Version Description
Download this release
Release Info
| Developer | gutenbergplugin |
| Plugin | |
| Version | 11.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 11.0.0 to 11.1.0
- build/a11y/index.js +4 -4
- build/a11y/index.min.asset.php +1 -1
- build/a11y/index.min.js +1 -1
- build/admin-manifest/index.js +253 -0
- build/admin-manifest/index.min.asset.php +1 -0
- build/admin-manifest/index.min.js +1 -0
- build/annotations/index.js +17 -17
- build/annotations/index.min.asset.php +1 -1
- build/annotations/index.min.js +1 -1
- build/api-fetch/index.js +4 -4
- build/api-fetch/index.min.asset.php +1 -1
- build/api-fetch/index.min.js +1 -1
- build/autop/index.js +2 -2
- build/autop/index.min.asset.php +1 -1
- build/autop/index.min.js +1 -1
- build/blob/index.js +2 -2
- build/blob/index.min.asset.php +1 -1
- build/blob/index.min.js +1 -1
- build/block-directory/index.js +63 -63
- build/block-directory/index.min.asset.php +1 -1
- build/block-directory/index.min.js +5 -5
- build/block-editor/index.js +10273 -11234
build/a11y/index.js
CHANGED
|
@@ -82,7 +82,7 @@ window["wp"] = window["wp"] || {}; window["wp"]["a11y"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
|
@@ -94,14 +94,14 @@ window["wp"] = window["wp"] || {}; window["wp"]["a11y"] =
|
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
-
/***/
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["domReady"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
-
/***/
|
| 105 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 106 |
|
| 107 |
"use strict";
|
|
@@ -113,7 +113,7 @@ __webpack_require__.d(__webpack_exports__, "setup", function() { return /* bindi
|
|
| 113 |
__webpack_require__.d(__webpack_exports__, "speak", function() { return /* binding */ speak; });
|
| 114 |
|
| 115 |
// EXTERNAL MODULE: external ["wp","domReady"]
|
| 116 |
-
var external_wp_domReady_ = __webpack_require__(
|
| 117 |
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_);
|
| 118 |
|
| 119 |
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 517);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
+
/***/ 324:
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["domReady"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
+
/***/ 517:
|
| 105 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 106 |
|
| 107 |
"use strict";
|
| 113 |
__webpack_require__.d(__webpack_exports__, "speak", function() { return /* binding */ speak; });
|
| 114 |
|
| 115 |
// EXTERNAL MODULE: external ["wp","domReady"]
|
| 116 |
+
var external_wp_domReady_ = __webpack_require__(324);
|
| 117 |
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_);
|
| 118 |
|
| 119 |
// EXTERNAL MODULE: external ["wp","i18n"]
|
build/a11y/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('wp-dom-ready', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('wp-dom-ready', 'wp-i18n', 'wp-polyfill'), 'version' => '0b26935dde8ba245b17a2843e523bb37');
|
build/a11y/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.a11y=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=
|
| 1 |
+
window.wp=window.wp||{},window.wp.a11y=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=517)}({1:function(t,e){t.exports=window.wp.i18n},324:function(t,e){t.exports=window.wp.domReady},517:function(t,e,n){"use strict";n.r(e),n.d(e,"setup",(function(){return p})),n.d(e,"speak",(function(){return u}));var o=n(324),i=n.n(o),r=n(1);function a(t="polite"){const e=document.createElement("div");e.id="a11y-speak-"+t,e.className="a11y-speak-region",e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("aria-live",t),e.setAttribute("aria-relevant","additions text"),e.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(e),e}let d="";function p(){const t=document.getElementById("a11y-speak-intro-text"),e=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===t&&function(){const t=document.createElement("p");t.id="a11y-speak-intro-text",t.className="a11y-speak-intro-text",t.textContent=Object(r.__)("Notifications"),t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("hidden","hidden");const{body:e}=document;e&&e.appendChild(t)}(),null===e&&a("assertive"),null===n&&a("polite")}function u(t,e){!function(){const t=document.getElementsByClassName("a11y-speak-region"),e=document.getElementById("a11y-speak-intro-text");for(let e=0;e<t.length;e++)t[e].textContent="";e&&e.setAttribute("hidden","hidden")}(),t=function(t){return t=t.replace(/<[^<>]+>/g," "),d===t&&(t+=" "),d=t,t}(t);const n=document.getElementById("a11y-speak-intro-text"),o=document.getElementById("a11y-speak-assertive"),i=document.getElementById("a11y-speak-polite");o&&"assertive"===e?o.textContent=t:i&&(i.textContent=t),n&&n.removeAttribute("hidden")}i()(p)}});
|
build/admin-manifest/index.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
window["wp"] = window["wp"] || {}; window["wp"]["adminManifest"] =
|
| 2 |
+
/******/ (function(modules) { // webpackBootstrap
|
| 3 |
+
/******/ // The module cache
|
| 4 |
+
/******/ var installedModules = {};
|
| 5 |
+
/******/
|
| 6 |
+
/******/ // The require function
|
| 7 |
+
/******/ function __webpack_require__(moduleId) {
|
| 8 |
+
/******/
|
| 9 |
+
/******/ // Check if module is in cache
|
| 10 |
+
/******/ if(installedModules[moduleId]) {
|
| 11 |
+
/******/ return installedModules[moduleId].exports;
|
| 12 |
+
/******/ }
|
| 13 |
+
/******/ // Create a new module (and put it into the cache)
|
| 14 |
+
/******/ var module = installedModules[moduleId] = {
|
| 15 |
+
/******/ i: moduleId,
|
| 16 |
+
/******/ l: false,
|
| 17 |
+
/******/ exports: {}
|
| 18 |
+
/******/ };
|
| 19 |
+
/******/
|
| 20 |
+
/******/ // Execute the module function
|
| 21 |
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
| 22 |
+
/******/
|
| 23 |
+
/******/ // Flag the module as loaded
|
| 24 |
+
/******/ module.l = true;
|
| 25 |
+
/******/
|
| 26 |
+
/******/ // Return the exports of the module
|
| 27 |
+
/******/ return module.exports;
|
| 28 |
+
/******/ }
|
| 29 |
+
/******/
|
| 30 |
+
/******/
|
| 31 |
+
/******/ // expose the modules object (__webpack_modules__)
|
| 32 |
+
/******/ __webpack_require__.m = modules;
|
| 33 |
+
/******/
|
| 34 |
+
/******/ // expose the module cache
|
| 35 |
+
/******/ __webpack_require__.c = installedModules;
|
| 36 |
+
/******/
|
| 37 |
+
/******/ // define getter function for harmony exports
|
| 38 |
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
| 39 |
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
| 40 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
| 41 |
+
/******/ }
|
| 42 |
+
/******/ };
|
| 43 |
+
/******/
|
| 44 |
+
/******/ // define __esModule on exports
|
| 45 |
+
/******/ __webpack_require__.r = function(exports) {
|
| 46 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
| 47 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
| 48 |
+
/******/ }
|
| 49 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
| 50 |
+
/******/ };
|
| 51 |
+
/******/
|
| 52 |
+
/******/ // create a fake namespace object
|
| 53 |
+
/******/ // mode & 1: value is a module id, require it
|
| 54 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
| 55 |
+
/******/ // mode & 4: return value when already ns object
|
| 56 |
+
/******/ // mode & 8|1: behave like require
|
| 57 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
| 58 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
| 59 |
+
/******/ if(mode & 8) return value;
|
| 60 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
| 61 |
+
/******/ var ns = Object.create(null);
|
| 62 |
+
/******/ __webpack_require__.r(ns);
|
| 63 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
| 64 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
| 65 |
+
/******/ return ns;
|
| 66 |
+
/******/ };
|
| 67 |
+
/******/
|
| 68 |
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
| 69 |
+
/******/ __webpack_require__.n = function(module) {
|
| 70 |
+
/******/ var getter = module && module.__esModule ?
|
| 71 |
+
/******/ function getDefault() { return module['default']; } :
|
| 72 |
+
/******/ function getModuleExports() { return module; };
|
| 73 |
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
| 74 |
+
/******/ return getter;
|
| 75 |
+
/******/ };
|
| 76 |
+
/******/
|
| 77 |
+
/******/ // Object.prototype.hasOwnProperty.call
|
| 78 |
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
| 79 |
+
/******/
|
| 80 |
+
/******/ // __webpack_public_path__
|
| 81 |
+
/******/ __webpack_require__.p = "";
|
| 82 |
+
/******/
|
| 83 |
+
/******/
|
| 84 |
+
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 367);
|
| 86 |
+
/******/ })
|
| 87 |
+
/************************************************************************/
|
| 88 |
+
/******/ ({
|
| 89 |
+
|
| 90 |
+
/***/ 367:
|
| 91 |
+
/***/ (function(module, exports) {
|
| 92 |
+
|
| 93 |
+
function addManifest(manifest) {
|
| 94 |
+
const link = document.createElement('link');
|
| 95 |
+
link.rel = 'manifest';
|
| 96 |
+
link.href = `data:application/manifest+json,${encodeURIComponent(JSON.stringify(manifest))}`;
|
| 97 |
+
document.head.appendChild(link);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
function addAppleTouchIcon(size, base64data) {
|
| 101 |
+
const iconLink = document.createElement('link');
|
| 102 |
+
iconLink.rel = 'apple-touch-icon';
|
| 103 |
+
iconLink.href = base64data;
|
| 104 |
+
iconLink.sizes = '180x180';
|
| 105 |
+
document.head.insertBefore(iconLink, document.head.firstElementChild);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
function createSvgElement(html) {
|
| 109 |
+
const doc = document.implementation.createHTMLDocument('');
|
| 110 |
+
doc.body.innerHTML = html;
|
| 111 |
+
const {
|
| 112 |
+
firstElementChild: svgElement
|
| 113 |
+
} = doc.body;
|
| 114 |
+
svgElement.setAttribute('viewBox', '0 0 80 80');
|
| 115 |
+
return svgElement;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
function createIcon({
|
| 119 |
+
svgElement,
|
| 120 |
+
size,
|
| 121 |
+
color,
|
| 122 |
+
backgroundColor,
|
| 123 |
+
circle
|
| 124 |
+
}) {
|
| 125 |
+
return new Promise(resolve => {
|
| 126 |
+
const canvas = document.createElement('canvas');
|
| 127 |
+
const context = canvas.getContext('2d'); // Leave 1/8th padding around the logo.
|
| 128 |
+
|
| 129 |
+
const padding = size / 8; // Which leaves 3/4ths of space for the icon.
|
| 130 |
+
|
| 131 |
+
const logoSize = padding * 6; // Resize the SVG logo.
|
| 132 |
+
|
| 133 |
+
svgElement.setAttribute('width', logoSize);
|
| 134 |
+
svgElement.setAttribute('height', logoSize); // Color in the background.
|
| 135 |
+
|
| 136 |
+
svgElement.querySelectorAll('path').forEach(path => {
|
| 137 |
+
path.setAttribute('fill', backgroundColor);
|
| 138 |
+
}); // Resize the canvas.
|
| 139 |
+
|
| 140 |
+
canvas.width = size;
|
| 141 |
+
canvas.height = size; // If we're not drawing a circle, set the background color.
|
| 142 |
+
|
| 143 |
+
if (!circle) {
|
| 144 |
+
context.fillStyle = backgroundColor;
|
| 145 |
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
| 146 |
+
} // Fill in the letter (W) and circle around it.
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
context.fillStyle = color;
|
| 150 |
+
context.beginPath();
|
| 151 |
+
context.arc(size / 2, size / 2, logoSize / 2 - 1, 0, 2 * Math.PI);
|
| 152 |
+
context.closePath();
|
| 153 |
+
context.fill(); // Create a URL for the SVG to load in an image element.
|
| 154 |
+
|
| 155 |
+
const svgBlob = new window.Blob([svgElement.outerHTML], {
|
| 156 |
+
type: 'image/svg+xml'
|
| 157 |
+
});
|
| 158 |
+
const url = URL.createObjectURL(svgBlob);
|
| 159 |
+
const image = document.createElement('img');
|
| 160 |
+
image.src = url;
|
| 161 |
+
image.width = logoSize;
|
| 162 |
+
image.height = logoSize;
|
| 163 |
+
|
| 164 |
+
image.onload = () => {
|
| 165 |
+
// Once the image is loaded, draw it onto the canvas.
|
| 166 |
+
context.drawImage(image, padding, padding); // Export it to a blob.
|
| 167 |
+
|
| 168 |
+
canvas.toBlob(imageBlob => {
|
| 169 |
+
// We no longer need the SVG blob url.
|
| 170 |
+
URL.revokeObjectURL(url); // Unfortunately blob URLs don't seem to work, so we have to use
|
| 171 |
+
// base64 encoded data URLs.
|
| 172 |
+
|
| 173 |
+
const reader = new window.FileReader();
|
| 174 |
+
reader.readAsDataURL(imageBlob);
|
| 175 |
+
|
| 176 |
+
reader.onloadend = () => {
|
| 177 |
+
resolve(reader.result);
|
| 178 |
+
};
|
| 179 |
+
});
|
| 180 |
+
};
|
| 181 |
+
});
|
| 182 |
+
} // eslint-disable-next-line @wordpress/no-global-event-listener
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
window.addEventListener('load', () => {
|
| 186 |
+
if (!('serviceWorker' in window.navigator)) {
|
| 187 |
+
return;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
const {
|
| 191 |
+
logo,
|
| 192 |
+
siteTitle,
|
| 193 |
+
adminUrl
|
| 194 |
+
} = window.wpAdminManifestL10n;
|
| 195 |
+
const manifest = {
|
| 196 |
+
name: siteTitle,
|
| 197 |
+
display: 'standalone',
|
| 198 |
+
orientation: 'portrait',
|
| 199 |
+
start_url: adminUrl,
|
| 200 |
+
// Open front-end, login page, and any external URLs in a browser
|
| 201 |
+
// modal.
|
| 202 |
+
scope: adminUrl,
|
| 203 |
+
icons: []
|
| 204 |
+
};
|
| 205 |
+
const adminBar = document.getElementById('wpadminbar');
|
| 206 |
+
const {
|
| 207 |
+
color,
|
| 208 |
+
backgroundColor
|
| 209 |
+
} = window.getComputedStyle(adminBar);
|
| 210 |
+
const svgElement = createSvgElement(logo);
|
| 211 |
+
Promise.all([// The maskable icon should have its background filled. This is used
|
| 212 |
+
// for iOS. To do: check which sizes are really needed.
|
| 213 |
+
...[180, 192, 512].map(size => createIcon({
|
| 214 |
+
svgElement,
|
| 215 |
+
size,
|
| 216 |
+
color,
|
| 217 |
+
backgroundColor
|
| 218 |
+
}).then(base64data => {
|
| 219 |
+
manifest.icons.push({
|
| 220 |
+
src: base64data,
|
| 221 |
+
sizes: size + 'x' + size,
|
| 222 |
+
type: 'image/png',
|
| 223 |
+
purpose: 'maskable'
|
| 224 |
+
}); // iOS doesn't seem to look at the manifest.
|
| 225 |
+
|
| 226 |
+
if (size === 180) {
|
| 227 |
+
addAppleTouchIcon(size, base64data);
|
| 228 |
+
}
|
| 229 |
+
})), // The "normal" icon should be round. This is used for Chrome
|
| 230 |
+
// Desktop PWAs. To do: check which sizes are really needed.
|
| 231 |
+
...[180, 192, 512].map(size => createIcon({
|
| 232 |
+
svgElement,
|
| 233 |
+
size,
|
| 234 |
+
color,
|
| 235 |
+
backgroundColor,
|
| 236 |
+
circle: true
|
| 237 |
+
}).then(base64data => {
|
| 238 |
+
manifest.icons.push({
|
| 239 |
+
src: base64data,
|
| 240 |
+
sizes: size + 'x' + size,
|
| 241 |
+
type: 'image/png',
|
| 242 |
+
purpose: 'any'
|
| 243 |
+
});
|
| 244 |
+
}))]).then(() => {
|
| 245 |
+
addManifest(manifest);
|
| 246 |
+
window.navigator.serviceWorker.register(adminUrl + '?service-worker');
|
| 247 |
+
});
|
| 248 |
+
});
|
| 249 |
+
//# sourceMappingURL=index.js.map
|
| 250 |
+
|
| 251 |
+
/***/ })
|
| 252 |
+
|
| 253 |
+
/******/ });
|
build/admin-manifest/index.min.asset.php
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '23d4bcb51176c98aa658b2c1629e6531');
|
build/admin-manifest/index.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
window.wp=window.wp||{},window.wp.adminManifest=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=367)}({367:function(e,t){function n({svgElement:e,size:t,color:n,backgroundColor:o,circle:r}){return new Promise(i=>{const l=document.createElement("canvas"),a=l.getContext("2d"),c=t/8,d=6*c;e.setAttribute("width",d),e.setAttribute("height",d),e.querySelectorAll("path").forEach(e=>{e.setAttribute("fill",o)}),l.width=t,l.height=t,r||(a.fillStyle=o,a.fillRect(0,0,l.width,l.height)),a.fillStyle=n,a.beginPath(),a.arc(t/2,t/2,d/2-1,0,2*Math.PI),a.closePath(),a.fill();const s=new window.Blob([e.outerHTML],{type:"image/svg+xml"}),u=URL.createObjectURL(s),m=document.createElement("img");m.src=u,m.width=d,m.height=d,m.onload=()=>{a.drawImage(m,c,c),l.toBlob(e=>{URL.revokeObjectURL(u);const t=new window.FileReader;t.readAsDataURL(e),t.onloadend=()=>{i(t.result)}})}})}window.addEventListener("load",()=>{if(!("serviceWorker"in window.navigator))return;const{logo:e,siteTitle:t,adminUrl:o}=window.wpAdminManifestL10n,r={name:t,display:"standalone",orientation:"portrait",start_url:o,scope:o,icons:[]},i=document.getElementById("wpadminbar"),{color:l,backgroundColor:a}=window.getComputedStyle(i),c=function(e){const t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;const{firstElementChild:n}=t.body;return n.setAttribute("viewBox","0 0 80 80"),n}(e);Promise.all([...[180,192,512].map(e=>n({svgElement:c,size:e,color:l,backgroundColor:a}).then(t=>{r.icons.push({src:t,sizes:e+"x"+e,type:"image/png",purpose:"maskable"}),180===e&&function(e,t){const n=document.createElement("link");n.rel="apple-touch-icon",n.href=t,n.sizes="180x180",document.head.insertBefore(n,document.head.firstElementChild)}(0,t)})),...[180,192,512].map(e=>n({svgElement:c,size:e,color:l,backgroundColor:a,circle:!0}).then(t=>{r.icons.push({src:t,sizes:e+"x"+e,type:"image/png",purpose:"any"})}))]).then(()=>{!function(e){const t=document.createElement("link");t.rel="manifest",t.href="data:application/manifest+json,"+encodeURIComponent(JSON.stringify(e)),document.head.appendChild(t)}(r),window.navigator.serviceWorker.register(o+"?service-worker")})})}});
|
build/annotations/index.js
CHANGED
|
@@ -82,7 +82,7 @@ window["wp"] = window["wp"] || {}; window["wp"]["annotations"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
|
@@ -94,14 +94,21 @@ window["wp"] = window["wp"] || {}; window["wp"]["annotations"] =
|
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
-
/***/
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["richText"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
-
/***/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 106 |
|
| 107 |
"use strict";
|
|
@@ -190,21 +197,14 @@ function v4(options, buf, offset) {
|
|
| 190 |
|
| 191 |
/***/ }),
|
| 192 |
|
| 193 |
-
/***/
|
| 194 |
-
/***/ (function(module, exports) {
|
| 195 |
-
|
| 196 |
-
(function() { module.exports = window["lodash"]; }());
|
| 197 |
-
|
| 198 |
-
/***/ }),
|
| 199 |
-
|
| 200 |
-
/***/ 20:
|
| 201 |
/***/ (function(module, exports) {
|
| 202 |
|
| 203 |
(function() { module.exports = window["wp"]["hooks"]; }());
|
| 204 |
|
| 205 |
/***/ }),
|
| 206 |
|
| 207 |
-
/***/
|
| 208 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 209 |
|
| 210 |
"use strict";
|
|
@@ -493,7 +493,7 @@ function isShallowEqual( a, b, fromIndex ) {
|
|
| 493 |
|
| 494 |
/***/ }),
|
| 495 |
|
| 496 |
-
/***/
|
| 497 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 498 |
|
| 499 |
"use strict";
|
|
@@ -520,7 +520,7 @@ __webpack_require__.d(actions_namespaceObject, "__experimentalUpdateAnnotationRa
|
|
| 520 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotationsBySource", function() { return __experimentalRemoveAnnotationsBySource; });
|
| 521 |
|
| 522 |
// EXTERNAL MODULE: external ["wp","richText"]
|
| 523 |
-
var external_wp_richText_ = __webpack_require__(
|
| 524 |
|
| 525 |
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 526 |
var external_wp_i18n_ = __webpack_require__(1);
|
|
@@ -740,7 +740,7 @@ const {
|
|
| 740 |
Object(external_wp_richText_["registerFormatType"])(format_name, settings);
|
| 741 |
//# sourceMappingURL=index.js.map
|
| 742 |
// EXTERNAL MODULE: external ["wp","hooks"]
|
| 743 |
-
var external_wp_hooks_ = __webpack_require__(
|
| 744 |
|
| 745 |
// EXTERNAL MODULE: external ["wp","data"]
|
| 746 |
var external_wp_data_ = __webpack_require__(4);
|
|
@@ -886,7 +886,7 @@ function reducer_annotations(state = {}, action) {
|
|
| 886 |
/* harmony default export */ var reducer = (reducer_annotations);
|
| 887 |
//# sourceMappingURL=reducer.js.map
|
| 888 |
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
|
| 889 |
-
var rememo = __webpack_require__(
|
| 890 |
|
| 891 |
// CONCATENATED MODULE: ./packages/annotations/build-module/store/selectors.js
|
| 892 |
/**
|
|
@@ -976,7 +976,7 @@ function __experimentalGetAnnotations(state) {
|
|
| 976 |
}
|
| 977 |
//# sourceMappingURL=selectors.js.map
|
| 978 |
// EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
|
| 979 |
-
var v4 = __webpack_require__(
|
| 980 |
|
| 981 |
// CONCATENATED MODULE: ./packages/annotations/build-module/store/actions.js
|
| 982 |
/**
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 508);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
+
/***/ 17:
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["richText"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
+
/***/ 2:
|
| 105 |
+
/***/ (function(module, exports) {
|
| 106 |
+
|
| 107 |
+
(function() { module.exports = window["lodash"]; }());
|
| 108 |
+
|
| 109 |
+
/***/ }),
|
| 110 |
+
|
| 111 |
+
/***/ 200:
|
| 112 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 113 |
|
| 114 |
"use strict";
|
| 197 |
|
| 198 |
/***/ }),
|
| 199 |
|
| 200 |
+
/***/ 21:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
/***/ (function(module, exports) {
|
| 202 |
|
| 203 |
(function() { module.exports = window["wp"]["hooks"]; }());
|
| 204 |
|
| 205 |
/***/ }),
|
| 206 |
|
| 207 |
+
/***/ 30:
|
| 208 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 209 |
|
| 210 |
"use strict";
|
| 493 |
|
| 494 |
/***/ }),
|
| 495 |
|
| 496 |
+
/***/ 508:
|
| 497 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 498 |
|
| 499 |
"use strict";
|
| 520 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotationsBySource", function() { return __experimentalRemoveAnnotationsBySource; });
|
| 521 |
|
| 522 |
// EXTERNAL MODULE: external ["wp","richText"]
|
| 523 |
+
var external_wp_richText_ = __webpack_require__(17);
|
| 524 |
|
| 525 |
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 526 |
var external_wp_i18n_ = __webpack_require__(1);
|
| 740 |
Object(external_wp_richText_["registerFormatType"])(format_name, settings);
|
| 741 |
//# sourceMappingURL=index.js.map
|
| 742 |
// EXTERNAL MODULE: external ["wp","hooks"]
|
| 743 |
+
var external_wp_hooks_ = __webpack_require__(21);
|
| 744 |
|
| 745 |
// EXTERNAL MODULE: external ["wp","data"]
|
| 746 |
var external_wp_data_ = __webpack_require__(4);
|
| 886 |
/* harmony default export */ var reducer = (reducer_annotations);
|
| 887 |
//# sourceMappingURL=reducer.js.map
|
| 888 |
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
|
| 889 |
+
var rememo = __webpack_require__(30);
|
| 890 |
|
| 891 |
// CONCATENATED MODULE: ./packages/annotations/build-module/store/selectors.js
|
| 892 |
/**
|
| 976 |
}
|
| 977 |
//# sourceMappingURL=selectors.js.map
|
| 978 |
// EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
|
| 979 |
+
var v4 = __webpack_require__(200);
|
| 980 |
|
| 981 |
// CONCATENATED MODULE: ./packages/annotations/build-module/store/actions.js
|
| 982 |
/**
|
build/annotations/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('lodash', 'wp-data', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'wp-rich-text'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('lodash', 'wp-data', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'wp-rich-text'), 'version' => 'ba9367ba02fb641f3a094f92282b4ffe');
|
build/annotations/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.annotations=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=
|
| 1 |
+
window.wp=window.wp||{},window.wp.annotations=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=508)}({1:function(t,e){t.exports=window.wp.i18n},17:function(t,e){t.exports=window.wp.richText},2:function(t,e){t.exports=window.lodash},200:function(t,e,n){"use strict";var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function a(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}for(var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,u=function(t){return"string"==typeof t&&i.test(t)},c=[],l=0;l<256;++l)c.push((l+256).toString(16).substr(1));e.a=function(t,e,n){var r=(t=t||{}).random||(t.rng||a)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase();if(!u(n))throw TypeError("Stringified UUID is invalid");return n}(r)}},21:function(t,e){t.exports=window.wp.hooks},30:function(t,e,n){"use strict";var r,o;function a(t){return[t]}function i(){var t={clear:function(){t.head=null}};return t}function u(t,e,n){var r;if(t.length!==e.length)return!1;for(r=n;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,e.a=function(t,e){var n,c;function l(){n=o?new WeakMap:i()}function s(){var n,r,o,a,i,l=arguments.length;for(a=new Array(l),o=0;o<l;o++)a[o]=arguments[o];for(i=e.apply(null,a),(n=c(i)).isUniqueByDependants||(n.lastDependants&&!u(i,n.lastDependants,0)&&n.clear(),n.lastDependants=i),r=n.head;r;){if(u(r.args,a,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:t.apply(null,a)},a[0]=null,r.args=a,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return e||(e=a),c=o?function(t){var e,o,a,u,c,l=n,s=!0;for(e=0;e<t.length;e++){if(!(c=o=t[e])||"object"!=typeof c){s=!1;break}l.has(o)?l=l.get(o):(a=new WeakMap,l.set(o,a),l=a)}return l.has(r)||((u=i()).isUniqueByDependants=s,l.set(r,u)),l.get(r)}:function(){return n},s.getDependants=e,s.clear=l,l(),s}},4:function(t,e){t.exports=window.wp.data},508:function(t,e,n){"use strict";n.r(e),n.d(e,"store",(function(){return T}));var r={};n.r(r),n.d(r,"__experimentalGetAnnotationsForBlock",(function(){return b})),n.d(r,"__experimentalGetAllAnnotationsForBlock",(function(){return x})),n.d(r,"__experimentalGetAnnotationsForRichText",(function(){return _})),n.d(r,"__experimentalGetAnnotations",(function(){return h}));var o={};n.r(o),n.d(o,"__experimentalAddAnnotation",(function(){return O})),n.d(o,"__experimentalRemoveAnnotation",(function(){return y})),n.d(o,"__experimentalUpdateAnnotationRange",(function(){return w})),n.d(o,"__experimentalRemoveAnnotationsBySource",(function(){return N}));var a=n(17),i=n(1);const u="core/annotations",c={name:"core/annotation",title:Object(i.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(u).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach(e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const o="annotation-text-"+e.source,i="annotation-text-"+e.id;t=Object(a.applyFormat)(t,{type:"core/annotation",attributes:{className:o,id:i}},n,r)}),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(u).__experimentalRemoveAnnotation,updateAnnotationRange:t(u).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach((t,n)=>{(t=(t=t||[]).filter(t=>"core/annotation"===t.type)).forEach(t=>{let{id:r}=t.attributes;r=r.replace("annotation-text-",""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1})}),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach(t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)})}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:l,...s}=c;Object(a.registerFormatType)(l,s);var d=n(21),f=n(4);Object(d.addFilter)("editor.BlockListBlock","core/annotations",t=>Object(f.withSelect)((t,{clientId:e,className:n})=>({className:t(u).__experimentalGetAnnotationsForBlock(e).map(t=>"is-annotated-by-"+t.source).concat(n).filter(Boolean).join(" ")}))(t));var p=n(2);function v(t,e){const n=t.filter(e);return t.length===n.length?t:n}var m=n(30);const g=[],b=Object(m.a)((t,e)=>{var n;return(null!==(n=null==t?void 0:t[e])&&void 0!==n?n:[]).filter(t=>"block"===t.selector)},(t,e)=>{var n;return[null!==(n=null==t?void 0:t[e])&&void 0!==n?n:g]});function x(t,e){var n;return null!==(n=null==t?void 0:t[e])&&void 0!==n?n:g}const _=Object(m.a)((t,e,n)=>{var r;return(null!==(r=null==t?void 0:t[e])&&void 0!==r?r:[]).filter(t=>"range"===t.selector&&n===t.richTextIdentifier).map(t=>{const{range:e,...n}=t;return{...e,...n}})},(t,e)=>{var n;return[null!==(n=null==t?void 0:t[e])&&void 0!==n?n:g]});function h(t){return Object(p.flatMap)(t,t=>t)}var A=n(200);function O({blockClientId:t,richTextIdentifier:e=null,range:n=null,selector:r="range",source:o="default",id:a=Object(A.a)()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:t,richTextIdentifier:e,source:o,selector:r};return"range"===r&&(i.range=n),i}function y(t){return{type:"ANNOTATION_REMOVE",annotationId:t}}function w(t,e,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:t,start:e,end:n}}function N(t){return{type:"ANNOTATION_REMOVE_SOURCE",source:t}}const T=Object(f.createReduxStore)(u,{reducer:function(t={},e){var n,r;switch(e.type){case"ANNOTATION_ADD":const o=e.blockClientId,a={id:e.id,blockClientId:o,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===a.selector&&(r=a.range,!(Object(p.isNumber)(r.start)&&Object(p.isNumber)(r.end)&&r.start<=r.end)))return t;const i=null!==(n=null==t?void 0:t[o])&&void 0!==n?n:[];return{...t,[o]:[...i,a]};case"ANNOTATION_REMOVE":return Object(p.mapValues)(t,t=>v(t,t=>t.id!==e.annotationId));case"ANNOTATION_UPDATE_RANGE":return Object(p.mapValues)(t,t=>{let n=!1;const r=t.map(t=>t.id===e.annotationId?(n=!0,{...t,range:{start:e.start,end:e.end}}):t);return n?r:t});case"ANNOTATION_REMOVE_SOURCE":return Object(p.mapValues)(t,t=>v(t,t=>t.source!==e.source))}return t},selectors:r,actions:o});Object(f.register)(T)}});
|
build/api-fetch/index.js
CHANGED
|
@@ -82,7 +82,7 @@ window["wp"] = window["wp"] || {}; window["wp"]["apiFetch"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
|
@@ -94,14 +94,14 @@ window["wp"] = window["wp"] || {}; window["wp"]["apiFetch"] =
|
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
-
/***/
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["url"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
-
/***/
|
| 105 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 106 |
|
| 107 |
"use strict";
|
|
@@ -283,7 +283,7 @@ function createPreloadingMiddleware(preloadedData) {
|
|
| 283 |
/* harmony default export */ var preloading = (createPreloadingMiddleware);
|
| 284 |
//# sourceMappingURL=preloading.js.map
|
| 285 |
// EXTERNAL MODULE: external ["wp","url"]
|
| 286 |
-
var external_wp_url_ = __webpack_require__(
|
| 287 |
|
| 288 |
// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/fetch-all-middleware.js
|
| 289 |
/**
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 507);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
|
| 97 |
+
/***/ 20:
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["url"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
| 103 |
|
| 104 |
+
/***/ 507:
|
| 105 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 106 |
|
| 107 |
"use strict";
|
| 283 |
/* harmony default export */ var preloading = (createPreloadingMiddleware);
|
| 284 |
//# sourceMappingURL=preloading.js.map
|
| 285 |
// EXTERNAL MODULE: external ["wp","url"]
|
| 286 |
+
var external_wp_url_ = __webpack_require__(20);
|
| 287 |
|
| 288 |
// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/fetch-all-middleware.js
|
| 289 |
/**
|
build/api-fetch/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'a767c9a08662f51c39fca6b8bf0e6d4e');
|
build/api-fetch/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.apiFetch=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=
|
| 1 |
+
window.wp=window.wp||{},window.wp.apiFetch=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=507)}({1:function(e,t){e.exports=window.wp.i18n},20:function(e,t){e.exports=window.wp.url},507:function(e,t,r){"use strict";r.r(t);var n=r(1),o=(e,t)=>{let r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),o=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:o})};function a(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map(e=>e.split("=")).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e.join("=")).join("&"):n}var s=r(20);const c=({path:e,url:t,...r},n)=>({...r,url:t&&Object(s.addQueryArgs)(t,n),path:e&&Object(s.addQueryArgs)(e,n)}),i=e=>e.json?e.json():Promise.reject(e),u=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t};var p=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await O({...c(e,{per_page:100}),parse:!1}),n=await i(r);if(!Array.isArray(n))return n;let o=u(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await O({...e,path:void 0,url:o,parse:!1}),r=await i(t);a=a.concat(r),o=u(t)}return a};const d=new Set(["PATCH","PUT","DELETE"]),l="GET",f=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch(e=>h(e,t));function h(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:Object(n.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})})(e).then(e=>{const t={code:"unknown_error",message:Object(n.__)("An unknown error occurred.")};throw e||t})}const w={Accept:"application/json, */*;q=0.1"},m={credentials:"include"},y=[(e,t)=>("string"!=typeof e.url||Object(s.hasQueryArg)(e.url,"_locale")||(e.url=Object(s.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||Object(s.hasQueryArg)(e.path,"_locale")||(e.path=Object(s.addQueryArgs)(e.path,{_locale:"user"})),t(e)),o,(e,t)=>{const{method:r=l}=e;return d.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},p],g=e=>{if(e.status>=200&&e.status<300)return e;throw e};let j=e=>{const{url:t,path:r,data:o,parse:a=!0,...s}=e;let{body:c,headers:i}=e;return i={...w,...i},o&&(c=JSON.stringify(o),i["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...m,...s,body:c,headers:i}).then(e=>Promise.resolve(e).then(g).catch(e=>h(e,a)).then(e=>f(e,a)),e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:Object(n.__)("You are probably offline.")}})};function b(e){return y.reduceRight((e,t)=>r=>t(r,e),j)(e).catch(t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(b.nonceEndpoint).then(g).then(e=>e.text()).then(t=>(b.nonceMiddleware.nonce=t,b(e))))}b.use=function(e){y.unshift(e)},b.setFetchHandler=function(e){j=e},b.createNonceMiddleware=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const o in n)if("x-wp-nonce"===o.toLowerCase()&&n[o]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t},b.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce((t,r)=>(t[a(r)]=e[r],t),{});return(e,r)=>{const{parse:n=!0}=e;if("string"==typeof e.path){const r=e.method||"GET",o=a(e.path);if("GET"===r&&t[o]){const e=t[o];return delete t[o],Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}if("OPTIONS"===r&&t[r]&&t[r][o])return Promise.resolve(n?t[r][o].body:t[r][o])}return r(e)}},b.createRootURLMiddleware=e=>(t,r)=>o(t,t=>{let n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r({...t,url:o})}),b.fetchAllMiddleware=p,b.mediaUploadMiddleware=(e,t)=>{if(!(e.path&&-1!==e.path.indexOf("/wp/v2/media")||e.url&&-1!==e.url.indexOf("/wp/v2/media")))return t(e);let r=0;const o=e=>(r++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<5?o(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(t=>{const r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?o(r).catch(()=>!1!==e.parse?Promise.reject({code:"post_process",message:Object(n.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t)):h(t,e.parse)}).then(t=>f(t,e.parse))};var O=t.default=b}}).default;
|
build/autop/index.js
CHANGED
|
@@ -82,12 +82,12 @@ window["wp"] = window["wp"] || {}; window["wp"]["autop"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 89 |
|
| 90 |
-
/***/
|
| 91 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 92 |
|
| 93 |
"use strict";
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 368);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 89 |
|
| 90 |
+
/***/ 368:
|
| 91 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 92 |
|
| 93 |
"use strict";
|
build/autop/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '3db69a429f6838e19cbe35304023f9e2');
|
build/autop/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.autop=function(e){var n={};function r(p){if(n[p])return n[p].exports;var t=n[p]={i:p,l:!1,exports:{}};return e[p].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=e,r.c=n,r.d=function(e,n,p){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:p})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var p=Object.create(null);if(r.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)r.d(p,t,function(n){return e[n]}.bind(null,t));return p},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=
|
| 1 |
+
window.wp=window.wp||{},window.wp.autop=function(e){var n={};function r(p){if(n[p])return n[p].exports;var t=n[p]={i:p,l:!1,exports:{}};return e[p].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=e,r.c=n,r.d=function(e,n,p){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:p})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var p=Object.create(null);if(r.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)r.d(p,t,function(n){return e[n]}.bind(null,t));return p},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=368)}({368:function(e,n,r){"use strict";r.r(n),r.d(n,"autop",(function(){return t})),r.d(n,"removep",(function(){return c}));const p=new RegExp("(<((?=!--|!\\[CDATA\\[)((?=!-)!(?:-(?!->)[^\\-]*)*(?:--\x3e)?|!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?)|[^>]*>?))");function t(e,n=!0){const r=[];if(""===e.trim())return"";if(-1!==(e+="\n").indexOf("<pre")){const n=e.split("</pre>"),p=n.pop();e="";for(let p=0;p<n.length;p++){const t=n[p],c=t.indexOf("<pre");if(-1===c){e+=t;continue}const l="<pre wp-pre-tag-"+p+"></pre>";r.push([l,t.substr(c)+"</pre>"]),e+=t.substr(0,c)+l}e+=p}const t="(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";-1!==(e=function(e,n){const r=function(e){const n=[];let r,t=e;for(;r=t.match(p);){const e=r.index;n.push(t.slice(0,e)),n.push(r[0]),t=t.slice(e+r[0].length)}return t.length&&n.push(t),n}(e);let t=!1;const c=Object.keys(n);for(let e=1;e<r.length;e+=2)for(let p=0;p<c.length;p++){const l=c[p];if(-1!==r[e].indexOf(l)){r[e]=r[e].replace(new RegExp(l,"g"),n[l]),t=!0;break}}return t&&(e=r.join("")),e}(e=(e=(e=(e=e.replace(/<br\s*\/?>\s*<br\s*\/?>/g,"\n\n")).replace(new RegExp("(<"+t+"[\\s/>])","g"),"\n\n$1")).replace(new RegExp("(</"+t+">)","g"),"$1\n\n")).replace(/\r\n|\r/g,"\n"),{"\n":" \x3c!-- wpnl --\x3e "})).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"<option")).replace(/<\/option>\s*/g,"</option>")),-1!==e.indexOf("</object>")&&(e=(e=(e=e.replace(/(<object[^>]*>)\s*/g,"$1")).replace(/\s*<\/object>/g,"</object>")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),-1===e.indexOf("<source")&&-1===e.indexOf("<track")||(e=(e=(e=e.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g,"$1")).replace(/\s*([<\[]\/(?:audio|video)[>\]])/g,"$1")).replace(/\s*(<(?:source|track)[^>]*>)\s*/g,"$1")),-1!==e.indexOf("<figcaption")&&(e=(e=e.replace(/\s*(<figcaption[^>]*>)/,"$1")).replace(/<\/figcaption>\s*/,"</figcaption>"));const c=(e=e.replace(/\n\n+/g,"\n\n")).split(/\n\s*\n/).filter(Boolean);return e="",c.forEach(n=>{e+="<p>"+n.replace(/^\n*|\n*$/g,"")+"</p>\n"}),e=(e=(e=(e=(e=(e=(e=(e=e.replace(/<p>\s*<\/p>/g,"")).replace(/<p>([^<]+)<\/(div|address|form)>/g,"<p>$1</p></$2>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)\\s*</p>","g"),"$1")).replace(/<p>(<li.+?)<\/p>/g,"$1")).replace(/<p><blockquote([^>]*)>/gi,"<blockquote$1><p>")).replace(/<\/blockquote><\/p>/g,"</p></blockquote>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)","g"),"$1")).replace(new RegExp("(</?"+t+"[^>]*>)\\s*</p>","g"),"$1"),n&&(e=(e=(e=(e=e.replace(/<(script|style).*?<\/\\1>/g,e=>e[0].replace(/\n/g,"<WPPreserveNewline />"))).replace(/<br>|<br\/>/g,"<br />")).replace(/(<br \/>)?\s*\n/g,(e,n)=>n?e:"<br />\n")).replace(/<WPPreserveNewline \/>/g,"\n")),e=(e=(e=e.replace(new RegExp("(</?"+t+"[^>]*>)\\s*<br />","g"),"$1")).replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,"$1")).replace(/\n<\/p>$/g,"</p>"),r.forEach(n=>{const[r,p]=n;e=e.replace(r,p)}),-1!==e.indexOf("\x3c!-- wpnl --\x3e")&&(e=e.replace(/\s?<!-- wpnl -->\s?/g,"\n")),e}function c(e){const n="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",r=n+"|div|p",p=n+"|pre",t=[];let c=!1,l=!1;return e?(-1===e.indexOf("<script")&&-1===e.indexOf("<style")||(e=e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,e=>(t.push(e),"<wp-preserve>"))),-1!==e.indexOf("<pre")&&(c=!0,e=e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g,e=>(e=(e=e.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/\r?\n/g,"<wp-line-break>"))),-1!==e.indexOf("[caption")&&(l=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,e=>e.replace(/<br([^>]*)>/g,"<wp-temp-br$1>").replace(/[\r\n\t]+/,""))),-1!==(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(new RegExp("\\s*</("+r+")>\\s*","g"),"</$1>\n")).replace(new RegExp("\\s*<((?:"+r+")(?: [^>]*)?)>","g"),"\n<$1>")).replace(/(<p [^>]+>[\s\S]*?)<\/p>/g,"$1</p#>")).replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n")).replace(/\s*<p>/gi,"")).replace(/\s*<\/p>\s*/gi,"\n\n")).replace(/\n[\s\u00a0]+\n/g,"\n\n")).replace(/(\s*)<br ?\/?>\s*/gi,(e,n)=>n&&-1!==n.indexOf("\n")?"\n\n":"\n")).replace(/\s*<div/g,"\n<div")).replace(/<\/div>\s*/g,"</div>\n")).replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n")).replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption")).replace(new RegExp("\\s*<((?:"+p+")(?: [^>]*)?)\\s*>","g"),"\n<$1>")).replace(new RegExp("\\s*</("+p+")>\\s*","g"),"</$1>\n")).replace(/<((li|dt|dd)[^>]*)>/g," \t<$1>")).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"\n<option")).replace(/\s*<\/select>/g,"\n</select>")),-1!==e.indexOf("<hr")&&(e=e.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")),-1!==e.indexOf("<object")&&(e=e.replace(/<object[\s\S]+?<\/object>/g,e=>e.replace(/[\r\n]+/g,""))),e=(e=(e=(e=e.replace(/<\/p#>/g,"</p>\n")).replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1")).replace(/^\s+/,"")).replace(/[\s\u00a0]+$/,""),c&&(e=e.replace(/<wp-line-break>/g,"\n")),l&&(e=e.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),t.length&&(e=e.replace(/<wp-preserve>/g,()=>t.shift())),e):""}}});
|
build/blob/index.js
CHANGED
|
@@ -82,12 +82,12 @@ window["wp"] = window["wp"] || {}; window["wp"]["blob"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 89 |
|
| 90 |
-
/***/
|
| 91 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 92 |
|
| 93 |
"use strict";
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 369);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 89 |
|
| 90 |
+
/***/ 369:
|
| 91 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 92 |
|
| 93 |
"use strict";
|
build/blob/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '518e41473b76044dd1254a076ae7c32c');
|
build/blob/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.blob=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=
|
| 1 |
+
window.wp=window.wp||{},window.wp.blob=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=369)}({369:function(e,n,t){"use strict";t.r(n),t.d(n,"createBlobURL",(function(){return i})),t.d(n,"getBlobByURL",(function(){return c})),t.d(n,"getBlobTypeByURL",(function(){return f})),t.d(n,"revokeBlobURL",(function(){return l})),t.d(n,"isBlobURL",(function(){return d}));const{createObjectURL:r,revokeObjectURL:o}=window.URL,u={};function i(e){const n=r(e);return u[n]=e,n}function c(e){return u[e]}function f(e){var n;return null===(n=c(e))||void 0===n?void 0:n.type.split("/")[0]}function l(e){u[e]&&o(e),delete u[e]}function d(e){return!(!e||!e.indexOf)&&0===e.indexOf("blob:")}}});
|
build/block-directory/index.js
CHANGED
|
@@ -82,7 +82,7 @@ window["wp"] = window["wp"] || {}; window["wp"]["blockDirectory"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
|
@@ -140,14 +140,14 @@ function Icon({
|
|
| 140 |
|
| 141 |
/***/ }),
|
| 142 |
|
| 143 |
-
/***/
|
| 144 |
/***/ (function(module, exports) {
|
| 145 |
|
| 146 |
(function() { module.exports = window["wp"]["coreData"]; }());
|
| 147 |
|
| 148 |
/***/ }),
|
| 149 |
|
| 150 |
-
/***/
|
| 151 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 152 |
|
| 153 |
"use strict";
|
|
@@ -161,18 +161,25 @@ function Icon({
|
|
| 161 |
* WordPress dependencies
|
| 162 |
*/
|
| 163 |
|
| 164 |
-
const
|
| 165 |
xmlns: "http://www.w3.org/2000/svg",
|
| 166 |
viewBox: "0 0 24 24"
|
| 167 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 168 |
-
d: "
|
| 169 |
}));
|
| 170 |
-
/* harmony default export */ __webpack_exports__["a"] = (
|
| 171 |
-
//# sourceMappingURL=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
/***/ }),
|
| 174 |
|
| 175 |
-
/***/
|
| 176 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 177 |
|
| 178 |
"use strict";
|
|
@@ -186,20 +193,18 @@ const starFilled = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["creat
|
|
| 186 |
* WordPress dependencies
|
| 187 |
*/
|
| 188 |
|
| 189 |
-
const
|
| 190 |
xmlns: "http://www.w3.org/2000/svg",
|
| 191 |
viewBox: "0 0 24 24"
|
| 192 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 193 |
-
|
| 194 |
-
d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
|
| 195 |
-
clipRule: "evenodd"
|
| 196 |
}));
|
| 197 |
-
/* harmony default export */ __webpack_exports__["a"] = (
|
| 198 |
-
//# sourceMappingURL=star-
|
| 199 |
|
| 200 |
/***/ }),
|
| 201 |
|
| 202 |
-
/***/
|
| 203 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 204 |
|
| 205 |
"use strict";
|
|
@@ -213,21 +218,16 @@ const starEmpty = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["create
|
|
| 213 |
* WordPress dependencies
|
| 214 |
*/
|
| 215 |
|
| 216 |
-
const
|
| 217 |
xmlns: "http://www.w3.org/2000/svg",
|
| 218 |
viewBox: "0 0 24 24"
|
| 219 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 220 |
-
|
|
|
|
|
|
|
| 221 |
}));
|
| 222 |
-
/* harmony default export */ __webpack_exports__["a"] = (
|
| 223 |
-
//# sourceMappingURL=
|
| 224 |
-
|
| 225 |
-
/***/ }),
|
| 226 |
-
|
| 227 |
-
/***/ 16:
|
| 228 |
-
/***/ (function(module, exports) {
|
| 229 |
-
|
| 230 |
-
(function() { module.exports = window["wp"]["editor"]; }());
|
| 231 |
|
| 232 |
/***/ }),
|
| 233 |
|
|
@@ -238,21 +238,14 @@ const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cre
|
|
| 238 |
|
| 239 |
/***/ }),
|
| 240 |
|
| 241 |
-
/***/
|
| 242 |
/***/ (function(module, exports) {
|
| 243 |
|
| 244 |
(function() { module.exports = window["wp"]["hooks"]; }());
|
| 245 |
|
| 246 |
/***/ }),
|
| 247 |
|
| 248 |
-
/***/
|
| 249 |
-
/***/ (function(module, exports) {
|
| 250 |
-
|
| 251 |
-
(function() { module.exports = window["wp"]["editPost"]; }());
|
| 252 |
-
|
| 253 |
-
/***/ }),
|
| 254 |
-
|
| 255 |
-
/***/ 28:
|
| 256 |
/***/ (function(module, exports) {
|
| 257 |
|
| 258 |
(function() { module.exports = window["wp"]["notices"]; }());
|
|
@@ -266,31 +259,31 @@ const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cre
|
|
| 266 |
|
| 267 |
/***/ }),
|
| 268 |
|
| 269 |
-
/***/
|
| 270 |
/***/ (function(module, exports) {
|
| 271 |
|
| 272 |
(function() { module.exports = window["wp"]["a11y"]; }());
|
| 273 |
|
| 274 |
/***/ }),
|
| 275 |
|
| 276 |
-
/***/
|
| 277 |
/***/ (function(module, exports) {
|
| 278 |
|
| 279 |
(function() { module.exports = window["wp"]["apiFetch"]; }());
|
| 280 |
|
| 281 |
/***/ }),
|
| 282 |
|
| 283 |
-
/***/
|
| 284 |
/***/ (function(module, exports) {
|
| 285 |
|
| 286 |
-
(function() { module.exports = window["wp"]["
|
| 287 |
|
| 288 |
/***/ }),
|
| 289 |
|
| 290 |
-
/***/
|
| 291 |
/***/ (function(module, exports) {
|
| 292 |
|
| 293 |
-
(function() { module.exports = window["wp"]["
|
| 294 |
|
| 295 |
/***/ }),
|
| 296 |
|
|
@@ -301,14 +294,28 @@ const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cre
|
|
| 301 |
|
| 302 |
/***/ }),
|
| 303 |
|
| 304 |
-
/***/
|
| 305 |
/***/ (function(module, exports) {
|
| 306 |
|
| 307 |
(function() { module.exports = window["wp"]["htmlEntities"]; }());
|
| 308 |
|
| 309 |
/***/ }),
|
| 310 |
|
| 311 |
-
/***/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 313 |
|
| 314 |
"use strict";
|
|
@@ -347,10 +354,10 @@ __webpack_require__.d(actions_namespaceObject, "clearErrorNotice", function() {
|
|
| 347 |
var external_wp_element_ = __webpack_require__(0);
|
| 348 |
|
| 349 |
// EXTERNAL MODULE: external ["wp","plugins"]
|
| 350 |
-
var external_wp_plugins_ = __webpack_require__(
|
| 351 |
|
| 352 |
// EXTERNAL MODULE: external ["wp","hooks"]
|
| 353 |
-
var external_wp_hooks_ = __webpack_require__(
|
| 354 |
|
| 355 |
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 356 |
var external_wp_blocks_ = __webpack_require__(8);
|
|
@@ -359,10 +366,10 @@ var external_wp_blocks_ = __webpack_require__(8);
|
|
| 359 |
var external_wp_data_ = __webpack_require__(4);
|
| 360 |
|
| 361 |
// EXTERNAL MODULE: external ["wp","editor"]
|
| 362 |
-
var external_wp_editor_ = __webpack_require__(
|
| 363 |
|
| 364 |
// EXTERNAL MODULE: external ["wp","dataControls"]
|
| 365 |
-
var external_wp_dataControls_ = __webpack_require__(
|
| 366 |
|
| 367 |
// EXTERNAL MODULE: external "lodash"
|
| 368 |
var external_lodash_ = __webpack_require__(2);
|
|
@@ -627,10 +634,10 @@ function selectors_getErrorNoticeForBlock(state, blockId) {
|
|
| 627 |
var external_wp_i18n_ = __webpack_require__(1);
|
| 628 |
|
| 629 |
// EXTERNAL MODULE: external ["wp","notices"]
|
| 630 |
-
var external_wp_notices_ = __webpack_require__(
|
| 631 |
|
| 632 |
// EXTERNAL MODULE: external ["wp","apiFetch"]
|
| 633 |
-
var external_wp_apiFetch_ = __webpack_require__(
|
| 634 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_);
|
| 635 |
|
| 636 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/store/controls.js
|
|
@@ -1105,19 +1112,19 @@ var external_wp_components_ = __webpack_require__(3);
|
|
| 1105 |
var external_wp_compose_ = __webpack_require__(9);
|
| 1106 |
|
| 1107 |
// EXTERNAL MODULE: external ["wp","coreData"]
|
| 1108 |
-
var external_wp_coreData_ = __webpack_require__(
|
| 1109 |
|
| 1110 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 1111 |
var esm_extends = __webpack_require__(7);
|
| 1112 |
|
| 1113 |
// EXTERNAL MODULE: external ["wp","htmlEntities"]
|
| 1114 |
-
var external_wp_htmlEntities_ = __webpack_require__(
|
| 1115 |
|
| 1116 |
// EXTERNAL MODULE: ./packages/icons/build-module/icon/index.js
|
| 1117 |
var build_module_icon = __webpack_require__(109);
|
| 1118 |
|
| 1119 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/star-filled.js
|
| 1120 |
-
var star_filled = __webpack_require__(
|
| 1121 |
|
| 1122 |
// EXTERNAL MODULE: external ["wp","primitives"]
|
| 1123 |
var external_wp_primitives_ = __webpack_require__(6);
|
|
@@ -1138,7 +1145,7 @@ const starHalf = Object(external_wp_element_["createElement"])(external_wp_primi
|
|
| 1138 |
/* harmony default export */ var star_half = (starHalf);
|
| 1139 |
//# sourceMappingURL=star-half.js.map
|
| 1140 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/star-empty.js
|
| 1141 |
-
var star_empty = __webpack_require__(
|
| 1142 |
|
| 1143 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/block-ratings/stars.js
|
| 1144 |
|
|
@@ -1470,7 +1477,7 @@ function DownloadableBlocksList({
|
|
| 1470 |
/* harmony default export */ var downloadable_blocks_list = (DownloadableBlocksList);
|
| 1471 |
//# sourceMappingURL=index.js.map
|
| 1472 |
// EXTERNAL MODULE: external ["wp","a11y"]
|
| 1473 |
-
var external_wp_a11y_ = __webpack_require__(
|
| 1474 |
|
| 1475 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js
|
| 1476 |
|
|
@@ -1511,7 +1518,7 @@ function DownloadableBlocksInserterPanel({
|
|
| 1511 |
/* harmony default export */ var inserter_panel = (DownloadableBlocksInserterPanel);
|
| 1512 |
//# sourceMappingURL=inserter-panel.js.map
|
| 1513 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/block-default.js
|
| 1514 |
-
var block_default = __webpack_require__(
|
| 1515 |
|
| 1516 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/downloadable-blocks-panel/no-results.js
|
| 1517 |
|
|
@@ -1668,7 +1675,7 @@ function InserterMenuDownloadableBlocksPanel() {
|
|
| 1668 |
/* harmony default export */ var inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel);
|
| 1669 |
//# sourceMappingURL=index.js.map
|
| 1670 |
// EXTERNAL MODULE: external ["wp","editPost"]
|
| 1671 |
-
var external_wp_editPost_ = __webpack_require__(
|
| 1672 |
|
| 1673 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/compact-list/index.js
|
| 1674 |
|
|
@@ -1936,13 +1943,6 @@ Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'block-direc
|
|
| 1936 |
|
| 1937 |
/***/ }),
|
| 1938 |
|
| 1939 |
-
/***/ 5:
|
| 1940 |
-
/***/ (function(module, exports) {
|
| 1941 |
-
|
| 1942 |
-
(function() { module.exports = window["wp"]["blockEditor"]; }());
|
| 1943 |
-
|
| 1944 |
-
/***/ }),
|
| 1945 |
-
|
| 1946 |
/***/ 6:
|
| 1947 |
/***/ (function(module, exports) {
|
| 1948 |
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 500);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
/******/ ({
|
| 140 |
|
| 141 |
/***/ }),
|
| 142 |
|
| 143 |
+
/***/ 12:
|
| 144 |
/***/ (function(module, exports) {
|
| 145 |
|
| 146 |
(function() { module.exports = window["wp"]["coreData"]; }());
|
| 147 |
|
| 148 |
/***/ }),
|
| 149 |
|
| 150 |
+
/***/ 146:
|
| 151 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 152 |
|
| 153 |
"use strict";
|
| 161 |
* WordPress dependencies
|
| 162 |
*/
|
| 163 |
|
| 164 |
+
const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 165 |
xmlns: "http://www.w3.org/2000/svg",
|
| 166 |
viewBox: "0 0 24 24"
|
| 167 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 168 |
+
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"
|
| 169 |
}));
|
| 170 |
+
/* harmony default export */ __webpack_exports__["a"] = (blockDefault);
|
| 171 |
+
//# sourceMappingURL=block-default.js.map
|
| 172 |
+
|
| 173 |
+
/***/ }),
|
| 174 |
+
|
| 175 |
+
/***/ 18:
|
| 176 |
+
/***/ (function(module, exports) {
|
| 177 |
+
|
| 178 |
+
(function() { module.exports = window["wp"]["editor"]; }());
|
| 179 |
|
| 180 |
/***/ }),
|
| 181 |
|
| 182 |
+
/***/ 190:
|
| 183 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 184 |
|
| 185 |
"use strict";
|
| 193 |
* WordPress dependencies
|
| 194 |
*/
|
| 195 |
|
| 196 |
+
const starFilled = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 197 |
xmlns: "http://www.w3.org/2000/svg",
|
| 198 |
viewBox: "0 0 24 24"
|
| 199 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 200 |
+
d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
|
|
|
|
|
|
|
| 201 |
}));
|
| 202 |
+
/* harmony default export */ __webpack_exports__["a"] = (starFilled);
|
| 203 |
+
//# sourceMappingURL=star-filled.js.map
|
| 204 |
|
| 205 |
/***/ }),
|
| 206 |
|
| 207 |
+
/***/ 191:
|
| 208 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 209 |
|
| 210 |
"use strict";
|
| 218 |
* WordPress dependencies
|
| 219 |
*/
|
| 220 |
|
| 221 |
+
const starEmpty = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 222 |
xmlns: "http://www.w3.org/2000/svg",
|
| 223 |
viewBox: "0 0 24 24"
|
| 224 |
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 225 |
+
fillRule: "evenodd",
|
| 226 |
+
d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
|
| 227 |
+
clipRule: "evenodd"
|
| 228 |
}));
|
| 229 |
+
/* harmony default export */ __webpack_exports__["a"] = (starEmpty);
|
| 230 |
+
//# sourceMappingURL=star-empty.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
/***/ }),
|
| 233 |
|
| 238 |
|
| 239 |
/***/ }),
|
| 240 |
|
| 241 |
+
/***/ 21:
|
| 242 |
/***/ (function(module, exports) {
|
| 243 |
|
| 244 |
(function() { module.exports = window["wp"]["hooks"]; }());
|
| 245 |
|
| 246 |
/***/ }),
|
| 247 |
|
| 248 |
+
/***/ 29:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
/***/ (function(module, exports) {
|
| 250 |
|
| 251 |
(function() { module.exports = window["wp"]["notices"]; }());
|
| 259 |
|
| 260 |
/***/ }),
|
| 261 |
|
| 262 |
+
/***/ 31:
|
| 263 |
/***/ (function(module, exports) {
|
| 264 |
|
| 265 |
(function() { module.exports = window["wp"]["a11y"]; }());
|
| 266 |
|
| 267 |
/***/ }),
|
| 268 |
|
| 269 |
+
/***/ 32:
|
| 270 |
/***/ (function(module, exports) {
|
| 271 |
|
| 272 |
(function() { module.exports = window["wp"]["apiFetch"]; }());
|
| 273 |
|
| 274 |
/***/ }),
|
| 275 |
|
| 276 |
+
/***/ 325:
|
| 277 |
/***/ (function(module, exports) {
|
| 278 |
|
| 279 |
+
(function() { module.exports = window["wp"]["editPost"]; }());
|
| 280 |
|
| 281 |
/***/ }),
|
| 282 |
|
| 283 |
+
/***/ 34:
|
| 284 |
/***/ (function(module, exports) {
|
| 285 |
|
| 286 |
+
(function() { module.exports = window["wp"]["dataControls"]; }());
|
| 287 |
|
| 288 |
/***/ }),
|
| 289 |
|
| 294 |
|
| 295 |
/***/ }),
|
| 296 |
|
| 297 |
+
/***/ 41:
|
| 298 |
/***/ (function(module, exports) {
|
| 299 |
|
| 300 |
(function() { module.exports = window["wp"]["htmlEntities"]; }());
|
| 301 |
|
| 302 |
/***/ }),
|
| 303 |
|
| 304 |
+
/***/ 45:
|
| 305 |
+
/***/ (function(module, exports) {
|
| 306 |
+
|
| 307 |
+
(function() { module.exports = window["wp"]["plugins"]; }());
|
| 308 |
+
|
| 309 |
+
/***/ }),
|
| 310 |
+
|
| 311 |
+
/***/ 5:
|
| 312 |
+
/***/ (function(module, exports) {
|
| 313 |
+
|
| 314 |
+
(function() { module.exports = window["wp"]["blockEditor"]; }());
|
| 315 |
+
|
| 316 |
+
/***/ }),
|
| 317 |
+
|
| 318 |
+
/***/ 500:
|
| 319 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 320 |
|
| 321 |
"use strict";
|
| 354 |
var external_wp_element_ = __webpack_require__(0);
|
| 355 |
|
| 356 |
// EXTERNAL MODULE: external ["wp","plugins"]
|
| 357 |
+
var external_wp_plugins_ = __webpack_require__(45);
|
| 358 |
|
| 359 |
// EXTERNAL MODULE: external ["wp","hooks"]
|
| 360 |
+
var external_wp_hooks_ = __webpack_require__(21);
|
| 361 |
|
| 362 |
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 363 |
var external_wp_blocks_ = __webpack_require__(8);
|
| 366 |
var external_wp_data_ = __webpack_require__(4);
|
| 367 |
|
| 368 |
// EXTERNAL MODULE: external ["wp","editor"]
|
| 369 |
+
var external_wp_editor_ = __webpack_require__(18);
|
| 370 |
|
| 371 |
// EXTERNAL MODULE: external ["wp","dataControls"]
|
| 372 |
+
var external_wp_dataControls_ = __webpack_require__(34);
|
| 373 |
|
| 374 |
// EXTERNAL MODULE: external "lodash"
|
| 375 |
var external_lodash_ = __webpack_require__(2);
|
| 634 |
var external_wp_i18n_ = __webpack_require__(1);
|
| 635 |
|
| 636 |
// EXTERNAL MODULE: external ["wp","notices"]
|
| 637 |
+
var external_wp_notices_ = __webpack_require__(29);
|
| 638 |
|
| 639 |
// EXTERNAL MODULE: external ["wp","apiFetch"]
|
| 640 |
+
var external_wp_apiFetch_ = __webpack_require__(32);
|
| 641 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_);
|
| 642 |
|
| 643 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/store/controls.js
|
| 1112 |
var external_wp_compose_ = __webpack_require__(9);
|
| 1113 |
|
| 1114 |
// EXTERNAL MODULE: external ["wp","coreData"]
|
| 1115 |
+
var external_wp_coreData_ = __webpack_require__(12);
|
| 1116 |
|
| 1117 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 1118 |
var esm_extends = __webpack_require__(7);
|
| 1119 |
|
| 1120 |
// EXTERNAL MODULE: external ["wp","htmlEntities"]
|
| 1121 |
+
var external_wp_htmlEntities_ = __webpack_require__(41);
|
| 1122 |
|
| 1123 |
// EXTERNAL MODULE: ./packages/icons/build-module/icon/index.js
|
| 1124 |
var build_module_icon = __webpack_require__(109);
|
| 1125 |
|
| 1126 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/star-filled.js
|
| 1127 |
+
var star_filled = __webpack_require__(190);
|
| 1128 |
|
| 1129 |
// EXTERNAL MODULE: external ["wp","primitives"]
|
| 1130 |
var external_wp_primitives_ = __webpack_require__(6);
|
| 1145 |
/* harmony default export */ var star_half = (starHalf);
|
| 1146 |
//# sourceMappingURL=star-half.js.map
|
| 1147 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/star-empty.js
|
| 1148 |
+
var star_empty = __webpack_require__(191);
|
| 1149 |
|
| 1150 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/block-ratings/stars.js
|
| 1151 |
|
| 1477 |
/* harmony default export */ var downloadable_blocks_list = (DownloadableBlocksList);
|
| 1478 |
//# sourceMappingURL=index.js.map
|
| 1479 |
// EXTERNAL MODULE: external ["wp","a11y"]
|
| 1480 |
+
var external_wp_a11y_ = __webpack_require__(31);
|
| 1481 |
|
| 1482 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js
|
| 1483 |
|
| 1518 |
/* harmony default export */ var inserter_panel = (DownloadableBlocksInserterPanel);
|
| 1519 |
//# sourceMappingURL=inserter-panel.js.map
|
| 1520 |
// EXTERNAL MODULE: ./packages/icons/build-module/library/block-default.js
|
| 1521 |
+
var block_default = __webpack_require__(146);
|
| 1522 |
|
| 1523 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/downloadable-blocks-panel/no-results.js
|
| 1524 |
|
| 1675 |
/* harmony default export */ var inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel);
|
| 1676 |
//# sourceMappingURL=index.js.map
|
| 1677 |
// EXTERNAL MODULE: external ["wp","editPost"]
|
| 1678 |
+
var external_wp_editPost_ = __webpack_require__(325);
|
| 1679 |
|
| 1680 |
// CONCATENATED MODULE: ./packages/block-directory/build-module/components/compact-list/index.js
|
| 1681 |
|
| 1943 |
|
| 1944 |
/***/ }),
|
| 1945 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1946 |
/***/ 6:
|
| 1947 |
/***/ (function(module, exports) {
|
| 1948 |
|
build/block-directory/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '2a7217388d531827f936edfdf52638be');
|
build/block-directory/index.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
window.wp=window.wp||{},window.wp.blockDirectory=function(e){var t={};function n(l){if(t[l])return t[l].exports;var c=t[l]={i:l,l:!1,exports:{}};return e[l].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(l,c,function(t){return e[t]}.bind(null,c));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
| 2 |
-
Object(h.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),l=!0}catch(e){let n=e.message||Object(h.__)("An error occurred."),l=e instanceof Error;const c={folder_exists:Object(h.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:Object(h.__)("Error installing block. You can reload the page and try again.")};c[e.code]&&(l=!0,n=c[e.code]),yield M(t,n,l),yield s.controls.dispatch(v.store,"createErrorNotice",n,{speak:!0,isDismissible:!0})}return yield A(e.id,!1),l}function*D(e){try{yield Object(b.apiFetch)({url:S(e),data:{status:"inactive"},method:"PUT"}),yield Object(b.apiFetch)({url:S(e),method:"DELETE"}),yield R(e)}catch(e){yield s.controls.dispatch(v.store,"createErrorNotice",e.message||Object(h.__)("An error occurred."))}}function P(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function R(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function A(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function M(e,t,n=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:n}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var V={*getDownloadableBlocks(e){if(e)try{yield L(e);const t=(yield Object(b.apiFetch)({path:"wp/v2/block-directory/search?term="+e})).map(e=>Object(u.mapKeys)(e,(e,t)=>Object(u.camelCase)(t)));yield C(t,e)}catch(e){}}};const H={reducer:m,selectors:l,actions:c,controls:{...b.controls,...T},resolvers:V},K=Object(s.createReduxStore)("core/block-directory",H);function z(){const{uninstallBlockType:e}=Object(s.useDispatch)(K),t=Object(s.useSelect)(e=>{const{isAutosavingPost:t,isSavingPost:n}=e(d.store);return n()&&!t()},[]),n=Object(s.useSelect)(e=>e(K).getUnusedBlockTypes(),[]);return Object(o.useEffect)(()=>{t&&n.length&&n.forEach(t=>{e(t),Object(i.unregisterBlockType)(t.name)})},[t]),null}Object(s.register)(K);var q=n(3),Y=n(9),$=n(
|
| 3 |
/* translators: %s: number of stars. */
|
| 4 |
Object(h.__)("%s out of 5 stars"),t)},Object(u.times)(n,e=>Object(o.createElement)(W.a,{key:"full_stars_"+e,className:"block-directory-block-ratings__star-full",icon:J.a,size:16})),Object(u.times)(l,e=>Object(o.createElement)(W.a,{key:"half_stars_"+e,className:"block-directory-block-ratings__star-half-full",icon:X,size:16})),Object(u.times)(c,e=>Object(o.createElement)(W.a,{key:"empty_stars_"+e,className:"block-directory-block-ratings__star-empty",icon:Z.a,size:16})))},te=({rating:e})=>Object(o.createElement)("span",{className:"block-directory-block-ratings"},Object(o.createElement)(ee,{rating:e})),ne=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?Object(o.createElement)("img",{className:t,src:e,alt:""}):Object(o.createElement)(p.BlockIcon,{className:t,icon:e,showColors:!0})},le=({block:e})=>{const t=Object(s.useSelect)(t=>t(K).getErrorNoticeForBlock(e.id),[e]);return t?Object(o.createElement)("div",{className:"block-directory-downloadable-block-notice"},Object(o.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},t.message,t.isFatal?" "+Object(h.__)("Try reloading the page."):null)):null};function ce({title:e,rating:t,ratingCount:n},{hasNotice:l,isInstalled:c,isInstalling:o}){const r=.5*Math.round(t/.5);return!c&&l?Object(h.sprintf)("Retry installing %s.",Object(G.decodeEntities)(e)):c?Object(h.sprintf)("Add %s.",Object(G.decodeEntities)(e)):o?Object(h.sprintf)("Installing %s.",Object(G.decodeEntities)(e)):n<1?Object(h.sprintf)("Install %s.",Object(G.decodeEntities)(e)):Object(h.sprintf)(
|
| 5 |
/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
|
| 6 |
Object(h._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",n),Object(G.decodeEntities)(e),r,n)}var oe=function({composite:e,item:t,onClick:n}){const{author:l,description:c,icon:r,rating:a,title:d}=t,b=!!Object(i.getBlockType)(t.name),{hasNotice:u,isInstalling:m,isInstallable:p}=Object(s.useSelect)(e=>{const{getErrorNoticeForBlock:n,isInstalling:l}=e(K),c=n(t.id),o=c&&c.isFatal;return{hasNotice:!!c,isInstalling:l(t.id),isInstallable:!o}},[t]);let O="";return b?O=Object(h.__)("Installed!"):m&&(O=Object(h.__)("Installing…")),Object(o.createElement)(q.__unstableCompositeItem,Object(U.a)({role:"option",as:q.Button},e,{className:"block-directory-downloadable-block-list-item",onClick:e=>{e.preventDefault(),n()},isBusy:m,disabled:m||!p,label:ce(t,{hasNotice:u,isInstalled:b,isInstalling:m}),showTooltip:!0,tooltipPosition:"top center"}),Object(o.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},Object(o.createElement)(ne,{icon:r,title:d}),m?Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},Object(o.createElement)(q.Spinner,null)):Object(o.createElement)(te,{rating:a})),Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},Object(o.createInterpolateElement)(Object(h.sprintf)(
|
| 7 |
/* translators: %1$s: block title, %2$s: author name. */
|
| 8 |
-
Object(h.__)("%1$s <span>by %2$s</span>"),Object(G.decodeEntities)(d),l),{span:Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),u?Object(o.createElement)(le,{block:t}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},O||Object(G.decodeEntities)(c)),p&&!(b||m)&&Object(o.createElement)(q.VisuallyHidden,null,Object(h.__)("Install block")))))},re=function({items:e,onHover:t=u.noop,onSelect:n}){const l=Object(q.__unstableUseCompositeState)(),{installBlockType:c}=Object(s.useDispatch)(K);return e.length?Object(o.createElement)(q.__unstableComposite,Object(U.a)({},l,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":Object(h.__)("Blocks available for install")}),e.map(e=>Object(o.createElement)(oe,{key:e.id,composite:l,onClick:()=>{Object(i.getBlockType)(e.name)?n(e):c(e).then(t=>{t&&n(e)}),t(null)},onHover:t,item:e}))):null},ae=n(
|
| 9 |
/* translators: %d: number of available blocks. */
|
| 10 |
-
Object(h._n)("%d additional block is available to install.","%d additional blocks are available to install.",l),l))},[l]),Object(o.createElement)(o.Fragment,null,!n&&Object(o.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},Object(h.__)("No results available from your installed blocks.")),Object(o.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),Object(o.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},Object(o.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},Object(o.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},Object(h.__)("Available to install")),Object(o.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},Object(h.__)("Select a block to install and add it to your post."))),e))},se=n(
|
| 11 |
/* translators: %s: Name of the block author. */
|
| 12 |
Object(h.__)("By %s"),l)))))):null}function Oe(){const e=Object(s.useSelect)(e=>e(K).getNewBlockTypes(),[]);return e.length?Object(o.createElement)(me.PluginPrePublishPanel,{icon:se.a,title:Object(h.sprintf)(// translators: %d: number of blocks (number).
|
| 13 |
Object(h._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},Object(o.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},Object(h._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),Object(o.createElement)(pe,{items:e})):null}function ke({attributes:e,block:t,clientId:n}){const l=Object(s.useSelect)(e=>e(K).isInstalling(t.id)),{installBlockType:c}=Object(s.useDispatch)(K),{replaceBlock:r}=Object(s.useDispatch)(p.store);return Object(o.createElement)(q.Button,{onClick:()=>c(t).then(l=>{if(l){const l=Object(i.getBlockType)(t.name),[c]=Object(i.parse)(e.originalContent);c&&r(n,Object(i.createBlock)(l.name,c.attributes,c.innerBlocks))}}),disabled:l,isBusy:l,variant:"primary"},Object(h.sprintf)(
|
|
@@ -16,4 +16,4 @@ Object(h.__)("Install %s"),t.title))}const je=({originalBlock:e,...t})=>{const{o
|
|
| 16 |
/* translators: %s: block name */
|
| 17 |
Object(h.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||n);const b=[Object(o.createElement)(ke,{key:"install",block:e,attributes:t.attributes,clientId:t.clientId})];return r&&a&&(d=Object(h.sprintf)(
|
| 18 |
/* translators: %s: block name */
|
| 19 |
-
Object(h.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||n),b.push(Object(o.createElement)(q.Button,{key:"convert",onClick:()=>{c(t.clientId,Object(i.createBlock)("core/html",{content:l}))},variant:"link"},Object(h.__)("Keep as HTML")))),Object(o.createElement)("div",Object(p.useBlockProps)(),Object(o.createElement)(p.Warning,{actions:b},d),Object(o.createElement)(o.RawHTML,null,l))};Object(r.registerPlugin)("block-directory",{render:()=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(z,null),Object(o.createElement)(ue,null),Object(o.createElement)(Oe,null))}),Object(a.addFilter)("blocks.registerBlockType","block-directory/fallback",(e,t)=>{return"core/missing"!==t||(e.edit=(n=e.edit,e=>{const{originalName:t}=e.attributes,{block:l,hasPermission:c}=Object(s.useSelect)(e=>{const{getDownloadableBlocks:n}=e(K),l=n("block:"+t).filter(({name:e})=>t===e);return{hasPermission:e($.store).canUser("read","block-directory/search"),block:l.length&&l[0]}},[t]);return c&&l?Object(o.createElement)(je,Object(U.a)({},e,{originalBlock:l})):Object(o.createElement)(n,e)})),e;var n})},
|
| 1 |
+
window.wp=window.wp||{},window.wp.blockDirectory=function(e){var t={};function n(l){if(t[l])return t[l].exports;var c=t[l]={i:l,l:!1,exports:{}};return e[l].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(l,c,function(t){return e[t]}.bind(null,c));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=500)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},109:function(e,t,n){"use strict";var l=n(0);t.a=function({icon:e,size:t=24,...n}){return Object(l.cloneElement)(e,{width:t,height:t,...n})}},12:function(e,t){e.exports=window.wp.coreData},146:function(e,t,n){"use strict";var l=n(0),c=n(6);const o=Object(l.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(l.createElement)(c.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"}));t.a=o},18:function(e,t){e.exports=window.wp.editor},190:function(e,t,n){"use strict";var l=n(0),c=n(6);const o=Object(l.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(l.createElement)(c.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));t.a=o},191:function(e,t,n){"use strict";var l=n(0),c=n(6);const o=Object(l.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(l.createElement)(c.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"}));t.a=o},2:function(e,t){e.exports=window.lodash},21:function(e,t){e.exports=window.wp.hooks},29:function(e,t){e.exports=window.wp.notices},3:function(e,t){e.exports=window.wp.components},31:function(e,t){e.exports=window.wp.a11y},32:function(e,t){e.exports=window.wp.apiFetch},325:function(e,t){e.exports=window.wp.editPost},34:function(e,t){e.exports=window.wp.dataControls},4:function(e,t){e.exports=window.wp.data},41:function(e,t){e.exports=window.wp.htmlEntities},45:function(e,t){e.exports=window.wp.plugins},5:function(e,t){e.exports=window.wp.blockEditor},500:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return K}));var l={};n.r(l),n.d(l,"isRequestingDownloadableBlocks",(function(){return k})),n.d(l,"getDownloadableBlocks",(function(){return j})),n.d(l,"getInstalledBlockTypes",(function(){return f})),n.d(l,"getNewBlockTypes",(function(){return _})),n.d(l,"getUnusedBlockTypes",(function(){return w})),n.d(l,"isInstalling",(function(){return y})),n.d(l,"getErrorNotices",(function(){return E})),n.d(l,"getErrorNoticeForBlock",(function(){return g}));var c={};n.r(c),n.d(c,"fetchDownloadableBlocks",(function(){return L})),n.d(c,"receiveDownloadableBlocks",(function(){return C})),n.d(c,"installBlockType",(function(){return x})),n.d(c,"uninstallBlockType",(function(){return D})),n.d(c,"addInstalledBlockType",(function(){return P})),n.d(c,"removeInstalledBlockType",(function(){return R})),n.d(c,"setIsInstalling",(function(){return A})),n.d(c,"setErrorNotice",(function(){return M})),n.d(c,"clearErrorNotice",(function(){return F}));var o=n(0),r=n(45),a=n(21),i=n(8),s=n(4),d=n(18),b=n(34),u=n(2),m=Object(s.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter(e=>e.name!==t.item.name)};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":return Object(u.omit)(e,t.blockId)}return e}}),p=n(5);function O(e,t=[]){if(!t.length)return!1;if(t.some(({name:t})=>t===e.name))return!0;for(let n=0;n<t.length;n++)if(O(e,t[n].innerBlocks))return!0;return!1}function k(e,t){return!(!e.downloadableBlocks[t]||!e.downloadableBlocks[t].isRequesting)&&e.downloadableBlocks[t].isRequesting}function j(e,t){return e.downloadableBlocks[t]&&e.downloadableBlocks[t].results?e.downloadableBlocks[t].results:[]}function f(e){return e.blockManagement.installedBlockTypes}const _=Object(s.createRegistrySelector)(e=>t=>{const n=e(p.store).getBlocks();return f(t).filter(e=>O(e,n))}),w=Object(s.createRegistrySelector)(e=>t=>{const n=e(p.store).getBlocks();return f(t).filter(e=>!O(e,n))});function y(e,t){return e.blockManagement.isInstalling[t]||!1}function E(e){return e.errorNotices}function g(e,t){return e.errorNotices[t]}var h=n(1),v=n(29),B=n(32),N=n.n(B);const I=e=>new Promise((t,n)=>{const l=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach(t=>{e[t]&&(l[t]=e[t])}),e.innerHTML&&l.appendChild(document.createTextNode(e.innerHTML)),l.onload=()=>t(!0),l.onerror=()=>n(new Error("Error loading asset.")),document.body.appendChild(l),("link"===l.nodeName.toLowerCase()||"script"===l.nodeName.toLowerCase()&&!l.src)&&t()});var T={async LOAD_ASSETS(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),n=(new window.DOMParser).parseFromString(t,"text/html"),l=Array.from(n.querySelectorAll('link[rel="stylesheet"],script')).filter(e=>e.id&&!document.getElementById(e.id));for(const e of l)await I(e)}};function S(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function L(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function C(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}function*x(e){const{id:t,assets:n}=e;let l=!1;yield F(t);try{yield A(e.id,!0);const t=S(e);let c={};if(t?yield Object(b.apiFetch)({url:t,data:{status:"active"},method:"PUT"}):c=(yield Object(b.apiFetch)({path:"wp/v2/plugins",data:{slug:e.id,status:"active"},method:"POST"}))._links,yield P({...e,links:{...e.links,...c}}),yield function(e){return{type:"LOAD_ASSETS",assets:e}}(n),!(yield s.controls.select(i.store.name,"getBlockTypes")).some(t=>t.name===e.name))throw new Error(Object(h.__)("Error registering block. Try reloading the page."));yield s.controls.dispatch(v.store,"createInfoNotice",Object(h.sprintf)(// translators: %s is the block title.
|
| 2 |
+
Object(h.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),l=!0}catch(e){let n=e.message||Object(h.__)("An error occurred."),l=e instanceof Error;const c={folder_exists:Object(h.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:Object(h.__)("Error installing block. You can reload the page and try again.")};c[e.code]&&(l=!0,n=c[e.code]),yield M(t,n,l),yield s.controls.dispatch(v.store,"createErrorNotice",n,{speak:!0,isDismissible:!0})}return yield A(e.id,!1),l}function*D(e){try{yield Object(b.apiFetch)({url:S(e),data:{status:"inactive"},method:"PUT"}),yield Object(b.apiFetch)({url:S(e),method:"DELETE"}),yield R(e)}catch(e){yield s.controls.dispatch(v.store,"createErrorNotice",e.message||Object(h.__)("An error occurred."))}}function P(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function R(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function A(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function M(e,t,n=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:n}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var V={*getDownloadableBlocks(e){if(e)try{yield L(e);const t=(yield Object(b.apiFetch)({path:"wp/v2/block-directory/search?term="+e})).map(e=>Object(u.mapKeys)(e,(e,t)=>Object(u.camelCase)(t)));yield C(t,e)}catch(e){}}};const H={reducer:m,selectors:l,actions:c,controls:{...b.controls,...T},resolvers:V},K=Object(s.createReduxStore)("core/block-directory",H);function z(){const{uninstallBlockType:e}=Object(s.useDispatch)(K),t=Object(s.useSelect)(e=>{const{isAutosavingPost:t,isSavingPost:n}=e(d.store);return n()&&!t()},[]),n=Object(s.useSelect)(e=>e(K).getUnusedBlockTypes(),[]);return Object(o.useEffect)(()=>{t&&n.length&&n.forEach(t=>{e(t),Object(i.unregisterBlockType)(t.name)})},[t]),null}Object(s.register)(K);var q=n(3),Y=n(9),$=n(12),U=n(7),G=n(41),W=n(109),J=n(190),Q=n(6),X=Object(o.createElement)(Q.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(Q.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})),Z=n(191),ee=function({rating:e}){const t=.5*Math.round(e/.5),n=Math.floor(e),l=Math.ceil(e-n),c=5-(n+l);return Object(o.createElement)("span",{"aria-label":Object(h.sprintf)(
|
| 3 |
/* translators: %s: number of stars. */
|
| 4 |
Object(h.__)("%s out of 5 stars"),t)},Object(u.times)(n,e=>Object(o.createElement)(W.a,{key:"full_stars_"+e,className:"block-directory-block-ratings__star-full",icon:J.a,size:16})),Object(u.times)(l,e=>Object(o.createElement)(W.a,{key:"half_stars_"+e,className:"block-directory-block-ratings__star-half-full",icon:X,size:16})),Object(u.times)(c,e=>Object(o.createElement)(W.a,{key:"empty_stars_"+e,className:"block-directory-block-ratings__star-empty",icon:Z.a,size:16})))},te=({rating:e})=>Object(o.createElement)("span",{className:"block-directory-block-ratings"},Object(o.createElement)(ee,{rating:e})),ne=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?Object(o.createElement)("img",{className:t,src:e,alt:""}):Object(o.createElement)(p.BlockIcon,{className:t,icon:e,showColors:!0})},le=({block:e})=>{const t=Object(s.useSelect)(t=>t(K).getErrorNoticeForBlock(e.id),[e]);return t?Object(o.createElement)("div",{className:"block-directory-downloadable-block-notice"},Object(o.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},t.message,t.isFatal?" "+Object(h.__)("Try reloading the page."):null)):null};function ce({title:e,rating:t,ratingCount:n},{hasNotice:l,isInstalled:c,isInstalling:o}){const r=.5*Math.round(t/.5);return!c&&l?Object(h.sprintf)("Retry installing %s.",Object(G.decodeEntities)(e)):c?Object(h.sprintf)("Add %s.",Object(G.decodeEntities)(e)):o?Object(h.sprintf)("Installing %s.",Object(G.decodeEntities)(e)):n<1?Object(h.sprintf)("Install %s.",Object(G.decodeEntities)(e)):Object(h.sprintf)(
|
| 5 |
/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
|
| 6 |
Object(h._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",n),Object(G.decodeEntities)(e),r,n)}var oe=function({composite:e,item:t,onClick:n}){const{author:l,description:c,icon:r,rating:a,title:d}=t,b=!!Object(i.getBlockType)(t.name),{hasNotice:u,isInstalling:m,isInstallable:p}=Object(s.useSelect)(e=>{const{getErrorNoticeForBlock:n,isInstalling:l}=e(K),c=n(t.id),o=c&&c.isFatal;return{hasNotice:!!c,isInstalling:l(t.id),isInstallable:!o}},[t]);let O="";return b?O=Object(h.__)("Installed!"):m&&(O=Object(h.__)("Installing…")),Object(o.createElement)(q.__unstableCompositeItem,Object(U.a)({role:"option",as:q.Button},e,{className:"block-directory-downloadable-block-list-item",onClick:e=>{e.preventDefault(),n()},isBusy:m,disabled:m||!p,label:ce(t,{hasNotice:u,isInstalled:b,isInstalling:m}),showTooltip:!0,tooltipPosition:"top center"}),Object(o.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},Object(o.createElement)(ne,{icon:r,title:d}),m?Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},Object(o.createElement)(q.Spinner,null)):Object(o.createElement)(te,{rating:a})),Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},Object(o.createInterpolateElement)(Object(h.sprintf)(
|
| 7 |
/* translators: %1$s: block title, %2$s: author name. */
|
| 8 |
+
Object(h.__)("%1$s <span>by %2$s</span>"),Object(G.decodeEntities)(d),l),{span:Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),u?Object(o.createElement)(le,{block:t}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},O||Object(G.decodeEntities)(c)),p&&!(b||m)&&Object(o.createElement)(q.VisuallyHidden,null,Object(h.__)("Install block")))))},re=function({items:e,onHover:t=u.noop,onSelect:n}){const l=Object(q.__unstableUseCompositeState)(),{installBlockType:c}=Object(s.useDispatch)(K);return e.length?Object(o.createElement)(q.__unstableComposite,Object(U.a)({},l,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":Object(h.__)("Blocks available for install")}),e.map(e=>Object(o.createElement)(oe,{key:e.id,composite:l,onClick:()=>{Object(i.getBlockType)(e.name)?n(e):c(e).then(t=>{t&&n(e)}),t(null)},onHover:t,item:e}))):null},ae=n(31),ie=function({children:e,downloadableItems:t,hasLocalBlocks:n}){const l=t.length;return Object(o.useEffect)(()=>{Object(ae.speak)(Object(h.sprintf)(
|
| 9 |
/* translators: %d: number of available blocks. */
|
| 10 |
+
Object(h._n)("%d additional block is available to install.","%d additional blocks are available to install.",l),l))},[l]),Object(o.createElement)(o.Fragment,null,!n&&Object(o.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},Object(h.__)("No results available from your installed blocks.")),Object(o.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),Object(o.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},Object(o.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},Object(o.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},Object(h.__)("Available to install")),Object(o.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},Object(h.__)("Select a block to install and add it to your post."))),e))},se=n(146),de=function(){return Object(o.createElement)("div",{className:"block-editor-inserter__no-results"},Object(o.createElement)(W.a,{className:"block-editor-inserter__no-results-icon",icon:se.a}),Object(o.createElement)("p",null,Object(h.__)("No results found.")))},be=Object(Y.compose)([Object(s.withSelect)((e,{filterValue:t,rootClientId:n=null})=>{const{getDownloadableBlocks:l,isRequestingDownloadableBlocks:c}=e(K),{canInsertBlockType:o}=e(p.store),r=e($.store).canUser("read","block-directory/search");return{downloadableItems:r?l(t).filter(e=>o(e,n,!0)):[],hasPermission:r,isLoading:c(t)}})])((function({downloadableItems:e,onSelect:t,onHover:n,hasLocalBlocks:l,hasPermission:c,isLoading:r,isTyping:a}){return void 0===c||r||a?Object(o.createElement)(o.Fragment,null,c&&!l&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},Object(h.__)("No results available from your installed blocks.")),Object(o.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),Object(o.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},Object(o.createElement)(q.Spinner,null))):!1===c?l?null:Object(o.createElement)(de,null):e.length?Object(o.createElement)(ie,{downloadableItems:e,hasLocalBlocks:l},Object(o.createElement)(re,{items:e,onSelect:t,onHover:n})):!l&&Object(o.createElement)(de,null)})),ue=function(){const[e,t]=Object(o.useState)(""),n=Object(u.debounce)(t,400);return Object(o.createElement)(p.__unstableInserterMenuExtension,null,({onSelect:t,onHover:l,filterValue:c,hasItems:r,rootClientId:a})=>(e!==c&&n(c),e?Object(o.createElement)(be,{onSelect:t,onHover:l,rootClientId:a,filterValue:e,hasLocalBlocks:r,isTyping:c!==e}):null))},me=n(325);function pe({items:e}){return e.length?Object(o.createElement)("ul",{className:"block-directory-compact-list"},e.map(({icon:e,id:t,title:n,author:l})=>Object(o.createElement)("li",{key:t,className:"block-directory-compact-list__item"},Object(o.createElement)(ne,{icon:e,title:n}),Object(o.createElement)("div",{className:"block-directory-compact-list__item-details"},Object(o.createElement)("div",{className:"block-directory-compact-list__item-title"},n),Object(o.createElement)("div",{className:"block-directory-compact-list__item-author"},Object(h.sprintf)(
|
| 11 |
/* translators: %s: Name of the block author. */
|
| 12 |
Object(h.__)("By %s"),l)))))):null}function Oe(){const e=Object(s.useSelect)(e=>e(K).getNewBlockTypes(),[]);return e.length?Object(o.createElement)(me.PluginPrePublishPanel,{icon:se.a,title:Object(h.sprintf)(// translators: %d: number of blocks (number).
|
| 13 |
Object(h._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},Object(o.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},Object(h._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),Object(o.createElement)(pe,{items:e})):null}function ke({attributes:e,block:t,clientId:n}){const l=Object(s.useSelect)(e=>e(K).isInstalling(t.id)),{installBlockType:c}=Object(s.useDispatch)(K),{replaceBlock:r}=Object(s.useDispatch)(p.store);return Object(o.createElement)(q.Button,{onClick:()=>c(t).then(l=>{if(l){const l=Object(i.getBlockType)(t.name),[c]=Object(i.parse)(e.originalContent);c&&r(n,Object(i.createBlock)(l.name,c.attributes,c.innerBlocks))}}),disabled:l,isBusy:l,variant:"primary"},Object(h.sprintf)(
|
| 16 |
/* translators: %s: block name */
|
| 17 |
Object(h.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||n);const b=[Object(o.createElement)(ke,{key:"install",block:e,attributes:t.attributes,clientId:t.clientId})];return r&&a&&(d=Object(h.sprintf)(
|
| 18 |
/* translators: %s: block name */
|
| 19 |
+
Object(h.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||n),b.push(Object(o.createElement)(q.Button,{key:"convert",onClick:()=>{c(t.clientId,Object(i.createBlock)("core/html",{content:l}))},variant:"link"},Object(h.__)("Keep as HTML")))),Object(o.createElement)("div",Object(p.useBlockProps)(),Object(o.createElement)(p.Warning,{actions:b},d),Object(o.createElement)(o.RawHTML,null,l))};Object(r.registerPlugin)("block-directory",{render:()=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(z,null),Object(o.createElement)(ue,null),Object(o.createElement)(Oe,null))}),Object(a.addFilter)("blocks.registerBlockType","block-directory/fallback",(e,t)=>{return"core/missing"!==t||(e.edit=(n=e.edit,e=>{const{originalName:t}=e.attributes,{block:l,hasPermission:c}=Object(s.useSelect)(e=>{const{getDownloadableBlocks:n}=e(K),l=n("block:"+t).filter(({name:e})=>t===e);return{hasPermission:e($.store).canUser("read","block-directory/search"),block:l.length&&l[0]}},[t]);return c&&l?Object(o.createElement)(je,Object(U.a)({},e,{originalBlock:l})):Object(o.createElement)(n,e)})),e;var n})},6:function(e,t){e.exports=window.wp.primitives},7:function(e,t,n){"use strict";function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return l}))},8:function(e,t){e.exports=window.wp.blocks},9:function(e,t){e.exports=window.wp.compose}});
|
build/block-editor/index.js
CHANGED
|
@@ -82,30 +82,88 @@ window["wp"] = window["wp"] || {}; window["wp"]["blockEditor"] =
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
-
/******/ (
|
| 89 |
-
|
| 90 |
-
/***/ 0:
|
| 91 |
/***/ (function(module, exports) {
|
| 92 |
|
| 93 |
(function() { module.exports = window["wp"]["element"]; }());
|
| 94 |
|
| 95 |
/***/ }),
|
| 96 |
-
|
| 97 |
-
/***/ 1:
|
| 98 |
/***/ (function(module, exports) {
|
| 99 |
|
| 100 |
(function() { module.exports = window["wp"]["i18n"]; }());
|
| 101 |
|
| 102 |
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
/***/
|
|
|
|
| 105 |
/***/ (function(module, exports, __webpack_require__) {
|
| 106 |
|
| 107 |
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
| 108 |
-
Copyright (c)
|
| 109 |
Licensed under the MIT License (MIT), see
|
| 110 |
http://jedwatson.github.io/classnames
|
| 111 |
*/
|
|
@@ -116,7 +174,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
| 116 |
|
| 117 |
var hasOwn = {}.hasOwnProperty;
|
| 118 |
|
| 119 |
-
function classNames
|
| 120 |
var classes = [];
|
| 121 |
|
| 122 |
for (var i = 0; i < arguments.length; i++) {
|
|
@@ -128,12 +186,21 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
| 128 |
if (argType === 'string' || argType === 'number') {
|
| 129 |
classes.push(arg);
|
| 130 |
} else if (Array.isArray(arg)) {
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
} else if (argType === 'object') {
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
}
|
|
|
|
|
|
|
| 137 |
}
|
| 138 |
}
|
| 139 |
}
|
|
@@ -142,6 +209,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
| 142 |
}
|
| 143 |
|
| 144 |
if ( true && module.exports) {
|
|
|
|
| 145 |
module.exports = classNames;
|
| 146 |
} else if (true) {
|
| 147 |
// register as 'classnames', consistent with npm package name
|
|
@@ -154,4846 +222,5162 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
| 154 |
|
| 155 |
|
| 156 |
/***/ }),
|
|
|
|
|
|
|
| 157 |
|
| 158 |
-
|
| 159 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 160 |
-
|
| 161 |
-
"use strict";
|
| 162 |
-
|
| 163 |
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
var React__default = _interopDefault(React);
|
| 172 |
-
var _inheritsLoose = _interopDefault(__webpack_require__(177));
|
| 173 |
-
var _assertThisInitialized = _interopDefault(__webpack_require__(179));
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
}
|
| 214 |
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
};
|
| 218 |
-
function merge(target, lowercase) {
|
| 219 |
-
if (lowercase === void 0) {
|
| 220 |
-
lowercase = true;
|
| 221 |
-
}
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element;
|
| 226 |
-
acc[key] = target(key);
|
| 227 |
-
return acc;
|
| 228 |
-
}, target);
|
| 229 |
-
};
|
| 230 |
-
}
|
| 231 |
-
function useForceUpdate() {
|
| 232 |
-
var _useState = React.useState(false),
|
| 233 |
-
f = _useState[1];
|
| 234 |
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
return !v;
|
| 238 |
-
});
|
| 239 |
-
}, []);
|
| 240 |
-
return forceUpdate;
|
| 241 |
-
}
|
| 242 |
-
function withDefault(value, defaultValue) {
|
| 243 |
-
return is.und(value) || is.nul(value) ? defaultValue : value;
|
| 244 |
-
}
|
| 245 |
-
function toArray(a) {
|
| 246 |
-
return !is.und(a) ? is.arr(a) ? a : [a] : [];
|
| 247 |
-
}
|
| 248 |
-
function callProp(obj) {
|
| 249 |
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
| 250 |
-
args[_key - 1] = arguments[_key];
|
| 251 |
-
}
|
| 252 |
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
reverse = props.reverse,
|
| 266 |
-
force = props.force,
|
| 267 |
-
immediate = props.immediate,
|
| 268 |
-
delay = props.delay,
|
| 269 |
-
attach = props.attach,
|
| 270 |
-
destroyed = props.destroyed,
|
| 271 |
-
interpolateTo = props.interpolateTo,
|
| 272 |
-
ref = props.ref,
|
| 273 |
-
lazy = props.lazy,
|
| 274 |
-
forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]);
|
| 275 |
|
| 276 |
-
|
|
|
|
| 277 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
-
function
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
}, props);
|
| 284 |
-
var rest = Object.keys(props).reduce(function (a, k) {
|
| 285 |
-
var _extends2;
|
| 286 |
-
|
| 287 |
-
return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2));
|
| 288 |
-
}, {});
|
| 289 |
-
return _extends({
|
| 290 |
-
to: forward
|
| 291 |
-
}, rest);
|
| 292 |
}
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
}
|
| 299 |
-
}
|
| 300 |
|
| 301 |
-
|
| 302 |
-
|
|
|
|
| 303 |
|
| 304 |
-
var Animated =
|
| 305 |
-
/*#__PURE__*/
|
| 306 |
-
function () {
|
| 307 |
-
function Animated() {
|
| 308 |
-
this.payload = void 0;
|
| 309 |
-
this.children = [];
|
| 310 |
-
}
|
| 311 |
|
| 312 |
-
var _proto = Animated.prototype;
|
| 313 |
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
|
| 318 |
-
_proto.getPayload = function getPayload() {
|
| 319 |
-
return this.payload || this;
|
| 320 |
-
};
|
| 321 |
|
| 322 |
-
_proto.attach = function attach() {};
|
| 323 |
|
| 324 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
-
|
| 327 |
-
|
|
|
|
| 328 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
-
_proto.addChild = function addChild(child) {
|
| 331 |
-
if (this.children.length === 0) this.attach();
|
| 332 |
-
this.children.push(child);
|
| 333 |
-
};
|
| 334 |
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
|
| 341 |
-
return Animated;
|
| 342 |
-
}();
|
| 343 |
-
var AnimatedArray =
|
| 344 |
-
/*#__PURE__*/
|
| 345 |
-
function (_Animated) {
|
| 346 |
-
_inheritsLoose(AnimatedArray, _Animated);
|
| 347 |
|
| 348 |
-
|
| 349 |
-
|
|
|
|
| 350 |
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
|
| 355 |
-
|
| 356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
|
| 358 |
-
_this.attach = function () {
|
| 359 |
-
return _this.payload.forEach(function (p) {
|
| 360 |
-
return p instanceof Animated && p.addChild(_assertThisInitialized(_this));
|
| 361 |
-
});
|
| 362 |
-
};
|
| 363 |
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
|
| 370 |
-
return _this;
|
| 371 |
-
}
|
| 372 |
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
-
function AnimatedObject() {
|
| 381 |
-
var _this2;
|
| 382 |
|
| 383 |
-
|
| 384 |
-
|
|
|
|
|
|
|
| 385 |
}
|
| 386 |
|
| 387 |
-
|
| 388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
|
| 390 |
-
_this2.attach = function () {
|
| 391 |
-
return Object.values(_this2.payload).forEach(function (s) {
|
| 392 |
-
return s instanceof Animated && s.addChild(_assertThisInitialized(_this2));
|
| 393 |
-
});
|
| 394 |
-
};
|
| 395 |
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
});
|
| 400 |
};
|
| 401 |
-
|
| 402 |
-
return _this2;
|
| 403 |
}
|
| 404 |
|
| 405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
|
| 407 |
-
_proto2.getValue = function getValue(animated) {
|
| 408 |
-
if (animated === void 0) {
|
| 409 |
-
animated = false;
|
| 410 |
-
}
|
| 411 |
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
};
|
| 426 |
-
|
| 427 |
-
return AnimatedObject;
|
| 428 |
-
}(Animated);
|
| 429 |
-
|
| 430 |
-
var applyAnimatedValues;
|
| 431 |
-
function injectApplyAnimatedValues(fn, transform) {
|
| 432 |
-
applyAnimatedValues = {
|
| 433 |
-
fn: fn,
|
| 434 |
-
transform: transform
|
| 435 |
-
};
|
| 436 |
-
}
|
| 437 |
-
var colorNames;
|
| 438 |
-
function injectColorNames(names) {
|
| 439 |
-
colorNames = names;
|
| 440 |
-
}
|
| 441 |
-
var requestFrame = function requestFrame(cb) {
|
| 442 |
-
return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1;
|
| 443 |
-
};
|
| 444 |
-
var cancelFrame = function cancelFrame(id) {
|
| 445 |
-
typeof window !== 'undefined' && window.cancelAnimationFrame(id);
|
| 446 |
-
};
|
| 447 |
-
function injectFrame(raf, caf) {
|
| 448 |
-
requestFrame = raf;
|
| 449 |
-
cancelFrame = caf;
|
| 450 |
-
}
|
| 451 |
-
var interpolation;
|
| 452 |
-
function injectStringInterpolator(fn) {
|
| 453 |
-
interpolation = fn;
|
| 454 |
-
}
|
| 455 |
-
var now = function now() {
|
| 456 |
-
return Date.now();
|
| 457 |
-
};
|
| 458 |
-
function injectNow(nowFn) {
|
| 459 |
-
now = nowFn;
|
| 460 |
-
}
|
| 461 |
-
var defaultElement;
|
| 462 |
-
function injectDefaultElement(el) {
|
| 463 |
-
defaultElement = el;
|
| 464 |
-
}
|
| 465 |
-
var animatedApi = function animatedApi(node) {
|
| 466 |
-
return node.current;
|
| 467 |
};
|
| 468 |
-
function injectAnimatedApi(fn) {
|
| 469 |
-
animatedApi = fn;
|
| 470 |
-
}
|
| 471 |
-
var createAnimatedStyle;
|
| 472 |
-
function injectCreateAnimatedStyle(factory) {
|
| 473 |
-
createAnimatedStyle = factory;
|
| 474 |
-
}
|
| 475 |
-
var manualFrameloop;
|
| 476 |
-
function injectManualFrameloop(callback) {
|
| 477 |
-
manualFrameloop = callback;
|
| 478 |
-
}
|
| 479 |
-
|
| 480 |
-
var Globals = /*#__PURE__*/Object.freeze({
|
| 481 |
-
get applyAnimatedValues () { return applyAnimatedValues; },
|
| 482 |
-
injectApplyAnimatedValues: injectApplyAnimatedValues,
|
| 483 |
-
get colorNames () { return colorNames; },
|
| 484 |
-
injectColorNames: injectColorNames,
|
| 485 |
-
get requestFrame () { return requestFrame; },
|
| 486 |
-
get cancelFrame () { return cancelFrame; },
|
| 487 |
-
injectFrame: injectFrame,
|
| 488 |
-
get interpolation () { return interpolation; },
|
| 489 |
-
injectStringInterpolator: injectStringInterpolator,
|
| 490 |
-
get now () { return now; },
|
| 491 |
-
injectNow: injectNow,
|
| 492 |
-
get defaultElement () { return defaultElement; },
|
| 493 |
-
injectDefaultElement: injectDefaultElement,
|
| 494 |
-
get animatedApi () { return animatedApi; },
|
| 495 |
-
injectAnimatedApi: injectAnimatedApi,
|
| 496 |
-
get createAnimatedStyle () { return createAnimatedStyle; },
|
| 497 |
-
injectCreateAnimatedStyle: injectCreateAnimatedStyle,
|
| 498 |
-
get manualFrameloop () { return manualFrameloop; },
|
| 499 |
-
injectManualFrameloop: injectManualFrameloop
|
| 500 |
-
});
|
| 501 |
-
|
| 502 |
/**
|
| 503 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
*/
|
| 505 |
|
| 506 |
-
var AnimatedProps =
|
| 507 |
-
/*#__PURE__*/
|
| 508 |
-
function (_AnimatedObject) {
|
| 509 |
-
_inheritsLoose(AnimatedProps, _AnimatedObject);
|
| 510 |
-
|
| 511 |
-
function AnimatedProps(props, callback) {
|
| 512 |
-
var _this;
|
| 513 |
-
|
| 514 |
-
_this = _AnimatedObject.call(this) || this;
|
| 515 |
-
_this.update = void 0;
|
| 516 |
-
_this.payload = !props.style ? props : _extends({}, props, {
|
| 517 |
-
style: createAnimatedStyle(props.style)
|
| 518 |
-
});
|
| 519 |
-
_this.update = callback;
|
| 520 |
|
| 521 |
-
|
|
|
|
| 522 |
|
| 523 |
-
|
|
|
|
| 524 |
}
|
| 525 |
|
| 526 |
-
|
| 527 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 528 |
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
var mounted = React.useRef(true);
|
| 533 |
-
var propsAnimated = React.useRef(null);
|
| 534 |
-
var node = React.useRef(null);
|
| 535 |
-
var attachProps = React.useCallback(function (props) {
|
| 536 |
-
var oldPropsAnimated = propsAnimated.current;
|
| 537 |
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
}
|
| 543 |
-
};
|
| 544 |
|
| 545 |
-
|
| 546 |
-
oldPropsAnimated && oldPropsAnimated.detach();
|
| 547 |
-
}, []);
|
| 548 |
-
React.useEffect(function () {
|
| 549 |
-
return function () {
|
| 550 |
-
mounted.current = false;
|
| 551 |
-
propsAnimated.current && propsAnimated.current.detach();
|
| 552 |
-
};
|
| 553 |
}, []);
|
| 554 |
-
|
| 555 |
-
return animatedApi(node, mounted, forceUpdate);
|
| 556 |
-
});
|
| 557 |
-
attachProps(props);
|
| 558 |
-
|
| 559 |
-
var _getValue = propsAnimated.current.getValue(),
|
| 560 |
-
scrollTop = _getValue.scrollTop,
|
| 561 |
-
scrollLeft = _getValue.scrollLeft,
|
| 562 |
-
animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]);
|
| 563 |
-
|
| 564 |
-
return React__default.createElement(Component, _extends({}, animatedProps, {
|
| 565 |
-
ref: function ref(childRef) {
|
| 566 |
-
return node.current = handleRef(childRef, _ref);
|
| 567 |
-
}
|
| 568 |
-
}));
|
| 569 |
-
});
|
| 570 |
-
return AnimatedComponent;
|
| 571 |
-
};
|
| 572 |
-
|
| 573 |
-
var active = false;
|
| 574 |
-
var controllers = new Set();
|
| 575 |
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
|
|
|
| 579 |
|
| 580 |
-
|
| 581 |
-
|
|
|
|
|
|
|
| 582 |
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
} else {
|
| 587 |
-
_i = _iterator.next();
|
| 588 |
-
if (_i.done) break;
|
| 589 |
-
_ref = _i.value;
|
| 590 |
-
}
|
| 591 |
|
| 592 |
-
|
| 593 |
-
|
|
|
|
|
|
|
|
|
|
| 594 |
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
|
|
|
| 599 |
|
| 600 |
-
|
| 601 |
-
|
|
|
|
|
|
|
|
|
|
| 602 |
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
|
|
|
|
|
|
|
|
|
|
| 617 |
|
| 618 |
-
if (
|
| 619 |
-
|
| 620 |
-
animation.done = true;
|
| 621 |
-
continue;
|
| 622 |
}
|
| 623 |
|
| 624 |
-
if (
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
endOfAnimation = time >= animation.startTime + config.duration;
|
| 628 |
-
} else if (config.decay) {
|
| 629 |
-
/** Decay easing */
|
| 630 |
-
position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime)));
|
| 631 |
-
endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1;
|
| 632 |
-
if (endOfAnimation) to = position;
|
| 633 |
-
} else {
|
| 634 |
-
/** Spring easing */
|
| 635 |
-
lastTime = animation.lastTime !== void 0 ? animation.lastTime : time;
|
| 636 |
-
velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end.
|
| 637 |
-
|
| 638 |
-
if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/
|
| 639 |
-
|
| 640 |
-
var numSteps = Math.floor(time - lastTime);
|
| 641 |
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
position = position + velocity * 1 / 1000;
|
| 648 |
-
} // Conditions for stopping the spring animation
|
| 649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
endOfAnimation = isOvershooting || isVelocity && isDisplacement;
|
| 655 |
-
animation.lastVelocity = velocity;
|
| 656 |
-
animation.lastTime = time;
|
| 657 |
-
} // Trails aren't done until their parents conclude
|
| 658 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 659 |
|
| 660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 661 |
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
|
| 668 |
-
animation.setValue(position);
|
| 669 |
-
animation.lastPosition = position;
|
| 670 |
-
} // Keep track of updated values only when necessary
|
| 671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
|
| 673 |
-
|
| 674 |
-
|
| 675 |
|
|
|
|
|
|
|
| 676 |
|
| 677 |
-
|
|
|
|
|
|
|
| 678 |
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
}
|
| 683 |
-
} // Loop over as long as there are controllers ...
|
| 684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 691 |
|
| 692 |
-
return active;
|
| 693 |
-
};
|
| 694 |
|
| 695 |
-
|
| 696 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 697 |
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
}
|
| 702 |
-
};
|
| 703 |
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
|
| 708 |
-
function createInterpolator(range, output, extrapolate) {
|
| 709 |
-
if (typeof range === 'function') {
|
| 710 |
-
return range;
|
| 711 |
-
}
|
| 712 |
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
extrapolate: extrapolate
|
| 718 |
-
});
|
| 719 |
-
}
|
| 720 |
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
|
|
|
| 724 |
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';
|
| 729 |
-
var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';
|
| 730 |
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
};
|
| 734 |
|
| 735 |
-
|
| 736 |
-
var range = findRange(input, inputRange);
|
| 737 |
-
return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);
|
| 738 |
};
|
| 739 |
-
}
|
| 740 |
-
|
| 741 |
-
function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
|
| 742 |
-
var result = map ? map(input) : input; // Extrapolate
|
| 743 |
|
| 744 |
-
if (
|
| 745 |
-
|
| 746 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 747 |
|
| 748 |
-
|
| 749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 750 |
}
|
| 751 |
|
| 752 |
-
|
| 753 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
|
| 755 |
-
if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing
|
| 756 |
|
| 757 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
}
|
| 767 |
|
| 768 |
-
return
|
| 769 |
-
}
|
| 770 |
-
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
|
|
|
|
|
|
|
|
|
| 778 |
|
| 779 |
-
_this = _AnimatedArray.call(this) || this;
|
| 780 |
-
_this.calc = void 0;
|
| 781 |
-
_this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents];
|
| 782 |
-
_this.calc = createInterpolator(range, output);
|
| 783 |
-
return _this;
|
| 784 |
-
}
|
| 785 |
|
| 786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 787 |
|
| 788 |
-
_proto.getValue = function getValue() {
|
| 789 |
-
return this.calc.apply(this, this.payload.map(function (value) {
|
| 790 |
-
return value.getValue();
|
| 791 |
-
}));
|
| 792 |
-
};
|
| 793 |
|
| 794 |
-
|
| 795 |
-
this.calc = createInterpolator(range, output);
|
| 796 |
-
};
|
| 797 |
|
| 798 |
-
|
| 799 |
-
|
| 800 |
-
};
|
| 801 |
|
| 802 |
-
|
| 803 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 804 |
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
|
| 809 |
-
var config = {
|
| 810 |
-
default: {
|
| 811 |
-
tension: 170,
|
| 812 |
-
friction: 26
|
| 813 |
-
},
|
| 814 |
-
gentle: {
|
| 815 |
-
tension: 120,
|
| 816 |
-
friction: 14
|
| 817 |
-
},
|
| 818 |
-
wobbly: {
|
| 819 |
-
tension: 180,
|
| 820 |
-
friction: 12
|
| 821 |
-
},
|
| 822 |
-
stiff: {
|
| 823 |
-
tension: 210,
|
| 824 |
-
friction: 20
|
| 825 |
-
},
|
| 826 |
-
slow: {
|
| 827 |
-
tension: 280,
|
| 828 |
-
friction: 60
|
| 829 |
-
},
|
| 830 |
-
molasses: {
|
| 831 |
-
tension: 280,
|
| 832 |
-
friction: 120
|
| 833 |
-
}
|
| 834 |
-
};
|
| 835 |
|
| 836 |
-
|
| 837 |
-
* useChain(references, timeSteps, timeFrame)
|
| 838 |
-
*/
|
| 839 |
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
|
|
|
|
|
|
|
|
|
| 843 |
}
|
| 844 |
|
| 845 |
-
|
| 846 |
-
React.useEffect(function () {
|
| 847 |
-
if (is.equ(refs, previous.current)) refs.forEach(function (_ref) {
|
| 848 |
-
var current = _ref.current;
|
| 849 |
-
return current && current.start();
|
| 850 |
-
});else if (timeSteps) {
|
| 851 |
-
refs.forEach(function (_ref2, index) {
|
| 852 |
-
var current = _ref2.current;
|
| 853 |
|
| 854 |
-
|
| 855 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 856 |
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
return _extends({}, e, {
|
| 862 |
-
delay: e.delay + t
|
| 863 |
-
});
|
| 864 |
-
});
|
| 865 |
-
ctrl.start();
|
| 866 |
-
});
|
| 867 |
-
}
|
| 868 |
}
|
| 869 |
-
});
|
| 870 |
-
} else refs.reduce(function (q, _ref3, rI) {
|
| 871 |
-
var current = _ref3.current;
|
| 872 |
-
return q = q.then(function () {
|
| 873 |
-
return current.start();
|
| 874 |
-
});
|
| 875 |
-
}, Promise.resolve());
|
| 876 |
-
previous.current = refs;
|
| 877 |
-
});
|
| 878 |
-
}
|
| 879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 880 |
/**
|
| 881 |
-
*
|
| 882 |
-
*
|
| 883 |
-
*
|
| 884 |
-
*
|
| 885 |
-
* .interpolate() .interpolate() new Animated.Value(1)
|
| 886 |
-
* opacity translateY scale
|
| 887 |
-
* style transform
|
| 888 |
-
* View#234 style
|
| 889 |
-
* View#123
|
| 890 |
*
|
| 891 |
-
*
|
| 892 |
-
* When an AnimatedValue is updated, we recursively go down through this
|
| 893 |
-
* graph in order to find leaf nodes: the views that we flag as needing
|
| 894 |
-
* an update.
|
| 895 |
*
|
| 896 |
-
*
|
| 897 |
-
* When a view is flagged as needing an update, we recursively go back up
|
| 898 |
-
* in order to build the new value that it needs. The reason why we need
|
| 899 |
-
* this two-phases process is to deal with composite props such as
|
| 900 |
-
* transform which can receive values from multiple parents.
|
| 901 |
*/
|
| 902 |
-
function addAnimatedStyles(node, styles) {
|
| 903 |
-
if ('update' in node) {
|
| 904 |
-
styles.add(node);
|
| 905 |
-
} else {
|
| 906 |
-
node.getChildren().forEach(function (child) {
|
| 907 |
-
return addAnimatedStyles(child, styles);
|
| 908 |
-
});
|
| 909 |
-
}
|
| 910 |
-
}
|
| 911 |
-
|
| 912 |
-
var AnimatedValue =
|
| 913 |
-
/*#__PURE__*/
|
| 914 |
-
function (_Animated) {
|
| 915 |
-
_inheritsLoose(AnimatedValue, _Animated);
|
| 916 |
|
| 917 |
-
function AnimatedValue(_value) {
|
| 918 |
-
var _this;
|
| 919 |
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
_this.startTime = void 0;
|
| 927 |
-
_this.lastTime = void 0;
|
| 928 |
-
_this.done = false;
|
| 929 |
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
}
|
| 934 |
|
| 935 |
-
|
| 936 |
-
if (flush) _this.flush();
|
| 937 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 938 |
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
|
| 945 |
-
|
|
|
|
|
|
|
| 946 |
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 951 |
|
| 952 |
-
this.animatedStyles.forEach(function (animatedStyle) {
|
| 953 |
-
return animatedStyle.update();
|
| 954 |
-
});
|
| 955 |
-
};
|
| 956 |
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 960 |
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
|
|
|
|
|
|
| 964 |
|
| 965 |
-
|
| 966 |
-
|
| 967 |
-
|
|
|
|
|
|
|
| 968 |
|
| 969 |
-
return AnimatedValue;
|
| 970 |
-
}(Animated);
|
| 971 |
|
| 972 |
-
|
| 973 |
-
/*#__PURE__*/
|
| 974 |
-
function (_AnimatedArray) {
|
| 975 |
-
_inheritsLoose(AnimatedValueArray, _AnimatedArray);
|
| 976 |
|
| 977 |
-
|
| 978 |
-
|
|
|
|
| 979 |
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
|
| 985 |
-
}
|
| 986 |
|
| 987 |
-
|
|
|
|
|
|
|
|
|
|
| 988 |
|
| 989 |
-
|
| 990 |
-
|
|
|
|
| 991 |
|
| 992 |
-
|
| 993 |
-
|
| 994 |
}
|
| 995 |
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
value.forEach(function (v, i) {
|
| 999 |
-
return _this2.payload[i].setValue(v, flush);
|
| 1000 |
-
});
|
| 1001 |
-
}
|
| 1002 |
-
} else {
|
| 1003 |
-
this.payload.forEach(function (p) {
|
| 1004 |
-
return p.setValue(value, flush);
|
| 1005 |
-
});
|
| 1006 |
-
}
|
| 1007 |
-
};
|
| 1008 |
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
};
|
| 1014 |
|
| 1015 |
-
|
| 1016 |
-
|
| 1017 |
-
|
|
|
|
|
|
|
| 1018 |
|
| 1019 |
-
|
| 1020 |
-
|
|
|
|
|
|
|
|
|
|
| 1021 |
|
| 1022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1023 |
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
|
|
|
| 1029 |
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
this.animations = {};
|
| 1038 |
-
this.interpolations = {};
|
| 1039 |
-
this.values = {};
|
| 1040 |
-
this.configs = [];
|
| 1041 |
-
this.listeners = [];
|
| 1042 |
-
this.queue = [];
|
| 1043 |
-
this.localQueue = void 0;
|
| 1044 |
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
|
| 1049 |
-
|
| 1050 |
-
|
| 1051 |
-
|
| 1052 |
-
* This function filters input props and creates an array of tasks which are executed in .start()
|
| 1053 |
-
* Each task is allowed to carry a delay, which means it can execute asnychroneously */
|
| 1054 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1055 |
|
| 1056 |
-
|
|
|
|
|
|
|
|
|
|
| 1057 |
|
| 1058 |
-
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
to = _ref.to,
|
| 1066 |
-
props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]);
|
| 1067 |
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
this.queue.push(_extends({}, props, {
|
| 1071 |
-
delay: delay,
|
| 1072 |
-
to: to
|
| 1073 |
-
}));
|
| 1074 |
-
} else if (to) {
|
| 1075 |
-
// Otherwise go through each key since it could be delayed individually
|
| 1076 |
-
var ops = {};
|
| 1077 |
-
Object.entries(to).forEach(function (_ref2) {
|
| 1078 |
-
var _to;
|
| 1079 |
|
| 1080 |
-
|
| 1081 |
-
|
|
|
|
|
|
|
| 1082 |
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
}, props);
|
| 1088 |
-
|
| 1089 |
-
var previous = ops[entry.delay] && ops[entry.delay].to;
|
| 1090 |
-
ops[entry.delay] = _extends({}, ops[entry.delay], entry, {
|
| 1091 |
-
to: _extends({}, previous, entry.to)
|
| 1092 |
-
});
|
| 1093 |
-
});
|
| 1094 |
-
this.queue = Object.values(ops);
|
| 1095 |
-
} // Sort queue, so that async calls go last
|
| 1096 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1097 |
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1101 |
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
| 1105 |
-
|
| 1106 |
-
|
| 1107 |
-
|
|
|
|
| 1108 |
|
| 1109 |
-
_proto.start = function start$$1(onEnd) {
|
| 1110 |
-
var _this2 = this;
|
| 1111 |
|
| 1112 |
-
|
| 1113 |
-
|
| 1114 |
-
|
|
|
|
|
|
|
| 1115 |
|
| 1116 |
-
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
-
});
|
| 1125 |
-
} // The guid helps us tracking frames, a new queue over an old one means an override
|
| 1126 |
-
// We discard async calls in that caseÍ
|
| 1127 |
|
|
|
|
|
|
|
|
|
|
| 1128 |
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
-
|
|
|
|
|
|
|
| 1132 |
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1136 |
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
_this2.idle = true;
|
| 1140 |
-
if (_this2.props.onRest) _this2.props.onRest(_this2.merged);
|
| 1141 |
}
|
| 1142 |
|
| 1143 |
-
|
| 1144 |
-
|
|
|
|
|
|
|
|
|
|
| 1145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1146 |
|
| 1147 |
-
|
|
|
|
|
|
|
| 1148 |
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
|
|
|
|
|
|
| 1153 |
}
|
| 1154 |
-
}, delay);
|
| 1155 |
-
} else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb);
|
| 1156 |
-
});
|
| 1157 |
-
} // Otherwise we kick of the frameloop
|
| 1158 |
-
else {
|
| 1159 |
-
if (is.fun(onEnd)) this.listeners.push(onEnd);
|
| 1160 |
-
if (this.props.onStart) this.props.onStart();
|
| 1161 |
|
| 1162 |
-
|
| 1163 |
-
|
|
|
|
| 1164 |
|
| 1165 |
-
|
| 1166 |
-
|
|
|
|
| 1167 |
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
| 1171 |
-
|
| 1172 |
-
|
| 1173 |
-
return this;
|
| 1174 |
-
}
|
| 1175 |
-
/** Pause sets onEnd listeners free, but also removes the controller from the frameloop */
|
| 1176 |
-
;
|
| 1177 |
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
if (finished) stop(this);
|
| 1181 |
-
return this;
|
| 1182 |
-
};
|
| 1183 |
|
| 1184 |
-
|
| 1185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1186 |
|
| 1187 |
-
|
| 1188 |
-
|
|
|
|
|
|
|
| 1189 |
|
| 1190 |
-
|
| 1191 |
-
|
|
|
|
|
|
|
| 1192 |
|
| 1193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1194 |
|
| 1195 |
-
|
| 1196 |
-
|
| 1197 |
-
|
|
|
|
| 1198 |
|
| 1199 |
-
|
|
|
|
|
|
|
| 1200 |
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
//this.stop()
|
| 1204 |
-
if (local === _this3.guid) return new Promise(function (r) {
|
| 1205 |
-
return _this3.diff(fresh).start(r);
|
| 1206 |
-
});
|
| 1207 |
-
});
|
| 1208 |
-
};
|
| 1209 |
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
|
| 1221 |
-
|
| 1222 |
-
|
| 1223 |
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
|
| 1238 |
-
});
|
| 1239 |
-
}
|
| 1240 |
|
| 1241 |
-
|
| 1242 |
-
|
|
|
|
| 1243 |
|
| 1244 |
-
|
| 1245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1246 |
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
_this$props$to = _this$props.to,
|
| 1252 |
-
to = _this$props$to === void 0 ? {} : _this$props$to,
|
| 1253 |
-
_this$props$config = _this$props.config,
|
| 1254 |
-
config = _this$props$config === void 0 ? {} : _this$props$config,
|
| 1255 |
-
reverse = _this$props.reverse,
|
| 1256 |
-
attach = _this$props.attach,
|
| 1257 |
-
reset = _this$props.reset,
|
| 1258 |
-
immediate = _this$props.immediate; // Reverse values when requested
|
| 1259 |
|
| 1260 |
-
|
| 1261 |
-
|
| 1262 |
-
|
| 1263 |
-
to = _ref6[1];
|
| 1264 |
-
} // This will collect all props that were ever set, reset merged props when necessary
|
| 1265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1266 |
|
| 1267 |
-
|
| 1268 |
-
|
|
|
|
|
|
|
| 1269 |
|
| 1270 |
-
|
|
|
|
|
|
|
| 1271 |
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
|
| 1276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1277 |
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
if (target) toValue = target.animations[name].parent;
|
| 1286 |
-
var parent = entry.parent,
|
| 1287 |
-
interpolation$$1 = entry.interpolation,
|
| 1288 |
-
toValues = toArray(target ? toValue.getPayload() : toValue),
|
| 1289 |
-
animatedValues;
|
| 1290 |
-
var newValue = value;
|
| 1291 |
-
if (isInterpolation) newValue = interpolation({
|
| 1292 |
-
range: [0, 1],
|
| 1293 |
-
output: [value, value]
|
| 1294 |
-
})(1);
|
| 1295 |
-
var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags
|
| 1296 |
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
return !v.done;
|
| 1300 |
-
});
|
| 1301 |
-
var currentValueDiffersFromGoal = !is.equ(newValue, currentValue);
|
| 1302 |
-
var hasNewGoal = !is.equ(newValue, entry.previous);
|
| 1303 |
-
var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one)
|
| 1304 |
-
// and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?)
|
| 1305 |
|
| 1306 |
-
|
| 1307 |
-
|
|
|
|
|
|
|
| 1308 |
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
prev = prev !== void 0 && !reset ? prev : fromValue;
|
| 1313 |
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
|
|
|
|
|
|
| 1318 |
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
|
|
|
| 1322 |
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
}
|
| 1328 |
-
toValues = toArray(target ? toValue.getPayload() : toValue);
|
| 1329 |
-
animatedValues = toArray(parent.getPayload());
|
| 1330 |
-
if (reset && !isInterpolation) parent.setValue(fromValue, false);
|
| 1331 |
-
_this4.hasChanged = true; // Reset animated values
|
| 1332 |
|
| 1333 |
-
|
| 1334 |
-
value.startPosition = value.value;
|
| 1335 |
-
value.lastPosition = value.value;
|
| 1336 |
-
value.lastVelocity = isActive ? value.lastVelocity : undefined;
|
| 1337 |
-
value.lastTime = isActive ? value.lastTime : undefined;
|
| 1338 |
-
value.startTime = now();
|
| 1339 |
-
value.done = false;
|
| 1340 |
-
value.animatedStyles.clear();
|
| 1341 |
-
}); // Set immediate values
|
| 1342 |
|
| 1343 |
-
|
| 1344 |
-
|
|
|
|
|
|
|
| 1345 |
}
|
| 1346 |
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
parent: parent,
|
| 1350 |
-
interpolation: interpolation$$1,
|
| 1351 |
-
animatedValues: animatedValues,
|
| 1352 |
-
toValues: toValues,
|
| 1353 |
-
previous: newValue,
|
| 1354 |
-
config: toConfig,
|
| 1355 |
-
fromValues: toArray(parent.getValue()),
|
| 1356 |
-
immediate: callProp(immediate, name),
|
| 1357 |
-
initialVelocity: withDefault(toConfig.velocity, 0),
|
| 1358 |
-
clamp: withDefault(toConfig.clamp, false),
|
| 1359 |
-
precision: withDefault(toConfig.precision, 0.01),
|
| 1360 |
-
tension: withDefault(toConfig.tension, 170),
|
| 1361 |
-
friction: withDefault(toConfig.friction, 26),
|
| 1362 |
-
mass: withDefault(toConfig.mass, 1),
|
| 1363 |
-
duration: toConfig.duration,
|
| 1364 |
-
easing: withDefault(toConfig.easing, function (t) {
|
| 1365 |
-
return t;
|
| 1366 |
-
}),
|
| 1367 |
-
decay: toConfig.decay
|
| 1368 |
-
}), _extends2));
|
| 1369 |
-
} else {
|
| 1370 |
-
if (!currentValueDiffersFromGoal) {
|
| 1371 |
-
var _extends3;
|
| 1372 |
|
| 1373 |
-
|
| 1374 |
-
|
| 1375 |
-
|
| 1376 |
-
// which it technically is. Interpolations also needs a config update with their target set to 1.
|
| 1377 |
-
if (isInterpolation) {
|
| 1378 |
-
parent.setValue(1, false);
|
| 1379 |
-
interpolation$$1.updateConfig({
|
| 1380 |
-
output: [newValue, newValue]
|
| 1381 |
-
});
|
| 1382 |
-
}
|
| 1383 |
|
| 1384 |
-
|
| 1385 |
-
|
| 1386 |
-
return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], {
|
| 1387 |
-
previous: newValue
|
| 1388 |
-
}), _extends3));
|
| 1389 |
}
|
| 1390 |
|
| 1391 |
-
return
|
|
|
|
|
|
|
| 1392 |
}
|
| 1393 |
-
|
| 1394 |
|
| 1395 |
-
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1400 |
|
| 1401 |
-
for (var key in this.animations) {
|
| 1402 |
-
this.interpolations[key] = this.animations[key].interpolation;
|
| 1403 |
-
this.values[key] = this.animations[key].interpolation.getValue();
|
| 1404 |
-
}
|
| 1405 |
-
}
|
| 1406 |
|
| 1407 |
-
|
| 1408 |
-
|
| 1409 |
|
| 1410 |
-
|
| 1411 |
-
|
| 1412 |
-
|
| 1413 |
-
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
|
| 1417 |
-
|
| 1418 |
-
|
| 1419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1420 |
|
| 1421 |
-
|
| 1422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1423 |
|
| 1424 |
-
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1428 |
|
| 1429 |
-
|
| 1430 |
-
|
| 1431 |
-
|
| 1432 |
-
var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations
|
| 1433 |
|
| 1434 |
-
|
| 1435 |
-
|
| 1436 |
-
|
| 1437 |
-
ctrl.current.map(function (c) {
|
| 1438 |
-
return c.destroy();
|
| 1439 |
-
});
|
| 1440 |
-
ctrl.current = undefined;
|
| 1441 |
-
}
|
| 1442 |
|
| 1443 |
-
var ref;
|
| 1444 |
-
return [new Array(length).fill().map(function (_, i) {
|
| 1445 |
-
var ctrl = new Controller();
|
| 1446 |
-
var newProps = isFn ? callProp(props, i, ctrl) : props[i];
|
| 1447 |
-
if (i === 0) ref = newProps.ref;
|
| 1448 |
-
ctrl.update(newProps);
|
| 1449 |
-
if (!ref) ctrl.start();
|
| 1450 |
-
return ctrl;
|
| 1451 |
-
}), ref];
|
| 1452 |
-
}, [length]),
|
| 1453 |
-
controllers = _useMemo[0],
|
| 1454 |
-
ref = _useMemo[1];
|
| 1455 |
|
| 1456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1457 |
|
| 1458 |
-
var api = React.useImperativeHandle(ref, function () {
|
| 1459 |
-
return {
|
| 1460 |
-
start: function start() {
|
| 1461 |
-
return Promise.all(ctrl.current.map(function (c) {
|
| 1462 |
-
return new Promise(function (r) {
|
| 1463 |
-
return c.start(r);
|
| 1464 |
-
});
|
| 1465 |
-
}));
|
| 1466 |
-
},
|
| 1467 |
-
stop: function stop(finished) {
|
| 1468 |
-
return ctrl.current.forEach(function (c) {
|
| 1469 |
-
return c.stop(finished);
|
| 1470 |
-
});
|
| 1471 |
-
},
|
| 1472 |
|
| 1473 |
-
|
| 1474 |
-
return
|
|
|
|
|
|
|
| 1475 |
}
|
| 1476 |
|
| 1477 |
-
|
| 1478 |
-
}); // This function updates the controllers
|
| 1479 |
-
|
| 1480 |
-
var updateCtrl = React.useMemo(function () {
|
| 1481 |
-
return function (updateProps) {
|
| 1482 |
-
return ctrl.current.map(function (c, i) {
|
| 1483 |
-
c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]);
|
| 1484 |
-
if (!ref) c.start();
|
| 1485 |
-
});
|
| 1486 |
-
};
|
| 1487 |
-
}, [length]); // Update controller if props aren't functional
|
| 1488 |
-
|
| 1489 |
-
React.useEffect(function () {
|
| 1490 |
-
if (mounted.current) {
|
| 1491 |
-
if (!isFn) updateCtrl(props);
|
| 1492 |
-
} else if (!ref) ctrl.current.forEach(function (c) {
|
| 1493 |
-
return c.start();
|
| 1494 |
-
});
|
| 1495 |
-
}); // Update mounted flag and destroy controller on unmount
|
| 1496 |
-
|
| 1497 |
-
React.useEffect(function () {
|
| 1498 |
-
return mounted.current = true, function () {
|
| 1499 |
-
return ctrl.current.forEach(function (c) {
|
| 1500 |
-
return c.destroy();
|
| 1501 |
-
});
|
| 1502 |
-
};
|
| 1503 |
-
}, []); // Return animated props, or, anim-props + the update-setter above
|
| 1504 |
-
|
| 1505 |
-
var propValues = ctrl.current.map(function (c) {
|
| 1506 |
-
return c.getValues();
|
| 1507 |
-
});
|
| 1508 |
-
return isFn ? [propValues, updateCtrl, function (finished) {
|
| 1509 |
-
return ctrl.current.forEach(function (c) {
|
| 1510 |
-
return c.pause(finished);
|
| 1511 |
-
});
|
| 1512 |
-
}] : propValues;
|
| 1513 |
-
};
|
| 1514 |
|
| 1515 |
-
|
| 1516 |
-
|
| 1517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1518 |
*/
|
| 1519 |
|
| 1520 |
-
|
| 1521 |
-
|
| 1522 |
-
|
| 1523 |
-
|
| 1524 |
-
result = _useSprings[0],
|
| 1525 |
-
set = _useSprings[1],
|
| 1526 |
-
pause = _useSprings[2];
|
| 1527 |
|
| 1528 |
-
|
| 1529 |
-
|
|
|
|
| 1530 |
|
| 1531 |
-
|
| 1532 |
-
|
| 1533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1534 |
*/
|
| 1535 |
|
| 1536 |
-
|
| 1537 |
-
|
| 1538 |
-
|
| 1539 |
-
|
| 1540 |
-
|
| 1541 |
|
| 1542 |
-
|
| 1543 |
-
|
| 1544 |
-
|
| 1545 |
-
|
| 1546 |
-
|
| 1547 |
-
|
| 1548 |
-
|
| 1549 |
-
|
| 1550 |
-
|
| 1551 |
-
|
| 1552 |
-
|
| 1553 |
-
|
| 1554 |
-
|
|
|
|
| 1555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1556 |
|
| 1557 |
-
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
|
| 1563 |
-
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
return attachController;
|
| 1567 |
-
}
|
| 1568 |
-
});
|
| 1569 |
-
});
|
| 1570 |
};
|
| 1571 |
-
}
|
| 1572 |
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1576 |
|
| 1577 |
-
|
| 1578 |
-
|
| 1579 |
-
|
| 1580 |
-
|
| 1581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1582 |
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1586 |
*/
|
| 1587 |
|
| 1588 |
-
|
| 1589 |
-
|
| 1590 |
-
|
| 1591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1592 |
|
| 1593 |
-
|
| 1594 |
-
|
| 1595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1596 |
|
| 1597 |
-
|
| 1598 |
-
|
| 1599 |
-
|
| 1600 |
-
|
| 1601 |
-
|
| 1602 |
-
|
| 1603 |
-
|
| 1604 |
|
| 1605 |
-
|
| 1606 |
-
|
| 1607 |
-
|
| 1608 |
-
|
| 1609 |
-
|
| 1610 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1611 |
|
| 1612 |
-
function
|
| 1613 |
-
|
| 1614 |
-
|
| 1615 |
-
|
| 1616 |
-
return
|
| 1617 |
-
|
| 1618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1619 |
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
-
_get$reset = _get.reset,
|
| 1625 |
-
reset = _get$reset === void 0 ? false : _get$reset,
|
| 1626 |
-
enter = _get.enter,
|
| 1627 |
-
leave = _get.leave,
|
| 1628 |
-
update = _get.update,
|
| 1629 |
-
onDestroyed = _get.onDestroyed,
|
| 1630 |
-
keys = _get.keys,
|
| 1631 |
-
items = _get.items,
|
| 1632 |
-
onFrame = _get.onFrame,
|
| 1633 |
-
_onRest = _get.onRest,
|
| 1634 |
-
onStart = _get.onStart,
|
| 1635 |
-
ref = _get.ref,
|
| 1636 |
-
extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]);
|
| 1637 |
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
| 1641 |
-
|
| 1642 |
-
first: true,
|
| 1643 |
-
deleted: [],
|
| 1644 |
-
current: {},
|
| 1645 |
-
transitions: [],
|
| 1646 |
-
prevProps: {},
|
| 1647 |
-
paused: !!props.ref,
|
| 1648 |
-
instances: !mounted.current && new Map(),
|
| 1649 |
-
forceUpdate: forceUpdate
|
| 1650 |
-
});
|
| 1651 |
-
React.useImperativeHandle(props.ref, function () {
|
| 1652 |
-
return {
|
| 1653 |
-
start: function start() {
|
| 1654 |
-
return Promise.all(Array.from(state.current.instances).map(function (_ref) {
|
| 1655 |
-
var c = _ref[1];
|
| 1656 |
-
return new Promise(function (r) {
|
| 1657 |
-
return c.start(r);
|
| 1658 |
-
});
|
| 1659 |
-
}));
|
| 1660 |
-
},
|
| 1661 |
-
stop: function stop(finished) {
|
| 1662 |
-
return Array.from(state.current.instances).forEach(function (_ref2) {
|
| 1663 |
-
var c = _ref2[1];
|
| 1664 |
-
return c.stop(finished);
|
| 1665 |
-
});
|
| 1666 |
-
},
|
| 1667 |
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1674 |
|
| 1675 |
-
|
| 1676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1677 |
|
| 1678 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1679 |
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
to = transition.to,
|
| 1686 |
-
config = transition.config,
|
| 1687 |
-
trail = transition.trail,
|
| 1688 |
-
key = transition.key,
|
| 1689 |
-
item = transition.item;
|
| 1690 |
-
if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object
|
| 1691 |
|
| 1692 |
-
|
|
|
|
|
|
|
|
|
|
| 1693 |
|
| 1694 |
-
|
| 1695 |
-
|
| 1696 |
-
from: from,
|
| 1697 |
-
config: config,
|
| 1698 |
-
ref: ref,
|
| 1699 |
-
onRest: function onRest(values) {
|
| 1700 |
-
if (state.current.mounted) {
|
| 1701 |
-
if (transition.destroyed) {
|
| 1702 |
-
// If no ref is given delete destroyed items immediately
|
| 1703 |
-
if (!ref && !lazy) cleanUp(state, key);
|
| 1704 |
-
if (onDestroyed) onDestroyed(item);
|
| 1705 |
-
} // A transition comes to rest once all its springs conclude
|
| 1706 |
|
|
|
|
|
|
|
|
|
|
| 1707 |
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state);
|
| 1714 |
-
if (_onRest) _onRest(item, slot, values);
|
| 1715 |
-
}
|
| 1716 |
-
},
|
| 1717 |
-
onStart: onStart && function () {
|
| 1718 |
-
return onStart(item, slot);
|
| 1719 |
-
},
|
| 1720 |
-
onFrame: onFrame && function (values) {
|
| 1721 |
-
return onFrame(item, slot, values);
|
| 1722 |
-
},
|
| 1723 |
-
delay: trail,
|
| 1724 |
-
reset: reset && slot === ENTER // Update controller
|
| 1725 |
|
| 1726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1727 |
|
| 1728 |
-
|
| 1729 |
-
|
| 1730 |
-
|
|
|
|
| 1731 |
}
|
| 1732 |
|
| 1733 |
-
|
| 1734 |
-
|
| 1735 |
-
|
| 1736 |
-
state.current.mounted = mounted.current = false;
|
| 1737 |
-
Array.from(state.current.instances).map(function (_ref5) {
|
| 1738 |
-
var c = _ref5[1];
|
| 1739 |
-
return c.destroy();
|
| 1740 |
-
});
|
| 1741 |
-
state.current.instances.clear();
|
| 1742 |
-
};
|
| 1743 |
-
}, []);
|
| 1744 |
-
return state.current.transitions.map(function (_ref6) {
|
| 1745 |
-
var item = _ref6.item,
|
| 1746 |
-
slot = _ref6.slot,
|
| 1747 |
-
key = _ref6.key;
|
| 1748 |
-
return {
|
| 1749 |
-
item: item,
|
| 1750 |
-
key: key,
|
| 1751 |
-
state: slot,
|
| 1752 |
-
props: state.current.instances.get(key).getValues()
|
| 1753 |
-
};
|
| 1754 |
-
});
|
| 1755 |
-
}
|
| 1756 |
-
|
| 1757 |
-
function cleanUp(state, filterKey) {
|
| 1758 |
-
var deleted = state.current.deleted;
|
| 1759 |
|
| 1760 |
-
|
| 1761 |
-
|
| 1762 |
-
|
| 1763 |
-
|
| 1764 |
-
|
| 1765 |
-
|
| 1766 |
-
|
| 1767 |
-
|
| 1768 |
-
|
|
|
|
| 1769 |
|
| 1770 |
-
|
| 1771 |
-
|
|
|
|
|
|
|
|
|
|
| 1772 |
|
| 1773 |
-
|
| 1774 |
-
|
| 1775 |
-
|
| 1776 |
|
| 1777 |
-
|
| 1778 |
-
|
| 1779 |
-
|
| 1780 |
-
|
| 1781 |
-
|
| 1782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1783 |
|
| 1784 |
-
|
| 1785 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1786 |
|
| 1787 |
-
|
|
|
|
|
|
|
| 1788 |
|
| 1789 |
-
|
|
|
|
|
|
|
|
|
|
| 1790 |
}
|
| 1791 |
|
| 1792 |
-
|
| 1793 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1794 |
|
| 1795 |
-
function
|
| 1796 |
-
|
| 1797 |
-
|
| 1798 |
-
|
| 1799 |
|
| 1800 |
-
|
| 1801 |
-
|
| 1802 |
-
|
| 1803 |
-
|
| 1804 |
-
from = _get2.from,
|
| 1805 |
-
enter = _get2.enter,
|
| 1806 |
-
leave = _get2.leave,
|
| 1807 |
-
update = _get2.update,
|
| 1808 |
-
_get2$trail = _get2.trail,
|
| 1809 |
-
trail = _get2$trail === void 0 ? 0 : _get2$trail,
|
| 1810 |
-
unique = _get2.unique,
|
| 1811 |
-
config = _get2.config,
|
| 1812 |
-
_get2$order = _get2.order,
|
| 1813 |
-
order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order;
|
| 1814 |
|
| 1815 |
-
|
| 1816 |
-
_keys = _get3.keys,
|
| 1817 |
-
_items = _get3.items;
|
| 1818 |
|
| 1819 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1820 |
|
| 1821 |
-
|
|
|
|
|
|
|
| 1822 |
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
|
| 1826 |
-
|
| 1827 |
-
return !currentSet.has(item);
|
| 1828 |
-
});
|
| 1829 |
-
var removed = state.transitions.filter(function (item) {
|
| 1830 |
-
return !item.destroyed && !nextSet.has(item.originalKey);
|
| 1831 |
-
}).map(function (i) {
|
| 1832 |
-
return i.originalKey;
|
| 1833 |
-
});
|
| 1834 |
-
var updated = keys.filter(function (item) {
|
| 1835 |
-
return currentSet.has(item);
|
| 1836 |
-
});
|
| 1837 |
-
var delay = -trail;
|
| 1838 |
|
| 1839 |
-
|
| 1840 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1841 |
|
| 1842 |
-
|
| 1843 |
-
|
| 1844 |
-
|
| 1845 |
-
|
| 1846 |
-
|
| 1847 |
-
|
| 1848 |
-
|
| 1849 |
-
})) deleted = deleted.filter(function (t) {
|
| 1850 |
-
return t.originalKey !== key;
|
| 1851 |
-
});
|
| 1852 |
-
var keyIndex = keys.indexOf(key);
|
| 1853 |
-
var item = items[keyIndex];
|
| 1854 |
-
var slot = first && initial !== void 0 ? 'initial' : ENTER;
|
| 1855 |
-
current[key] = {
|
| 1856 |
-
slot: slot,
|
| 1857 |
-
originalKey: key,
|
| 1858 |
-
key: unique ? String(key) : guid++,
|
| 1859 |
-
item: item,
|
| 1860 |
-
trail: delay = delay + trail,
|
| 1861 |
-
config: callProp(config, item, slot),
|
| 1862 |
-
from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item),
|
| 1863 |
-
to: callProp(enter, item)
|
| 1864 |
-
};
|
| 1865 |
-
});
|
| 1866 |
-
break;
|
| 1867 |
-
}
|
| 1868 |
|
| 1869 |
-
|
| 1870 |
-
|
| 1871 |
-
|
| 1872 |
-
|
|
|
|
| 1873 |
|
| 1874 |
-
|
| 1875 |
-
|
| 1876 |
-
|
| 1877 |
-
|
| 1878 |
-
|
| 1879 |
-
|
| 1880 |
-
right: _keys[Math.min(_keys.length, keyIndex + 1)],
|
| 1881 |
-
trail: delay = delay + trail,
|
| 1882 |
-
config: callProp(config, item, slot),
|
| 1883 |
-
to: callProp(leave, item)
|
| 1884 |
-
}));
|
| 1885 |
-
delete current[key];
|
| 1886 |
-
});
|
| 1887 |
-
break;
|
| 1888 |
-
}
|
| 1889 |
|
| 1890 |
-
case UPDATE:
|
| 1891 |
-
{
|
| 1892 |
-
updated.forEach(function (key) {
|
| 1893 |
-
var keyIndex = keys.indexOf(key);
|
| 1894 |
-
var item = items[keyIndex];
|
| 1895 |
-
var slot = UPDATE;
|
| 1896 |
-
current[key] = _extends({}, current[key], {
|
| 1897 |
-
item: item,
|
| 1898 |
-
slot: slot,
|
| 1899 |
-
trail: delay = delay + trail,
|
| 1900 |
-
config: callProp(config, item, slot),
|
| 1901 |
-
to: callProp(update, item)
|
| 1902 |
-
});
|
| 1903 |
-
});
|
| 1904 |
-
break;
|
| 1905 |
-
}
|
| 1906 |
-
}
|
| 1907 |
}
|
| 1908 |
|
| 1909 |
-
|
| 1910 |
-
|
| 1911 |
-
|
| 1912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1913 |
|
| 1914 |
-
|
| 1915 |
-
|
| 1916 |
-
right = _ref10.right,
|
| 1917 |
-
item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]);
|
| 1918 |
|
| 1919 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1920 |
|
| 1921 |
-
|
| 1922 |
-
|
| 1923 |
-
|
|
|
|
|
|
|
|
|
|
| 1924 |
|
| 1925 |
-
|
| 1926 |
-
|
| 1927 |
-
}
|
| 1928 |
-
|
| 1929 |
-
|
| 1930 |
-
first: first && added.length === 0,
|
| 1931 |
-
transitions: out,
|
| 1932 |
-
current: current,
|
| 1933 |
-
deleted: deleted,
|
| 1934 |
-
prevProps: props
|
| 1935 |
-
});
|
| 1936 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1937 |
|
| 1938 |
-
|
| 1939 |
-
|
| 1940 |
-
function (_AnimatedObject) {
|
| 1941 |
-
_inheritsLoose(AnimatedStyle, _AnimatedObject);
|
| 1942 |
|
| 1943 |
-
|
| 1944 |
-
|
| 1945 |
|
| 1946 |
-
|
| 1947 |
-
style = {};
|
| 1948 |
-
}
|
| 1949 |
|
| 1950 |
-
_this = _AnimatedObject.call(this) || this;
|
| 1951 |
|
| 1952 |
-
|
| 1953 |
-
|
| 1954 |
-
|
| 1955 |
|
| 1956 |
-
|
| 1957 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1958 |
}
|
| 1959 |
|
| 1960 |
-
return
|
| 1961 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1962 |
|
| 1963 |
-
|
| 1964 |
-
|
| 1965 |
-
|
| 1966 |
-
|
| 1967 |
-
|
| 1968 |
-
|
| 1969 |
-
|
| 1970 |
-
|
| 1971 |
-
|
| 1972 |
-
|
| 1973 |
-
|
| 1974 |
-
|
| 1975 |
-
|
| 1976 |
-
blueviolet: 0x8a2be2ff,
|
| 1977 |
-
brown: 0xa52a2aff,
|
| 1978 |
-
burlywood: 0xdeb887ff,
|
| 1979 |
-
burntsienna: 0xea7e5dff,
|
| 1980 |
-
cadetblue: 0x5f9ea0ff,
|
| 1981 |
-
chartreuse: 0x7fff00ff,
|
| 1982 |
-
chocolate: 0xd2691eff,
|
| 1983 |
-
coral: 0xff7f50ff,
|
| 1984 |
-
cornflowerblue: 0x6495edff,
|
| 1985 |
-
cornsilk: 0xfff8dcff,
|
| 1986 |
-
crimson: 0xdc143cff,
|
| 1987 |
-
cyan: 0x00ffffff,
|
| 1988 |
-
darkblue: 0x00008bff,
|
| 1989 |
-
darkcyan: 0x008b8bff,
|
| 1990 |
-
darkgoldenrod: 0xb8860bff,
|
| 1991 |
-
darkgray: 0xa9a9a9ff,
|
| 1992 |
-
darkgreen: 0x006400ff,
|
| 1993 |
-
darkgrey: 0xa9a9a9ff,
|
| 1994 |
-
darkkhaki: 0xbdb76bff,
|
| 1995 |
-
darkmagenta: 0x8b008bff,
|
| 1996 |
-
darkolivegreen: 0x556b2fff,
|
| 1997 |
-
darkorange: 0xff8c00ff,
|
| 1998 |
-
darkorchid: 0x9932ccff,
|
| 1999 |
-
darkred: 0x8b0000ff,
|
| 2000 |
-
darksalmon: 0xe9967aff,
|
| 2001 |
-
darkseagreen: 0x8fbc8fff,
|
| 2002 |
-
darkslateblue: 0x483d8bff,
|
| 2003 |
-
darkslategray: 0x2f4f4fff,
|
| 2004 |
-
darkslategrey: 0x2f4f4fff,
|
| 2005 |
-
darkturquoise: 0x00ced1ff,
|
| 2006 |
-
darkviolet: 0x9400d3ff,
|
| 2007 |
-
deeppink: 0xff1493ff,
|
| 2008 |
-
deepskyblue: 0x00bfffff,
|
| 2009 |
-
dimgray: 0x696969ff,
|
| 2010 |
-
dimgrey: 0x696969ff,
|
| 2011 |
-
dodgerblue: 0x1e90ffff,
|
| 2012 |
-
firebrick: 0xb22222ff,
|
| 2013 |
-
floralwhite: 0xfffaf0ff,
|
| 2014 |
-
forestgreen: 0x228b22ff,
|
| 2015 |
-
fuchsia: 0xff00ffff,
|
| 2016 |
-
gainsboro: 0xdcdcdcff,
|
| 2017 |
-
ghostwhite: 0xf8f8ffff,
|
| 2018 |
-
gold: 0xffd700ff,
|
| 2019 |
-
goldenrod: 0xdaa520ff,
|
| 2020 |
-
gray: 0x808080ff,
|
| 2021 |
-
green: 0x008000ff,
|
| 2022 |
-
greenyellow: 0xadff2fff,
|
| 2023 |
-
grey: 0x808080ff,
|
| 2024 |
-
honeydew: 0xf0fff0ff,
|
| 2025 |
-
hotpink: 0xff69b4ff,
|
| 2026 |
-
indianred: 0xcd5c5cff,
|
| 2027 |
-
indigo: 0x4b0082ff,
|
| 2028 |
-
ivory: 0xfffff0ff,
|
| 2029 |
-
khaki: 0xf0e68cff,
|
| 2030 |
-
lavender: 0xe6e6faff,
|
| 2031 |
-
lavenderblush: 0xfff0f5ff,
|
| 2032 |
-
lawngreen: 0x7cfc00ff,
|
| 2033 |
-
lemonchiffon: 0xfffacdff,
|
| 2034 |
-
lightblue: 0xadd8e6ff,
|
| 2035 |
-
lightcoral: 0xf08080ff,
|
| 2036 |
-
lightcyan: 0xe0ffffff,
|
| 2037 |
-
lightgoldenrodyellow: 0xfafad2ff,
|
| 2038 |
-
lightgray: 0xd3d3d3ff,
|
| 2039 |
-
lightgreen: 0x90ee90ff,
|
| 2040 |
-
lightgrey: 0xd3d3d3ff,
|
| 2041 |
-
lightpink: 0xffb6c1ff,
|
| 2042 |
-
lightsalmon: 0xffa07aff,
|
| 2043 |
-
lightseagreen: 0x20b2aaff,
|
| 2044 |
-
lightskyblue: 0x87cefaff,
|
| 2045 |
-
lightslategray: 0x778899ff,
|
| 2046 |
-
lightslategrey: 0x778899ff,
|
| 2047 |
-
lightsteelblue: 0xb0c4deff,
|
| 2048 |
-
lightyellow: 0xffffe0ff,
|
| 2049 |
-
lime: 0x00ff00ff,
|
| 2050 |
-
limegreen: 0x32cd32ff,
|
| 2051 |
-
linen: 0xfaf0e6ff,
|
| 2052 |
-
magenta: 0xff00ffff,
|
| 2053 |
-
maroon: 0x800000ff,
|
| 2054 |
-
mediumaquamarine: 0x66cdaaff,
|
| 2055 |
-
mediumblue: 0x0000cdff,
|
| 2056 |
-
mediumorchid: 0xba55d3ff,
|
| 2057 |
-
mediumpurple: 0x9370dbff,
|
| 2058 |
-
mediumseagreen: 0x3cb371ff,
|
| 2059 |
-
mediumslateblue: 0x7b68eeff,
|
| 2060 |
-
mediumspringgreen: 0x00fa9aff,
|
| 2061 |
-
mediumturquoise: 0x48d1ccff,
|
| 2062 |
-
mediumvioletred: 0xc71585ff,
|
| 2063 |
-
midnightblue: 0x191970ff,
|
| 2064 |
-
mintcream: 0xf5fffaff,
|
| 2065 |
-
mistyrose: 0xffe4e1ff,
|
| 2066 |
-
moccasin: 0xffe4b5ff,
|
| 2067 |
-
navajowhite: 0xffdeadff,
|
| 2068 |
-
navy: 0x000080ff,
|
| 2069 |
-
oldlace: 0xfdf5e6ff,
|
| 2070 |
-
olive: 0x808000ff,
|
| 2071 |
-
olivedrab: 0x6b8e23ff,
|
| 2072 |
-
orange: 0xffa500ff,
|
| 2073 |
-
orangered: 0xff4500ff,
|
| 2074 |
-
orchid: 0xda70d6ff,
|
| 2075 |
-
palegoldenrod: 0xeee8aaff,
|
| 2076 |
-
palegreen: 0x98fb98ff,
|
| 2077 |
-
paleturquoise: 0xafeeeeff,
|
| 2078 |
-
palevioletred: 0xdb7093ff,
|
| 2079 |
-
papayawhip: 0xffefd5ff,
|
| 2080 |
-
peachpuff: 0xffdab9ff,
|
| 2081 |
-
peru: 0xcd853fff,
|
| 2082 |
-
pink: 0xffc0cbff,
|
| 2083 |
-
plum: 0xdda0ddff,
|
| 2084 |
-
powderblue: 0xb0e0e6ff,
|
| 2085 |
-
purple: 0x800080ff,
|
| 2086 |
-
rebeccapurple: 0x663399ff,
|
| 2087 |
-
red: 0xff0000ff,
|
| 2088 |
-
rosybrown: 0xbc8f8fff,
|
| 2089 |
-
royalblue: 0x4169e1ff,
|
| 2090 |
-
saddlebrown: 0x8b4513ff,
|
| 2091 |
-
salmon: 0xfa8072ff,
|
| 2092 |
-
sandybrown: 0xf4a460ff,
|
| 2093 |
-
seagreen: 0x2e8b57ff,
|
| 2094 |
-
seashell: 0xfff5eeff,
|
| 2095 |
-
sienna: 0xa0522dff,
|
| 2096 |
-
silver: 0xc0c0c0ff,
|
| 2097 |
-
skyblue: 0x87ceebff,
|
| 2098 |
-
slateblue: 0x6a5acdff,
|
| 2099 |
-
slategray: 0x708090ff,
|
| 2100 |
-
slategrey: 0x708090ff,
|
| 2101 |
-
snow: 0xfffafaff,
|
| 2102 |
-
springgreen: 0x00ff7fff,
|
| 2103 |
-
steelblue: 0x4682b4ff,
|
| 2104 |
-
tan: 0xd2b48cff,
|
| 2105 |
-
teal: 0x008080ff,
|
| 2106 |
-
thistle: 0xd8bfd8ff,
|
| 2107 |
-
tomato: 0xff6347ff,
|
| 2108 |
-
turquoise: 0x40e0d0ff,
|
| 2109 |
-
violet: 0xee82eeff,
|
| 2110 |
-
wheat: 0xf5deb3ff,
|
| 2111 |
-
white: 0xffffffff,
|
| 2112 |
-
whitesmoke: 0xf5f5f5ff,
|
| 2113 |
-
yellow: 0xffff00ff,
|
| 2114 |
-
yellowgreen: 0x9acd32ff
|
| 2115 |
-
};
|
| 2116 |
|
| 2117 |
-
|
| 2118 |
-
|
| 2119 |
-
var PERCENTAGE = NUMBER + '%';
|
| 2120 |
|
| 2121 |
-
|
| 2122 |
-
|
| 2123 |
-
parts[_key] = arguments[_key];
|
| 2124 |
}
|
| 2125 |
|
| 2126 |
-
return
|
| 2127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2128 |
|
| 2129 |
-
|
| 2130 |
-
|
| 2131 |
-
var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
| 2132 |
-
var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
| 2133 |
-
var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
| 2134 |
-
var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
| 2135 |
-
var hex6 = /^#([0-9a-fA-F]{6})$/;
|
| 2136 |
-
var hex8 = /^#([0-9a-fA-F]{8})$/;
|
| 2137 |
-
|
| 2138 |
-
/*
|
| 2139 |
-
https://github.com/react-community/normalize-css-color
|
| 2140 |
-
|
| 2141 |
-
BSD 3-Clause License
|
| 2142 |
-
|
| 2143 |
-
Copyright (c) 2016, React Community
|
| 2144 |
-
All rights reserved.
|
| 2145 |
-
|
| 2146 |
-
Redistribution and use in source and binary forms, with or without
|
| 2147 |
-
modification, are permitted provided that the following conditions are met:
|
| 2148 |
-
|
| 2149 |
-
* Redistributions of source code must retain the above copyright notice, this
|
| 2150 |
-
list of conditions and the following disclaimer.
|
| 2151 |
|
| 2152 |
-
|
| 2153 |
-
|
| 2154 |
-
|
| 2155 |
|
| 2156 |
-
|
| 2157 |
-
|
| 2158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2159 |
|
| 2160 |
-
|
| 2161 |
-
|
| 2162 |
-
|
| 2163 |
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 2164 |
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 2165 |
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 2166 |
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 2167 |
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 2168 |
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 2169 |
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 2170 |
-
*/
|
| 2171 |
-
function normalizeColor(color) {
|
| 2172 |
-
var match;
|
| 2173 |
|
| 2174 |
-
|
| 2175 |
-
|
| 2176 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2178 |
|
| 2179 |
-
|
| 2180 |
-
|
| 2181 |
|
| 2182 |
-
if (
|
| 2183 |
-
return
|
| 2184 |
-
parse255(match[2]) << 16 | // g
|
| 2185 |
-
parse255(match[3]) << 8 | // b
|
| 2186 |
-
0x000000ff) >>> // a
|
| 2187 |
-
0;
|
| 2188 |
}
|
| 2189 |
|
| 2190 |
-
|
| 2191 |
-
|
| 2192 |
-
|
| 2193 |
-
|
| 2194 |
-
|
| 2195 |
-
|
| 2196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2197 |
|
| 2198 |
-
|
| 2199 |
-
|
| 2200 |
-
|
| 2201 |
-
|
| 2202 |
-
|
| 2203 |
-
|
| 2204 |
-
|
|
|
|
|
|
|
|
|
|
| 2205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2206 |
|
| 2207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2208 |
|
| 2209 |
-
|
| 2210 |
-
|
| 2211 |
-
|
| 2212 |
-
|
| 2213 |
-
|
| 2214 |
-
|
| 2215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2216 |
|
| 2217 |
-
|
| 2218 |
-
|
| 2219 |
-
|
| 2220 |
-
|
| 2221 |
-
|
| 2222 |
-
|
| 2223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2224 |
|
| 2225 |
-
|
| 2226 |
-
|
| 2227 |
-
|
| 2228 |
-
|
| 2229 |
-
|
| 2230 |
-
0;
|
| 2231 |
}
|
| 2232 |
|
| 2233 |
-
return
|
| 2234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2235 |
|
| 2236 |
-
|
| 2237 |
-
|
| 2238 |
-
|
| 2239 |
-
|
| 2240 |
-
|
| 2241 |
-
|
| 2242 |
-
|
| 2243 |
-
}
|
|
|
|
| 2244 |
|
| 2245 |
-
function
|
| 2246 |
-
|
| 2247 |
-
var p = 2 * l - q;
|
| 2248 |
-
var r = hue2rgb(p, q, h + 1 / 3);
|
| 2249 |
-
var g = hue2rgb(p, q, h);
|
| 2250 |
-
var b = hue2rgb(p, q, h - 1 / 3);
|
| 2251 |
-
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
| 2252 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2253 |
|
| 2254 |
-
function
|
| 2255 |
-
|
| 2256 |
-
if (int < 0) return 0;
|
| 2257 |
-
if (int > 255) return 255;
|
| 2258 |
-
return int;
|
| 2259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2260 |
|
| 2261 |
-
function
|
| 2262 |
-
|
| 2263 |
-
return (int % 360 + 360) % 360 / 360;
|
| 2264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2265 |
|
| 2266 |
-
function
|
| 2267 |
-
|
| 2268 |
-
if (num < 0) return 0;
|
| 2269 |
-
if (num > 1) return 255;
|
| 2270 |
-
return Math.round(num * 255);
|
| 2271 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2272 |
|
| 2273 |
-
function
|
| 2274 |
-
|
| 2275 |
-
var int = parseFloat(str);
|
| 2276 |
-
if (int < 0) return 0;
|
| 2277 |
-
if (int > 100) return 1;
|
| 2278 |
-
return int / 100;
|
| 2279 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2280 |
|
| 2281 |
-
function
|
| 2282 |
-
|
| 2283 |
-
if (int32Color === null) return input;
|
| 2284 |
-
int32Color = int32Color || 0;
|
| 2285 |
-
var r = (int32Color & 0xff000000) >>> 24;
|
| 2286 |
-
var g = (int32Color & 0x00ff0000) >>> 16;
|
| 2287 |
-
var b = (int32Color & 0x0000ff00) >>> 8;
|
| 2288 |
-
var a = (int32Color & 0x000000ff) / 255;
|
| 2289 |
-
return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
| 2290 |
-
} // Problem: https://github.com/animatedjs/animated/pull/102
|
| 2291 |
-
// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662
|
| 2292 |
-
|
| 2293 |
|
| 2294 |
-
|
| 2295 |
-
|
|
|
|
| 2296 |
|
| 2297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2298 |
|
| 2299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2300 |
/**
|
| 2301 |
-
*
|
| 2302 |
-
*
|
| 2303 |
-
* things like:
|
| 2304 |
*
|
| 2305 |
-
*
|
| 2306 |
-
*
|
| 2307 |
-
*
|
| 2308 |
*/
|
| 2309 |
|
| 2310 |
-
|
| 2311 |
-
|
| 2312 |
-
|
| 2313 |
-
|
| 2314 |
-
}
|
| 2315 |
-
|
| 2316 |
-
|
| 2317 |
-
|
| 2318 |
-
return [];
|
| 2319 |
-
});
|
| 2320 |
-
outputRange.forEach(function (value) {
|
| 2321 |
-
value.match(stringShapeRegex).forEach(function (number, i) {
|
| 2322 |
-
return outputRanges[i].push(+number);
|
| 2323 |
-
});
|
| 2324 |
-
});
|
| 2325 |
-
var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) {
|
| 2326 |
-
return createInterpolator(_extends({}, config, {
|
| 2327 |
-
output: outputRanges[i]
|
| 2328 |
-
}));
|
| 2329 |
-
});
|
| 2330 |
-
return function (input) {
|
| 2331 |
-
var i = 0;
|
| 2332 |
-
return outputRange[0] // 'rgba(0, 100, 200, 0)'
|
| 2333 |
-
// ->
|
| 2334 |
-
// 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...'
|
| 2335 |
-
.replace(stringShapeRegex, function () {
|
| 2336 |
-
return interpolations[i++](input);
|
| 2337 |
-
}) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to
|
| 2338 |
-
// round the opacity (4th column).
|
| 2339 |
-
.replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) {
|
| 2340 |
-
return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")";
|
| 2341 |
-
});
|
| 2342 |
-
};
|
| 2343 |
-
};
|
| 2344 |
-
|
| 2345 |
-
var isUnitlessNumber = {
|
| 2346 |
-
animationIterationCount: true,
|
| 2347 |
-
borderImageOutset: true,
|
| 2348 |
-
borderImageSlice: true,
|
| 2349 |
-
borderImageWidth: true,
|
| 2350 |
-
boxFlex: true,
|
| 2351 |
-
boxFlexGroup: true,
|
| 2352 |
-
boxOrdinalGroup: true,
|
| 2353 |
-
columnCount: true,
|
| 2354 |
-
columns: true,
|
| 2355 |
-
flex: true,
|
| 2356 |
-
flexGrow: true,
|
| 2357 |
-
flexPositive: true,
|
| 2358 |
-
flexShrink: true,
|
| 2359 |
-
flexNegative: true,
|
| 2360 |
-
flexOrder: true,
|
| 2361 |
-
gridRow: true,
|
| 2362 |
-
gridRowEnd: true,
|
| 2363 |
-
gridRowSpan: true,
|
| 2364 |
-
gridRowStart: true,
|
| 2365 |
-
gridColumn: true,
|
| 2366 |
-
gridColumnEnd: true,
|
| 2367 |
-
gridColumnSpan: true,
|
| 2368 |
-
gridColumnStart: true,
|
| 2369 |
-
fontWeight: true,
|
| 2370 |
-
lineClamp: true,
|
| 2371 |
-
lineHeight: true,
|
| 2372 |
-
opacity: true,
|
| 2373 |
-
order: true,
|
| 2374 |
-
orphans: true,
|
| 2375 |
-
tabSize: true,
|
| 2376 |
-
widows: true,
|
| 2377 |
-
zIndex: true,
|
| 2378 |
-
zoom: true,
|
| 2379 |
-
// SVG-related properties
|
| 2380 |
-
fillOpacity: true,
|
| 2381 |
-
floodOpacity: true,
|
| 2382 |
-
stopOpacity: true,
|
| 2383 |
-
strokeDasharray: true,
|
| 2384 |
-
strokeDashoffset: true,
|
| 2385 |
-
strokeMiterlimit: true,
|
| 2386 |
-
strokeOpacity: true,
|
| 2387 |
-
strokeWidth: true
|
| 2388 |
-
};
|
| 2389 |
-
|
| 2390 |
-
var prefixKey = function prefixKey(prefix, key) {
|
| 2391 |
-
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
| 2392 |
-
};
|
| 2393 |
-
|
| 2394 |
-
var prefixes = ['Webkit', 'Ms', 'Moz', 'O'];
|
| 2395 |
-
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) {
|
| 2396 |
-
prefixes.forEach(function (prefix) {
|
| 2397 |
-
return acc[prefixKey(prefix, prop)] = acc[prop];
|
| 2398 |
-
});
|
| 2399 |
-
return acc;
|
| 2400 |
-
}, isUnitlessNumber);
|
| 2401 |
|
| 2402 |
-
|
| 2403 |
-
|
| 2404 |
-
|
| 2405 |
|
| 2406 |
-
return
|
| 2407 |
}
|
| 2408 |
-
|
| 2409 |
-
var attributeCache = {};
|
| 2410 |
-
injectCreateAnimatedStyle(function (style) {
|
| 2411 |
-
return new AnimatedStyle(style);
|
| 2412 |
-
});
|
| 2413 |
-
injectDefaultElement('div');
|
| 2414 |
-
injectStringInterpolator(createStringInterpolator);
|
| 2415 |
-
injectColorNames(colors);
|
| 2416 |
-
injectApplyAnimatedValues(function (instance, props) {
|
| 2417 |
-
if (instance.nodeType && instance.setAttribute !== undefined) {
|
| 2418 |
-
var style = props.style,
|
| 2419 |
-
children = props.children,
|
| 2420 |
-
scrollTop = props.scrollTop,
|
| 2421 |
-
scrollLeft = props.scrollLeft,
|
| 2422 |
-
attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]);
|
| 2423 |
-
|
| 2424 |
-
var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';
|
| 2425 |
-
if (scrollTop !== void 0) instance.scrollTop = scrollTop;
|
| 2426 |
-
if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value
|
| 2427 |
-
|
| 2428 |
-
if (children !== void 0) instance.textContent = children; // Set styles ...
|
| 2429 |
-
|
| 2430 |
-
for (var styleName in style) {
|
| 2431 |
-
if (!style.hasOwnProperty(styleName)) continue;
|
| 2432 |
-
var isCustomProperty = styleName.indexOf('--') === 0;
|
| 2433 |
-
var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty);
|
| 2434 |
-
if (styleName === 'float') styleName = 'cssFloat';
|
| 2435 |
-
if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue;
|
| 2436 |
-
} // Set attributes ...
|
| 2437 |
-
|
| 2438 |
-
|
| 2439 |
-
for (var name in attributes) {
|
| 2440 |
-
// Attributes are written in dash case
|
| 2441 |
-
var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) {
|
| 2442 |
-
return '-' + n.toLowerCase();
|
| 2443 |
-
}));
|
| 2444 |
-
if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]);
|
| 2445 |
-
}
|
| 2446 |
-
|
| 2447 |
-
return;
|
| 2448 |
-
} else return false;
|
| 2449 |
-
}, function (style) {
|
| 2450 |
-
return style;
|
| 2451 |
-
});
|
| 2452 |
-
|
| 2453 |
-
var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
|
| 2454 |
-
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
|
| 2455 |
-
// Extend animated with all the available THREE elements
|
| 2456 |
-
var apply = merge(createAnimatedComponent, false);
|
| 2457 |
-
var extendedAnimated = apply(domElements);
|
| 2458 |
-
|
| 2459 |
-
exports.apply = apply;
|
| 2460 |
-
exports.config = config;
|
| 2461 |
-
exports.update = update;
|
| 2462 |
-
exports.animated = extendedAnimated;
|
| 2463 |
-
exports.a = extendedAnimated;
|
| 2464 |
-
exports.interpolate = interpolate$1;
|
| 2465 |
-
exports.Globals = Globals;
|
| 2466 |
-
exports.useSpring = useSpring;
|
| 2467 |
-
exports.useTrail = useTrail;
|
| 2468 |
-
exports.useTransition = useTransition;
|
| 2469 |
-
exports.useChain = useChain;
|
| 2470 |
-
exports.useSprings = useSprings;
|
| 2471 |
-
|
| 2472 |
-
|
| 2473 |
-
/***/ }),
|
| 2474 |
-
|
| 2475 |
-
/***/ 109:
|
| 2476 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 2477 |
-
|
| 2478 |
-
"use strict";
|
| 2479 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 2480 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 2481 |
/**
|
| 2482 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2483 |
*/
|
| 2484 |
|
| 2485 |
-
|
| 2486 |
-
|
|
|
|
|
|
|
| 2487 |
/**
|
| 2488 |
-
*
|
|
|
|
|
|
|
| 2489 |
*
|
| 2490 |
-
* @param {
|
| 2491 |
-
*
|
| 2492 |
-
* Other props will be passed to wrapped SVG component
|
| 2493 |
*
|
| 2494 |
-
* @return {
|
| 2495 |
*/
|
| 2496 |
|
| 2497 |
-
function
|
| 2498 |
-
|
| 2499 |
-
size = 24,
|
| 2500 |
-
...props
|
| 2501 |
-
}) {
|
| 2502 |
-
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
|
| 2503 |
-
width: size,
|
| 2504 |
-
height: size,
|
| 2505 |
-
...props
|
| 2506 |
-
});
|
| 2507 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2508 |
|
| 2509 |
-
|
| 2510 |
-
|
| 2511 |
-
|
| 2512 |
-
/***/ }),
|
| 2513 |
|
| 2514 |
-
|
| 2515 |
-
|
|
|
|
|
|
|
| 2516 |
|
| 2517 |
-
|
| 2518 |
-
|
| 2519 |
-
|
| 2520 |
-
|
| 2521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2522 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2524 |
/**
|
| 2525 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2526 |
*/
|
| 2527 |
|
| 2528 |
-
|
| 2529 |
-
|
| 2530 |
-
|
| 2531 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 2532 |
-
d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
|
| 2533 |
-
}));
|
| 2534 |
-
/* harmony default export */ __webpack_exports__["a"] = (close);
|
| 2535 |
-
//# sourceMappingURL=close.js.map
|
| 2536 |
|
| 2537 |
-
|
|
|
|
|
|
|
|
|
|
| 2538 |
|
| 2539 |
-
|
| 2540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2541 |
|
| 2542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2544 |
|
| 2545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2546 |
|
| 2547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2548 |
|
| 2549 |
-
/***/ 114:
|
| 2550 |
-
/***/ (function(module, exports) {
|
| 2551 |
|
| 2552 |
-
(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2553 |
|
| 2554 |
-
/***/ }),
|
| 2555 |
|
| 2556 |
-
|
| 2557 |
-
|
|
|
|
|
|
|
| 2558 |
|
| 2559 |
-
(function() { module.exports = window["wp"]["shortcode"]; }());
|
| 2560 |
|
| 2561 |
-
|
| 2562 |
|
| 2563 |
-
|
| 2564 |
-
|
|
|
|
| 2565 |
|
| 2566 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2567 |
|
| 2568 |
-
|
|
|
|
|
|
|
| 2569 |
|
| 2570 |
-
/***/ 127:
|
| 2571 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 2572 |
|
| 2573 |
-
|
| 2574 |
-
|
| 2575 |
-
|
| 2576 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 2577 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 2578 |
|
| 2579 |
|
|
|
|
|
|
|
| 2580 |
/**
|
| 2581 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2582 |
*/
|
| 2583 |
|
| 2584 |
-
|
| 2585 |
-
|
| 2586 |
-
|
| 2587 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 2588 |
-
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
|
| 2589 |
-
}));
|
| 2590 |
-
/* harmony default export */ __webpack_exports__["a"] = (plus);
|
| 2591 |
-
//# sourceMappingURL=plus.js.map
|
| 2592 |
-
|
| 2593 |
-
/***/ }),
|
| 2594 |
-
|
| 2595 |
-
/***/ 128:
|
| 2596 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 2597 |
-
|
| 2598 |
-
"use strict";
|
| 2599 |
/**
|
| 2600 |
-
*
|
|
|
|
|
|
|
| 2601 |
*
|
| 2602 |
-
*
|
| 2603 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2604 |
*/
|
| 2605 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2607 |
|
| 2608 |
-
|
| 2609 |
-
|
| 2610 |
-
|
| 2611 |
-
|
| 2612 |
-
|
| 2613 |
-
|
| 2614 |
-
module.exports = function() {
|
| 2615 |
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
| 2616 |
-
if (secret === ReactPropTypesSecret) {
|
| 2617 |
-
// It is still safe when called from React.
|
| 2618 |
-
return;
|
| 2619 |
-
}
|
| 2620 |
-
var err = new Error(
|
| 2621 |
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
| 2622 |
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
| 2623 |
-
'Read more at http://fb.me/use-check-prop-types'
|
| 2624 |
-
);
|
| 2625 |
-
err.name = 'Invariant Violation';
|
| 2626 |
-
throw err;
|
| 2627 |
-
};
|
| 2628 |
-
shim.isRequired = shim;
|
| 2629 |
-
function getShim() {
|
| 2630 |
-
return shim;
|
| 2631 |
-
};
|
| 2632 |
-
// Important!
|
| 2633 |
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
| 2634 |
-
var ReactPropTypes = {
|
| 2635 |
-
array: shim,
|
| 2636 |
-
bool: shim,
|
| 2637 |
-
func: shim,
|
| 2638 |
-
number: shim,
|
| 2639 |
-
object: shim,
|
| 2640 |
-
string: shim,
|
| 2641 |
-
symbol: shim,
|
| 2642 |
|
| 2643 |
-
|
| 2644 |
-
|
| 2645 |
-
|
| 2646 |
-
elementType: shim,
|
| 2647 |
-
instanceOf: getShim,
|
| 2648 |
-
node: shim,
|
| 2649 |
-
objectOf: getShim,
|
| 2650 |
-
oneOf: getShim,
|
| 2651 |
-
oneOfType: getShim,
|
| 2652 |
-
shape: getShim,
|
| 2653 |
-
exact: getShim,
|
| 2654 |
|
| 2655 |
-
|
| 2656 |
-
|
| 2657 |
-
}
|
|
|
|
|
|
|
| 2658 |
|
| 2659 |
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
| 2660 |
|
| 2661 |
-
|
| 2662 |
-
};
|
| 2663 |
|
|
|
|
|
|
|
|
|
|
| 2664 |
|
| 2665 |
-
|
|
|
|
|
|
|
| 2666 |
|
| 2667 |
-
|
| 2668 |
-
|
|
|
|
| 2669 |
|
| 2670 |
-
|
|
|
|
| 2671 |
/**
|
| 2672 |
-
*
|
|
|
|
| 2673 |
*
|
| 2674 |
-
*
|
| 2675 |
-
*
|
|
|
|
| 2676 |
*/
|
| 2677 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2678 |
|
|
|
|
|
|
|
|
|
|
| 2679 |
|
| 2680 |
-
|
| 2681 |
-
|
| 2682 |
-
|
| 2683 |
-
|
| 2684 |
-
|
| 2685 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2686 |
|
| 2687 |
-
|
| 2688 |
-
|
| 2689 |
|
| 2690 |
-
(
|
|
|
|
|
|
|
| 2691 |
|
| 2692 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2693 |
|
| 2694 |
-
|
| 2695 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2696 |
|
| 2697 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2698 |
|
| 2699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2700 |
|
| 2701 |
-
|
| 2702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2703 |
|
| 2704 |
-
|
|
|
|
|
|
|
| 2705 |
|
| 2706 |
-
|
|
|
|
|
|
|
|
|
|
| 2707 |
|
| 2708 |
-
|
| 2709 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2710 |
|
| 2711 |
-
|
| 2712 |
-
|
| 2713 |
-
|
| 2714 |
-
|
| 2715 |
-
|
| 2716 |
|
|
|
|
|
|
|
|
|
|
| 2717 |
|
|
|
|
|
|
|
| 2718 |
/**
|
| 2719 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2720 |
*/
|
| 2721 |
|
| 2722 |
-
|
| 2723 |
-
|
| 2724 |
-
|
| 2725 |
-
|
| 2726 |
-
|
| 2727 |
-
}));
|
| 2728 |
-
/* harmony default export */ __webpack_exports__["a"] = (blockDefault);
|
| 2729 |
-
//# sourceMappingURL=block-default.js.map
|
| 2730 |
-
|
| 2731 |
-
/***/ }),
|
| 2732 |
-
|
| 2733 |
-
/***/ 151:
|
| 2734 |
-
/***/ (function(module, exports) {
|
| 2735 |
|
| 2736 |
-
|
| 2737 |
-
|
| 2738 |
-
|
| 2739 |
-
var source = arguments[i];
|
| 2740 |
|
| 2741 |
-
|
| 2742 |
-
|
| 2743 |
-
|
| 2744 |
-
|
| 2745 |
-
|
| 2746 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2747 |
|
| 2748 |
-
|
| 2749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2750 |
|
| 2751 |
-
|
| 2752 |
-
return
|
| 2753 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2754 |
|
| 2755 |
-
|
| 2756 |
-
|
|
|
|
|
|
|
|
|
|
| 2757 |
|
| 2758 |
-
|
|
|
|
|
|
|
| 2759 |
|
| 2760 |
-
|
| 2761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2762 |
|
| 2763 |
-
|
| 2764 |
-
|
| 2765 |
-
|
| 2766 |
-
|
| 2767 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2769 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2770 |
/**
|
| 2771 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2772 |
*/
|
| 2773 |
|
| 2774 |
-
|
| 2775 |
-
|
| 2776 |
-
|
| 2777 |
-
|
| 2778 |
-
|
| 2779 |
-
|
| 2780 |
-
|
| 2781 |
-
|
| 2782 |
-
|
| 2783 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2784 |
|
| 2785 |
-
|
| 2786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2787 |
|
| 2788 |
-
|
| 2789 |
-
|
| 2790 |
-
|
| 2791 |
-
|
| 2792 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2794 |
|
|
|
|
|
|
|
|
|
|
| 2795 |
/**
|
| 2796 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2797 |
*/
|
| 2798 |
|
| 2799 |
-
|
| 2800 |
-
|
| 2801 |
-
|
| 2802 |
-
|
| 2803 |
-
|
| 2804 |
-
|
| 2805 |
-
|
| 2806 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2807 |
|
| 2808 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2809 |
|
| 2810 |
-
|
| 2811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2812 |
|
| 2813 |
-
|
| 2814 |
-
//
|
| 2815 |
-
|
| 2816 |
-
|
| 2817 |
-
|
| 2818 |
-
constructor: {
|
| 2819 |
-
value: ctor,
|
| 2820 |
-
enumerable: false,
|
| 2821 |
-
writable: true,
|
| 2822 |
-
configurable: true
|
| 2823 |
-
}
|
| 2824 |
-
});
|
| 2825 |
-
};
|
| 2826 |
-
} else {
|
| 2827 |
-
// old school shim for old browsers
|
| 2828 |
-
module.exports = function inherits(ctor, superCtor) {
|
| 2829 |
-
ctor.super_ = superCtor
|
| 2830 |
-
var TempCtor = function () {}
|
| 2831 |
-
TempCtor.prototype = superCtor.prototype
|
| 2832 |
-
ctor.prototype = new TempCtor()
|
| 2833 |
-
ctor.prototype.constructor = ctor
|
| 2834 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2835 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2836 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2837 |
|
| 2838 |
-
|
|
|
|
|
|
|
| 2839 |
|
| 2840 |
-
|
| 2841 |
-
|
|
|
|
| 2842 |
|
| 2843 |
-
|
| 2844 |
-
|
| 2845 |
-
|
| 2846 |
-
|
| 2847 |
-
|
|
|
|
| 2848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2849 |
|
|
|
|
|
|
|
|
|
|
| 2850 |
/**
|
| 2851 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2852 |
*/
|
| 2853 |
|
| 2854 |
-
|
| 2855 |
-
|
| 2856 |
-
|
| 2857 |
-
|
| 2858 |
-
|
| 2859 |
-
|
| 2860 |
-
|
| 2861 |
-
|
|
|
|
|
|
|
| 2862 |
|
| 2863 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2864 |
|
| 2865 |
-
|
| 2866 |
-
|
|
|
|
|
|
|
| 2867 |
|
| 2868 |
-
|
| 2869 |
-
if (source == null) return {};
|
| 2870 |
-
var target = {};
|
| 2871 |
-
var sourceKeys = Object.keys(source);
|
| 2872 |
-
var key, i;
|
| 2873 |
|
| 2874 |
-
|
| 2875 |
-
|
| 2876 |
-
if (excluded.indexOf(key) >= 0) continue;
|
| 2877 |
-
target[key] = source[key];
|
| 2878 |
}
|
| 2879 |
|
| 2880 |
-
return
|
| 2881 |
}
|
| 2882 |
|
| 2883 |
-
|
| 2884 |
-
|
| 2885 |
-
|
| 2886 |
-
|
| 2887 |
-
|
| 2888 |
-
/***/ 177:
|
| 2889 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 2890 |
|
| 2891 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2892 |
|
| 2893 |
-
|
| 2894 |
-
|
| 2895 |
-
subClass.prototype.constructor = subClass;
|
| 2896 |
-
setPrototypeOf(subClass, superClass);
|
| 2897 |
-
}
|
| 2898 |
|
| 2899 |
-
|
| 2900 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2901 |
|
| 2902 |
-
/***/ }),
|
| 2903 |
|
| 2904 |
-
|
| 2905 |
-
|
| 2906 |
|
| 2907 |
-
|
| 2908 |
-
|
| 2909 |
-
|
| 2910 |
-
|
| 2911 |
-
|
|
|
|
| 2912 |
|
| 2913 |
-
|
| 2914 |
-
|
| 2915 |
-
}
|
| 2916 |
|
| 2917 |
-
|
| 2918 |
-
|
|
|
|
|
|
|
| 2919 |
|
| 2920 |
-
|
|
|
|
|
|
|
| 2921 |
|
| 2922 |
-
|
| 2923 |
-
/***/ (function(module, exports) {
|
| 2924 |
|
| 2925 |
-
|
| 2926 |
-
|
| 2927 |
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
| 2928 |
}
|
| 2929 |
|
| 2930 |
-
|
| 2931 |
-
|
| 2932 |
|
| 2933 |
-
|
| 2934 |
-
|
|
|
|
| 2935 |
|
| 2936 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2937 |
|
| 2938 |
-
|
| 2939 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2940 |
|
| 2941 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2942 |
|
| 2943 |
|
| 2944 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2945 |
|
| 2946 |
-
function
|
| 2947 |
-
|
| 2948 |
-
|
| 2949 |
-
|
| 2950 |
-
|
| 2951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2952 |
|
| 2953 |
-
|
| 2954 |
-
var
|
| 2955 |
-
var alignWithTop = config.alignWithTop;
|
| 2956 |
-
var alignWithLeft = config.alignWithLeft;
|
| 2957 |
-
var offsetTop = config.offsetTop || 0;
|
| 2958 |
-
var offsetLeft = config.offsetLeft || 0;
|
| 2959 |
-
var offsetBottom = config.offsetBottom || 0;
|
| 2960 |
-
var offsetRight = config.offsetRight || 0;
|
| 2961 |
|
| 2962 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2963 |
|
| 2964 |
-
var isWin = util.isWindow(container);
|
| 2965 |
-
var isFramed = !!(isWin && container.frameElement);
|
| 2966 |
-
var elemOffset = util.offset(elem);
|
| 2967 |
-
var eh = util.outerHeight(elem);
|
| 2968 |
-
var ew = util.outerWidth(elem);
|
| 2969 |
-
var containerOffset = undefined;
|
| 2970 |
-
var ch = undefined;
|
| 2971 |
-
var cw = undefined;
|
| 2972 |
-
var containerScroll = undefined;
|
| 2973 |
-
var diffTop = undefined;
|
| 2974 |
-
var diffBottom = undefined;
|
| 2975 |
-
var win = undefined;
|
| 2976 |
-
var winScroll = undefined;
|
| 2977 |
-
var ww = undefined;
|
| 2978 |
-
var wh = undefined;
|
| 2979 |
|
| 2980 |
-
|
| 2981 |
-
|
|
|
|
| 2982 |
}
|
| 2983 |
|
| 2984 |
-
|
| 2985 |
-
|
| 2986 |
-
|
| 2987 |
-
|
| 2988 |
-
|
| 2989 |
-
|
| 2990 |
-
|
| 2991 |
-
|
| 2992 |
-
|
| 2993 |
-
diffTop = {
|
| 2994 |
-
left: elemOffset.left - winScroll.left - offsetLeft,
|
| 2995 |
-
top: elemOffset.top - winScroll.top - offsetTop
|
| 2996 |
-
};
|
| 2997 |
-
diffBottom = {
|
| 2998 |
-
left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
|
| 2999 |
-
top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
|
| 3000 |
-
};
|
| 3001 |
-
containerScroll = winScroll;
|
| 3002 |
-
} else {
|
| 3003 |
-
containerOffset = util.offset(container);
|
| 3004 |
-
ch = container.clientHeight;
|
| 3005 |
-
cw = container.clientWidth;
|
| 3006 |
-
containerScroll = {
|
| 3007 |
-
left: container.scrollLeft,
|
| 3008 |
-
top: container.scrollTop
|
| 3009 |
-
};
|
| 3010 |
-
// elem 相对 container 可视视窗的距离
|
| 3011 |
-
// 注意边框, offset 是边框到根节点
|
| 3012 |
-
diffTop = {
|
| 3013 |
-
left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
|
| 3014 |
-
top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
|
| 3015 |
-
};
|
| 3016 |
-
diffBottom = {
|
| 3017 |
-
left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
|
| 3018 |
-
top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
|
| 3019 |
-
};
|
| 3020 |
-
}
|
| 3021 |
|
| 3022 |
-
if (diffTop.top < 0 || diffBottom.top > 0) {
|
| 3023 |
-
// 强制向上
|
| 3024 |
-
if (alignWithTop === true) {
|
| 3025 |
-
util.scrollTop(container, containerScroll.top + diffTop.top);
|
| 3026 |
-
} else if (alignWithTop === false) {
|
| 3027 |
-
util.scrollTop(container, containerScroll.top + diffBottom.top);
|
| 3028 |
-
} else {
|
| 3029 |
-
// 自动调整
|
| 3030 |
-
if (diffTop.top < 0) {
|
| 3031 |
-
util.scrollTop(container, containerScroll.top + diffTop.top);
|
| 3032 |
-
} else {
|
| 3033 |
-
util.scrollTop(container, containerScroll.top + diffBottom.top);
|
| 3034 |
-
}
|
| 3035 |
-
}
|
| 3036 |
-
} else {
|
| 3037 |
-
if (!onlyScrollIfNeeded) {
|
| 3038 |
-
alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
|
| 3039 |
-
if (alignWithTop) {
|
| 3040 |
-
util.scrollTop(container, containerScroll.top + diffTop.top);
|
| 3041 |
-
} else {
|
| 3042 |
-
util.scrollTop(container, containerScroll.top + diffBottom.top);
|
| 3043 |
-
}
|
| 3044 |
-
}
|
| 3045 |
-
}
|
| 3046 |
|
| 3047 |
-
|
| 3048 |
-
|
| 3049 |
-
|
| 3050 |
-
|
| 3051 |
-
|
| 3052 |
-
|
| 3053 |
-
|
| 3054 |
-
|
| 3055 |
-
|
| 3056 |
-
|
| 3057 |
-
|
| 3058 |
-
|
| 3059 |
-
|
| 3060 |
-
|
| 3061 |
-
|
| 3062 |
-
|
| 3063 |
-
|
| 3064 |
-
|
| 3065 |
-
|
| 3066 |
-
|
| 3067 |
-
|
| 3068 |
-
|
| 3069 |
-
|
| 3070 |
-
|
| 3071 |
-
|
| 3072 |
-
|
| 3073 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3074 |
|
| 3075 |
-
module.exports = scrollIntoView;
|
| 3076 |
|
| 3077 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3078 |
|
| 3079 |
-
/***/ 181:
|
| 3080 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 3081 |
|
| 3082 |
-
|
| 3083 |
|
|
|
|
|
|
|
|
|
|
| 3084 |
|
| 3085 |
-
|
|
|
|
| 3086 |
|
| 3087 |
-
|
|
|
|
| 3088 |
|
| 3089 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3090 |
|
| 3091 |
-
function getClientPosition(elem) {
|
| 3092 |
-
var box = undefined;
|
| 3093 |
-
var x = undefined;
|
| 3094 |
-
var y = undefined;
|
| 3095 |
-
var doc = elem.ownerDocument;
|
| 3096 |
-
var body = doc.body;
|
| 3097 |
-
var docElem = doc && doc.documentElement;
|
| 3098 |
-
// 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
|
| 3099 |
-
box = elem.getBoundingClientRect();
|
| 3100 |
|
| 3101 |
-
|
| 3102 |
-
|
| 3103 |
-
|
|
|
|
|
|
|
| 3104 |
|
| 3105 |
-
|
| 3106 |
-
|
|
|
|
|
|
|
|
|
|
| 3107 |
|
| 3108 |
-
|
| 3109 |
-
|
| 3110 |
-
|
| 3111 |
-
|
| 3112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3113 |
|
| 3114 |
-
|
| 3115 |
-
|
| 3116 |
-
|
| 3117 |
-
|
| 3118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3119 |
|
| 3120 |
-
// ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
|
| 3121 |
-
// 窗口边框标准是设 documentElement ,quirks 时设置 body
|
| 3122 |
-
// 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
|
| 3123 |
-
// 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
|
| 3124 |
-
// 标准 ie 下 docElem.clientTop 就是 border-top
|
| 3125 |
-
// ie7 html 即窗口边框改变不了。永远为 2
|
| 3126 |
-
// 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
|
| 3127 |
|
| 3128 |
-
|
| 3129 |
-
|
|
|
|
|
|
|
| 3130 |
|
| 3131 |
-
|
| 3132 |
-
|
| 3133 |
-
top: y
|
| 3134 |
-
};
|
| 3135 |
-
}
|
| 3136 |
|
| 3137 |
-
|
| 3138 |
-
var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
| 3139 |
-
var method = 'scroll' + (top ? 'Top' : 'Left');
|
| 3140 |
-
if (typeof ret !== 'number') {
|
| 3141 |
-
var d = w.document;
|
| 3142 |
-
// ie6,7,8 standard mode
|
| 3143 |
-
ret = d.documentElement[method];
|
| 3144 |
-
if (typeof ret !== 'number') {
|
| 3145 |
-
// quirks mode
|
| 3146 |
-
ret = d.body[method];
|
| 3147 |
-
}
|
| 3148 |
-
}
|
| 3149 |
-
return ret;
|
| 3150 |
-
}
|
| 3151 |
|
| 3152 |
-
|
| 3153 |
-
return getScroll(w);
|
| 3154 |
-
}
|
| 3155 |
|
| 3156 |
-
|
| 3157 |
-
|
| 3158 |
-
}
|
| 3159 |
|
| 3160 |
-
|
| 3161 |
-
|
| 3162 |
-
|
| 3163 |
-
|
| 3164 |
-
|
| 3165 |
-
|
| 3166 |
-
|
| 3167 |
-
|
| 3168 |
-
|
| 3169 |
-
|
| 3170 |
-
|
| 3171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3172 |
|
| 3173 |
-
|
| 3174 |
-
|
| 3175 |
-
|
| 3176 |
-
}
|
| 3177 |
|
| 3178 |
-
|
| 3179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3180 |
|
| 3181 |
-
|
| 3182 |
-
|
| 3183 |
-
|
| 3184 |
-
|
| 3185 |
-
var LEFT = 'left';
|
| 3186 |
-
var PX = 'px';
|
| 3187 |
|
| 3188 |
-
|
| 3189 |
-
|
| 3190 |
-
|
| 3191 |
-
|
|
|
|
| 3192 |
|
| 3193 |
-
// 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
|
| 3194 |
-
// 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
|
| 3195 |
-
// 在 ie 下不对,需要直接用 offset 方式
|
| 3196 |
-
// borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
|
| 3197 |
|
| 3198 |
-
|
| 3199 |
-
|
| 3200 |
-
|
| 3201 |
-
|
| 3202 |
-
// exclude left right for relativity
|
| 3203 |
-
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
| 3204 |
-
// Remember the original values
|
| 3205 |
-
var style = elem.style;
|
| 3206 |
-
var left = style[LEFT];
|
| 3207 |
-
var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
| 3208 |
|
| 3209 |
-
|
| 3210 |
-
|
|
|
|
| 3211 |
|
| 3212 |
-
|
| 3213 |
-
|
| 3214 |
-
|
|
|
|
|
|
|
|
|
|
| 3215 |
|
| 3216 |
-
// Revert the changed values
|
| 3217 |
-
style[LEFT] = left;
|
| 3218 |
|
| 3219 |
-
|
| 3220 |
-
|
| 3221 |
-
|
| 3222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3223 |
|
| 3224 |
-
|
| 3225 |
-
|
| 3226 |
-
|
| 3227 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3228 |
|
| 3229 |
-
|
| 3230 |
-
|
| 3231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3232 |
}
|
| 3233 |
-
}
|
| 3234 |
|
| 3235 |
-
|
| 3236 |
-
return
|
| 3237 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3238 |
|
| 3239 |
-
|
| 3240 |
-
|
| 3241 |
-
|
| 3242 |
-
|
| 3243 |
-
var MARGIN_INDEX = 0;
|
| 3244 |
|
| 3245 |
-
|
| 3246 |
-
|
| 3247 |
-
var style = elem.style;
|
| 3248 |
-
var name = undefined;
|
| 3249 |
|
| 3250 |
-
|
| 3251 |
-
|
| 3252 |
-
|
| 3253 |
-
old[name] = style[name];
|
| 3254 |
-
style[name] = options[name];
|
| 3255 |
-
}
|
| 3256 |
}
|
| 3257 |
|
| 3258 |
-
|
| 3259 |
|
| 3260 |
-
|
| 3261 |
-
|
| 3262 |
-
|
| 3263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3265 |
}
|
| 3266 |
-
}
|
| 3267 |
|
| 3268 |
-
|
| 3269 |
-
|
| 3270 |
-
|
| 3271 |
-
|
| 3272 |
-
|
| 3273 |
-
|
| 3274 |
-
|
| 3275 |
-
|
| 3276 |
-
|
| 3277 |
-
|
| 3278 |
-
|
| 3279 |
-
cssProp = prop + which[i] + 'Width';
|
| 3280 |
-
} else {
|
| 3281 |
-
cssProp = prop + which[i];
|
| 3282 |
-
}
|
| 3283 |
-
value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
| 3284 |
-
}
|
| 3285 |
-
}
|
| 3286 |
}
|
| 3287 |
-
return value;
|
| 3288 |
-
}
|
| 3289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3290 |
/**
|
| 3291 |
-
*
|
| 3292 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3293 |
*/
|
| 3294 |
-
function isWindow(obj) {
|
| 3295 |
-
// must use == for ie8
|
| 3296 |
-
/* eslint eqeqeq:0 */
|
| 3297 |
-
return obj != null && obj == obj.window;
|
| 3298 |
-
}
|
| 3299 |
|
| 3300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3301 |
|
| 3302 |
-
|
| 3303 |
-
|
| 3304 |
-
var d = refWin.document;
|
| 3305 |
-
return Math.max(
|
| 3306 |
-
// firefox chrome documentElement.scrollHeight< body.scrollHeight
|
| 3307 |
-
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
|
| 3308 |
-
d.documentElement['scroll' + name],
|
| 3309 |
-
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
|
| 3310 |
-
d.body['scroll' + name], domUtils['viewport' + name](d));
|
| 3311 |
-
};
|
| 3312 |
|
| 3313 |
-
|
| 3314 |
-
// pc browser includes scrollbar in window.innerWidth
|
| 3315 |
-
var prop = 'client' + name;
|
| 3316 |
-
var doc = win.document;
|
| 3317 |
-
var body = doc.body;
|
| 3318 |
-
var documentElement = doc.documentElement;
|
| 3319 |
-
var documentElementProp = documentElement[prop];
|
| 3320 |
-
// 标准模式取 documentElement
|
| 3321 |
-
// backcompat 取 body
|
| 3322 |
-
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
| 3323 |
-
};
|
| 3324 |
-
});
|
| 3325 |
|
| 3326 |
-
|
| 3327 |
-
|
| 3328 |
-
|
| 3329 |
-
|
| 3330 |
-
|
| 3331 |
-
|
| 3332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3333 |
*/
|
| 3334 |
-
function getWH(elem, name, extra) {
|
| 3335 |
-
if (isWindow(elem)) {
|
| 3336 |
-
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
| 3337 |
-
} else if (elem.nodeType === 9) {
|
| 3338 |
-
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
| 3339 |
-
}
|
| 3340 |
-
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
| 3341 |
-
var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
|
| 3342 |
-
var computedStyle = getComputedStyleX(elem);
|
| 3343 |
-
var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
| 3344 |
-
var cssBoxValue = 0;
|
| 3345 |
-
if (borderBoxValue == null || borderBoxValue <= 0) {
|
| 3346 |
-
borderBoxValue = undefined;
|
| 3347 |
-
// Fall back to computed then un computed css if necessary
|
| 3348 |
-
cssBoxValue = getComputedStyleX(elem, name);
|
| 3349 |
-
if (cssBoxValue == null || Number(cssBoxValue) < 0) {
|
| 3350 |
-
cssBoxValue = elem.style[name] || 0;
|
| 3351 |
-
}
|
| 3352 |
-
// Normalize '', auto, and prepare for extra
|
| 3353 |
-
cssBoxValue = parseFloat(cssBoxValue) || 0;
|
| 3354 |
-
}
|
| 3355 |
-
if (extra === undefined) {
|
| 3356 |
-
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
| 3357 |
-
}
|
| 3358 |
-
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
| 3359 |
-
var val = borderBoxValue || cssBoxValue;
|
| 3360 |
-
if (extra === CONTENT_INDEX) {
|
| 3361 |
-
if (borderBoxValueOrIsBorderBox) {
|
| 3362 |
-
return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
| 3363 |
-
}
|
| 3364 |
-
return cssBoxValue;
|
| 3365 |
-
}
|
| 3366 |
-
if (borderBoxValueOrIsBorderBox) {
|
| 3367 |
-
var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
|
| 3368 |
-
return val + (extra === BORDER_INDEX ? 0 : padding);
|
| 3369 |
-
}
|
| 3370 |
-
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
| 3371 |
-
}
|
| 3372 |
|
| 3373 |
-
|
| 3374 |
-
|
| 3375 |
-
|
| 3376 |
-
|
| 3377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3378 |
|
| 3379 |
-
|
| 3380 |
-
|
| 3381 |
-
|
| 3382 |
-
|
| 3383 |
-
|
| 3384 |
-
//
|
| 3385 |
-
|
| 3386 |
-
|
| 3387 |
-
|
| 3388 |
-
|
| 3389 |
-
|
| 3390 |
-
|
| 3391 |
-
|
| 3392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3393 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3394 |
|
| 3395 |
-
function
|
| 3396 |
-
|
| 3397 |
-
if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
| 3398 |
-
for (var i in name) {
|
| 3399 |
-
if (name.hasOwnProperty(i)) {
|
| 3400 |
-
css(el, i, name[i]);
|
| 3401 |
-
}
|
| 3402 |
-
}
|
| 3403 |
-
return undefined;
|
| 3404 |
-
}
|
| 3405 |
-
if (typeof value !== 'undefined') {
|
| 3406 |
-
if (typeof value === 'number') {
|
| 3407 |
-
value += 'px';
|
| 3408 |
-
}
|
| 3409 |
-
el.style[name] = value;
|
| 3410 |
-
return undefined;
|
| 3411 |
-
}
|
| 3412 |
-
return getComputedStyleX(el, name);
|
| 3413 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3414 |
|
| 3415 |
-
|
| 3416 |
-
|
| 3417 |
-
|
| 3418 |
-
|
| 3419 |
-
|
| 3420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3421 |
|
| 3422 |
-
|
| 3423 |
-
|
| 3424 |
-
|
| 3425 |
-
|
| 3426 |
-
var isBorderBox = isBorderBoxFn(elem);
|
| 3427 |
-
if (isBorderBox) {
|
| 3428 |
-
val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
| 3429 |
-
}
|
| 3430 |
-
return css(elem, name, val);
|
| 3431 |
-
}
|
| 3432 |
-
return undefined;
|
| 3433 |
}
|
| 3434 |
-
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
| 3435 |
-
};
|
| 3436 |
-
});
|
| 3437 |
|
| 3438 |
-
|
| 3439 |
-
|
| 3440 |
-
|
| 3441 |
-
|
| 3442 |
-
|
| 3443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3444 |
|
| 3445 |
-
|
| 3446 |
-
|
| 3447 |
-
var current = undefined;
|
| 3448 |
-
var key = undefined;
|
| 3449 |
|
| 3450 |
-
|
| 3451 |
-
|
| 3452 |
-
|
| 3453 |
-
|
| 3454 |
-
}
|
| 3455 |
-
}
|
| 3456 |
-
css(elem, ret);
|
| 3457 |
-
}
|
| 3458 |
|
| 3459 |
-
module.exports = _extends({
|
| 3460 |
-
getWindow: function getWindow(node) {
|
| 3461 |
-
var doc = node.ownerDocument || node;
|
| 3462 |
-
return doc.defaultView || doc.parentWindow;
|
| 3463 |
-
},
|
| 3464 |
-
offset: function offset(el, value) {
|
| 3465 |
-
if (typeof value !== 'undefined') {
|
| 3466 |
-
setOffset(el, value);
|
| 3467 |
-
} else {
|
| 3468 |
-
return getOffset(el);
|
| 3469 |
-
}
|
| 3470 |
-
},
|
| 3471 |
|
| 3472 |
-
|
| 3473 |
-
|
| 3474 |
-
|
| 3475 |
-
|
| 3476 |
-
|
| 3477 |
-
|
| 3478 |
-
|
| 3479 |
-
|
| 3480 |
-
|
| 3481 |
-
|
| 3482 |
-
var overflow = obj.overflow;
|
| 3483 |
-
if (overflow) {
|
| 3484 |
-
for (var i in obj) {
|
| 3485 |
-
if (obj.hasOwnProperty(i)) {
|
| 3486 |
-
ret.overflow[i] = obj.overflow[i];
|
| 3487 |
-
}
|
| 3488 |
-
}
|
| 3489 |
-
}
|
| 3490 |
-
return ret;
|
| 3491 |
-
},
|
| 3492 |
-
scrollLeft: function scrollLeft(w, v) {
|
| 3493 |
-
if (isWindow(w)) {
|
| 3494 |
-
if (v === undefined) {
|
| 3495 |
-
return getScrollLeft(w);
|
| 3496 |
-
}
|
| 3497 |
-
window.scrollTo(v, getScrollTop(w));
|
| 3498 |
-
} else {
|
| 3499 |
-
if (v === undefined) {
|
| 3500 |
-
return w.scrollLeft;
|
| 3501 |
-
}
|
| 3502 |
-
w.scrollLeft = v;
|
| 3503 |
-
}
|
| 3504 |
-
},
|
| 3505 |
-
scrollTop: function scrollTop(w, v) {
|
| 3506 |
-
if (isWindow(w)) {
|
| 3507 |
-
if (v === undefined) {
|
| 3508 |
-
return getScrollTop(w);
|
| 3509 |
-
}
|
| 3510 |
-
window.scrollTo(getScrollLeft(w), v);
|
| 3511 |
-
} else {
|
| 3512 |
-
if (v === undefined) {
|
| 3513 |
-
return w.scrollTop;
|
| 3514 |
-
}
|
| 3515 |
-
w.scrollTop = v;
|
| 3516 |
-
}
|
| 3517 |
-
},
|
| 3518 |
|
| 3519 |
-
|
| 3520 |
-
|
| 3521 |
-
}, domUtils);
|
| 3522 |
|
| 3523 |
-
|
| 3524 |
|
| 3525 |
-
|
| 3526 |
-
|
|
|
|
| 3527 |
|
| 3528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3529 |
|
| 3530 |
-
|
| 3531 |
-
|
| 3532 |
-
|
| 3533 |
-
|
| 3534 |
-
|
| 3535 |
-
|
| 3536 |
-
|
| 3537 |
-
|
| 3538 |
-
};
|
| 3539 |
-
})();
|
| 3540 |
-
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
| 3541 |
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
| 3542 |
-
s = arguments[i];
|
| 3543 |
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
| 3544 |
-
t[p] = s[p];
|
| 3545 |
-
}
|
| 3546 |
-
return t;
|
| 3547 |
-
};
|
| 3548 |
-
var __rest = (this && this.__rest) || function (s, e) {
|
| 3549 |
-
var t = {};
|
| 3550 |
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
| 3551 |
-
t[p] = s[p];
|
| 3552 |
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
| 3553 |
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
| 3554 |
-
t[p[i]] = s[p[i]];
|
| 3555 |
-
return t;
|
| 3556 |
-
};
|
| 3557 |
-
exports.__esModule = true;
|
| 3558 |
-
var React = __webpack_require__(12);
|
| 3559 |
-
var PropTypes = __webpack_require__(23);
|
| 3560 |
-
var autosize = __webpack_require__(183);
|
| 3561 |
-
var _getLineHeight = __webpack_require__(184);
|
| 3562 |
-
var getLineHeight = _getLineHeight;
|
| 3563 |
-
var RESIZED = "autosize:resized";
|
| 3564 |
/**
|
| 3565 |
-
*
|
| 3566 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3567 |
*/
|
| 3568 |
-
var TextareaAutosizeClass = /** @class */ (function (_super) {
|
| 3569 |
-
__extends(TextareaAutosizeClass, _super);
|
| 3570 |
-
function TextareaAutosizeClass() {
|
| 3571 |
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
| 3572 |
-
_this.state = {
|
| 3573 |
-
lineHeight: null
|
| 3574 |
-
};
|
| 3575 |
-
_this.textarea = null;
|
| 3576 |
-
_this.onResize = function (e) {
|
| 3577 |
-
if (_this.props.onResize) {
|
| 3578 |
-
_this.props.onResize(e);
|
| 3579 |
-
}
|
| 3580 |
-
};
|
| 3581 |
-
_this.updateLineHeight = function () {
|
| 3582 |
-
if (_this.textarea) {
|
| 3583 |
-
_this.setState({
|
| 3584 |
-
lineHeight: getLineHeight(_this.textarea)
|
| 3585 |
-
});
|
| 3586 |
-
}
|
| 3587 |
-
};
|
| 3588 |
-
_this.onChange = function (e) {
|
| 3589 |
-
var onChange = _this.props.onChange;
|
| 3590 |
-
_this.currentValue = e.currentTarget.value;
|
| 3591 |
-
onChange && onChange(e);
|
| 3592 |
-
};
|
| 3593 |
-
return _this;
|
| 3594 |
-
}
|
| 3595 |
-
TextareaAutosizeClass.prototype.componentDidMount = function () {
|
| 3596 |
-
var _this = this;
|
| 3597 |
-
var _a = this.props, maxRows = _a.maxRows, async = _a.async;
|
| 3598 |
-
if (typeof maxRows === "number") {
|
| 3599 |
-
this.updateLineHeight();
|
| 3600 |
-
}
|
| 3601 |
-
if (typeof maxRows === "number" || async) {
|
| 3602 |
-
/*
|
| 3603 |
-
the defer is needed to:
|
| 3604 |
-
- force "autosize" to activate the scrollbar when this.props.maxRows is passed
|
| 3605 |
-
- support StyledComponents (see #71)
|
| 3606 |
-
*/
|
| 3607 |
-
setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
|
| 3608 |
-
}
|
| 3609 |
-
else {
|
| 3610 |
-
this.textarea && autosize(this.textarea);
|
| 3611 |
-
}
|
| 3612 |
-
if (this.textarea) {
|
| 3613 |
-
this.textarea.addEventListener(RESIZED, this.onResize);
|
| 3614 |
-
}
|
| 3615 |
-
};
|
| 3616 |
-
TextareaAutosizeClass.prototype.componentWillUnmount = function () {
|
| 3617 |
-
if (this.textarea) {
|
| 3618 |
-
this.textarea.removeEventListener(RESIZED, this.onResize);
|
| 3619 |
-
autosize.destroy(this.textarea);
|
| 3620 |
-
}
|
| 3621 |
-
};
|
| 3622 |
-
TextareaAutosizeClass.prototype.render = function () {
|
| 3623 |
-
var _this = this;
|
| 3624 |
-
var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
|
| 3625 |
-
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
|
| 3626 |
-
return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
|
| 3627 |
-
_this.textarea = element;
|
| 3628 |
-
if (typeof _this.props.innerRef === 'function') {
|
| 3629 |
-
_this.props.innerRef(element);
|
| 3630 |
-
}
|
| 3631 |
-
else if (_this.props.innerRef) {
|
| 3632 |
-
_this.props.innerRef.current = element;
|
| 3633 |
-
}
|
| 3634 |
-
} }), children));
|
| 3635 |
-
};
|
| 3636 |
-
TextareaAutosizeClass.prototype.componentDidUpdate = function () {
|
| 3637 |
-
this.textarea && autosize.update(this.textarea);
|
| 3638 |
-
};
|
| 3639 |
-
TextareaAutosizeClass.defaultProps = {
|
| 3640 |
-
rows: 1,
|
| 3641 |
-
async: false
|
| 3642 |
-
};
|
| 3643 |
-
TextareaAutosizeClass.propTypes = {
|
| 3644 |
-
rows: PropTypes.number,
|
| 3645 |
-
maxRows: PropTypes.number,
|
| 3646 |
-
onResize: PropTypes.func,
|
| 3647 |
-
innerRef: PropTypes.any,
|
| 3648 |
-
async: PropTypes.bool
|
| 3649 |
-
};
|
| 3650 |
-
return TextareaAutosizeClass;
|
| 3651 |
-
}(React.Component));
|
| 3652 |
-
exports.TextareaAutosize = React.forwardRef(function (props, ref) {
|
| 3653 |
-
return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
|
| 3654 |
-
});
|
| 3655 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3656 |
|
| 3657 |
-
|
|
|
|
| 3658 |
|
| 3659 |
-
|
| 3660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3661 |
|
| 3662 |
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
| 3663 |
-
autosize 4.0.2
|
| 3664 |
-
license: MIT
|
| 3665 |
-
http://www.jacklmoore.com/autosize
|
| 3666 |
-
*/
|
| 3667 |
-
(function (global, factory) {
|
| 3668 |
-
if (true) {
|
| 3669 |
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
| 3670 |
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
| 3671 |
-
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
| 3672 |
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
| 3673 |
-
} else { var mod; }
|
| 3674 |
-
})(this, function (module, exports) {
|
| 3675 |
-
'use strict';
|
| 3676 |
|
| 3677 |
-
|
| 3678 |
-
|
| 3679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3680 |
|
| 3681 |
-
|
| 3682 |
-
|
| 3683 |
-
|
| 3684 |
-
|
| 3685 |
-
|
| 3686 |
-
|
| 3687 |
-
|
| 3688 |
-
|
| 3689 |
-
|
| 3690 |
-
|
| 3691 |
-
values.push(value);
|
| 3692 |
-
}
|
| 3693 |
-
},
|
| 3694 |
-
delete: function _delete(key) {
|
| 3695 |
-
var index = keys.indexOf(key);
|
| 3696 |
-
if (index > -1) {
|
| 3697 |
-
keys.splice(index, 1);
|
| 3698 |
-
values.splice(index, 1);
|
| 3699 |
-
}
|
| 3700 |
-
}
|
| 3701 |
-
};
|
| 3702 |
-
}();
|
| 3703 |
|
| 3704 |
-
|
| 3705 |
-
|
| 3706 |
-
|
| 3707 |
-
|
| 3708 |
-
|
| 3709 |
-
|
| 3710 |
-
|
| 3711 |
-
|
| 3712 |
-
|
| 3713 |
-
|
| 3714 |
-
|
| 3715 |
-
};
|
| 3716 |
-
}
|
| 3717 |
|
| 3718 |
-
|
| 3719 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3720 |
|
| 3721 |
-
|
| 3722 |
-
|
| 3723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3724 |
|
| 3725 |
-
|
| 3726 |
-
|
|
|
|
|
|
|
| 3727 |
|
| 3728 |
-
if (style.resize === 'vertical') {
|
| 3729 |
-
ta.style.resize = 'none';
|
| 3730 |
-
} else if (style.resize === 'both') {
|
| 3731 |
-
ta.style.resize = 'horizontal';
|
| 3732 |
-
}
|
| 3733 |
|
| 3734 |
-
|
| 3735 |
-
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
|
| 3736 |
-
} else {
|
| 3737 |
-
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
| 3738 |
-
}
|
| 3739 |
-
// Fix when a textarea is not on document body and heightOffset is Not a Number
|
| 3740 |
-
if (isNaN(heightOffset)) {
|
| 3741 |
-
heightOffset = 0;
|
| 3742 |
-
}
|
| 3743 |
|
| 3744 |
-
|
| 3745 |
-
|
|
|
|
| 3746 |
|
| 3747 |
-
function changeOverflow(value) {
|
| 3748 |
-
{
|
| 3749 |
-
// Chrome/Safari-specific fix:
|
| 3750 |
-
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
|
| 3751 |
-
// made available by removing the scrollbar. The following forces the necessary text reflow.
|
| 3752 |
-
var width = ta.style.width;
|
| 3753 |
-
ta.style.width = '0px';
|
| 3754 |
-
// Force reflow:
|
| 3755 |
-
/* jshint ignore:start */
|
| 3756 |
-
ta.offsetWidth;
|
| 3757 |
-
/* jshint ignore:end */
|
| 3758 |
-
ta.style.width = width;
|
| 3759 |
-
}
|
| 3760 |
|
| 3761 |
-
|
| 3762 |
-
|
| 3763 |
|
| 3764 |
-
|
| 3765 |
-
|
|
|
|
|
|
|
| 3766 |
|
| 3767 |
-
|
| 3768 |
-
|
| 3769 |
-
|
| 3770 |
-
|
| 3771 |
-
|
| 3772 |
-
|
| 3773 |
-
|
| 3774 |
-
|
| 3775 |
-
|
|
|
|
| 3776 |
|
| 3777 |
-
|
| 3778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3779 |
|
| 3780 |
-
|
| 3781 |
-
|
| 3782 |
-
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
|
| 3783 |
-
return;
|
| 3784 |
-
}
|
| 3785 |
|
| 3786 |
-
|
| 3787 |
-
|
| 3788 |
|
| 3789 |
-
|
| 3790 |
-
|
|
|
|
| 3791 |
|
| 3792 |
-
|
| 3793 |
-
|
|
|
|
|
|
|
| 3794 |
|
| 3795 |
-
|
| 3796 |
-
|
| 3797 |
-
|
| 3798 |
-
});
|
| 3799 |
|
| 3800 |
-
if (docTop) {
|
| 3801 |
-
document.documentElement.scrollTop = docTop;
|
| 3802 |
-
}
|
| 3803 |
-
}
|
| 3804 |
|
| 3805 |
-
|
| 3806 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3807 |
|
| 3808 |
-
|
| 3809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3810 |
|
| 3811 |
-
|
| 3812 |
-
|
|
|
|
|
|
|
| 3813 |
|
| 3814 |
-
|
| 3815 |
-
|
| 3816 |
-
|
| 3817 |
-
if (computed.overflowY === 'hidden') {
|
| 3818 |
-
changeOverflow('scroll');
|
| 3819 |
-
resize();
|
| 3820 |
-
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
|
| 3821 |
-
}
|
| 3822 |
-
} else {
|
| 3823 |
-
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
|
| 3824 |
-
if (computed.overflowY !== 'hidden') {
|
| 3825 |
-
changeOverflow('hidden');
|
| 3826 |
-
resize();
|
| 3827 |
-
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
|
| 3828 |
-
}
|
| 3829 |
-
}
|
| 3830 |
|
| 3831 |
-
if (cachedHeight !== actualHeight) {
|
| 3832 |
-
cachedHeight = actualHeight;
|
| 3833 |
-
var evt = createEvent('autosize:resized');
|
| 3834 |
-
try {
|
| 3835 |
-
ta.dispatchEvent(evt);
|
| 3836 |
-
} catch (err) {
|
| 3837 |
-
// Firefox will throw an error on dispatchEvent for a detached element
|
| 3838 |
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
|
| 3839 |
-
}
|
| 3840 |
-
}
|
| 3841 |
-
}
|
| 3842 |
|
| 3843 |
-
var pageResize = function pageResize() {
|
| 3844 |
-
if (ta.clientWidth !== clientWidth) {
|
| 3845 |
-
update();
|
| 3846 |
-
}
|
| 3847 |
-
};
|
| 3848 |
-
|
| 3849 |
-
var destroy = function (style) {
|
| 3850 |
-
window.removeEventListener('resize', pageResize, false);
|
| 3851 |
-
ta.removeEventListener('input', update, false);
|
| 3852 |
-
ta.removeEventListener('keyup', update, false);
|
| 3853 |
-
ta.removeEventListener('autosize:destroy', destroy, false);
|
| 3854 |
-
ta.removeEventListener('autosize:update', update, false);
|
| 3855 |
-
|
| 3856 |
-
Object.keys(style).forEach(function (key) {
|
| 3857 |
-
ta.style[key] = style[key];
|
| 3858 |
-
});
|
| 3859 |
-
|
| 3860 |
-
map.delete(ta);
|
| 3861 |
-
}.bind(ta, {
|
| 3862 |
-
height: ta.style.height,
|
| 3863 |
-
resize: ta.style.resize,
|
| 3864 |
-
overflowY: ta.style.overflowY,
|
| 3865 |
-
overflowX: ta.style.overflowX,
|
| 3866 |
-
wordWrap: ta.style.wordWrap
|
| 3867 |
-
});
|
| 3868 |
-
|
| 3869 |
-
ta.addEventListener('autosize:destroy', destroy, false);
|
| 3870 |
-
|
| 3871 |
-
// IE9 does not fire onpropertychange or oninput for deletions,
|
| 3872 |
-
// so binding to onkeyup to catch most of those events.
|
| 3873 |
-
// There is no way that I know of to detect something like 'cut' in IE9.
|
| 3874 |
-
if ('onpropertychange' in ta && 'oninput' in ta) {
|
| 3875 |
-
ta.addEventListener('keyup', update, false);
|
| 3876 |
-
}
|
| 3877 |
-
|
| 3878 |
-
window.addEventListener('resize', pageResize, false);
|
| 3879 |
-
ta.addEventListener('input', update, false);
|
| 3880 |
-
ta.addEventListener('autosize:update', update, false);
|
| 3881 |
-
ta.style.overflowX = 'hidden';
|
| 3882 |
-
ta.style.wordWrap = 'break-word';
|
| 3883 |
-
|
| 3884 |
-
map.set(ta, {
|
| 3885 |
-
destroy: destroy,
|
| 3886 |
-
update: update
|
| 3887 |
-
});
|
| 3888 |
-
|
| 3889 |
-
init();
|
| 3890 |
-
}
|
| 3891 |
-
|
| 3892 |
-
function destroy(ta) {
|
| 3893 |
-
var methods = map.get(ta);
|
| 3894 |
-
if (methods) {
|
| 3895 |
-
methods.destroy();
|
| 3896 |
-
}
|
| 3897 |
-
}
|
| 3898 |
|
| 3899 |
-
function update(ta) {
|
| 3900 |
-
var methods = map.get(ta);
|
| 3901 |
-
if (methods) {
|
| 3902 |
-
methods.update();
|
| 3903 |
-
}
|
| 3904 |
-
}
|
| 3905 |
|
| 3906 |
-
var autosize = null;
|
| 3907 |
|
| 3908 |
-
// Do nothing in Node.js environment and IE8 (or lower)
|
| 3909 |
-
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
|
| 3910 |
-
autosize = function autosize(el) {
|
| 3911 |
-
return el;
|
| 3912 |
-
};
|
| 3913 |
-
autosize.destroy = function (el) {
|
| 3914 |
-
return el;
|
| 3915 |
-
};
|
| 3916 |
-
autosize.update = function (el) {
|
| 3917 |
-
return el;
|
| 3918 |
-
};
|
| 3919 |
-
} else {
|
| 3920 |
-
autosize = function autosize(el, options) {
|
| 3921 |
-
if (el) {
|
| 3922 |
-
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
|
| 3923 |
-
return assign(x, options);
|
| 3924 |
-
});
|
| 3925 |
-
}
|
| 3926 |
-
return el;
|
| 3927 |
-
};
|
| 3928 |
-
autosize.destroy = function (el) {
|
| 3929 |
-
if (el) {
|
| 3930 |
-
Array.prototype.forEach.call(el.length ? el : [el], destroy);
|
| 3931 |
-
}
|
| 3932 |
-
return el;
|
| 3933 |
-
};
|
| 3934 |
-
autosize.update = function (el) {
|
| 3935 |
-
if (el) {
|
| 3936 |
-
Array.prototype.forEach.call(el.length ? el : [el], update);
|
| 3937 |
-
}
|
| 3938 |
-
return el;
|
| 3939 |
-
};
|
| 3940 |
-
}
|
| 3941 |
|
| 3942 |
-
exports.default = autosize;
|
| 3943 |
-
module.exports = exports['default'];
|
| 3944 |
-
});
|
| 3945 |
|
| 3946 |
-
|
|
|
|
|
|
|
| 3947 |
|
| 3948 |
-
/***/ 184:
|
| 3949 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 3950 |
|
| 3951 |
-
// Load in dependencies
|
| 3952 |
-
var computedStyle = __webpack_require__(185);
|
| 3953 |
|
| 3954 |
/**
|
| 3955 |
-
*
|
| 3956 |
-
*
|
| 3957 |
-
*
|
|
|
|
| 3958 |
*/
|
| 3959 |
-
function lineHeight(node) {
|
| 3960 |
-
// Grab the line-height via style
|
| 3961 |
-
var lnHeightStr = computedStyle(node, 'line-height');
|
| 3962 |
-
var lnHeight = parseFloat(lnHeightStr, 10);
|
| 3963 |
|
| 3964 |
-
|
| 3965 |
-
|
| 3966 |
-
|
| 3967 |
-
var _lnHeightStyle = node.style.lineHeight;
|
| 3968 |
-
node.style.lineHeight = lnHeightStr + 'em';
|
| 3969 |
|
| 3970 |
-
|
| 3971 |
-
|
| 3972 |
-
|
|
|
|
|
|
|
|
|
|
| 3973 |
|
| 3974 |
-
|
| 3975 |
-
|
| 3976 |
-
node.style.lineHeight = _lnHeightStyle;
|
| 3977 |
-
} else {
|
| 3978 |
-
delete node.style.lineHeight;
|
| 3979 |
}
|
| 3980 |
-
}
|
| 3981 |
|
| 3982 |
-
|
| 3983 |
-
// DEV: `em` units are converted to `pt` in IE6
|
| 3984 |
-
// Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
|
| 3985 |
-
if (lnHeightStr.indexOf('pt') !== -1) {
|
| 3986 |
-
lnHeight *= 4;
|
| 3987 |
-
lnHeight /= 3;
|
| 3988 |
-
// Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
|
| 3989 |
-
} else if (lnHeightStr.indexOf('mm') !== -1) {
|
| 3990 |
-
lnHeight *= 96;
|
| 3991 |
-
lnHeight /= 25.4;
|
| 3992 |
-
// Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
|
| 3993 |
-
} else if (lnHeightStr.indexOf('cm') !== -1) {
|
| 3994 |
-
lnHeight *= 96;
|
| 3995 |
-
lnHeight /= 2.54;
|
| 3996 |
-
// Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
|
| 3997 |
-
} else if (lnHeightStr.indexOf('in') !== -1) {
|
| 3998 |
-
lnHeight *= 96;
|
| 3999 |
-
// Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
|
| 4000 |
-
} else if (lnHeightStr.indexOf('pc') !== -1) {
|
| 4001 |
-
lnHeight *= 16;
|
| 4002 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4003 |
|
| 4004 |
-
// Continue our computation
|
| 4005 |
-
lnHeight = Math.round(lnHeight);
|
| 4006 |
-
|
| 4007 |
-
// If the line-height is "normal", calculate by font-size
|
| 4008 |
-
if (lnHeightStr === 'normal') {
|
| 4009 |
-
// Create a temporary node
|
| 4010 |
-
var nodeName = node.nodeName;
|
| 4011 |
-
var _node = document.createElement(nodeName);
|
| 4012 |
-
_node.innerHTML = ' ';
|
| 4013 |
-
|
| 4014 |
-
// If we have a text area, reset it to only 1 row
|
| 4015 |
-
// https://github.com/twolfson/line-height/issues/4
|
| 4016 |
-
if (nodeName.toUpperCase() === 'TEXTAREA') {
|
| 4017 |
-
_node.setAttribute('rows', '1');
|
| 4018 |
-
}
|
| 4019 |
|
| 4020 |
-
|
| 4021 |
-
|
| 4022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4023 |
|
| 4024 |
-
|
| 4025 |
-
|
| 4026 |
-
|
| 4027 |
-
|
| 4028 |
-
_node.style.border = '0px';
|
| 4029 |
|
| 4030 |
-
|
| 4031 |
-
var body = document.body;
|
| 4032 |
-
body.appendChild(_node);
|
| 4033 |
|
| 4034 |
-
|
| 4035 |
-
var height = _node.offsetHeight;
|
| 4036 |
-
lnHeight = height;
|
| 4037 |
|
| 4038 |
-
|
| 4039 |
-
|
|
|
|
| 4040 |
}
|
| 4041 |
-
|
| 4042 |
-
// Return the calculated height
|
| 4043 |
-
return lnHeight;
|
| 4044 |
}
|
| 4045 |
-
|
| 4046 |
-
// Export lineHeight
|
| 4047 |
-
module.exports = lineHeight;
|
| 4048 |
-
|
| 4049 |
-
|
| 4050 |
-
/***/ }),
|
| 4051 |
-
|
| 4052 |
-
/***/ 185:
|
| 4053 |
-
/***/ (function(module, exports) {
|
| 4054 |
-
|
| 4055 |
-
// This code has been refactored for 140 bytes
|
| 4056 |
-
// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
|
| 4057 |
-
var computedStyle = function (el, prop, getComputedStyle) {
|
| 4058 |
-
getComputedStyle = window.getComputedStyle;
|
| 4059 |
-
|
| 4060 |
-
// In one fell swoop
|
| 4061 |
-
return (
|
| 4062 |
-
// If we have getComputedStyle
|
| 4063 |
-
getComputedStyle ?
|
| 4064 |
-
// Query it
|
| 4065 |
-
// TODO: From CSS-Query notes, we might need (node, null) for FF
|
| 4066 |
-
getComputedStyle(el) :
|
| 4067 |
-
|
| 4068 |
-
// Otherwise, we are in IE and use currentStyle
|
| 4069 |
-
el.currentStyle
|
| 4070 |
-
)[
|
| 4071 |
-
// Switch to camelCase for CSSOM
|
| 4072 |
-
// DEV: Grabbed from jQuery
|
| 4073 |
-
// https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
|
| 4074 |
-
// https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
|
| 4075 |
-
prop.replace(/-(\w)/gi, function (word, letter) {
|
| 4076 |
-
return letter.toUpperCase();
|
| 4077 |
-
})
|
| 4078 |
-
];
|
| 4079 |
-
};
|
| 4080 |
-
|
| 4081 |
-
module.exports = computedStyle;
|
| 4082 |
-
|
| 4083 |
-
|
| 4084 |
-
/***/ }),
|
| 4085 |
-
|
| 4086 |
-
/***/ 186:
|
| 4087 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4088 |
-
|
| 4089 |
-
"use strict";
|
| 4090 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4091 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4092 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4093 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4094 |
-
|
| 4095 |
-
|
| 4096 |
/**
|
| 4097 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4098 |
*/
|
| 4099 |
|
| 4100 |
-
|
| 4101 |
-
|
| 4102 |
-
|
| 4103 |
-
|
| 4104 |
-
|
| 4105 |
-
}
|
| 4106 |
-
|
| 4107 |
-
|
| 4108 |
-
|
| 4109 |
-
|
| 4110 |
-
|
| 4111 |
-
/***/ 187:
|
| 4112 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4113 |
-
|
| 4114 |
-
"use strict";
|
| 4115 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4116 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4117 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4118 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4121 |
/**
|
| 4122 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4123 |
*/
|
| 4124 |
|
| 4125 |
-
|
| 4126 |
-
|
| 4127 |
-
|
| 4128 |
-
|
| 4129 |
-
|
| 4130 |
-
|
| 4131 |
-
|
| 4132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4133 |
|
| 4134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4135 |
|
| 4136 |
-
|
| 4137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4138 |
|
| 4139 |
-
|
|
|
|
| 4140 |
|
| 4141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4142 |
|
| 4143 |
-
|
| 4144 |
-
|
| 4145 |
|
| 4146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4147 |
|
| 4148 |
-
|
| 4149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4150 |
|
| 4151 |
-
|
| 4152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4153 |
|
| 4154 |
-
|
|
|
|
|
|
|
| 4155 |
|
|
|
|
|
|
|
|
|
|
| 4156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4157 |
/**
|
| 4158 |
-
*
|
|
|
|
|
|
|
| 4159 |
*/
|
| 4160 |
|
| 4161 |
-
|
| 4162 |
-
|
| 4163 |
-
|
| 4164 |
-
}
|
| 4165 |
-
|
| 4166 |
-
}));
|
| 4167 |
-
/* harmony default export */ var library_pencil = (pencil);
|
| 4168 |
-
//# sourceMappingURL=pencil.js.map
|
| 4169 |
-
// CONCATENATED MODULE: ./packages/icons/build-module/library/edit.js
|
| 4170 |
/**
|
| 4171 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4172 |
*/
|
| 4173 |
|
| 4174 |
-
|
| 4175 |
-
|
| 4176 |
-
|
| 4177 |
-
|
| 4178 |
-
|
| 4179 |
-
|
| 4180 |
-
/***/ (function(module, exports) {
|
| 4181 |
|
| 4182 |
-
|
|
|
|
| 4183 |
|
| 4184 |
-
|
|
|
|
|
|
|
| 4185 |
|
| 4186 |
-
|
| 4187 |
-
/***/ (function(module, exports) {
|
| 4188 |
|
| 4189 |
-
(
|
|
|
|
|
|
|
| 4190 |
|
| 4191 |
-
|
|
|
|
|
|
|
| 4192 |
|
| 4193 |
-
|
| 4194 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4195 |
-
|
| 4196 |
-
"use strict";
|
| 4197 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4198 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4199 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4200 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4201 |
|
|
|
|
|
|
|
|
|
|
| 4202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4203 |
/**
|
| 4204 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4205 |
*/
|
| 4206 |
|
| 4207 |
-
const search = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 4208 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 4209 |
-
viewBox: "0 0 24 24"
|
| 4210 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 4211 |
-
d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"
|
| 4212 |
-
}));
|
| 4213 |
-
/* harmony default export */ __webpack_exports__["a"] = (search);
|
| 4214 |
-
//# sourceMappingURL=search.js.map
|
| 4215 |
-
|
| 4216 |
-
/***/ }),
|
| 4217 |
|
| 4218 |
-
|
| 4219 |
-
|
|
|
|
|
|
|
| 4220 |
|
| 4221 |
-
|
| 4222 |
-
|
| 4223 |
-
|
| 4224 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4225 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4228 |
/**
|
| 4229 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4230 |
*/
|
| 4231 |
|
| 4232 |
-
|
| 4233 |
-
|
| 4234 |
-
|
| 4235 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 4236 |
-
d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
|
| 4237 |
-
}));
|
| 4238 |
-
/* harmony default export */ __webpack_exports__["a"] = (chevronRight);
|
| 4239 |
-
//# sourceMappingURL=chevron-right.js.map
|
| 4240 |
-
|
| 4241 |
-
/***/ }),
|
| 4242 |
-
|
| 4243 |
-
/***/ 211:
|
| 4244 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4245 |
-
|
| 4246 |
-
"use strict";
|
| 4247 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4248 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4249 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4250 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4251 |
-
|
| 4252 |
-
|
| 4253 |
/**
|
| 4254 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4255 |
*/
|
| 4256 |
|
| 4257 |
-
|
| 4258 |
-
|
| 4259 |
-
|
| 4260 |
-
|
| 4261 |
-
|
| 4262 |
-
|
| 4263 |
-
|
| 4264 |
-
|
| 4265 |
-
|
| 4266 |
-
/***/ }),
|
| 4267 |
|
| 4268 |
-
|
| 4269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4270 |
|
| 4271 |
-
|
| 4272 |
-
/*
|
| 4273 |
-
|
| 4274 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4275 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4276 |
|
|
|
|
|
|
|
|
|
|
| 4277 |
|
| 4278 |
-
|
| 4279 |
-
|
| 4280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4281 |
|
| 4282 |
-
|
| 4283 |
-
|
| 4284 |
-
|
| 4285 |
-
}
|
| 4286 |
-
|
| 4287 |
-
|
| 4288 |
-
/* harmony default export */ __webpack_exports__["a"] = (keyboardReturn);
|
| 4289 |
-
//# sourceMappingURL=keyboard-return.js.map
|
| 4290 |
|
| 4291 |
-
/***/ }),
|
| 4292 |
|
| 4293 |
-
|
| 4294 |
-
|
|
|
|
| 4295 |
|
| 4296 |
-
"
|
| 4297 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4298 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4299 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4300 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4302 |
|
|
|
|
|
|
|
|
|
|
| 4303 |
/**
|
| 4304 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4305 |
*/
|
| 4306 |
|
| 4307 |
-
|
| 4308 |
-
|
| 4309 |
-
|
| 4310 |
-
|
| 4311 |
-
|
| 4312 |
-
|
| 4313 |
-
|
| 4314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4315 |
|
| 4316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4317 |
|
| 4318 |
-
|
| 4319 |
-
|
| 4320 |
|
| 4321 |
-
(
|
|
|
|
| 4322 |
|
| 4323 |
-
|
|
|
|
|
|
|
|
|
|
| 4324 |
|
| 4325 |
-
|
| 4326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4328 |
/**
|
| 4329 |
-
*
|
| 4330 |
*
|
| 4331 |
-
*
|
| 4332 |
-
* LICENSE file in the root directory of this source tree.
|
| 4333 |
*/
|
| 4334 |
|
| 4335 |
-
|
| 4336 |
-
|
| 4337 |
-
|
| 4338 |
-
|
| 4339 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4341 |
|
| 4342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4343 |
|
| 4344 |
-
|
| 4345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4346 |
|
| 4347 |
-
(
|
|
|
|
|
|
|
|
|
|
| 4348 |
|
| 4349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4350 |
|
| 4351 |
-
|
| 4352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4353 |
|
| 4354 |
-
(function() { module.exports = window["wp"]["deprecated"]; }());
|
| 4355 |
|
| 4356 |
-
|
| 4357 |
|
| 4358 |
-
|
| 4359 |
-
|
| 4360 |
|
| 4361 |
-
|
| 4362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4363 |
|
| 4364 |
|
| 4365 |
-
Object
|
| 4366 |
-
value: true
|
| 4367 |
-
});
|
| 4368 |
-
exports.diffChars = diffChars;
|
| 4369 |
-
exports.characterDiff = void 0;
|
| 4370 |
|
| 4371 |
-
|
| 4372 |
-
|
| 4373 |
-
|
| 4374 |
-
_base = _interopRequireDefault(__webpack_require__(291))
|
| 4375 |
-
/*istanbul ignore end*/
|
| 4376 |
-
;
|
| 4377 |
|
| 4378 |
-
/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
| 4379 |
|
| 4380 |
-
|
| 4381 |
-
var characterDiff = new
|
| 4382 |
-
/*istanbul ignore start*/
|
| 4383 |
-
_base
|
| 4384 |
-
/*istanbul ignore end*/
|
| 4385 |
-
.
|
| 4386 |
-
/*istanbul ignore start*/
|
| 4387 |
-
default
|
| 4388 |
-
/*istanbul ignore end*/
|
| 4389 |
-
();
|
| 4390 |
|
| 4391 |
-
|
| 4392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4393 |
|
| 4394 |
-
|
| 4395 |
-
|
| 4396 |
-
|
|
|
|
|
|
|
| 4397 |
}
|
| 4398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4400 |
|
| 4401 |
-
|
|
|
|
|
|
|
| 4402 |
|
| 4403 |
-
|
| 4404 |
-
|
|
|
|
| 4405 |
|
| 4406 |
-
|
| 4407 |
-
/*
|
| 4408 |
-
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
| 4409 |
-
Copyrights licensed under the New BSD License.
|
| 4410 |
-
See the accompanying LICENSE file for terms.
|
| 4411 |
-
*/
|
| 4412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4414 |
|
| 4415 |
-
|
| 4416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4417 |
|
| 4418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4419 |
|
| 4420 |
-
|
| 4421 |
-
|
| 4422 |
-
|
| 4423 |
-
|
| 4424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4425 |
|
| 4426 |
-
function
|
| 4427 |
-
|
| 4428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4429 |
|
| 4430 |
-
|
| 4431 |
-
|
| 4432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4433 |
|
| 4434 |
-
|
| 4435 |
-
|
| 4436 |
-
|
| 4437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4438 |
|
| 4439 |
-
|
| 4440 |
-
|
| 4441 |
-
|
| 4442 |
-
|
| 4443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4444 |
|
| 4445 |
-
|
| 4446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4447 |
|
| 4448 |
-
|
| 4449 |
-
|
| 4450 |
-
|
| 4451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4452 |
|
| 4453 |
-
|
| 4454 |
-
|
| 4455 |
-
|
| 4456 |
-
|
| 4457 |
-
|
| 4458 |
-
|
| 4459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4460 |
|
| 4461 |
-
|
| 4462 |
-
|
| 4463 |
-
|
| 4464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4465 |
|
| 4466 |
-
|
| 4467 |
-
|
| 4468 |
-
|
| 4469 |
-
expValue = toDecimal(expValue);
|
| 4470 |
-
value = toDecimal(value);
|
| 4471 |
-
break;
|
| 4472 |
|
| 4473 |
-
|
| 4474 |
-
|
| 4475 |
-
|
| 4476 |
-
case 'monochrome':
|
| 4477 |
-
expValue = parseInt(expValue, 10) || 1;
|
| 4478 |
-
value = parseInt(value, 10) || 0;
|
| 4479 |
-
break;
|
| 4480 |
-
}
|
| 4481 |
|
| 4482 |
-
|
| 4483 |
-
|
| 4484 |
-
|
| 4485 |
-
|
| 4486 |
-
|
| 4487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4488 |
|
| 4489 |
-
|
| 4490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4491 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4492 |
|
| 4493 |
-
function
|
| 4494 |
-
|
| 4495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4496 |
|
| 4497 |
-
|
| 4498 |
-
|
| 4499 |
-
|
| 4500 |
-
|
| 4501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4502 |
|
| 4503 |
-
|
| 4504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4505 |
|
| 4506 |
-
|
| 4507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4508 |
|
| 4509 |
-
|
| 4510 |
-
|
| 4511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4512 |
|
| 4513 |
-
|
| 4514 |
-
|
| 4515 |
-
|
| 4516 |
-
|
| 4517 |
-
|
| 4518 |
-
});
|
| 4519 |
|
| 4520 |
-
|
| 4521 |
-
|
|
|
|
|
|
|
|
|
|
| 4522 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4523 |
|
| 4524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4525 |
|
| 4526 |
-
|
| 4527 |
-
|
| 4528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4529 |
|
| 4530 |
-
|
| 4531 |
-
|
| 4532 |
-
|
| 4533 |
-
|
| 4534 |
|
| 4535 |
-
|
| 4536 |
-
|
| 4537 |
|
| 4538 |
-
|
| 4539 |
-
|
| 4540 |
-
|
| 4541 |
|
| 4542 |
-
|
| 4543 |
-
|
| 4544 |
-
|
| 4545 |
-
|
| 4546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4547 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4548 |
|
| 4549 |
-
function
|
| 4550 |
-
|
| 4551 |
-
|
|
|
|
| 4552 |
|
| 4553 |
-
|
| 4554 |
-
|
| 4555 |
-
|
| 4556 |
-
|
| 4557 |
-
|
| 4558 |
-
|
| 4559 |
-
|
| 4560 |
-
|
| 4561 |
-
|
| 4562 |
-
}
|
| 4563 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4565 |
|
| 4566 |
-
|
|
|
|
| 4567 |
|
| 4568 |
-
|
| 4569 |
-
|
|
|
|
| 4570 |
|
| 4571 |
-
|
| 4572 |
-
|
| 4573 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4574 |
|
| 4575 |
-
function
|
| 4576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4577 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4578 |
|
| 4579 |
-
|
| 4580 |
-
|
| 4581 |
-
|
| 4582 |
-
|
| 4583 |
-
|
| 4584 |
-
|
| 4585 |
-
|
| 4586 |
-
|
| 4587 |
-
|
| 4588 |
-
|
| 4589 |
-
|
| 4590 |
-
}
|
|
|
|
|
|
|
| 4591 |
|
| 4592 |
-
|
| 4593 |
-
|
| 4594 |
-
|
| 4595 |
-
|
| 4596 |
-
|
| 4597 |
-
|
| 4598 |
-
|
| 4599 |
-
|
| 4600 |
-
|
| 4601 |
-
|
| 4602 |
-
|
|
|
|
| 4603 |
|
| 4604 |
-
|
| 4605 |
-
|
| 4606 |
-
|
| 4607 |
-
var key = ps[i];
|
| 4608 |
-
if (!hasOwnProperty.call(node, key)) node[key] = {};
|
| 4609 |
-
node = node[key];
|
| 4610 |
-
}
|
| 4611 |
-
node[ps[i]] = value;
|
| 4612 |
-
return value;
|
| 4613 |
-
};
|
| 4614 |
|
| 4615 |
-
Traverse.prototype.map = function (cb) {
|
| 4616 |
-
return walk(this.value, cb, true);
|
| 4617 |
-
};
|
| 4618 |
|
| 4619 |
-
Traverse.prototype.forEach = function (cb) {
|
| 4620 |
-
this.value = walk(this.value, cb, false);
|
| 4621 |
-
return this.value;
|
| 4622 |
-
};
|
| 4623 |
|
| 4624 |
-
Traverse.prototype.reduce = function (cb, init) {
|
| 4625 |
-
var skip = arguments.length === 1;
|
| 4626 |
-
var acc = skip ? this.value : init;
|
| 4627 |
-
this.forEach(function (x) {
|
| 4628 |
-
if (!this.isRoot || !skip) {
|
| 4629 |
-
acc = cb.call(this, acc, x);
|
| 4630 |
-
}
|
| 4631 |
-
});
|
| 4632 |
-
return acc;
|
| 4633 |
-
};
|
| 4634 |
|
| 4635 |
-
Traverse.prototype.paths = function () {
|
| 4636 |
-
var acc = [];
|
| 4637 |
-
this.forEach(function (x) {
|
| 4638 |
-
acc.push(this.path);
|
| 4639 |
-
});
|
| 4640 |
-
return acc;
|
| 4641 |
-
};
|
| 4642 |
|
| 4643 |
-
Traverse.prototype.nodes = function () {
|
| 4644 |
-
var acc = [];
|
| 4645 |
-
this.forEach(function (x) {
|
| 4646 |
-
acc.push(this.node);
|
| 4647 |
-
});
|
| 4648 |
-
return acc;
|
| 4649 |
-
};
|
| 4650 |
|
| 4651 |
-
|
| 4652 |
-
|
| 4653 |
-
|
| 4654 |
-
|
| 4655 |
-
|
| 4656 |
-
|
| 4657 |
-
|
| 4658 |
-
}
|
| 4659 |
-
}
|
| 4660 |
-
|
| 4661 |
-
if (typeof src === 'object' && src !== null) {
|
| 4662 |
-
var dst = copy(src);
|
| 4663 |
-
|
| 4664 |
-
parents.push(src);
|
| 4665 |
-
nodes.push(dst);
|
| 4666 |
-
|
| 4667 |
-
forEach(objectKeys(src), function (key) {
|
| 4668 |
-
dst[key] = clone(src[key]);
|
| 4669 |
-
});
|
| 4670 |
-
|
| 4671 |
-
parents.pop();
|
| 4672 |
-
nodes.pop();
|
| 4673 |
-
return dst;
|
| 4674 |
-
}
|
| 4675 |
-
else {
|
| 4676 |
-
return src;
|
| 4677 |
-
}
|
| 4678 |
-
})(this.value);
|
| 4679 |
-
};
|
| 4680 |
|
| 4681 |
-
|
| 4682 |
-
|
| 4683 |
-
|
| 4684 |
-
|
| 4685 |
-
|
| 4686 |
-
return (function walker (node_) {
|
| 4687 |
-
var node = immutable ? copy(node_) : node_;
|
| 4688 |
-
var modifiers = {};
|
| 4689 |
-
|
| 4690 |
-
var keepGoing = true;
|
| 4691 |
-
|
| 4692 |
-
var state = {
|
| 4693 |
-
node : node,
|
| 4694 |
-
node_ : node_,
|
| 4695 |
-
path : [].concat(path),
|
| 4696 |
-
parent : parents[parents.length - 1],
|
| 4697 |
-
parents : parents,
|
| 4698 |
-
key : path.slice(-1)[0],
|
| 4699 |
-
isRoot : path.length === 0,
|
| 4700 |
-
level : path.length,
|
| 4701 |
-
circular : null,
|
| 4702 |
-
update : function (x, stopHere) {
|
| 4703 |
-
if (!state.isRoot) {
|
| 4704 |
-
state.parent.node[state.key] = x;
|
| 4705 |
-
}
|
| 4706 |
-
state.node = x;
|
| 4707 |
-
if (stopHere) keepGoing = false;
|
| 4708 |
-
},
|
| 4709 |
-
'delete' : function (stopHere) {
|
| 4710 |
-
delete state.parent.node[state.key];
|
| 4711 |
-
if (stopHere) keepGoing = false;
|
| 4712 |
-
},
|
| 4713 |
-
remove : function (stopHere) {
|
| 4714 |
-
if (isArray(state.parent.node)) {
|
| 4715 |
-
state.parent.node.splice(state.key, 1);
|
| 4716 |
-
}
|
| 4717 |
-
else {
|
| 4718 |
-
delete state.parent.node[state.key];
|
| 4719 |
-
}
|
| 4720 |
-
if (stopHere) keepGoing = false;
|
| 4721 |
-
},
|
| 4722 |
-
keys : null,
|
| 4723 |
-
before : function (f) { modifiers.before = f },
|
| 4724 |
-
after : function (f) { modifiers.after = f },
|
| 4725 |
-
pre : function (f) { modifiers.pre = f },
|
| 4726 |
-
post : function (f) { modifiers.post = f },
|
| 4727 |
-
stop : function () { alive = false },
|
| 4728 |
-
block : function () { keepGoing = false }
|
| 4729 |
-
};
|
| 4730 |
-
|
| 4731 |
-
if (!alive) return state;
|
| 4732 |
-
|
| 4733 |
-
function updateState() {
|
| 4734 |
-
if (typeof state.node === 'object' && state.node !== null) {
|
| 4735 |
-
if (!state.keys || state.node_ !== state.node) {
|
| 4736 |
-
state.keys = objectKeys(state.node)
|
| 4737 |
-
}
|
| 4738 |
-
|
| 4739 |
-
state.isLeaf = state.keys.length == 0;
|
| 4740 |
-
|
| 4741 |
-
for (var i = 0; i < parents.length; i++) {
|
| 4742 |
-
if (parents[i].node_ === node_) {
|
| 4743 |
-
state.circular = parents[i];
|
| 4744 |
-
break;
|
| 4745 |
-
}
|
| 4746 |
-
}
|
| 4747 |
-
}
|
| 4748 |
-
else {
|
| 4749 |
-
state.isLeaf = true;
|
| 4750 |
-
state.keys = null;
|
| 4751 |
-
}
|
| 4752 |
-
|
| 4753 |
-
state.notLeaf = !state.isLeaf;
|
| 4754 |
-
state.notRoot = !state.isRoot;
|
| 4755 |
-
}
|
| 4756 |
-
|
| 4757 |
-
updateState();
|
| 4758 |
-
|
| 4759 |
-
// use return values to update if defined
|
| 4760 |
-
var ret = cb.call(state, state.node);
|
| 4761 |
-
if (ret !== undefined && state.update) state.update(ret);
|
| 4762 |
-
|
| 4763 |
-
if (modifiers.before) modifiers.before.call(state, state.node);
|
| 4764 |
-
|
| 4765 |
-
if (!keepGoing) return state;
|
| 4766 |
-
|
| 4767 |
-
if (typeof state.node == 'object'
|
| 4768 |
-
&& state.node !== null && !state.circular) {
|
| 4769 |
-
parents.push(state);
|
| 4770 |
-
|
| 4771 |
-
updateState();
|
| 4772 |
-
|
| 4773 |
-
forEach(state.keys, function (key, i) {
|
| 4774 |
-
path.push(key);
|
| 4775 |
-
|
| 4776 |
-
if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
|
| 4777 |
-
|
| 4778 |
-
var child = walker(state.node[key]);
|
| 4779 |
-
if (immutable && hasOwnProperty.call(state.node, key)) {
|
| 4780 |
-
state.node[key] = child.node;
|
| 4781 |
-
}
|
| 4782 |
-
|
| 4783 |
-
child.isLast = i == state.keys.length - 1;
|
| 4784 |
-
child.isFirst = i == 0;
|
| 4785 |
-
|
| 4786 |
-
if (modifiers.post) modifiers.post.call(state, child);
|
| 4787 |
-
|
| 4788 |
-
path.pop();
|
| 4789 |
-
});
|
| 4790 |
-
parents.pop();
|
| 4791 |
-
}
|
| 4792 |
-
|
| 4793 |
-
if (modifiers.after) modifiers.after.call(state, state.node);
|
| 4794 |
-
|
| 4795 |
-
return state;
|
| 4796 |
-
})(root).node;
|
| 4797 |
-
}
|
| 4798 |
-
|
| 4799 |
-
function copy (src) {
|
| 4800 |
-
if (typeof src === 'object' && src !== null) {
|
| 4801 |
-
var dst;
|
| 4802 |
-
|
| 4803 |
-
if (isArray(src)) {
|
| 4804 |
-
dst = [];
|
| 4805 |
-
}
|
| 4806 |
-
else if (isDate(src)) {
|
| 4807 |
-
dst = new Date(src.getTime ? src.getTime() : src);
|
| 4808 |
-
}
|
| 4809 |
-
else if (isRegExp(src)) {
|
| 4810 |
-
dst = new RegExp(src);
|
| 4811 |
-
}
|
| 4812 |
-
else if (isError(src)) {
|
| 4813 |
-
dst = { message: src.message };
|
| 4814 |
-
}
|
| 4815 |
-
else if (isBoolean(src)) {
|
| 4816 |
-
dst = new Boolean(src);
|
| 4817 |
-
}
|
| 4818 |
-
else if (isNumber(src)) {
|
| 4819 |
-
dst = new Number(src);
|
| 4820 |
-
}
|
| 4821 |
-
else if (isString(src)) {
|
| 4822 |
-
dst = new String(src);
|
| 4823 |
-
}
|
| 4824 |
-
else if (Object.create && Object.getPrototypeOf) {
|
| 4825 |
-
dst = Object.create(Object.getPrototypeOf(src));
|
| 4826 |
-
}
|
| 4827 |
-
else if (src.constructor === Object) {
|
| 4828 |
-
dst = {};
|
| 4829 |
-
}
|
| 4830 |
-
else {
|
| 4831 |
-
var proto =
|
| 4832 |
-
(src.constructor && src.constructor.prototype)
|
| 4833 |
-
|| src.__proto__
|
| 4834 |
-
|| {}
|
| 4835 |
-
;
|
| 4836 |
-
var T = function () {};
|
| 4837 |
-
T.prototype = proto;
|
| 4838 |
-
dst = new T;
|
| 4839 |
-
}
|
| 4840 |
-
|
| 4841 |
-
forEach(objectKeys(src), function (key) {
|
| 4842 |
-
dst[key] = src[key];
|
| 4843 |
-
});
|
| 4844 |
-
return dst;
|
| 4845 |
-
}
|
| 4846 |
-
else return src;
|
| 4847 |
-
}
|
| 4848 |
-
|
| 4849 |
-
var objectKeys = Object.keys || function keys (obj) {
|
| 4850 |
-
var res = [];
|
| 4851 |
-
for (var key in obj) res.push(key)
|
| 4852 |
-
return res;
|
| 4853 |
-
};
|
| 4854 |
-
|
| 4855 |
-
function toS (obj) { return Object.prototype.toString.call(obj) }
|
| 4856 |
-
function isDate (obj) { return toS(obj) === '[object Date]' }
|
| 4857 |
-
function isRegExp (obj) { return toS(obj) === '[object RegExp]' }
|
| 4858 |
-
function isError (obj) { return toS(obj) === '[object Error]' }
|
| 4859 |
-
function isBoolean (obj) { return toS(obj) === '[object Boolean]' }
|
| 4860 |
-
function isNumber (obj) { return toS(obj) === '[object Number]' }
|
| 4861 |
-
function isString (obj) { return toS(obj) === '[object String]' }
|
| 4862 |
-
|
| 4863 |
-
var isArray = Array.isArray || function isArray (xs) {
|
| 4864 |
-
return Object.prototype.toString.call(xs) === '[object Array]';
|
| 4865 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4866 |
|
| 4867 |
-
|
| 4868 |
-
|
| 4869 |
-
|
| 4870 |
-
fn(xs[i], i, xs);
|
| 4871 |
-
}
|
| 4872 |
-
};
|
| 4873 |
|
| 4874 |
-
|
| 4875 |
-
|
| 4876 |
-
var args = [].slice.call(arguments, 1);
|
| 4877 |
-
var t = new Traverse(obj);
|
| 4878 |
-
return t[key].apply(t, args);
|
| 4879 |
-
};
|
| 4880 |
});
|
| 4881 |
-
|
| 4882 |
-
var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
|
| 4883 |
-
return key in obj;
|
| 4884 |
-
};
|
| 4885 |
-
|
| 4886 |
|
| 4887 |
/***/ }),
|
| 4888 |
-
|
| 4889 |
-
/***/ 28:
|
| 4890 |
/***/ (function(module, exports) {
|
| 4891 |
|
| 4892 |
-
(function() { module.exports = window["wp"]["
|
| 4893 |
|
| 4894 |
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4895 |
|
| 4896 |
-
|
| 4897 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4898 |
-
|
| 4899 |
-
"use strict";
|
| 4900 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4901 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4902 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4903 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4904 |
-
|
| 4905 |
-
|
| 4906 |
-
/**
|
| 4907 |
-
* WordPress dependencies
|
| 4908 |
-
*/
|
| 4909 |
-
|
| 4910 |
-
const formatStrikethrough = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 4911 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 4912 |
-
viewBox: "0 0 24 24"
|
| 4913 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 4914 |
-
d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"
|
| 4915 |
-
}));
|
| 4916 |
-
/* harmony default export */ __webpack_exports__["a"] = (formatStrikethrough);
|
| 4917 |
-
//# sourceMappingURL=format-strikethrough.js.map
|
| 4918 |
|
| 4919 |
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4920 |
|
| 4921 |
-
|
| 4922 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4923 |
-
|
| 4924 |
-
"use strict";
|
| 4925 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4926 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4927 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4928 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4929 |
-
|
| 4930 |
|
| 4931 |
-
|
| 4932 |
-
|
| 4933 |
-
|
| 4934 |
|
| 4935 |
-
|
| 4936 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 4937 |
-
viewBox: "0 0 24 24"
|
| 4938 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 4939 |
-
d: "M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"
|
| 4940 |
-
}));
|
| 4941 |
-
/* harmony default export */ __webpack_exports__["a"] = (alignLeft);
|
| 4942 |
-
//# sourceMappingURL=align-left.js.map
|
| 4943 |
|
| 4944 |
/***/ }),
|
|
|
|
|
|
|
| 4945 |
|
| 4946 |
-
|
| 4947 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4948 |
-
|
| 4949 |
-
"use strict";
|
| 4950 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 4951 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 4952 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4953 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4954 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4955 |
|
| 4956 |
/**
|
| 4957 |
-
*
|
|
|
|
|
|
|
|
|
|
| 4958 |
*/
|
| 4959 |
|
| 4960 |
-
|
| 4961 |
-
|
| 4962 |
-
|
| 4963 |
-
|
| 4964 |
-
|
| 4965 |
-
|
| 4966 |
-
/* harmony default export */ __webpack_exports__["a"] = (alignCenter);
|
| 4967 |
-
//# sourceMappingURL=align-center.js.map
|
| 4968 |
|
| 4969 |
/***/ }),
|
|
|
|
|
|
|
| 4970 |
|
| 4971 |
-
|
| 4972 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4973 |
|
| 4974 |
-
|
| 4975 |
-
/*
|
| 4976 |
-
|
| 4977 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 4978 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 4979 |
|
|
|
|
| 4980 |
|
| 4981 |
-
|
| 4982 |
-
|
| 4983 |
-
|
|
|
|
|
|
|
| 4984 |
|
| 4985 |
-
|
| 4986 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 4987 |
-
viewBox: "0 0 24 24"
|
| 4988 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 4989 |
-
d: "M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"
|
| 4990 |
-
}));
|
| 4991 |
-
/* harmony default export */ __webpack_exports__["a"] = (alignRight);
|
| 4992 |
-
//# sourceMappingURL=align-right.js.map
|
| 4993 |
|
| 4994 |
/***/ }),
|
| 4995 |
-
|
| 4996 |
-
/***/ 29:
|
| 4997 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 4998 |
|
| 4999 |
"use strict";
|
|
@@ -5274,526 +5658,124 @@ function isShallowEqual( a, b, fromIndex ) {
|
|
| 5274 |
|
| 5275 |
|
| 5276 |
/***/ }),
|
|
|
|
|
|
|
| 5277 |
|
| 5278 |
-
|
| 5279 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5280 |
-
|
| 5281 |
-
"use strict";
|
| 5282 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 5283 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 5284 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 5285 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 5286 |
-
|
| 5287 |
|
| 5288 |
-
|
| 5289 |
-
|
| 5290 |
-
*/
|
|
|
|
| 5291 |
|
| 5292 |
-
|
| 5293 |
-
viewBox: "0 0 24 24",
|
| 5294 |
-
xmlns: "http://www.w3.org/2000/svg"
|
| 5295 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 5296 |
-
d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
|
| 5297 |
-
}));
|
| 5298 |
-
/* harmony default export */ __webpack_exports__["a"] = (chevronUp);
|
| 5299 |
-
//# sourceMappingURL=chevron-up.js.map
|
| 5300 |
|
| 5301 |
/***/ }),
|
| 5302 |
-
|
| 5303 |
-
|
| 5304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5305 |
|
| 5306 |
"use strict";
|
| 5307 |
-
/*
|
| 5308 |
-
|
| 5309 |
-
|
| 5310 |
-
Object.defineProperty(exports, "__esModule", {
|
| 5311 |
-
value: true
|
| 5312 |
-
});
|
| 5313 |
-
exports.default = Diff;
|
| 5314 |
-
|
| 5315 |
-
/*istanbul ignore end*/
|
| 5316 |
-
function Diff() {}
|
| 5317 |
-
|
| 5318 |
-
Diff.prototype = {
|
| 5319 |
-
/*istanbul ignore start*/
|
| 5320 |
-
|
| 5321 |
-
/*istanbul ignore end*/
|
| 5322 |
-
diff: function diff(oldString, newString) {
|
| 5323 |
-
/*istanbul ignore start*/
|
| 5324 |
-
var
|
| 5325 |
-
/*istanbul ignore end*/
|
| 5326 |
-
options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
| 5327 |
-
var callback = options.callback;
|
| 5328 |
-
|
| 5329 |
-
if (typeof options === 'function') {
|
| 5330 |
-
callback = options;
|
| 5331 |
-
options = {};
|
| 5332 |
-
}
|
| 5333 |
|
| 5334 |
-
|
| 5335 |
-
|
|
|
|
| 5336 |
|
| 5337 |
-
|
| 5338 |
-
if (callback) {
|
| 5339 |
-
setTimeout(function () {
|
| 5340 |
-
callback(undefined, value);
|
| 5341 |
-
}, 0);
|
| 5342 |
-
return true;
|
| 5343 |
-
} else {
|
| 5344 |
-
return value;
|
| 5345 |
-
}
|
| 5346 |
-
} // Allow subclasses to massage the input prior to running
|
| 5347 |
|
|
|
|
|
|
|
|
|
|
| 5348 |
|
| 5349 |
-
|
| 5350 |
-
|
| 5351 |
-
|
| 5352 |
-
newString = this.removeEmpty(this.tokenize(newString));
|
| 5353 |
-
var newLen = newString.length,
|
| 5354 |
-
oldLen = oldString.length;
|
| 5355 |
-
var editLength = 1;
|
| 5356 |
-
var maxEditLength = newLen + oldLen;
|
| 5357 |
-
var bestPath = [{
|
| 5358 |
-
newPos: -1,
|
| 5359 |
-
components: []
|
| 5360 |
-
}]; // Seed editLength = 0, i.e. the content starts with the same values
|
| 5361 |
|
| 5362 |
-
|
| 5363 |
|
| 5364 |
-
|
| 5365 |
-
|
| 5366 |
-
|
| 5367 |
-
|
| 5368 |
-
|
| 5369 |
-
|
| 5370 |
-
|
| 5371 |
|
|
|
|
| 5372 |
|
| 5373 |
-
|
| 5374 |
-
|
| 5375 |
-
var basePath =
|
| 5376 |
-
/*istanbul ignore start*/
|
| 5377 |
-
void 0
|
| 5378 |
-
/*istanbul ignore end*/
|
| 5379 |
-
;
|
| 5380 |
|
| 5381 |
-
|
| 5382 |
-
|
| 5383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5384 |
|
| 5385 |
-
|
| 5386 |
-
|
| 5387 |
-
|
| 5388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5389 |
|
| 5390 |
-
|
| 5391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5392 |
|
| 5393 |
-
|
| 5394 |
-
|
| 5395 |
-
|
| 5396 |
-
continue;
|
| 5397 |
-
} // Select the diagonal that we want to branch from. We select the prior
|
| 5398 |
-
// path whose position in the new string is the farthest from the origin
|
| 5399 |
-
// and does not pass the bounds of the diff graph
|
| 5400 |
|
| 5401 |
-
|
| 5402 |
-
|
| 5403 |
-
|
| 5404 |
-
|
| 5405 |
-
|
| 5406 |
-
|
| 5407 |
-
|
| 5408 |
-
|
| 5409 |
-
|
| 5410 |
-
|
| 5411 |
-
|
| 5412 |
-
|
| 5413 |
-
|
| 5414 |
-
|
| 5415 |
-
|
| 5416 |
-
|
| 5417 |
-
|
| 5418 |
-
|
| 5419 |
-
|
| 5420 |
-
|
| 5421 |
-
|
| 5422 |
-
|
| 5423 |
-
|
| 5424 |
-
|
| 5425 |
-
|
| 5426 |
-
|
| 5427 |
-
|
| 5428 |
-
|
| 5429 |
-
|
| 5430 |
-
|
| 5431 |
-
|
| 5432 |
-
|
| 5433 |
-
/* istanbul ignore next */
|
| 5434 |
-
if (editLength > maxEditLength) {
|
| 5435 |
-
return callback();
|
| 5436 |
-
}
|
| 5437 |
-
|
| 5438 |
-
if (!execEditLength()) {
|
| 5439 |
-
exec();
|
| 5440 |
-
}
|
| 5441 |
-
}, 0);
|
| 5442 |
-
})();
|
| 5443 |
-
} else {
|
| 5444 |
-
while (editLength <= maxEditLength) {
|
| 5445 |
-
var ret = execEditLength();
|
| 5446 |
-
|
| 5447 |
-
if (ret) {
|
| 5448 |
-
return ret;
|
| 5449 |
-
}
|
| 5450 |
-
}
|
| 5451 |
-
}
|
| 5452 |
-
},
|
| 5453 |
-
|
| 5454 |
-
/*istanbul ignore start*/
|
| 5455 |
-
|
| 5456 |
-
/*istanbul ignore end*/
|
| 5457 |
-
pushComponent: function pushComponent(components, added, removed) {
|
| 5458 |
-
var last = components[components.length - 1];
|
| 5459 |
-
|
| 5460 |
-
if (last && last.added === added && last.removed === removed) {
|
| 5461 |
-
// We need to clone here as the component clone operation is just
|
| 5462 |
-
// as shallow array clone
|
| 5463 |
-
components[components.length - 1] = {
|
| 5464 |
-
count: last.count + 1,
|
| 5465 |
-
added: added,
|
| 5466 |
-
removed: removed
|
| 5467 |
-
};
|
| 5468 |
-
} else {
|
| 5469 |
-
components.push({
|
| 5470 |
-
count: 1,
|
| 5471 |
-
added: added,
|
| 5472 |
-
removed: removed
|
| 5473 |
-
});
|
| 5474 |
-
}
|
| 5475 |
-
},
|
| 5476 |
-
|
| 5477 |
-
/*istanbul ignore start*/
|
| 5478 |
-
|
| 5479 |
-
/*istanbul ignore end*/
|
| 5480 |
-
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
| 5481 |
-
var newLen = newString.length,
|
| 5482 |
-
oldLen = oldString.length,
|
| 5483 |
-
newPos = basePath.newPos,
|
| 5484 |
-
oldPos = newPos - diagonalPath,
|
| 5485 |
-
commonCount = 0;
|
| 5486 |
-
|
| 5487 |
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
| 5488 |
-
newPos++;
|
| 5489 |
-
oldPos++;
|
| 5490 |
-
commonCount++;
|
| 5491 |
-
}
|
| 5492 |
-
|
| 5493 |
-
if (commonCount) {
|
| 5494 |
-
basePath.components.push({
|
| 5495 |
-
count: commonCount
|
| 5496 |
-
});
|
| 5497 |
-
}
|
| 5498 |
-
|
| 5499 |
-
basePath.newPos = newPos;
|
| 5500 |
-
return oldPos;
|
| 5501 |
-
},
|
| 5502 |
-
|
| 5503 |
-
/*istanbul ignore start*/
|
| 5504 |
-
|
| 5505 |
-
/*istanbul ignore end*/
|
| 5506 |
-
equals: function equals(left, right) {
|
| 5507 |
-
if (this.options.comparator) {
|
| 5508 |
-
return this.options.comparator(left, right);
|
| 5509 |
-
} else {
|
| 5510 |
-
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
| 5511 |
-
}
|
| 5512 |
-
},
|
| 5513 |
-
|
| 5514 |
-
/*istanbul ignore start*/
|
| 5515 |
-
|
| 5516 |
-
/*istanbul ignore end*/
|
| 5517 |
-
removeEmpty: function removeEmpty(array) {
|
| 5518 |
-
var ret = [];
|
| 5519 |
-
|
| 5520 |
-
for (var i = 0; i < array.length; i++) {
|
| 5521 |
-
if (array[i]) {
|
| 5522 |
-
ret.push(array[i]);
|
| 5523 |
-
}
|
| 5524 |
-
}
|
| 5525 |
-
|
| 5526 |
-
return ret;
|
| 5527 |
-
},
|
| 5528 |
-
|
| 5529 |
-
/*istanbul ignore start*/
|
| 5530 |
-
|
| 5531 |
-
/*istanbul ignore end*/
|
| 5532 |
-
castInput: function castInput(value) {
|
| 5533 |
-
return value;
|
| 5534 |
-
},
|
| 5535 |
-
|
| 5536 |
-
/*istanbul ignore start*/
|
| 5537 |
-
|
| 5538 |
-
/*istanbul ignore end*/
|
| 5539 |
-
tokenize: function tokenize(value) {
|
| 5540 |
-
return value.split('');
|
| 5541 |
-
},
|
| 5542 |
-
|
| 5543 |
-
/*istanbul ignore start*/
|
| 5544 |
-
|
| 5545 |
-
/*istanbul ignore end*/
|
| 5546 |
-
join: function join(chars) {
|
| 5547 |
-
return chars.join('');
|
| 5548 |
-
}
|
| 5549 |
-
};
|
| 5550 |
-
|
| 5551 |
-
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
| 5552 |
-
var componentPos = 0,
|
| 5553 |
-
componentLen = components.length,
|
| 5554 |
-
newPos = 0,
|
| 5555 |
-
oldPos = 0;
|
| 5556 |
-
|
| 5557 |
-
for (; componentPos < componentLen; componentPos++) {
|
| 5558 |
-
var component = components[componentPos];
|
| 5559 |
-
|
| 5560 |
-
if (!component.removed) {
|
| 5561 |
-
if (!component.added && useLongestToken) {
|
| 5562 |
-
var value = newString.slice(newPos, newPos + component.count);
|
| 5563 |
-
value = value.map(function (value, i) {
|
| 5564 |
-
var oldValue = oldString[oldPos + i];
|
| 5565 |
-
return oldValue.length > value.length ? oldValue : value;
|
| 5566 |
-
});
|
| 5567 |
-
component.value = diff.join(value);
|
| 5568 |
-
} else {
|
| 5569 |
-
component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
| 5570 |
-
}
|
| 5571 |
-
|
| 5572 |
-
newPos += component.count; // Common case
|
| 5573 |
-
|
| 5574 |
-
if (!component.added) {
|
| 5575 |
-
oldPos += component.count;
|
| 5576 |
-
}
|
| 5577 |
-
} else {
|
| 5578 |
-
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
| 5579 |
-
oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
|
| 5580 |
-
// The diffing algorithm is tied to add then remove output and this is the simplest
|
| 5581 |
-
// route to get the desired output with minimal overhead.
|
| 5582 |
-
|
| 5583 |
-
if (componentPos && components[componentPos - 1].added) {
|
| 5584 |
-
var tmp = components[componentPos - 1];
|
| 5585 |
-
components[componentPos - 1] = components[componentPos];
|
| 5586 |
-
components[componentPos] = tmp;
|
| 5587 |
-
}
|
| 5588 |
-
}
|
| 5589 |
-
} // Special case handle for when one terminal is ignored (i.e. whitespace).
|
| 5590 |
-
// For this case we merge the terminal into the prior string and drop the change.
|
| 5591 |
-
// This is only available for string mode.
|
| 5592 |
-
|
| 5593 |
-
|
| 5594 |
-
var lastComponent = components[componentLen - 1];
|
| 5595 |
-
|
| 5596 |
-
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
| 5597 |
-
components[componentLen - 2].value += lastComponent.value;
|
| 5598 |
-
components.pop();
|
| 5599 |
-
}
|
| 5600 |
-
|
| 5601 |
-
return components;
|
| 5602 |
-
}
|
| 5603 |
-
|
| 5604 |
-
function clonePath(path) {
|
| 5605 |
-
return {
|
| 5606 |
-
newPos: path.newPos,
|
| 5607 |
-
components: path.components.slice(0)
|
| 5608 |
-
};
|
| 5609 |
-
}
|
| 5610 |
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsImJlc3RQYXRoIiwibmV3UG9zIiwiY29tcG9uZW50cyIsIm9sZFBvcyIsImV4dHJhY3RDb21tb24iLCJqb2luIiwiY291bnQiLCJleGVjRWRpdExlbmd0aCIsImRpYWdvbmFsUGF0aCIsImJhc2VQYXRoIiwiYWRkUGF0aCIsInJlbW92ZVBhdGgiLCJjYW5BZGQiLCJjYW5SZW1vdmUiLCJjbG9uZVBhdGgiLCJwdXNoQ29tcG9uZW50IiwiYnVpbGRWYWx1ZXMiLCJ1c2VMb25nZXN0VG9rZW4iLCJleGVjIiwicmV0IiwiYWRkZWQiLCJyZW1vdmVkIiwibGFzdCIsInB1c2giLCJjb21tb25Db3VudCIsImVxdWFscyIsImxlZnQiLCJyaWdodCIsImNvbXBhcmF0b3IiLCJpZ25vcmVDYXNlIiwidG9Mb3dlckNhc2UiLCJhcnJheSIsImkiLCJzcGxpdCIsImNoYXJzIiwiY29tcG9uZW50UG9zIiwiY29tcG9uZW50TGVuIiwiY29tcG9uZW50Iiwic2xpY2UiLCJtYXAiLCJvbGRWYWx1ZSIsInRtcCIsImxhc3RDb21wb25lbnQiLCJwb3AiLCJwYXRoIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBZSxTQUFTQSxJQUFULEdBQWdCLENBQUU7O0FBRWpDQSxJQUFJLENBQUNDLFNBQUwsR0FBaUI7QUFBQTs7QUFBQTtBQUNmQyxFQUFBQSxJQURlLGdCQUNWQyxTQURVLEVBQ0NDLFNBREQsRUFDMEI7QUFBQTtBQUFBO0FBQUE7QUFBZEMsSUFBQUEsT0FBYyx1RUFBSixFQUFJO0FBQ3ZDLFFBQUlDLFFBQVEsR0FBR0QsT0FBTyxDQUFDQyxRQUF2Qjs7QUFDQSxRQUFJLE9BQU9ELE9BQVAsS0FBbUIsVUFBdkIsRUFBbUM7QUFDakNDLE1BQUFBLFFBQVEsR0FBR0QsT0FBWDtBQUNBQSxNQUFBQSxPQUFPLEdBQUcsRUFBVjtBQUNEOztBQUNELFNBQUtBLE9BQUwsR0FBZUEsT0FBZjtBQUVBLFFBQUlFLElBQUksR0FBRyxJQUFYOztBQUVBLGFBQVNDLElBQVQsQ0FBY0MsS0FBZCxFQUFxQjtBQUNuQixVQUFJSCxRQUFKLEVBQWM7QUFDWkksUUFBQUEsVUFBVSxDQUFDLFlBQVc7QUFBRUosVUFBQUEsUUFBUSxDQUFDSyxTQUFELEVBQVlGLEtBQVosQ0FBUjtBQUE2QixTQUEzQyxFQUE2QyxDQUE3QyxDQUFWO0FBQ0EsZUFBTyxJQUFQO0FBQ0QsT0FIRCxNQUdPO0FBQ0wsZUFBT0EsS0FBUDtBQUNEO0FBQ0YsS0FqQnNDLENBbUJ2Qzs7O0FBQ0FOLElBQUFBLFNBQVMsR0FBRyxLQUFLUyxTQUFMLENBQWVULFNBQWYsQ0FBWjtBQUNBQyxJQUFBQSxTQUFTLEdBQUcsS0FBS1EsU0FBTCxDQUFlUixTQUFmLENBQVo7QUFFQUQsSUFBQUEsU0FBUyxHQUFHLEtBQUtVLFdBQUwsQ0FBaUIsS0FBS0MsUUFBTCxDQUFjWCxTQUFkLENBQWpCLENBQVo7QUFDQUMsSUFBQUEsU0FBUyxHQUFHLEtBQUtTLFdBQUwsQ0FBaUIsS0FBS0MsUUFBTCxDQUFjVixTQUFkLENBQWpCLENBQVo7QUFFQSxRQUFJVyxNQUFNLEdBQUdYLFNBQVMsQ0FBQ1ksTUFBdkI7QUFBQSxRQUErQkMsTUFBTSxHQUFHZCxTQUFTLENBQUNhLE1BQWxEO0FBQ0EsUUFBSUUsVUFBVSxHQUFHLENBQWpCO0FBQ0EsUUFBSUMsYUFBYSxHQUFHSixNQUFNLEdBQUdFLE1BQTdCO0FBQ0EsUUFBSUcsUUFBUSxHQUFHLENBQUM7QUFBRUMsTUFBQUEsTUFBTSxFQUFFLENBQUMsQ0FBWDtBQUFjQyxNQUFBQSxVQUFVLEVBQUU7QUFBMUIsS0FBRCxDQUFmLENBN0J1QyxDQStCdkM7O0FBQ0EsUUFBSUMsTUFBTSxHQUFHLEtBQUtDLGFBQUwsQ0FBbUJKLFFBQVEsQ0FBQyxDQUFELENBQTNCLEVBQWdDaEIsU0FBaEMsRUFBMkNELFNBQTNDLEVBQXNELENBQXRELENBQWI7O0FBQ0EsUUFBSWlCLFFBQVEsQ0FBQyxDQUFELENBQVIsQ0FBWUMsTUFBWixHQUFxQixDQUFyQixJQUEwQk4sTUFBMUIsSUFBb0NRLE1BQU0sR0FBRyxDQUFULElBQWNOLE1BQXRELEVBQThEO0FBQzVEO0FBQ0EsYUFBT1QsSUFBSSxDQUFDLENBQUM7QUFBQ0MsUUFBQUEsS0FBSyxFQUFFLEtBQUtnQixJQUFMLENBQVVyQixTQUFWLENBQVI7QUFBOEJzQixRQUFBQSxLQUFLLEVBQUV0QixTQUFTLENBQUNZO0FBQS9DLE9BQUQsQ0FBRCxDQUFYO0FBQ0QsS0FwQ3NDLENBc0N2Qzs7O0FBQ0EsYUFBU1csY0FBVCxHQUEwQjtBQUN4QixXQUFLLElBQUlDLFlBQVksR0FBRyxDQUFDLENBQUQsR0FBS1YsVUFBN0IsRUFBeUNVLFlBQVksSUFBSVYsVUFBekQsRUFBcUVVLFlBQVksSUFBSSxDQUFyRixFQUF3RjtBQUN0RixZQUFJQyxRQUFRO0FBQUE7QUFBQTtBQUFaO0FBQUE7O0FBQ0EsWUFBSUMsT0FBTyxHQUFHVixRQUFRLENBQUNRLFlBQVksR0FBRyxDQUFoQixDQUF0QjtBQUFBLFlBQ0lHLFVBQVUsR0FBR1gsUUFBUSxDQUFDUSxZQUFZLEdBQUcsQ0FBaEIsQ0FEekI7QUFBQSxZQUVJTCxPQUFNLEdBQUcsQ0FBQ1EsVUFBVSxHQUFHQSxVQUFVLENBQUNWLE1BQWQsR0FBdUIsQ0FBbEMsSUFBdUNPLFlBRnBEOztBQUdBLFlBQUlFLE9BQUosRUFBYTtBQUNYO0FBQ0FWLFVBQUFBLFFBQVEsQ0FBQ1EsWUFBWSxHQUFHLENBQWhCLENBQVIsR0FBNkJqQixTQUE3QjtBQUNEOztBQUVELFlBQUlxQixNQUFNLEdBQUdGLE9BQU8sSUFBSUEsT0FBTyxDQUFDVCxNQUFSLEdBQWlCLENBQWpCLEdBQXFCTixNQUE3QztBQUFBLFlBQ0lrQixTQUFTLEdBQUdGLFVBQVUsSUFBSSxLQUFLUixPQUFuQixJQUE2QkEsT0FBTSxHQUFHTixNQUR0RDs7QUFFQSxZQUFJLENBQUNlLE1BQUQsSUFBVyxDQUFDQyxTQUFoQixFQUEyQjtBQUN6QjtBQUNBYixVQUFBQSxRQUFRLENBQUNRLFlBQUQsQ0FBUixHQUF5QmpCLFNBQXpCO0FBQ0E7QUFDRCxTQWhCcUYsQ0FrQnRGO0FBQ0E7QUFDQTs7O0FBQ0EsWUFBSSxDQUFDcUIsTUFBRCxJQUFZQyxTQUFTLElBQUlILE9BQU8sQ0FBQ1QsTUFBUixHQUFpQlUsVUFBVSxDQUFDVixNQUF6RCxFQUFrRTtBQUNoRVEsVUFBQUEsUUFBUSxHQUFHSyxTQUFTLENBQUNILFVBQUQsQ0FBcEI7QUFDQXhCLFVBQUFBLElBQUksQ0FBQzRCLGFBQUwsQ0FBbUJOLFFBQVEsQ0FBQ1AsVUFBNUIsRUFBd0NYLFNBQXhDLEVBQW1ELElBQW5EO0FBQ0QsU0FIRCxNQUdPO0FBQ0xrQixVQUFBQSxRQUFRLEdBQUdDLE9BQVgsQ0FESyxDQUNlOztBQUNwQkQsVUFBQUEsUUFBUSxDQUFDUixNQUFUO0FBQ0FkLFVBQUFBLElBQUksQ0FBQzRCLGFBQUwsQ0FBbUJOLFFBQVEsQ0FBQ1AsVUFBNUIsRUFBd0MsSUFBeEMsRUFBOENYLFNBQTlDO0FBQ0Q7O0FBRURZLFFBQUFBLE9BQU0sR0FBR2hCLElBQUksQ0FBQ2lCLGFBQUwsQ0FBbUJLLFFBQW5CLEVBQTZCekIsU0FBN0IsRUFBd0NELFNBQXhDLEVBQW1EeUIsWUFBbkQsQ0FBVCxDQTlCc0YsQ0FnQ3RGOztBQUNBLFlBQUlDLFFBQVEsQ0FBQ1IsTUFBVCxHQUFrQixDQUFsQixJQUF1Qk4sTUFBdkIsSUFBaUNRLE9BQU0sR0FBRyxDQUFULElBQWNOLE1BQW5ELEVBQTJEO0FBQ3pELGlCQUFPVCxJQUFJLENBQUM0QixXQUFXLENBQUM3QixJQUFELEVBQU9zQixRQUFRLENBQUNQLFVBQWhCLEVBQTRCbEIsU0FBNUIsRUFBdUNELFNBQXZDLEVBQWtESSxJQUFJLENBQUM4QixlQUF2RCxDQUFaLENBQVg7QUFDRCxTQUZELE1BRU87QUFDTDtBQUNBakIsVUFBQUEsUUFBUSxDQUFDUSxZQUFELENBQVIsR0FBeUJDLFFBQXpCO0FBQ0Q7QUFDRjs7QUFFRFgsTUFBQUEsVUFBVTtBQUNYLEtBbEZzQyxDQW9GdkM7QUFDQTtBQUNBOzs7QUFDQSxRQUFJWixRQUFKLEVBQWM7QUFDWCxnQkFBU2dDLElBQVQsR0FBZ0I7QUFDZjVCLFFBQUFBLFVBQVUsQ0FBQyxZQUFXO0FBQ3BCOztBQUNBO0FBQ0EsY0FBSVEsVUFBVSxHQUFHQyxhQUFqQixFQUFnQztBQUM5QixtQkFBT2IsUUFBUSxFQUFmO0FBQ0Q7O0FBRUQsY0FBSSxDQUFDcUIsY0FBYyxFQUFuQixFQUF1QjtBQUNyQlcsWUFBQUEsSUFBSTtBQUNMO0FBQ0YsU0FWUyxFQVVQLENBVk8sQ0FBVjtBQVdELE9BWkEsR0FBRDtBQWFELEtBZEQsTUFjTztBQUNMLGFBQU9wQixVQUFVLElBQUlDLGFBQXJCLEVBQW9DO0FBQ2xDLFlBQUlvQixHQUFHLEdBQUdaLGNBQWMsRUFBeEI7O0FBQ0EsWUFBSVksR0FBSixFQUFTO0FBQ1AsaUJBQU9BLEdBQVA7QUFDRDtBQUNGO0FBQ0Y7QUFDRixHQTlHYzs7QUFBQTs7QUFBQTtBQWdIZkosRUFBQUEsYUFoSGUseUJBZ0hEYixVQWhIQyxFQWdIV2tCLEtBaEhYLEVBZ0hrQkMsT0FoSGxCLEVBZ0gyQjtBQUN4QyxRQUFJQyxJQUFJLEdBQUdwQixVQUFVLENBQUNBLFVBQVUsQ0FBQ04sTUFBWCxHQUFvQixDQUFyQixDQUFyQjs7QUFDQSxRQUFJMEIsSUFBSSxJQUFJQSxJQUFJLENBQUNGLEtBQUwsS0FBZUEsS0FBdkIsSUFBZ0NFLElBQUksQ0FBQ0QsT0FBTCxLQUFpQkEsT0FBckQsRUFBOEQ7QUFDNUQ7QUFDQTtBQUNBbkIsTUFBQUEsVUFBVSxDQUFDQSxVQUFVLENBQUNOLE1BQVgsR0FBb0IsQ0FBckIsQ0FBVixHQUFvQztBQUFDVSxRQUFBQSxLQUFLLEVBQUVnQixJQUFJLENBQUNoQixLQUFMLEdBQWEsQ0FBckI7QUFBd0JjLFFBQUFBLEtBQUssRUFBRUEsS0FBL0I7QUFBc0NDLFFBQUFBLE9BQU8sRUFBRUE7QUFBL0MsT0FBcEM7QUFDRCxLQUpELE1BSU87QUFDTG5CLE1BQUFBLFVBQVUsQ0FBQ3FCLElBQVgsQ0FBZ0I7QUFBQ2pCLFFBQUFBLEtBQUssRUFBRSxDQUFSO0FBQVdjLFFBQUFBLEtBQUssRUFBRUEsS0FBbEI7QUFBeUJDLFFBQUFBLE9BQU8sRUFBRUE7QUFBbEMsT0FBaEI7QUFDRDtBQUNGLEdBekhjOztBQUFBOztBQUFBO0FBMEhmakIsRUFBQUEsYUExSGUseUJBMEhESyxRQTFIQyxFQTBIU3pCLFNBMUhULEVBMEhvQkQsU0ExSHBCLEVBMEgrQnlCLFlBMUgvQixFQTBINkM7QUFDMUQsUUFBSWIsTUFBTSxHQUFHWCxTQUFTLENBQUNZLE1BQXZCO0FBQUEsUUFDSUMsTUFBTSxHQUFHZCxTQUFTLENBQUNhLE1BRHZCO0FBQUEsUUFFSUssTUFBTSxHQUFHUSxRQUFRLENBQUNSLE1BRnRCO0FBQUEsUUFHSUUsTUFBTSxHQUFHRixNQUFNLEdBQUdPLFlBSHRCO0FBQUEsUUFLSWdCLFdBQVcsR0FBRyxDQUxsQjs7QUFNQSxXQUFPdkIsTUFBTSxHQUFHLENBQVQsR0FBYU4sTUFBYixJQUF1QlEsTUFBTSxHQUFHLENBQVQsR0FBYU4sTUFBcEMsSUFBOEMsS0FBSzRCLE1BQUwsQ0FBWXpDLFNBQVMsQ0FBQ2lCLE1BQU0sR0FBRyxDQUFWLENBQXJCLEVBQW1DbEIsU0FBUyxDQUFDb0IsTUFBTSxHQUFHLENBQVYsQ0FBNUMsQ0FBckQsRUFBZ0g7QUFDOUdGLE1BQUFBLE1BQU07QUFDTkUsTUFBQUEsTUFBTTtBQUNOcUIsTUFBQUEsV0FBVztBQUNaOztBQUVELFFBQUlBLFdBQUosRUFBaUI7QUFDZmYsTUFBQUEsUUFBUSxDQUFDUCxVQUFULENBQW9CcUIsSUFBcEIsQ0FBeUI7QUFBQ2pCLFFBQUFBLEtBQUssRUFBRWtCO0FBQVIsT0FBekI7QUFDRDs7QUFFRGYsSUFBQUEsUUFBUSxDQUFDUixNQUFULEdBQWtCQSxNQUFsQjtBQUNBLFdBQU9FLE1BQVA7QUFDRCxHQTdJYzs7QUFBQTs7QUFBQTtBQStJZnNCLEVBQUFBLE1BL0llLGtCQStJUkMsSUEvSVEsRUErSUZDLEtBL0lFLEVBK0lLO0FBQ2xCLFFBQUksS0FBSzFDLE9BQUwsQ0FBYTJDLFVBQWpCLEVBQTZCO0FBQzNCLGFBQU8sS0FBSzNDLE9BQUwsQ0FBYTJDLFVBQWIsQ0FBd0JGLElBQXhCLEVBQThCQyxLQUE5QixDQUFQO0FBQ0QsS0FGRCxNQUVPO0FBQ0wsYUFBT0QsSUFBSSxLQUFLQyxLQUFULElBQ0QsS0FBSzFDLE9BQUwsQ0FBYTRDLFVBQWIsSUFBMkJILElBQUksQ0FBQ0ksV0FBTCxPQUF1QkgsS0FBSyxDQUFDRyxXQUFOLEVBRHhEO0FBRUQ7QUFDRixHQXRKYzs7QUFBQTs7QUFBQTtBQXVKZnJDLEVBQUFBLFdBdkplLHVCQXVKSHNDLEtBdkpHLEVBdUpJO0FBQ2pCLFFBQUlaLEdBQUcsR0FBRyxFQUFWOztBQUNBLFNBQUssSUFBSWEsQ0FBQyxHQUFHLENBQWIsRUFBZ0JBLENBQUMsR0FBR0QsS0FBSyxDQUFDbkMsTUFBMUIsRUFBa0NvQyxDQUFDLEVBQW5DLEVBQXVDO0FBQ3JDLFVBQUlELEtBQUssQ0FBQ0MsQ0FBRCxDQUFULEVBQWM7QUFDWmIsUUFBQUEsR0FBRyxDQUFDSSxJQUFKLENBQVNRLEtBQUssQ0FBQ0MsQ0FBRCxDQUFkO0FBQ0Q7QUFDRjs7QUFDRCxXQUFPYixHQUFQO0FBQ0QsR0EvSmM7O0FBQUE7O0FBQUE7QUFnS2YzQixFQUFBQSxTQWhLZSxxQkFnS0xILEtBaEtLLEVBZ0tFO0FBQ2YsV0FBT0EsS0FBUDtBQUNELEdBbEtjOztBQUFBOztBQUFBO0FBbUtmSyxFQUFBQSxRQW5LZSxvQkFtS05MLEtBbktNLEVBbUtDO0FBQ2QsV0FBT0EsS0FBSyxDQUFDNEMsS0FBTixDQUFZLEVBQVosQ0FBUDtBQUNELEdBcktjOztBQUFBOztBQUFBO0FBc0tmNUIsRUFBQUEsSUF0S2UsZ0JBc0tWNkIsS0F0S1UsRUFzS0g7QUFDVixXQUFPQSxLQUFLLENBQUM3QixJQUFOLENBQVcsRUFBWCxDQUFQO0FBQ0Q7QUF4S2MsQ0FBakI7O0FBMktBLFNBQVNXLFdBQVQsQ0FBcUJsQyxJQUFyQixFQUEyQm9CLFVBQTNCLEVBQXVDbEIsU0FBdkMsRUFBa0RELFNBQWxELEVBQTZEa0MsZUFBN0QsRUFBOEU7QUFDNUUsTUFBSWtCLFlBQVksR0FBRyxDQUFuQjtBQUFBLE1BQ0lDLFlBQVksR0FBR2xDLFVBQVUsQ0FBQ04sTUFEOUI7QUFBQSxNQUVJSyxNQUFNLEdBQUcsQ0FGYjtBQUFBLE1BR0lFLE1BQU0sR0FBRyxDQUhiOztBQUtBLFNBQU9nQyxZQUFZLEdBQUdDLFlBQXRCLEVBQW9DRCxZQUFZLEVBQWhELEVBQW9EO0FBQ2xELFFBQUlFLFNBQVMsR0FBR25DLFVBQVUsQ0FBQ2lDLFlBQUQsQ0FBMUI7O0FBQ0EsUUFBSSxDQUFDRSxTQUFTLENBQUNoQixPQUFmLEVBQXdCO0FBQ3RCLFVBQUksQ0FBQ2dCLFNBQVMsQ0FBQ2pCLEtBQVgsSUFBb0JILGVBQXhCLEVBQXlDO0FBQ3ZDLFlBQUk1QixLQUFLLEdBQUdMLFNBQVMsQ0FBQ3NELEtBQVYsQ0FBZ0JyQyxNQUFoQixFQUF3QkEsTUFBTSxHQUFHb0MsU0FBUyxDQUFDL0IsS0FBM0MsQ0FBWjtBQUNBakIsUUFBQUEsS0FBSyxHQUFHQSxLQUFLLENBQUNrRCxHQUFOLENBQVUsVUFBU2xELEtBQVQsRUFBZ0IyQyxDQUFoQixFQUFtQjtBQUNuQyxjQUFJUSxRQUFRLEdBQUd6RCxTQUFTLENBQUNvQixNQUFNLEdBQUc2QixDQUFWLENBQXhCO0FBQ0EsaUJBQU9RLFFBQVEsQ0FBQzVDLE1BQVQsR0FBa0JQLEtBQUssQ0FBQ08sTUFBeEIsR0FBaUM0QyxRQUFqQyxHQUE0Q25ELEtBQW5EO0FBQ0QsU0FITyxDQUFSO0FBS0FnRCxRQUFBQSxTQUFTLENBQUNoRCxLQUFWLEdBQWtCUCxJQUFJLENBQUN1QixJQUFMLENBQVVoQixLQUFWLENBQWxCO0FBQ0QsT0FSRCxNQVFPO0FBQ0xnRCxRQUFBQSxTQUFTLENBQUNoRCxLQUFWLEdBQWtCUCxJQUFJLENBQUN1QixJQUFMLENBQVVyQixTQUFTLENBQUNzRCxLQUFWLENBQWdCckMsTUFBaEIsRUFBd0JBLE1BQU0sR0FBR29DLFNBQVMsQ0FBQy9CLEtBQTNDLENBQVYsQ0FBbEI7QUFDRDs7QUFDREwsTUFBQUEsTUFBTSxJQUFJb0MsU0FBUyxDQUFDL0IsS0FBcEIsQ0Fac0IsQ0FjdEI7O0FBQ0EsVUFBSSxDQUFDK0IsU0FBUyxDQUFDakIsS0FBZixFQUFzQjtBQUNwQmpCLFFBQUFBLE1BQU0sSUFBSWtDLFNBQVMsQ0FBQy9CLEtBQXBCO0FBQ0Q7QUFDRixLQWxCRCxNQWtCTztBQUNMK0IsTUFBQUEsU0FBUyxDQUFDaEQsS0FBVixHQUFrQlAsSUFBSSxDQUFDdUIsSUFBTCxDQUFVdEIsU0FBUyxDQUFDdUQsS0FBVixDQUFnQm5DLE1BQWhCLEVBQXdCQSxNQUFNLEdBQUdrQyxTQUFTLENBQUMvQixLQUEzQyxDQUFWLENBQWxCO0FBQ0FILE1BQUFBLE1BQU0sSUFBSWtDLFNBQVMsQ0FBQy9CLEtBQXBCLENBRkssQ0FJTDtBQUNBO0FBQ0E7O0FBQ0EsVUFBSTZCLFlBQVksSUFBSWpDLFVBQVUsQ0FBQ2lDLFlBQVksR0FBRyxDQUFoQixDQUFWLENBQTZCZixLQUFqRCxFQUF3RDtBQUN0RCxZQUFJcUIsR0FBRyxHQUFHdkMsVUFBVSxDQUFDaUMsWUFBWSxHQUFHLENBQWhCLENBQXBCO0FBQ0FqQyxRQUFBQSxVQUFVLENBQUNpQyxZQUFZLEdBQUcsQ0FBaEIsQ0FBVixHQUErQmpDLFVBQVUsQ0FBQ2lDLFlBQUQsQ0FBekM7QUFDQWpDLFFBQUFBLFVBQVUsQ0FBQ2lDLFlBQUQsQ0FBVixHQUEyQk0sR0FBM0I7QUFDRDtBQUNGO0FBQ0YsR0F2QzJFLENBeUM1RTtBQUNBO0FBQ0E7OztBQUNBLE1BQUlDLGFBQWEsR0FBR3hDLFVBQVUsQ0FBQ2tDLFlBQVksR0FBRyxDQUFoQixDQUE5Qjs7QUFDQSxNQUFJQSxZQUFZLEdBQUcsQ0FBZixJQUNHLE9BQU9NLGFBQWEsQ0FBQ3JELEtBQXJCLEtBQStCLFFBRGxDLEtBRUlxRCxhQUFhLENBQUN0QixLQUFkLElBQXVCc0IsYUFBYSxDQUFDckIsT0FGekMsS0FHR3ZDLElBQUksQ0FBQzJDLE1BQUwsQ0FBWSxFQUFaLEVBQWdCaUIsYUFBYSxDQUFDckQsS0FBOUIsQ0FIUCxFQUc2QztBQUMzQ2EsSUFBQUEsVUFBVSxDQUFDa0MsWUFBWSxHQUFHLENBQWhCLENBQVYsQ0FBNkIvQyxLQUE3QixJQUFzQ3FELGFBQWEsQ0FBQ3JELEtBQXBEO0FBQ0FhLElBQUFBLFVBQVUsQ0FBQ3lDLEdBQVg7QUFDRDs7QUFFRCxTQUFPekMsVUFBUDtBQUNEOztBQUVELFNBQVNZLFNBQVQsQ0FBbUI4QixJQUFuQixFQUF5QjtBQUN2QixTQUFPO0FBQUUzQyxJQUFBQSxNQUFNLEVBQUUyQyxJQUFJLENBQUMzQyxNQUFmO0FBQXVCQyxJQUFBQSxVQUFVLEVBQUUwQyxJQUFJLENBQUMxQyxVQUFMLENBQWdCb0MsS0FBaEIsQ0FBc0IsQ0FBdEI7QUFBbkMsR0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gRGlmZigpIHt9XG5cbkRpZmYucHJvdG90eXBlID0ge1xuICBkaWZmKG9sZFN0cmluZywgbmV3U3RyaW5nLCBvcHRpb25zID0ge30pIHtcbiAgICBsZXQgY2FsbGJhY2sgPSBvcHRpb25zLmNhbGxiYWNrO1xuICAgIGlmICh0eXBlb2Ygb3B0aW9ucyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgY2FsbGJhY2sgPSBvcHRpb25zO1xuICAgICAgb3B0aW9ucyA9IHt9O1xuICAgIH1cbiAgICB0aGlzLm9wdGlvbnMgPSBvcHRpb25zO1xuXG4gICAgbGV0IHNlbGYgPSB0aGlzO1xuXG4gICAgZnVuY3Rpb24gZG9uZSh2YWx1ZSkge1xuICAgICAgaWYgKGNhbGxiYWNrKSB7XG4gICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7IGNhbGxiYWNrKHVuZGVmaW5lZCwgdmFsdWUpOyB9LCAwKTtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gQWxsb3cgc3ViY2xhc3NlcyB0byBtYXNzYWdlIHRoZSBpbnB1dCBwcmlvciB0byBydW5uaW5nXG4gICAgb2xkU3RyaW5nID0gdGhpcy5jYXN0SW5wdXQob2xkU3RyaW5nKTtcbiAgICBuZXdTdHJpbmcgPSB0aGlzLmNhc3RJbnB1dChuZXdTdHJpbmcpO1xuXG4gICAgb2xkU3RyaW5nID0gdGhpcy5yZW1vdmVFbXB0eSh0aGlzLnRva2VuaXplKG9sZFN0cmluZykpO1xuICAgIG5ld1N0cmluZyA9IHRoaXMucmVtb3ZlRW1wdHkodGhpcy50b2tlbml6ZShuZXdTdHJpbmcpKTtcblxuICAgIGxldCBuZXdMZW4gPSBuZXdTdHJpbmcubGVuZ3RoLCBvbGRMZW4gPSBvbGRTdHJpbmcubGVuZ3RoO1xuICAgIGxldCBlZGl0TGVuZ3RoID0gMTtcbiAgICBsZXQgbWF4RWRpdExlbmd0aCA9IG5ld0xlbiArIG9sZExlbjtcbiAgICBsZXQgYmVzdFBhdGggPSBbeyBuZXdQb3M6IC0xLCBjb21wb25lbnRzOiBbXSB9XTtcblxuICAgIC8vIFNlZWQgZWRpdExlbmd0aCA9IDAsIGkuZS4gdGhlIGNvbnRlbnQgc3RhcnRzIHdpdGggdGhlIHNhbWUgdmFsdWVzXG4gICAgbGV0IG9sZFBvcyA9IHRoaXMuZXh0cmFjdENvbW1vbihiZXN0UGF0aFswXSwgbmV3U3RyaW5nLCBvbGRTdHJpbmcsIDApO1xuICAgIGlmIChiZXN0UGF0aFswXS5uZXdQb3MgKyAxID49IG5ld0xlbiAmJiBvbGRQb3MgKyAxID49IG9sZExlbikge1xuICAgICAgLy8gSWRlbnRpdHkgcGVyIHRoZSBlcXVhbGl0eSBhbmQgdG9rZW5pemVyXG4gICAgICByZXR1cm4gZG9uZShbe3ZhbHVlOiB0aGlzLmpvaW4obmV3U3RyaW5nKSwgY291bnQ6IG5ld1N0cmluZy5sZW5ndGh9XSk7XG4gICAgfVxuXG4gICAgLy8gTWFpbiB3b3JrZXIgbWV0aG9kLiBjaGVja3MgYWxsIHBlcm11dGF0aW9ucyBvZiBhIGdpdmVuIGVkaXQgbGVuZ3RoIGZvciBhY2NlcHRhbmNlLlxuICAgIGZ1bmN0aW9uIGV4ZWNFZGl0TGVuZ3RoKCkge1xuICAgICAgZm9yIChsZXQgZGlhZ29uYWxQYXRoID0gLTEgKiBlZGl0TGVuZ3RoOyBkaWFnb25hbFBhdGggPD0gZWRpdExlbmd0aDsgZGlhZ29uYWxQYXRoICs9IDIpIHtcbiAgICAgICAgbGV0IGJhc2VQYXRoO1xuICAgICAgICBsZXQgYWRkUGF0aCA9IGJlc3RQYXRoW2RpYWdvbmFsUGF0aCAtIDFdLFxuICAgICAgICAgICAgcmVtb3ZlUGF0aCA9IGJlc3RQYXRoW2RpYWdvbmFsUGF0aCArIDFdLFxuICAgICAgICAgICAgb2xkUG9zID0gKHJlbW92ZVBhdGggPyByZW1vdmVQYXRoLm5ld1BvcyA6IDApIC0gZGlhZ29uYWxQYXRoO1xuICAgICAgICBpZiAoYWRkUGF0aCkge1xuICAgICAgICAgIC8vIE5vIG9uZSBlbHNlIGlzIGdvaW5nIHRvIGF0dGVtcHQgdG8gdXNlIHRoaXMgdmFsdWUsIGNsZWFyIGl0XG4gICAgICAgICAgYmVzdFBhdGhbZGlhZ29uYWxQYXRoIC0gMV0gPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgY2FuQWRkID0gYWRkUGF0aCAmJiBhZGRQYXRoLm5ld1BvcyArIDEgPCBuZXdMZW4sXG4gICAgICAgICAgICBjYW5SZW1vdmUgPSByZW1vdmVQYXRoICYmIDAgPD0gb2xkUG9zICYmIG9sZFBvcyA8IG9sZExlbjtcbiAgICAgICAgaWYgKCFjYW5BZGQgJiYgIWNhblJlbW92ZSkge1xuICAgICAgICAgIC8vIElmIHRoaXMgcGF0aCBpcyBhIHRlcm1pbmFsIHRoZW4gcHJ1bmVcbiAgICAgICAgICBiZXN0UGF0aFtkaWFnb25hbFBhdGhdID0gdW5kZWZpbmVkO1xuICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gU2VsZWN0IHRoZSBkaWFnb25hbCB0aGF0IHdlIHdhbnQgdG8gYnJhbmNoIGZyb20uIFdlIHNlbGVjdCB0aGUgcHJpb3JcbiAgICAgICAgLy8gcGF0aCB3aG9zZSBwb3NpdGlvbiBpbiB0aGUgbmV3IHN0cmluZyBpcyB0aGUgZmFydGhlc3QgZnJvbSB0aGUgb3JpZ2luXG4gICAgICAgIC8vIGFuZCBkb2VzIG5vdCBwYXNzIHRoZSBib3VuZHMgb2YgdGhlIGRpZmYgZ3JhcGhcbiAgICAgICAgaWYgKCFjYW5BZGQgfHwgKGNhblJlbW92ZSAmJiBhZGRQYXRoLm5ld1BvcyA8IHJlbW92ZVBhdGgubmV3UG9zKSkge1xuICAgICAgICAgIGJhc2VQYXRoID0gY2xvbmVQYXRoKHJlbW92ZVBhdGgpO1xuICAgICAgICAgIHNlbGYucHVzaENvbXBvbmVudChiYXNlUGF0aC5jb21wb25lbnRzLCB1bmRlZmluZWQsIHRydWUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGJhc2VQYXRoID0gYWRkUGF0aDsgLy8gTm8gbmVlZCB0byBjbG9uZSwgd2UndmUgcHVsbGVkIGl0IGZyb20gdGhlIGxpc3RcbiAgICAgICAgICBiYXNlUGF0aC5uZXdQb3MrKztcbiAgICAgICAgICBzZWxmLnB1c2hDb21wb25lbnQoYmFzZVBhdGguY29tcG9uZW50cywgdHJ1ZSwgdW5kZWZpbmVkKTtcbiAgICAgICAgfVxuXG4gICAgICAgIG9sZFBvcyA9IHNlbGYuZXh0cmFjdENvbW1vbihiYXNlUGF0aCwgbmV3U3RyaW5nLCBvbGRTdHJpbmcsIGRpYWdvbmFsUGF0aCk7XG5cbiAgICAgICAgLy8gSWYgd2UgaGF2ZSBoaXQgdGhlIGVuZCBvZiBib3RoIHN0cmluZ3MsIHRoZW4gd2UgYXJlIGRvbmVcbiAgICAgICAgaWYgKGJhc2VQYXRoLm5ld1BvcyArIDEgPj0gbmV3TGVuICYmIG9sZFBvcyArIDEgPj0gb2xkTGVuKSB7XG4gICAgICAgICAgcmV0dXJuIGRvbmUoYnVpbGRWYWx1ZXMoc2VsZiwgYmFzZVBhdGguY29tcG9uZW50cywgbmV3U3RyaW5nLCBvbGRTdHJpbmcsIHNlbGYudXNlTG9uZ2VzdFRva2VuKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gT3RoZXJ3aXNlIHRyYWNrIHRoaXMgcGF0aCBhcyBhIHBvdGVudGlhbCBjYW5kaWRhdGUgYW5kIGNvbnRpbnVlLlxuICAgICAgICAgIGJlc3RQYXRoW2RpYWdvbmFsUGF0aF0gPSBiYXNlUGF0aDtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBlZGl0TGVuZ3RoKys7XG4gICAgfVxuXG4gICAgLy8gUGVyZm9ybXMgdGhlIGxlbmd0aCBvZiBlZGl0IGl0ZXJhdGlvbi4gSXMgYSBiaXQgZnVnbHkgYXMgdGhpcyBoYXMgdG8gc3VwcG9ydCB0aGVcbiAgICAvLyBzeW5jIGFuZCBhc3luYyBtb2RlIHdoaWNoIGlzIG5ldmVyIGZ1bi4gTG9vcHMgb3ZlciBleGVjRWRpdExlbmd0aCB1bnRpbCBhIHZhbHVlXG4gICAgLy8gaXMgcHJvZHVjZWQuXG4gICAgaWYgKGNhbGxiYWNrKSB7XG4gICAgICAoZnVuY3Rpb24gZXhlYygpIHtcbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAvLyBUaGlzIHNob3VsZCBub3QgaGFwcGVuLCBidXQgd2Ugd2FudCB0byBiZSBzYWZlLlxuICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgaWYgKGVkaXRMZW5ndGggPiBtYXhFZGl0TGVuZ3RoKSB7XG4gICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoIWV4ZWNFZGl0TGVuZ3RoKCkpIHtcbiAgICAgICAgICAgIGV4ZWMoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0sIDApO1xuICAgICAgfSgpKTtcbiAgICB9IGVsc2Uge1xuICAgICAgd2hpbGUgKGVkaXRMZW5ndGggPD0gbWF4RWRpdExlbmd0aCkge1xuICAgICAgICBsZXQgcmV0ID0gZXhlY0VkaXRMZW5ndGgoKTtcbiAgICAgICAgaWYgKHJldCkge1xuICAgICAgICAgIHJldHVybiByZXQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gIH0sXG5cbiAgcHVzaENvbXBvbmVudChjb21wb25lbnRzLCBhZGRlZCwgcmVtb3ZlZCkge1xuICAgIGxldCBsYXN0ID0gY29tcG9uZW50c1tjb21wb25lbnRzLmxlbmd0aCAtIDFdO1xuICAgIGlmIChsYXN0ICYmIGxhc3QuYWRkZWQgPT09IGFkZGVkICYmIGxhc3QucmVtb3ZlZCA9PT0gcmVtb3ZlZCkge1xuICAgICAgLy8gV2UgbmVlZCB0byBjbG9uZSBoZXJlIGFzIHRoZSBjb21wb25lbnQgY2xvbmUgb3BlcmF0aW9uIGlzIGp1c3RcbiAgICAgIC8vIGFzIHNoYWxsb3cgYXJyYXkgY2xvbmVcbiAgICAgIGNvbXBvbmVudHNbY29tcG9uZW50cy5sZW5ndGggLSAxXSA9IHtjb3VudDogbGFzdC5jb3VudCArIDEsIGFkZGVkOiBhZGRlZCwgcmVtb3ZlZDogcmVtb3ZlZCB9O1xuICAgIH0gZWxzZSB7XG4gICAgICBjb21wb25lbnRzLnB1c2goe2NvdW50OiAxLCBhZGRlZDogYWRkZWQsIHJlbW92ZWQ6IHJlbW92ZWQgfSk7XG4gICAgfVxuICB9LFxuICBleHRyYWN0Q29tbW9uKGJhc2VQYXRoLCBuZXdTdHJpbmcsIG9sZFN0cmluZywgZGlhZ29uYWxQYXRoKSB7XG4gICAgbGV0IG5ld0xlbiA9IG5ld1N0cmluZy5sZW5ndGgsXG4gICAgICAgIG9sZExlbiA9IG9sZFN0cmluZy5sZW5ndGgsXG4gICAgICAgIG5ld1BvcyA9IGJhc2VQYXRoLm5ld1BvcyxcbiAgICAgICAgb2xkUG9zID0gbmV3UG9zIC0gZGlhZ29uYWxQYXRoLFxuXG4gICAgICAgIGNvbW1vbkNvdW50ID0gMDtcbiAgICB3aGlsZSAobmV3UG9zICsgMSA8IG5ld0xlbiAmJiBvbGRQb3MgKyAxIDwgb2xkTGVuICYmIHRoaXMuZXF1YWxzKG5ld1N0cmluZ1tuZXdQb3MgKyAxXSwgb2xkU3RyaW5nW29sZFBvcyArIDFdKSkge1xuICAgICAgbmV3UG9zKys7XG4gICAgICBvbGRQb3MrKztcbiAgICAgIGNvbW1vbkNvdW50Kys7XG4gICAgfVxuXG4gICAgaWYgKGNvbW1vbkNvdW50KSB7XG4gICAgICBiYXNlUGF0aC5jb21wb25lbnRzLnB1c2goe2NvdW50OiBjb21tb25Db3VudH0pO1xuICAgIH1cblxuICAgIGJhc2VQYXRoLm5ld1BvcyA9IG5ld1BvcztcbiAgICByZXR1cm4gb2xkUG9zO1xuICB9LFxuXG4gIGVxdWFscyhsZWZ0LCByaWdodCkge1xuICAgIGlmICh0aGlzLm9wdGlvbnMuY29tcGFyYXRvcikge1xuICAgICAgcmV0dXJuIHRoaXMub3B0aW9ucy5jb21wYXJhdG9yKGxlZnQsIHJpZ2h0KTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIGxlZnQgPT09IHJpZ2h0XG4gICAgICAgIHx8ICh0aGlzLm9wdGlvbnMuaWdub3JlQ2FzZSAmJiBsZWZ0LnRvTG93ZXJDYXNlKCkgPT09IHJpZ2h0LnRvTG93ZXJDYXNlKCkpO1xuICAgIH1cbiAgfSxcbiAgcmVtb3ZlRW1wdHkoYXJyYXkpIHtcbiAgICBsZXQgcmV0ID0gW107XG4gICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnJheS5sZW5ndGg7IGkrKykge1xuICAgICAgaWYgKGFycmF5W2ldKSB7XG4gICAgICAgIHJldC5wdXNoKGFycmF5W2ldKTtcbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHJldDtcbiAgfSxcbiAgY2FzdElucHV0KHZhbHVlKSB7XG4gICAgcmV0dXJuIHZhbHVlO1xuICB9LFxuICB0b2tlbml6ZSh2YWx1ZSkge1xuICAgIHJldHVybiB2YWx1ZS5zcGxpdCgnJyk7XG4gIH0sXG4gIGpvaW4oY2hhcnMpIHtcbiAgICByZXR1cm4gY2hhcnMuam9pbignJyk7XG4gIH1cbn07XG5cbmZ1bmN0aW9uIGJ1aWxkVmFsdWVzKGRpZmYsIGNvbXBvbmVudHMsIG5ld1N0cmluZywgb2xkU3RyaW5nLCB1c2VMb25nZXN0VG9rZW4pIHtcbiAgbGV0IGNvbXBvbmVudFBvcyA9IDAsXG4gICAgICBjb21wb25lbnRMZW4gPSBjb21wb25lbnRzLmxlbmd0aCxcbiAgICAgIG5ld1BvcyA9IDAsXG4gICAgICBvbGRQb3MgPSAwO1xuXG4gIGZvciAoOyBjb21wb25lbnRQb3MgPCBjb21wb25lbnRMZW47IGNvbXBvbmVudFBvcysrKSB7XG4gICAgbGV0IGNvbXBvbmVudCA9IGNvbXBvbmVudHNbY29tcG9uZW50UG9zXTtcbiAgICBpZiAoIWNvbXBvbmVudC5yZW1vdmVkKSB7XG4gICAgICBpZiAoIWNvbXBvbmVudC5hZGRlZCAmJiB1c2VMb25nZXN0VG9rZW4pIHtcbiAgICAgICAgbGV0IHZhbHVlID0gbmV3U3RyaW5nLnNsaWNlKG5ld1BvcywgbmV3UG9zICsgY29tcG9uZW50LmNvdW50KTtcbiAgICAgICAgdmFsdWUgPSB2YWx1ZS5tYXAoZnVuY3Rpb24odmFsdWUsIGkpIHtcbiAgICAgICAgICBsZXQgb2xkVmFsdWUgPSBvbGRTdHJpbmdbb2xkUG9zICsgaV07XG4gICAgICAgICAgcmV0dXJuIG9sZFZhbHVlLmxlbmd0aCA+IHZhbHVlLmxlbmd0aCA/IG9sZFZhbHVlIDogdmFsdWU7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGNvbXBvbmVudC52YWx1ZSA9IGRpZmYuam9pbih2YWx1ZSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBjb21wb25lbnQudmFsdWUgPSBkaWZmLmpvaW4obmV3U3RyaW5nLnNsaWNlKG5ld1BvcywgbmV3UG9zICsgY29tcG9uZW50LmNvdW50KSk7XG4gICAgICB9XG4gICAgICBuZXdQb3MgKz0gY29tcG9uZW50LmNvdW50O1xuXG4gICAgICAvLyBDb21tb24gY2FzZVxuICAgICAgaWYgKCFjb21wb25lbnQuYWRkZWQpIHtcbiAgICAgICAgb2xkUG9zICs9IGNvbXBvbmVudC5jb3VudDtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgY29tcG9uZW50LnZhbHVlID0gZGlmZi5qb2luKG9sZFN0cmluZy5zbGljZShvbGRQb3MsIG9sZFBvcyArIGNvbXBvbmVudC5jb3VudCkpO1xuICAgICAgb2xkUG9zICs9IGNvbXBvbmVudC5jb3VudDtcblxuICAgICAgLy8gUmV2ZXJzZSBhZGQgYW5kIHJlbW92ZSBzbyByZW1vdmVzIGFyZSBvdXRwdXQgZmlyc3QgdG8gbWF0Y2ggY29tbW9uIGNvbnZlbnRpb25cbiAgICAgIC8vIFRoZSBkaWZmaW5nIGFsZ29yaXRobSBpcyB0aWVkIHRvIGFkZCB0aGVuIHJlbW92ZSBvdXRwdXQgYW5kIHRoaXMgaXMgdGhlIHNpbXBsZXN0XG4gICAgICAvLyByb3V0ZSB0byBnZXQgdGhlIGRlc2lyZWQgb3V0cHV0IHdpdGggbWluaW1hbCBvdmVyaGVhZC5cbiAgICAgIGlmIChjb21wb25lbnRQb3MgJiYgY29tcG9uZW50c1tjb21wb25lbnRQb3MgLSAxXS5hZGRlZCkge1xuICAgICAgICBsZXQgdG1wID0gY29tcG9uZW50c1tjb21wb25lbnRQb3MgLSAxXTtcbiAgICAgICAgY29tcG9uZW50c1tjb21wb25lbnRQb3MgLSAxXSA9IGNvbXBvbmVudHNbY29tcG9uZW50UG9zXTtcbiAgICAgICAgY29tcG9uZW50c1tjb21wb25lbnRQb3NdID0gdG1wO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIC8vIFNwZWNpYWwgY2FzZSBoYW5kbGUgZm9yIHdoZW4gb25lIHRlcm1pbmFsIGlzIGlnbm9yZWQgKGkuZS4gd2hpdGVzcGFjZSkuXG4gIC8vIEZvciB0aGlzIGNhc2Ugd2UgbWVyZ2UgdGhlIHRlcm1pbmFsIGludG8gdGhlIHByaW9yIHN0cmluZyBhbmQgZHJvcCB0aGUgY2hhbmdlLlxuICAvLyBUaGlzIGlzIG9ubHkgYXZhaWxhYmxlIGZvciBzdHJpbmcgbW9kZS5cbiAgbGV0IGxhc3RDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGxhc3RDb21wb25lbnQudmFsdWUgPT09ICdzdHJpbmcnXG4gICAgICAmJiAobGFzdENvbXBvbmVudC5hZGRlZCB8fCBsYXN0Q29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgbGFzdENvbXBvbmVudC52YWx1ZSkpIHtcbiAgICBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDJdLnZhbHVlICs9IGxhc3RDb21wb25lbnQudmFsdWU7XG4gICAgY29tcG9uZW50cy5wb3AoKTtcbiAgfVxuXG4gIHJldHVybiBjb21wb25lbnRzO1xufVxuXG5mdW5jdGlvbiBjbG9uZVBhdGgocGF0aCkge1xuICByZXR1cm4geyBuZXdQb3M6IHBhdGgubmV3UG9zLCBjb21wb25lbnRzOiBwYXRoLmNvbXBvbmVudHMuc2xpY2UoMCkgfTtcbn1cbiJdfQ==
|
| 5611 |
-
|
| 5612 |
-
|
| 5613 |
-
/***/ }),
|
| 5614 |
-
|
| 5615 |
-
/***/ 292:
|
| 5616 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5617 |
-
|
| 5618 |
-
"use strict";
|
| 5619 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 5620 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 5621 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 5622 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 5623 |
-
|
| 5624 |
-
|
| 5625 |
-
/**
|
| 5626 |
-
* WordPress dependencies
|
| 5627 |
-
*/
|
| 5628 |
-
|
| 5629 |
-
const grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 5630 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 5631 |
-
viewBox: "0 0 24 24"
|
| 5632 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 5633 |
-
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",
|
| 5634 |
-
fillRule: "evenodd",
|
| 5635 |
-
clipRule: "evenodd"
|
| 5636 |
-
}));
|
| 5637 |
-
/* harmony default export */ __webpack_exports__["a"] = (grid);
|
| 5638 |
-
//# sourceMappingURL=grid.js.map
|
| 5639 |
-
|
| 5640 |
-
/***/ }),
|
| 5641 |
-
|
| 5642 |
-
/***/ 293:
|
| 5643 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5644 |
-
|
| 5645 |
-
"use strict";
|
| 5646 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 5647 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 5648 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 5649 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 5650 |
-
|
| 5651 |
-
|
| 5652 |
-
/**
|
| 5653 |
-
* WordPress dependencies
|
| 5654 |
-
*/
|
| 5655 |
-
|
| 5656 |
-
const media = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 5657 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 5658 |
-
viewBox: "0 0 24 24"
|
| 5659 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 5660 |
-
d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z"
|
| 5661 |
-
}));
|
| 5662 |
-
/* harmony default export */ __webpack_exports__["a"] = (media);
|
| 5663 |
-
//# sourceMappingURL=media.js.map
|
| 5664 |
-
|
| 5665 |
-
/***/ }),
|
| 5666 |
-
|
| 5667 |
-
/***/ 294:
|
| 5668 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5669 |
-
|
| 5670 |
-
"use strict";
|
| 5671 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 5672 |
-
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 5673 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 5674 |
-
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 5675 |
-
|
| 5676 |
-
|
| 5677 |
-
/**
|
| 5678 |
-
* WordPress dependencies
|
| 5679 |
-
*/
|
| 5680 |
-
|
| 5681 |
-
const arrowLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 5682 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 5683 |
-
viewBox: "0 0 24 24"
|
| 5684 |
-
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 5685 |
-
d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
|
| 5686 |
-
}));
|
| 5687 |
-
/* harmony default export */ __webpack_exports__["a"] = (arrowLeft);
|
| 5688 |
-
//# sourceMappingURL=arrow-left.js.map
|
| 5689 |
-
|
| 5690 |
-
/***/ }),
|
| 5691 |
-
|
| 5692 |
-
/***/ 3:
|
| 5693 |
-
/***/ (function(module, exports) {
|
| 5694 |
-
|
| 5695 |
-
(function() { module.exports = window["wp"]["components"]; }());
|
| 5696 |
-
|
| 5697 |
-
/***/ }),
|
| 5698 |
-
|
| 5699 |
-
/***/ 30:
|
| 5700 |
-
/***/ (function(module, exports) {
|
| 5701 |
-
|
| 5702 |
-
(function() { module.exports = window["wp"]["a11y"]; }());
|
| 5703 |
-
|
| 5704 |
-
/***/ }),
|
| 5705 |
-
|
| 5706 |
-
/***/ 32:
|
| 5707 |
-
/***/ (function(module, exports) {
|
| 5708 |
-
|
| 5709 |
-
(function() { module.exports = window["wp"]["blob"]; }());
|
| 5710 |
-
|
| 5711 |
-
/***/ }),
|
| 5712 |
-
|
| 5713 |
-
/***/ 35:
|
| 5714 |
-
/***/ (function(module, exports, __webpack_require__) {
|
| 5715 |
-
|
| 5716 |
-
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2
|
| 5717 |
-
// https://github.com/bgrins/TinyColor
|
| 5718 |
-
// Brian Grinstead, MIT License
|
| 5719 |
-
|
| 5720 |
-
(function(Math) {
|
| 5721 |
-
|
| 5722 |
-
var trimLeft = /^\s+/,
|
| 5723 |
-
trimRight = /\s+$/,
|
| 5724 |
-
tinyCounter = 0,
|
| 5725 |
-
mathRound = Math.round,
|
| 5726 |
-
mathMin = Math.min,
|
| 5727 |
-
mathMax = Math.max,
|
| 5728 |
-
mathRandom = Math.random;
|
| 5729 |
-
|
| 5730 |
-
function tinycolor (color, opts) {
|
| 5731 |
-
|
| 5732 |
-
color = (color) ? color : '';
|
| 5733 |
-
opts = opts || { };
|
| 5734 |
-
|
| 5735 |
-
// If input is already a tinycolor, return itself
|
| 5736 |
-
if (color instanceof tinycolor) {
|
| 5737 |
-
return color;
|
| 5738 |
-
}
|
| 5739 |
-
// If we are called as a function, call using new instead
|
| 5740 |
-
if (!(this instanceof tinycolor)) {
|
| 5741 |
-
return new tinycolor(color, opts);
|
| 5742 |
-
}
|
| 5743 |
-
|
| 5744 |
-
var rgb = inputToRGB(color);
|
| 5745 |
-
this._originalInput = color,
|
| 5746 |
-
this._r = rgb.r,
|
| 5747 |
-
this._g = rgb.g,
|
| 5748 |
-
this._b = rgb.b,
|
| 5749 |
-
this._a = rgb.a,
|
| 5750 |
-
this._roundA = mathRound(100*this._a) / 100,
|
| 5751 |
-
this._format = opts.format || rgb.format;
|
| 5752 |
-
this._gradientType = opts.gradientType;
|
| 5753 |
-
|
| 5754 |
-
// Don't let the range of [0,255] come back in [0,1].
|
| 5755 |
-
// Potentially lose a little bit of precision here, but will fix issues where
|
| 5756 |
-
// .5 gets interpreted as half of the total, instead of half of 1
|
| 5757 |
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
| 5758 |
-
if (this._r < 1) { this._r = mathRound(this._r); }
|
| 5759 |
-
if (this._g < 1) { this._g = mathRound(this._g); }
|
| 5760 |
-
if (this._b < 1) { this._b = mathRound(this._b); }
|
| 5761 |
-
|
| 5762 |
-
this._ok = rgb.ok;
|
| 5763 |
-
this._tc_id = tinyCounter++;
|
| 5764 |
-
}
|
| 5765 |
-
|
| 5766 |
-
tinycolor.prototype = {
|
| 5767 |
-
isDark: function() {
|
| 5768 |
-
return this.getBrightness() < 128;
|
| 5769 |
-
},
|
| 5770 |
-
isLight: function() {
|
| 5771 |
-
return !this.isDark();
|
| 5772 |
-
},
|
| 5773 |
-
isValid: function() {
|
| 5774 |
-
return this._ok;
|
| 5775 |
-
},
|
| 5776 |
-
getOriginalInput: function() {
|
| 5777 |
-
return this._originalInput;
|
| 5778 |
-
},
|
| 5779 |
-
getFormat: function() {
|
| 5780 |
-
return this._format;
|
| 5781 |
-
},
|
| 5782 |
-
getAlpha: function() {
|
| 5783 |
-
return this._a;
|
| 5784 |
-
},
|
| 5785 |
-
getBrightness: function() {
|
| 5786 |
-
//http://www.w3.org/TR/AERT#color-contrast
|
| 5787 |
-
var rgb = this.toRgb();
|
| 5788 |
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
| 5789 |
-
},
|
| 5790 |
-
getLuminance: function() {
|
| 5791 |
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
| 5792 |
-
var rgb = this.toRgb();
|
| 5793 |
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
| 5794 |
-
RsRGB = rgb.r/255;
|
| 5795 |
-
GsRGB = rgb.g/255;
|
| 5796 |
-
BsRGB = rgb.b/255;
|
| 5797 |
|
| 5798 |
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
| 5799 |
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
|
@@ -6910,359 +6892,114 @@ else {}
|
|
| 6910 |
|
| 6911 |
|
| 6912 |
/***/ }),
|
| 6913 |
-
|
| 6914 |
-
|
| 6915 |
-
|
| 6916 |
-
|
| 6917 |
-
|
| 6918 |
-
|
| 6919 |
-
|
| 6920 |
-
|
| 6921 |
-
|
| 6922 |
/***/ (function(module, exports) {
|
| 6923 |
|
| 6924 |
-
(function() { module.exports = window["wp"]["
|
| 6925 |
|
| 6926 |
/***/ }),
|
| 6927 |
-
|
| 6928 |
-
/***/ 402:
|
| 6929 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 6930 |
|
| 6931 |
"use strict";
|
| 6932 |
-
|
| 6933 |
-
__webpack_require__
|
| 6934 |
-
|
| 6935 |
-
|
| 6936 |
-
|
| 6937 |
-
|
| 6938 |
-
|
| 6939 |
-
|
| 6940 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseCustomSides", function() { return /* reexport */ useCustomSides; });
|
| 6941 |
-
__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; });
|
| 6942 |
-
__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; });
|
| 6943 |
-
__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; });
|
| 6944 |
-
__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; });
|
| 6945 |
-
__webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; });
|
| 6946 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGetGradientClass", function() { return /* reexport */ __experimentalGetGradientClass; });
|
| 6947 |
-
__webpack_require__.d(__webpack_exports__, "getGradientValueBySlug", function() { return /* reexport */ getGradientValueBySlug; });
|
| 6948 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGetGradientObjectByGradientValue", function() { return /* reexport */ __experimentalGetGradientObjectByGradientValue; });
|
| 6949 |
-
__webpack_require__.d(__webpack_exports__, "getGradientSlugByValue", function() { return /* reexport */ getGradientSlugByValue; });
|
| 6950 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseGradient", function() { return /* reexport */ __experimentalUseGradient; });
|
| 6951 |
-
__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; });
|
| 6952 |
-
__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; });
|
| 6953 |
-
__webpack_require__.d(__webpack_exports__, "getFontSizeObjectByValue", function() { return /* reexport */ getFontSizeObjectByValue; });
|
| 6954 |
-
__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ font_size_picker; });
|
| 6955 |
-
__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ with_font_sizes; });
|
| 6956 |
-
__webpack_require__.d(__webpack_exports__, "AlignmentControl", function() { return /* reexport */ AlignmentControl; });
|
| 6957 |
-
__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; });
|
| 6958 |
-
__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ autocomplete; });
|
| 6959 |
-
__webpack_require__.d(__webpack_exports__, "BlockAlignmentControl", function() { return /* reexport */ BlockAlignmentControl; });
|
| 6960 |
-
__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; });
|
| 6961 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockFullHeightAligmentControl", function() { return /* reexport */ block_full_height_alignment_control; });
|
| 6962 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockAlignmentMatrixControl", function() { return /* reexport */ block_alignment_matrix_control; });
|
| 6963 |
-
__webpack_require__.d(__webpack_exports__, "BlockBreadcrumb", function() { return /* reexport */ block_breadcrumb; });
|
| 6964 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockContentOverlay", function() { return /* reexport */ BlockContentOverlay; });
|
| 6965 |
-
__webpack_require__.d(__webpack_exports__, "BlockContextProvider", function() { return /* reexport */ BlockContextProvider; });
|
| 6966 |
-
__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ block_controls; });
|
| 6967 |
-
__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; });
|
| 6968 |
-
__webpack_require__.d(__webpack_exports__, "BlockColorsStyleSelector", function() { return /* reexport */ color_style_selector; });
|
| 6969 |
-
__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ block_edit_BlockEdit; });
|
| 6970 |
-
__webpack_require__.d(__webpack_exports__, "useBlockEditContext", function() { return /* reexport */ useBlockEditContext; });
|
| 6971 |
-
__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; });
|
| 6972 |
-
__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ dropdown; });
|
| 6973 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationBlockFill", function() { return /* reexport */ BlockNavigationBlockFill; });
|
| 6974 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationEditor", function() { return /* reexport */ BlockNavigationEditor; });
|
| 6975 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationTree", function() { return /* reexport */ BlockNavigationTree; });
|
| 6976 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationPicker", function() { return /* reexport */ block_variation_picker; });
|
| 6977 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockPatternSetup", function() { return /* reexport */ block_pattern_setup; });
|
| 6978 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationTransforms", function() { return /* reexport */ block_variation_transforms; });
|
| 6979 |
-
__webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentToolbar", function() { return /* reexport */ BlockVerticalAlignmentToolbar; });
|
| 6980 |
-
__webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentControl", function() { return /* reexport */ BlockVerticalAlignmentControl; });
|
| 6981 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalBorderStyleControl", function() { return /* reexport */ BorderStyleControl; });
|
| 6982 |
-
__webpack_require__.d(__webpack_exports__, "ButtonBlockerAppender", function() { return /* reexport */ ButtonBlockerAppender; });
|
| 6983 |
-
__webpack_require__.d(__webpack_exports__, "ButtonBlockAppender", function() { return /* reexport */ button_block_appender; });
|
| 6984 |
-
__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ color_palette; });
|
| 6985 |
-
__webpack_require__.d(__webpack_exports__, "ColorPaletteControl", function() { return /* reexport */ ColorPaletteControl; });
|
| 6986 |
-
__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ contrast_checker; });
|
| 6987 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalDuotoneControl", function() { return /* reexport */ duotone_control; });
|
| 6988 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGradientPicker", function() { return /* reexport */ gradient_picker; });
|
| 6989 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerControl", function() { return /* reexport */ GradientPickerControl; });
|
| 6990 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerPanel", function() { return /* reexport */ GradientPanel; });
|
| 6991 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalFontAppearanceControl", function() { return /* reexport */ FontAppearanceControl; });
|
| 6992 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalFontFamilyControl", function() { return /* reexport */ FontFamilyControl; });
|
| 6993 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLetterSpacingControl", function() { return /* reexport */ LetterSpacingControl; });
|
| 6994 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalColorGradientControl", function() { return /* reexport */ control; });
|
| 6995 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalPanelColorGradientSettings", function() { return /* reexport */ panel_color_gradient_settings; });
|
| 6996 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalImageSizeControl", function() { return /* reexport */ ImageSizeControl; });
|
| 6997 |
-
__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ inner_blocks; });
|
| 6998 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseInnerBlocksProps", function() { return /* reexport */ useInnerBlocksProps; });
|
| 6999 |
-
__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ inspector_advanced_controls; });
|
| 7000 |
-
__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ inspector_controls; });
|
| 7001 |
-
__webpack_require__.d(__webpack_exports__, "JustifyToolbar", function() { return /* reexport */ JustifyToolbar; });
|
| 7002 |
-
__webpack_require__.d(__webpack_exports__, "JustifyContentControl", function() { return /* reexport */ JustifyContentControl; });
|
| 7003 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLinkControl", function() { return /* reexport */ link_control; });
|
| 7004 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchInput", function() { return /* reexport */ search_input; });
|
| 7005 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchResults", function() { return /* reexport */ LinkControlSearchResults; });
|
| 7006 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchItem", function() { return /* reexport */ search_item; });
|
| 7007 |
-
__webpack_require__.d(__webpack_exports__, "LineHeightControl", function() { return /* reexport */ LineHeightControl; });
|
| 7008 |
-
__webpack_require__.d(__webpack_exports__, "MediaReplaceFlow", function() { return /* reexport */ media_replace_flow; });
|
| 7009 |
-
__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ media_placeholder; });
|
| 7010 |
-
__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ media_upload; });
|
| 7011 |
-
__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ check; });
|
| 7012 |
-
__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ panel_color_settings; });
|
| 7013 |
-
__webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ plain_text; });
|
| 7014 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalResponsiveBlockControl", function() { return /* reexport */ responsive_block_control; });
|
| 7015 |
-
__webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ rich_text; });
|
| 7016 |
-
__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; });
|
| 7017 |
-
__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; });
|
| 7018 |
-
__webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ input_event_unstableRichTextInputEvent; });
|
| 7019 |
-
__webpack_require__.d(__webpack_exports__, "ToolSelector", function() { return /* reexport */ tool_selector; });
|
| 7020 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUnitControl", function() { return /* reexport */ UnitControl; });
|
| 7021 |
-
__webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ url_input; });
|
| 7022 |
-
__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ url_input_button; });
|
| 7023 |
-
__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ url_popover; });
|
| 7024 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalImageURLInputUI", function() { return /* reexport */ ImageURLInputUI; });
|
| 7025 |
-
__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ with_color_context; });
|
| 7026 |
-
__webpack_require__.d(__webpack_exports__, "__unstableBlockSettingsMenuFirstItem", function() { return /* reexport */ block_settings_menu_first_item; });
|
| 7027 |
-
__webpack_require__.d(__webpack_exports__, "__unstableInserterMenuExtension", function() { return /* reexport */ inserter_menu_extension; });
|
| 7028 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalPreviewOptions", function() { return /* reexport */ PreviewOptions; });
|
| 7029 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseResizeCanvas", function() { return /* reexport */ useResizeCanvas; });
|
| 7030 |
-
__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ block_inspector; });
|
| 7031 |
-
__webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; });
|
| 7032 |
-
__webpack_require__.d(__webpack_exports__, "useBlockProps", function() { return /* reexport */ useBlockProps; });
|
| 7033 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLayoutStyle", function() { return /* reexport */ LayoutStyle; });
|
| 7034 |
-
__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ block_mover; });
|
| 7035 |
-
__webpack_require__.d(__webpack_exports__, "BlockPreview", function() { return /* reexport */ block_preview; });
|
| 7036 |
-
__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; });
|
| 7037 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseBlockSelectionClearer", function() { return /* reexport */ useBlockSelectionClearer; });
|
| 7038 |
-
__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ block_settings_menu; });
|
| 7039 |
-
__webpack_require__.d(__webpack_exports__, "BlockSettingsMenuControls", function() { return /* reexport */ block_settings_menu_controls; });
|
| 7040 |
-
__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; });
|
| 7041 |
-
__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; });
|
| 7042 |
-
__webpack_require__.d(__webpack_exports__, "BlockTools", function() { return /* reexport */ BlockTools; });
|
| 7043 |
-
__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ copy_handler; });
|
| 7044 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseClipboardHandler", function() { return /* reexport */ useClipboardHandler; });
|
| 7045 |
-
__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ default_block_appender; });
|
| 7046 |
-
__webpack_require__.d(__webpack_exports__, "__unstableEditorStyles", function() { return /* reexport */ EditorStyles; });
|
| 7047 |
-
__webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ inserter; });
|
| 7048 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalLibrary", function() { return /* reexport */ library; });
|
| 7049 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalSearchForm", function() { return /* reexport */ search_form; });
|
| 7050 |
-
__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ keyboard_shortcuts; });
|
| 7051 |
-
__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; });
|
| 7052 |
-
__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ navigable_toolbar; });
|
| 7053 |
-
__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ observe_typing; });
|
| 7054 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseTypingObserver", function() { return /* reexport */ useTypingObserver; });
|
| 7055 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseMouseMoveTypingReset", function() { return /* reexport */ useMouseMoveTypingReset; });
|
| 7056 |
-
__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; });
|
| 7057 |
-
__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ skip_to_selected_block; });
|
| 7058 |
-
__webpack_require__.d(__webpack_exports__, "Typewriter", function() { return /* reexport */ typewriter; });
|
| 7059 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseTypewriter", function() { return /* reexport */ useTypewriter; });
|
| 7060 |
-
__webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ warning; });
|
| 7061 |
-
__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; });
|
| 7062 |
-
__webpack_require__.d(__webpack_exports__, "__unstableUseCanvasClickRedirect", function() { return /* reexport */ useCanvasClickRedirect; });
|
| 7063 |
-
__webpack_require__.d(__webpack_exports__, "useBlockDisplayInformation", function() { return /* reexport */ useBlockDisplayInformation; });
|
| 7064 |
-
__webpack_require__.d(__webpack_exports__, "__unstableIframe", function() { return /* reexport */ iframe; });
|
| 7065 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseNoRecursiveRenders", function() { return /* reexport */ useNoRecursiveRenders; });
|
| 7066 |
-
__webpack_require__.d(__webpack_exports__, "BlockEditorProvider", function() { return /* reexport */ provider; });
|
| 7067 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalUseSimulatedMediaQuery", function() { return /* reexport */ useSimulatedMediaQuery; });
|
| 7068 |
-
__webpack_require__.d(__webpack_exports__, "useSetting", function() { return /* reexport */ useSetting; });
|
| 7069 |
-
__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ transform_styles; });
|
| 7070 |
-
__webpack_require__.d(__webpack_exports__, "validateThemeColors", function() { return /* reexport */ validateThemeColors; });
|
| 7071 |
-
__webpack_require__.d(__webpack_exports__, "validateThemeGradients", function() { return /* reexport */ validateThemeGradients; });
|
| 7072 |
-
__webpack_require__.d(__webpack_exports__, "__experimentalGetMatchingVariation", function() { return /* reexport */ __experimentalGetMatchingVariation; });
|
| 7073 |
-
__webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; });
|
| 7074 |
-
__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
|
| 7075 |
-
__webpack_require__.d(__webpack_exports__, "SETTINGS_DEFAULTS", function() { return /* reexport */ SETTINGS_DEFAULTS; });
|
| 7076 |
|
| 7077 |
-
// NAMESPACE OBJECT: ./packages/block-editor/build-module/store/selectors.js
|
| 7078 |
-
var selectors_namespaceObject = {};
|
| 7079 |
-
__webpack_require__.r(selectors_namespaceObject);
|
| 7080 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; });
|
| 7081 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return selectors_isBlockValid; });
|
| 7082 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return selectors_getBlockAttributes; });
|
| 7083 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; });
|
| 7084 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return selectors_unstableGetBlockWithoutInnerBlocks; });
|
| 7085 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; });
|
| 7086 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithBlockTree", function() { return __unstableGetBlockWithBlockTree; });
|
| 7087 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockTree", function() { return __unstableGetBlockTree; });
|
| 7088 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdWithClientIdsTree", function() { return selectors_unstableGetClientIdWithClientIdsTree; });
|
| 7089 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdsTree", function() { return selectors_unstableGetClientIdsTree; });
|
| 7090 |
-
__webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return selectors_getClientIdsOfDescendants; });
|
| 7091 |
-
__webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; });
|
| 7092 |
-
__webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; });
|
| 7093 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return selectors_getBlocksByClientId; });
|
| 7094 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return selectors_getBlockCount; });
|
| 7095 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectionStart", function() { return selectors_getSelectionStart; });
|
| 7096 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectionEnd", function() { return selectors_getSelectionEnd; });
|
| 7097 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return selectors_getBlockSelectionStart; });
|
| 7098 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return selectors_getBlockSelectionEnd; });
|
| 7099 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return selectors_getSelectedBlockCount; });
|
| 7100 |
-
__webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return selectors_hasSelectedBlock; });
|
| 7101 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; });
|
| 7102 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return selectors_getSelectedBlock; });
|
| 7103 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return selectors_getBlockRootClientId; });
|
| 7104 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockParents", function() { return selectors_getBlockParents; });
|
| 7105 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockParentsByBlockName", function() { return getBlockParentsByBlockName; });
|
| 7106 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return selectors_getBlockHierarchyRootClientId; });
|
| 7107 |
-
__webpack_require__.d(selectors_namespaceObject, "getLowestCommonAncestorWithSelectedBlock", function() { return getLowestCommonAncestorWithSelectedBlock; });
|
| 7108 |
-
__webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; });
|
| 7109 |
-
__webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return selectors_getPreviousBlockClientId; });
|
| 7110 |
-
__webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return selectors_getNextBlockClientId; });
|
| 7111 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return selectors_getSelectedBlocksInitialCaretPosition; });
|
| 7112 |
-
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientIds", function() { return selectors_getSelectedBlockClientIds; });
|
| 7113 |
-
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return selectors_getMultiSelectedBlockClientIds; });
|
| 7114 |
-
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return selectors_getMultiSelectedBlocks; });
|
| 7115 |
-
__webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return selectors_getFirstMultiSelectedBlockClientId; });
|
| 7116 |
-
__webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return selectors_getLastMultiSelectedBlockClientId; });
|
| 7117 |
-
__webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return selectors_isFirstMultiSelectedBlock; });
|
| 7118 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return selectors_isBlockMultiSelected; });
|
| 7119 |
-
__webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return selectors_isAncestorMultiSelected; });
|
| 7120 |
-
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return selectors_getMultiSelectedBlocksStartClientId; });
|
| 7121 |
-
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return selectors_getMultiSelectedBlocksEndClientId; });
|
| 7122 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return selectors_getBlockOrder; });
|
| 7123 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return selectors_getBlockIndex; });
|
| 7124 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return selectors_isBlockSelected; });
|
| 7125 |
-
__webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return selectors_hasSelectedInnerBlock; });
|
| 7126 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; });
|
| 7127 |
-
__webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return selectors_hasMultiSelection; });
|
| 7128 |
-
__webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return selectors_isMultiSelecting; });
|
| 7129 |
-
__webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return selectors_isSelectionEnabled; });
|
| 7130 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return selectors_getBlockMode; });
|
| 7131 |
-
__webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; });
|
| 7132 |
-
__webpack_require__.d(selectors_namespaceObject, "isDraggingBlocks", function() { return selectors_isDraggingBlocks; });
|
| 7133 |
-
__webpack_require__.d(selectors_namespaceObject, "getDraggedBlockClientIds", function() { return selectors_getDraggedBlockClientIds; });
|
| 7134 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockBeingDragged", function() { return selectors_isBlockBeingDragged; });
|
| 7135 |
-
__webpack_require__.d(selectors_namespaceObject, "isAncestorBeingDragged", function() { return selectors_isAncestorBeingDragged; });
|
| 7136 |
-
__webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; });
|
| 7137 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return selectors_getBlockInsertionPoint; });
|
| 7138 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return selectors_isBlockInsertionPointVisible; });
|
| 7139 |
-
__webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return selectors_isValidTemplate; });
|
| 7140 |
-
__webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; });
|
| 7141 |
-
__webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return selectors_getTemplateLock; });
|
| 7142 |
-
__webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; });
|
| 7143 |
-
__webpack_require__.d(selectors_namespaceObject, "canInsertBlocks", function() { return selectors_canInsertBlocks; });
|
| 7144 |
-
__webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; });
|
| 7145 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockTransformItems", function() { return selectors_getBlockTransformItems; });
|
| 7146 |
-
__webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return selectors_hasInserterItems; });
|
| 7147 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedBlocks", function() { return selectors_experimentalGetAllowedBlocks; });
|
| 7148 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedPattern", function() { return __experimentalGetParsedPattern; });
|
| 7149 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedPatterns", function() { return selectors_experimentalGetAllowedPatterns; });
|
| 7150 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternsByBlockTypes", function() { return selectors_experimentalGetPatternsByBlockTypes; });
|
| 7151 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternTransformItems", function() { return selectors_experimentalGetPatternTransformItems; });
|
| 7152 |
-
__webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return selectors_getBlockListSettings; });
|
| 7153 |
-
__webpack_require__.d(selectors_namespaceObject, "getSettings", function() { return selectors_getSettings; });
|
| 7154 |
-
__webpack_require__.d(selectors_namespaceObject, "isLastBlockChangePersistent", function() { return selectors_isLastBlockChangePersistent; });
|
| 7155 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetBlockListSettingsForBlocks", function() { return selectors_experimentalGetBlockListSettingsForBlocks; });
|
| 7156 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedReusableBlock", function() { return __experimentalGetParsedReusableBlock; });
|
| 7157 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlockTitle", function() { return selectors_experimentalGetReusableBlockTitle; });
|
| 7158 |
-
__webpack_require__.d(selectors_namespaceObject, "__unstableIsLastBlockChangeIgnored", function() { return selectors_unstableIsLastBlockChangeIgnored; });
|
| 7159 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetLastBlockAttributeChanges", function() { return __experimentalGetLastBlockAttributeChanges; });
|
| 7160 |
-
__webpack_require__.d(selectors_namespaceObject, "isNavigationMode", function() { return selectors_isNavigationMode; });
|
| 7161 |
-
__webpack_require__.d(selectors_namespaceObject, "hasBlockMovingClientId", function() { return selectors_hasBlockMovingClientId; });
|
| 7162 |
-
__webpack_require__.d(selectors_namespaceObject, "didAutomaticChange", function() { return selectors_didAutomaticChange; });
|
| 7163 |
-
__webpack_require__.d(selectors_namespaceObject, "isBlockHighlighted", function() { return selectors_isBlockHighlighted; });
|
| 7164 |
-
__webpack_require__.d(selectors_namespaceObject, "areInnerBlocksControlled", function() { return areInnerBlocksControlled; });
|
| 7165 |
-
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetActiveBlockIdByBlockNames", function() { return __experimentalGetActiveBlockIdByBlockNames; });
|
| 7166 |
-
__webpack_require__.d(selectors_namespaceObject, "wasBlockJustInserted", function() { return wasBlockJustInserted; });
|
| 7167 |
|
| 7168 |
-
|
| 7169 |
-
|
| 7170 |
-
|
| 7171 |
-
__webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return actions_resetBlocks; });
|
| 7172 |
-
__webpack_require__.d(actions_namespaceObject, "validateBlocksToTemplate", function() { return validateBlocksToTemplate; });
|
| 7173 |
-
__webpack_require__.d(actions_namespaceObject, "resetSelection", function() { return actions_resetSelection; });
|
| 7174 |
-
__webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; });
|
| 7175 |
-
__webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return actions_updateBlockAttributes; });
|
| 7176 |
-
__webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return actions_updateBlock; });
|
| 7177 |
-
__webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; });
|
| 7178 |
-
__webpack_require__.d(actions_namespaceObject, "selectPreviousBlock", function() { return selectPreviousBlock; });
|
| 7179 |
-
__webpack_require__.d(actions_namespaceObject, "selectNextBlock", function() { return selectNextBlock; });
|
| 7180 |
-
__webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return actions_startMultiSelect; });
|
| 7181 |
-
__webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return actions_stopMultiSelect; });
|
| 7182 |
-
__webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return actions_multiSelect; });
|
| 7183 |
-
__webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; });
|
| 7184 |
-
__webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return actions_toggleSelection; });
|
| 7185 |
-
__webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; });
|
| 7186 |
-
__webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return actions_replaceBlock; });
|
| 7187 |
-
__webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return actions_moveBlocksDown; });
|
| 7188 |
-
__webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return actions_moveBlocksUp; });
|
| 7189 |
-
__webpack_require__.d(actions_namespaceObject, "moveBlocksToPosition", function() { return actions_moveBlocksToPosition; });
|
| 7190 |
-
__webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return actions_moveBlockToPosition; });
|
| 7191 |
-
__webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return actions_insertBlock; });
|
| 7192 |
-
__webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; });
|
| 7193 |
-
__webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return actions_showInsertionPoint; });
|
| 7194 |
-
__webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return actions_hideInsertionPoint; });
|
| 7195 |
-
__webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return setTemplateValidity; });
|
| 7196 |
-
__webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return synchronizeTemplate; });
|
| 7197 |
-
__webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return actions_mergeBlocks; });
|
| 7198 |
-
__webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return actions_removeBlocks; });
|
| 7199 |
-
__webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return actions_removeBlock; });
|
| 7200 |
-
__webpack_require__.d(actions_namespaceObject, "replaceInnerBlocks", function() { return actions_replaceInnerBlocks; });
|
| 7201 |
-
__webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; });
|
| 7202 |
-
__webpack_require__.d(actions_namespaceObject, "startTyping", function() { return actions_startTyping; });
|
| 7203 |
-
__webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return actions_stopTyping; });
|
| 7204 |
-
__webpack_require__.d(actions_namespaceObject, "startDraggingBlocks", function() { return actions_startDraggingBlocks; });
|
| 7205 |
-
__webpack_require__.d(actions_namespaceObject, "stopDraggingBlocks", function() { return actions_stopDraggingBlocks; });
|
| 7206 |
-
__webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return actions_enterFormattedText; });
|
| 7207 |
-
__webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return actions_exitFormattedText; });
|
| 7208 |
-
__webpack_require__.d(actions_namespaceObject, "selectionChange", function() { return actions_selectionChange; });
|
| 7209 |
-
__webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; });
|
| 7210 |
-
__webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return actions_updateBlockListSettings; });
|
| 7211 |
-
__webpack_require__.d(actions_namespaceObject, "updateSettings", function() { return actions_updateSettings; });
|
| 7212 |
-
__webpack_require__.d(actions_namespaceObject, "__unstableSaveReusableBlock", function() { return __unstableSaveReusableBlock; });
|
| 7213 |
-
__webpack_require__.d(actions_namespaceObject, "__unstableMarkLastChangeAsPersistent", function() { return actions_unstableMarkLastChangeAsPersistent; });
|
| 7214 |
-
__webpack_require__.d(actions_namespaceObject, "__unstableMarkNextChangeAsNotPersistent", function() { return actions_unstableMarkNextChangeAsNotPersistent; });
|
| 7215 |
-
__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChange", function() { return actions_unstableMarkAutomaticChange; });
|
| 7216 |
-
__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChangeFinal", function() { return __unstableMarkAutomaticChangeFinal; });
|
| 7217 |
-
__webpack_require__.d(actions_namespaceObject, "setNavigationMode", function() { return actions_setNavigationMode; });
|
| 7218 |
-
__webpack_require__.d(actions_namespaceObject, "setBlockMovingClientId", function() { return actions_setBlockMovingClientId; });
|
| 7219 |
-
__webpack_require__.d(actions_namespaceObject, "duplicateBlocks", function() { return actions_duplicateBlocks; });
|
| 7220 |
-
__webpack_require__.d(actions_namespaceObject, "insertBeforeBlock", function() { return actions_insertBeforeBlock; });
|
| 7221 |
-
__webpack_require__.d(actions_namespaceObject, "insertAfterBlock", function() { return actions_insertAfterBlock; });
|
| 7222 |
-
__webpack_require__.d(actions_namespaceObject, "toggleBlockHighlight", function() { return actions_toggleBlockHighlight; });
|
| 7223 |
-
__webpack_require__.d(actions_namespaceObject, "flashBlock", function() { return actions_flashBlock; });
|
| 7224 |
-
__webpack_require__.d(actions_namespaceObject, "setHasControlledInnerBlocks", function() { return actions_setHasControlledInnerBlocks; });
|
| 7225 |
|
| 7226 |
-
|
| 7227 |
-
|
|
|
|
| 7228 |
|
| 7229 |
-
// EXTERNAL MODULE: external ["wp","element"]
|
| 7230 |
-
var external_wp_element_ = __webpack_require__(0);
|
| 7231 |
|
| 7232 |
-
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 7233 |
-
var classnames = __webpack_require__(10);
|
| 7234 |
-
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
| 7235 |
|
| 7236 |
-
|
| 7237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7238 |
|
| 7239 |
-
|
| 7240 |
-
|
|
|
|
|
|
|
|
|
|
| 7241 |
|
| 7242 |
-
|
| 7243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7244 |
|
| 7245 |
-
|
| 7246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7247 |
|
| 7248 |
-
|
| 7249 |
-
var external_wp_components_ = __webpack_require__(3);
|
| 7250 |
|
| 7251 |
-
|
| 7252 |
-
|
|
|
|
|
|
|
|
|
|
| 7253 |
|
| 7254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7255 |
/**
|
| 7256 |
* WordPress dependencies
|
| 7257 |
*/
|
| 7258 |
|
| 7259 |
-
const Context = Object(
|
| 7260 |
name: '',
|
| 7261 |
isSelected: false,
|
| 7262 |
clientId: null
|
| 7263 |
});
|
| 7264 |
const {
|
| 7265 |
-
Provider
|
| 7266 |
} = Context;
|
| 7267 |
|
| 7268 |
/**
|
|
@@ -7272,1857 +7009,1560 @@ const {
|
|
| 7272 |
*/
|
| 7273 |
|
| 7274 |
function useBlockEditContext() {
|
| 7275 |
-
return Object(
|
| 7276 |
}
|
| 7277 |
//# sourceMappingURL=context.js.map
|
| 7278 |
-
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 7279 |
-
var external_wp_i18n_ = __webpack_require__(1);
|
| 7280 |
|
| 7281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7282 |
/**
|
| 7283 |
* WordPress dependencies
|
| 7284 |
*/
|
| 7285 |
|
| 7286 |
-
|
| 7287 |
-
insertUsage: {}
|
| 7288 |
-
};
|
| 7289 |
/**
|
| 7290 |
-
*
|
| 7291 |
-
*
|
| 7292 |
-
* @typedef {Object} SETTINGS_DEFAULT
|
| 7293 |
-
* @property {boolean} alignWide Enable/Disable Wide/Full Alignments
|
| 7294 |
-
* @property {boolean} supportsLayout Enable/disable layouts support in container blocks.
|
| 7295 |
-
* @property {boolean} imageEditing Image Editing settings set to false to disable.
|
| 7296 |
-
* @property {Array} imageSizes Available image sizes
|
| 7297 |
-
* @property {number} maxWidth Max width to constraint resizing
|
| 7298 |
-
* @property {boolean|Array} allowedBlockTypes Allowed block types
|
| 7299 |
-
* @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed
|
| 7300 |
-
* @property {boolean} focusMode Whether the focus mode is enabled or not
|
| 7301 |
-
* @property {Array} styles Editor Styles
|
| 7302 |
-
* @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode
|
| 7303 |
-
* @property {string} bodyPlaceholder Empty post placeholder
|
| 7304 |
-
* @property {string} titlePlaceholder Empty title placeholder
|
| 7305 |
-
* @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
|
| 7306 |
-
* @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
|
| 7307 |
-
* @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
|
| 7308 |
-
* @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
|
| 7309 |
-
* @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
|
| 7310 |
*/
|
| 7311 |
|
| 7312 |
-
|
| 7313 |
-
|
| 7314 |
-
|
| 7315 |
-
|
| 7316 |
-
|
| 7317 |
-
colors: [{
|
| 7318 |
-
name: Object(external_wp_i18n_["__"])('Black'),
|
| 7319 |
-
slug: 'black',
|
| 7320 |
-
color: '#000000'
|
| 7321 |
-
}, {
|
| 7322 |
-
name: Object(external_wp_i18n_["__"])('Cyan bluish gray'),
|
| 7323 |
-
slug: 'cyan-bluish-gray',
|
| 7324 |
-
color: '#abb8c3'
|
| 7325 |
-
}, {
|
| 7326 |
-
name: Object(external_wp_i18n_["__"])('White'),
|
| 7327 |
-
slug: 'white',
|
| 7328 |
-
color: '#ffffff'
|
| 7329 |
-
}, {
|
| 7330 |
-
name: Object(external_wp_i18n_["__"])('Pale pink'),
|
| 7331 |
-
slug: 'pale-pink',
|
| 7332 |
-
color: '#f78da7'
|
| 7333 |
-
}, {
|
| 7334 |
-
name: Object(external_wp_i18n_["__"])('Vivid red'),
|
| 7335 |
-
slug: 'vivid-red',
|
| 7336 |
-
color: '#cf2e2e'
|
| 7337 |
-
}, {
|
| 7338 |
-
name: Object(external_wp_i18n_["__"])('Luminous vivid orange'),
|
| 7339 |
-
slug: 'luminous-vivid-orange',
|
| 7340 |
-
color: '#ff6900'
|
| 7341 |
-
}, {
|
| 7342 |
-
name: Object(external_wp_i18n_["__"])('Luminous vivid amber'),
|
| 7343 |
-
slug: 'luminous-vivid-amber',
|
| 7344 |
-
color: '#fcb900'
|
| 7345 |
-
}, {
|
| 7346 |
-
name: Object(external_wp_i18n_["__"])('Light green cyan'),
|
| 7347 |
-
slug: 'light-green-cyan',
|
| 7348 |
-
color: '#7bdcb5'
|
| 7349 |
-
}, {
|
| 7350 |
-
name: Object(external_wp_i18n_["__"])('Vivid green cyan'),
|
| 7351 |
-
slug: 'vivid-green-cyan',
|
| 7352 |
-
color: '#00d084'
|
| 7353 |
-
}, {
|
| 7354 |
-
name: Object(external_wp_i18n_["__"])('Pale cyan blue'),
|
| 7355 |
-
slug: 'pale-cyan-blue',
|
| 7356 |
-
color: '#8ed1fc'
|
| 7357 |
-
}, {
|
| 7358 |
-
name: Object(external_wp_i18n_["__"])('Vivid cyan blue'),
|
| 7359 |
-
slug: 'vivid-cyan-blue',
|
| 7360 |
-
color: '#0693e3'
|
| 7361 |
-
}, {
|
| 7362 |
-
name: Object(external_wp_i18n_["__"])('Vivid purple'),
|
| 7363 |
-
slug: 'vivid-purple',
|
| 7364 |
-
color: '#9b51e0'
|
| 7365 |
-
}],
|
| 7366 |
-
// fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
| 7367 |
-
// The setting is only kept for backward compatibility purposes.
|
| 7368 |
-
fontSizes: [{
|
| 7369 |
-
name: Object(external_wp_i18n_["_x"])('Small', 'font size name'),
|
| 7370 |
-
size: 13,
|
| 7371 |
-
slug: 'small'
|
| 7372 |
-
}, {
|
| 7373 |
-
name: Object(external_wp_i18n_["_x"])('Normal', 'font size name'),
|
| 7374 |
-
size: 16,
|
| 7375 |
-
slug: 'normal'
|
| 7376 |
-
}, {
|
| 7377 |
-
name: Object(external_wp_i18n_["_x"])('Medium', 'font size name'),
|
| 7378 |
-
size: 20,
|
| 7379 |
-
slug: 'medium'
|
| 7380 |
-
}, {
|
| 7381 |
-
name: Object(external_wp_i18n_["_x"])('Large', 'font size name'),
|
| 7382 |
-
size: 36,
|
| 7383 |
-
slug: 'large'
|
| 7384 |
-
}, {
|
| 7385 |
-
name: Object(external_wp_i18n_["_x"])('Huge', 'font size name'),
|
| 7386 |
-
size: 42,
|
| 7387 |
-
slug: 'huge'
|
| 7388 |
-
}],
|
| 7389 |
-
// Image default size slug.
|
| 7390 |
-
imageDefaultSize: 'large',
|
| 7391 |
-
imageSizes: [{
|
| 7392 |
-
slug: 'thumbnail',
|
| 7393 |
-
name: Object(external_wp_i18n_["__"])('Thumbnail')
|
| 7394 |
-
}, {
|
| 7395 |
-
slug: 'medium',
|
| 7396 |
-
name: Object(external_wp_i18n_["__"])('Medium')
|
| 7397 |
-
}, {
|
| 7398 |
-
slug: 'large',
|
| 7399 |
-
name: Object(external_wp_i18n_["__"])('Large')
|
| 7400 |
-
}, {
|
| 7401 |
-
slug: 'full',
|
| 7402 |
-
name: Object(external_wp_i18n_["__"])('Full Size')
|
| 7403 |
-
}],
|
| 7404 |
-
// Allow plugin to disable Image Editor if need be
|
| 7405 |
-
imageEditing: true,
|
| 7406 |
-
// This is current max width of the block inner area
|
| 7407 |
-
// It's used to constraint image resizing and this value could be overridden later by themes
|
| 7408 |
-
maxWidth: 580,
|
| 7409 |
-
// Allowed block types for the editor, defaulting to true (all supported).
|
| 7410 |
-
allowedBlockTypes: true,
|
| 7411 |
-
// Maximum upload size in bytes allowed for the site.
|
| 7412 |
-
maxUploadFileSize: 0,
|
| 7413 |
-
// List of allowed mime types and file extensions.
|
| 7414 |
-
allowedMimeTypes: null,
|
| 7415 |
-
__experimentalCanUserUseUnfilteredHTML: false,
|
| 7416 |
-
__experimentalBlockDirectory: false,
|
| 7417 |
-
__mobileEnablePageTemplates: false,
|
| 7418 |
-
__experimentalBlockPatterns: [],
|
| 7419 |
-
__experimentalBlockPatternCategories: [],
|
| 7420 |
-
__experimentalSpotlightEntityBlocks: [],
|
| 7421 |
-
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
| 7422 |
-
// The setting is only kept for backward compatibility purposes.
|
| 7423 |
-
gradients: [{
|
| 7424 |
-
name: Object(external_wp_i18n_["__"])('Vivid cyan blue to vivid purple'),
|
| 7425 |
-
gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
|
| 7426 |
-
slug: 'vivid-cyan-blue-to-vivid-purple'
|
| 7427 |
-
}, {
|
| 7428 |
-
name: Object(external_wp_i18n_["__"])('Light green cyan to vivid green cyan'),
|
| 7429 |
-
gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',
|
| 7430 |
-
slug: 'light-green-cyan-to-vivid-green-cyan'
|
| 7431 |
-
}, {
|
| 7432 |
-
name: Object(external_wp_i18n_["__"])('Luminous vivid amber to luminous vivid orange'),
|
| 7433 |
-
gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',
|
| 7434 |
-
slug: 'luminous-vivid-amber-to-luminous-vivid-orange'
|
| 7435 |
-
}, {
|
| 7436 |
-
name: Object(external_wp_i18n_["__"])('Luminous vivid orange to vivid red'),
|
| 7437 |
-
gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',
|
| 7438 |
-
slug: 'luminous-vivid-orange-to-vivid-red'
|
| 7439 |
-
}, {
|
| 7440 |
-
name: Object(external_wp_i18n_["__"])('Very light gray to cyan bluish gray'),
|
| 7441 |
-
gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',
|
| 7442 |
-
slug: 'very-light-gray-to-cyan-bluish-gray'
|
| 7443 |
-
}, {
|
| 7444 |
-
name: Object(external_wp_i18n_["__"])('Cool to warm spectrum'),
|
| 7445 |
-
gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',
|
| 7446 |
-
slug: 'cool-to-warm-spectrum'
|
| 7447 |
-
}, {
|
| 7448 |
-
name: Object(external_wp_i18n_["__"])('Blush light purple'),
|
| 7449 |
-
gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',
|
| 7450 |
-
slug: 'blush-light-purple'
|
| 7451 |
-
}, {
|
| 7452 |
-
name: Object(external_wp_i18n_["__"])('Blush bordeaux'),
|
| 7453 |
-
gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',
|
| 7454 |
-
slug: 'blush-bordeaux'
|
| 7455 |
-
}, {
|
| 7456 |
-
name: Object(external_wp_i18n_["__"])('Luminous dusk'),
|
| 7457 |
-
gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',
|
| 7458 |
-
slug: 'luminous-dusk'
|
| 7459 |
-
}, {
|
| 7460 |
-
name: Object(external_wp_i18n_["__"])('Pale ocean'),
|
| 7461 |
-
gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',
|
| 7462 |
-
slug: 'pale-ocean'
|
| 7463 |
-
}, {
|
| 7464 |
-
name: Object(external_wp_i18n_["__"])('Electric grass'),
|
| 7465 |
-
gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',
|
| 7466 |
-
slug: 'electric-grass'
|
| 7467 |
-
}, {
|
| 7468 |
-
name: Object(external_wp_i18n_["__"])('Midnight'),
|
| 7469 |
-
gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',
|
| 7470 |
-
slug: 'midnight'
|
| 7471 |
-
}]
|
| 7472 |
-
};
|
| 7473 |
-
//# sourceMappingURL=defaults.js.map
|
| 7474 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/array.js
|
| 7475 |
/**
|
| 7476 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7477 |
*/
|
| 7478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7479 |
/**
|
| 7480 |
-
*
|
|
|
|
| 7481 |
*
|
| 7482 |
-
* @param {
|
| 7483 |
-
* @param {*} elements Elements to insert.
|
| 7484 |
-
* @param {number} index Insert Position.
|
| 7485 |
*
|
| 7486 |
-
* @return {
|
| 7487 |
*/
|
| 7488 |
|
| 7489 |
-
function
|
| 7490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7491 |
}
|
| 7492 |
/**
|
| 7493 |
-
*
|
|
|
|
| 7494 |
*
|
| 7495 |
-
* @param {
|
| 7496 |
-
* @param {number} from Source index.
|
| 7497 |
-
* @param {number} to Destination index.
|
| 7498 |
-
* @param {number} count Number of elements to move.
|
| 7499 |
*
|
| 7500 |
-
* @return {
|
| 7501 |
*/
|
| 7502 |
|
| 7503 |
-
|
| 7504 |
-
|
| 7505 |
-
|
| 7506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7507 |
}
|
| 7508 |
-
|
| 7509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7510 |
/**
|
| 7511 |
-
*
|
| 7512 |
*/
|
| 7513 |
|
| 7514 |
/**
|
| 7515 |
-
*
|
| 7516 |
*/
|
| 7517 |
|
| 7518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7519 |
|
| 7520 |
/**
|
| 7521 |
-
*
|
| 7522 |
*/
|
| 7523 |
|
| 7524 |
|
| 7525 |
-
|
| 7526 |
/**
|
| 7527 |
-
*
|
| 7528 |
-
* context, the value of which is an array of block client IDs existing within
|
| 7529 |
-
* that nesting context.
|
| 7530 |
-
*
|
| 7531 |
-
* @param {Array} blocks Blocks to map.
|
| 7532 |
-
* @param {?string} rootClientId Assumed root client ID.
|
| 7533 |
-
*
|
| 7534 |
-
* @return {Object} Block order map object.
|
| 7535 |
*/
|
| 7536 |
|
| 7537 |
-
|
| 7538 |
-
const result = {
|
| 7539 |
-
[rootClientId]: []
|
| 7540 |
-
};
|
| 7541 |
-
blocks.forEach(block => {
|
| 7542 |
-
const {
|
| 7543 |
-
clientId,
|
| 7544 |
-
innerBlocks
|
| 7545 |
-
} = block;
|
| 7546 |
-
result[rootClientId].push(clientId);
|
| 7547 |
-
Object.assign(result, mapBlockOrder(innerBlocks, clientId));
|
| 7548 |
-
});
|
| 7549 |
-
return result;
|
| 7550 |
-
}
|
| 7551 |
-
/**
|
| 7552 |
-
* Given an array of blocks, returns an object where each key contains
|
| 7553 |
-
* the clientId of the block and the value is the parent of the block.
|
| 7554 |
-
*
|
| 7555 |
-
* @param {Array} blocks Blocks to map.
|
| 7556 |
-
* @param {?string} rootClientId Assumed root client ID.
|
| 7557 |
-
*
|
| 7558 |
-
* @return {Object} Block order map object.
|
| 7559 |
-
*/
|
| 7560 |
|
|
|
|
| 7561 |
|
| 7562 |
-
function
|
| 7563 |
-
|
| 7564 |
-
|
| 7565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7566 |
}
|
| 7567 |
-
/**
|
| 7568 |
-
* Helper method to iterate through all blocks, recursing into inner blocks,
|
| 7569 |
-
* applying a transformation function to each one.
|
| 7570 |
-
* Returns a flattened object with the transformed blocks.
|
| 7571 |
-
*
|
| 7572 |
-
* @param {Array} blocks Blocks to flatten.
|
| 7573 |
-
* @param {Function} transform Transforming function to be applied to each block.
|
| 7574 |
-
*
|
| 7575 |
-
* @return {Object} Flattened object.
|
| 7576 |
-
*/
|
| 7577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7578 |
|
| 7579 |
-
|
| 7580 |
-
const result = {};
|
| 7581 |
-
const stack = [...blocks];
|
| 7582 |
|
| 7583 |
-
while (stack.length) {
|
| 7584 |
-
const {
|
| 7585 |
-
innerBlocks,
|
| 7586 |
-
...block
|
| 7587 |
-
} = stack.shift();
|
| 7588 |
-
stack.push(...innerBlocks);
|
| 7589 |
-
result[block.clientId] = transform(block);
|
| 7590 |
-
}
|
| 7591 |
|
| 7592 |
-
return result;
|
| 7593 |
-
}
|
| 7594 |
/**
|
| 7595 |
-
*
|
| 7596 |
-
* attributes, recursing into inner blocks. Keys correspond to the block client
|
| 7597 |
-
* ID, the value of which is the attributes object.
|
| 7598 |
-
*
|
| 7599 |
-
* @param {Array} blocks Blocks to flatten.
|
| 7600 |
-
*
|
| 7601 |
-
* @return {Object} Flattened block attributes object.
|
| 7602 |
*/
|
| 7603 |
|
| 7604 |
-
|
| 7605 |
-
function getFlattenedBlocksWithoutAttributes(blocks) {
|
| 7606 |
-
return flattenBlocks(blocks, block => Object(external_lodash_["omit"])(block, 'attributes'));
|
| 7607 |
-
}
|
| 7608 |
/**
|
| 7609 |
-
*
|
| 7610 |
-
* recursing into inner blocks. Keys correspond to the block client ID, the
|
| 7611 |
-
* value of which is the attributes object.
|
| 7612 |
-
*
|
| 7613 |
-
* @param {Array} blocks Blocks to flatten.
|
| 7614 |
-
*
|
| 7615 |
-
* @return {Object} Flattened block attributes object.
|
| 7616 |
*/
|
| 7617 |
|
| 7618 |
|
| 7619 |
-
|
| 7620 |
-
return flattenBlocks(blocks, block => block.attributes);
|
| 7621 |
-
}
|
| 7622 |
/**
|
| 7623 |
-
*
|
| 7624 |
-
* a descendant of the given root client ID.
|
| 7625 |
-
*
|
| 7626 |
-
* Calling this with `rootClientId` set to `''` results in a list of client IDs
|
| 7627 |
-
* that are in the post. That is, it excludes blocks like fetched reusable
|
| 7628 |
-
* blocks which are stored into state but not visible. It also excludes
|
| 7629 |
-
* InnerBlocks controllers, like template parts.
|
| 7630 |
-
*
|
| 7631 |
-
* It is important to exclude the full inner block controller and not just the
|
| 7632 |
-
* inner blocks because in many cases, we need to persist the previous value of
|
| 7633 |
-
* an inner block controller. To do so, it must be excluded from the list of
|
| 7634 |
-
* client IDs which are considered to be part of the top-level entity.
|
| 7635 |
-
*
|
| 7636 |
-
* @param {Object} blocksOrder Object that maps block client IDs to a list of
|
| 7637 |
-
* nested block client IDs.
|
| 7638 |
-
* @param {?string} rootClientId The root client ID to search. Defaults to ''.
|
| 7639 |
-
* @param {?Object} controlledInnerBlocks The InnerBlocks controller state.
|
| 7640 |
-
*
|
| 7641 |
-
* @return {Array} List of descendant client IDs.
|
| 7642 |
*/
|
| 7643 |
|
| 7644 |
|
| 7645 |
-
function getNestedBlockClientIds(blocksOrder, rootClientId = '', controlledInnerBlocks = {}) {
|
| 7646 |
-
return Object(external_lodash_["reduce"])(blocksOrder[rootClientId], (result, clientId) => {
|
| 7647 |
-
if (!!controlledInnerBlocks[clientId]) {
|
| 7648 |
-
return result;
|
| 7649 |
-
}
|
| 7650 |
|
| 7651 |
-
return [...result, clientId, ...getNestedBlockClientIds(blocksOrder, clientId)];
|
| 7652 |
-
}, []);
|
| 7653 |
-
}
|
| 7654 |
-
/**
|
| 7655 |
-
* Returns an object against which it is safe to perform mutating operations,
|
| 7656 |
-
* given the original object and its current working copy.
|
| 7657 |
-
*
|
| 7658 |
-
* @param {Object} original Original object.
|
| 7659 |
-
* @param {Object} working Working object.
|
| 7660 |
-
*
|
| 7661 |
-
* @return {Object} Mutation-safe object.
|
| 7662 |
-
*/
|
| 7663 |
|
| 7664 |
|
| 7665 |
-
function
|
| 7666 |
-
|
| 7667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7668 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7669 |
}
|
| 7670 |
|
| 7671 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7672 |
}
|
| 7673 |
/**
|
| 7674 |
-
*
|
| 7675 |
-
* otherwise.
|
| 7676 |
*
|
| 7677 |
-
* @
|
| 7678 |
-
* @param {Object} b Second object.
|
| 7679 |
*
|
| 7680 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7681 |
*/
|
| 7682 |
|
|
|
|
|
|
|
| 7683 |
|
| 7684 |
-
|
| 7685 |
-
|
| 7686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7687 |
/**
|
| 7688 |
-
*
|
| 7689 |
-
* dispatched action, the two actions are updating the same block attribute, or
|
| 7690 |
-
* false otherwise.
|
| 7691 |
-
*
|
| 7692 |
-
* @param {Object} action Currently dispatching action.
|
| 7693 |
-
* @param {Object} lastAction Previously dispatched action.
|
| 7694 |
-
*
|
| 7695 |
-
* @return {boolean} Whether actions are updating the same block attribute.
|
| 7696 |
*/
|
| 7697 |
|
| 7698 |
-
|
| 7699 |
-
return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && Object(external_lodash_["isEqual"])(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
|
| 7700 |
-
}
|
| 7701 |
/**
|
| 7702 |
-
*
|
| 7703 |
-
*
|
| 7704 |
-
* @param {Array} objectKeys Keys to fill.
|
| 7705 |
-
* @return {Object} Object filled with empty object as values for each clientId.
|
| 7706 |
*/
|
| 7707 |
|
| 7708 |
-
|
| 7709 |
-
|
| 7710 |
-
|
| 7711 |
-
return result;
|
| 7712 |
-
}, {});
|
| 7713 |
-
};
|
| 7714 |
/**
|
| 7715 |
-
*
|
| 7716 |
-
* A new instance of the cache key (empty object) is created each time the block object
|
| 7717 |
-
* needs to be refreshed (for any change in the block or its children).
|
| 7718 |
*
|
| 7719 |
-
* @
|
| 7720 |
*
|
| 7721 |
-
* @
|
|
|
|
|
|
|
| 7722 |
*/
|
| 7723 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7724 |
|
| 7725 |
-
|
| 7726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7727 |
|
| 7728 |
-
|
| 7729 |
-
|
| 7730 |
-
|
|
|
|
|
|
|
|
|
|
| 7731 |
|
| 7732 |
-
|
| 7733 |
-
/**
|
| 7734 |
-
* For each clientId provided, traverses up parents, adding the provided clientIds
|
| 7735 |
-
* and each parent's clientId to the returned array.
|
| 7736 |
-
*
|
| 7737 |
-
* When calling this function consider that it uses the old state, so any state
|
| 7738 |
-
* modifications made by the `reducer` will not be present.
|
| 7739 |
-
*
|
| 7740 |
-
* @param {Array} clientIds an Array of block clientIds.
|
| 7741 |
-
*
|
| 7742 |
-
* @return {Array} The provided clientIds and all of their parent clientIds.
|
| 7743 |
-
*/
|
| 7744 |
|
| 7745 |
-
|
| 7746 |
-
|
| 7747 |
-
let current = clientId;
|
| 7748 |
|
| 7749 |
-
|
| 7750 |
-
|
| 7751 |
-
current = state.parents[current];
|
| 7752 |
-
} while (current && !state.controlledInnerBlocks[current]);
|
| 7753 |
|
| 7754 |
-
|
| 7755 |
-
|
| 7756 |
-
};
|
| 7757 |
|
| 7758 |
-
|
| 7759 |
-
|
| 7760 |
-
|
| 7761 |
-
break;
|
| 7762 |
|
| 7763 |
-
|
| 7764 |
-
|
| 7765 |
-
{
|
| 7766 |
-
const updatedBlockUids = Object(external_lodash_["keys"])(flattenBlocks(action.blocks));
|
| 7767 |
|
| 7768 |
-
|
| 7769 |
-
|
| 7770 |
-
}
|
| 7771 |
|
| 7772 |
-
|
| 7773 |
-
|
| 7774 |
-
};
|
| 7775 |
-
break;
|
| 7776 |
-
}
|
| 7777 |
|
| 7778 |
-
|
| 7779 |
-
|
| 7780 |
-
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds([action.clientId]))
|
| 7781 |
-
};
|
| 7782 |
-
break;
|
| 7783 |
|
| 7784 |
-
|
| 7785 |
-
|
| 7786 |
-
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.clientIds))
|
| 7787 |
-
};
|
| 7788 |
-
break;
|
| 7789 |
|
| 7790 |
-
|
| 7791 |
-
|
| 7792 |
-
newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.replacedClientIds),
|
| 7793 |
-
...Object(external_lodash_["omit"])(parentClientIds, action.replacedClientIds),
|
| 7794 |
-
...fillKeysWithEmptyObject(Object(external_lodash_["keys"])(flattenBlocks(action.blocks)))
|
| 7795 |
-
};
|
| 7796 |
-
break;
|
| 7797 |
|
| 7798 |
-
|
| 7799 |
-
|
| 7800 |
-
...fillKeysWithEmptyObject(Object(external_lodash_["difference"])(getBlocksWithParentsClientIds(action.clientIds), action.clientIds))
|
| 7801 |
-
};
|
| 7802 |
-
break;
|
| 7803 |
|
| 7804 |
-
|
| 7805 |
-
|
| 7806 |
-
const updatedBlockUids = [...action.clientIds];
|
| 7807 |
|
| 7808 |
-
|
| 7809 |
-
|
| 7810 |
-
}
|
| 7811 |
|
| 7812 |
-
|
| 7813 |
-
|
| 7814 |
-
}
|
| 7815 |
|
| 7816 |
-
|
| 7817 |
-
|
| 7818 |
-
};
|
| 7819 |
-
break;
|
| 7820 |
-
}
|
| 7821 |
|
| 7822 |
-
|
| 7823 |
-
|
| 7824 |
-
{
|
| 7825 |
-
const updatedBlockUids = [];
|
| 7826 |
|
| 7827 |
-
|
| 7828 |
-
|
| 7829 |
-
}
|
| 7830 |
|
| 7831 |
-
|
| 7832 |
-
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 7833 |
-
};
|
| 7834 |
-
break;
|
| 7835 |
-
}
|
| 7836 |
|
| 7837 |
-
case 'SAVE_REUSABLE_BLOCK_SUCCESS':
|
| 7838 |
-
{
|
| 7839 |
-
const updatedBlockUids = Object(external_lodash_["keys"])(Object(external_lodash_["omitBy"])(newState.attributes, (attributes, clientId) => {
|
| 7840 |
-
return newState.byClientId[clientId].name !== 'core/block' || attributes.ref !== action.updatedId;
|
| 7841 |
-
}));
|
| 7842 |
-
newState.cache = { ...newState.cache,
|
| 7843 |
-
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 7844 |
-
};
|
| 7845 |
-
}
|
| 7846 |
-
}
|
| 7847 |
|
| 7848 |
-
return newState;
|
| 7849 |
-
};
|
| 7850 |
/**
|
| 7851 |
-
*
|
| 7852 |
-
* `isPersistentChange` property value corresponding to whether a change in
|
| 7853 |
-
* state can be considered as persistent. All changes are considered persistent
|
| 7854 |
-
* except when updating the same block attribute as in the previous action.
|
| 7855 |
-
*
|
| 7856 |
-
* @param {Function} reducer Original reducer function.
|
| 7857 |
-
*
|
| 7858 |
-
* @return {Function} Enhanced reducer function.
|
| 7859 |
*/
|
| 7860 |
|
| 7861 |
-
|
| 7862 |
-
function withPersistentBlockChange(reducer) {
|
| 7863 |
-
let lastAction;
|
| 7864 |
-
let markNextChangeAsNotPersistent = false;
|
| 7865 |
-
return (state, action) => {
|
| 7866 |
-
let nextState = reducer(state, action);
|
| 7867 |
-
const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent; // Defer to previous state value (or default) unless changing or
|
| 7868 |
-
// explicitly marking as persistent.
|
| 7869 |
-
|
| 7870 |
-
if (state === nextState && !isExplicitPersistentChange) {
|
| 7871 |
-
var _state$isPersistentCh;
|
| 7872 |
-
|
| 7873 |
-
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
|
| 7874 |
-
const nextIsPersistentChange = (_state$isPersistentCh = state === null || state === void 0 ? void 0 : state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true;
|
| 7875 |
-
|
| 7876 |
-
if (state.isPersistentChange === nextIsPersistentChange) {
|
| 7877 |
-
return state;
|
| 7878 |
-
}
|
| 7879 |
-
|
| 7880 |
-
return { ...nextState,
|
| 7881 |
-
isPersistentChange: nextIsPersistentChange
|
| 7882 |
-
};
|
| 7883 |
-
}
|
| 7884 |
-
|
| 7885 |
-
nextState = { ...nextState,
|
| 7886 |
-
isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
|
| 7887 |
-
}; // In comparing against the previous action, consider only those which
|
| 7888 |
-
// would have qualified as one which would have been ignored or not
|
| 7889 |
-
// have resulted in a changed state.
|
| 7890 |
-
|
| 7891 |
-
lastAction = action;
|
| 7892 |
-
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
|
| 7893 |
-
return nextState;
|
| 7894 |
-
};
|
| 7895 |
-
}
|
| 7896 |
/**
|
| 7897 |
-
*
|
| 7898 |
-
* `isIgnoredChange` property value corresponding to whether a change in state
|
| 7899 |
-
* can be considered as ignored. A change is considered ignored when the result
|
| 7900 |
-
* of an action not incurred by direct user interaction.
|
| 7901 |
-
*
|
| 7902 |
-
* @param {Function} reducer Original reducer function.
|
| 7903 |
-
*
|
| 7904 |
-
* @return {Function} Enhanced reducer function.
|
| 7905 |
*/
|
| 7906 |
|
| 7907 |
|
| 7908 |
-
function withIgnoredBlockChange(reducer) {
|
| 7909 |
-
/**
|
| 7910 |
-
* Set of action types for which a blocks state change should be ignored.
|
| 7911 |
-
*
|
| 7912 |
-
* @type {Set}
|
| 7913 |
-
*/
|
| 7914 |
-
const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']);
|
| 7915 |
-
return (state, action) => {
|
| 7916 |
-
const nextState = reducer(state, action);
|
| 7917 |
|
| 7918 |
-
if (nextState !== state) {
|
| 7919 |
-
nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
|
| 7920 |
-
}
|
| 7921 |
|
| 7922 |
-
|
| 7923 |
-
};
|
| 7924 |
-
}
|
| 7925 |
/**
|
| 7926 |
-
*
|
| 7927 |
-
* block client IDs in remove action to include cascade of inner blocks.
|
| 7928 |
-
*
|
| 7929 |
-
* @param {Function} reducer Original reducer function.
|
| 7930 |
-
*
|
| 7931 |
-
* @return {Function} Enhanced reducer function.
|
| 7932 |
*/
|
| 7933 |
|
| 7934 |
|
| 7935 |
-
const withInnerBlocksRemoveCascade = reducer => (state, action) => {
|
| 7936 |
-
// Gets all children which need to be removed.
|
| 7937 |
-
const getAllChildren = clientIds => {
|
| 7938 |
-
let result = clientIds;
|
| 7939 |
-
|
| 7940 |
-
for (let i = 0; i < result.length; i++) {
|
| 7941 |
-
if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
|
| 7942 |
-
continue;
|
| 7943 |
-
}
|
| 7944 |
-
|
| 7945 |
-
if (result === clientIds) {
|
| 7946 |
-
result = [...result];
|
| 7947 |
-
}
|
| 7948 |
|
| 7949 |
-
result.push(...state.order[result[i]]);
|
| 7950 |
-
}
|
| 7951 |
|
| 7952 |
-
return result;
|
| 7953 |
-
};
|
| 7954 |
|
| 7955 |
-
if (state) {
|
| 7956 |
-
switch (action.type) {
|
| 7957 |
-
case 'REMOVE_BLOCKS':
|
| 7958 |
-
action = { ...action,
|
| 7959 |
-
type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN',
|
| 7960 |
-
removedClientIds: getAllChildren(action.clientIds)
|
| 7961 |
-
};
|
| 7962 |
-
break;
|
| 7963 |
|
| 7964 |
-
|
| 7965 |
-
|
| 7966 |
-
|
| 7967 |
-
|
| 7968 |
-
|
| 7969 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7970 |
}
|
| 7971 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7972 |
|
| 7973 |
-
return reducer(state, action);
|
| 7974 |
-
};
|
| 7975 |
/**
|
| 7976 |
-
*
|
| 7977 |
-
* the `RESET_BLOCKS` action. When dispatched, this action will replace all
|
| 7978 |
-
* blocks that exist in the post, leaving blocks that exist only in state (e.g.
|
| 7979 |
-
* reusable blocks and blocks controlled by inner blocks controllers) alone.
|
| 7980 |
-
*
|
| 7981 |
-
* @param {Function} reducer Original reducer function.
|
| 7982 |
-
*
|
| 7983 |
-
* @return {Function} Enhanced reducer function.
|
| 7984 |
*/
|
| 7985 |
|
| 7986 |
|
| 7987 |
-
|
| 7988 |
-
|
| 7989 |
-
|
| 7990 |
-
|
| 7991 |
-
|
| 7992 |
-
|
| 7993 |
-
|
| 7994 |
-
|
|
|
|
| 7995 |
|
| 7996 |
-
const controlledInnerBlocks = Object.keys(Object(external_lodash_["pickBy"])(state.controlledInnerBlocks));
|
| 7997 |
-
/**
|
| 7998 |
-
* Each update operation consists of a few parts:
|
| 7999 |
-
* 1. First, the client IDs associated with the top level entity are
|
| 8000 |
-
* removed from the existing state key, leaving in place controlled
|
| 8001 |
-
* blocks (like reusable blocks and inner block controllers).
|
| 8002 |
-
* 2. Second, the blocks from the reset action are used to calculate the
|
| 8003 |
-
* individual state keys. This will re-populate the clientIDs which
|
| 8004 |
-
* were removed in step 1.
|
| 8005 |
-
* 3. In some cases, we remove the recalculated inner block controllers,
|
| 8006 |
-
* letting their old values persist. We need to do this because the
|
| 8007 |
-
* reset block action from a top-level entity is not aware of any
|
| 8008 |
-
* inner blocks inside InnerBlock controllers. So if the new values
|
| 8009 |
-
* were used, it would not take into account the existing InnerBlocks
|
| 8010 |
-
* which already exist in the state for inner block controllers. For
|
| 8011 |
-
* example, `attributes` uses the newly computed value for controllers
|
| 8012 |
-
* since attributes are stored in the top-level entity. But `order`
|
| 8013 |
-
* uses the previous value for the controllers since the new value
|
| 8014 |
-
* does not include the order of controlled inner blocks. So if the
|
| 8015 |
-
* new value was used, template parts would disappear from the editor
|
| 8016 |
-
* whenever you try to undo a change in the top level entity.
|
| 8017 |
-
*/
|
| 8018 |
|
| 8019 |
-
return { ...state,
|
| 8020 |
-
byClientId: { ...Object(external_lodash_["omit"])(state.byClientId, visibleClientIds),
|
| 8021 |
-
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 8022 |
-
},
|
| 8023 |
-
attributes: { ...Object(external_lodash_["omit"])(state.attributes, visibleClientIds),
|
| 8024 |
-
...getFlattenedBlockAttributes(action.blocks)
|
| 8025 |
-
},
|
| 8026 |
-
order: { ...Object(external_lodash_["omit"])(state.order, visibleClientIds),
|
| 8027 |
-
...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), controlledInnerBlocks)
|
| 8028 |
-
},
|
| 8029 |
-
parents: { ...Object(external_lodash_["omit"])(state.parents, visibleClientIds),
|
| 8030 |
-
...mapBlockParents(action.blocks)
|
| 8031 |
-
},
|
| 8032 |
-
cache: { ...Object(external_lodash_["omit"])(state.cache, visibleClientIds),
|
| 8033 |
-
...Object(external_lodash_["omit"])(Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})), controlledInnerBlocks)
|
| 8034 |
-
}
|
| 8035 |
-
};
|
| 8036 |
-
}
|
| 8037 |
|
| 8038 |
-
return reducer(state, action);
|
| 8039 |
-
};
|
| 8040 |
/**
|
| 8041 |
-
*
|
| 8042 |
-
* the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state
|
| 8043 |
-
* should become equivalent to the execution of a `REMOVE_BLOCKS` action
|
| 8044 |
-
* containing all the child's of the root block followed by the execution of
|
| 8045 |
-
* `INSERT_BLOCKS` with the new blocks.
|
| 8046 |
-
*
|
| 8047 |
-
* @param {Function} reducer Original reducer function.
|
| 8048 |
-
*
|
| 8049 |
-
* @return {Function} Enhanced reducer function.
|
| 8050 |
*/
|
| 8051 |
|
| 8052 |
|
| 8053 |
-
const withReplaceInnerBlocks = reducer => (state, action) => {
|
| 8054 |
-
if (action.type !== 'REPLACE_INNER_BLOCKS') {
|
| 8055 |
-
return reducer(state, action);
|
| 8056 |
-
} // Finds every nested inner block controller. We must check the action blocks
|
| 8057 |
-
// and not just the block parent state because some inner block controllers
|
| 8058 |
-
// should be deleted if specified, whereas others should not be deleted. If
|
| 8059 |
-
// a controlled should not be deleted, then we need to avoid deleting its
|
| 8060 |
-
// inner blocks from the block state because its inner blocks will not be
|
| 8061 |
-
// attached to the block in the action.
|
| 8062 |
|
| 8063 |
|
| 8064 |
-
const nestedControllers = {};
|
| 8065 |
|
| 8066 |
-
|
| 8067 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8068 |
|
| 8069 |
-
|
| 8070 |
-
|
| 8071 |
-
|
| 8072 |
-
|
| 8073 |
-
|
| 8074 |
-
|
| 8075 |
|
| 8076 |
-
|
| 8077 |
-
|
| 8078 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8079 |
}
|
| 8080 |
-
} // The `keepControlledInnerBlocks` prop will keep the inner blocks of the
|
| 8081 |
-
// marked block in the block state so that they can be reattached to the
|
| 8082 |
-
// marked block when we re-insert everything a few lines below.
|
| 8083 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8084 |
|
| 8085 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8086 |
|
| 8087 |
-
|
| 8088 |
-
|
| 8089 |
-
|
| 8090 |
-
|
| 8091 |
-
|
| 8092 |
-
|
| 8093 |
}
|
| 8094 |
|
| 8095 |
-
|
|
|
|
|
|
|
|
|
|
| 8096 |
|
| 8097 |
-
|
| 8098 |
-
|
| 8099 |
-
|
| 8100 |
-
|
| 8101 |
-
|
| 8102 |
-
|
| 8103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8104 |
|
| 8105 |
-
stateAfterInsert.order = { ...stateAfterInsert.order,
|
| 8106 |
-
...Object(external_lodash_["reduce"])(nestedControllers, (result, value, key) => {
|
| 8107 |
-
if (state.order[key]) {
|
| 8108 |
-
result[key] = state.order[key];
|
| 8109 |
-
}
|
| 8110 |
|
| 8111 |
-
|
| 8112 |
-
|
| 8113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8114 |
}
|
| 8115 |
-
|
| 8116 |
-
|
| 8117 |
-
|
| 8118 |
-
|
| 8119 |
-
|
| 8120 |
-
|
| 8121 |
-
|
| 8122 |
-
|
| 8123 |
-
|
| 8124 |
-
* @param {Function} reducer Original reducer function.
|
| 8125 |
-
*
|
| 8126 |
-
* @return {Function} Enhanced reducer function.
|
| 8127 |
-
*/
|
| 8128 |
|
| 8129 |
|
| 8130 |
-
|
| 8131 |
-
|
|
|
|
| 8132 |
const {
|
| 8133 |
-
|
| 8134 |
-
|
| 8135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8136 |
|
| 8137 |
-
if (
|
| 8138 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8139 |
}
|
| 8140 |
|
| 8141 |
-
|
| 8142 |
-
|
| 8143 |
-
|
| 8144 |
-
|
| 8145 |
-
|
| 8146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8147 |
|
| 8148 |
-
|
| 8149 |
-
|
| 8150 |
-
|
| 8151 |
-
|
| 8152 |
-
|
|
|
|
|
|
|
|
|
|
| 8153 |
|
| 8154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8155 |
});
|
| 8156 |
}
|
| 8157 |
|
| 8158 |
-
|
| 8159 |
-
};
|
| 8160 |
-
/**
|
| 8161 |
-
* Reducer returning the blocks state.
|
| 8162 |
-
*
|
| 8163 |
-
* @param {Object} state Current state.
|
| 8164 |
-
* @param {Object} action Dispatched action.
|
| 8165 |
-
*
|
| 8166 |
-
* @return {Object} Updated state.
|
| 8167 |
-
*/
|
| 8168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8169 |
|
| 8170 |
-
const
|
| 8171 |
-
withBlockCache, // needs to be before withInnerBlocksRemoveCascade
|
| 8172 |
-
withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade
|
| 8173 |
-
withBlockReset, withPersistentBlockChange, withIgnoredBlockChange)({
|
| 8174 |
-
byClientId(state = {}, action) {
|
| 8175 |
-
switch (action.type) {
|
| 8176 |
-
case 'RESET_BLOCKS':
|
| 8177 |
-
return getFlattenedBlocksWithoutAttributes(action.blocks);
|
| 8178 |
|
| 8179 |
-
|
| 8180 |
-
|
| 8181 |
-
return { ...state,
|
| 8182 |
-
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 8183 |
-
};
|
| 8184 |
|
| 8185 |
-
|
| 8186 |
-
|
| 8187 |
-
|
| 8188 |
-
return state;
|
| 8189 |
-
} // Do nothing if only attributes change.
|
| 8190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8191 |
|
| 8192 |
-
|
|
|
|
|
|
|
| 8193 |
|
| 8194 |
-
|
| 8195 |
-
|
| 8196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8197 |
|
| 8198 |
-
|
| 8199 |
-
|
| 8200 |
-
|
| 8201 |
-
}
|
| 8202 |
-
};
|
| 8203 |
|
| 8204 |
-
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 8205 |
-
if (!action.blocks) {
|
| 8206 |
-
return state;
|
| 8207 |
-
}
|
| 8208 |
|
| 8209 |
-
|
| 8210 |
-
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 8211 |
-
};
|
| 8212 |
|
| 8213 |
-
|
| 8214 |
-
|
| 8215 |
-
|
| 8216 |
|
| 8217 |
-
return state;
|
| 8218 |
-
},
|
| 8219 |
|
| 8220 |
-
|
| 8221 |
-
|
| 8222 |
-
case 'RESET_BLOCKS':
|
| 8223 |
-
return getFlattenedBlockAttributes(action.blocks);
|
| 8224 |
|
| 8225 |
-
|
| 8226 |
-
|
| 8227 |
-
|
| 8228 |
-
|
| 8229 |
-
|
| 8230 |
|
| 8231 |
-
|
| 8232 |
-
|
| 8233 |
-
|
| 8234 |
-
return state;
|
| 8235 |
-
}
|
| 8236 |
|
| 8237 |
-
|
| 8238 |
-
|
| 8239 |
-
|
| 8240 |
-
|
| 8241 |
-
};
|
| 8242 |
|
| 8243 |
-
|
| 8244 |
-
|
| 8245 |
-
|
| 8246 |
-
|
| 8247 |
-
|
| 8248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8249 |
|
| 8250 |
-
|
| 8251 |
-
|
| 8252 |
-
|
| 8253 |
-
|
| 8254 |
-
result = getMutateSafeObject(state[id], result);
|
| 8255 |
-
result[key] = value;
|
| 8256 |
-
}
|
| 8257 |
|
| 8258 |
-
|
| 8259 |
-
|
| 8260 |
-
}), {});
|
| 8261 |
|
| 8262 |
-
|
| 8263 |
-
|
| 8264 |
-
|
|
|
|
| 8265 |
|
| 8266 |
-
|
| 8267 |
-
|
| 8268 |
-
};
|
| 8269 |
-
}
|
| 8270 |
|
| 8271 |
-
|
| 8272 |
-
|
| 8273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8274 |
}
|
| 8275 |
-
|
| 8276 |
-
|
| 8277 |
-
...getFlattenedBlockAttributes(action.blocks)
|
| 8278 |
-
};
|
| 8279 |
-
|
| 8280 |
-
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 8281 |
-
return Object(external_lodash_["omit"])(state, action.removedClientIds);
|
| 8282 |
}
|
| 8283 |
-
|
| 8284 |
-
|
| 8285 |
-
|
| 8286 |
-
|
| 8287 |
-
|
| 8288 |
-
switch (action.type) {
|
| 8289 |
-
case 'RESET_BLOCKS':
|
| 8290 |
-
return mapBlockOrder(action.blocks);
|
| 8291 |
-
|
| 8292 |
-
case 'RECEIVE_BLOCKS':
|
| 8293 |
-
return { ...state,
|
| 8294 |
-
...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), '')
|
| 8295 |
-
};
|
| 8296 |
-
|
| 8297 |
-
case 'INSERT_BLOCKS':
|
| 8298 |
-
{
|
| 8299 |
-
const {
|
| 8300 |
-
rootClientId = ''
|
| 8301 |
-
} = action;
|
| 8302 |
-
const subState = state[rootClientId] || [];
|
| 8303 |
-
const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
|
| 8304 |
-
const {
|
| 8305 |
-
index = subState.length
|
| 8306 |
-
} = action;
|
| 8307 |
-
return { ...state,
|
| 8308 |
-
...mappedBlocks,
|
| 8309 |
-
[rootClientId]: insertAt(subState, mappedBlocks[rootClientId], index)
|
| 8310 |
-
};
|
| 8311 |
}
|
| 8312 |
-
|
| 8313 |
-
|
| 8314 |
-
|
| 8315 |
-
|
| 8316 |
-
|
| 8317 |
-
|
| 8318 |
-
|
| 8319 |
-
|
| 8320 |
-
|
| 8321 |
-
|
| 8322 |
-
|
| 8323 |
-
|
| 8324 |
-
|
| 8325 |
-
|
| 8326 |
-
|
| 8327 |
-
|
| 8328 |
-
|
| 8329 |
-
|
| 8330 |
-
|
| 8331 |
-
|
| 8332 |
-
|
| 8333 |
-
|
| 8334 |
-
|
| 8335 |
-
|
| 8336 |
-
};
|
| 8337 |
}
|
|
|
|
| 8338 |
|
| 8339 |
-
case 'MOVE_BLOCKS_UP':
|
| 8340 |
-
{
|
| 8341 |
-
const {
|
| 8342 |
-
clientIds,
|
| 8343 |
-
rootClientId = ''
|
| 8344 |
-
} = action;
|
| 8345 |
-
const firstClientId = Object(external_lodash_["first"])(clientIds);
|
| 8346 |
-
const subState = state[rootClientId];
|
| 8347 |
-
|
| 8348 |
-
if (!subState.length || firstClientId === Object(external_lodash_["first"])(subState)) {
|
| 8349 |
-
return state;
|
| 8350 |
-
}
|
| 8351 |
|
| 8352 |
-
|
| 8353 |
-
|
| 8354 |
-
|
| 8355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8356 |
}
|
|
|
|
| 8357 |
|
| 8358 |
-
case 'MOVE_BLOCKS_DOWN':
|
| 8359 |
-
{
|
| 8360 |
-
const {
|
| 8361 |
-
clientIds,
|
| 8362 |
-
rootClientId = ''
|
| 8363 |
-
} = action;
|
| 8364 |
-
const firstClientId = Object(external_lodash_["first"])(clientIds);
|
| 8365 |
-
const lastClientId = Object(external_lodash_["last"])(clientIds);
|
| 8366 |
-
const subState = state[rootClientId];
|
| 8367 |
-
|
| 8368 |
-
if (!subState.length || lastClientId === Object(external_lodash_["last"])(subState)) {
|
| 8369 |
-
return state;
|
| 8370 |
-
}
|
| 8371 |
|
| 8372 |
-
const firstIndex = subState.indexOf(firstClientId);
|
| 8373 |
-
return { ...state,
|
| 8374 |
-
[rootClientId]: moveTo(subState, firstIndex, firstIndex + 1, clientIds.length)
|
| 8375 |
-
};
|
| 8376 |
-
}
|
| 8377 |
|
| 8378 |
-
|
| 8379 |
-
|
| 8380 |
-
|
| 8381 |
-
|
| 8382 |
-
|
| 8383 |
|
| 8384 |
-
|
| 8385 |
-
|
| 8386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8387 |
|
| 8388 |
-
|
| 8389 |
-
|
| 8390 |
-
|
| 8391 |
-
|
| 8392 |
-
|
| 8393 |
-
|
| 8394 |
-
}
|
| 8395 |
|
| 8396 |
-
|
| 8397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8398 |
}
|
| 8399 |
-
|
| 8400 |
-
return result;
|
| 8401 |
-
}, []))])(state);
|
| 8402 |
}
|
| 8403 |
-
|
| 8404 |
-
|
| 8405 |
-
return Object(external_lodash_["flow"])([// Remove inner block ordering for removed blocks
|
| 8406 |
-
nextState => Object(external_lodash_["omit"])(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings
|
| 8407 |
-
nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["without"])(subState, ...action.removedClientIds))])(state);
|
| 8408 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8409 |
|
| 8410 |
-
|
| 8411 |
-
|
| 8412 |
-
|
| 8413 |
-
|
| 8414 |
-
|
| 8415 |
-
parents(state = {}, action) {
|
| 8416 |
-
switch (action.type) {
|
| 8417 |
-
case 'RESET_BLOCKS':
|
| 8418 |
-
return mapBlockParents(action.blocks);
|
| 8419 |
-
|
| 8420 |
-
case 'RECEIVE_BLOCKS':
|
| 8421 |
-
return { ...state,
|
| 8422 |
-
...mapBlockParents(action.blocks)
|
| 8423 |
-
};
|
| 8424 |
-
|
| 8425 |
-
case 'INSERT_BLOCKS':
|
| 8426 |
-
return { ...state,
|
| 8427 |
-
...mapBlockParents(action.blocks, action.rootClientId || '')
|
| 8428 |
-
};
|
| 8429 |
-
|
| 8430 |
-
case 'MOVE_BLOCKS_TO_POSITION':
|
| 8431 |
-
{
|
| 8432 |
-
return { ...state,
|
| 8433 |
-
...action.clientIds.reduce((accumulator, id) => {
|
| 8434 |
-
accumulator[id] = action.toRootClientId || '';
|
| 8435 |
-
return accumulator;
|
| 8436 |
-
}, {})
|
| 8437 |
-
};
|
| 8438 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8439 |
|
| 8440 |
-
|
| 8441 |
-
|
| 8442 |
-
|
| 8443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8444 |
|
| 8445 |
-
|
| 8446 |
-
|
| 8447 |
-
|
|
|
|
|
|
|
| 8448 |
|
| 8449 |
-
return state;
|
| 8450 |
-
},
|
| 8451 |
|
| 8452 |
-
|
| 8453 |
-
|
| 8454 |
-
|
| 8455 |
-
|
| 8456 |
-
|
| 8457 |
-
|
| 8458 |
-
|
| 8459 |
-
|
| 8460 |
-
|
| 8461 |
-
|
| 8462 |
|
| 8463 |
-
|
| 8464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8465 |
|
| 8466 |
-
});
|
| 8467 |
/**
|
| 8468 |
-
*
|
| 8469 |
-
*
|
| 8470 |
-
* @param {boolean} state Current state.
|
| 8471 |
-
* @param {Object} action Dispatched action.
|
| 8472 |
-
*
|
| 8473 |
-
* @return {boolean} Updated state.
|
| 8474 |
*/
|
| 8475 |
|
| 8476 |
-
function reducer_isTyping(state = false, action) {
|
| 8477 |
-
switch (action.type) {
|
| 8478 |
-
case 'START_TYPING':
|
| 8479 |
-
return true;
|
| 8480 |
|
| 8481 |
-
case 'STOP_TYPING':
|
| 8482 |
-
return false;
|
| 8483 |
-
}
|
| 8484 |
|
| 8485 |
-
return state;
|
| 8486 |
-
}
|
| 8487 |
/**
|
| 8488 |
-
*
|
| 8489 |
-
*
|
| 8490 |
-
* @param {string[]} state Current state.
|
| 8491 |
-
* @param {Object} action Dispatched action.
|
| 8492 |
-
*
|
| 8493 |
-
* @return {string[]} Updated state.
|
| 8494 |
*/
|
| 8495 |
|
| 8496 |
-
function draggedBlocks(state = [], action) {
|
| 8497 |
-
switch (action.type) {
|
| 8498 |
-
case 'START_DRAGGING_BLOCKS':
|
| 8499 |
-
return action.clientIds;
|
| 8500 |
|
| 8501 |
-
case 'STOP_DRAGGING_BLOCKS':
|
| 8502 |
-
return [];
|
| 8503 |
-
}
|
| 8504 |
|
| 8505 |
-
return state;
|
| 8506 |
-
}
|
| 8507 |
/**
|
| 8508 |
-
*
|
|
|
|
| 8509 |
*
|
| 8510 |
-
* @
|
| 8511 |
-
* @param {Object} action Dispatched action.
|
| 8512 |
*
|
| 8513 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8514 |
*/
|
| 8515 |
|
| 8516 |
-
function
|
| 8517 |
-
|
| 8518 |
-
|
| 8519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8520 |
|
| 8521 |
-
|
| 8522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8523 |
}
|
| 8524 |
|
| 8525 |
-
return
|
| 8526 |
}
|
| 8527 |
-
|
| 8528 |
-
* Internal helper reducer for selectionStart and selectionEnd. Can hold a block
|
| 8529 |
-
* selection, represented by an object with property clientId.
|
| 8530 |
-
*
|
| 8531 |
-
* @param {Object} state Current state.
|
| 8532 |
-
* @param {Object} action Dispatched action.
|
| 8533 |
-
*
|
| 8534 |
-
* @return {Object} Updated state.
|
| 8535 |
-
*/
|
| 8536 |
|
| 8537 |
-
|
| 8538 |
-
|
| 8539 |
-
|
| 8540 |
-
|
| 8541 |
-
|
| 8542 |
-
|
| 8543 |
-
}
|
| 8544 |
|
| 8545 |
-
|
| 8546 |
-
}
|
| 8547 |
|
| 8548 |
-
|
| 8549 |
-
|
| 8550 |
-
|
| 8551 |
-
|
| 8552 |
|
| 8553 |
-
|
| 8554 |
-
|
| 8555 |
-
};
|
| 8556 |
|
| 8557 |
-
|
| 8558 |
-
|
| 8559 |
-
|
| 8560 |
-
if (!action.updateSelection || !action.blocks.length) {
|
| 8561 |
-
return state;
|
| 8562 |
-
}
|
| 8563 |
|
| 8564 |
-
|
| 8565 |
-
|
| 8566 |
-
};
|
| 8567 |
-
}
|
| 8568 |
|
| 8569 |
-
|
| 8570 |
-
|
| 8571 |
-
return state;
|
| 8572 |
-
}
|
| 8573 |
|
| 8574 |
-
|
|
|
|
| 8575 |
|
| 8576 |
-
|
| 8577 |
-
|
| 8578 |
-
if (action.clientIds.indexOf(state.clientId) === -1) {
|
| 8579 |
-
return state;
|
| 8580 |
-
}
|
| 8581 |
|
| 8582 |
-
|
| 8583 |
-
|
| 8584 |
|
| 8585 |
-
|
| 8586 |
-
|
| 8587 |
-
}
|
| 8588 |
|
| 8589 |
-
|
| 8590 |
-
|
| 8591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8592 |
|
| 8593 |
-
return {
|
| 8594 |
-
clientId: blockToSelect.clientId
|
| 8595 |
-
};
|
| 8596 |
-
}
|
| 8597 |
-
}
|
| 8598 |
|
| 8599 |
-
return state;
|
| 8600 |
-
}
|
| 8601 |
/**
|
| 8602 |
-
*
|
| 8603 |
-
*
|
| 8604 |
-
* @param {boolean} state Current state.
|
| 8605 |
-
* @param {Object} action Dispatched action.
|
| 8606 |
-
*
|
| 8607 |
-
* @return {boolean} Updated state.
|
| 8608 |
*/
|
| 8609 |
|
| 8610 |
|
| 8611 |
-
|
| 8612 |
-
|
|
|
|
| 8613 |
|
| 8614 |
-
switch (action.type) {
|
| 8615 |
-
case 'SELECTION_CHANGE':
|
| 8616 |
-
return {
|
| 8617 |
-
selectionStart: {
|
| 8618 |
-
clientId: action.clientId,
|
| 8619 |
-
attributeKey: action.attributeKey,
|
| 8620 |
-
offset: action.startOffset
|
| 8621 |
-
},
|
| 8622 |
-
selectionEnd: {
|
| 8623 |
-
clientId: action.clientId,
|
| 8624 |
-
attributeKey: action.attributeKey,
|
| 8625 |
-
offset: action.endOffset
|
| 8626 |
-
}
|
| 8627 |
-
};
|
| 8628 |
|
| 8629 |
-
case 'RESET_SELECTION':
|
| 8630 |
-
const {
|
| 8631 |
-
selectionStart,
|
| 8632 |
-
selectionEnd
|
| 8633 |
-
} = action;
|
| 8634 |
-
return {
|
| 8635 |
-
selectionStart,
|
| 8636 |
-
selectionEnd
|
| 8637 |
-
};
|
| 8638 |
|
| 8639 |
-
case 'MULTI_SELECT':
|
| 8640 |
-
const {
|
| 8641 |
-
start,
|
| 8642 |
-
end
|
| 8643 |
-
} = action;
|
| 8644 |
-
return {
|
| 8645 |
-
selectionStart: {
|
| 8646 |
-
clientId: start
|
| 8647 |
-
},
|
| 8648 |
-
selectionEnd: {
|
| 8649 |
-
clientId: end
|
| 8650 |
-
}
|
| 8651 |
-
};
|
| 8652 |
|
| 8653 |
-
|
| 8654 |
-
|
| 8655 |
-
|
| 8656 |
|
| 8657 |
-
if (!startClientId && !endClientId) {
|
| 8658 |
-
return state;
|
| 8659 |
-
} // If the start of the selection won't exist after reset, remove selection.
|
| 8660 |
|
| 8661 |
|
| 8662 |
-
|
| 8663 |
-
return {
|
| 8664 |
-
selectionStart: {},
|
| 8665 |
-
selectionEnd: {}
|
| 8666 |
-
};
|
| 8667 |
-
} // If the end of the selection won't exist after reset, collapse selection.
|
| 8668 |
|
|
|
|
| 8669 |
|
| 8670 |
-
|
| 8671 |
-
|
| 8672 |
-
|
| 8673 |
-
};
|
| 8674 |
-
}
|
| 8675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8676 |
}
|
| 8677 |
|
| 8678 |
-
|
| 8679 |
-
selectionStart: selectionHelper(state.selectionStart, action),
|
| 8680 |
-
selectionEnd: selectionHelper(state.selectionEnd, action)
|
| 8681 |
-
};
|
| 8682 |
-
}
|
| 8683 |
-
/**
|
| 8684 |
-
* Reducer returning whether the user is multi-selecting.
|
| 8685 |
-
*
|
| 8686 |
-
* @param {boolean} state Current state.
|
| 8687 |
-
* @param {Object} action Dispatched action.
|
| 8688 |
-
*
|
| 8689 |
-
* @return {boolean} Updated state.
|
| 8690 |
-
*/
|
| 8691 |
-
|
| 8692 |
-
function reducer_isMultiSelecting(state = false, action) {
|
| 8693 |
-
switch (action.type) {
|
| 8694 |
-
case 'START_MULTI_SELECT':
|
| 8695 |
-
return true;
|
| 8696 |
|
| 8697 |
-
|
| 8698 |
-
|
| 8699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8700 |
|
| 8701 |
-
|
| 8702 |
-
|
| 8703 |
-
|
| 8704 |
-
* Reducer returning whether selection is enabled.
|
| 8705 |
-
*
|
| 8706 |
-
* @param {boolean} state Current state.
|
| 8707 |
-
* @param {Object} action Dispatched action.
|
| 8708 |
-
*
|
| 8709 |
-
* @return {boolean} Updated state.
|
| 8710 |
-
*/
|
| 8711 |
|
| 8712 |
-
|
| 8713 |
-
|
| 8714 |
-
|
| 8715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8716 |
}
|
| 8717 |
|
| 8718 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8719 |
}
|
| 8720 |
-
/**
|
| 8721 |
-
* Reducer returning the intial block selection.
|
| 8722 |
-
*
|
| 8723 |
-
* Currently this in only used to restore the selection after block deletion and
|
| 8724 |
-
* pasting new content.This reducer should eventually be removed in favour of setting
|
| 8725 |
-
* selection directly.
|
| 8726 |
-
*
|
| 8727 |
-
* @param {boolean} state Current state.
|
| 8728 |
-
* @param {Object} action Dispatched action.
|
| 8729 |
-
*
|
| 8730 |
-
* @return {number|null} Initial position: 0, -1 or null.
|
| 8731 |
-
*/
|
| 8732 |
|
| 8733 |
-
|
| 8734 |
-
|
| 8735 |
-
|
| 8736 |
-
|
| 8737 |
-
|
| 8738 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8739 |
|
| 8740 |
-
|
| 8741 |
-
|
| 8742 |
-
function blocksMode(state = {}, action) {
|
| 8743 |
-
if (action.type === 'TOGGLE_BLOCK_MODE') {
|
| 8744 |
-
const {
|
| 8745 |
-
clientId
|
| 8746 |
-
} = action;
|
| 8747 |
-
return { ...state,
|
| 8748 |
-
[clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html'
|
| 8749 |
-
};
|
| 8750 |
-
}
|
| 8751 |
|
| 8752 |
-
|
| 8753 |
-
}
|
| 8754 |
/**
|
| 8755 |
-
*
|
| 8756 |
-
* is not an explicit insertion point assigned, or an object of its `index` and
|
| 8757 |
-
* `rootClientId`.
|
| 8758 |
-
*
|
| 8759 |
-
* @param {Object} state Current state.
|
| 8760 |
-
* @param {Object} action Dispatched action.
|
| 8761 |
-
*
|
| 8762 |
-
* @return {Object} Updated state.
|
| 8763 |
*/
|
| 8764 |
|
| 8765 |
-
function reducer_insertionPoint(state = null, action) {
|
| 8766 |
-
switch (action.type) {
|
| 8767 |
-
case 'SHOW_INSERTION_POINT':
|
| 8768 |
-
const {
|
| 8769 |
-
rootClientId,
|
| 8770 |
-
index,
|
| 8771 |
-
__unstableWithInserter
|
| 8772 |
-
} = action;
|
| 8773 |
-
return {
|
| 8774 |
-
rootClientId,
|
| 8775 |
-
index,
|
| 8776 |
-
__unstableWithInserter
|
| 8777 |
-
};
|
| 8778 |
|
| 8779 |
-
case 'HIDE_INSERTION_POINT':
|
| 8780 |
-
return null;
|
| 8781 |
-
}
|
| 8782 |
|
| 8783 |
-
return state;
|
| 8784 |
-
}
|
| 8785 |
/**
|
| 8786 |
-
*
|
| 8787 |
-
*
|
| 8788 |
-
* @param {Object} state Current state.
|
| 8789 |
-
* @param {Object} action Dispatched action.
|
| 8790 |
-
*
|
| 8791 |
-
* @return {boolean} Updated state.
|
| 8792 |
*/
|
| 8793 |
|
| 8794 |
-
function reducer_template(state = {
|
| 8795 |
-
isValid: true
|
| 8796 |
-
}, action) {
|
| 8797 |
-
switch (action.type) {
|
| 8798 |
-
case 'SET_TEMPLATE_VALIDITY':
|
| 8799 |
-
return { ...state,
|
| 8800 |
-
isValid: action.isValid
|
| 8801 |
-
};
|
| 8802 |
-
}
|
| 8803 |
|
| 8804 |
-
return state;
|
| 8805 |
-
}
|
| 8806 |
-
/**
|
| 8807 |
-
* Reducer returning the editor setting.
|
| 8808 |
-
*
|
| 8809 |
-
* @param {Object} state Current state.
|
| 8810 |
-
* @param {Object} action Dispatched action.
|
| 8811 |
-
*
|
| 8812 |
-
* @return {Object} Updated state.
|
| 8813 |
-
*/
|
| 8814 |
|
| 8815 |
-
function
|
| 8816 |
-
|
| 8817 |
-
|
| 8818 |
-
|
| 8819 |
-
|
| 8820 |
-
|
| 8821 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8822 |
|
| 8823 |
-
|
| 8824 |
-
|
| 8825 |
-
/**
|
| 8826 |
-
* Reducer returning the user preferences.
|
| 8827 |
-
*
|
| 8828 |
-
* @param {Object} state Current state.
|
| 8829 |
-
* @param {Object} action Dispatched action.
|
| 8830 |
-
*
|
| 8831 |
-
* @return {string} Updated state.
|
| 8832 |
-
*/
|
| 8833 |
|
| 8834 |
-
|
| 8835 |
-
|
| 8836 |
-
|
| 8837 |
-
case 'REPLACE_BLOCKS':
|
| 8838 |
-
return action.blocks.reduce((prevState, block) => {
|
| 8839 |
-
const {
|
| 8840 |
-
attributes,
|
| 8841 |
-
name: blockName
|
| 8842 |
-
} = block;
|
| 8843 |
-
const match = Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the
|
| 8844 |
-
// one that is used for block variations in the Inserter (`getItemFromVariation`).
|
| 8845 |
|
| 8846 |
-
|
| 8847 |
-
|
| 8848 |
-
|
| 8849 |
-
};
|
| 8850 |
|
| 8851 |
-
|
| 8852 |
-
|
| 8853 |
-
|
| 8854 |
}
|
| 8855 |
|
| 8856 |
-
return
|
| 8857 |
-
|
| 8858 |
-
[id]: {
|
| 8859 |
-
time: action.time,
|
| 8860 |
-
count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1,
|
| 8861 |
-
insert
|
| 8862 |
-
}
|
| 8863 |
-
}
|
| 8864 |
-
};
|
| 8865 |
-
}, state);
|
| 8866 |
-
}
|
| 8867 |
|
| 8868 |
-
|
| 8869 |
-
}
|
| 8870 |
-
/**
|
| 8871 |
-
* Reducer returning an object where each key is a block client ID, its value
|
| 8872 |
-
* representing the settings for its nested blocks.
|
| 8873 |
-
*
|
| 8874 |
-
* @param {Object} state Current state.
|
| 8875 |
-
* @param {Object} action Dispatched action.
|
| 8876 |
-
*
|
| 8877 |
-
* @return {Object} Updated state.
|
| 8878 |
-
*/
|
| 8879 |
|
| 8880 |
-
|
| 8881 |
-
|
| 8882 |
-
|
| 8883 |
-
|
| 8884 |
-
|
| 8885 |
-
|
| 8886 |
-
{
|
| 8887 |
-
return
|
| 8888 |
}
|
| 8889 |
|
| 8890 |
-
|
| 8891 |
-
|
| 8892 |
-
|
| 8893 |
-
|
| 8894 |
-
|
|
|
|
|
|
|
|
|
|
| 8895 |
|
| 8896 |
-
|
| 8897 |
-
|
| 8898 |
-
|
| 8899 |
-
|
| 8900 |
|
| 8901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8902 |
}
|
|
|
|
| 8903 |
|
| 8904 |
-
|
| 8905 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8906 |
}
|
| 8907 |
|
| 8908 |
-
return
|
| 8909 |
-
[clientId]: action.settings
|
| 8910 |
-
};
|
| 8911 |
}
|
| 8912 |
-
}
|
| 8913 |
|
| 8914 |
-
|
| 8915 |
-
|
| 8916 |
-
/**
|
| 8917 |
-
* Reducer returning whether the navigation mode is enabled or not.
|
| 8918 |
-
*
|
| 8919 |
-
* @param {string} state Current state.
|
| 8920 |
-
* @param {Object} action Dispatched action.
|
| 8921 |
-
*
|
| 8922 |
-
* @return {string} Updated state.
|
| 8923 |
-
*/
|
| 8924 |
|
| 8925 |
-
|
| 8926 |
-
|
| 8927 |
-
|
| 8928 |
-
|
| 8929 |
-
}
|
| 8930 |
|
| 8931 |
-
|
| 8932 |
-
|
| 8933 |
-
}
|
| 8934 |
|
| 8935 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8936 |
}
|
|
|
|
|
|
|
| 8937 |
/**
|
| 8938 |
-
*
|
| 8939 |
-
*
|
| 8940 |
-
* @param {string|null} state Current state.
|
| 8941 |
-
* @param {Object} action Dispatched action.
|
| 8942 |
-
*
|
| 8943 |
-
* @return {string|null} Updated state.
|
| 8944 |
*/
|
| 8945 |
|
| 8946 |
-
function reducer_hasBlockMovingClientId(state = null, action) {
|
| 8947 |
-
// Let inserting block always trigger Edit mode.
|
| 8948 |
-
if (action.type === 'SET_BLOCK_MOVING_MODE') {
|
| 8949 |
-
return action.hasBlockMovingClientId;
|
| 8950 |
-
}
|
| 8951 |
-
|
| 8952 |
-
if (action.type === 'SET_NAVIGATION_MODE') {
|
| 8953 |
-
return null;
|
| 8954 |
-
}
|
| 8955 |
|
| 8956 |
-
return state;
|
| 8957 |
-
}
|
| 8958 |
/**
|
| 8959 |
-
*
|
| 8960 |
-
* update. The state is structured as an object where the keys represent the
|
| 8961 |
-
* client IDs of blocks, the values a subset of attributes from the most recent
|
| 8962 |
-
* block update. The state is always reset to null if the last action is
|
| 8963 |
-
* anything other than an attributes update.
|
| 8964 |
-
*
|
| 8965 |
-
* @param {Object<string,Object>} state Current state.
|
| 8966 |
-
* @param {Object} action Action object.
|
| 8967 |
-
*
|
| 8968 |
-
* @return {[string,Object]} Updated state.
|
| 8969 |
*/
|
| 8970 |
|
| 8971 |
-
function lastBlockAttributesChange(state, action) {
|
| 8972 |
-
switch (action.type) {
|
| 8973 |
-
case 'UPDATE_BLOCK':
|
| 8974 |
-
if (!action.updates.attributes) {
|
| 8975 |
-
break;
|
| 8976 |
-
}
|
| 8977 |
|
| 8978 |
-
return {
|
| 8979 |
-
[action.clientId]: action.updates.attributes
|
| 8980 |
-
};
|
| 8981 |
|
| 8982 |
-
|
| 8983 |
-
|
| 8984 |
-
|
| 8985 |
-
|
|
|
|
| 8986 |
}
|
| 8987 |
|
| 8988 |
-
return
|
| 8989 |
-
}
|
| 8990 |
-
/**
|
| 8991 |
-
* Reducer returning automatic change state.
|
| 8992 |
-
*
|
| 8993 |
-
* @param {boolean} state Current state.
|
| 8994 |
-
* @param {Object} action Dispatched action.
|
| 8995 |
-
*
|
| 8996 |
-
* @return {string} Updated state.
|
| 8997 |
-
*/
|
| 8998 |
|
| 8999 |
-
|
| 9000 |
-
|
| 9001 |
-
|
| 9002 |
-
|
| 9003 |
|
| 9004 |
-
|
| 9005 |
-
|
| 9006 |
-
return 'final';
|
| 9007 |
-
}
|
| 9008 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9009 |
return;
|
|
|
|
| 9010 |
|
| 9011 |
-
|
| 9012 |
-
|
| 9013 |
-
|
| 9014 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9015 |
}
|
| 9016 |
|
| 9017 |
-
|
| 9018 |
-
// Undoing an automatic change should still be possible after mouse
|
| 9019 |
-
// move.
|
| 9020 |
|
| 9021 |
-
|
| 9022 |
-
|
| 9023 |
-
return state;
|
| 9024 |
-
} // Reset the state by default (for any action not handled).
|
| 9025 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9026 |
}
|
| 9027 |
-
|
| 9028 |
-
|
| 9029 |
-
|
| 9030 |
-
* @param {boolean} state Current highlighted block.
|
| 9031 |
-
* @param {Object} action Dispatched action.
|
| 9032 |
-
*
|
| 9033 |
-
* @return {string} Updated state.
|
| 9034 |
-
*/
|
| 9035 |
|
| 9036 |
-
|
| 9037 |
-
|
| 9038 |
-
case 'TOGGLE_BLOCK_HIGHLIGHT':
|
| 9039 |
-
const {
|
| 9040 |
-
clientId,
|
| 9041 |
-
isHighlighted
|
| 9042 |
-
} = action;
|
| 9043 |
|
| 9044 |
-
|
| 9045 |
-
|
| 9046 |
-
|
| 9047 |
-
return null;
|
| 9048 |
-
}
|
| 9049 |
|
| 9050 |
-
|
|
|
|
| 9051 |
|
| 9052 |
-
|
| 9053 |
-
if (action.clientId !== state) {
|
| 9054 |
-
return null;
|
| 9055 |
-
}
|
| 9056 |
|
| 9057 |
-
}
|
| 9058 |
|
| 9059 |
-
return state;
|
| 9060 |
-
}
|
| 9061 |
/**
|
| 9062 |
-
*
|
| 9063 |
-
*
|
| 9064 |
-
* @param {Object} state Current state.
|
| 9065 |
-
* @param {Object} action Dispatched action.
|
| 9066 |
-
*
|
| 9067 |
-
* @return {Object} Updated state.
|
| 9068 |
*/
|
| 9069 |
|
| 9070 |
-
function lastBlockInserted(state = {}, action) {
|
| 9071 |
-
var _action$meta;
|
| 9072 |
|
| 9073 |
-
switch (action.type) {
|
| 9074 |
-
case 'INSERT_BLOCKS':
|
| 9075 |
-
if (!action.blocks.length) {
|
| 9076 |
-
return state;
|
| 9077 |
-
}
|
| 9078 |
|
| 9079 |
-
|
| 9080 |
-
|
| 9081 |
-
|
| 9082 |
-
clientId,
|
| 9083 |
-
source
|
| 9084 |
-
};
|
| 9085 |
|
| 9086 |
-
|
| 9087 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9088 |
}
|
| 9089 |
|
| 9090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9091 |
}
|
| 9092 |
-
|
| 9093 |
-
|
| 9094 |
-
|
| 9095 |
-
draggedBlocks,
|
| 9096 |
-
isCaretWithinFormattedText: reducer_isCaretWithinFormattedText,
|
| 9097 |
-
selection: reducer_selection,
|
| 9098 |
-
isMultiSelecting: reducer_isMultiSelecting,
|
| 9099 |
-
isSelectionEnabled: reducer_isSelectionEnabled,
|
| 9100 |
-
initialPosition: reducer_initialPosition,
|
| 9101 |
-
blocksMode,
|
| 9102 |
-
blockListSettings: reducer_blockListSettings,
|
| 9103 |
-
insertionPoint: reducer_insertionPoint,
|
| 9104 |
-
template: reducer_template,
|
| 9105 |
-
settings: reducer_settings,
|
| 9106 |
-
preferences,
|
| 9107 |
-
lastBlockAttributesChange,
|
| 9108 |
-
isNavigationMode: reducer_isNavigationMode,
|
| 9109 |
-
hasBlockMovingClientId: reducer_hasBlockMovingClientId,
|
| 9110 |
-
automaticChangeStatus,
|
| 9111 |
-
highlightedBlock,
|
| 9112 |
-
lastBlockInserted
|
| 9113 |
-
}));
|
| 9114 |
-
//# sourceMappingURL=reducer.js.map
|
| 9115 |
-
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
|
| 9116 |
-
var rememo = __webpack_require__(29);
|
| 9117 |
|
| 9118 |
-
//
|
|
|
|
|
|
|
|
|
|
| 9119 |
|
| 9120 |
|
| 9121 |
/**
|
| 9122 |
* External dependencies
|
| 9123 |
*/
|
| 9124 |
|
| 9125 |
-
|
| 9126 |
/**
|
| 9127 |
* WordPress dependencies
|
| 9128 |
*/
|
|
@@ -9131,3696 +8571,3422 @@ var rememo = __webpack_require__(29);
|
|
| 9131 |
|
| 9132 |
|
| 9133 |
/**
|
| 9134 |
-
*
|
| 9135 |
-
*
|
| 9136 |
-
* @typedef {Object} WPBlockSelection
|
| 9137 |
-
*
|
| 9138 |
-
* @property {string} clientId A block client ID.
|
| 9139 |
-
* @property {string} attributeKey A block attribute key.
|
| 9140 |
-
* @property {number} offset An attribute value offset, based on the rich
|
| 9141 |
-
* text value. See `wp.richText.create`.
|
| 9142 |
*/
|
| 9143 |
-
// Module constants
|
| 9144 |
|
| 9145 |
-
const MILLISECONDS_PER_HOUR = 3600 * 1000;
|
| 9146 |
-
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
|
| 9147 |
-
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
|
| 9148 |
-
const templateIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], {
|
| 9149 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 9150 |
-
viewBox: "0 0 24 24"
|
| 9151 |
-
}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], {
|
| 9152 |
-
x: "0",
|
| 9153 |
-
fill: "none",
|
| 9154 |
-
width: "24",
|
| 9155 |
-
height: "24"
|
| 9156 |
-
}), Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
|
| 9157 |
-
d: "M19 3H5c-1.105 0-2 .895-2 2v14c0 1.105.895 2 2 2h14c1.105 0 2-.895 2-2V5c0-1.105-.895-2-2-2zM6 6h5v5H6V6zm4.5 13C9.12 19 8 17.88 8 16.5S9.12 14 10.5 14s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm3-6l3-5 3 5h-6z"
|
| 9158 |
-
})));
|
| 9159 |
-
/**
|
| 9160 |
-
* Shared reference to an empty array for cases where it is important to avoid
|
| 9161 |
-
* returning a new array reference on every invocation, as in a connected or
|
| 9162 |
-
* other pure component which performs `shouldComponentUpdate` check on props.
|
| 9163 |
-
* This should be used as a last resort, since the normalized data should be
|
| 9164 |
-
* maintained by the reducer result in state.
|
| 9165 |
-
*
|
| 9166 |
-
* @type {Array}
|
| 9167 |
-
*/
|
| 9168 |
|
| 9169 |
-
const EMPTY_ARRAY = [];
|
| 9170 |
-
/**
|
| 9171 |
-
* Returns a block's name given its client ID, or null if no block exists with
|
| 9172 |
-
* the client ID.
|
| 9173 |
-
*
|
| 9174 |
-
* @param {Object} state Editor state.
|
| 9175 |
-
* @param {string} clientId Block client ID.
|
| 9176 |
-
*
|
| 9177 |
-
* @return {string} Block name.
|
| 9178 |
-
*/
|
| 9179 |
|
| 9180 |
-
function selectors_getBlockName(state, clientId) {
|
| 9181 |
-
const block = state.blocks.byClientId[clientId];
|
| 9182 |
-
const socialLinkName = 'core/social-link';
|
| 9183 |
|
| 9184 |
-
if (external_wp_element_["Platform"].OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) {
|
| 9185 |
-
const attributes = state.blocks.attributes[clientId];
|
| 9186 |
-
const {
|
| 9187 |
-
service
|
| 9188 |
-
} = attributes;
|
| 9189 |
-
return service ? `${socialLinkName}-${service}` : socialLinkName;
|
| 9190 |
-
}
|
| 9191 |
|
| 9192 |
-
return block ? block.name : null;
|
| 9193 |
-
}
|
| 9194 |
-
/**
|
| 9195 |
-
* Returns whether a block is valid or not.
|
| 9196 |
-
*
|
| 9197 |
-
* @param {Object} state Editor state.
|
| 9198 |
-
* @param {string} clientId Block client ID.
|
| 9199 |
-
*
|
| 9200 |
-
* @return {boolean} Is Valid.
|
| 9201 |
-
*/
|
| 9202 |
|
| 9203 |
-
function selectors_isBlockValid(state, clientId) {
|
| 9204 |
-
const block = state.blocks.byClientId[clientId];
|
| 9205 |
-
return !!block && block.isValid;
|
| 9206 |
-
}
|
| 9207 |
-
/**
|
| 9208 |
-
* Returns a block's attributes given its client ID, or null if no block exists with
|
| 9209 |
-
* the client ID.
|
| 9210 |
-
*
|
| 9211 |
-
* @param {Object} state Editor state.
|
| 9212 |
-
* @param {string} clientId Block client ID.
|
| 9213 |
-
*
|
| 9214 |
-
* @return {Object?} Block attributes.
|
| 9215 |
-
*/
|
| 9216 |
|
| 9217 |
-
function selectors_getBlockAttributes(state, clientId) {
|
| 9218 |
-
const block = state.blocks.byClientId[clientId];
|
| 9219 |
|
| 9220 |
-
if (!block) {
|
| 9221 |
-
return null;
|
| 9222 |
-
}
|
| 9223 |
|
| 9224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9225 |
}
|
| 9226 |
-
/**
|
| 9227 |
-
* Returns a block given its client ID. This is a parsed copy of the block,
|
| 9228 |
-
* containing its `blockName`, `clientId`, and current `attributes` state. This
|
| 9229 |
-
* is not the block's registration settings, which must be retrieved from the
|
| 9230 |
-
* blocks module registration store.
|
| 9231 |
-
*
|
| 9232 |
-
* getBlock recurses through its inner blocks until all its children blocks have
|
| 9233 |
-
* been retrieved. Note that getBlock will not return the child inner blocks of
|
| 9234 |
-
* an inner block controller. This is because an inner block controller syncs
|
| 9235 |
-
* itself with its own entity, and should therefore not be included with the
|
| 9236 |
-
* blocks of a different entity. For example, say you call `getBlocks( TP )` to
|
| 9237 |
-
* get the blocks of a template part. If another template part is a child of TP,
|
| 9238 |
-
* then the nested template part's child blocks will not be returned. This way,
|
| 9239 |
-
* the template block itself is considered part of the parent, but the children
|
| 9240 |
-
* are not.
|
| 9241 |
-
*
|
| 9242 |
-
* @param {Object} state Editor state.
|
| 9243 |
-
* @param {string} clientId Block client ID.
|
| 9244 |
-
*
|
| 9245 |
-
* @return {Object} Parsed block object.
|
| 9246 |
-
*/
|
| 9247 |
|
| 9248 |
-
|
| 9249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9250 |
|
| 9251 |
-
|
| 9252 |
-
|
| 9253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9254 |
|
| 9255 |
-
|
| 9256 |
-
|
| 9257 |
-
|
| 9258 |
-
};
|
| 9259 |
-
}, (state, clientId) => [// Normally, we'd have both `getBlockAttributes` dependencies and
|
| 9260 |
-
// `getBlocks` (children) dependencies here but for performance reasons
|
| 9261 |
-
// we use a denormalized cache key computed in the reducer that takes both
|
| 9262 |
-
// the attributes and inner blocks into account. The value of the cache key
|
| 9263 |
-
// is being changed whenever one of these dependencies is out of date.
|
| 9264 |
-
state.blocks.cache[clientId]]);
|
| 9265 |
-
const selectors_unstableGetBlockWithoutInnerBlocks = Object(rememo["a" /* default */])((state, clientId) => {
|
| 9266 |
-
const block = state.blocks.byClientId[clientId];
|
| 9267 |
|
| 9268 |
-
|
| 9269 |
-
|
| 9270 |
-
|
| 9271 |
|
| 9272 |
-
|
| 9273 |
-
|
| 9274 |
-
|
| 9275 |
-
|
| 9276 |
-
|
| 9277 |
-
* Returns all block objects for the current post being edited as an array in
|
| 9278 |
-
* the order they appear in the post. Note that this will exclude child blocks
|
| 9279 |
-
* of nested inner block controllers.
|
| 9280 |
-
*
|
| 9281 |
-
* Note: It's important to memoize this selector to avoid return a new instance
|
| 9282 |
-
* on each call. We use the block cache state for each top-level block of the
|
| 9283 |
-
* given clientID. This way, the selector only refreshes on changes to blocks
|
| 9284 |
-
* associated with the given entity, and does not refresh when changes are made
|
| 9285 |
-
* to blocks which are part of different inner block controllers.
|
| 9286 |
-
*
|
| 9287 |
-
* @param {Object} state Editor state.
|
| 9288 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 9289 |
-
*
|
| 9290 |
-
* @return {Object[]} Post blocks.
|
| 9291 |
-
*/
|
| 9292 |
|
| 9293 |
-
|
| 9294 |
-
|
| 9295 |
-
}
|
| 9296 |
-
|
| 9297 |
-
|
| 9298 |
-
|
| 9299 |
-
|
| 9300 |
-
|
| 9301 |
-
|
| 9302 |
-
|
| 9303 |
-
|
| 9304 |
-
|
| 9305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9306 |
|
| 9307 |
-
|
| 9308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9309 |
|
| 9310 |
-
|
| 9311 |
-
|
| 9312 |
-
|
| 9313 |
|
| 9314 |
-
|
| 9315 |
-
|
| 9316 |
-
|
| 9317 |
-
|
| 9318 |
-
|
|
|
|
|
|
|
|
|
|
| 9319 |
/**
|
| 9320 |
-
*
|
| 9321 |
-
* represented in the block-editor store from the given root regardless of any
|
| 9322 |
-
* inner block controllers.
|
| 9323 |
-
*
|
| 9324 |
-
* @param {Object} state Editor state.
|
| 9325 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 9326 |
-
*
|
| 9327 |
-
* @return {Object[]} Post blocks.
|
| 9328 |
*/
|
| 9329 |
|
| 9330 |
-
const __unstableGetBlockTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => __unstableGetBlockWithBlockTree(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
|
| 9331 |
-
/**
|
| 9332 |
-
* Returns a stripped down block object containing only its client ID,
|
| 9333 |
-
* and its inner blocks' client IDs.
|
| 9334 |
-
*
|
| 9335 |
-
* @param {Object} state Editor state.
|
| 9336 |
-
* @param {string} clientId Client ID of the block to get.
|
| 9337 |
-
*
|
| 9338 |
-
* @return {Object} Client IDs of the post blocks.
|
| 9339 |
-
*/
|
| 9340 |
|
| 9341 |
-
const selectors_unstableGetClientIdWithClientIdsTree = Object(rememo["a" /* default */])((state, clientId) => ({
|
| 9342 |
-
clientId,
|
| 9343 |
-
innerBlocks: selectors_unstableGetClientIdsTree(state, clientId)
|
| 9344 |
-
}), state => [state.blocks.order]);
|
| 9345 |
-
/**
|
| 9346 |
-
* Returns the block tree represented in the block-editor store from the
|
| 9347 |
-
* given root, consisting of stripped down block objects containing only
|
| 9348 |
-
* their client IDs, and their inner blocks' client IDs.
|
| 9349 |
-
*
|
| 9350 |
-
* @param {Object} state Editor state.
|
| 9351 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 9352 |
-
*
|
| 9353 |
-
* @return {Object[]} Client IDs of the post blocks.
|
| 9354 |
-
*/
|
| 9355 |
|
| 9356 |
-
const selectors_unstableGetClientIdsTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => selectors_unstableGetClientIdWithClientIdsTree(state, clientId)), state => [state.blocks.order]);
|
| 9357 |
/**
|
| 9358 |
-
*
|
| 9359 |
-
* of the blocks given.
|
| 9360 |
-
*
|
| 9361 |
-
* @param {Object} state Global application state.
|
| 9362 |
-
* @param {Array} clientIds Array of blocks to inspect.
|
| 9363 |
-
*
|
| 9364 |
-
* @return {Array} ids of descendants.
|
| 9365 |
*/
|
| 9366 |
|
| 9367 |
-
const selectors_getClientIdsOfDescendants = (state, clientIds) => Object(external_lodash_["flatMap"])(clientIds, clientId => {
|
| 9368 |
-
const descendants = selectors_getBlockOrder(state, clientId);
|
| 9369 |
-
return [...descendants, ...selectors_getClientIdsOfDescendants(state, descendants)];
|
| 9370 |
-
});
|
| 9371 |
-
/**
|
| 9372 |
-
* Returns an array containing the clientIds of the top-level blocks
|
| 9373 |
-
* and their descendants of any depth (for nested blocks).
|
| 9374 |
-
*
|
| 9375 |
-
* @param {Object} state Global application state.
|
| 9376 |
-
*
|
| 9377 |
-
* @return {Array} ids of top-level and descendant blocks.
|
| 9378 |
-
*/
|
| 9379 |
|
| 9380 |
-
const getClientIdsWithDescendants = Object(rememo["a" /* default */])(state => {
|
| 9381 |
-
const topLevelIds = selectors_getBlockOrder(state);
|
| 9382 |
-
return [...topLevelIds, ...selectors_getClientIdsOfDescendants(state, topLevelIds)];
|
| 9383 |
-
}, state => [state.blocks.order]);
|
| 9384 |
/**
|
| 9385 |
-
*
|
| 9386 |
-
* The number returned includes nested blocks.
|
| 9387 |
-
*
|
| 9388 |
-
* @param {Object} state Global application state.
|
| 9389 |
-
* @param {?string} blockName Optional block name, if specified only blocks of that type will be counted.
|
| 9390 |
*
|
| 9391 |
-
* @
|
|
|
|
|
|
|
| 9392 |
*/
|
| 9393 |
|
| 9394 |
-
const
|
| 9395 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9396 |
|
| 9397 |
-
|
| 9398 |
-
|
| 9399 |
-
}
|
| 9400 |
|
| 9401 |
-
|
| 9402 |
-
|
| 9403 |
-
|
| 9404 |
-
}, 0);
|
| 9405 |
-
}, state => [state.blocks.order, state.blocks.byClientId]);
|
| 9406 |
-
/**
|
| 9407 |
-
* Given an array of block client IDs, returns the corresponding array of block
|
| 9408 |
-
* objects.
|
| 9409 |
-
*
|
| 9410 |
-
* @param {Object} state Editor state.
|
| 9411 |
-
* @param {string[]} clientIds Client IDs for which blocks are to be returned.
|
| 9412 |
-
*
|
| 9413 |
-
* @return {WPBlock[]} Block objects.
|
| 9414 |
-
*/
|
| 9415 |
|
| 9416 |
-
|
| 9417 |
-
/**
|
| 9418 |
-
* Returns the number of blocks currently present in the post.
|
| 9419 |
-
*
|
| 9420 |
-
* @param {Object} state Editor state.
|
| 9421 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 9422 |
-
*
|
| 9423 |
-
* @return {number} Number of blocks in the post.
|
| 9424 |
-
*/
|
| 9425 |
|
| 9426 |
-
|
| 9427 |
-
|
| 9428 |
-
}
|
| 9429 |
-
/**
|
| 9430 |
-
* Returns the current selection start block client ID, attribute key and text
|
| 9431 |
-
* offset.
|
| 9432 |
-
*
|
| 9433 |
-
* @param {Object} state Block editor state.
|
| 9434 |
-
*
|
| 9435 |
-
* @return {WPBlockSelection} Selection start information.
|
| 9436 |
-
*/
|
| 9437 |
|
| 9438 |
-
|
| 9439 |
-
|
| 9440 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9441 |
/**
|
| 9442 |
-
*
|
| 9443 |
-
* offset.
|
| 9444 |
-
*
|
| 9445 |
-
* @param {Object} state Block editor state.
|
| 9446 |
-
*
|
| 9447 |
-
* @return {WPBlockSelection} Selection end information.
|
| 9448 |
*/
|
| 9449 |
|
| 9450 |
-
|
| 9451 |
-
|
| 9452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9453 |
/**
|
| 9454 |
-
*
|
| 9455 |
-
* may represent either a singular block selection or multi-selection start.
|
| 9456 |
-
* A selection is singular if its start and end match.
|
| 9457 |
-
*
|
| 9458 |
-
* @param {Object} state Global application state.
|
| 9459 |
-
*
|
| 9460 |
-
* @return {?string} Client ID of block selection start.
|
| 9461 |
*/
|
| 9462 |
|
| 9463 |
-
function selectors_getBlockSelectionStart(state) {
|
| 9464 |
-
return state.selection.selectionStart.clientId;
|
| 9465 |
-
}
|
| 9466 |
/**
|
| 9467 |
-
*
|
| 9468 |
-
* may represent either a singular block selection or multi-selection end.
|
| 9469 |
-
* A selection is singular if its start and end match.
|
| 9470 |
-
*
|
| 9471 |
-
* @param {Object} state Global application state.
|
| 9472 |
-
*
|
| 9473 |
-
* @return {?string} Client ID of block selection end.
|
| 9474 |
*/
|
| 9475 |
|
| 9476 |
-
|
| 9477 |
-
return state.selection.selectionEnd.clientId;
|
| 9478 |
-
}
|
| 9479 |
/**
|
| 9480 |
-
*
|
| 9481 |
-
*
|
| 9482 |
-
* @param {Object} state Global application state.
|
| 9483 |
-
*
|
| 9484 |
-
* @return {number} Number of blocks selected in the post.
|
| 9485 |
*/
|
| 9486 |
|
| 9487 |
-
function selectors_getSelectedBlockCount(state) {
|
| 9488 |
-
const multiSelectedBlockCount = selectors_getMultiSelectedBlockClientIds(state).length;
|
| 9489 |
|
| 9490 |
-
|
| 9491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9492 |
}
|
| 9493 |
|
| 9494 |
-
|
| 9495 |
-
|
| 9496 |
-
|
| 9497 |
-
|
| 9498 |
-
|
| 9499 |
-
|
| 9500 |
-
|
| 9501 |
-
|
| 9502 |
-
|
| 9503 |
-
|
| 9504 |
-
|
| 9505 |
-
|
| 9506 |
-
|
| 9507 |
-
|
| 9508 |
-
} = state.selection;
|
| 9509 |
-
return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId;
|
| 9510 |
}
|
| 9511 |
-
|
| 9512 |
-
|
| 9513 |
-
* selected block.
|
| 9514 |
-
*
|
| 9515 |
-
* @param {Object} state Editor state.
|
| 9516 |
-
*
|
| 9517 |
-
* @return {?string} Selected block client ID.
|
| 9518 |
-
*/
|
| 9519 |
|
| 9520 |
-
function selectors_getSelectedBlockClientId(state) {
|
| 9521 |
-
const {
|
| 9522 |
-
selectionStart,
|
| 9523 |
-
selectionEnd
|
| 9524 |
-
} = state.selection;
|
| 9525 |
-
const {
|
| 9526 |
-
clientId
|
| 9527 |
-
} = selectionStart;
|
| 9528 |
|
| 9529 |
-
if (!clientId || clientId !== selectionEnd.clientId) {
|
| 9530 |
-
return null;
|
| 9531 |
-
}
|
| 9532 |
|
| 9533 |
-
return clientId;
|
| 9534 |
-
}
|
| 9535 |
/**
|
| 9536 |
-
*
|
| 9537 |
-
*
|
| 9538 |
-
* @param {Object} state Global application state.
|
| 9539 |
-
*
|
| 9540 |
-
* @return {?Object} Selected block.
|
| 9541 |
*/
|
| 9542 |
|
| 9543 |
-
function selectors_getSelectedBlock(state) {
|
| 9544 |
-
const clientId = selectors_getSelectedBlockClientId(state);
|
| 9545 |
-
return clientId ? selectors_getBlock(state, clientId) : null;
|
| 9546 |
-
}
|
| 9547 |
-
/**
|
| 9548 |
-
* Given a block client ID, returns the root block from which the block is
|
| 9549 |
-
* nested, an empty string for top-level blocks, or null if the block does not
|
| 9550 |
-
* exist.
|
| 9551 |
-
*
|
| 9552 |
-
* @param {Object} state Editor state.
|
| 9553 |
-
* @param {string} clientId Block from which to find root client ID.
|
| 9554 |
-
*
|
| 9555 |
-
* @return {?string} Root client ID, if exists
|
| 9556 |
-
*/
|
| 9557 |
|
| 9558 |
-
function selectors_getBlockRootClientId(state, clientId) {
|
| 9559 |
-
return state.blocks.parents[clientId] !== undefined ? state.blocks.parents[clientId] : null;
|
| 9560 |
-
}
|
| 9561 |
/**
|
| 9562 |
-
*
|
| 9563 |
-
*
|
| 9564 |
-
* @param {Object} state Editor state.
|
| 9565 |
-
* @param {string} clientId Block from which to find root client ID.
|
| 9566 |
-
* @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
|
| 9567 |
-
*
|
| 9568 |
-
* @return {Array} ClientIDs of the parent blocks.
|
| 9569 |
*/
|
| 9570 |
|
| 9571 |
-
const selectors_getBlockParents = Object(rememo["a" /* default */])((state, clientId, ascending = false) => {
|
| 9572 |
-
const parents = [];
|
| 9573 |
-
let current = clientId;
|
| 9574 |
|
| 9575 |
-
|
| 9576 |
-
|
| 9577 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9578 |
}
|
| 9579 |
|
| 9580 |
-
|
| 9581 |
-
|
| 9582 |
-
|
| 9583 |
-
|
| 9584 |
-
|
| 9585 |
-
|
| 9586 |
-
|
| 9587 |
-
|
| 9588 |
-
|
| 9589 |
-
|
| 9590 |
-
|
| 9591 |
-
|
| 9592 |
-
|
| 9593 |
-
|
| 9594 |
-
|
| 9595 |
-
*/
|
| 9596 |
|
| 9597 |
-
const getBlockParentsByBlockName = Object(rememo["a" /* default */])((state, clientId, blockName, ascending = false) => {
|
| 9598 |
-
const parents = selectors_getBlockParents(state, clientId, ascending);
|
| 9599 |
-
return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(Object(external_lodash_["map"])(parents, id => ({
|
| 9600 |
-
id,
|
| 9601 |
-
name: selectors_getBlockName(state, id)
|
| 9602 |
-
})), ({
|
| 9603 |
-
name
|
| 9604 |
-
}) => {
|
| 9605 |
-
if (Array.isArray(blockName)) {
|
| 9606 |
-
return blockName.includes(name);
|
| 9607 |
-
}
|
| 9608 |
|
| 9609 |
-
return name === blockName;
|
| 9610 |
-
}), ({
|
| 9611 |
-
id
|
| 9612 |
-
}) => id);
|
| 9613 |
-
}, state => [state.blocks.parents]);
|
| 9614 |
/**
|
| 9615 |
-
*
|
| 9616 |
-
*
|
| 9617 |
-
* @param {Object} state Editor state.
|
| 9618 |
-
* @param {string} clientId Block from which to find root client ID.
|
| 9619 |
-
*
|
| 9620 |
-
* @return {string} Root client ID
|
| 9621 |
*/
|
| 9622 |
|
| 9623 |
-
function selectors_getBlockHierarchyRootClientId(state, clientId) {
|
| 9624 |
-
let current = clientId;
|
| 9625 |
-
let parent;
|
| 9626 |
|
| 9627 |
-
|
| 9628 |
-
|
| 9629 |
-
current = state.blocks.parents[current];
|
| 9630 |
-
} while (current);
|
| 9631 |
|
| 9632 |
-
|
| 9633 |
-
|
| 9634 |
-
|
| 9635 |
-
|
| 9636 |
-
|
| 9637 |
-
* @param {Object} state Editor state.
|
| 9638 |
-
* @param {string} clientId Block from which to find common ancestor client ID.
|
| 9639 |
-
*
|
| 9640 |
-
* @return {string} Common ancestor client ID or undefined
|
| 9641 |
-
*/
|
| 9642 |
|
| 9643 |
-
|
| 9644 |
-
|
| 9645 |
-
|
| 9646 |
-
|
| 9647 |
-
|
| 9648 |
-
const maxDepth = Math.min(clientParents.length, selectedParents.length);
|
| 9649 |
|
| 9650 |
-
|
| 9651 |
-
|
| 9652 |
-
lowestCommonAncestor = clientParents[index];
|
| 9653 |
-
} else {
|
| 9654 |
-
break;
|
| 9655 |
-
}
|
| 9656 |
-
}
|
| 9657 |
|
| 9658 |
-
|
| 9659 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9660 |
/**
|
| 9661 |
-
*
|
| 9662 |
-
* startClientId and modifier directionality. Defaults start startClientId to
|
| 9663 |
-
* the selected block, and direction as next block. Returns null if there is no
|
| 9664 |
-
* adjacent block.
|
| 9665 |
-
*
|
| 9666 |
-
* @param {Object} state Editor state.
|
| 9667 |
-
* @param {?string} startClientId Optional client ID of block from which to
|
| 9668 |
-
* search.
|
| 9669 |
-
* @param {?number} modifier Directionality multiplier (1 next, -1
|
| 9670 |
-
* previous).
|
| 9671 |
-
*
|
| 9672 |
-
* @return {?string} Return the client ID of the block, or null if none exists.
|
| 9673 |
*/
|
| 9674 |
|
| 9675 |
-
|
| 9676 |
-
|
| 9677 |
-
|
| 9678 |
-
|
| 9679 |
-
|
| 9680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9681 |
|
| 9682 |
-
|
| 9683 |
-
|
| 9684 |
-
|
| 9685 |
-
|
| 9686 |
-
|
| 9687 |
-
|
| 9688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9689 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9690 |
|
| 9691 |
-
|
| 9692 |
-
|
| 9693 |
-
|
| 9694 |
-
|
|
|
|
| 9695 |
|
| 9696 |
|
| 9697 |
-
|
|
|
|
|
|
|
| 9698 |
|
| 9699 |
-
if (rootClientId === null) {
|
| 9700 |
-
return null;
|
| 9701 |
-
}
|
| 9702 |
|
| 9703 |
-
|
| 9704 |
-
|
| 9705 |
-
|
| 9706 |
-
|
| 9707 |
-
|
| 9708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9709 |
|
| 9710 |
-
|
| 9711 |
-
|
| 9712 |
-
} // Block was last in set and we're attempting to get next.
|
| 9713 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9714 |
|
| 9715 |
-
|
| 9716 |
-
|
| 9717 |
-
|
|
|
|
|
|
|
|
|
|
| 9718 |
|
|
|
|
| 9719 |
|
| 9720 |
-
return orderSet[nextIndex];
|
| 9721 |
-
}
|
| 9722 |
/**
|
| 9723 |
-
*
|
| 9724 |
-
* Defaults start to the selected block. Returns null if there is no previous
|
| 9725 |
-
* block.
|
| 9726 |
*
|
| 9727 |
-
* @param {
|
| 9728 |
-
*
|
| 9729 |
-
*
|
| 9730 |
*
|
| 9731 |
-
* @return {
|
| 9732 |
*/
|
| 9733 |
|
| 9734 |
-
function
|
| 9735 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9736 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9737 |
/**
|
| 9738 |
-
*
|
| 9739 |
-
* Defaults start to the selected block. Returns null if there is no next
|
| 9740 |
-
* block.
|
| 9741 |
-
*
|
| 9742 |
-
* @param {Object} state Editor state.
|
| 9743 |
-
* @param {?string} startClientId Optional client ID of block from which to
|
| 9744 |
-
* search.
|
| 9745 |
-
*
|
| 9746 |
-
* @return {?string} Adjacent block's client ID, or null if none exists.
|
| 9747 |
*/
|
| 9748 |
|
| 9749 |
-
|
| 9750 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9751 |
}
|
| 9752 |
/**
|
| 9753 |
-
*
|
| 9754 |
-
* This position is to used to position the caret properly when the selected block changes.
|
| 9755 |
-
* If the current block is not a RichText, having initial position set to 0 means "focus block"
|
| 9756 |
-
*
|
| 9757 |
-
* @param {Object} state Global application state.
|
| 9758 |
-
*
|
| 9759 |
-
* @return {0|-1|null} Initial position.
|
| 9760 |
*/
|
| 9761 |
|
| 9762 |
-
|
| 9763 |
-
|
| 9764 |
-
}
|
| 9765 |
/**
|
| 9766 |
-
*
|
| 9767 |
-
*
|
| 9768 |
-
* @param {Object} state Editor state.
|
| 9769 |
-
*
|
| 9770 |
-
* @return {Array} Multi-selected block client IDs.
|
| 9771 |
*/
|
| 9772 |
|
| 9773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9774 |
const {
|
| 9775 |
-
|
| 9776 |
-
|
| 9777 |
-
} =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9778 |
|
| 9779 |
-
|
| 9780 |
-
|
| 9781 |
-
|
| 9782 |
|
| 9783 |
-
|
| 9784 |
-
|
| 9785 |
-
|
| 9786 |
-
|
| 9787 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9789 |
|
| 9790 |
-
|
|
|
|
|
|
|
| 9791 |
|
| 9792 |
-
|
| 9793 |
-
return EMPTY_ARRAY;
|
| 9794 |
-
}
|
| 9795 |
|
| 9796 |
-
|
| 9797 |
-
|
| 9798 |
-
|
| 9799 |
|
| 9800 |
-
if (startIndex > endIndex) {
|
| 9801 |
-
return blockOrder.slice(endIndex, startIndex + 1);
|
| 9802 |
-
}
|
| 9803 |
|
| 9804 |
-
|
| 9805 |
-
|
| 9806 |
-
|
| 9807 |
-
|
| 9808 |
-
* array if there is no multi-selection.
|
| 9809 |
-
*
|
| 9810 |
-
* @param {Object} state Editor state.
|
| 9811 |
-
*
|
| 9812 |
-
* @return {Array} Multi-selected block client IDs.
|
| 9813 |
-
*/
|
| 9814 |
|
| 9815 |
-
|
| 9816 |
-
const {
|
| 9817 |
-
selectionStart,
|
| 9818 |
-
selectionEnd
|
| 9819 |
-
} = state.selection;
|
| 9820 |
|
| 9821 |
-
|
| 9822 |
-
|
| 9823 |
-
}
|
| 9824 |
|
| 9825 |
-
|
| 9826 |
-
|
| 9827 |
-
|
| 9828 |
-
|
| 9829 |
-
|
| 9830 |
-
*
|
| 9831 |
-
* @param {Object} state Editor state.
|
| 9832 |
-
*
|
| 9833 |
-
* @return {Array} Multi-selected block objects.
|
| 9834 |
-
*/
|
| 9835 |
|
| 9836 |
-
|
| 9837 |
-
|
|
|
|
| 9838 |
|
| 9839 |
-
|
| 9840 |
-
|
| 9841 |
-
}
|
| 9842 |
|
| 9843 |
-
|
| 9844 |
-
|
| 9845 |
-
|
| 9846 |
-
|
| 9847 |
-
|
| 9848 |
-
|
| 9849 |
-
|
| 9850 |
-
|
| 9851 |
-
|
| 9852 |
-
|
| 9853 |
|
| 9854 |
-
function selectors_getFirstMultiSelectedBlockClientId(state) {
|
| 9855 |
-
return Object(external_lodash_["first"])(selectors_getMultiSelectedBlockClientIds(state)) || null;
|
| 9856 |
-
}
|
| 9857 |
-
/**
|
| 9858 |
-
* Returns the client ID of the last block in the multi-selection set, or null
|
| 9859 |
-
* if there is no multi-selection.
|
| 9860 |
-
*
|
| 9861 |
-
* @param {Object} state Editor state.
|
| 9862 |
-
*
|
| 9863 |
-
* @return {?string} Last block client ID in the multi-selection set.
|
| 9864 |
-
*/
|
| 9865 |
|
| 9866 |
-
function selectors_getLastMultiSelectedBlockClientId(state) {
|
| 9867 |
-
return Object(external_lodash_["last"])(selectors_getMultiSelectedBlockClientIds(state)) || null;
|
| 9868 |
-
}
|
| 9869 |
-
/**
|
| 9870 |
-
* Returns true if a multi-selection exists, and the block corresponding to the
|
| 9871 |
-
* specified client ID is the first block of the multi-selection set, or false
|
| 9872 |
-
* otherwise.
|
| 9873 |
-
*
|
| 9874 |
-
* @param {Object} state Editor state.
|
| 9875 |
-
* @param {string} clientId Block client ID.
|
| 9876 |
-
*
|
| 9877 |
-
* @return {boolean} Whether block is first in multi-selection.
|
| 9878 |
-
*/
|
| 9879 |
|
| 9880 |
-
function selectors_isFirstMultiSelectedBlock(state, clientId) {
|
| 9881 |
-
return selectors_getFirstMultiSelectedBlockClientId(state) === clientId;
|
| 9882 |
-
}
|
| 9883 |
/**
|
| 9884 |
-
*
|
| 9885 |
-
* false otherwise.
|
| 9886 |
-
*
|
| 9887 |
-
* @param {Object} state Editor state.
|
| 9888 |
-
* @param {string} clientId Block client ID.
|
| 9889 |
-
*
|
| 9890 |
-
* @return {boolean} Whether block is in multi-selection set.
|
| 9891 |
*/
|
| 9892 |
|
| 9893 |
-
function selectors_isBlockMultiSelected(state, clientId) {
|
| 9894 |
-
return selectors_getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1;
|
| 9895 |
-
}
|
| 9896 |
/**
|
| 9897 |
-
*
|
| 9898 |
-
* otherwise.
|
| 9899 |
-
*
|
| 9900 |
-
* @param {Object} state Editor state.
|
| 9901 |
-
* @param {string} clientId Block client ID.
|
| 9902 |
-
*
|
| 9903 |
-
* @return {boolean} Whether an ancestor of the block is in multi-selection
|
| 9904 |
-
* set.
|
| 9905 |
*/
|
| 9906 |
|
| 9907 |
-
const selectors_isAncestorMultiSelected = Object(rememo["a" /* default */])((state, clientId) => {
|
| 9908 |
-
let ancestorClientId = clientId;
|
| 9909 |
-
let isMultiSelected = false;
|
| 9910 |
|
| 9911 |
-
while (ancestorClientId && !isMultiSelected) {
|
| 9912 |
-
ancestorClientId = selectors_getBlockRootClientId(state, ancestorClientId);
|
| 9913 |
-
isMultiSelected = selectors_isBlockMultiSelected(state, ancestorClientId);
|
| 9914 |
-
}
|
| 9915 |
|
| 9916 |
-
|
| 9917 |
-
}, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
|
| 9918 |
/**
|
| 9919 |
-
*
|
| 9920 |
-
* null if there is no multi-selection.
|
| 9921 |
-
*
|
| 9922 |
-
* This is not necessarily the first client ID in the selection.
|
| 9923 |
-
*
|
| 9924 |
-
* @see getFirstMultiSelectedBlockClientId
|
| 9925 |
-
*
|
| 9926 |
-
* @param {Object} state Editor state.
|
| 9927 |
-
*
|
| 9928 |
-
* @return {?string} Client ID of block beginning multi-selection.
|
| 9929 |
*/
|
| 9930 |
|
| 9931 |
-
function selectors_getMultiSelectedBlocksStartClientId(state) {
|
| 9932 |
-
const {
|
| 9933 |
-
selectionStart,
|
| 9934 |
-
selectionEnd
|
| 9935 |
-
} = state.selection;
|
| 9936 |
|
| 9937 |
-
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 9938 |
-
return null;
|
| 9939 |
-
}
|
| 9940 |
|
| 9941 |
-
|
| 9942 |
-
}
|
| 9943 |
/**
|
| 9944 |
-
*
|
| 9945 |
-
* null if there is no multi-selection.
|
| 9946 |
-
*
|
| 9947 |
-
* This is not necessarily the last client ID in the selection.
|
| 9948 |
-
*
|
| 9949 |
-
* @see getLastMultiSelectedBlockClientId
|
| 9950 |
*
|
| 9951 |
-
* @param {Object}
|
| 9952 |
*
|
| 9953 |
-
* @return {
|
| 9954 |
*/
|
| 9955 |
|
| 9956 |
-
function
|
| 9957 |
const {
|
| 9958 |
-
|
| 9959 |
-
|
| 9960 |
-
|
| 9961 |
-
|
| 9962 |
-
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 9963 |
-
return null;
|
| 9964 |
-
}
|
| 9965 |
-
|
| 9966 |
-
return selectionEnd.clientId || null;
|
| 9967 |
}
|
| 9968 |
-
/**
|
| 9969 |
-
* Returns an array containing all block client IDs in the editor in the order
|
| 9970 |
-
* they appear. Optionally accepts a root client ID of the block list for which
|
| 9971 |
-
* the order should be returned, defaulting to the top-level block order.
|
| 9972 |
-
*
|
| 9973 |
-
* @param {Object} state Editor state.
|
| 9974 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 9975 |
-
*
|
| 9976 |
-
* @return {Array} Ordered client IDs of editor blocks.
|
| 9977 |
-
*/
|
| 9978 |
|
| 9979 |
-
function
|
| 9980 |
-
|
| 9981 |
-
|
| 9982 |
-
|
| 9983 |
-
|
| 9984 |
-
|
| 9985 |
-
|
| 9986 |
-
|
| 9987 |
-
|
| 9988 |
-
|
| 9989 |
-
|
| 9990 |
-
|
| 9991 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9992 |
|
| 9993 |
-
|
| 9994 |
-
|
| 9995 |
-
|
| 9996 |
-
|
| 9997 |
-
|
| 9998 |
-
|
| 9999 |
-
|
| 10000 |
-
* @param {Object} state Editor state.
|
| 10001 |
-
* @param {string} clientId Block client ID.
|
| 10002 |
-
*
|
| 10003 |
-
* @return {boolean} Whether block is selected and multi-selection exists.
|
| 10004 |
-
*/
|
| 10005 |
|
| 10006 |
-
|
| 10007 |
-
|
| 10008 |
-
|
| 10009 |
-
|
| 10010 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10011 |
|
| 10012 |
-
|
| 10013 |
-
|
| 10014 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10015 |
|
| 10016 |
-
|
| 10017 |
-
}
|
| 10018 |
-
|
| 10019 |
-
|
| 10020 |
-
|
| 10021 |
-
|
| 10022 |
-
* @param {string} clientId Block client ID.
|
| 10023 |
-
* @param {boolean} deep Perform a deep check.
|
| 10024 |
-
*
|
| 10025 |
-
* @return {boolean} Whether the block as an inner block selected
|
| 10026 |
-
*/
|
| 10027 |
|
| 10028 |
-
|
| 10029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10030 |
}
|
| 10031 |
-
/**
|
| 10032 |
-
* Returns true if the block corresponding to the specified client ID is
|
| 10033 |
-
* currently selected but isn't the last of the selected blocks. Here "last"
|
| 10034 |
-
* refers to the block sequence in the document, _not_ the sequence of
|
| 10035 |
-
* multi-selection, which is why `state.selectionEnd` isn't used.
|
| 10036 |
-
*
|
| 10037 |
-
* @param {Object} state Editor state.
|
| 10038 |
-
* @param {string} clientId Block client ID.
|
| 10039 |
-
*
|
| 10040 |
-
* @return {boolean} Whether block is selected and not the last in the
|
| 10041 |
-
* selection.
|
| 10042 |
-
*/
|
| 10043 |
|
| 10044 |
-
|
| 10045 |
-
|
| 10046 |
-
|
| 10047 |
-
|
| 10048 |
|
| 10049 |
-
|
| 10050 |
-
|
| 10051 |
-
return index > -1 && index < clientIds.length - 1;
|
| 10052 |
-
}
|
| 10053 |
-
/**
|
| 10054 |
-
* Returns true if a multi-selection has been made, or false otherwise.
|
| 10055 |
-
*
|
| 10056 |
-
* @param {Object} state Editor state.
|
| 10057 |
-
*
|
| 10058 |
-
* @return {boolean} Whether multi-selection has been made.
|
| 10059 |
-
*/
|
| 10060 |
|
| 10061 |
-
|
| 10062 |
-
const {
|
| 10063 |
-
selectionStart,
|
| 10064 |
-
selectionEnd
|
| 10065 |
-
} = state.selection;
|
| 10066 |
-
return selectionStart.clientId !== selectionEnd.clientId;
|
| 10067 |
-
}
|
| 10068 |
-
/**
|
| 10069 |
-
* Whether in the process of multi-selecting or not. This flag is only true
|
| 10070 |
-
* while the multi-selection is being selected (by mouse move), and is false
|
| 10071 |
-
* once the multi-selection has been settled.
|
| 10072 |
-
*
|
| 10073 |
-
* @see hasMultiSelection
|
| 10074 |
-
*
|
| 10075 |
-
* @param {Object} state Global application state.
|
| 10076 |
-
*
|
| 10077 |
-
* @return {boolean} True if multi-selecting, false if not.
|
| 10078 |
-
*/
|
| 10079 |
|
| 10080 |
-
function selectors_isMultiSelecting(state) {
|
| 10081 |
-
return state.isMultiSelecting;
|
| 10082 |
-
}
|
| 10083 |
-
/**
|
| 10084 |
-
* Selector that returns if multi-selection is enabled or not.
|
| 10085 |
-
*
|
| 10086 |
-
* @param {Object} state Global application state.
|
| 10087 |
-
*
|
| 10088 |
-
* @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled.
|
| 10089 |
-
*/
|
| 10090 |
|
| 10091 |
-
function selectors_isSelectionEnabled(state) {
|
| 10092 |
-
return state.isSelectionEnabled;
|
| 10093 |
-
}
|
| 10094 |
/**
|
| 10095 |
-
*
|
| 10096 |
-
* assigned.
|
| 10097 |
-
*
|
| 10098 |
-
* @param {Object} state Editor state.
|
| 10099 |
-
* @param {string} clientId Block client ID.
|
| 10100 |
-
*
|
| 10101 |
-
* @return {Object} Block editing mode.
|
| 10102 |
*/
|
| 10103 |
|
| 10104 |
-
function selectors_getBlockMode(state, clientId) {
|
| 10105 |
-
return state.blocksMode[clientId] || 'visual';
|
| 10106 |
-
}
|
| 10107 |
/**
|
| 10108 |
-
*
|
| 10109 |
-
*
|
| 10110 |
-
* @param {Object} state Global application state.
|
| 10111 |
-
*
|
| 10112 |
-
* @return {boolean} Whether user is typing.
|
| 10113 |
*/
|
| 10114 |
|
| 10115 |
-
function selectors_isTyping(state) {
|
| 10116 |
-
return state.isTyping;
|
| 10117 |
-
}
|
| 10118 |
-
/**
|
| 10119 |
-
* Returns true if the user is dragging blocks, or false otherwise.
|
| 10120 |
-
*
|
| 10121 |
-
* @param {Object} state Global application state.
|
| 10122 |
-
*
|
| 10123 |
-
* @return {boolean} Whether user is dragging blocks.
|
| 10124 |
-
*/
|
| 10125 |
|
| 10126 |
-
function selectors_isDraggingBlocks(state) {
|
| 10127 |
-
return !!state.draggedBlocks.length;
|
| 10128 |
-
}
|
| 10129 |
-
/**
|
| 10130 |
-
* Returns the client ids of any blocks being directly dragged.
|
| 10131 |
-
*
|
| 10132 |
-
* This does not include children of a parent being dragged.
|
| 10133 |
-
*
|
| 10134 |
-
* @param {Object} state Global application state.
|
| 10135 |
-
*
|
| 10136 |
-
* @return {string[]} Array of dragged block client ids.
|
| 10137 |
-
*/
|
| 10138 |
|
| 10139 |
-
function selectors_getDraggedBlockClientIds(state) {
|
| 10140 |
-
return state.draggedBlocks;
|
| 10141 |
-
}
|
| 10142 |
-
/**
|
| 10143 |
-
* Returns whether the block is being dragged.
|
| 10144 |
-
*
|
| 10145 |
-
* Only returns true if the block is being directly dragged,
|
| 10146 |
-
* not if the block is a child of a parent being dragged.
|
| 10147 |
-
* See `isAncestorBeingDragged` for child blocks.
|
| 10148 |
-
*
|
| 10149 |
-
* @param {Object} state Global application state.
|
| 10150 |
-
* @param {string} clientId Client id for block to check.
|
| 10151 |
-
*
|
| 10152 |
-
* @return {boolean} Whether the block is being dragged.
|
| 10153 |
-
*/
|
| 10154 |
|
| 10155 |
-
function
|
| 10156 |
-
|
| 10157 |
-
}
|
| 10158 |
-
/**
|
| 10159 |
-
* Returns whether a parent/ancestor of the block is being dragged.
|
| 10160 |
-
*
|
| 10161 |
-
* @param {Object} state Global application state.
|
| 10162 |
-
* @param {string} clientId Client id for block to check.
|
| 10163 |
-
*
|
| 10164 |
-
* @return {boolean} Whether the block's ancestor is being dragged.
|
| 10165 |
-
*/
|
| 10166 |
|
| 10167 |
-
|
| 10168 |
-
|
| 10169 |
-
// the more expensive check for parents.
|
| 10170 |
-
if (!selectors_isDraggingBlocks(state)) {
|
| 10171 |
-
return false;
|
| 10172 |
}
|
| 10173 |
|
| 10174 |
-
|
| 10175 |
-
return Object(external_lodash_["some"])(parents, parentClientId => selectors_isBlockBeingDragged(state, parentClientId));
|
| 10176 |
}
|
| 10177 |
-
/**
|
| 10178 |
-
* Returns true if the caret is within formatted text, or false otherwise.
|
| 10179 |
-
*
|
| 10180 |
-
* @param {Object} state Global application state.
|
| 10181 |
-
*
|
| 10182 |
-
* @return {boolean} Whether the caret is within formatted text.
|
| 10183 |
-
*/
|
| 10184 |
|
| 10185 |
-
function
|
| 10186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10187 |
}
|
| 10188 |
-
/**
|
| 10189 |
-
* Returns the insertion point, the index at which the new inserted block would
|
| 10190 |
-
* be placed. Defaults to the last index.
|
| 10191 |
-
*
|
| 10192 |
-
* @param {Object} state Editor state.
|
| 10193 |
-
*
|
| 10194 |
-
* @return {Object} Insertion point object with `rootClientId`, `index`.
|
| 10195 |
-
*/
|
| 10196 |
|
| 10197 |
-
|
| 10198 |
-
|
| 10199 |
-
const {
|
| 10200 |
-
insertionPoint,
|
| 10201 |
-
selection: {
|
| 10202 |
-
selectionEnd
|
| 10203 |
-
}
|
| 10204 |
-
} = state;
|
| 10205 |
|
| 10206 |
-
|
| 10207 |
-
|
| 10208 |
-
|
| 10209 |
|
| 10210 |
-
|
| 10211 |
-
|
| 10212 |
-
|
|
|
|
|
|
|
| 10213 |
|
| 10214 |
-
if (clientId) {
|
| 10215 |
-
rootClientId = selectors_getBlockRootClientId(state, clientId) || undefined;
|
| 10216 |
-
index = selectors_getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1;
|
| 10217 |
-
} else {
|
| 10218 |
-
index = selectors_getBlockOrder(state).length;
|
| 10219 |
-
}
|
| 10220 |
|
| 10221 |
-
return {
|
| 10222 |
-
rootClientId,
|
| 10223 |
-
index
|
| 10224 |
-
};
|
| 10225 |
-
}
|
| 10226 |
/**
|
| 10227 |
-
*
|
| 10228 |
-
*
|
| 10229 |
-
* @param {Object} state Global application state.
|
| 10230 |
-
*
|
| 10231 |
-
* @return {?boolean} Whether the insertion point is visible or not.
|
| 10232 |
*/
|
| 10233 |
|
| 10234 |
-
|
| 10235 |
-
|
| 10236 |
-
|
| 10237 |
-
|
| 10238 |
-
|
| 10239 |
-
|
| 10240 |
-
|
| 10241 |
-
|
| 10242 |
-
*/
|
| 10243 |
|
| 10244 |
-
|
| 10245 |
-
|
| 10246 |
-
|
| 10247 |
-
|
| 10248 |
-
|
| 10249 |
-
|
| 10250 |
-
|
| 10251 |
-
|
| 10252 |
-
|
| 10253 |
-
|
|
|
|
|
|
|
| 10254 |
|
| 10255 |
-
|
| 10256 |
-
return state.settings.template;
|
| 10257 |
-
}
|
| 10258 |
-
/**
|
| 10259 |
-
* Returns the defined block template lock. Optionally accepts a root block
|
| 10260 |
-
* client ID as context, otherwise defaulting to the global context.
|
| 10261 |
-
*
|
| 10262 |
-
* @param {Object} state Editor state.
|
| 10263 |
-
* @param {?string} rootClientId Optional block root client ID.
|
| 10264 |
-
*
|
| 10265 |
-
* @return {?string} Block Template Lock
|
| 10266 |
-
*/
|
| 10267 |
|
| 10268 |
-
function selectors_getTemplateLock(state, rootClientId) {
|
| 10269 |
-
if (!rootClientId) {
|
| 10270 |
-
return state.settings.templateLock;
|
| 10271 |
-
}
|
| 10272 |
|
| 10273 |
-
|
| 10274 |
|
| 10275 |
-
|
| 10276 |
-
return null;
|
| 10277 |
-
}
|
| 10278 |
|
| 10279 |
-
|
| 10280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10281 |
|
| 10282 |
-
|
| 10283 |
-
|
| 10284 |
-
|
| 10285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10286 |
|
| 10287 |
-
|
| 10288 |
-
|
| 10289 |
-
// the following check should be changed to something like:
|
| 10290 |
-
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
|
| 10291 |
-
if (list.includes('core/post-content') && item === null) {
|
| 10292 |
-
return true;
|
| 10293 |
}
|
| 10294 |
|
| 10295 |
-
|
| 10296 |
-
|
| 10297 |
-
|
| 10298 |
-
return defaultResult;
|
| 10299 |
-
};
|
| 10300 |
-
/**
|
| 10301 |
-
* Determines if the given block type is allowed to be inserted into the block list.
|
| 10302 |
-
* This function is not exported and not memoized because using a memoized selector
|
| 10303 |
-
* inside another memoized selector is just a waste of time.
|
| 10304 |
-
*
|
| 10305 |
-
* @param {Object} state Editor state.
|
| 10306 |
-
* @param {string|Object} blockName The block type object, e.g., the response
|
| 10307 |
-
* from the block directory; or a string name of
|
| 10308 |
-
* an installed block type, e.g.' core/paragraph'.
|
| 10309 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10310 |
-
*
|
| 10311 |
-
* @return {boolean} Whether the given block type is allowed to be inserted.
|
| 10312 |
-
*/
|
| 10313 |
-
|
| 10314 |
-
|
| 10315 |
-
const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => {
|
| 10316 |
-
let blockType;
|
| 10317 |
|
| 10318 |
-
|
| 10319 |
-
blockType = blockName;
|
| 10320 |
-
blockName = blockType.name;
|
| 10321 |
-
} else {
|
| 10322 |
-
blockType = Object(external_wp_blocks_["getBlockType"])(blockName);
|
| 10323 |
}
|
| 10324 |
-
|
| 10325 |
-
|
| 10326 |
-
|
|
|
|
| 10327 |
}
|
| 10328 |
|
| 10329 |
-
|
| 10330 |
-
|
| 10331 |
-
|
| 10332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10333 |
|
| 10334 |
-
|
| 10335 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10336 |
}
|
| 10337 |
|
| 10338 |
-
|
|
|
|
| 10339 |
|
| 10340 |
-
|
| 10341 |
-
|
| 10342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10343 |
|
| 10344 |
-
|
| 10345 |
-
|
| 10346 |
|
| 10347 |
-
|
| 10348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10349 |
}
|
| 10350 |
|
| 10351 |
-
|
| 10352 |
-
|
| 10353 |
-
const blockAllowedParentBlocks = blockType.parent;
|
| 10354 |
-
const parentName = selectors_getBlockName(state, rootClientId);
|
| 10355 |
-
const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName);
|
| 10356 |
|
| 10357 |
-
|
| 10358 |
-
|
| 10359 |
-
|
| 10360 |
-
|
| 10361 |
-
|
| 10362 |
-
|
| 10363 |
}
|
| 10364 |
|
| 10365 |
-
|
| 10366 |
-
};
|
| 10367 |
-
/**
|
| 10368 |
-
* Determines if the given block type is allowed to be inserted into the block list.
|
| 10369 |
-
*
|
| 10370 |
-
* @param {Object} state Editor state.
|
| 10371 |
-
* @param {string} blockName The name of the block type, e.g.' core/paragraph'.
|
| 10372 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10373 |
-
*
|
| 10374 |
-
* @return {boolean} Whether the given block type is allowed to be inserted.
|
| 10375 |
-
*/
|
| 10376 |
|
|
|
|
|
|
|
|
|
|
| 10377 |
|
| 10378 |
-
|
| 10379 |
-
|
| 10380 |
-
|
| 10381 |
-
* list.
|
| 10382 |
-
*
|
| 10383 |
-
* @param {Object} state Editor state.
|
| 10384 |
-
* @param {string} clientIds The block client IDs to be inserted.
|
| 10385 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10386 |
-
*
|
| 10387 |
-
* @return {boolean} Whether the given blocks are allowed to be inserted.
|
| 10388 |
-
*/
|
| 10389 |
|
| 10390 |
-
function
|
| 10391 |
-
return clientIds.every(id => selectors_canInsertBlockType(state, selectors_getBlockName(state, id), rootClientId));
|
| 10392 |
-
}
|
| 10393 |
-
/**
|
| 10394 |
-
* Returns information about how recently and frequently a block has been inserted.
|
| 10395 |
-
*
|
| 10396 |
-
* @param {Object} state Global application state.
|
| 10397 |
-
* @param {string} id A string which identifies the insert, e.g. 'core/block/12'
|
| 10398 |
-
*
|
| 10399 |
-
* @return {?{ time: number, count: number }} An object containing `time` which is when the last
|
| 10400 |
-
* insert occurred as a UNIX epoch, and `count` which is
|
| 10401 |
-
* the number of inserts that have occurred.
|
| 10402 |
-
*/
|
| 10403 |
|
| 10404 |
-
function
|
| 10405 |
-
var _state$preferences$in, _state$preferences$in2;
|
| 10406 |
|
| 10407 |
-
|
| 10408 |
-
|
| 10409 |
-
|
| 10410 |
-
* Returns whether we can show a block type in the inserter
|
| 10411 |
-
*
|
| 10412 |
-
* @param {Object} state Global State
|
| 10413 |
-
* @param {Object} blockType BlockType
|
| 10414 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10415 |
-
*
|
| 10416 |
-
* @return {boolean} Whether the given block type is allowed to be shown in the inserter.
|
| 10417 |
-
*/
|
| 10418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10419 |
|
| 10420 |
-
|
| 10421 |
-
|
| 10422 |
-
|
| 10423 |
-
|
|
|
|
| 10424 |
|
| 10425 |
-
return
|
| 10426 |
-
};
|
| 10427 |
-
|
| 10428 |
-
|
| 10429 |
-
|
| 10430 |
-
|
| 10431 |
-
* @param {Object} item Denormalized inserter item
|
| 10432 |
-
* @return {Function} Function to transform a block variation to inserter item
|
| 10433 |
-
*/
|
| 10434 |
|
|
|
|
|
|
|
| 10435 |
|
| 10436 |
-
|
| 10437 |
-
|
| 10438 |
-
|
| 10439 |
-
time,
|
| 10440 |
-
count = 0
|
| 10441 |
-
} = getInsertUsage(state, variationId) || {};
|
| 10442 |
-
return { ...item,
|
| 10443 |
-
id: variationId,
|
| 10444 |
-
icon: variation.icon || item.icon,
|
| 10445 |
-
title: variation.title || item.title,
|
| 10446 |
-
description: variation.description || item.description,
|
| 10447 |
-
category: variation.category || item.category,
|
| 10448 |
-
// If `example` is explicitly undefined for the variation, the preview will not be shown.
|
| 10449 |
-
example: variation.hasOwnProperty('example') ? variation.example : item.example,
|
| 10450 |
-
initialAttributes: { ...item.initialAttributes,
|
| 10451 |
-
...variation.attributes
|
| 10452 |
-
},
|
| 10453 |
-
innerBlocks: variation.innerBlocks,
|
| 10454 |
-
keywords: variation.keywords || item.keywords,
|
| 10455 |
-
frecency: calculateFrecency(time, count)
|
| 10456 |
-
};
|
| 10457 |
-
};
|
| 10458 |
-
/**
|
| 10459 |
-
* Returns the calculated frecency.
|
| 10460 |
-
*
|
| 10461 |
-
* 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 10462 |
-
* that combines block usage frequenty and recency.
|
| 10463 |
-
*
|
| 10464 |
-
* @param {number} time When the last insert occurred as a UNIX epoch
|
| 10465 |
-
* @param {number} count The number of inserts that have occurred.
|
| 10466 |
-
*
|
| 10467 |
-
* @return {number} The calculated frecency.
|
| 10468 |
-
*/
|
| 10469 |
|
|
|
|
|
|
|
| 10470 |
|
| 10471 |
-
|
| 10472 |
-
|
| 10473 |
-
|
| 10474 |
-
|
| 10475 |
-
|
| 10476 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10477 |
|
| 10478 |
-
|
|
|
|
| 10479 |
|
| 10480 |
-
|
| 10481 |
-
|
| 10482 |
-
|
|
|
|
|
|
|
|
|
|
| 10483 |
|
| 10484 |
-
|
| 10485 |
-
|
| 10486 |
|
| 10487 |
-
|
| 10488 |
-
|
|
|
|
| 10489 |
|
| 10490 |
-
|
| 10491 |
-
|
| 10492 |
-
}
|
| 10493 |
-
};
|
| 10494 |
-
/**
|
| 10495 |
-
* Returns a function that accepts a block type and builds an item to be shown
|
| 10496 |
-
* in a specific context. It's used for building items for Inserter and available
|
| 10497 |
-
* block Transfroms list.
|
| 10498 |
-
*
|
| 10499 |
-
* @param {Object} state Editor state.
|
| 10500 |
-
* @param {Object} options Options object for handling the building of a block type.
|
| 10501 |
-
* @param {string} options.buildScope The scope for which the item is going to be used.
|
| 10502 |
-
* @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list).
|
| 10503 |
-
*/
|
| 10504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10505 |
|
| 10506 |
-
|
| 10507 |
-
|
| 10508 |
-
|
| 10509 |
-
|
| 10510 |
-
|
| 10511 |
|
| 10512 |
-
|
| 10513 |
-
isDisabled = Object(external_lodash_["some"])(selectors_getBlocksByClientId(state, getClientIdsWithDescendants(state)), {
|
| 10514 |
-
name: blockType.name
|
| 10515 |
-
});
|
| 10516 |
}
|
| 10517 |
|
| 10518 |
-
|
| 10519 |
-
time,
|
| 10520 |
-
count = 0
|
| 10521 |
-
} = getInsertUsage(state, id) || {};
|
| 10522 |
-
const blockItemBase = {
|
| 10523 |
-
id,
|
| 10524 |
-
name: blockType.name,
|
| 10525 |
-
title: blockType.title,
|
| 10526 |
-
icon: blockType.icon,
|
| 10527 |
-
isDisabled,
|
| 10528 |
-
frecency: calculateFrecency(time, count)
|
| 10529 |
-
};
|
| 10530 |
-
if (buildScope === 'transform') return blockItemBase;
|
| 10531 |
-
const inserterVariations = blockType.variations.filter(({
|
| 10532 |
-
scope
|
| 10533 |
-
}) => !scope || scope.includes('inserter'));
|
| 10534 |
-
return { ...blockItemBase,
|
| 10535 |
-
initialAttributes: {},
|
| 10536 |
-
description: blockType.description,
|
| 10537 |
-
category: blockType.category,
|
| 10538 |
-
keywords: blockType.keywords,
|
| 10539 |
-
variations: inserterVariations,
|
| 10540 |
-
example: blockType.example,
|
| 10541 |
-
utility: 1 // deprecated
|
| 10542 |
-
|
| 10543 |
-
};
|
| 10544 |
-
};
|
| 10545 |
-
/**
|
| 10546 |
-
* Determines the items that appear in the inserter. Includes both static
|
| 10547 |
-
* items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
|
| 10548 |
-
*
|
| 10549 |
-
* Each item object contains what's necessary to display a button in the
|
| 10550 |
-
* inserter and handle its selection.
|
| 10551 |
-
*
|
| 10552 |
-
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 10553 |
-
* that combines block usage frequenty and recency.
|
| 10554 |
-
*
|
| 10555 |
-
* Items are returned ordered descendingly by their 'utility' and 'frecency'.
|
| 10556 |
-
*
|
| 10557 |
-
* @param {Object} state Editor state.
|
| 10558 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10559 |
-
*
|
| 10560 |
-
* @return {WPEditorInserterItem[]} Items that appear in inserter.
|
| 10561 |
-
*
|
| 10562 |
-
* @typedef {Object} WPEditorInserterItem
|
| 10563 |
-
* @property {string} id Unique identifier for the item.
|
| 10564 |
-
* @property {string} name The type of block to create.
|
| 10565 |
-
* @property {Object} initialAttributes Attributes to pass to the newly created block.
|
| 10566 |
-
* @property {string} title Title of the item, as it appears in the inserter.
|
| 10567 |
-
* @property {string} icon Dashicon for the item, as it appears in the inserter.
|
| 10568 |
-
* @property {string} category Block category that the item is associated with.
|
| 10569 |
-
* @property {string[]} keywords Keywords that can be searched to find this item.
|
| 10570 |
-
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
|
| 10571 |
-
* this item.
|
| 10572 |
-
* @property {number} frecency Heuristic that combines frequency and recency.
|
| 10573 |
-
*/
|
| 10574 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10575 |
|
| 10576 |
-
|
| 10577 |
-
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
|
| 10578 |
-
buildScope: 'inserter'
|
| 10579 |
-
});
|
| 10580 |
|
| 10581 |
-
|
| 10582 |
-
|
|
|
|
|
|
|
|
|
|
| 10583 |
|
| 10584 |
-
|
|
|
|
| 10585 |
|
| 10586 |
-
|
|
|
|
|
|
|
| 10587 |
|
| 10588 |
-
|
| 10589 |
-
|
| 10590 |
-
}
|
| 10591 |
|
| 10592 |
-
|
| 10593 |
-
|
| 10594 |
-
|
| 10595 |
-
|
| 10596 |
-
|
| 10597 |
-
return {
|
| 10598 |
-
id,
|
| 10599 |
-
name: 'core/block',
|
| 10600 |
-
initialAttributes: {
|
| 10601 |
-
ref: reusableBlock.id
|
| 10602 |
-
},
|
| 10603 |
-
title: reusableBlock.title.raw,
|
| 10604 |
-
icon: referencedBlockType ? referencedBlockType.icon : templateIcon,
|
| 10605 |
-
category: 'reusable',
|
| 10606 |
-
keywords: [],
|
| 10607 |
-
isDisabled: false,
|
| 10608 |
-
utility: 1,
|
| 10609 |
-
// deprecated
|
| 10610 |
-
frecency
|
| 10611 |
-
};
|
| 10612 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10613 |
|
| 10614 |
-
|
| 10615 |
-
|
| 10616 |
-
|
| 10617 |
-
|
| 10618 |
-
|
| 10619 |
-
|
| 10620 |
-
|
| 10621 |
-
|
| 10622 |
-
|
| 10623 |
-
|
| 10624 |
-
|
| 10625 |
-
|
| 10626 |
-
|
| 10627 |
-
|
| 10628 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10629 |
|
| 10630 |
-
|
| 10631 |
-
|
| 10632 |
-
|
| 10633 |
-
}
|
| 10634 |
-
} // Prioritize core blocks's display in inserter.
|
| 10635 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10636 |
|
| 10637 |
-
|
| 10638 |
-
|
| 10639 |
-
const firstIsCoreBlock = a.name.startsWith(coreBlockNamePrefix);
|
| 10640 |
-
const secondIsCoreBlock = b.name.startsWith(coreBlockNamePrefix);
|
| 10641 |
|
| 10642 |
-
|
| 10643 |
-
|
| 10644 |
-
}
|
|
|
|
|
|
|
|
|
|
| 10645 |
|
| 10646 |
-
|
| 10647 |
-
}; // Ensure core blocks are prioritized in the returned results,
|
| 10648 |
-
// because third party blocks can be registered earlier than
|
| 10649 |
-
// the core blocks (usually by using the `init` action),
|
| 10650 |
-
// thus affecting the display order.
|
| 10651 |
-
// We don't sort reusable blocks as they are handled differently.
|
| 10652 |
|
|
|
|
|
|
|
| 10653 |
|
| 10654 |
-
|
| 10655 |
-
|
| 10656 |
-
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]);
|
| 10657 |
-
/**
|
| 10658 |
-
* Determines the items that appear in the available block transforms list.
|
| 10659 |
-
*
|
| 10660 |
-
* Each item object contains what's necessary to display a menu item in the
|
| 10661 |
-
* transform list and handle its selection.
|
| 10662 |
-
*
|
| 10663 |
-
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 10664 |
-
* that combines block usage frequenty and recency.
|
| 10665 |
-
*
|
| 10666 |
-
* Items are returned ordered descendingly by their 'frecency'.
|
| 10667 |
-
*
|
| 10668 |
-
* @param {Object} state Editor state.
|
| 10669 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10670 |
-
*
|
| 10671 |
-
* @return {WPEditorTransformItem[]} Items that appear in inserter.
|
| 10672 |
-
*
|
| 10673 |
-
* @typedef {Object} WPEditorTransformItem
|
| 10674 |
-
* @property {string} id Unique identifier for the item.
|
| 10675 |
-
* @property {string} name The type of block to create.
|
| 10676 |
-
* @property {string} title Title of the item, as it appears in the inserter.
|
| 10677 |
-
* @property {string} icon Dashicon for the item, as it appears in the inserter.
|
| 10678 |
-
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
|
| 10679 |
-
* this item.
|
| 10680 |
-
* @property {number} frecency Heuristic that combines frequency and recency.
|
| 10681 |
-
*/
|
| 10682 |
|
| 10683 |
-
|
| 10684 |
-
|
| 10685 |
-
|
| 10686 |
-
|
| 10687 |
-
|
| 10688 |
-
|
| 10689 |
-
|
| 10690 |
-
|
| 10691 |
-
const possibleTransforms = Object(external_wp_blocks_["getPossibleBlockTransformations"])(blocks).reduce((accumulator, block) => {
|
| 10692 |
-
if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) {
|
| 10693 |
-
accumulator.push(itemsByName[block.name]);
|
| 10694 |
-
}
|
| 10695 |
|
| 10696 |
-
|
| 10697 |
-
|
| 10698 |
-
|
| 10699 |
-
|
| 10700 |
-
}
|
| 10701 |
-
|
| 10702 |
-
* Determines whether there are items to show in the inserter.
|
| 10703 |
-
*
|
| 10704 |
-
* @param {Object} state Editor state.
|
| 10705 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10706 |
-
*
|
| 10707 |
-
* @return {boolean} Items that appear in inserter.
|
| 10708 |
-
*/
|
| 10709 |
|
| 10710 |
-
|
| 10711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10712 |
|
| 10713 |
-
|
| 10714 |
-
|
| 10715 |
-
|
|
|
|
| 10716 |
|
| 10717 |
-
|
| 10718 |
-
|
| 10719 |
-
|
| 10720 |
-
|
| 10721 |
-
|
| 10722 |
-
|
| 10723 |
-
|
| 10724 |
-
|
| 10725 |
-
*
|
| 10726 |
-
* @return {Array?} The list of allowed block types.
|
| 10727 |
-
*/
|
| 10728 |
|
| 10729 |
-
|
| 10730 |
-
|
| 10731 |
-
return;
|
| 10732 |
-
}
|
| 10733 |
|
| 10734 |
-
|
| 10735 |
-
|
|
|
|
| 10736 |
|
| 10737 |
-
|
| 10738 |
-
|
| 10739 |
-
return allowedBlockTypes;
|
| 10740 |
-
}
|
| 10741 |
|
| 10742 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10743 |
|
| 10744 |
-
|
| 10745 |
-
var
|
| 10746 |
|
| 10747 |
-
|
| 10748 |
-
|
|
|
|
|
|
|
| 10749 |
|
| 10750 |
-
|
| 10751 |
-
|
| 10752 |
-
}
|
| 10753 |
|
| 10754 |
-
|
| 10755 |
-
|
| 10756 |
-
|
| 10757 |
-
|
|
|
|
|
|
|
|
|
|
| 10758 |
|
| 10759 |
-
|
| 10760 |
-
|
|
|
|
|
|
|
|
|
|
| 10761 |
|
| 10762 |
-
const __experimentalGetParsedPattern = Object(rememo["a" /* default */])((state, patternName) => {
|
| 10763 |
-
const patterns = state.settings.__experimentalBlockPatterns;
|
| 10764 |
-
const pattern = patterns.find(({
|
| 10765 |
-
name
|
| 10766 |
-
}) => name === patternName);
|
| 10767 |
|
| 10768 |
-
|
| 10769 |
-
|
| 10770 |
-
|
|
|
|
|
|
|
| 10771 |
|
| 10772 |
-
|
| 10773 |
-
|
| 10774 |
-
|
| 10775 |
-
|
| 10776 |
-
|
| 10777 |
-
|
| 10778 |
-
|
| 10779 |
-
|
| 10780 |
-
|
| 10781 |
-
|
| 10782 |
-
|
| 10783 |
-
|
| 10784 |
-
|
| 10785 |
-
blocks
|
| 10786 |
-
}) => checkAllowListRecursive(blocks, allowedBlockTypes));
|
| 10787 |
-
return allowedPatterns;
|
| 10788 |
-
}, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]);
|
| 10789 |
-
/**
|
| 10790 |
-
* Returns the list of allowed patterns for inner blocks children.
|
| 10791 |
-
*
|
| 10792 |
-
* @param {Object} state Editor state.
|
| 10793 |
-
* @param {?string} rootClientId Optional target root client ID.
|
| 10794 |
-
*
|
| 10795 |
-
* @return {Array?} The list of allowed patterns.
|
| 10796 |
-
*/
|
| 10797 |
|
| 10798 |
-
|
| 10799 |
-
const availableParsedPatterns = getAllAllowedPatterns(state);
|
| 10800 |
-
const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, ({
|
| 10801 |
-
blocks
|
| 10802 |
-
}) => blocks.every(({
|
| 10803 |
-
name
|
| 10804 |
-
}) => selectors_canInsertBlockType(state, name, rootClientId)));
|
| 10805 |
-
return patternsAllowed;
|
| 10806 |
-
}, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId]]);
|
| 10807 |
-
/**
|
| 10808 |
-
* Returns the list of patterns based on their declared `blockTypes`
|
| 10809 |
-
* and a block's name.
|
| 10810 |
-
* Patterns can use `blockTypes` to integrate in work flows like
|
| 10811 |
-
* suggesting appropriate patterns in a Placeholder state(during insertion)
|
| 10812 |
-
* or blocks transformations.
|
| 10813 |
-
*
|
| 10814 |
-
* @param {Object} state Editor state.
|
| 10815 |
-
* @param {string|string[]} blockNames Block's name or array of block names to find matching pattens.
|
| 10816 |
-
* @param {?string} rootClientId Optional target root client ID.
|
| 10817 |
-
*
|
| 10818 |
-
* @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
|
| 10819 |
-
*/
|
| 10820 |
|
| 10821 |
-
|
| 10822 |
-
if (!blockNames) return EMPTY_ARRAY;
|
| 10823 |
|
| 10824 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10825 |
|
| 10826 |
-
const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
|
| 10827 |
-
return patterns.filter(pattern => {
|
| 10828 |
-
var _pattern$blockTypes, _pattern$blockTypes$s;
|
| 10829 |
|
| 10830 |
-
|
| 10831 |
-
|
| 10832 |
-
|
| 10833 |
-
|
| 10834 |
-
|
| 10835 |
-
|
| 10836 |
-
|
| 10837 |
-
* the `__experimentalRole` property of blocks' attributes for the transformation.
|
| 10838 |
-
*
|
| 10839 |
-
* We return the first set of possible eligible block patterns,
|
| 10840 |
-
* by checking the `blockTypes` property. We still have to recurse through
|
| 10841 |
-
* block pattern's blocks and try to find matches from the selected blocks.
|
| 10842 |
-
* Now this happens in the consumer to avoid heavy operations in the selector.
|
| 10843 |
-
*
|
| 10844 |
-
* @param {Object} state Editor state.
|
| 10845 |
-
* @param {Object[]} blocks The selected blocks.
|
| 10846 |
-
* @param {?string} rootClientId Optional root client ID of block list.
|
| 10847 |
-
*
|
| 10848 |
-
* @return {WPBlockPattern[]} Items that are eligible for a pattern transformation.
|
| 10849 |
-
*/
|
| 10850 |
|
| 10851 |
-
const selectors_experimentalGetPatternTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => {
|
| 10852 |
-
if (!blocks) return EMPTY_ARRAY;
|
| 10853 |
-
/**
|
| 10854 |
-
* For now we only handle blocks without InnerBlocks and take into account
|
| 10855 |
-
* the `__experimentalRole` property of blocks' attributes for the transformation.
|
| 10856 |
-
* Note that the blocks have been retrieved through `getBlock`, which doesn't
|
| 10857 |
-
* return the inner blocks of an inner block controller, so we still need
|
| 10858 |
-
* to check for this case too.
|
| 10859 |
-
*/
|
| 10860 |
|
| 10861 |
-
|
| 10862 |
-
clientId,
|
| 10863 |
-
innerBlocks
|
| 10864 |
-
}) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) {
|
| 10865 |
-
return EMPTY_ARRAY;
|
| 10866 |
-
} // Create a Set of the selected block names that is used in patterns filtering.
|
| 10867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10868 |
|
| 10869 |
-
|
| 10870 |
-
|
| 10871 |
-
|
| 10872 |
-
/**
|
| 10873 |
-
* Here we will return first set of possible eligible block patterns,
|
| 10874 |
-
* by checking the `blockTypes` property. We still have to recurse through
|
| 10875 |
-
* block pattern's blocks and try to find matches from the selected blocks.
|
| 10876 |
-
* Now this happens in the consumer to avoid heavy operations in the selector.
|
| 10877 |
-
*/
|
| 10878 |
|
| 10879 |
-
return selectors_experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId);
|
| 10880 |
-
}, (state, rootClientId) => [...selectors_experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]);
|
| 10881 |
-
/**
|
| 10882 |
-
* Returns the Block List settings of a block, if any exist.
|
| 10883 |
-
*
|
| 10884 |
-
* @param {Object} state Editor state.
|
| 10885 |
-
* @param {?string} clientId Block client ID.
|
| 10886 |
-
*
|
| 10887 |
-
* @return {?Object} Block settings of the block if set.
|
| 10888 |
-
*/
|
| 10889 |
|
| 10890 |
-
|
| 10891 |
-
|
| 10892 |
-
}
|
| 10893 |
-
/**
|
| 10894 |
-
* Returns the editor settings.
|
| 10895 |
-
*
|
| 10896 |
-
* @param {Object} state Editor state.
|
| 10897 |
-
*
|
| 10898 |
-
* @return {Object} The editor settings object.
|
| 10899 |
-
*/
|
| 10900 |
|
| 10901 |
-
function selectors_getSettings(state) {
|
| 10902 |
-
return state.settings;
|
| 10903 |
-
}
|
| 10904 |
-
/**
|
| 10905 |
-
* Returns true if the most recent block change is be considered persistent, or
|
| 10906 |
-
* false otherwise. A persistent change is one committed by BlockEditorProvider
|
| 10907 |
-
* via its `onChange` callback, in addition to `onInput`.
|
| 10908 |
-
*
|
| 10909 |
-
* @param {Object} state Block editor state.
|
| 10910 |
-
*
|
| 10911 |
-
* @return {boolean} Whether the most recent block change was persistent.
|
| 10912 |
-
*/
|
| 10913 |
|
| 10914 |
-
|
| 10915 |
-
return state.blocks.isPersistentChange;
|
| 10916 |
-
}
|
| 10917 |
-
/**
|
| 10918 |
-
* Returns the block list settings for an array of blocks, if any exist.
|
| 10919 |
-
*
|
| 10920 |
-
* @param {Object} state Editor state.
|
| 10921 |
-
* @param {Array} clientIds Block client IDs.
|
| 10922 |
-
*
|
| 10923 |
-
* @return {Object} An object where the keys are client ids and the values are
|
| 10924 |
-
* a block list setting object.
|
| 10925 |
-
*/
|
| 10926 |
|
| 10927 |
-
|
| 10928 |
-
|
| 10929 |
-
|
| 10930 |
-
return blockListSettingsForBlocks;
|
| 10931 |
}
|
|
|
|
| 10932 |
|
| 10933 |
-
return { ...blockListSettingsForBlocks,
|
| 10934 |
-
[clientId]: state.blockListSettings[clientId]
|
| 10935 |
-
};
|
| 10936 |
-
}, {});
|
| 10937 |
-
}, state => [state.blockListSettings]);
|
| 10938 |
-
/**
|
| 10939 |
-
* Returns the parsed block saved as shared block with the given ID.
|
| 10940 |
-
*
|
| 10941 |
-
* @param {Object} state Global application state.
|
| 10942 |
-
* @param {number|string} ref The shared block's ID.
|
| 10943 |
-
*
|
| 10944 |
-
* @return {Object} The parsed block.
|
| 10945 |
-
*/
|
| 10946 |
|
| 10947 |
-
|
| 10948 |
-
|
|
|
|
|
|
|
|
|
|
| 10949 |
|
| 10950 |
-
|
| 10951 |
-
|
| 10952 |
-
} // Only reusableBlock.content.raw should be used here, `reusableBlock.content` is a
|
| 10953 |
-
// workaround until #22127 is fixed.
|
| 10954 |
|
|
|
|
|
|
|
| 10955 |
|
| 10956 |
-
|
| 10957 |
-
|
| 10958 |
-
|
| 10959 |
-
|
| 10960 |
-
|
| 10961 |
-
* @param {Object} state Global application state.
|
| 10962 |
-
* @param {number|string} ref The shared block's ID.
|
| 10963 |
-
*
|
| 10964 |
-
* @return {string} The reusable block saved title.
|
| 10965 |
-
*/
|
| 10966 |
|
| 10967 |
-
|
| 10968 |
-
|
|
|
|
| 10969 |
|
| 10970 |
-
|
|
|
|
|
|
|
|
|
|
| 10971 |
|
| 10972 |
-
if (
|
| 10973 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10974 |
}
|
| 10975 |
|
| 10976 |
-
|
| 10977 |
-
|
| 10978 |
-
|
| 10979 |
-
* Returns true if the most recent block change is be considered ignored, or
|
| 10980 |
-
* false otherwise. An ignored change is one not to be committed by
|
| 10981 |
-
* BlockEditorProvider, neither via `onChange` nor `onInput`.
|
| 10982 |
-
*
|
| 10983 |
-
* @param {Object} state Block editor state.
|
| 10984 |
-
*
|
| 10985 |
-
* @return {boolean} Whether the most recent block change was ignored.
|
| 10986 |
-
*/
|
| 10987 |
|
| 10988 |
-
|
| 10989 |
-
|
| 10990 |
-
|
| 10991 |
-
|
| 10992 |
-
|
| 10993 |
-
// their own separate block editor / state (#7119).
|
| 10994 |
-
return state.blocks.isIgnoredChange;
|
| 10995 |
-
}
|
| 10996 |
-
/**
|
| 10997 |
-
* Returns the block attributes changed as a result of the last dispatched
|
| 10998 |
-
* action.
|
| 10999 |
-
*
|
| 11000 |
-
* @param {Object} state Block editor state.
|
| 11001 |
-
*
|
| 11002 |
-
* @return {Object<string,Object>} Subsets of block attributes changed, keyed
|
| 11003 |
-
* by block client ID.
|
| 11004 |
-
*/
|
| 11005 |
|
| 11006 |
-
function
|
| 11007 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11008 |
}
|
| 11009 |
-
/**
|
| 11010 |
-
* Returns the available reusable blocks
|
| 11011 |
-
*
|
| 11012 |
-
* @param {Object} state Global application state.
|
| 11013 |
-
*
|
| 11014 |
-
* @return {Array} Reusable blocks
|
| 11015 |
-
*/
|
| 11016 |
|
| 11017 |
-
function
|
| 11018 |
-
var
|
| 11019 |
|
| 11020 |
-
|
| 11021 |
-
|
| 11022 |
-
|
| 11023 |
-
* Returns whether the navigation mode is enabled.
|
| 11024 |
-
*
|
| 11025 |
-
* @param {Object} state Editor state.
|
| 11026 |
-
*
|
| 11027 |
-
* @return {boolean} Is navigation mode enabled.
|
| 11028 |
-
*/
|
| 11029 |
|
|
|
|
|
|
|
|
|
|
| 11030 |
|
| 11031 |
-
|
| 11032 |
-
return
|
| 11033 |
-
}
|
| 11034 |
-
/**
|
| 11035 |
-
* Returns whether block moving mode is enabled.
|
| 11036 |
-
*
|
| 11037 |
-
* @param {Object} state Editor state.
|
| 11038 |
-
*
|
| 11039 |
-
* @return {string} Client Id of moving block.
|
| 11040 |
-
*/
|
| 11041 |
|
| 11042 |
-
|
| 11043 |
-
return state.hasBlockMovingClientId;
|
| 11044 |
-
}
|
| 11045 |
-
/**
|
| 11046 |
-
* Returns true if the last change was an automatic change, false otherwise.
|
| 11047 |
-
*
|
| 11048 |
-
* @param {Object} state Global application state.
|
| 11049 |
-
*
|
| 11050 |
-
* @return {boolean} Whether the last change was automatic.
|
| 11051 |
-
*/
|
| 11052 |
|
| 11053 |
-
|
| 11054 |
-
return !!state.automaticChangeStatus;
|
| 11055 |
-
}
|
| 11056 |
-
/**
|
| 11057 |
-
* Returns true if the current highlighted block matches the block clientId.
|
| 11058 |
-
*
|
| 11059 |
-
* @param {Object} state Global application state.
|
| 11060 |
-
* @param {string} clientId The block to check.
|
| 11061 |
-
*
|
| 11062 |
-
* @return {boolean} Whether the block is currently highlighted.
|
| 11063 |
-
*/
|
| 11064 |
|
| 11065 |
-
|
| 11066 |
-
return
|
| 11067 |
}
|
| 11068 |
-
/**
|
| 11069 |
-
* Checks if a given block has controlled inner blocks.
|
| 11070 |
-
*
|
| 11071 |
-
* @param {Object} state Global application state.
|
| 11072 |
-
* @param {string} clientId The block to check.
|
| 11073 |
-
*
|
| 11074 |
-
* @return {boolean} True if the block has controlled inner blocks.
|
| 11075 |
-
*/
|
| 11076 |
|
| 11077 |
-
function
|
| 11078 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11079 |
}
|
| 11080 |
-
/**
|
| 11081 |
-
* Returns the clientId for the first 'active' block of a given array of block names.
|
| 11082 |
-
* A block is 'active' if it (or a child) is the selected block.
|
| 11083 |
-
* Returns the first match moving up the DOM from the selected block.
|
| 11084 |
-
*
|
| 11085 |
-
* @param {Object} state Global application state.
|
| 11086 |
-
* @param {string[]} validBlocksNames The names of block types to check for.
|
| 11087 |
-
*
|
| 11088 |
-
* @return {string} The matching block's clientId.
|
| 11089 |
-
*/
|
| 11090 |
|
| 11091 |
-
|
| 11092 |
-
|
| 11093 |
-
|
| 11094 |
-
|
| 11095 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11096 |
|
| 11097 |
-
|
| 11098 |
|
| 11099 |
-
|
| 11100 |
-
return
|
| 11101 |
-
|
|
|
|
|
|
|
| 11102 |
|
|
|
|
|
|
|
|
|
|
| 11103 |
|
| 11104 |
-
|
| 11105 |
-
|
|
|
|
| 11106 |
|
| 11107 |
-
|
| 11108 |
-
|
| 11109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11110 |
}
|
|
|
|
| 11111 |
|
| 11112 |
-
|
| 11113 |
-
|
| 11114 |
-
/**
|
| 11115 |
-
* Tells if the block with the passed clientId was just inserted.
|
| 11116 |
-
*
|
| 11117 |
-
* @param {Object} state Global application state.
|
| 11118 |
-
* @param {Object} clientId Client Id of the block.
|
| 11119 |
-
* @param {?string} source Optional insertion source of the block.
|
| 11120 |
-
* @return {boolean} True if the block matches the last block inserted from the specified source.
|
| 11121 |
*/
|
| 11122 |
|
| 11123 |
-
function
|
| 11124 |
-
|
| 11125 |
-
|
| 11126 |
-
}
|
| 11127 |
-
return lastBlockInserted.clientId === clientId && lastBlockInserted.source === source;
|
| 11128 |
-
}
|
| 11129 |
-
//# sourceMappingURL=selectors.js.map
|
| 11130 |
-
// EXTERNAL MODULE: external ["wp","a11y"]
|
| 11131 |
-
var external_wp_a11y_ = __webpack_require__(30);
|
| 11132 |
|
| 11133 |
-
|
| 11134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11135 |
|
| 11136 |
-
|
| 11137 |
-
var
|
| 11138 |
-
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
|
| 11139 |
|
| 11140 |
-
|
| 11141 |
-
|
| 11142 |
-
|
| 11143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11144 |
|
| 11145 |
/**
|
| 11146 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11147 |
*/
|
| 11148 |
-
|
| 11149 |
-
|
| 11150 |
-
|
| 11151 |
-
|
| 11152 |
-
|
| 11153 |
-
|
| 11154 |
-
};
|
| 11155 |
-
const controls_controls = {
|
| 11156 |
-
SLEEP({
|
| 11157 |
-
duration
|
| 11158 |
-
}) {
|
| 11159 |
-
return new Promise(resolve => {
|
| 11160 |
-
setTimeout(resolve, duration);
|
| 11161 |
});
|
| 11162 |
-
}
|
|
|
|
| 11163 |
|
| 11164 |
-
|
| 11165 |
-
|
| 11166 |
-
|
| 11167 |
-
|
| 11168 |
-
requestIdleCallback(() => registry.dispatch(store).__unstableMarkAutomaticChangeFinal());
|
| 11169 |
-
})
|
| 11170 |
-
};
|
| 11171 |
-
/* harmony default export */ var store_controls = (controls_controls);
|
| 11172 |
-
//# sourceMappingURL=controls.js.map
|
| 11173 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/constants.js
|
| 11174 |
-
const STORE_NAME = 'core/block-editor';
|
| 11175 |
-
//# sourceMappingURL=constants.js.map
|
| 11176 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/actions.js
|
| 11177 |
-
/**
|
| 11178 |
-
* External dependencies
|
| 11179 |
-
*/
|
| 11180 |
|
| 11181 |
-
|
| 11182 |
-
|
| 11183 |
-
*/
|
| 11184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11186 |
|
|
|
|
|
|
|
|
|
|
| 11187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11188 |
|
|
|
|
| 11189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11190 |
|
| 11191 |
-
|
| 11192 |
-
|
| 11193 |
-
|
|
|
|
| 11194 |
|
|
|
|
|
|
|
|
|
|
| 11195 |
|
|
|
|
|
|
|
|
|
|
| 11196 |
|
| 11197 |
-
|
| 11198 |
-
|
| 11199 |
-
|
| 11200 |
-
* in actions which may result in no blocks remaining in the editor (removal,
|
| 11201 |
-
* replacement, etc).
|
| 11202 |
-
*/
|
| 11203 |
|
| 11204 |
-
|
| 11205 |
-
|
| 11206 |
-
// always a default block if the last of the blocks have been removed.
|
| 11207 |
|
| 11208 |
-
|
| 11209 |
-
|
| 11210 |
-
|
| 11211 |
-
|
| 11212 |
-
// We have to remember to manually move the focus elsewhere to
|
| 11213 |
-
// prevent it from being lost though.
|
| 11214 |
|
| 11215 |
-
|
| 11216 |
-
|
| 11217 |
-
}
|
| 11218 |
|
| 11219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11220 |
}
|
| 11221 |
-
}
|
| 11222 |
-
/**
|
| 11223 |
-
* Returns an action object used in signalling that blocks state should be
|
| 11224 |
-
* reset to the specified array of blocks, taking precedence over any other
|
| 11225 |
-
* content reflected as an edit in state.
|
| 11226 |
-
*
|
| 11227 |
-
* @param {Array} blocks Array of blocks.
|
| 11228 |
-
*/
|
| 11229 |
|
|
|
|
| 11230 |
|
| 11231 |
-
function
|
| 11232 |
-
|
| 11233 |
-
|
| 11234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11235 |
};
|
| 11236 |
-
return yield* validateBlocksToTemplate(blocks);
|
| 11237 |
-
}
|
| 11238 |
-
/**
|
| 11239 |
-
* Block validity is a function of blocks state (at the point of a
|
| 11240 |
-
* reset) and the template setting. As a compromise to its placement
|
| 11241 |
-
* across distinct parts of state, it is implemented here as a side-
|
| 11242 |
-
* effect of the block reset action.
|
| 11243 |
-
*
|
| 11244 |
-
* @param {Array} blocks Array of blocks.
|
| 11245 |
-
*/
|
| 11246 |
|
| 11247 |
-
function
|
| 11248 |
-
|
| 11249 |
-
|
| 11250 |
-
|
|
|
|
| 11251 |
|
| 11252 |
-
|
|
|
|
|
|
|
| 11253 |
|
| 11254 |
-
|
|
|
|
| 11255 |
|
| 11256 |
-
|
| 11257 |
-
yield setTemplateValidity(isBlocksValidToTemplate);
|
| 11258 |
-
return isBlocksValidToTemplate;
|
| 11259 |
-
}
|
| 11260 |
-
}
|
| 11261 |
-
/**
|
| 11262 |
-
* A block selection object.
|
| 11263 |
-
*
|
| 11264 |
-
* @typedef {Object} WPBlockSelection
|
| 11265 |
-
*
|
| 11266 |
-
* @property {string} clientId A block client ID.
|
| 11267 |
-
* @property {string} attributeKey A block attribute key.
|
| 11268 |
-
* @property {number} offset An attribute value offset, based on the rich
|
| 11269 |
-
* text value. See `wp.richText.create`.
|
| 11270 |
-
*/
|
| 11271 |
|
| 11272 |
-
|
| 11273 |
-
|
| 11274 |
-
|
| 11275 |
-
|
| 11276 |
-
|
| 11277 |
-
* @param {WPBlockSelection} selectionEnd The selection end.
|
| 11278 |
-
* @param {0|-1|null} initialPosition Initial block position.
|
| 11279 |
-
*
|
| 11280 |
-
* @return {Object} Action object.
|
| 11281 |
-
*/
|
| 11282 |
|
| 11283 |
-
|
| 11284 |
-
|
| 11285 |
-
|
| 11286 |
-
|
| 11287 |
-
|
| 11288 |
-
|
| 11289 |
-
|
| 11290 |
-
}
|
| 11291 |
-
|
| 11292 |
-
|
| 11293 |
-
|
| 11294 |
-
|
| 11295 |
-
|
| 11296 |
-
|
| 11297 |
-
*
|
| 11298 |
-
* @return {Object} Action object.
|
| 11299 |
-
*/
|
| 11300 |
|
| 11301 |
-
function
|
| 11302 |
-
|
| 11303 |
-
|
| 11304 |
-
blocks
|
| 11305 |
-
};
|
| 11306 |
-
}
|
| 11307 |
-
/**
|
| 11308 |
-
* Returns an action object used in signalling that the multiple blocks'
|
| 11309 |
-
* attributes with the specified client IDs have been updated.
|
| 11310 |
-
*
|
| 11311 |
-
* @param {string|string[]} clientIds Block client IDs.
|
| 11312 |
-
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
| 11313 |
-
* uniqueByBlock is true.
|
| 11314 |
-
* @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes
|
| 11315 |
-
* @return {Object} Action object.
|
| 11316 |
-
*/
|
| 11317 |
|
| 11318 |
-
|
| 11319 |
-
|
| 11320 |
-
|
| 11321 |
-
|
| 11322 |
-
|
| 11323 |
-
uniqueByBlock
|
| 11324 |
-
};
|
| 11325 |
-
}
|
| 11326 |
-
/**
|
| 11327 |
-
* Returns an action object used in signalling that the block with the
|
| 11328 |
-
* specified client ID has been updated.
|
| 11329 |
-
*
|
| 11330 |
-
* @param {string} clientId Block client ID.
|
| 11331 |
-
* @param {Object} updates Block attributes to be merged.
|
| 11332 |
-
*
|
| 11333 |
-
* @return {Object} Action object.
|
| 11334 |
-
*/
|
| 11335 |
|
| 11336 |
-
function actions_updateBlock(clientId, updates) {
|
| 11337 |
-
return {
|
| 11338 |
-
type: 'UPDATE_BLOCK',
|
| 11339 |
-
clientId,
|
| 11340 |
-
updates
|
| 11341 |
-
};
|
| 11342 |
-
}
|
| 11343 |
-
/**
|
| 11344 |
-
* Returns an action object used in signalling that the block with the
|
| 11345 |
-
* specified client ID has been selected, optionally accepting a position
|
| 11346 |
-
* value reflecting its selection directionality. An initialPosition of -1
|
| 11347 |
-
* reflects a reverse selection.
|
| 11348 |
-
*
|
| 11349 |
-
* @param {string} clientId Block client ID.
|
| 11350 |
-
* @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to
|
| 11351 |
-
* reflect reverse selection.
|
| 11352 |
-
*
|
| 11353 |
-
* @return {Object} Action object.
|
| 11354 |
-
*/
|
| 11355 |
|
| 11356 |
-
|
| 11357 |
-
return {
|
| 11358 |
-
type: 'SELECT_BLOCK',
|
| 11359 |
-
initialPosition,
|
| 11360 |
-
clientId
|
| 11361 |
-
};
|
| 11362 |
-
}
|
| 11363 |
-
/**
|
| 11364 |
-
* Yields action objects used in signalling that the block preceding the given
|
| 11365 |
-
* clientId should be selected.
|
| 11366 |
-
*
|
| 11367 |
-
* @param {string} clientId Block client ID.
|
| 11368 |
-
*/
|
| 11369 |
|
| 11370 |
-
function
|
| 11371 |
-
|
|
|
|
| 11372 |
|
| 11373 |
-
|
| 11374 |
-
|
| 11375 |
-
|
| 11376 |
-
|
| 11377 |
-
|
| 11378 |
-
/**
|
| 11379 |
-
* Yields action objects used in signalling that the block following the given
|
| 11380 |
-
* clientId should be selected.
|
| 11381 |
-
*
|
| 11382 |
-
* @param {string} clientId Block client ID.
|
| 11383 |
-
*/
|
| 11384 |
|
| 11385 |
-
|
| 11386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11387 |
|
| 11388 |
-
|
| 11389 |
-
|
| 11390 |
-
return [nextBlockClientId];
|
| 11391 |
-
}
|
| 11392 |
-
}
|
| 11393 |
-
/**
|
| 11394 |
-
* Returns an action object used in signalling that a block multi-selection has started.
|
| 11395 |
-
*
|
| 11396 |
-
* @return {Object} Action object.
|
| 11397 |
-
*/
|
| 11398 |
|
| 11399 |
-
|
| 11400 |
-
|
| 11401 |
-
|
| 11402 |
-
|
| 11403 |
-
}
|
| 11404 |
-
/**
|
| 11405 |
-
* Returns an action object used in signalling that block multi-selection stopped.
|
| 11406 |
-
*
|
| 11407 |
-
* @return {Object} Action object.
|
| 11408 |
-
*/
|
| 11409 |
|
| 11410 |
-
|
| 11411 |
-
|
| 11412 |
-
|
| 11413 |
-
|
| 11414 |
-
}
|
| 11415 |
-
|
| 11416 |
-
|
| 11417 |
-
*
|
| 11418 |
-
* @param {string} start First block of the multi selection.
|
| 11419 |
-
* @param {string} end Last block of the multiselection.
|
| 11420 |
-
*/
|
| 11421 |
|
| 11422 |
-
function* actions_multiSelect(start, end) {
|
| 11423 |
-
const startBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', start);
|
| 11424 |
-
const endBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', end); // Only allow block multi-selections at the same level.
|
| 11425 |
|
| 11426 |
-
|
| 11427 |
-
|
| 11428 |
-
|
| 11429 |
|
| 11430 |
-
|
| 11431 |
-
|
| 11432 |
-
|
| 11433 |
-
|
| 11434 |
-
|
| 11435 |
-
|
| 11436 |
-
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["sprintf"])(
|
| 11437 |
-
/* translators: %s: number of selected blocks */
|
| 11438 |
-
Object(external_wp_i18n_["_n"])('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
| 11439 |
-
}
|
| 11440 |
-
/**
|
| 11441 |
-
* Returns an action object used in signalling that the block selection is cleared.
|
| 11442 |
-
*
|
| 11443 |
-
* @return {Object} Action object.
|
| 11444 |
-
*/
|
| 11445 |
|
| 11446 |
-
function
|
| 11447 |
-
|
| 11448 |
-
type: 'CLEAR_SELECTED_BLOCK'
|
| 11449 |
-
};
|
| 11450 |
-
}
|
| 11451 |
-
/**
|
| 11452 |
-
* Returns an action object that enables or disables block selection.
|
| 11453 |
-
*
|
| 11454 |
-
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
| 11455 |
-
* be enabled.
|
| 11456 |
-
*
|
| 11457 |
-
* @return {Object} Action object.
|
| 11458 |
-
*/
|
| 11459 |
|
| 11460 |
-
|
| 11461 |
-
|
| 11462 |
-
|
| 11463 |
-
isSelectionEnabled
|
| 11464 |
-
};
|
| 11465 |
-
}
|
| 11466 |
|
| 11467 |
-
|
| 11468 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11469 |
|
| 11470 |
-
const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings === null || blockEditorSettings === void 0 ? void 0 : (_blockEditorSettings$2 = blockEditorSettings.__experimentalPreferredStyleVariations) === null || _blockEditorSettings$2 === void 0 ? void 0 : _blockEditorSettings$2.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {};
|
| 11471 |
-
return blocks.map(block => {
|
| 11472 |
-
var _block$attributes;
|
| 11473 |
|
| 11474 |
-
|
|
|
|
|
|
|
| 11475 |
|
| 11476 |
-
|
| 11477 |
-
|
| 11478 |
-
|
| 11479 |
|
| 11480 |
-
|
| 11481 |
-
|
| 11482 |
-
|
|
|
|
|
|
|
| 11483 |
|
| 11484 |
-
|
|
|
|
| 11485 |
|
| 11486 |
-
if (className !== null && className !== void 0 && className.includes('is-style-')) {
|
| 11487 |
-
return block;
|
| 11488 |
-
}
|
| 11489 |
|
| 11490 |
-
|
| 11491 |
-
attributes = {}
|
| 11492 |
-
} = block;
|
| 11493 |
-
const blockStyle = preferredStyleVariations[blockName];
|
| 11494 |
-
return { ...block,
|
| 11495 |
-
attributes: { ...attributes,
|
| 11496 |
-
className: `${className || ''} is-style-${blockStyle}`.trim()
|
| 11497 |
-
}
|
| 11498 |
-
};
|
| 11499 |
-
});
|
| 11500 |
-
}
|
| 11501 |
-
/**
|
| 11502 |
-
* Returns an action object signalling that a blocks should be replaced with
|
| 11503 |
-
* one or more replacement blocks.
|
| 11504 |
-
*
|
| 11505 |
-
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
| 11506 |
-
* @param {(Object|Object[])} blocks Replacement block(s).
|
| 11507 |
-
* @param {number} indexToSelect Index of replacement block to select.
|
| 11508 |
-
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
| 11509 |
-
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 11510 |
-
*
|
| 11511 |
-
* @yield {Object} Action object.
|
| 11512 |
-
*/
|
| 11513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11514 |
|
| 11515 |
-
|
| 11516 |
-
|
| 11517 |
-
blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings'));
|
| 11518 |
-
const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', Object(external_lodash_["first"])(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
|
| 11519 |
|
| 11520 |
-
|
| 11521 |
-
|
| 11522 |
-
const canInsertBlock = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlockType', block.name, rootClientId);
|
| 11523 |
|
| 11524 |
-
|
| 11525 |
-
|
| 11526 |
-
|
|
|
|
|
|
|
|
|
|
| 11527 |
}
|
|
|
|
|
|
|
| 11528 |
|
| 11529 |
-
|
| 11530 |
-
|
| 11531 |
-
|
| 11532 |
-
|
| 11533 |
-
time: Date.now(),
|
| 11534 |
-
indexToSelect,
|
| 11535 |
-
initialPosition,
|
| 11536 |
-
meta
|
| 11537 |
};
|
| 11538 |
-
yield* ensureDefaultBlock();
|
| 11539 |
-
}
|
| 11540 |
-
/**
|
| 11541 |
-
* Returns an action object signalling that a single block should be replaced
|
| 11542 |
-
* with one or more replacement blocks.
|
| 11543 |
-
*
|
| 11544 |
-
* @param {(string|string[])} clientId Block client ID to replace.
|
| 11545 |
-
* @param {(Object|Object[])} block Replacement block(s).
|
| 11546 |
-
*
|
| 11547 |
-
* @return {Object} Action object.
|
| 11548 |
-
*/
|
| 11549 |
-
|
| 11550 |
-
function actions_replaceBlock(clientId, block) {
|
| 11551 |
-
return actions_replaceBlocks(clientId, block);
|
| 11552 |
-
}
|
| 11553 |
-
/**
|
| 11554 |
-
* Higher-order action creator which, given the action type to dispatch creates
|
| 11555 |
-
* an action creator for managing block movement.
|
| 11556 |
-
*
|
| 11557 |
-
* @param {string} type Action type to dispatch.
|
| 11558 |
-
*
|
| 11559 |
-
* @return {Function} Action creator.
|
| 11560 |
-
*/
|
| 11561 |
|
| 11562 |
-
function
|
| 11563 |
-
|
| 11564 |
-
return {
|
| 11565 |
-
clientIds: Object(external_lodash_["castArray"])(clientIds),
|
| 11566 |
-
type,
|
| 11567 |
-
rootClientId
|
| 11568 |
-
};
|
| 11569 |
-
};
|
| 11570 |
-
}
|
| 11571 |
|
| 11572 |
-
|
| 11573 |
-
|
| 11574 |
-
/**
|
| 11575 |
-
* Returns an action object signalling that the given blocks should be moved to
|
| 11576 |
-
* a new position.
|
| 11577 |
-
*
|
| 11578 |
-
* @param {?string} clientIds The client IDs of the blocks.
|
| 11579 |
-
* @param {?string} fromRootClientId Root client ID source.
|
| 11580 |
-
* @param {?string} toRootClientId Root client ID destination.
|
| 11581 |
-
* @param {number} index The index to move the blocks to.
|
| 11582 |
-
*
|
| 11583 |
-
* @yield {Object} Action object.
|
| 11584 |
-
*/
|
| 11585 |
|
| 11586 |
-
function
|
| 11587 |
-
|
| 11588 |
-
// it is not possible to move the block to any other position.
|
| 11589 |
|
| 11590 |
-
|
| 11591 |
-
return;
|
| 11592 |
-
}
|
| 11593 |
|
| 11594 |
-
|
| 11595 |
-
|
| 11596 |
-
|
| 11597 |
-
toRootClientId,
|
| 11598 |
-
clientIds,
|
| 11599 |
-
index
|
| 11600 |
-
}; // If moving inside the same root block the move is always possible.
|
| 11601 |
|
| 11602 |
-
|
| 11603 |
-
yield action;
|
| 11604 |
-
return;
|
| 11605 |
-
} // If templateLock is insert we can not remove the block from the parent.
|
| 11606 |
-
// Given that here we know that we are moving the block to a different
|
| 11607 |
-
// parent, the move should not be possible if the condition is true.
|
| 11608 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11609 |
|
| 11610 |
-
|
| 11611 |
-
|
| 11612 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11613 |
|
| 11614 |
-
|
|
|
|
| 11615 |
|
| 11616 |
-
|
| 11617 |
-
|
| 11618 |
-
|
| 11619 |
-
|
| 11620 |
-
|
| 11621 |
-
|
| 11622 |
-
|
| 11623 |
-
|
| 11624 |
-
|
| 11625 |
-
* @param {?string} fromRootClientId Root client ID source.
|
| 11626 |
-
* @param {?string} toRootClientId Root client ID destination.
|
| 11627 |
-
* @param {number} index The index to move the block to.
|
| 11628 |
-
*
|
| 11629 |
-
* @yield {Object} Action object.
|
| 11630 |
-
*/
|
| 11631 |
|
| 11632 |
-
|
| 11633 |
-
|
| 11634 |
-
|
| 11635 |
-
|
| 11636 |
-
|
| 11637 |
-
|
| 11638 |
-
*
|
| 11639 |
-
* @param {Object} block Block object to insert.
|
| 11640 |
-
* @param {?number} index Index at which block should be inserted.
|
| 11641 |
-
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
| 11642 |
-
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
|
| 11643 |
-
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 11644 |
-
*
|
| 11645 |
-
* @return {Object} Action object.
|
| 11646 |
-
*/
|
| 11647 |
|
| 11648 |
-
|
| 11649 |
-
|
| 11650 |
-
}
|
| 11651 |
-
/**
|
| 11652 |
-
* Returns an action object used in signalling that an array of blocks should
|
| 11653 |
-
* be inserted, optionally at a specific index respective a root block list.
|
| 11654 |
-
*
|
| 11655 |
-
* @param {Object[]} blocks Block objects to insert.
|
| 11656 |
-
* @param {?number} index Index at which block should be inserted.
|
| 11657 |
-
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
| 11658 |
-
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
|
| 11659 |
-
* @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
|
| 11660 |
-
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 11661 |
-
* @return {Object} Action object.
|
| 11662 |
-
*/
|
| 11663 |
|
| 11664 |
-
|
| 11665 |
-
|
| 11666 |
-
meta = initialPosition;
|
| 11667 |
-
initialPosition = 0;
|
| 11668 |
-
external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", {
|
| 11669 |
-
since: '10.1',
|
| 11670 |
-
plugin: 'Gutenberg',
|
| 11671 |
-
hint: 'The meta argument is now the 6th argument of the function'
|
| 11672 |
-
});
|
| 11673 |
-
}
|
| 11674 |
|
| 11675 |
-
|
| 11676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11677 |
|
| 11678 |
-
|
| 11679 |
-
|
|
|
|
|
|
|
|
|
|
| 11680 |
|
| 11681 |
-
if (isValid) {
|
| 11682 |
-
allowedBlocks.push(block);
|
| 11683 |
-
}
|
| 11684 |
-
}
|
| 11685 |
|
| 11686 |
-
|
| 11687 |
-
|
| 11688 |
-
type: 'INSERT_BLOCKS',
|
| 11689 |
-
blocks: allowedBlocks,
|
| 11690 |
-
index,
|
| 11691 |
-
rootClientId,
|
| 11692 |
-
time: Date.now(),
|
| 11693 |
-
updateSelection,
|
| 11694 |
-
initialPosition: updateSelection ? initialPosition : null,
|
| 11695 |
-
meta
|
| 11696 |
-
};
|
| 11697 |
-
}
|
| 11698 |
-
}
|
| 11699 |
-
/**
|
| 11700 |
-
* Returns an action object used in signalling that the insertion point should
|
| 11701 |
-
* be shown.
|
| 11702 |
-
*
|
| 11703 |
-
* @param {?string} rootClientId Optional root client ID of block list on
|
| 11704 |
-
* which to insert.
|
| 11705 |
-
* @param {?number} index Index at which block should be inserted.
|
| 11706 |
-
* @param {Object} __unstableOptions Wether or not to show an inserter button.
|
| 11707 |
-
*
|
| 11708 |
-
* @return {Object} Action object.
|
| 11709 |
-
*/
|
| 11710 |
|
| 11711 |
-
|
| 11712 |
-
const {
|
| 11713 |
-
__unstableWithInserter
|
| 11714 |
-
} = __unstableOptions;
|
| 11715 |
-
return {
|
| 11716 |
-
type: 'SHOW_INSERTION_POINT',
|
| 11717 |
-
rootClientId,
|
| 11718 |
-
index,
|
| 11719 |
-
__unstableWithInserter
|
| 11720 |
-
};
|
| 11721 |
-
}
|
| 11722 |
-
/**
|
| 11723 |
-
* Returns an action object hiding the insertion point.
|
| 11724 |
-
*
|
| 11725 |
-
* @return {Object} Action object.
|
| 11726 |
-
*/
|
| 11727 |
|
| 11728 |
-
function
|
| 11729 |
-
|
| 11730 |
-
|
| 11731 |
-
|
| 11732 |
-
}
|
| 11733 |
-
/**
|
| 11734 |
-
* Returns an action object resetting the template validity.
|
| 11735 |
-
*
|
| 11736 |
-
* @param {boolean} isValid template validity flag.
|
| 11737 |
-
*
|
| 11738 |
-
* @return {Object} Action object.
|
| 11739 |
-
*/
|
| 11740 |
|
| 11741 |
-
|
| 11742 |
-
|
| 11743 |
-
|
| 11744 |
-
|
| 11745 |
-
|
| 11746 |
-
|
| 11747 |
-
|
| 11748 |
-
|
| 11749 |
-
|
| 11750 |
-
|
| 11751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11752 |
|
| 11753 |
-
|
| 11754 |
-
|
| 11755 |
-
|
| 11756 |
-
|
| 11757 |
-
|
| 11758 |
-
|
| 11759 |
-
|
| 11760 |
-
|
| 11761 |
-
}
|
| 11762 |
-
/**
|
| 11763 |
-
* Returns an action object used in signalling that two blocks should be merged
|
| 11764 |
-
*
|
| 11765 |
-
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
| 11766 |
-
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
| 11767 |
-
*/
|
| 11768 |
|
| 11769 |
-
|
| 11770 |
-
|
| 11771 |
-
yield {
|
| 11772 |
-
type: 'MERGE_BLOCKS',
|
| 11773 |
-
blocks
|
| 11774 |
-
};
|
| 11775 |
-
const [clientIdA, clientIdB] = blocks;
|
| 11776 |
-
const blockA = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlock', clientIdA);
|
| 11777 |
-
const blockAType = Object(external_wp_blocks_["getBlockType"])(blockA.name); // Only focus the previous block if it's not mergeable
|
| 11778 |
|
| 11779 |
-
|
| 11780 |
-
|
| 11781 |
-
|
| 11782 |
-
|
| 11783 |
|
| 11784 |
-
|
| 11785 |
-
|
| 11786 |
-
|
| 11787 |
-
|
| 11788 |
-
attributeKey,
|
| 11789 |
-
offset
|
| 11790 |
-
} = yield external_wp_data_["controls"].select(STORE_NAME, 'getSelectionStart');
|
| 11791 |
-
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
| 11792 |
-
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
| 11793 |
-
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
| 11794 |
-
// is not a defined block attribute key. This can be the case if the
|
| 11795 |
-
// fallback intance ID is used to store selection (and no RichText
|
| 11796 |
-
// identifier is set), or when the identifier is wrong.
|
| 11797 |
-
!!attributeDefinition;
|
| 11798 |
|
| 11799 |
-
|
| 11800 |
-
|
| 11801 |
-
|
| 11802 |
-
} else {
|
| 11803 |
-
window.console.error('The RichText identifier prop does not match any attributes defined by the block.');
|
| 11804 |
-
}
|
| 11805 |
-
} // A robust way to retain selection position through various transforms
|
| 11806 |
-
// is to insert a special character at the position and then recover it.
|
| 11807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11808 |
|
| 11809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11810 |
|
| 11811 |
-
|
| 11812 |
-
|
|
|
|
| 11813 |
|
| 11814 |
-
|
| 11815 |
-
|
| 11816 |
-
|
| 11817 |
-
|
| 11818 |
-
|
| 11819 |
-
|
| 11820 |
-
|
| 11821 |
-
|
| 11822 |
-
|
| 11823 |
-
|
| 11824 |
-
|
| 11825 |
-
|
| 11826 |
-
|
| 11827 |
-
|
| 11828 |
-
|
| 11829 |
-
|
| 11830 |
-
|
| 11831 |
-
|
| 11832 |
-
|
| 11833 |
-
|
| 11834 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11835 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11836 |
|
| 11837 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11838 |
|
| 11839 |
-
|
| 11840 |
-
|
| 11841 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11842 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11843 |
|
| 11844 |
-
|
|
|
|
| 11845 |
|
| 11846 |
-
|
| 11847 |
-
|
| 11848 |
-
|
| 11849 |
-
|
| 11850 |
-
|
| 11851 |
-
|
| 11852 |
-
|
| 11853 |
-
|
| 11854 |
-
|
| 11855 |
-
|
| 11856 |
-
multilineTag,
|
| 11857 |
-
multilineWrapperTags,
|
| 11858 |
-
preserveWhiteSpace
|
| 11859 |
-
});
|
| 11860 |
-
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
| 11861 |
-
const newValue = Object(external_wp_richText_["remove"])(convertedValue, newOffset, newOffset + 1);
|
| 11862 |
-
const newHtml = Object(external_wp_richText_["toHTMLString"])({
|
| 11863 |
-
value: newValue,
|
| 11864 |
-
multilineTag,
|
| 11865 |
-
preserveWhiteSpace
|
| 11866 |
-
});
|
| 11867 |
-
updatedAttributes[newAttributeKey] = newHtml;
|
| 11868 |
-
yield actions_selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
| 11869 |
-
}
|
| 11870 |
|
| 11871 |
-
|
| 11872 |
-
|
| 11873 |
-
|
| 11874 |
-
|
| 11875 |
-
|
| 11876 |
-
}
|
| 11877 |
-
/**
|
| 11878 |
-
* Yields action objects used in signalling that the blocks corresponding to
|
| 11879 |
-
* the set of specified client IDs are to be removed.
|
| 11880 |
-
*
|
| 11881 |
-
* @param {string|string[]} clientIds Client IDs of blocks to remove.
|
| 11882 |
-
* @param {boolean} selectPrevious True if the previous block should be
|
| 11883 |
-
* selected when a block is removed.
|
| 11884 |
*/
|
| 11885 |
|
| 11886 |
-
function
|
| 11887 |
-
|
| 11888 |
-
|
| 11889 |
-
|
| 11890 |
|
| 11891 |
-
|
| 11892 |
-
|
| 11893 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11894 |
|
| 11895 |
-
|
| 11896 |
-
return
|
| 11897 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11898 |
|
| 11899 |
-
|
| 11900 |
|
| 11901 |
-
|
| 11902 |
-
|
| 11903 |
-
|
| 11904 |
-
|
| 11905 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11906 |
|
| 11907 |
-
|
| 11908 |
-
|
| 11909 |
-
|
| 11910 |
-
}; // To avoid a focus loss when removing the last block, assure there is
|
| 11911 |
-
// always a default block if the last of the blocks have been removed.
|
| 11912 |
|
| 11913 |
-
|
| 11914 |
-
|
| 11915 |
-
}
|
| 11916 |
-
/**
|
| 11917 |
-
* Returns an action object used in signalling that the block with the
|
| 11918 |
-
* specified client ID is to be removed.
|
| 11919 |
-
*
|
| 11920 |
-
* @param {string} clientId Client ID of block to remove.
|
| 11921 |
-
* @param {boolean} selectPrevious True if the previous block should be
|
| 11922 |
-
* selected when a block is removed.
|
| 11923 |
-
*
|
| 11924 |
-
* @return {Object} Action object.
|
| 11925 |
-
*/
|
| 11926 |
|
| 11927 |
-
function
|
| 11928 |
-
|
| 11929 |
-
|
| 11930 |
-
|
| 11931 |
-
|
| 11932 |
-
|
| 11933 |
-
|
| 11934 |
-
|
| 11935 |
-
* @param {Object[]} blocks Block objects to insert as new InnerBlocks
|
| 11936 |
-
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false.
|
| 11937 |
-
* @param {0|-1|null} initialPosition Initial block position.
|
| 11938 |
-
* @return {Object} Action object.
|
| 11939 |
-
*/
|
| 11940 |
|
| 11941 |
-
function
|
| 11942 |
-
|
| 11943 |
-
|
| 11944 |
-
|
| 11945 |
-
|
| 11946 |
-
|
| 11947 |
-
|
| 11948 |
-
time: Date.now()
|
| 11949 |
-
};
|
| 11950 |
-
}
|
| 11951 |
-
/**
|
| 11952 |
-
* Returns an action object used to toggle the block editing mode between
|
| 11953 |
-
* visual and HTML modes.
|
| 11954 |
-
*
|
| 11955 |
-
* @param {string} clientId Block client ID.
|
| 11956 |
-
*
|
| 11957 |
-
* @return {Object} Action object.
|
| 11958 |
-
*/
|
| 11959 |
|
| 11960 |
-
function
|
| 11961 |
-
|
| 11962 |
-
|
| 11963 |
-
|
| 11964 |
-
|
| 11965 |
-
}
|
| 11966 |
-
|
| 11967 |
-
* Returns an action object used in signalling that the user has begun to type.
|
| 11968 |
-
*
|
| 11969 |
-
* @return {Object} Action object.
|
| 11970 |
-
*/
|
| 11971 |
|
| 11972 |
-
function
|
| 11973 |
-
|
| 11974 |
-
|
| 11975 |
-
|
| 11976 |
-
|
| 11977 |
-
|
| 11978 |
-
|
| 11979 |
-
|
| 11980 |
-
|
| 11981 |
-
*/
|
| 11982 |
|
| 11983 |
-
|
| 11984 |
-
|
| 11985 |
-
|
| 11986 |
-
};
|
| 11987 |
-
}
|
| 11988 |
-
/**
|
| 11989 |
-
* Returns an action object used in signalling that the user has begun to drag blocks.
|
| 11990 |
-
*
|
| 11991 |
-
* @param {string[]} clientIds An array of client ids being dragged
|
| 11992 |
-
*
|
| 11993 |
-
* @return {Object} Action object.
|
| 11994 |
*/
|
| 11995 |
|
| 11996 |
-
|
| 11997 |
-
|
| 11998 |
-
type: 'START_DRAGGING_BLOCKS',
|
| 11999 |
-
clientIds
|
| 12000 |
-
};
|
| 12001 |
-
}
|
| 12002 |
-
/**
|
| 12003 |
-
* Returns an action object used in signalling that the user has stopped dragging blocks.
|
| 12004 |
-
*
|
| 12005 |
-
* @return {Object} Action object.
|
| 12006 |
-
*/
|
| 12007 |
|
| 12008 |
-
|
| 12009 |
-
|
| 12010 |
-
|
| 12011 |
-
|
| 12012 |
-
}
|
| 12013 |
-
/**
|
| 12014 |
-
* Returns an action object used in signalling that the caret has entered formatted text.
|
| 12015 |
-
*
|
| 12016 |
-
* @return {Object} Action object.
|
| 12017 |
-
*/
|
| 12018 |
|
| 12019 |
-
|
| 12020 |
-
|
| 12021 |
-
type: 'ENTER_FORMATTED_TEXT'
|
| 12022 |
-
};
|
| 12023 |
-
}
|
| 12024 |
-
/**
|
| 12025 |
-
* Returns an action object used in signalling that the user caret has exited formatted text.
|
| 12026 |
-
*
|
| 12027 |
-
* @return {Object} Action object.
|
| 12028 |
-
*/
|
| 12029 |
-
|
| 12030 |
-
function actions_exitFormattedText() {
|
| 12031 |
-
return {
|
| 12032 |
-
type: 'EXIT_FORMATTED_TEXT'
|
| 12033 |
-
};
|
| 12034 |
-
}
|
| 12035 |
-
/**
|
| 12036 |
-
* Returns an action object used in signalling that the user caret has changed
|
| 12037 |
-
* position.
|
| 12038 |
-
*
|
| 12039 |
-
* @param {string} clientId The selected block client ID.
|
| 12040 |
-
* @param {string} attributeKey The selected block attribute key.
|
| 12041 |
-
* @param {number} startOffset The start offset.
|
| 12042 |
-
* @param {number} endOffset The end offset.
|
| 12043 |
-
*
|
| 12044 |
-
* @return {Object} Action object.
|
| 12045 |
-
*/
|
| 12046 |
|
| 12047 |
-
|
| 12048 |
-
|
| 12049 |
-
|
| 12050 |
-
clientId,
|
| 12051 |
-
attributeKey,
|
| 12052 |
-
startOffset,
|
| 12053 |
-
endOffset
|
| 12054 |
-
};
|
| 12055 |
-
}
|
| 12056 |
-
/**
|
| 12057 |
-
* Returns an action object used in signalling that a new block of the default
|
| 12058 |
-
* type should be added to the block list.
|
| 12059 |
-
*
|
| 12060 |
-
* @param {?Object} attributes Optional attributes of the block to assign.
|
| 12061 |
-
* @param {?string} rootClientId Optional root client ID of block list on which
|
| 12062 |
-
* to append.
|
| 12063 |
-
* @param {?number} index Optional index where to insert the default block
|
| 12064 |
-
*
|
| 12065 |
-
* @return {Object} Action object
|
| 12066 |
*/
|
| 12067 |
|
| 12068 |
-
function
|
| 12069 |
-
|
| 12070 |
-
|
|
|
|
|
|
|
| 12071 |
|
| 12072 |
-
|
| 12073 |
-
|
| 12074 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12075 |
|
| 12076 |
-
const block = Object(external_wp_blocks_["createBlock"])(defaultBlockName, attributes);
|
| 12077 |
-
return actions_insertBlock(block, index, rootClientId);
|
| 12078 |
-
}
|
| 12079 |
-
/**
|
| 12080 |
-
* Returns an action object that changes the nested settings of a given block.
|
| 12081 |
-
*
|
| 12082 |
-
* @param {string} clientId Client ID of the block whose nested setting are
|
| 12083 |
-
* being received.
|
| 12084 |
-
* @param {Object} settings Object with the new settings for the nested block.
|
| 12085 |
-
*
|
| 12086 |
-
* @return {Object} Action object
|
| 12087 |
-
*/
|
| 12088 |
|
| 12089 |
-
function
|
| 12090 |
-
|
| 12091 |
-
|
| 12092 |
-
|
| 12093 |
-
|
| 12094 |
-
|
| 12095 |
-
}
|
| 12096 |
-
|
| 12097 |
-
|
| 12098 |
-
|
| 12099 |
-
|
| 12100 |
-
|
| 12101 |
-
|
| 12102 |
-
|
|
|
|
| 12103 |
|
| 12104 |
-
function
|
| 12105 |
-
|
| 12106 |
-
|
| 12107 |
-
settings
|
| 12108 |
-
};
|
| 12109 |
-
}
|
| 12110 |
-
/**
|
| 12111 |
-
* Returns an action object used in signalling that a temporary reusable blocks have been saved
|
| 12112 |
-
* in order to switch its temporary id with the real id.
|
| 12113 |
-
*
|
| 12114 |
-
* @param {string} id Reusable block's id.
|
| 12115 |
-
* @param {string} updatedId Updated block's id.
|
| 12116 |
-
*
|
| 12117 |
-
* @return {Object} Action object.
|
| 12118 |
-
*/
|
| 12119 |
|
| 12120 |
-
function
|
| 12121 |
-
|
| 12122 |
-
|
| 12123 |
-
|
| 12124 |
-
|
| 12125 |
-
};
|
| 12126 |
-
}
|
| 12127 |
-
/**
|
| 12128 |
-
* Returns an action object used in signalling that the last block change should be marked explicitly as persistent.
|
| 12129 |
-
*
|
| 12130 |
-
* @return {Object} Action object.
|
| 12131 |
-
*/
|
| 12132 |
|
| 12133 |
-
|
| 12134 |
-
|
| 12135 |
-
|
| 12136 |
-
};
|
| 12137 |
-
}
|
| 12138 |
-
/**
|
| 12139 |
-
* Returns an action object used in signalling that the next block change should be marked explicitly as not persistent.
|
| 12140 |
-
*
|
| 12141 |
-
* @return {Object} Action object.
|
| 12142 |
*/
|
| 12143 |
|
| 12144 |
-
|
| 12145 |
-
|
| 12146 |
-
|
| 12147 |
-
|
| 12148 |
-
}
|
| 12149 |
-
/**
|
| 12150 |
-
* Returns an action object used in signalling that the last block change is
|
| 12151 |
-
* an automatic change, meaning it was not performed by the user, and can be
|
| 12152 |
-
* undone using the `Escape` and `Backspace` keys. This action must be called
|
| 12153 |
-
* after the change was made, and any actions that are a consequence of it, so
|
| 12154 |
-
* it is recommended to be called at the next idle period to ensure all
|
| 12155 |
-
* selection changes have been recorded.
|
| 12156 |
-
*/
|
| 12157 |
|
| 12158 |
-
function
|
| 12159 |
-
|
| 12160 |
-
|
| 12161 |
-
};
|
| 12162 |
-
yield __unstableMarkAutomaticChangeFinalControl();
|
| 12163 |
-
}
|
| 12164 |
-
function __unstableMarkAutomaticChangeFinal() {
|
| 12165 |
-
return {
|
| 12166 |
-
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
|
| 12167 |
-
};
|
| 12168 |
-
}
|
| 12169 |
-
/**
|
| 12170 |
-
* Generators that triggers an action used to enable or disable the navigation mode.
|
| 12171 |
-
*
|
| 12172 |
-
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
| 12173 |
-
*/
|
| 12174 |
|
| 12175 |
-
|
| 12176 |
-
|
| 12177 |
-
|
| 12178 |
-
|
| 12179 |
-
|
|
|
|
|
|
|
| 12180 |
|
| 12181 |
-
|
| 12182 |
-
|
| 12183 |
-
|
| 12184 |
-
|
| 12185 |
-
}
|
| 12186 |
-
}
|
| 12187 |
-
/**
|
| 12188 |
-
* Generator that triggers an action used to enable or disable the block moving mode.
|
| 12189 |
-
*
|
| 12190 |
-
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
| 12191 |
-
*/
|
| 12192 |
|
| 12193 |
-
function
|
| 12194 |
-
|
| 12195 |
-
|
| 12196 |
-
|
| 12197 |
-
|
|
|
|
|
|
|
| 12198 |
|
| 12199 |
-
|
| 12200 |
-
|
| 12201 |
-
|
| 12202 |
-
|
| 12203 |
-
|
| 12204 |
-
|
| 12205 |
-
|
| 12206 |
-
|
| 12207 |
-
|
| 12208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12209 |
|
| 12210 |
-
|
| 12211 |
-
|
| 12212 |
-
|
| 12213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12214 |
|
| 12215 |
-
|
| 12216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12217 |
|
| 12218 |
-
|
| 12219 |
-
|
| 12220 |
-
}
|
| 12221 |
|
| 12222 |
-
|
| 12223 |
|
| 12224 |
-
if (
|
| 12225 |
-
|
| 12226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12227 |
|
| 12228 |
-
|
| 12229 |
-
const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["__experimentalCloneSanitizedBlock"])(block));
|
| 12230 |
-
yield actions_insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
|
| 12231 |
|
| 12232 |
-
|
| 12233 |
-
|
| 12234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12235 |
|
| 12236 |
-
return clonedBlocks.map(block => block.clientId);
|
| 12237 |
-
}
|
| 12238 |
-
/**
|
| 12239 |
-
* Generator used to insert an empty block after a given block.
|
| 12240 |
-
*
|
| 12241 |
-
* @param {string} clientId
|
| 12242 |
-
*/
|
| 12243 |
|
| 12244 |
-
|
| 12245 |
-
|
| 12246 |
-
|
| 12247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12248 |
|
| 12249 |
-
|
| 12250 |
-
const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId);
|
| 12251 |
|
| 12252 |
-
|
| 12253 |
-
|
|
|
|
| 12254 |
}
|
| 12255 |
|
| 12256 |
-
|
| 12257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12258 |
}
|
| 12259 |
-
/**
|
| 12260 |
-
* Generator used to insert an empty block before a given block.
|
| 12261 |
-
*
|
| 12262 |
-
* @param {string} clientId
|
| 12263 |
-
*/
|
| 12264 |
|
| 12265 |
-
function
|
| 12266 |
-
|
| 12267 |
-
return;
|
| 12268 |
-
}
|
| 12269 |
|
| 12270 |
-
|
| 12271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12272 |
|
| 12273 |
-
|
| 12274 |
-
|
| 12275 |
-
}
|
| 12276 |
|
| 12277 |
-
|
| 12278 |
-
|
| 12279 |
-
}
|
| 12280 |
-
/**
|
| 12281 |
-
* Returns an action object that toggles the highlighted block state.
|
| 12282 |
-
*
|
| 12283 |
-
* @param {string} clientId The block's clientId.
|
| 12284 |
-
* @param {boolean} isHighlighted The highlight state.
|
| 12285 |
-
*/
|
| 12286 |
|
| 12287 |
-
|
| 12288 |
-
|
| 12289 |
-
|
| 12290 |
-
|
| 12291 |
-
|
| 12292 |
};
|
| 12293 |
-
}
|
| 12294 |
-
/**
|
| 12295 |
-
* Yields action objects used in signalling that the block corresponding to the
|
| 12296 |
-
* given clientId should appear to "flash" by rhythmically highlighting it.
|
| 12297 |
-
*
|
| 12298 |
-
* @param {string} clientId Target block client ID.
|
| 12299 |
-
*/
|
| 12300 |
|
| 12301 |
-
|
| 12302 |
-
|
| 12303 |
-
yield {
|
| 12304 |
-
type: 'SLEEP',
|
| 12305 |
-
duration: 150
|
| 12306 |
-
};
|
| 12307 |
-
yield actions_toggleBlockHighlight(clientId, false);
|
| 12308 |
-
}
|
| 12309 |
-
/**
|
| 12310 |
-
* Returns an action object that sets whether the block has controlled innerblocks.
|
| 12311 |
-
*
|
| 12312 |
-
* @param {string} clientId The block's clientId.
|
| 12313 |
-
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|
| 12314 |
-
*/
|
| 12315 |
|
| 12316 |
-
|
| 12317 |
-
|
| 12318 |
-
|
| 12319 |
-
|
| 12320 |
-
|
| 12321 |
-
|
| 12322 |
}
|
| 12323 |
-
//# sourceMappingURL=actions.js.map
|
| 12324 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/index.js
|
| 12325 |
-
/**
|
| 12326 |
-
* WordPress dependencies
|
| 12327 |
-
*/
|
| 12328 |
|
| 12329 |
-
|
| 12330 |
-
|
| 12331 |
-
|
|
|
|
| 12332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12333 |
|
|
|
|
|
|
|
|
|
|
| 12334 |
|
|
|
|
| 12335 |
|
|
|
|
| 12336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12337 |
|
| 12338 |
-
|
| 12339 |
-
|
| 12340 |
-
*
|
| 12341 |
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
|
| 12342 |
-
*
|
| 12343 |
-
* @type {Object}
|
| 12344 |
-
*/
|
| 12345 |
|
| 12346 |
-
|
| 12347 |
-
|
| 12348 |
-
|
| 12349 |
-
|
| 12350 |
-
|
| 12351 |
-
|
| 12352 |
-
|
| 12353 |
-
|
| 12354 |
-
|
| 12355 |
-
|
| 12356 |
-
|
| 12357 |
-
|
| 12358 |
-
|
| 12359 |
-
|
| 12360 |
-
|
| 12361 |
-
|
| 12362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12363 |
|
| 12364 |
-
|
| 12365 |
-
|
| 12366 |
-
|
| 12367 |
-
|
| 12368 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/use-display-block-controls/index.js
|
| 12369 |
-
/**
|
| 12370 |
-
* WordPress dependencies
|
| 12371 |
-
*/
|
| 12372 |
|
| 12373 |
-
|
| 12374 |
-
|
| 12375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12378 |
|
| 12379 |
-
function
|
| 12380 |
-
|
| 12381 |
-
|
| 12382 |
-
|
| 12383 |
-
name
|
| 12384 |
-
} = useBlockEditContext();
|
| 12385 |
-
const isFirstAndSameTypeMultiSelected = Object(external_wp_data_["useSelect"])(select => {
|
| 12386 |
-
// Don't bother checking, see OR statement below.
|
| 12387 |
-
if (isSelected) {
|
| 12388 |
-
return;
|
| 12389 |
-
}
|
| 12390 |
|
| 12391 |
-
|
| 12392 |
-
getBlockName,
|
| 12393 |
-
isFirstMultiSelectedBlock,
|
| 12394 |
-
getMultiSelectedBlockClientIds
|
| 12395 |
-
} = select(store);
|
| 12396 |
|
| 12397 |
-
if (
|
| 12398 |
-
return
|
| 12399 |
-
}
|
| 12400 |
|
| 12401 |
-
|
| 12402 |
-
|
| 12403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12404 |
}
|
| 12405 |
-
//# sourceMappingURL=index.js.map
|
| 12406 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/groups.js
|
| 12407 |
-
/**
|
| 12408 |
-
* WordPress dependencies
|
| 12409 |
-
*/
|
| 12410 |
|
| 12411 |
-
|
| 12412 |
-
|
| 12413 |
-
|
| 12414 |
-
|
| 12415 |
-
const groups = {
|
| 12416 |
-
default: BlockControlsDefault,
|
| 12417 |
-
block: BlockControlsBlock,
|
| 12418 |
-
inline: BlockControlsInline,
|
| 12419 |
-
other: BlockControlsOther
|
| 12420 |
-
};
|
| 12421 |
-
/* harmony default export */ var block_controls_groups = (groups);
|
| 12422 |
-
//# sourceMappingURL=groups.js.map
|
| 12423 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/fill.js
|
| 12424 |
|
|
|
|
|
|
|
| 12425 |
|
| 12426 |
-
|
| 12427 |
-
|
| 12428 |
-
|
| 12429 |
|
| 12430 |
-
|
| 12431 |
-
* WordPress dependencies
|
| 12432 |
-
*/
|
| 12433 |
|
|
|
|
|
|
|
|
|
|
| 12434 |
|
| 12435 |
-
|
| 12436 |
-
|
| 12437 |
-
|
|
|
|
|
|
|
|
|
|
| 12438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12439 |
|
|
|
|
|
|
|
|
|
|
| 12440 |
|
| 12441 |
-
function
|
| 12442 |
-
|
| 12443 |
-
|
| 12444 |
-
children
|
| 12445 |
-
}) {
|
| 12446 |
-
if (!useDisplayBlockControls()) {
|
| 12447 |
-
return null;
|
| 12448 |
}
|
| 12449 |
|
| 12450 |
-
|
| 12451 |
-
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], {
|
| 12452 |
-
document: document
|
| 12453 |
-
}, Object(external_wp_element_["createElement"])(Fill, null, fillProps => {
|
| 12454 |
-
// Children passed to BlockControlsFill will not have access to any
|
| 12455 |
-
// React Context whose Provider is part of the BlockControlsSlot tree.
|
| 12456 |
-
// So we re-create the Provider in this subtree.
|
| 12457 |
-
const value = !Object(external_lodash_["isEmpty"])(fillProps) ? fillProps : null;
|
| 12458 |
-
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalToolbarContext"].Provider, {
|
| 12459 |
-
value: value
|
| 12460 |
-
}, group === 'default' && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], {
|
| 12461 |
-
controls: controls
|
| 12462 |
-
}), children);
|
| 12463 |
-
}));
|
| 12464 |
}
|
| 12465 |
-
//# sourceMappingURL=fill.js.map
|
| 12466 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/slot.js
|
| 12467 |
-
|
| 12468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12469 |
|
| 12470 |
-
|
| 12471 |
-
|
| 12472 |
-
*/
|
| 12473 |
|
|
|
|
| 12474 |
|
| 12475 |
-
|
| 12476 |
-
|
| 12477 |
-
*/
|
| 12478 |
|
|
|
|
|
|
|
| 12479 |
|
| 12480 |
-
|
| 12481 |
-
|
| 12482 |
-
...props
|
| 12483 |
-
}) {
|
| 12484 |
-
const accessibleToolbarState = Object(external_wp_element_["useContext"])(external_wp_components_["__experimentalToolbarContext"]);
|
| 12485 |
-
const Slot = block_controls_groups[group].Slot;
|
| 12486 |
-
const slot = Object(external_wp_components_["__experimentalUseSlot"])(Slot.__unstableName);
|
| 12487 |
-
const hasFills = Boolean(slot.fills && slot.fills.length);
|
| 12488 |
|
| 12489 |
-
|
| 12490 |
-
|
| 12491 |
-
|
| 12492 |
|
| 12493 |
-
|
| 12494 |
-
|
| 12495 |
-
|
| 12496 |
-
fillProps: accessibleToolbarState
|
| 12497 |
-
}));
|
| 12498 |
-
}
|
| 12499 |
|
| 12500 |
-
|
| 12501 |
-
|
| 12502 |
-
|
| 12503 |
-
|
| 12504 |
-
|
| 12505 |
-
|
| 12506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12507 |
|
|
|
|
|
|
|
|
|
|
| 12508 |
|
| 12509 |
|
| 12510 |
-
|
| 12511 |
-
|
| 12512 |
-
*/
|
| 12513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12514 |
|
| 12515 |
-
|
| 12516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12517 |
|
| 12518 |
-
|
| 12519 |
-
|
| 12520 |
-
|
| 12521 |
-
|
| 12522 |
-
|
|
|
|
|
|
|
| 12523 |
|
| 12524 |
-
BlockFormatControls.Slot = props => {
|
| 12525 |
-
return Object(external_wp_element_["createElement"])(BlockControlsSlot, Object(esm_extends["a" /* default */])({
|
| 12526 |
-
group: "inline"
|
| 12527 |
-
}, props));
|
| 12528 |
-
};
|
| 12529 |
|
| 12530 |
-
|
| 12531 |
-
//# sourceMappingURL=index.js.map
|
| 12532 |
-
// EXTERNAL MODULE: external ["wp","primitives"]
|
| 12533 |
-
var external_wp_primitives_ = __webpack_require__(6);
|
| 12534 |
|
| 12535 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12536 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12537 |
|
| 12538 |
-
|
| 12539 |
-
|
| 12540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12541 |
|
| 12542 |
-
|
| 12543 |
-
|
| 12544 |
-
viewBox: "0 0 24 24"
|
| 12545 |
-
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
|
| 12546 |
-
d: "M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z"
|
| 12547 |
-
}));
|
| 12548 |
-
/* harmony default export */ var position_left = (positionLeft);
|
| 12549 |
-
//# sourceMappingURL=position-left.js.map
|
| 12550 |
-
// CONCATENATED MODULE: ./packages/icons/build-module/library/position-center.js
|
| 12551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12552 |
|
| 12553 |
-
|
| 12554 |
-
*
|
| 12555 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12556 |
|
| 12557 |
-
|
| 12558 |
-
|
| 12559 |
-
|
| 12560 |
-
|
| 12561 |
-
|
| 12562 |
-
}
|
| 12563 |
-
/* harmony default export */ var position_center = (positionCenter);
|
| 12564 |
-
//# sourceMappingURL=position-center.js.map
|
| 12565 |
-
// CONCATENATED MODULE: ./packages/icons/build-module/library/position-right.js
|
| 12566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12567 |
|
| 12568 |
-
|
| 12569 |
-
|
| 12570 |
-
|
|
|
|
|
|
|
|
|
|
| 12571 |
|
| 12572 |
-
|
| 12573 |
-
|
| 12574 |
-
|
| 12575 |
-
|
| 12576 |
-
|
| 12577 |
-
|
| 12578 |
-
|
| 12579 |
-
//# sourceMappingURL=position-right.js.map
|
| 12580 |
-
// CONCATENATED MODULE: ./packages/icons/build-module/library/stretch-wide.js
|
| 12581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12582 |
|
| 12583 |
-
/**
|
| 12584 |
-
* WordPress dependencies
|
| 12585 |
-
*/
|
| 12586 |
|
| 12587 |
-
|
| 12588 |
-
|
| 12589 |
-
viewBox: "0 0 24 24"
|
| 12590 |
-
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
|
| 12591 |
-
d: "M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"
|
| 12592 |
-
}));
|
| 12593 |
-
/* harmony default export */ var stretch_wide = (stretchWide);
|
| 12594 |
-
//# sourceMappingURL=stretch-wide.js.map
|
| 12595 |
-
// CONCATENATED MODULE: ./packages/icons/build-module/library/stretch-full-width.js
|
| 12596 |
|
|
|
|
| 12597 |
|
|
|
|
| 12598 |
/**
|
| 12599 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12600 |
*/
|
| 12601 |
|
| 12602 |
-
|
| 12603 |
-
|
| 12604 |
-
|
| 12605 |
-
|
| 12606 |
-
|
| 12607 |
-
|
| 12608 |
-
|
| 12609 |
-
|
| 12610 |
-
|
| 12611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12612 |
|
| 12613 |
-
|
| 12614 |
-
|
| 12615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12616 |
|
| 12617 |
-
|
| 12618 |
-
|
| 12619 |
};
|
| 12620 |
-
const Layout = Object(external_wp_element_["createContext"])(layout_defaultLayout);
|
| 12621 |
|
| 12622 |
-
|
| 12623 |
-
|
| 12624 |
-
|
| 12625 |
-
|
| 12626 |
-
|
| 12627 |
-
|
| 12628 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12629 |
}
|
| 12630 |
-
/**
|
| 12631 |
-
* Allows to define the layout.
|
| 12632 |
-
*/
|
| 12633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12634 |
|
| 12635 |
-
|
| 12636 |
-
|
| 12637 |
-
|
| 12638 |
-
*/
|
| 12639 |
|
| 12640 |
-
|
| 12641 |
-
return Object(external_wp_element_["useContext"])(Layout);
|
| 12642 |
-
}
|
| 12643 |
-
function LayoutStyle({
|
| 12644 |
-
selector,
|
| 12645 |
-
layout = {}
|
| 12646 |
-
}) {
|
| 12647 |
-
const {
|
| 12648 |
-
contentSize,
|
| 12649 |
-
wideSize
|
| 12650 |
-
} = layout;
|
| 12651 |
-
let style = !!contentSize || !!wideSize ? `
|
| 12652 |
-
${appendSelectors(selector, '> *')} {
|
| 12653 |
-
max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
|
| 12654 |
-
margin-left: auto !important;
|
| 12655 |
-
margin-right: auto !important;
|
| 12656 |
-
}
|
| 12657 |
|
| 12658 |
-
|
| 12659 |
-
|
| 12660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12661 |
|
| 12662 |
-
${appendSelectors(selector, '> [data-align="full"]')} {
|
| 12663 |
-
max-width: none;
|
| 12664 |
-
}
|
| 12665 |
-
` : '';
|
| 12666 |
-
style += `
|
| 12667 |
-
${appendSelectors(selector, '> [data-align="left"]')} {
|
| 12668 |
-
float: left;
|
| 12669 |
-
margin-right: 2em;
|
| 12670 |
-
}
|
| 12671 |
|
| 12672 |
-
|
| 12673 |
-
|
| 12674 |
-
|
| 12675 |
-
|
| 12676 |
-
|
| 12677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12678 |
}
|
| 12679 |
-
//# sourceMappingURL=layout.js.map
|
| 12680 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-alignment-control/use-available-alignments.js
|
| 12681 |
/**
|
| 12682 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12683 |
*/
|
| 12684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12685 |
/**
|
| 12686 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12687 |
*/
|
| 12688 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12689 |
|
|
|
|
|
|
|
|
|
|
| 12690 |
|
| 12691 |
-
const
|
| 12692 |
-
|
| 12693 |
-
|
| 12694 |
-
const
|
| 12695 |
-
wideControlsEnabled = false
|
| 12696 |
-
} = Object(external_wp_data_["useSelect"])(select => {
|
| 12697 |
-
const {
|
| 12698 |
-
getSettings
|
| 12699 |
-
} = select(store);
|
| 12700 |
-
const settings = getSettings();
|
| 12701 |
-
return {
|
| 12702 |
-
wideControlsEnabled: settings.alignWide
|
| 12703 |
-
};
|
| 12704 |
-
}, []);
|
| 12705 |
-
const layout = useLayout();
|
| 12706 |
-
const supportsAlignments = layout.type === 'default';
|
| 12707 |
|
| 12708 |
-
if (!
|
| 12709 |
-
return
|
| 12710 |
}
|
| 12711 |
|
| 12712 |
-
|
| 12713 |
-
alignments: availableAlignments = DEFAULT_CONTROLS
|
| 12714 |
-
} = layout;
|
| 12715 |
-
const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments.
|
| 12716 |
-
wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control));
|
| 12717 |
-
return enabledControls;
|
| 12718 |
}
|
| 12719 |
-
//# sourceMappingURL=
|
| 12720 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12721 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12722 |
|
| 12723 |
|
| 12724 |
/**
|
| 12725 |
* WordPress dependencies
|
| 12726 |
*/
|
| 12727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12728 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12729 |
|
| 12730 |
-
|
| 12731 |
-
* Internal dependencies
|
| 12732 |
-
*/
|
| 12733 |
-
|
| 12734 |
|
| 12735 |
-
|
| 12736 |
-
|
| 12737 |
-
icon: position_left,
|
| 12738 |
-
title: Object(external_wp_i18n_["__"])('Align left')
|
| 12739 |
-
},
|
| 12740 |
-
center: {
|
| 12741 |
-
icon: position_center,
|
| 12742 |
-
title: Object(external_wp_i18n_["__"])('Align center')
|
| 12743 |
-
},
|
| 12744 |
-
right: {
|
| 12745 |
-
icon: position_right,
|
| 12746 |
-
title: Object(external_wp_i18n_["__"])('Align right')
|
| 12747 |
-
},
|
| 12748 |
-
wide: {
|
| 12749 |
-
icon: stretch_wide,
|
| 12750 |
-
title: Object(external_wp_i18n_["__"])('Wide width')
|
| 12751 |
-
},
|
| 12752 |
-
full: {
|
| 12753 |
-
icon: stretch_full_width,
|
| 12754 |
-
title: Object(external_wp_i18n_["__"])('Full width')
|
| 12755 |
-
}
|
| 12756 |
-
};
|
| 12757 |
-
const DEFAULT_CONTROL = 'center';
|
| 12758 |
-
const ui_POPOVER_PROPS = {
|
| 12759 |
-
isAlternate: true
|
| 12760 |
-
};
|
| 12761 |
|
| 12762 |
-
|
| 12763 |
-
value,
|
| 12764 |
-
onChange,
|
| 12765 |
-
controls,
|
| 12766 |
-
isToolbar,
|
| 12767 |
-
isCollapsed = true
|
| 12768 |
-
}) {
|
| 12769 |
-
const enabledControls = useAvailableAlignments(controls);
|
| 12770 |
|
| 12771 |
-
|
| 12772 |
-
|
| 12773 |
-
}
|
| 12774 |
|
| 12775 |
-
|
| 12776 |
-
|
| 12777 |
-
}
|
| 12778 |
|
| 12779 |
-
|
| 12780 |
-
|
| 12781 |
-
|
| 12782 |
-
const extraProps = isToolbar ? {
|
| 12783 |
-
isCollapsed
|
| 12784 |
-
} : {};
|
| 12785 |
-
return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({
|
| 12786 |
-
popoverProps: ui_POPOVER_PROPS,
|
| 12787 |
-
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
| 12788 |
-
label: Object(external_wp_i18n_["__"])('Align'),
|
| 12789 |
-
toggleProps: {
|
| 12790 |
-
describedBy: Object(external_wp_i18n_["__"])('Change alignment')
|
| 12791 |
-
},
|
| 12792 |
-
controls: enabledControls.map(control => {
|
| 12793 |
-
return { ...BLOCK_ALIGNMENTS_CONTROLS[control],
|
| 12794 |
-
isActive: value === control,
|
| 12795 |
-
role: isCollapsed ? 'menuitemradio' : undefined,
|
| 12796 |
-
onClick: applyOrUnset(control)
|
| 12797 |
-
};
|
| 12798 |
-
})
|
| 12799 |
-
}, extraProps));
|
| 12800 |
-
}
|
| 12801 |
|
| 12802 |
-
|
| 12803 |
-
|
| 12804 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-alignment-control/index.js
|
| 12805 |
|
|
|
|
|
|
|
| 12806 |
|
|
|
|
|
|
|
| 12807 |
|
| 12808 |
-
|
| 12809 |
-
|
| 12810 |
-
*/
|
| 12811 |
|
| 12812 |
-
|
| 12813 |
-
return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, {
|
| 12814 |
-
isToolbar: false
|
| 12815 |
-
}));
|
| 12816 |
-
}
|
| 12817 |
-
function BlockAlignmentToolbar(props) {
|
| 12818 |
-
return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, {
|
| 12819 |
-
isToolbar: true
|
| 12820 |
-
}));
|
| 12821 |
-
}
|
| 12822 |
-
//# sourceMappingURL=index.js.map
|
| 12823 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/align.js
|
| 12824 |
|
| 12825 |
|
| 12826 |
|
|
@@ -12841,271 +12007,180 @@ function BlockAlignmentToolbar(props) {
|
|
| 12841 |
*/
|
| 12842 |
|
| 12843 |
|
| 12844 |
-
|
| 12845 |
/**
|
| 12846 |
-
*
|
| 12847 |
-
* used to
|
|
|
|
|
|
|
| 12848 |
*
|
| 12849 |
-
* @
|
| 12850 |
-
* @type {string[]}
|
| 12851 |
*/
|
| 12852 |
|
| 12853 |
-
const
|
| 12854 |
-
|
| 12855 |
-
|
| 12856 |
-
|
| 12857 |
-
|
| 12858 |
-
|
| 12859 |
-
|
| 12860 |
-
|
| 12861 |
-
*/
|
| 12862 |
-
|
| 12863 |
-
const WIDE_ALIGNMENTS = ['wide', 'full'];
|
| 12864 |
-
/**
|
| 12865 |
-
* Returns the valid alignments.
|
| 12866 |
-
* Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.
|
| 12867 |
-
* Exported just for testing purposes, not exported outside the module.
|
| 12868 |
-
*
|
| 12869 |
-
* @param {?boolean|string[]} blockAlign Aligns supported by the block.
|
| 12870 |
-
* @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.
|
| 12871 |
-
* @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.
|
| 12872 |
-
*
|
| 12873 |
-
* @return {string[]} Valid alignments.
|
| 12874 |
-
*/
|
| 12875 |
-
|
| 12876 |
-
function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) {
|
| 12877 |
-
let validAlignments;
|
| 12878 |
-
|
| 12879 |
-
if (Array.isArray(blockAlign)) {
|
| 12880 |
-
validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value));
|
| 12881 |
-
} else if (blockAlign === true) {
|
| 12882 |
-
// `true` includes all alignments...
|
| 12883 |
-
validAlignments = ALL_ALIGNMENTS;
|
| 12884 |
-
} else {
|
| 12885 |
-
validAlignments = [];
|
| 12886 |
-
}
|
| 12887 |
-
|
| 12888 |
-
if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) {
|
| 12889 |
-
return Object(external_lodash_["without"])(validAlignments, ...WIDE_ALIGNMENTS);
|
| 12890 |
-
}
|
| 12891 |
-
|
| 12892 |
-
return validAlignments;
|
| 12893 |
-
}
|
| 12894 |
-
/**
|
| 12895 |
-
* Filters registered block settings, extending attributes to include `align`.
|
| 12896 |
-
*
|
| 12897 |
-
* @param {Object} settings Original block settings.
|
| 12898 |
-
*
|
| 12899 |
-
* @return {Object} Filtered block settings.
|
| 12900 |
-
*/
|
| 12901 |
|
| 12902 |
-
|
| 12903 |
-
|
| 12904 |
-
|
| 12905 |
-
return settings;
|
| 12906 |
-
}
|
| 12907 |
|
| 12908 |
-
if (
|
| 12909 |
-
|
| 12910 |
-
|
| 12911 |
-
|
| 12912 |
-
|
| 12913 |
-
// Allow for '' since it is used by updateAlignment function
|
| 12914 |
-
// in withToolbarControls for special cases with defined default values.
|
| 12915 |
-
enum: [...ALL_ALIGNMENTS, '']
|
| 12916 |
-
}
|
| 12917 |
-
};
|
| 12918 |
-
}
|
| 12919 |
|
| 12920 |
-
return settings;
|
| 12921 |
-
}
|
| 12922 |
-
/**
|
| 12923 |
-
* Override the default edit UI to include new toolbar controls for block
|
| 12924 |
-
* alignment, if block defines support.
|
| 12925 |
-
*
|
| 12926 |
-
* @param {Function} BlockEdit Original component.
|
| 12927 |
-
*
|
| 12928 |
-
* @return {Function} Wrapped component.
|
| 12929 |
-
*/
|
| 12930 |
|
| 12931 |
-
const
|
| 12932 |
-
const {
|
| 12933 |
-
name: blockName
|
| 12934 |
-
} = props; // Compute the block allowed alignments without taking into account,
|
| 12935 |
-
// if the theme supports wide alignments or not
|
| 12936 |
-
// and without checking the layout for availble alignments.
|
| 12937 |
-
// BlockAlignmentToolbar takes both of these into account.
|
| 12938 |
|
| 12939 |
-
|
| 12940 |
-
|
|
|
|
|
|
|
|
|
|
| 12941 |
|
| 12942 |
-
const updateAlignment = nextAlign => {
|
| 12943 |
-
if (!nextAlign) {
|
| 12944 |
-
var _blockType$attributes, _blockType$attributes2;
|
| 12945 |
|
| 12946 |
-
|
| 12947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12948 |
|
| 12949 |
-
|
| 12950 |
-
nextAlign = '';
|
| 12951 |
-
}
|
| 12952 |
-
}
|
| 12953 |
|
| 12954 |
-
props.setAttributes({
|
| 12955 |
-
align: nextAlign
|
| 12956 |
-
});
|
| 12957 |
-
};
|
| 12958 |
|
| 12959 |
-
return [validAlignments.length > 0 && props.isSelected && Object(external_wp_element_["createElement"])(block_controls, {
|
| 12960 |
-
key: "align-controls",
|
| 12961 |
-
group: "block"
|
| 12962 |
-
}, Object(external_wp_element_["createElement"])(BlockAlignmentControl, {
|
| 12963 |
-
value: props.attributes.align,
|
| 12964 |
-
onChange: updateAlignment,
|
| 12965 |
-
controls: validAlignments
|
| 12966 |
-
})), Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({
|
| 12967 |
-
key: "edit"
|
| 12968 |
-
}, props))];
|
| 12969 |
-
}, 'withToolbarControls');
|
| 12970 |
/**
|
| 12971 |
-
*
|
| 12972 |
-
*
|
| 12973 |
-
* @param {Function} BlockListBlock Original component.
|
| 12974 |
-
*
|
| 12975 |
-
* @return {Function} Wrapped component.
|
| 12976 |
*/
|
| 12977 |
|
| 12978 |
-
|
| 12979 |
-
|
| 12980 |
-
|
| 12981 |
-
attributes
|
| 12982 |
-
} = props;
|
| 12983 |
-
const {
|
| 12984 |
-
align
|
| 12985 |
-
} = attributes;
|
| 12986 |
-
const blockAllowedAlignments = getValidAlignments(Object(external_wp_blocks_["getBlockSupport"])(name, 'align'), Object(external_wp_blocks_["hasBlockSupport"])(name, 'alignWide', true));
|
| 12987 |
-
const validAlignments = useAvailableAlignments(blockAllowedAlignments); // If an alignment is not assigned, there's no need to go through the
|
| 12988 |
-
// effort to validate or assign its value.
|
| 12989 |
-
|
| 12990 |
-
if (align === undefined) {
|
| 12991 |
-
return Object(external_wp_element_["createElement"])(BlockListBlock, props);
|
| 12992 |
-
}
|
| 12993 |
|
| 12994 |
-
let wrapperProps = props.wrapperProps;
|
| 12995 |
|
| 12996 |
-
if (validAlignments.includes(align)) {
|
| 12997 |
-
wrapperProps = { ...wrapperProps,
|
| 12998 |
-
'data-align': align
|
| 12999 |
-
};
|
| 13000 |
-
}
|
| 13001 |
|
| 13002 |
-
return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, {
|
| 13003 |
-
wrapperProps: wrapperProps
|
| 13004 |
-
}));
|
| 13005 |
-
});
|
| 13006 |
-
/**
|
| 13007 |
-
* Override props assigned to save component to inject alignment class name if
|
| 13008 |
-
* block supports it.
|
| 13009 |
-
*
|
| 13010 |
-
* @param {Object} props Additional props applied to save element.
|
| 13011 |
-
* @param {Object} blockType Block type.
|
| 13012 |
-
* @param {Object} attributes Block attributes.
|
| 13013 |
-
*
|
| 13014 |
-
* @return {Object} Filtered props applied to save element.
|
| 13015 |
-
*/
|
| 13016 |
|
| 13017 |
-
function
|
| 13018 |
const {
|
| 13019 |
-
|
| 13020 |
-
|
| 13021 |
-
|
| 13022 |
-
|
| 13023 |
-
|
| 13024 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13025 |
|
| 13026 |
-
|
|
|
|
|
|
|
| 13027 |
|
| 13028 |
-
|
| 13029 |
-
|
| 13030 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13031 |
|
| 13032 |
-
return props;
|
| 13033 |
-
}
|
| 13034 |
-
Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/align/addAttribute', addAttribute);
|
| 13035 |
-
Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/align/with-data-align', withDataAlign);
|
| 13036 |
-
Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/align/with-toolbar-controls', withToolbarControls);
|
| 13037 |
-
Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/align/addAssignedAlign', addAssignedAlign);
|
| 13038 |
-
//# sourceMappingURL=align.js.map
|
| 13039 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-advanced-controls/index.js
|
| 13040 |
|
| 13041 |
|
| 13042 |
/**
|
| 13043 |
* WordPress dependencies
|
| 13044 |
*/
|
| 13045 |
|
|
|
|
| 13046 |
/**
|
| 13047 |
* Internal dependencies
|
| 13048 |
*/
|
| 13049 |
|
| 13050 |
|
| 13051 |
-
const inspector_advanced_controls_name = 'InspectorAdvancedControls';
|
| 13052 |
-
const {
|
| 13053 |
-
Fill: inspector_advanced_controls_Fill,
|
| 13054 |
-
Slot: inspector_advanced_controls_Slot
|
| 13055 |
-
} = Object(external_wp_components_["createSlotFill"])(inspector_advanced_controls_name);
|
| 13056 |
-
|
| 13057 |
-
function InspectorAdvancedControls({
|
| 13058 |
-
children
|
| 13059 |
-
}) {
|
| 13060 |
-
const {
|
| 13061 |
-
isSelected
|
| 13062 |
-
} = useBlockEditContext();
|
| 13063 |
-
return isSelected ? Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], {
|
| 13064 |
-
document: document
|
| 13065 |
-
}, Object(external_wp_element_["createElement"])(inspector_advanced_controls_Fill, null, children)) : null;
|
| 13066 |
-
}
|
| 13067 |
-
|
| 13068 |
-
InspectorAdvancedControls.slotName = inspector_advanced_controls_name;
|
| 13069 |
-
InspectorAdvancedControls.Slot = inspector_advanced_controls_Slot;
|
| 13070 |
/**
|
| 13071 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13072 |
*/
|
| 13073 |
|
| 13074 |
-
|
| 13075 |
-
|
| 13076 |
-
|
| 13077 |
-
|
| 13078 |
-
|
| 13079 |
-
|
| 13080 |
-
|
| 13081 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13082 |
|
| 13083 |
-
/**
|
| 13084 |
-
* Internal dependencies
|
| 13085 |
-
*/
|
| 13086 |
|
|
|
|
|
|
|
|
|
|
| 13087 |
|
| 13088 |
-
|
| 13089 |
-
|
| 13090 |
-
Slot: inspector_controls_Slot
|
| 13091 |
-
} = Object(external_wp_components_["createSlotFill"])('InspectorControls');
|
| 13092 |
|
| 13093 |
-
|
| 13094 |
-
|
| 13095 |
-
|
| 13096 |
-
|
| 13097 |
-
|
| 13098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13099 |
}
|
|
|
|
| 13100 |
|
| 13101 |
-
|
| 13102 |
-
|
| 13103 |
-
|
| 13104 |
-
*/
|
| 13105 |
|
| 13106 |
-
|
| 13107 |
-
|
| 13108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13109 |
|
| 13110 |
|
| 13111 |
/**
|
|
@@ -13121,119 +12196,130 @@ InspectorControls.Slot = inspector_controls_Slot;
|
|
| 13121 |
|
| 13122 |
|
| 13123 |
|
| 13124 |
-
|
| 13125 |
/**
|
| 13126 |
* Internal dependencies
|
| 13127 |
*/
|
| 13128 |
|
| 13129 |
|
| 13130 |
-
/**
|
| 13131 |
-
* Regular expression matching invalid anchor characters for replacement.
|
| 13132 |
-
*
|
| 13133 |
-
* @type {RegExp}
|
| 13134 |
-
*/
|
| 13135 |
|
| 13136 |
-
|
| 13137 |
-
|
| 13138 |
-
|
| 13139 |
-
|
| 13140 |
-
|
| 13141 |
-
|
| 13142 |
-
|
| 13143 |
-
|
| 13144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13145 |
|
| 13146 |
-
|
| 13147 |
-
|
| 13148 |
-
|
| 13149 |
-
|
| 13150 |
-
|
|
|
|
| 13151 |
|
| 13152 |
-
|
| 13153 |
-
|
| 13154 |
-
|
| 13155 |
-
|
| 13156 |
-
|
| 13157 |
-
|
| 13158 |
-
|
| 13159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13160 |
}
|
| 13161 |
-
};
|
| 13162 |
-
}
|
| 13163 |
|
| 13164 |
-
|
|
|
|
|
|
|
|
|
|
| 13165 |
}
|
| 13166 |
/**
|
| 13167 |
-
*
|
| 13168 |
-
* assigning the anchor ID, if block supports anchor.
|
| 13169 |
-
*
|
| 13170 |
-
* @param {WPComponent} BlockEdit Original component.
|
| 13171 |
*
|
| 13172 |
-
* @
|
| 13173 |
*/
|
| 13174 |
|
| 13175 |
-
const withInspectorControl = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => {
|
| 13176 |
-
return props => {
|
| 13177 |
-
const hasAnchor = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'anchor');
|
| 13178 |
-
|
| 13179 |
-
if (hasAnchor && props.isSelected) {
|
| 13180 |
-
const isWeb = external_wp_element_["Platform"].OS === 'web';
|
| 13181 |
-
const textControl = Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
|
| 13182 |
-
className: "html-anchor-control",
|
| 13183 |
-
label: Object(external_wp_i18n_["__"])('HTML anchor'),
|
| 13184 |
-
help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
|
| 13185 |
-
href: 'https://wordpress.org/support/article/page-jumps/'
|
| 13186 |
-
}, Object(external_wp_i18n_["__"])('Learn more about anchors'))),
|
| 13187 |
-
value: props.attributes.anchor || '',
|
| 13188 |
-
placeholder: !isWeb ? Object(external_wp_i18n_["__"])('Add an anchor') : null,
|
| 13189 |
-
onChange: nextValue => {
|
| 13190 |
-
nextValue = nextValue.replace(ANCHOR_REGEX, '-');
|
| 13191 |
-
props.setAttributes({
|
| 13192 |
-
anchor: nextValue
|
| 13193 |
-
});
|
| 13194 |
-
},
|
| 13195 |
-
autoCapitalize: "none",
|
| 13196 |
-
autoComplete: "off"
|
| 13197 |
-
});
|
| 13198 |
-
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), isWeb && Object(external_wp_element_["createElement"])(inspector_advanced_controls, null, textControl), !isWeb && props.name === 'core/heading' && Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
|
| 13199 |
-
title: Object(external_wp_i18n_["__"])('Heading settings')
|
| 13200 |
-
}, textControl)));
|
| 13201 |
-
}
|
| 13202 |
|
| 13203 |
-
|
| 13204 |
-
|
| 13205 |
-
|
|
|
|
|
|
|
|
|
|
| 13206 |
/**
|
| 13207 |
-
*
|
| 13208 |
-
* supports anchor. This is only applied if the block's save result is an
|
| 13209 |
-
* element and not a markup string.
|
| 13210 |
-
*
|
| 13211 |
-
* @param {Object} extraProps Additional props applied to save element.
|
| 13212 |
-
* @param {Object} blockType Block type.
|
| 13213 |
-
* @param {Object} attributes Current block attributes.
|
| 13214 |
-
*
|
| 13215 |
-
* @return {Object} Filtered props applied to save element.
|
| 13216 |
*/
|
| 13217 |
|
| 13218 |
-
|
| 13219 |
-
|
| 13220 |
-
extraProps.id = attributes.anchor === '' ? null : attributes.anchor;
|
| 13221 |
-
}
|
| 13222 |
|
| 13223 |
-
|
| 13224 |
-
|
| 13225 |
-
|
| 13226 |
-
|
| 13227 |
-
|
| 13228 |
-
|
| 13229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13230 |
|
| 13231 |
|
| 13232 |
/**
|
| 13233 |
* External dependencies
|
| 13234 |
*/
|
| 13235 |
|
| 13236 |
-
|
| 13237 |
/**
|
| 13238 |
* WordPress dependencies
|
| 13239 |
*/
|
|
@@ -13242,371 +12328,350 @@ Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'cor
|
|
| 13242 |
|
| 13243 |
|
| 13244 |
|
| 13245 |
-
|
| 13246 |
/**
|
| 13247 |
* Internal dependencies
|
| 13248 |
*/
|
| 13249 |
|
| 13250 |
|
| 13251 |
-
/**
|
| 13252 |
-
* Filters registered block settings, extending attributes with anchor using ID
|
| 13253 |
-
* of the first node.
|
| 13254 |
-
*
|
| 13255 |
-
* @param {Object} settings Original block settings.
|
| 13256 |
-
*
|
| 13257 |
-
* @return {Object} Filtered block settings.
|
| 13258 |
-
*/
|
| 13259 |
|
| 13260 |
-
function custom_class_name_addAttribute(settings) {
|
| 13261 |
-
if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'customClassName', true)) {
|
| 13262 |
-
// Gracefully handle if settings.attributes is undefined.
|
| 13263 |
-
settings.attributes = { ...settings.attributes,
|
| 13264 |
-
className: {
|
| 13265 |
-
type: 'string'
|
| 13266 |
-
}
|
| 13267 |
-
};
|
| 13268 |
-
}
|
| 13269 |
|
| 13270 |
-
return settings;
|
| 13271 |
-
}
|
| 13272 |
-
/**
|
| 13273 |
-
* Override the default edit UI to include a new block inspector control for
|
| 13274 |
-
* assigning the custom class name, if block supports custom class name.
|
| 13275 |
-
*
|
| 13276 |
-
* @param {WPComponent} BlockEdit Original component.
|
| 13277 |
-
*
|
| 13278 |
-
* @return {WPComponent} Wrapped component.
|
| 13279 |
-
*/
|
| 13280 |
|
| 13281 |
-
const
|
| 13282 |
-
return props => {
|
| 13283 |
-
const hasCustomClassName = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'customClassName', true);
|
| 13284 |
|
| 13285 |
-
|
| 13286 |
-
|
| 13287 |
-
|
| 13288 |
-
|
| 13289 |
-
|
| 13290 |
-
|
| 13291 |
-
|
| 13292 |
-
|
| 13293 |
-
|
| 13294 |
-
|
| 13295 |
-
|
| 13296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13297 |
}
|
| 13298 |
|
| 13299 |
-
|
| 13300 |
-
|
| 13301 |
-
}, 'withInspectorControl');
|
| 13302 |
-
/**
|
| 13303 |
-
* Override props assigned to save component to inject anchor ID, if block
|
| 13304 |
-
* supports anchor. This is only applied if the block's save result is an
|
| 13305 |
-
* element and not a markup string.
|
| 13306 |
-
*
|
| 13307 |
-
* @param {Object} extraProps Additional props applied to save element.
|
| 13308 |
-
* @param {Object} blockType Block type.
|
| 13309 |
-
* @param {Object} attributes Current block attributes.
|
| 13310 |
-
*
|
| 13311 |
-
* @return {Object} Filtered props applied to save element.
|
| 13312 |
-
*/
|
| 13313 |
|
| 13314 |
-
|
| 13315 |
-
|
| 13316 |
-
|
| 13317 |
-
}
|
| 13318 |
|
| 13319 |
-
|
| 13320 |
-
|
| 13321 |
-
|
| 13322 |
-
* Given an HTML string, returns an array of class names assigned to the root
|
| 13323 |
-
* element in the markup.
|
| 13324 |
-
*
|
| 13325 |
-
* @param {string} innerHTML Markup string from which to extract classes.
|
| 13326 |
-
*
|
| 13327 |
-
* @return {string[]} Array of class names assigned to the root element.
|
| 13328 |
-
*/
|
| 13329 |
|
| 13330 |
-
|
| 13331 |
-
|
| 13332 |
-
|
| 13333 |
-
|
| 13334 |
-
|
| 13335 |
-
|
| 13336 |
-
|
| 13337 |
-
});
|
| 13338 |
-
|
| 13339 |
-
|
| 13340 |
-
|
| 13341 |
-
|
| 13342 |
-
|
| 13343 |
-
|
| 13344 |
-
* block from being considered as invalid.
|
| 13345 |
-
*
|
| 13346 |
-
* @param {Object} blockAttributes Original block attributes.
|
| 13347 |
-
* @param {Object} blockType Block type settings.
|
| 13348 |
-
* @param {string} innerHTML Original block markup.
|
| 13349 |
-
*
|
| 13350 |
-
* @return {Object} Filtered block attributes.
|
| 13351 |
-
*/
|
| 13352 |
|
| 13353 |
-
|
| 13354 |
-
|
| 13355 |
-
// To determine difference, serialize block given the known set of
|
| 13356 |
-
// attributes, with the exception of `className`. This will determine
|
| 13357 |
-
// the default set of classes. From there, any difference in innerHTML
|
| 13358 |
-
// can be considered as custom classes.
|
| 13359 |
-
const attributesSansClassName = Object(external_lodash_["omit"])(blockAttributes, ['className']);
|
| 13360 |
-
const serialized = Object(external_wp_blocks_["getSaveContent"])(blockType, attributesSansClassName);
|
| 13361 |
-
const defaultClasses = getHTMLRootElementClasses(serialized);
|
| 13362 |
-
const actualClasses = getHTMLRootElementClasses(innerHTML);
|
| 13363 |
-
const customClasses = Object(external_lodash_["difference"])(actualClasses, defaultClasses);
|
| 13364 |
|
| 13365 |
-
if (
|
| 13366 |
-
|
| 13367 |
-
|
| 13368 |
-
|
|
|
|
| 13369 |
}
|
| 13370 |
-
}
|
| 13371 |
|
| 13372 |
-
|
| 13373 |
-
}
|
| 13374 |
-
Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/custom-class-name/attribute', custom_class_name_addAttribute);
|
| 13375 |
-
Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/custom-class-name/with-inspector-control', custom_class_name_withInspectorControl);
|
| 13376 |
-
Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/custom-class-name/save-props', custom_class_name_addSaveProps);
|
| 13377 |
-
Object(external_wp_hooks_["addFilter"])('blocks.getBlockAttributes', 'core/custom-class-name/addParsedDifference', addParsedDifference);
|
| 13378 |
-
//# sourceMappingURL=custom-class-name.js.map
|
| 13379 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/generated-class-name.js
|
| 13380 |
-
/**
|
| 13381 |
-
* External dependencies
|
| 13382 |
-
*/
|
| 13383 |
|
| 13384 |
-
|
| 13385 |
-
|
| 13386 |
-
|
| 13387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13389 |
|
| 13390 |
-
|
| 13391 |
-
|
| 13392 |
-
|
| 13393 |
-
|
| 13394 |
-
|
| 13395 |
-
|
| 13396 |
-
|
| 13397 |
-
|
| 13398 |
-
|
| 13399 |
-
|
| 13400 |
|
| 13401 |
-
|
| 13402 |
-
|
| 13403 |
-
|
| 13404 |
-
|
| 13405 |
-
|
| 13406 |
-
|
| 13407 |
-
|
| 13408 |
-
} else {
|
| 13409 |
-
// There is no string in the className variable,
|
| 13410 |
-
// so we just dump the default name in there
|
| 13411 |
-
extraProps.className = Object(external_wp_blocks_["getBlockDefaultClassName"])(blockType.name);
|
| 13412 |
}
|
| 13413 |
-
}
|
| 13414 |
-
|
| 13415 |
-
return extraProps;
|
| 13416 |
-
}
|
| 13417 |
-
Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
|
| 13418 |
-
//# sourceMappingURL=generated-class-name.js.map
|
| 13419 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/use-setting/index.js
|
| 13420 |
-
/**
|
| 13421 |
-
* External dependencies
|
| 13422 |
-
*/
|
| 13423 |
|
| 13424 |
-
|
| 13425 |
-
|
| 13426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13428 |
|
| 13429 |
-
|
| 13430 |
-
|
| 13431 |
-
|
|
|
|
|
|
|
| 13432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13433 |
|
| 13434 |
|
| 13435 |
-
const
|
| 13436 |
-
|
| 13437 |
-
|
| 13438 |
-
|
| 13439 |
-
|
| 13440 |
-
|
| 13441 |
-
|
| 13442 |
-
|
| 13443 |
-
'spacing.units': settings => {
|
| 13444 |
-
if (settings.enableCustomUnits === undefined) {
|
| 13445 |
-
return;
|
| 13446 |
-
}
|
| 13447 |
|
| 13448 |
-
|
| 13449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13450 |
}
|
|
|
|
|
|
|
|
|
|
| 13451 |
|
| 13452 |
-
|
| 13453 |
-
|
| 13454 |
-
|
| 13455 |
-
|
| 13456 |
-
|
| 13457 |
-
|
| 13458 |
-
|
| 13459 |
-
|
| 13460 |
-
|
| 13461 |
-
|
| 13462 |
-
|
| 13463 |
-
|
| 13464 |
-
|
| 13465 |
-
|
| 13466 |
-
|
| 13467 |
-
|
| 13468 |
-
* @return {any} Returns the value defined for the setting.
|
| 13469 |
-
*
|
| 13470 |
-
* @example
|
| 13471 |
-
* ```js
|
| 13472 |
-
* const isEnabled = useSetting( 'typography.dropCap' );
|
| 13473 |
-
* ```
|
| 13474 |
-
*/
|
| 13475 |
-
|
| 13476 |
-
function useSetting(path) {
|
| 13477 |
-
const {
|
| 13478 |
-
name: blockName
|
| 13479 |
-
} = useBlockEditContext();
|
| 13480 |
-
const setting = Object(external_wp_data_["useSelect"])(select => {
|
| 13481 |
-
var _get;
|
| 13482 |
|
| 13483 |
-
|
| 13484 |
-
|
|
|
|
| 13485 |
|
| 13486 |
-
|
| 13487 |
-
const blockPath = `__experimentalFeatures.blocks.${blockName}.${path}`;
|
| 13488 |
-
const experimentalFeaturesResult = (_get = Object(external_lodash_["get"])(settings, blockPath)) !== null && _get !== void 0 ? _get : Object(external_lodash_["get"])(settings, defaultsPath);
|
| 13489 |
|
| 13490 |
-
|
| 13491 |
-
|
| 13492 |
-
|
|
|
|
| 13493 |
|
| 13494 |
-
|
| 13495 |
-
|
|
|
|
|
|
|
|
|
|
| 13496 |
|
| 13497 |
-
return experimentalFeaturesResult;
|
| 13498 |
-
} // 2 - Use deprecated settings, otherwise.
|
| 13499 |
|
|
|
|
|
|
|
|
|
|
| 13500 |
|
| 13501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13502 |
|
| 13503 |
-
|
| 13504 |
-
|
| 13505 |
-
|
| 13506 |
-
// This is only necessary to support typography.dropCap.
|
| 13507 |
-
// when __experimentalFeatures are not present (core without plugin).
|
| 13508 |
-
// To remove when __experimentalFeatures are ported to core.
|
| 13509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13510 |
|
| 13511 |
-
return path === 'typography.dropCap' ? true : undefined;
|
| 13512 |
-
}, [blockName, path]);
|
| 13513 |
-
return setting;
|
| 13514 |
-
}
|
| 13515 |
-
//# sourceMappingURL=index.js.map
|
| 13516 |
-
// EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
|
| 13517 |
-
var tinycolor = __webpack_require__(35);
|
| 13518 |
-
var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
|
| 13519 |
|
| 13520 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
|
| 13521 |
/**
|
| 13522 |
-
*
|
| 13523 |
*/
|
| 13524 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13525 |
|
| 13526 |
-
|
| 13527 |
-
|
| 13528 |
-
|
| 13529 |
-
*
|
| 13530 |
-
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 13531 |
-
* @param {?string} definedColor A string containing the color slug.
|
| 13532 |
-
* @param {?string} customColor A string containing the customColor value.
|
| 13533 |
-
*
|
| 13534 |
-
* @return {?Object} If definedColor is passed and the name is found in colors,
|
| 13535 |
-
* the color object exactly as set by the theme or editor defaults is returned.
|
| 13536 |
-
* Otherwise, an object that just sets the color is defined.
|
| 13537 |
-
*/
|
| 13538 |
|
| 13539 |
-
|
| 13540 |
-
|
| 13541 |
-
|
| 13542 |
-
|
| 13543 |
-
});
|
| 13544 |
|
| 13545 |
-
if (colorObj) {
|
| 13546 |
-
return colorObj;
|
| 13547 |
-
}
|
| 13548 |
-
}
|
| 13549 |
|
| 13550 |
-
return {
|
| 13551 |
-
color: customColor
|
| 13552 |
-
};
|
| 13553 |
-
};
|
| 13554 |
/**
|
| 13555 |
-
*
|
| 13556 |
-
*
|
| 13557 |
-
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 13558 |
-
* @param {?string} colorValue A string containing the color value.
|
| 13559 |
-
*
|
| 13560 |
-
* @return {?Object} Color object included in the colors array whose color property equals colorValue.
|
| 13561 |
-
* Returns undefined if no color object matches this requirement.
|
| 13562 |
*/
|
| 13563 |
|
| 13564 |
-
|
| 13565 |
-
|
| 13566 |
-
color: colorValue
|
| 13567 |
-
});
|
| 13568 |
-
};
|
| 13569 |
/**
|
| 13570 |
-
*
|
| 13571 |
-
*
|
| 13572 |
-
* @param {string} colorContextName Context/place where color is being used e.g: background, text etc...
|
| 13573 |
-
* @param {string} colorSlug Slug of the color.
|
| 13574 |
*
|
| 13575 |
-
* @
|
| 13576 |
-
*
|
|
|
|
| 13577 |
*/
|
| 13578 |
|
| 13579 |
-
|
| 13580 |
-
if (!colorContextName || !colorSlug) {
|
| 13581 |
-
return undefined;
|
| 13582 |
-
}
|
| 13583 |
|
| 13584 |
-
|
| 13585 |
-
}
|
| 13586 |
/**
|
| 13587 |
-
*
|
| 13588 |
*
|
| 13589 |
-
* @
|
| 13590 |
-
* @param {?string} colorValue A string containing the color value.
|
| 13591 |
*
|
| 13592 |
-
* @
|
| 13593 |
*/
|
| 13594 |
|
| 13595 |
-
function
|
| 13596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13597 |
}
|
| 13598 |
-
|
| 13599 |
-
|
| 13600 |
-
|
| 13601 |
-
|
| 13602 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13603 |
|
| 13604 |
/**
|
| 13605 |
* WordPress dependencies
|
| 13606 |
*/
|
| 13607 |
|
| 13608 |
-
|
| 13609 |
-
|
| 13610 |
/**
|
| 13611 |
* Internal dependencies
|
| 13612 |
*/
|
|
@@ -13614,110 +12679,189 @@ function getMostReadableColor(colors, colorValue) {
|
|
| 13614 |
|
| 13615 |
|
| 13616 |
|
| 13617 |
-
const use_gradient_EMPTY_ARRAY = [];
|
| 13618 |
-
function __experimentalGetGradientClass(gradientSlug) {
|
| 13619 |
-
if (!gradientSlug) {
|
| 13620 |
-
return undefined;
|
| 13621 |
-
}
|
| 13622 |
|
| 13623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13624 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13625 |
/**
|
| 13626 |
-
*
|
| 13627 |
-
*
|
| 13628 |
-
* @param {Array} gradients Gradient Palette
|
| 13629 |
-
* @param {string} slug Gradient slug
|
| 13630 |
-
*
|
| 13631 |
-
* @return {string} Gradient value.
|
| 13632 |
*/
|
| 13633 |
|
| 13634 |
-
|
| 13635 |
-
|
| 13636 |
-
|
| 13637 |
-
|
| 13638 |
-
function __experimentalGetGradientObjectByGradientValue(gradients, value) {
|
| 13639 |
-
const gradient = Object(external_lodash_["find"])(gradients, ['gradient', value]);
|
| 13640 |
-
return gradient;
|
| 13641 |
-
}
|
| 13642 |
/**
|
| 13643 |
-
*
|
| 13644 |
-
*
|
| 13645 |
-
* @param {Array} gradients Gradient Palette
|
| 13646 |
-
* @param {string} value Gradient value
|
| 13647 |
-
* @return {string} Gradient slug.
|
| 13648 |
*/
|
| 13649 |
|
| 13650 |
-
function getGradientSlugByValue(gradients, value) {
|
| 13651 |
-
const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value);
|
| 13652 |
|
| 13653 |
-
|
| 13654 |
-
|
| 13655 |
-
|
| 13656 |
-
|
| 13657 |
-
|
| 13658 |
-
|
| 13659 |
-
|
| 13660 |
-
|
| 13661 |
-
|
| 13662 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13663 |
const {
|
| 13664 |
-
|
| 13665 |
-
|
| 13666 |
-
|
| 13667 |
-
|
| 13668 |
-
|
| 13669 |
-
|
| 13670 |
-
|
| 13671 |
-
|
| 13672 |
-
|
| 13673 |
-
gradient: attributes[gradientAttribute]
|
| 13674 |
-
};
|
| 13675 |
-
}, [clientId, gradientAttribute, customGradientAttribute]);
|
| 13676 |
const {
|
| 13677 |
-
|
| 13678 |
-
} =
|
| 13679 |
-
|
| 13680 |
-
|
| 13681 |
-
|
| 13682 |
-
|
| 13683 |
-
|
| 13684 |
-
|
| 13685 |
-
|
| 13686 |
-
|
| 13687 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13688 |
}
|
| 13689 |
|
| 13690 |
-
|
| 13691 |
-
|
| 13692 |
-
|
| 13693 |
-
});
|
| 13694 |
-
}, [gradients, clientId, updateBlockAttributes]);
|
| 13695 |
|
| 13696 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13697 |
|
| 13698 |
-
|
| 13699 |
|
| 13700 |
-
|
| 13701 |
-
|
| 13702 |
-
} else {
|
| 13703 |
-
gradientValue = customGradient;
|
| 13704 |
-
}
|
| 13705 |
|
| 13706 |
-
|
| 13707 |
-
|
| 13708 |
-
|
| 13709 |
-
|
| 13710 |
-
|
| 13711 |
-
|
| 13712 |
-
|
| 13713 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13714 |
|
|
|
|
| 13715 |
|
| 13716 |
|
| 13717 |
/**
|
| 13718 |
-
*
|
| 13719 |
*/
|
| 13720 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13721 |
|
| 13722 |
/**
|
| 13723 |
* WordPress dependencies
|
|
@@ -13726,158 +12870,183 @@ function __experimentalUseGradient({
|
|
| 13726 |
|
| 13727 |
|
| 13728 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13729 |
/**
|
| 13730 |
-
*
|
| 13731 |
*/
|
| 13732 |
|
| 13733 |
|
|
|
|
|
|
|
| 13734 |
|
| 13735 |
-
|
| 13736 |
-
|
| 13737 |
-
|
| 13738 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13739 |
|
| 13740 |
-
|
|
|
|
|
|
|
| 13741 |
|
| 13742 |
-
const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 13743 |
|
| 13744 |
-
function VisualLabel({
|
| 13745 |
-
colors,
|
| 13746 |
-
gradients,
|
| 13747 |
-
label,
|
| 13748 |
-
currentTab,
|
| 13749 |
-
colorValue,
|
| 13750 |
-
gradientValue
|
| 13751 |
-
}) {
|
| 13752 |
-
let value, ariaLabel;
|
| 13753 |
|
| 13754 |
-
|
| 13755 |
-
|
| 13756 |
-
|
| 13757 |
-
|
| 13758 |
-
|
| 13759 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13760 |
}
|
| 13761 |
-
} else if (currentTab === 'gradient' && gradientValue) {
|
| 13762 |
-
value = gradientValue;
|
| 13763 |
|
| 13764 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13765 |
|
| 13766 |
-
|
| 13767 |
-
|
| 13768 |
-
|
| 13769 |
|
| 13770 |
-
|
| 13771 |
-
|
| 13772 |
-
|
| 13773 |
-
}));
|
| 13774 |
}
|
|
|
|
| 13775 |
|
| 13776 |
-
|
| 13777 |
-
|
| 13778 |
-
|
| 13779 |
-
disableCustomColors,
|
| 13780 |
-
disableCustomGradients,
|
| 13781 |
-
className,
|
| 13782 |
-
label,
|
| 13783 |
-
onColorChange,
|
| 13784 |
-
onGradientChange,
|
| 13785 |
-
colorValue,
|
| 13786 |
-
gradientValue,
|
| 13787 |
-
clearable
|
| 13788 |
-
}) {
|
| 13789 |
-
const canChooseAColor = onColorChange && (!Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors);
|
| 13790 |
-
const canChooseAGradient = onGradientChange && (!Object(external_lodash_["isEmpty"])(gradients) || !disableCustomGradients);
|
| 13791 |
-
const [currentTab, setCurrentTab] = Object(external_wp_element_["useState"])(gradientValue ? 'gradient' : !!canChooseAColor && 'color');
|
| 13792 |
-
|
| 13793 |
-
if (!canChooseAColor && !canChooseAGradient) {
|
| 13794 |
-
return null;
|
| 13795 |
-
}
|
| 13796 |
|
| 13797 |
-
|
| 13798 |
-
|
| 13799 |
-
|
| 13800 |
-
|
| 13801 |
-
}, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, Object(external_wp_element_["createElement"])(VisualLabel, {
|
| 13802 |
-
currentTab: currentTab,
|
| 13803 |
-
label: label,
|
| 13804 |
-
colorValue: colorValue,
|
| 13805 |
-
gradientValue: gradientValue
|
| 13806 |
-
})))), canChooseAColor && canChooseAGradient && Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], {
|
| 13807 |
-
className: "block-editor-color-gradient-control__button-tabs"
|
| 13808 |
-
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
| 13809 |
-
isSmall: true,
|
| 13810 |
-
isPressed: currentTab === 'color',
|
| 13811 |
-
onClick: () => setCurrentTab('color')
|
| 13812 |
-
}, Object(external_wp_i18n_["__"])('Solid')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
| 13813 |
-
isSmall: true,
|
| 13814 |
-
isPressed: currentTab === 'gradient',
|
| 13815 |
-
onClick: () => setCurrentTab('gradient')
|
| 13816 |
-
}, Object(external_wp_i18n_["__"])('Gradient'))), (currentTab === 'color' || !canChooseAGradient) && Object(external_wp_element_["createElement"])(external_wp_components_["ColorPalette"], {
|
| 13817 |
-
value: colorValue,
|
| 13818 |
-
onChange: canChooseAGradient ? newColor => {
|
| 13819 |
-
onColorChange(newColor);
|
| 13820 |
-
onGradientChange();
|
| 13821 |
-
} : onColorChange,
|
| 13822 |
-
colors,
|
| 13823 |
-
disableCustomColors,
|
| 13824 |
-
clearable: clearable
|
| 13825 |
-
}), (currentTab === 'gradient' || !canChooseAColor) && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalGradientPicker"], {
|
| 13826 |
-
value: gradientValue,
|
| 13827 |
-
onChange: canChooseAColor ? newGradient => {
|
| 13828 |
-
onGradientChange(newGradient);
|
| 13829 |
-
onColorChange();
|
| 13830 |
-
} : onGradientChange,
|
| 13831 |
-
gradients,
|
| 13832 |
-
disableCustomGradients,
|
| 13833 |
-
clearable: clearable
|
| 13834 |
-
})));
|
| 13835 |
-
}
|
| 13836 |
|
| 13837 |
-
function ColorGradientControlSelect(props) {
|
| 13838 |
-
const colorGradientSettings = {};
|
| 13839 |
-
colorGradientSettings.colors = useSetting('color.palette');
|
| 13840 |
-
colorGradientSettings.gradients = useSetting('color.gradients');
|
| 13841 |
-
colorGradientSettings.disableCustomColors = !useSetting('color.custom');
|
| 13842 |
-
colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient');
|
| 13843 |
-
return Object(external_wp_element_["createElement"])(ColorGradientControlInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props));
|
| 13844 |
-
}
|
| 13845 |
|
| 13846 |
-
|
| 13847 |
-
|
| 13848 |
-
|
| 13849 |
-
}
|
| 13850 |
|
| 13851 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13852 |
}
|
|
|
|
|
|
|
| 13853 |
|
| 13854 |
-
|
| 13855 |
-
|
| 13856 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13857 |
/**
|
| 13858 |
-
*
|
| 13859 |
*/
|
| 13860 |
|
| 13861 |
/**
|
| 13862 |
-
*
|
|
|
|
|
|
|
| 13863 |
*
|
| 13864 |
-
* @param {
|
| 13865 |
-
* @return {*} Object cleaned from falsy values
|
| 13866 |
*/
|
| 13867 |
|
| 13868 |
-
|
| 13869 |
-
|
| 13870 |
-
|
| 13871 |
-
|
|
|
|
| 13872 |
|
| 13873 |
-
|
| 13874 |
-
|
| 13875 |
-
|
| 13876 |
-
|
| 13877 |
-
|
|
|
|
|
|
|
| 13878 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13879 |
|
|
|
|
|
|
|
|
|
|
| 13880 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13881 |
/**
|
| 13882 |
* External dependencies
|
| 13883 |
*/
|
|
@@ -13889,277 +13058,257 @@ const cleanEmptyObject = object => {
|
|
| 13889 |
|
| 13890 |
|
| 13891 |
|
|
|
|
|
|
|
| 13892 |
/**
|
| 13893 |
* Internal dependencies
|
| 13894 |
*/
|
| 13895 |
|
| 13896 |
|
| 13897 |
-
|
| 13898 |
-
|
| 13899 |
-
|
| 13900 |
-
// Defining empty array here instead of inline avoids unnecessary re-renders of
|
| 13901 |
-
// color control.
|
| 13902 |
-
|
| 13903 |
-
const border_color_EMPTY_ARRAY = [];
|
| 13904 |
/**
|
| 13905 |
-
*
|
| 13906 |
-
*
|
| 13907 |
-
* There is deliberate overlap between the colors and borders block supports
|
| 13908 |
-
* relating to border color. It can be argued the border color controls could
|
| 13909 |
-
* be included within either, or both, the colors and borders panels in the
|
| 13910 |
-
* inspector controls. If they share the same block attributes it should not
|
| 13911 |
-
* matter.
|
| 13912 |
-
*
|
| 13913 |
-
* @param {Object} props Block properties.
|
| 13914 |
*
|
| 13915 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13916 |
*/
|
| 13917 |
|
| 13918 |
-
|
| 13919 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13921 |
const {
|
| 13922 |
-
|
| 13923 |
-
|
| 13924 |
-
|
| 13925 |
-
|
| 13926 |
-
|
| 13927 |
-
} =
|
| 13928 |
-
|
| 13929 |
-
|
| 13930 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13931 |
|
| 13932 |
-
|
| 13933 |
-
const colorObject = getColorObjectByColorValue(colors, value);
|
| 13934 |
-
const newStyle = { ...style,
|
| 13935 |
-
border: { ...(style === null || style === void 0 ? void 0 : style.border),
|
| 13936 |
-
color: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value
|
| 13937 |
-
}
|
| 13938 |
-
}; // If empty slug, ensure undefined to remove attribute.
|
| 13939 |
|
| 13940 |
-
|
| 13941 |
-
|
| 13942 |
-
|
| 13943 |
-
|
| 13944 |
-
|
| 13945 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13946 |
|
| 13947 |
-
|
| 13948 |
-
|
| 13949 |
-
|
| 13950 |
-
|
| 13951 |
-
|
| 13952 |
-
|
| 13953 |
-
|
| 13954 |
-
|
| 13955 |
-
|
| 13956 |
-
|
| 13957 |
-
|
| 13958 |
-
|
| 13959 |
-
|
| 13960 |
-
*
|
| 13961 |
-
* @param {Object} settings Original block settings.
|
| 13962 |
-
*
|
| 13963 |
-
* @return {Object} Updated block settings.
|
| 13964 |
-
*/
|
| 13965 |
|
| 13966 |
-
|
| 13967 |
-
|
| 13968 |
-
|
| 13969 |
-
|
|
|
|
| 13970 |
|
|
|
|
|
|
|
|
|
|
| 13971 |
|
| 13972 |
-
|
| 13973 |
-
|
| 13974 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13975 |
|
|
|
|
|
|
|
| 13976 |
|
| 13977 |
-
|
| 13978 |
-
|
| 13979 |
-
|
| 13980 |
-
|
| 13981 |
-
|
| 13982 |
-
|
| 13983 |
-
|
| 13984 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13985 |
/**
|
| 13986 |
-
*
|
| 13987 |
-
*
|
| 13988 |
-
* @param {Object} props Additional props applied to save element.
|
| 13989 |
-
* @param {Object} blockType Block type definition.
|
| 13990 |
-
* @param {Object} attributes Block's attributes.
|
| 13991 |
-
*
|
| 13992 |
-
* @return {Object} Filtered props to apply to save element.
|
| 13993 |
*/
|
| 13994 |
|
| 13995 |
-
|
| 13996 |
-
function border_color_addSaveProps(props, blockType, attributes) {
|
| 13997 |
-
var _style$border2;
|
| 13998 |
-
|
| 13999 |
-
if (!hasBorderSupport(blockType, 'color') || shouldSkipSerialization(blockType)) {
|
| 14000 |
-
return props;
|
| 14001 |
-
}
|
| 14002 |
-
|
| 14003 |
-
const {
|
| 14004 |
-
borderColor,
|
| 14005 |
-
style
|
| 14006 |
-
} = attributes;
|
| 14007 |
-
const borderColorClass = getColorClassName('border-color', borderColor);
|
| 14008 |
-
const newClassName = classnames_default()(props.className, {
|
| 14009 |
-
'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.color),
|
| 14010 |
-
[borderColorClass]: !!borderColorClass
|
| 14011 |
-
}); // If we are clearing the last of the previous classes in `className`
|
| 14012 |
-
// set it to `undefined` to avoid rendering empty DOM attributes.
|
| 14013 |
-
|
| 14014 |
-
props.className = newClassName ? newClassName : undefined;
|
| 14015 |
-
return props;
|
| 14016 |
-
}
|
| 14017 |
/**
|
| 14018 |
-
*
|
| 14019 |
-
* classnames to the block edit wrapper.
|
| 14020 |
-
*
|
| 14021 |
-
* @param {Object} settings Original block settings.
|
| 14022 |
-
*
|
| 14023 |
-
* @return {Object} Filtered block settings.
|
| 14024 |
*/
|
| 14025 |
|
| 14026 |
|
| 14027 |
-
function addEditProps(settings) {
|
| 14028 |
-
if (!hasBorderSupport(settings, 'color') || shouldSkipSerialization(settings)) {
|
| 14029 |
-
return settings;
|
| 14030 |
-
}
|
| 14031 |
|
| 14032 |
-
const existingGetEditWrapperProps = settings.getEditWrapperProps;
|
| 14033 |
|
| 14034 |
-
settings.getEditWrapperProps = attributes => {
|
| 14035 |
-
let props = {};
|
| 14036 |
|
| 14037 |
-
if (existingGetEditWrapperProps) {
|
| 14038 |
-
props = existingGetEditWrapperProps(attributes);
|
| 14039 |
-
}
|
| 14040 |
|
| 14041 |
-
|
| 14042 |
-
|
|
|
|
|
|
|
| 14043 |
|
| 14044 |
-
return settings;
|
| 14045 |
-
}
|
| 14046 |
/**
|
| 14047 |
-
*
|
| 14048 |
-
* Ideally, this is not needed and themes should load their palettes on the editor.
|
| 14049 |
*
|
| 14050 |
-
* @param {Function}
|
|
|
|
| 14051 |
*
|
| 14052 |
-
* @return {
|
| 14053 |
*/
|
| 14054 |
|
| 14055 |
-
|
| 14056 |
-
const withBorderColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => {
|
| 14057 |
-
var _getColorObjectByAttr, _props$wrapperProps;
|
| 14058 |
-
|
| 14059 |
const {
|
| 14060 |
-
|
| 14061 |
-
|
| 14062 |
-
} =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14063 |
const {
|
| 14064 |
-
|
| 14065 |
-
} =
|
| 14066 |
-
const
|
| 14067 |
-
|
| 14068 |
-
|
| 14069 |
-
|
| 14070 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14071 |
|
| 14072 |
-
|
| 14073 |
-
|
| 14074 |
-
};
|
| 14075 |
-
let wrapperProps = props.wrapperProps;
|
| 14076 |
-
wrapperProps = { ...props.wrapperProps,
|
| 14077 |
-
style: { ...extraStyles,
|
| 14078 |
-
...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style)
|
| 14079 |
-
}
|
| 14080 |
-
};
|
| 14081 |
-
return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, {
|
| 14082 |
-
wrapperProps: wrapperProps
|
| 14083 |
-
}));
|
| 14084 |
-
});
|
| 14085 |
-
Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addAttributes', addAttributes);
|
| 14086 |
-
Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/border/addSaveProps', border_color_addSaveProps);
|
| 14087 |
-
Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addEditProps', addEditProps);
|
| 14088 |
-
Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/border/with-border-color-palette-styles', withBorderColorPaletteStyles);
|
| 14089 |
-
//# sourceMappingURL=border-color.js.map
|
| 14090 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-radius.js
|
| 14091 |
|
|
|
|
|
|
|
|
|
|
| 14092 |
|
|
|
|
|
|
|
|
|
|
| 14093 |
/**
|
| 14094 |
* WordPress dependencies
|
| 14095 |
*/
|
| 14096 |
|
|
|
|
|
|
|
|
|
|
| 14097 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14098 |
|
| 14099 |
-
|
| 14100 |
-
* Internal dependencies
|
| 14101 |
-
*/
|
| 14102 |
|
|
|
|
|
|
|
| 14103 |
|
|
|
|
|
|
|
| 14104 |
|
| 14105 |
-
|
| 14106 |
-
|
| 14107 |
-
|
| 14108 |
-
*
|
| 14109 |
-
* @param {Object} props Block properties.
|
| 14110 |
-
*
|
| 14111 |
-
* @return {WPElement} Border radius edit element.
|
| 14112 |
-
*/
|
| 14113 |
|
| 14114 |
-
|
| 14115 |
-
|
| 14116 |
|
| 14117 |
-
|
| 14118 |
-
|
| 14119 |
-
style
|
| 14120 |
-
},
|
| 14121 |
-
setAttributes
|
| 14122 |
-
} = props; // Step value is maintained in state so step is appropriate for current unit
|
| 14123 |
-
// even when current radius value is undefined.
|
| 14124 |
|
| 14125 |
-
|
| 14126 |
-
|
| 14127 |
|
| 14128 |
-
|
| 14129 |
-
|
| 14130 |
-
};
|
| 14131 |
|
| 14132 |
-
|
| 14133 |
-
|
| 14134 |
-
border: { ...(style === null || style === void 0 ? void 0 : style.border),
|
| 14135 |
-
radius: newRadius
|
| 14136 |
-
}
|
| 14137 |
-
};
|
| 14138 |
|
| 14139 |
-
|
| 14140 |
-
|
| 14141 |
-
}
|
| 14142 |
|
| 14143 |
-
|
| 14144 |
-
|
| 14145 |
-
});
|
| 14146 |
-
};
|
| 14147 |
|
| 14148 |
-
|
| 14149 |
-
|
| 14150 |
-
|
| 14151 |
-
|
| 14152 |
-
|
| 14153 |
-
|
| 14154 |
-
|
| 14155 |
-
|
| 14156 |
-
|
| 14157 |
-
|
| 14158 |
-
units: units
|
| 14159 |
-
});
|
| 14160 |
-
}
|
| 14161 |
-
//# sourceMappingURL=border-radius.js.map
|
| 14162 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-style-control/index.js
|
| 14163 |
|
| 14164 |
|
| 14165 |
/**
|
|
@@ -14167,110 +13316,113 @@ function BorderRadiusEdit(props) {
|
|
| 14167 |
*/
|
| 14168 |
|
| 14169 |
|
| 14170 |
-
const DEFAULT_STYLE = {
|
| 14171 |
-
key: 'default',
|
| 14172 |
-
name: Object(external_wp_i18n_["__"])('Default'),
|
| 14173 |
-
style: {
|
| 14174 |
-
borderStyle: undefined
|
| 14175 |
-
}
|
| 14176 |
-
};
|
| 14177 |
-
const BORDER_STYLES = [DEFAULT_STYLE, {
|
| 14178 |
-
key: 'none',
|
| 14179 |
-
name: Object(external_wp_i18n_["__"])('None'),
|
| 14180 |
-
style: {
|
| 14181 |
-
borderStyle: 'none'
|
| 14182 |
-
}
|
| 14183 |
-
}, {
|
| 14184 |
-
key: 'solid',
|
| 14185 |
-
name: Object(external_wp_i18n_["__"])('Solid'),
|
| 14186 |
-
style: {
|
| 14187 |
-
borderStyle: 'solid'
|
| 14188 |
-
}
|
| 14189 |
-
}, {
|
| 14190 |
-
key: 'dashed',
|
| 14191 |
-
name: Object(external_wp_i18n_["__"])('Dashed'),
|
| 14192 |
-
style: {
|
| 14193 |
-
borderStyle: 'dashed'
|
| 14194 |
-
}
|
| 14195 |
-
}, {
|
| 14196 |
-
key: 'dotted',
|
| 14197 |
-
name: Object(external_wp_i18n_["__"])('Dotted'),
|
| 14198 |
-
style: {
|
| 14199 |
-
borderStyle: 'dotted'
|
| 14200 |
-
}
|
| 14201 |
-
}];
|
| 14202 |
-
/**
|
| 14203 |
-
* Control to display border style options.
|
| 14204 |
-
*
|
| 14205 |
-
* @param {Object} props Component props.
|
| 14206 |
-
* @param {Object} props.onChange Handler for changing border style selection.
|
| 14207 |
-
* @param {Object} props.value Currently selected border style value.
|
| 14208 |
-
*
|
| 14209 |
-
* @return {WPElement} Custom border style select control.
|
| 14210 |
-
*/
|
| 14211 |
|
| 14212 |
-
function
|
| 14213 |
-
|
| 14214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14215 |
}) {
|
| 14216 |
-
|
| 14217 |
-
|
| 14218 |
-
|
| 14219 |
-
|
| 14220 |
-
|
| 14221 |
-
|
| 14222 |
-
|
| 14223 |
-
|
| 14224 |
-
|
| 14225 |
-
|
| 14226 |
-
|
| 14227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14228 |
}
|
| 14229 |
-
//# sourceMappingURL=
|
| 14230 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/
|
| 14231 |
|
| 14232 |
|
| 14233 |
/**
|
| 14234 |
-
*
|
| 14235 |
*/
|
| 14236 |
|
|
|
|
|
|
|
|
|
|
| 14237 |
|
| 14238 |
/**
|
| 14239 |
-
*
|
| 14240 |
-
*
|
| 14241 |
-
* @param {Object} props Block properties.
|
| 14242 |
-
*
|
| 14243 |
-
* @return {WPElement} Border style edit element.
|
| 14244 |
*/
|
| 14245 |
|
| 14246 |
-
const BorderStyleEdit = props => {
|
| 14247 |
-
var _style$border;
|
| 14248 |
|
| 14249 |
-
const {
|
| 14250 |
-
attributes: {
|
| 14251 |
-
style
|
| 14252 |
-
},
|
| 14253 |
-
setAttributes
|
| 14254 |
-
} = props;
|
| 14255 |
|
| 14256 |
-
|
| 14257 |
-
|
| 14258 |
-
|
| 14259 |
-
|
| 14260 |
-
|
| 14261 |
-
|
| 14262 |
-
|
| 14263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14264 |
});
|
| 14265 |
-
}
|
| 14266 |
|
| 14267 |
-
|
| 14268 |
-
|
| 14269 |
-
|
| 14270 |
-
|
| 14271 |
-
|
| 14272 |
-
|
| 14273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14274 |
|
| 14275 |
|
| 14276 |
/**
|
|
@@ -14279,283 +13431,233 @@ const BorderStyleEdit = props => {
|
|
| 14279 |
|
| 14280 |
|
| 14281 |
|
|
|
|
|
|
|
|
|
|
| 14282 |
/**
|
| 14283 |
* Internal dependencies
|
| 14284 |
*/
|
| 14285 |
|
| 14286 |
|
| 14287 |
|
| 14288 |
-
const MIN_BORDER_WIDTH = 0;
|
| 14289 |
-
/**
|
| 14290 |
-
* Inspector control for configuring border width property.
|
| 14291 |
-
*
|
| 14292 |
-
* @param {Object} props Block properties.
|
| 14293 |
-
*
|
| 14294 |
-
* @return {WPElement} Border width edit element.
|
| 14295 |
-
*/
|
| 14296 |
|
| 14297 |
-
|
| 14298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14300 |
const {
|
| 14301 |
-
|
| 14302 |
-
|
|
|
|
|
|
|
|
|
|
| 14303 |
},
|
| 14304 |
-
setAttributes
|
| 14305 |
-
} = props; // Step value is maintained in state so step is appropriate for current unit
|
| 14306 |
-
// even when current radius value is undefined.
|
| 14307 |
-
|
| 14308 |
-
const initialStep = Object(external_wp_components_["__experimentalParseUnit"])(style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.width)[1] === 'px' ? 1 : 0.25;
|
| 14309 |
-
const [step, setStep] = Object(external_wp_element_["useState"])(initialStep);
|
| 14310 |
|
| 14311 |
-
|
| 14312 |
-
|
| 14313 |
-
|
| 14314 |
|
| 14315 |
-
|
| 14316 |
-
|
| 14317 |
-
|
| 14318 |
-
width: newWidth
|
| 14319 |
-
}
|
| 14320 |
-
};
|
| 14321 |
|
| 14322 |
-
|
| 14323 |
-
|
| 14324 |
}
|
| 14325 |
|
| 14326 |
-
setAttributes({
|
| 14327 |
-
style: newStyle
|
| 14328 |
-
});
|
| 14329 |
};
|
| 14330 |
-
|
| 14331 |
-
|
| 14332 |
-
|
| 14333 |
-
});
|
| 14334 |
-
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], {
|
| 14335 |
-
value: style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.width,
|
| 14336 |
-
label: Object(external_wp_i18n_["__"])('Border width'),
|
| 14337 |
-
min: MIN_BORDER_WIDTH,
|
| 14338 |
-
onChange: onChange,
|
| 14339 |
-
onUnitChange: onUnitChange,
|
| 14340 |
-
step: step,
|
| 14341 |
-
units: units
|
| 14342 |
-
});
|
| 14343 |
-
};
|
| 14344 |
-
//# sourceMappingURL=border-width.js.map
|
| 14345 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border.js
|
| 14346 |
|
| 14347 |
|
| 14348 |
/**
|
| 14349 |
* WordPress dependencies
|
| 14350 |
*/
|
| 14351 |
|
| 14352 |
-
|
| 14353 |
-
|
| 14354 |
-
|
| 14355 |
/**
|
| 14356 |
* Internal dependencies
|
| 14357 |
*/
|
| 14358 |
|
| 14359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14360 |
|
| 14361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14364 |
|
| 14365 |
-
|
| 14366 |
-
function BorderPanel(props) {
|
| 14367 |
-
const isDisabled = useIsBorderDisabled(props);
|
| 14368 |
-
const isSupported = hasBorderSupport(props.name);
|
| 14369 |
-
const isColorSupported = useSetting('border.customColor') && hasBorderSupport(props.name, 'color');
|
| 14370 |
-
const isRadiusSupported = useSetting('border.customRadius') && hasBorderSupport(props.name, 'radius');
|
| 14371 |
-
const isStyleSupported = useSetting('border.customStyle') && hasBorderSupport(props.name, 'style');
|
| 14372 |
-
const isWidthSupported = useSetting('border.customWidth') && hasBorderSupport(props.name, 'width');
|
| 14373 |
-
|
| 14374 |
-
if (isDisabled || !isSupported) {
|
| 14375 |
-
return null;
|
| 14376 |
}
|
| 14377 |
|
| 14378 |
-
return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
|
| 14379 |
-
className: "block-editor-hooks__border-controls",
|
| 14380 |
-
title: Object(external_wp_i18n_["__"])('Border settings'),
|
| 14381 |
-
initialOpen: false
|
| 14382 |
-
}, isStyleSupported && Object(external_wp_element_["createElement"])(BorderStyleEdit, props), isWidthSupported && Object(external_wp_element_["createElement"])(BorderWidthEdit, props), isRadiusSupported && Object(external_wp_element_["createElement"])(BorderRadiusEdit, props), isColorSupported && Object(external_wp_element_["createElement"])(BorderColorEdit, props)));
|
| 14383 |
}
|
| 14384 |
-
/**
|
| 14385 |
-
* Determine whether there is block support for border properties.
|
| 14386 |
-
*
|
| 14387 |
-
* @param {string} blockName Block name.
|
| 14388 |
-
* @param {string} feature Border feature to check support for.
|
| 14389 |
-
*
|
| 14390 |
-
* @return {boolean} Whether there is support.
|
| 14391 |
-
*/
|
| 14392 |
-
|
| 14393 |
-
function hasBorderSupport(blockName, feature = 'any') {
|
| 14394 |
-
if (external_wp_element_["Platform"].OS !== 'web') {
|
| 14395 |
-
return false;
|
| 14396 |
-
}
|
| 14397 |
|
| 14398 |
-
|
| 14399 |
-
|
| 14400 |
-
|
| 14401 |
-
|
| 14402 |
-
|
| 14403 |
-
|
| 14404 |
-
if (feature === 'any') {
|
| 14405 |
-
return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style);
|
| 14406 |
-
}
|
| 14407 |
-
|
| 14408 |
-
return !!(support !== null && support !== void 0 && support[feature]);
|
| 14409 |
-
}
|
| 14410 |
-
/**
|
| 14411 |
-
* Check whether serialization of border classes and styles should be skipped.
|
| 14412 |
-
*
|
| 14413 |
-
* @param {string|Object} blockType Block name or block type object.
|
| 14414 |
-
*
|
| 14415 |
-
* @return {boolean} Whether serialization of border properties should occur.
|
| 14416 |
-
*/
|
| 14417 |
-
|
| 14418 |
-
function shouldSkipSerialization(blockType) {
|
| 14419 |
-
const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, BORDER_SUPPORT_KEY);
|
| 14420 |
-
return support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization;
|
| 14421 |
-
}
|
| 14422 |
-
/**
|
| 14423 |
-
* Determines if all border support features have been disabled.
|
| 14424 |
-
*
|
| 14425 |
-
* @return {boolean} If border support is completely disabled.
|
| 14426 |
-
*/
|
| 14427 |
-
|
| 14428 |
-
const useIsBorderDisabled = () => {
|
| 14429 |
-
const configs = [!useSetting('border.customColor'), !useSetting('border.customRadius'), !useSetting('border.customStyle'), !useSetting('border.customWidth')];
|
| 14430 |
-
return configs.every(Boolean);
|
| 14431 |
-
};
|
| 14432 |
-
//# sourceMappingURL=border.js.map
|
| 14433 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
|
| 14434 |
|
|
|
|
| 14435 |
|
| 14436 |
|
| 14437 |
/**
|
| 14438 |
* External dependencies
|
| 14439 |
*/
|
| 14440 |
|
| 14441 |
-
|
| 14442 |
/**
|
| 14443 |
* WordPress dependencies
|
| 14444 |
*/
|
| 14445 |
|
| 14446 |
|
| 14447 |
|
|
|
|
| 14448 |
/**
|
| 14449 |
* Internal dependencies
|
| 14450 |
*/
|
| 14451 |
|
| 14452 |
|
| 14453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14454 |
|
| 14455 |
-
|
| 14456 |
-
|
| 14457 |
-
const
|
| 14458 |
-
|
| 14459 |
-
|
| 14460 |
-
const panel_color_gradient_settings_gradientIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(%s: gradient %s)');
|
| 14461 |
-
|
| 14462 |
-
const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 14463 |
-
|
| 14464 |
-
const Indicators = ({
|
| 14465 |
-
colors,
|
| 14466 |
-
gradients,
|
| 14467 |
-
settings
|
| 14468 |
-
}) => {
|
| 14469 |
-
return settings.map(({
|
| 14470 |
-
colorValue,
|
| 14471 |
-
gradientValue,
|
| 14472 |
-
label,
|
| 14473 |
-
colors: availableColors,
|
| 14474 |
-
gradients: availableGradients
|
| 14475 |
-
}, index) => {
|
| 14476 |
-
if (!colorValue && !gradientValue) {
|
| 14477 |
-
return null;
|
| 14478 |
-
}
|
| 14479 |
-
|
| 14480 |
-
let ariaLabel;
|
| 14481 |
|
| 14482 |
-
|
| 14483 |
-
|
| 14484 |
-
|
| 14485 |
-
|
| 14486 |
-
|
|
|
|
|
|
|
| 14487 |
|
| 14488 |
-
|
|
|
|
|
|
|
|
|
|
| 14489 |
}
|
|
|
|
| 14490 |
|
| 14491 |
-
|
| 14492 |
-
|
| 14493 |
-
|
| 14494 |
-
|
| 14495 |
-
|
|
|
|
|
|
|
|
|
|
| 14496 |
});
|
| 14497 |
-
}
|
| 14498 |
-
|
| 14499 |
-
const PanelColorGradientSettingsInner = ({
|
| 14500 |
-
className,
|
| 14501 |
-
colors,
|
| 14502 |
-
gradients,
|
| 14503 |
-
disableCustomColors,
|
| 14504 |
-
disableCustomGradients,
|
| 14505 |
-
children,
|
| 14506 |
-
settings,
|
| 14507 |
-
title,
|
| 14508 |
-
...props
|
| 14509 |
-
}) => {
|
| 14510 |
-
if (Object(external_lodash_["isEmpty"])(colors) && Object(external_lodash_["isEmpty"])(gradients) && disableCustomColors && disableCustomGradients && Object(external_lodash_["every"])(settings, setting => Object(external_lodash_["isEmpty"])(setting.colors) && Object(external_lodash_["isEmpty"])(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
|
| 14511 |
-
return null;
|
| 14512 |
-
}
|
| 14513 |
-
|
| 14514 |
-
const titleElement = Object(external_wp_element_["createElement"])("span", {
|
| 14515 |
-
className: "block-editor-panel-color-gradient-settings__panel-title"
|
| 14516 |
-
}, title, Object(external_wp_element_["createElement"])(Indicators, {
|
| 14517 |
-
colors: colors,
|
| 14518 |
-
gradients: gradients,
|
| 14519 |
-
settings: settings
|
| 14520 |
-
}));
|
| 14521 |
-
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], Object(esm_extends["a" /* default */])({
|
| 14522 |
-
className: classnames_default()('block-editor-panel-color-gradient-settings', className),
|
| 14523 |
-
title: titleElement
|
| 14524 |
-
}, props), settings.map((setting, index) => Object(external_wp_element_["createElement"])(control, Object(esm_extends["a" /* default */])({
|
| 14525 |
-
key: index,
|
| 14526 |
-
colors,
|
| 14527 |
-
gradients,
|
| 14528 |
-
disableCustomColors,
|
| 14529 |
-
disableCustomGradients
|
| 14530 |
-
}, setting))), children);
|
| 14531 |
-
};
|
| 14532 |
-
|
| 14533 |
-
const PanelColorGradientSettingsSelect = props => {
|
| 14534 |
-
const colorGradientSettings = {};
|
| 14535 |
-
colorGradientSettings.colors = useSetting('color.palette');
|
| 14536 |
-
colorGradientSettings.gradients = useSetting('color.gradients');
|
| 14537 |
-
colorGradientSettings.disableCustomColors = !useSetting('color.custom');
|
| 14538 |
-
colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient');
|
| 14539 |
-
return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props));
|
| 14540 |
-
};
|
| 14541 |
-
|
| 14542 |
-
const PanelColorGradientSettings = props => {
|
| 14543 |
-
if (Object(external_lodash_["every"])(panel_color_gradient_settings_colorsAndGradientKeys, key => props.hasOwnProperty(key))) {
|
| 14544 |
-
return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, props);
|
| 14545 |
-
}
|
| 14546 |
|
| 14547 |
-
|
| 14548 |
-
|
|
|
|
|
|
|
| 14549 |
|
| 14550 |
-
|
| 14551 |
-
//# sourceMappingURL=panel-color-gradient-settings.js.map
|
| 14552 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/contrast-checker/index.js
|
| 14553 |
|
| 14554 |
|
| 14555 |
/**
|
| 14556 |
* External dependencies
|
| 14557 |
*/
|
| 14558 |
|
|
|
|
| 14559 |
/**
|
| 14560 |
* WordPress dependencies
|
| 14561 |
*/
|
|
@@ -14565,1006 +13667,777 @@ const PanelColorGradientSettings = props => {
|
|
| 14565 |
|
| 14566 |
|
| 14567 |
|
| 14568 |
-
function ContrastCheckerMessage({
|
| 14569 |
-
tinyBackgroundColor,
|
| 14570 |
-
tinyTextColor,
|
| 14571 |
-
backgroundColor,
|
| 14572 |
-
textColor
|
| 14573 |
-
}) {
|
| 14574 |
-
const msg = tinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness() ? Object(external_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : Object(external_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage`
|
| 14575 |
-
// prop, but the contrast checker requires granular control over when the
|
| 14576 |
-
// announcements are made. Notably, the message will be re-announced if a
|
| 14577 |
-
// new color combination is selected and the contrast is still insufficient.
|
| 14578 |
-
|
| 14579 |
-
Object(external_wp_element_["useEffect"])(() => {
|
| 14580 |
-
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('This color combination may be hard for people to read.'));
|
| 14581 |
-
}, [backgroundColor, textColor]);
|
| 14582 |
-
return Object(external_wp_element_["createElement"])("div", {
|
| 14583 |
-
className: "block-editor-contrast-checker"
|
| 14584 |
-
}, Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], {
|
| 14585 |
-
spokenMessage: null,
|
| 14586 |
-
status: "warning",
|
| 14587 |
-
isDismissible: false
|
| 14588 |
-
}, msg));
|
| 14589 |
-
}
|
| 14590 |
-
|
| 14591 |
-
function ContrastChecker({
|
| 14592 |
-
backgroundColor,
|
| 14593 |
-
fallbackBackgroundColor,
|
| 14594 |
-
fallbackTextColor,
|
| 14595 |
-
fontSize,
|
| 14596 |
-
// font size value in pixels
|
| 14597 |
-
isLargeText,
|
| 14598 |
-
textColor
|
| 14599 |
-
}) {
|
| 14600 |
-
if (!(backgroundColor || fallbackBackgroundColor) || !(textColor || fallbackTextColor)) {
|
| 14601 |
-
return null;
|
| 14602 |
-
}
|
| 14603 |
-
|
| 14604 |
-
const tinyBackgroundColor = tinycolor_default()(backgroundColor || fallbackBackgroundColor);
|
| 14605 |
-
const tinyTextColor = tinycolor_default()(textColor || fallbackTextColor);
|
| 14606 |
-
const hasTransparency = tinyBackgroundColor.getAlpha() !== 1 || tinyTextColor.getAlpha() !== 1;
|
| 14607 |
-
|
| 14608 |
-
if (hasTransparency || tinycolor_default.a.isReadable(tinyBackgroundColor, tinyTextColor, {
|
| 14609 |
-
level: 'AA',
|
| 14610 |
-
size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
|
| 14611 |
-
})) {
|
| 14612 |
-
return null;
|
| 14613 |
-
}
|
| 14614 |
-
|
| 14615 |
-
return Object(external_wp_element_["createElement"])(ContrastCheckerMessage, {
|
| 14616 |
-
backgroundColor: backgroundColor,
|
| 14617 |
-
textColor: textColor,
|
| 14618 |
-
tinyBackgroundColor: tinyBackgroundColor,
|
| 14619 |
-
tinyTextColor: tinyTextColor
|
| 14620 |
-
});
|
| 14621 |
-
}
|
| 14622 |
-
|
| 14623 |
-
/* harmony default export */ var contrast_checker = (ContrastChecker);
|
| 14624 |
-
//# sourceMappingURL=index.js.map
|
| 14625 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/block-refs-provider.js
|
| 14626 |
-
|
| 14627 |
-
|
| 14628 |
-
/**
|
| 14629 |
-
* WordPress dependencies
|
| 14630 |
-
*/
|
| 14631 |
-
|
| 14632 |
-
const BlockRefs = Object(external_wp_element_["createContext"])();
|
| 14633 |
-
function BlockRefsProvider({
|
| 14634 |
-
children
|
| 14635 |
-
}) {
|
| 14636 |
-
const value = Object(external_wp_element_["useMemo"])(() => ({
|
| 14637 |
-
refs: new Map(),
|
| 14638 |
-
callbacks: new Map()
|
| 14639 |
-
}), []);
|
| 14640 |
-
return Object(external_wp_element_["createElement"])(BlockRefs.Provider, {
|
| 14641 |
-
value: value
|
| 14642 |
-
}, children);
|
| 14643 |
-
}
|
| 14644 |
-
//# sourceMappingURL=block-refs-provider.js.map
|
| 14645 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js
|
| 14646 |
-
/**
|
| 14647 |
-
* WordPress dependencies
|
| 14648 |
-
*/
|
| 14649 |
-
|
| 14650 |
|
| 14651 |
/**
|
| 14652 |
* Internal dependencies
|
| 14653 |
*/
|
| 14654 |
|
| 14655 |
|
| 14656 |
-
/** @typedef {import('@wordpress/element').RefCallback} RefCallback */
|
| 14657 |
-
|
| 14658 |
-
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
| 14659 |
-
|
| 14660 |
-
/**
|
| 14661 |
-
* Provides a ref to the BlockRefs context.
|
| 14662 |
-
*
|
| 14663 |
-
* @param {string} clientId The client ID of the element ref.
|
| 14664 |
-
*
|
| 14665 |
-
* @return {RefCallback} Ref callback.
|
| 14666 |
-
*/
|
| 14667 |
-
|
| 14668 |
-
function useBlockRefProvider(clientId) {
|
| 14669 |
-
const {
|
| 14670 |
-
refs,
|
| 14671 |
-
callbacks
|
| 14672 |
-
} = Object(external_wp_element_["useContext"])(BlockRefs);
|
| 14673 |
-
const ref = Object(external_wp_element_["useRef"])();
|
| 14674 |
-
Object(external_wp_element_["useLayoutEffect"])(() => {
|
| 14675 |
-
refs.set(ref, clientId);
|
| 14676 |
-
return () => {
|
| 14677 |
-
refs.delete(ref);
|
| 14678 |
-
};
|
| 14679 |
-
}, [clientId]);
|
| 14680 |
-
return Object(external_wp_compose_["useRefEffect"])(element => {
|
| 14681 |
-
// Update the ref in the provider.
|
| 14682 |
-
ref.current = element; // Call any update functions.
|
| 14683 |
|
| 14684 |
-
callbacks.forEach((id, setElement) => {
|
| 14685 |
-
if (clientId === id) {
|
| 14686 |
-
setElement(element);
|
| 14687 |
-
}
|
| 14688 |
-
});
|
| 14689 |
-
}, [clientId]);
|
| 14690 |
-
}
|
| 14691 |
-
/**
|
| 14692 |
-
* Gets a ref pointing to the current block element. Continues to return a
|
| 14693 |
-
* stable ref even if the block client ID changes.
|
| 14694 |
-
*
|
| 14695 |
-
* @param {string} clientId The client ID to get a ref for.
|
| 14696 |
-
*
|
| 14697 |
-
* @return {RefObject} A ref containing the element.
|
| 14698 |
-
*/
|
| 14699 |
|
| 14700 |
-
function useBlockRef(clientId) {
|
| 14701 |
-
const {
|
| 14702 |
-
refs
|
| 14703 |
-
} = Object(external_wp_element_["useContext"])(BlockRefs);
|
| 14704 |
-
const freshClientId = Object(external_wp_element_["useRef"])();
|
| 14705 |
-
freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so
|
| 14706 |
-
// that `current` works at a later point.
|
| 14707 |
|
| 14708 |
-
return Object(external_wp_element_["useMemo"])(() => ({
|
| 14709 |
-
get current() {
|
| 14710 |
-
let element = null; // Multiple refs may be created for a single block. Find the
|
| 14711 |
-
// first that has an element set.
|
| 14712 |
|
| 14713 |
-
for (const [ref, id] of refs.entries()) {
|
| 14714 |
-
if (id === freshClientId.current && ref.current) {
|
| 14715 |
-
element = ref.current;
|
| 14716 |
-
}
|
| 14717 |
-
}
|
| 14718 |
|
| 14719 |
-
return element;
|
| 14720 |
-
}
|
| 14721 |
|
| 14722 |
-
|
| 14723 |
-
}
|
| 14724 |
/**
|
| 14725 |
-
*
|
| 14726 |
-
* changes, becomes available, or disappears.
|
| 14727 |
*
|
| 14728 |
-
* @param {
|
|
|
|
| 14729 |
*
|
| 14730 |
-
* @return {
|
| 14731 |
*/
|
| 14732 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14733 |
|
| 14734 |
-
|
| 14735 |
-
|
| 14736 |
-
|
| 14737 |
-
} = Object(external_wp_element_["useContext"])(BlockRefs);
|
| 14738 |
-
const ref = useBlockRef(clientId);
|
| 14739 |
-
const [element, setElement] = Object(external_wp_element_["useState"])(null);
|
| 14740 |
-
Object(external_wp_element_["useLayoutEffect"])(() => {
|
| 14741 |
-
if (!clientId) {
|
| 14742 |
-
return;
|
| 14743 |
-
}
|
| 14744 |
|
| 14745 |
-
|
| 14746 |
-
|
| 14747 |
-
|
| 14748 |
};
|
| 14749 |
-
}
|
| 14750 |
-
return ref.current || element;
|
| 14751 |
-
}
|
| 14752 |
-
|
| 14753 |
-
|
| 14754 |
-
|
| 14755 |
-
//# sourceMappingURL=use-block-refs.js.map
|
| 14756 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/color-panel.js
|
| 14757 |
-
|
| 14758 |
-
|
| 14759 |
-
/**
|
| 14760 |
-
* WordPress dependencies
|
| 14761 |
-
*/
|
| 14762 |
-
|
| 14763 |
-
|
| 14764 |
-
/**
|
| 14765 |
-
* Internal dependencies
|
| 14766 |
-
*/
|
| 14767 |
-
|
| 14768 |
-
|
| 14769 |
-
|
| 14770 |
-
|
| 14771 |
|
|
|
|
|
|
|
| 14772 |
|
| 14773 |
-
function
|
| 14774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14775 |
}
|
| 14776 |
|
| 14777 |
-
function
|
| 14778 |
-
|
|
|
|
| 14779 |
clientId,
|
| 14780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14781 |
}) {
|
| 14782 |
-
const
|
| 14783 |
-
|
| 14784 |
-
|
| 14785 |
-
Object(external_wp_element_["
|
| 14786 |
-
|
| 14787 |
-
|
| 14788 |
-
|
| 14789 |
-
|
| 14790 |
-
if (!ref.current) {
|
| 14791 |
-
return;
|
| 14792 |
-
}
|
| 14793 |
-
|
| 14794 |
-
setDetectedColor(getComputedStyle(ref.current).color);
|
| 14795 |
-
let backgroundColorNode = ref.current;
|
| 14796 |
-
let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
|
| 14797 |
-
|
| 14798 |
-
while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) {
|
| 14799 |
-
backgroundColorNode = backgroundColorNode.parentNode;
|
| 14800 |
-
backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
|
| 14801 |
-
}
|
| 14802 |
|
| 14803 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14804 |
});
|
| 14805 |
-
|
| 14806 |
-
|
| 14807 |
-
initialOpen: false,
|
| 14808 |
-
settings: settings
|
| 14809 |
-
}, enableContrastChecking && Object(external_wp_element_["createElement"])(contrast_checker, {
|
| 14810 |
-
backgroundColor: detectedBackgroundColor,
|
| 14811 |
-
textColor: detectedColor
|
| 14812 |
-
})));
|
| 14813 |
-
}
|
| 14814 |
-
//# sourceMappingURL=color-panel.js.map
|
| 14815 |
-
// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/color.js
|
| 14816 |
|
|
|
|
|
|
|
|
|
|
| 14817 |
|
|
|
|
|
|
|
| 14818 |
|
| 14819 |
-
|
| 14820 |
-
|
| 14821 |
-
|
|
|
|
|
|
|
|
|
|
| 14822 |
|
|
|
|
| 14823 |
|
| 14824 |
-
|
| 14825 |
-
|
| 14826 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14827 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14828 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14829 |
|
|
|
|
| 14830 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14831 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14832 |
|
| 14833 |
-
|
| 14834 |
-
|
| 14835 |
-
|
| 14836 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14838 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14839 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14840 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14841 |
|
| 14842 |
-
|
| 14843 |
-
const
|
| 14844 |
|
| 14845 |
-
|
| 14846 |
-
|
| 14847 |
-
|
| 14848 |
-
}
|
|
|
|
| 14849 |
|
| 14850 |
-
|
| 14851 |
-
|
| 14852 |
-
|
| 14853 |
-
}
|
|
|
|
| 14854 |
|
| 14855 |
-
|
| 14856 |
-
|
| 14857 |
-
|
| 14858 |
-
|
| 14859 |
|
| 14860 |
-
|
| 14861 |
-
|
| 14862 |
-
};
|
| 14863 |
|
| 14864 |
-
|
| 14865 |
-
|
| 14866 |
-
|
| 14867 |
-
}
|
| 14868 |
|
| 14869 |
-
|
| 14870 |
-
|
| 14871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14872 |
|
| 14873 |
-
|
| 14874 |
-
|
| 14875 |
-
|
| 14876 |
-
};
|
| 14877 |
|
| 14878 |
-
|
| 14879 |
-
const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY);
|
| 14880 |
-
return colorSupport && colorSupport.text !== false;
|
| 14881 |
-
};
|
| 14882 |
-
/**
|
| 14883 |
-
* Filters registered block settings, extending attributes to include
|
| 14884 |
-
* `backgroundColor` and `textColor` attribute.
|
| 14885 |
-
*
|
| 14886 |
-
* @param {Object} settings Original block settings.
|
| 14887 |
-
*
|
| 14888 |
-
* @return {Object} Filtered block settings.
|
| 14889 |
-
*/
|
| 14890 |
|
|
|
|
|
|
|
| 14891 |
|
| 14892 |
-
|
| 14893 |
-
|
| 14894 |
-
return settings;
|
| 14895 |
-
} // allow blocks to specify their own attribute definition with default values if needed.
|
| 14896 |
|
|
|
|
|
|
|
| 14897 |
|
| 14898 |
-
|
| 14899 |
-
|
| 14900 |
-
backgroundColor: {
|
| 14901 |
-
type: 'string'
|
| 14902 |
-
}
|
| 14903 |
-
});
|
| 14904 |
-
}
|
| 14905 |
|
| 14906 |
-
|
| 14907 |
-
|
| 14908 |
-
textColor: {
|
| 14909 |
-
type: 'string'
|
| 14910 |
-
}
|
| 14911 |
-
});
|
| 14912 |
-
}
|
| 14913 |
|
| 14914 |
-
|
| 14915 |
-
|
| 14916 |
-
gradient: {
|
| 14917 |
-
type: 'string'
|
| 14918 |
-
}
|
| 14919 |
-
});
|
| 14920 |
-
}
|
| 14921 |
|
| 14922 |
-
|
| 14923 |
-
}
|
| 14924 |
/**
|
| 14925 |
-
*
|
| 14926 |
-
*
|
| 14927 |
-
* @param {Object} props Additional props applied to save element.
|
| 14928 |
-
* @param {Object} blockType Block type.
|
| 14929 |
-
* @param {Object} attributes Block attributes.
|
| 14930 |
-
*
|
| 14931 |
-
* @return {Object} Filtered props applied to save element.
|
| 14932 |
*/
|
| 14933 |
|
| 14934 |
|
| 14935 |
-
|
| 14936 |
-
|
| 14937 |
-
|
| 14938 |
-
|
| 14939 |
-
return props;
|
| 14940 |
-
}
|
| 14941 |
-
|
| 14942 |
-
const hasGradient = hasGradientSupport(blockType); // I'd have prefered to avoid the "style" attribute usage here
|
| 14943 |
-
|
| 14944 |
-
const {
|
| 14945 |
-
backgroundColor,
|
| 14946 |
-
textColor,
|
| 14947 |
-
gradient,
|
| 14948 |
-
style
|
| 14949 |
-
} = attributes;
|
| 14950 |
-
const backgroundClass = getColorClassName('background-color', backgroundColor);
|
| 14951 |
-
|
| 14952 |
-
const gradientClass = __experimentalGetGradientClass(gradient);
|
| 14953 |
-
|
| 14954 |
-
const textClass = getColorClassName('color', textColor);
|
| 14955 |
-
const newClassName = classnames_default()(props.className, textClass, gradientClass, {
|
| 14956 |
-
// Don't apply the background class if there's a custom gradient
|
| 14957 |
-
[backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.gradient)) && !!backgroundClass,
|
| 14958 |
-
'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text),
|
| 14959 |
-
'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)),
|
| 14960 |
-
'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color
|
| 14961 |
-
});
|
| 14962 |
-
props.className = newClassName ? newClassName : undefined;
|
| 14963 |
-
return props;
|
| 14964 |
-
}
|
| 14965 |
/**
|
| 14966 |
-
*
|
| 14967 |
-
* to apply the desired styles and classnames properly.
|
| 14968 |
-
*
|
| 14969 |
-
* @param {Object} settings Original block settings.
|
| 14970 |
*
|
| 14971 |
-
* @return {
|
|
|
|
|
|
|
| 14972 |
*/
|
| 14973 |
|
| 14974 |
-
function
|
| 14975 |
-
|
| 14976 |
-
|
| 14977 |
-
|
|
|
|
| 14978 |
|
| 14979 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14980 |
|
| 14981 |
-
|
| 14982 |
-
|
|
|
|
|
|
|
|
|
|
| 14983 |
|
| 14984 |
-
|
| 14985 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14986 |
}
|
| 14987 |
|
| 14988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14989 |
};
|
| 14990 |
|
| 14991 |
-
return
|
| 14992 |
}
|
|
|
|
|
|
|
|
|
|
| 14993 |
|
| 14994 |
-
|
| 14995 |
-
const attributeParsed = /var:preset\|color\|(.+)/.exec(value);
|
| 14996 |
-
|
| 14997 |
-
if (attributeParsed && attributeParsed[1]) {
|
| 14998 |
-
return getColorObjectByAttributeValues(colors, attributeParsed[1]).color;
|
| 14999 |
-
}
|
| 15000 |
|
| 15001 |
-
return value;
|
| 15002 |
-
};
|
| 15003 |
|
| 15004 |
-
function immutableSet(object, path, value) {
|
| 15005 |
-
return Object(external_lodash_["setWith"])(object ? Object(external_lodash_["clone"])(object) : {}, path, value, external_lodash_["clone"]);
|
| 15006 |
-
}
|
| 15007 |
/**
|
| 15008 |
-
*
|
| 15009 |
-
*
|
| 15010 |
-
* @param {Object} props
|
| 15011 |
-
*
|
| 15012 |
-
* @return {WPElement} Color edit element.
|
| 15013 |
*/
|
| 15014 |
|
| 15015 |
|
| 15016 |
-
function ColorEdit(props) {
|
| 15017 |
-
var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
|
| 15018 |
|
| 15019 |
-
const {
|
| 15020 |
-
name: blockName,
|
| 15021 |
-
attributes
|
| 15022 |
-
} = props;
|
| 15023 |
-
const isLinkColorEnabled = useSetting('color.link');
|
| 15024 |
-
const colors = useSetting('color.palette') || color_EMPTY_ARRAY;
|
| 15025 |
-
const gradients = useSetting('color.gradients') || color_EMPTY_ARRAY; // Shouldn't be needed but right now the ColorGradientsPanel
|
| 15026 |
-
// can trigger both onChangeColor and onChangeBackground
|
| 15027 |
-
// synchronously causing our two callbacks to override changes
|
| 15028 |
-
// from each other.
|
| 15029 |
|
| 15030 |
-
|
| 15031 |
-
|
| 15032 |
-
|
| 15033 |
-
}, [attributes]);
|
| 15034 |
|
| 15035 |
-
if (!hasColorSupport(blockName)) {
|
| 15036 |
-
return null;
|
| 15037 |
-
}
|
| 15038 |
|
| 15039 |
-
const hasBackground = hasBackgroundColorSupport(blockName);
|
| 15040 |
-
const hasGradient = hasGradientSupport(blockName);
|
| 15041 |
-
const {
|
| 15042 |
-
style,
|
| 15043 |
-
textColor,
|
| 15044 |
-
backgroundColor,
|
| 15045 |
-
gradient
|
| 15046 |
-
} = attributes;
|
| 15047 |
-
let gradientValue;
|
| 15048 |
|
| 15049 |
-
if (hasGradient && gradient) {
|
| 15050 |
-
gradientValue = getGradientValueBySlug(gradients, gradient);
|
| 15051 |
-
} else if (hasGradient) {
|
| 15052 |
-
var _style$color5;
|
| 15053 |
|
| 15054 |
-
gradientValue = style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient;
|
| 15055 |
-
}
|
| 15056 |
|
| 15057 |
-
|
| 15058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15059 |
|
| 15060 |
-
const
|
| 15061 |
-
|
| 15062 |
-
|
| 15063 |
-
|
| 15064 |
-
|
| 15065 |
-
|
| 15066 |
-
|
| 15067 |
-
const
|
| 15068 |
-
|
| 15069 |
-
|
| 15070 |
-
|
|
|
|
| 15071 |
};
|
| 15072 |
-
|
| 15073 |
-
|
| 15074 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
/******/
|
| 83 |
/******/
|
| 84 |
/******/ // Load entry module and return exports
|
| 85 |
+
/******/ return __webpack_require__(__webpack_require__.s = 488);
|
| 86 |
/******/ })
|
| 87 |
/************************************************************************/
|
| 88 |
+
/******/ ([
|
| 89 |
+
/* 0 */
|
|
|
|
| 90 |
/***/ (function(module, exports) {
|
| 91 |
|
| 92 |
(function() { module.exports = window["wp"]["element"]; }());
|
| 93 |
|
| 94 |
/***/ }),
|
| 95 |
+
/* 1 */
|
|
|
|
| 96 |
/***/ (function(module, exports) {
|
| 97 |
|
| 98 |
(function() { module.exports = window["wp"]["i18n"]; }());
|
| 99 |
|
| 100 |
/***/ }),
|
| 101 |
+
/* 2 */
|
| 102 |
+
/***/ (function(module, exports) {
|
| 103 |
+
|
| 104 |
+
(function() { module.exports = window["lodash"]; }());
|
| 105 |
+
|
| 106 |
+
/***/ }),
|
| 107 |
+
/* 3 */
|
| 108 |
+
/***/ (function(module, exports) {
|
| 109 |
+
|
| 110 |
+
(function() { module.exports = window["wp"]["components"]; }());
|
| 111 |
+
|
| 112 |
+
/***/ }),
|
| 113 |
+
/* 4 */
|
| 114 |
+
/***/ (function(module, exports) {
|
| 115 |
+
|
| 116 |
+
(function() { module.exports = window["wp"]["data"]; }());
|
| 117 |
+
|
| 118 |
+
/***/ }),
|
| 119 |
+
/* 5 */,
|
| 120 |
+
/* 6 */
|
| 121 |
+
/***/ (function(module, exports) {
|
| 122 |
+
|
| 123 |
+
(function() { module.exports = window["wp"]["primitives"]; }());
|
| 124 |
+
|
| 125 |
+
/***/ }),
|
| 126 |
+
/* 7 */
|
| 127 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 128 |
+
|
| 129 |
+
"use strict";
|
| 130 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
|
| 131 |
+
function _extends() {
|
| 132 |
+
_extends = Object.assign || function (target) {
|
| 133 |
+
for (var i = 1; i < arguments.length; i++) {
|
| 134 |
+
var source = arguments[i];
|
| 135 |
+
|
| 136 |
+
for (var key in source) {
|
| 137 |
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
| 138 |
+
target[key] = source[key];
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
return target;
|
| 144 |
+
};
|
| 145 |
+
|
| 146 |
+
return _extends.apply(this, arguments);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/***/ }),
|
| 150 |
+
/* 8 */
|
| 151 |
+
/***/ (function(module, exports) {
|
| 152 |
+
|
| 153 |
+
(function() { module.exports = window["wp"]["blocks"]; }());
|
| 154 |
+
|
| 155 |
+
/***/ }),
|
| 156 |
+
/* 9 */
|
| 157 |
+
/***/ (function(module, exports) {
|
| 158 |
+
|
| 159 |
+
(function() { module.exports = window["wp"]["compose"]; }());
|
| 160 |
|
| 161 |
+
/***/ }),
|
| 162 |
+
/* 10 */
|
| 163 |
/***/ (function(module, exports, __webpack_require__) {
|
| 164 |
|
| 165 |
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
| 166 |
+
Copyright (c) 2018 Jed Watson.
|
| 167 |
Licensed under the MIT License (MIT), see
|
| 168 |
http://jedwatson.github.io/classnames
|
| 169 |
*/
|
| 174 |
|
| 175 |
var hasOwn = {}.hasOwnProperty;
|
| 176 |
|
| 177 |
+
function classNames() {
|
| 178 |
var classes = [];
|
| 179 |
|
| 180 |
for (var i = 0; i < arguments.length; i++) {
|
| 186 |
if (argType === 'string' || argType === 'number') {
|
| 187 |
classes.push(arg);
|
| 188 |
} else if (Array.isArray(arg)) {
|
| 189 |
+
if (arg.length) {
|
| 190 |
+
var inner = classNames.apply(null, arg);
|
| 191 |
+
if (inner) {
|
| 192 |
+
classes.push(inner);
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
} else if (argType === 'object') {
|
| 196 |
+
if (arg.toString === Object.prototype.toString) {
|
| 197 |
+
for (var key in arg) {
|
| 198 |
+
if (hasOwn.call(arg, key) && arg[key]) {
|
| 199 |
+
classes.push(key);
|
| 200 |
+
}
|
| 201 |
}
|
| 202 |
+
} else {
|
| 203 |
+
classes.push(arg.toString());
|
| 204 |
}
|
| 205 |
}
|
| 206 |
}
|
| 209 |
}
|
| 210 |
|
| 211 |
if ( true && module.exports) {
|
| 212 |
+
classNames.default = classNames;
|
| 213 |
module.exports = classNames;
|
| 214 |
} else if (true) {
|
| 215 |
// register as 'classnames', consistent with npm package name
|
| 222 |
|
| 223 |
|
| 224 |
/***/ }),
|
| 225 |
+
/* 11 */
|
| 226 |
+
/***/ (function(module, exports) {
|
| 227 |
|
| 228 |
+
(function() { module.exports = window["React"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
/***/ }),
|
| 231 |
+
/* 12 */,
|
| 232 |
+
/* 13 */
|
| 233 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 234 |
|
| 235 |
+
"use strict";
|
| 236 |
|
| 237 |
+
// EXPORTS
|
| 238 |
+
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ storeConfig; });
|
| 239 |
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ store; });
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
+
// NAMESPACE OBJECT: ./packages/block-editor/build-module/store/selectors.js
|
| 242 |
+
var selectors_namespaceObject = {};
|
| 243 |
+
__webpack_require__.r(selectors_namespaceObject);
|
| 244 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; });
|
| 245 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; });
|
| 246 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; });
|
| 247 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; });
|
| 248 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; });
|
| 249 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return getBlocks; });
|
| 250 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithBlockTree", function() { return __unstableGetBlockWithBlockTree; });
|
| 251 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockTree", function() { return __unstableGetBlockTree; });
|
| 252 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdWithClientIdsTree", function() { return __unstableGetClientIdWithClientIdsTree; });
|
| 253 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdsTree", function() { return __unstableGetClientIdsTree; });
|
| 254 |
+
__webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; });
|
| 255 |
+
__webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; });
|
| 256 |
+
__webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return getGlobalBlockCount; });
|
| 257 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; });
|
| 258 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; });
|
| 259 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectionStart", function() { return getSelectionStart; });
|
| 260 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectionEnd", function() { return getSelectionEnd; });
|
| 261 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; });
|
| 262 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; });
|
| 263 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; });
|
| 264 |
+
__webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; });
|
| 265 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; });
|
| 266 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; });
|
| 267 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; });
|
| 268 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockParents", function() { return getBlockParents; });
|
| 269 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockParentsByBlockName", function() { return getBlockParentsByBlockName; });
|
| 270 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; });
|
| 271 |
+
__webpack_require__.d(selectors_namespaceObject, "getLowestCommonAncestorWithSelectedBlock", function() { return getLowestCommonAncestorWithSelectedBlock; });
|
| 272 |
+
__webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; });
|
| 273 |
+
__webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; });
|
| 274 |
+
__webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; });
|
| 275 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; });
|
| 276 |
+
__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientIds", function() { return getSelectedBlockClientIds; });
|
| 277 |
+
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; });
|
| 278 |
+
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; });
|
| 279 |
+
__webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; });
|
| 280 |
+
__webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; });
|
| 281 |
+
__webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; });
|
| 282 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; });
|
| 283 |
+
__webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; });
|
| 284 |
+
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; });
|
| 285 |
+
__webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; });
|
| 286 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; });
|
| 287 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; });
|
| 288 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; });
|
| 289 |
+
__webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; });
|
| 290 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; });
|
| 291 |
+
__webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; });
|
| 292 |
+
__webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return selectors_isMultiSelecting; });
|
| 293 |
+
__webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return selectors_isSelectionEnabled; });
|
| 294 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; });
|
| 295 |
+
__webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; });
|
| 296 |
+
__webpack_require__.d(selectors_namespaceObject, "isDraggingBlocks", function() { return isDraggingBlocks; });
|
| 297 |
+
__webpack_require__.d(selectors_namespaceObject, "getDraggedBlockClientIds", function() { return getDraggedBlockClientIds; });
|
| 298 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockBeingDragged", function() { return isBlockBeingDragged; });
|
| 299 |
+
__webpack_require__.d(selectors_namespaceObject, "isAncestorBeingDragged", function() { return isAncestorBeingDragged; });
|
| 300 |
+
__webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; });
|
| 301 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; });
|
| 302 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; });
|
| 303 |
+
__webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return selectors_isValidTemplate; });
|
| 304 |
+
__webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; });
|
| 305 |
+
__webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; });
|
| 306 |
+
__webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; });
|
| 307 |
+
__webpack_require__.d(selectors_namespaceObject, "canInsertBlocks", function() { return selectors_canInsertBlocks; });
|
| 308 |
+
__webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; });
|
| 309 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockTransformItems", function() { return getBlockTransformItems; });
|
| 310 |
+
__webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; });
|
| 311 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedBlocks", function() { return __experimentalGetAllowedBlocks; });
|
| 312 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedPattern", function() { return __experimentalGetParsedPattern; });
|
| 313 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedPatterns", function() { return __experimentalGetAllowedPatterns; });
|
| 314 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternsByBlockTypes", function() { return __experimentalGetPatternsByBlockTypes; });
|
| 315 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternTransformItems", function() { return __experimentalGetPatternTransformItems; });
|
| 316 |
+
__webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; });
|
| 317 |
+
__webpack_require__.d(selectors_namespaceObject, "getSettings", function() { return getSettings; });
|
| 318 |
+
__webpack_require__.d(selectors_namespaceObject, "isLastBlockChangePersistent", function() { return isLastBlockChangePersistent; });
|
| 319 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetBlockListSettingsForBlocks", function() { return __experimentalGetBlockListSettingsForBlocks; });
|
| 320 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedReusableBlock", function() { return __experimentalGetParsedReusableBlock; });
|
| 321 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlockTitle", function() { return __experimentalGetReusableBlockTitle; });
|
| 322 |
+
__webpack_require__.d(selectors_namespaceObject, "__unstableIsLastBlockChangeIgnored", function() { return __unstableIsLastBlockChangeIgnored; });
|
| 323 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetLastBlockAttributeChanges", function() { return __experimentalGetLastBlockAttributeChanges; });
|
| 324 |
+
__webpack_require__.d(selectors_namespaceObject, "isNavigationMode", function() { return selectors_isNavigationMode; });
|
| 325 |
+
__webpack_require__.d(selectors_namespaceObject, "hasBlockMovingClientId", function() { return selectors_hasBlockMovingClientId; });
|
| 326 |
+
__webpack_require__.d(selectors_namespaceObject, "didAutomaticChange", function() { return didAutomaticChange; });
|
| 327 |
+
__webpack_require__.d(selectors_namespaceObject, "isBlockHighlighted", function() { return isBlockHighlighted; });
|
| 328 |
+
__webpack_require__.d(selectors_namespaceObject, "areInnerBlocksControlled", function() { return areInnerBlocksControlled; });
|
| 329 |
+
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetActiveBlockIdByBlockNames", function() { return __experimentalGetActiveBlockIdByBlockNames; });
|
| 330 |
+
__webpack_require__.d(selectors_namespaceObject, "wasBlockJustInserted", function() { return wasBlockJustInserted; });
|
| 331 |
|
| 332 |
+
// NAMESPACE OBJECT: ./packages/block-editor/build-module/store/actions.js
|
| 333 |
+
var actions_namespaceObject = {};
|
| 334 |
+
__webpack_require__.r(actions_namespaceObject);
|
| 335 |
+
__webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; });
|
| 336 |
+
__webpack_require__.d(actions_namespaceObject, "validateBlocksToTemplate", function() { return validateBlocksToTemplate; });
|
| 337 |
+
__webpack_require__.d(actions_namespaceObject, "resetSelection", function() { return resetSelection; });
|
| 338 |
+
__webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; });
|
| 339 |
+
__webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; });
|
| 340 |
+
__webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; });
|
| 341 |
+
__webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return selectBlock; });
|
| 342 |
+
__webpack_require__.d(actions_namespaceObject, "selectPreviousBlock", function() { return selectPreviousBlock; });
|
| 343 |
+
__webpack_require__.d(actions_namespaceObject, "selectNextBlock", function() { return selectNextBlock; });
|
| 344 |
+
__webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; });
|
| 345 |
+
__webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; });
|
| 346 |
+
__webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; });
|
| 347 |
+
__webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return clearSelectedBlock; });
|
| 348 |
+
__webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; });
|
| 349 |
+
__webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; });
|
| 350 |
+
__webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; });
|
| 351 |
+
__webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; });
|
| 352 |
+
__webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; });
|
| 353 |
+
__webpack_require__.d(actions_namespaceObject, "moveBlocksToPosition", function() { return moveBlocksToPosition; });
|
| 354 |
+
__webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; });
|
| 355 |
+
__webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; });
|
| 356 |
+
__webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return insertBlocks; });
|
| 357 |
+
__webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; });
|
| 358 |
+
__webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; });
|
| 359 |
+
__webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return setTemplateValidity; });
|
| 360 |
+
__webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return synchronizeTemplate; });
|
| 361 |
+
__webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; });
|
| 362 |
+
__webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return removeBlocks; });
|
| 363 |
+
__webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; });
|
| 364 |
+
__webpack_require__.d(actions_namespaceObject, "replaceInnerBlocks", function() { return replaceInnerBlocks; });
|
| 365 |
+
__webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; });
|
| 366 |
+
__webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; });
|
| 367 |
+
__webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; });
|
| 368 |
+
__webpack_require__.d(actions_namespaceObject, "startDraggingBlocks", function() { return startDraggingBlocks; });
|
| 369 |
+
__webpack_require__.d(actions_namespaceObject, "stopDraggingBlocks", function() { return stopDraggingBlocks; });
|
| 370 |
+
__webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; });
|
| 371 |
+
__webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; });
|
| 372 |
+
__webpack_require__.d(actions_namespaceObject, "selectionChange", function() { return selectionChange; });
|
| 373 |
+
__webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return insertDefaultBlock; });
|
| 374 |
+
__webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; });
|
| 375 |
+
__webpack_require__.d(actions_namespaceObject, "updateSettings", function() { return updateSettings; });
|
| 376 |
+
__webpack_require__.d(actions_namespaceObject, "__unstableSaveReusableBlock", function() { return __unstableSaveReusableBlock; });
|
| 377 |
+
__webpack_require__.d(actions_namespaceObject, "__unstableMarkLastChangeAsPersistent", function() { return __unstableMarkLastChangeAsPersistent; });
|
| 378 |
+
__webpack_require__.d(actions_namespaceObject, "__unstableMarkNextChangeAsNotPersistent", function() { return __unstableMarkNextChangeAsNotPersistent; });
|
| 379 |
+
__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChange", function() { return __unstableMarkAutomaticChange; });
|
| 380 |
+
__webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChangeFinal", function() { return __unstableMarkAutomaticChangeFinal; });
|
| 381 |
+
__webpack_require__.d(actions_namespaceObject, "setNavigationMode", function() { return setNavigationMode; });
|
| 382 |
+
__webpack_require__.d(actions_namespaceObject, "setBlockMovingClientId", function() { return setBlockMovingClientId; });
|
| 383 |
+
__webpack_require__.d(actions_namespaceObject, "duplicateBlocks", function() { return duplicateBlocks; });
|
| 384 |
+
__webpack_require__.d(actions_namespaceObject, "insertBeforeBlock", function() { return insertBeforeBlock; });
|
| 385 |
+
__webpack_require__.d(actions_namespaceObject, "insertAfterBlock", function() { return insertAfterBlock; });
|
| 386 |
+
__webpack_require__.d(actions_namespaceObject, "toggleBlockHighlight", function() { return toggleBlockHighlight; });
|
| 387 |
+
__webpack_require__.d(actions_namespaceObject, "flashBlock", function() { return flashBlock; });
|
| 388 |
+
__webpack_require__.d(actions_namespaceObject, "setHasControlledInnerBlocks", function() { return setHasControlledInnerBlocks; });
|
| 389 |
|
| 390 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 391 |
+
var external_wp_data_ = __webpack_require__(4);
|
|
|
|
| 392 |
|
| 393 |
+
// EXTERNAL MODULE: external "lodash"
|
| 394 |
+
var external_lodash_ = __webpack_require__(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
|
| 396 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 397 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
|
| 399 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/defaults.js
|
| 400 |
+
var defaults = __webpack_require__(105);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/array.js
|
| 403 |
+
/**
|
| 404 |
+
* External dependencies
|
| 405 |
+
*/
|
| 406 |
|
| 407 |
+
/**
|
| 408 |
+
* Insert one or multiple elements into a given position of an array.
|
| 409 |
+
*
|
| 410 |
+
* @param {Array} array Source array.
|
| 411 |
+
* @param {*} elements Elements to insert.
|
| 412 |
+
* @param {number} index Insert Position.
|
| 413 |
+
*
|
| 414 |
+
* @return {Array} Result.
|
| 415 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
|
| 417 |
+
function insertAt(array, elements, index) {
|
| 418 |
+
return [...array.slice(0, index), ...Object(external_lodash_["castArray"])(elements), ...array.slice(index)];
|
| 419 |
}
|
| 420 |
+
/**
|
| 421 |
+
* Moves an element in an array.
|
| 422 |
+
*
|
| 423 |
+
* @param {Array} array Source array.
|
| 424 |
+
* @param {number} from Source index.
|
| 425 |
+
* @param {number} to Destination index.
|
| 426 |
+
* @param {number} count Number of elements to move.
|
| 427 |
+
*
|
| 428 |
+
* @return {Array} Result.
|
| 429 |
+
*/
|
| 430 |
|
| 431 |
+
function moveTo(array, from, to, count = 1) {
|
| 432 |
+
const withoutMovedElements = [...array];
|
| 433 |
+
withoutMovedElements.splice(from, count);
|
| 434 |
+
return insertAt(withoutMovedElements, array.slice(from, from + count), to);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
}
|
| 436 |
+
//# sourceMappingURL=array.js.map
|
| 437 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/reducer.js
|
| 438 |
+
/**
|
| 439 |
+
* External dependencies
|
| 440 |
+
*/
|
|
|
|
|
|
|
| 441 |
|
| 442 |
+
/**
|
| 443 |
+
* WordPress dependencies
|
| 444 |
+
*/
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
|
|
|
|
| 447 |
|
| 448 |
+
/**
|
| 449 |
+
* Internal dependencies
|
| 450 |
+
*/
|
| 451 |
|
|
|
|
|
|
|
|
|
|
| 452 |
|
|
|
|
| 453 |
|
| 454 |
+
/**
|
| 455 |
+
* Given an array of blocks, returns an object where each key is a nesting
|
| 456 |
+
* context, the value of which is an array of block client IDs existing within
|
| 457 |
+
* that nesting context.
|
| 458 |
+
*
|
| 459 |
+
* @param {Array} blocks Blocks to map.
|
| 460 |
+
* @param {?string} rootClientId Assumed root client ID.
|
| 461 |
+
*
|
| 462 |
+
* @return {Object} Block order map object.
|
| 463 |
+
*/
|
| 464 |
|
| 465 |
+
function mapBlockOrder(blocks, rootClientId = '') {
|
| 466 |
+
const result = {
|
| 467 |
+
[rootClientId]: []
|
| 468 |
};
|
| 469 |
+
blocks.forEach(block => {
|
| 470 |
+
const {
|
| 471 |
+
clientId,
|
| 472 |
+
innerBlocks
|
| 473 |
+
} = block;
|
| 474 |
+
result[rootClientId].push(clientId);
|
| 475 |
+
Object.assign(result, mapBlockOrder(innerBlocks, clientId));
|
| 476 |
+
});
|
| 477 |
+
return result;
|
| 478 |
+
}
|
| 479 |
+
/**
|
| 480 |
+
* Given an array of blocks, returns an object where each key contains
|
| 481 |
+
* the clientId of the block and the value is the parent of the block.
|
| 482 |
+
*
|
| 483 |
+
* @param {Array} blocks Blocks to map.
|
| 484 |
+
* @param {?string} rootClientId Assumed root client ID.
|
| 485 |
+
*
|
| 486 |
+
* @return {Object} Block order map object.
|
| 487 |
+
*/
|
| 488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
|
| 490 |
+
function mapBlockParents(blocks, rootClientId = '') {
|
| 491 |
+
return blocks.reduce((result, block) => Object.assign(result, {
|
| 492 |
+
[block.clientId]: rootClientId
|
| 493 |
+
}, mapBlockParents(block.innerBlocks, block.clientId)), {});
|
| 494 |
+
}
|
| 495 |
+
/**
|
| 496 |
+
* Helper method to iterate through all blocks, recursing into inner blocks,
|
| 497 |
+
* applying a transformation function to each one.
|
| 498 |
+
* Returns a flattened object with the transformed blocks.
|
| 499 |
+
*
|
| 500 |
+
* @param {Array} blocks Blocks to flatten.
|
| 501 |
+
* @param {Function} transform Transforming function to be applied to each block.
|
| 502 |
+
*
|
| 503 |
+
* @return {Object} Flattened object.
|
| 504 |
+
*/
|
| 505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
|
| 507 |
+
function flattenBlocks(blocks, transform = external_lodash_["identity"]) {
|
| 508 |
+
const result = {};
|
| 509 |
+
const stack = [...blocks];
|
| 510 |
|
| 511 |
+
while (stack.length) {
|
| 512 |
+
const {
|
| 513 |
+
innerBlocks,
|
| 514 |
+
...block
|
| 515 |
+
} = stack.shift();
|
| 516 |
+
stack.push(...innerBlocks);
|
| 517 |
+
result[block.clientId] = transform(block);
|
| 518 |
+
}
|
| 519 |
|
| 520 |
+
return result;
|
| 521 |
+
}
|
| 522 |
+
/**
|
| 523 |
+
* Given an array of blocks, returns an object containing all blocks, without
|
| 524 |
+
* attributes, recursing into inner blocks. Keys correspond to the block client
|
| 525 |
+
* ID, the value of which is the attributes object.
|
| 526 |
+
*
|
| 527 |
+
* @param {Array} blocks Blocks to flatten.
|
| 528 |
+
*
|
| 529 |
+
* @return {Object} Flattened block attributes object.
|
| 530 |
+
*/
|
| 531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
|
| 533 |
+
function getFlattenedBlocksWithoutAttributes(blocks) {
|
| 534 |
+
return flattenBlocks(blocks, block => Object(external_lodash_["omit"])(block, 'attributes'));
|
| 535 |
+
}
|
| 536 |
+
/**
|
| 537 |
+
* Given an array of blocks, returns an object containing all block attributes,
|
| 538 |
+
* recursing into inner blocks. Keys correspond to the block client ID, the
|
| 539 |
+
* value of which is the attributes object.
|
| 540 |
+
*
|
| 541 |
+
* @param {Array} blocks Blocks to flatten.
|
| 542 |
+
*
|
| 543 |
+
* @return {Object} Flattened block attributes object.
|
| 544 |
+
*/
|
| 545 |
|
|
|
|
|
|
|
| 546 |
|
| 547 |
+
function getFlattenedBlockAttributes(blocks) {
|
| 548 |
+
return flattenBlocks(blocks, block => block.attributes);
|
| 549 |
+
}
|
| 550 |
+
/**
|
| 551 |
+
* Given a block order map object, returns *all* of the block client IDs that are
|
| 552 |
+
* a descendant of the given root client ID.
|
| 553 |
+
*
|
| 554 |
+
* Calling this with `rootClientId` set to `''` results in a list of client IDs
|
| 555 |
+
* that are in the post. That is, it excludes blocks like fetched reusable
|
| 556 |
+
* blocks which are stored into state but not visible. It also excludes
|
| 557 |
+
* InnerBlocks controllers, like template parts.
|
| 558 |
+
*
|
| 559 |
+
* It is important to exclude the full inner block controller and not just the
|
| 560 |
+
* inner blocks because in many cases, we need to persist the previous value of
|
| 561 |
+
* an inner block controller. To do so, it must be excluded from the list of
|
| 562 |
+
* client IDs which are considered to be part of the top-level entity.
|
| 563 |
+
*
|
| 564 |
+
* @param {Object} blocksOrder Object that maps block client IDs to a list of
|
| 565 |
+
* nested block client IDs.
|
| 566 |
+
* @param {?string} rootClientId The root client ID to search. Defaults to ''.
|
| 567 |
+
* @param {?Object} controlledInnerBlocks The InnerBlocks controller state.
|
| 568 |
+
*
|
| 569 |
+
* @return {Array} List of descendant client IDs.
|
| 570 |
+
*/
|
| 571 |
|
|
|
|
|
|
|
| 572 |
|
| 573 |
+
function getNestedBlockClientIds(blocksOrder, rootClientId = '', controlledInnerBlocks = {}) {
|
| 574 |
+
return Object(external_lodash_["reduce"])(blocksOrder[rootClientId], (result, clientId) => {
|
| 575 |
+
if (!!controlledInnerBlocks[clientId]) {
|
| 576 |
+
return result;
|
| 577 |
}
|
| 578 |
|
| 579 |
+
return [...result, clientId, ...getNestedBlockClientIds(blocksOrder, clientId)];
|
| 580 |
+
}, []);
|
| 581 |
+
}
|
| 582 |
+
/**
|
| 583 |
+
* Returns an object against which it is safe to perform mutating operations,
|
| 584 |
+
* given the original object and its current working copy.
|
| 585 |
+
*
|
| 586 |
+
* @param {Object} original Original object.
|
| 587 |
+
* @param {Object} working Working object.
|
| 588 |
+
*
|
| 589 |
+
* @return {Object} Mutation-safe object.
|
| 590 |
+
*/
|
| 591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
|
| 593 |
+
function getMutateSafeObject(original, working) {
|
| 594 |
+
if (original === working) {
|
| 595 |
+
return { ...original
|
|
|
|
| 596 |
};
|
|
|
|
|
|
|
| 597 |
}
|
| 598 |
|
| 599 |
+
return working;
|
| 600 |
+
}
|
| 601 |
+
/**
|
| 602 |
+
* Returns true if the two object arguments have the same keys, or false
|
| 603 |
+
* otherwise.
|
| 604 |
+
*
|
| 605 |
+
* @param {Object} a First object.
|
| 606 |
+
* @param {Object} b Second object.
|
| 607 |
+
*
|
| 608 |
+
* @return {boolean} Whether the two objects have the same keys.
|
| 609 |
+
*/
|
| 610 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
|
| 612 |
+
function hasSameKeys(a, b) {
|
| 613 |
+
return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b));
|
| 614 |
+
}
|
| 615 |
+
/**
|
| 616 |
+
* Returns true if, given the currently dispatching action and the previously
|
| 617 |
+
* dispatched action, the two actions are updating the same block attribute, or
|
| 618 |
+
* false otherwise.
|
| 619 |
+
*
|
| 620 |
+
* @param {Object} action Currently dispatching action.
|
| 621 |
+
* @param {Object} lastAction Previously dispatched action.
|
| 622 |
+
*
|
| 623 |
+
* @return {boolean} Whether actions are updating the same block attribute.
|
| 624 |
+
*/
|
| 625 |
|
| 626 |
+
function isUpdatingSameBlockAttribute(action, lastAction) {
|
| 627 |
+
return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && Object(external_lodash_["isEqual"])(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
|
| 628 |
+
}
|
| 629 |
+
/**
|
| 630 |
+
* Utility returning an object with an empty object value for each key.
|
| 631 |
+
*
|
| 632 |
+
* @param {Array} objectKeys Keys to fill.
|
| 633 |
+
* @return {Object} Object filled with empty object as values for each clientId.
|
| 634 |
+
*/
|
| 635 |
|
| 636 |
+
const fillKeysWithEmptyObject = objectKeys => {
|
| 637 |
+
return objectKeys.reduce((result, key) => {
|
| 638 |
+
result[key] = {};
|
| 639 |
+
return result;
|
| 640 |
+
}, {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 641 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
/**
|
| 643 |
+
* Higher-order reducer intended to compute a cache key for each block in the post.
|
| 644 |
+
* A new instance of the cache key (empty object) is created each time the block object
|
| 645 |
+
* needs to be refreshed (for any change in the block or its children).
|
| 646 |
+
*
|
| 647 |
+
* @param {Function} reducer Original reducer function.
|
| 648 |
+
*
|
| 649 |
+
* @return {Function} Enhanced reducer function.
|
| 650 |
*/
|
| 651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 652 |
|
| 653 |
+
const withBlockCache = reducer => (state = {}, action) => {
|
| 654 |
+
const newState = reducer(state, action);
|
| 655 |
|
| 656 |
+
if (newState === state) {
|
| 657 |
+
return state;
|
| 658 |
}
|
| 659 |
|
| 660 |
+
newState.cache = state.cache ? state.cache : {};
|
| 661 |
+
/**
|
| 662 |
+
* For each clientId provided, traverses up parents, adding the provided clientIds
|
| 663 |
+
* and each parent's clientId to the returned array.
|
| 664 |
+
*
|
| 665 |
+
* When calling this function consider that it uses the old state, so any state
|
| 666 |
+
* modifications made by the `reducer` will not be present.
|
| 667 |
+
*
|
| 668 |
+
* @param {Array} clientIds an Array of block clientIds.
|
| 669 |
+
*
|
| 670 |
+
* @return {Array} The provided clientIds and all of their parent clientIds.
|
| 671 |
+
*/
|
| 672 |
|
| 673 |
+
const getBlocksWithParentsClientIds = clientIds => {
|
| 674 |
+
return clientIds.reduce((result, clientId) => {
|
| 675 |
+
let current = clientId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
|
| 677 |
+
do {
|
| 678 |
+
result.push(current);
|
| 679 |
+
current = state.parents[current];
|
| 680 |
+
} while (current && !state.controlledInnerBlocks[current]);
|
|
|
|
|
|
|
| 681 |
|
| 682 |
+
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
}, []);
|
| 684 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
|
| 686 |
+
switch (action.type) {
|
| 687 |
+
case 'RESET_BLOCKS':
|
| 688 |
+
newState.cache = Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({}));
|
| 689 |
+
break;
|
| 690 |
|
| 691 |
+
case 'RECEIVE_BLOCKS':
|
| 692 |
+
case 'INSERT_BLOCKS':
|
| 693 |
+
{
|
| 694 |
+
const updatedBlockUids = Object(external_lodash_["keys"])(flattenBlocks(action.blocks));
|
| 695 |
|
| 696 |
+
if (action.rootClientId && !state.controlledInnerBlocks[action.rootClientId]) {
|
| 697 |
+
updatedBlockUids.push(action.rootClientId);
|
| 698 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 699 |
|
| 700 |
+
newState.cache = { ...newState.cache,
|
| 701 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 702 |
+
};
|
| 703 |
+
break;
|
| 704 |
+
}
|
| 705 |
|
| 706 |
+
case 'UPDATE_BLOCK':
|
| 707 |
+
newState.cache = { ...newState.cache,
|
| 708 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds([action.clientId]))
|
| 709 |
+
};
|
| 710 |
+
break;
|
| 711 |
|
| 712 |
+
case 'UPDATE_BLOCK_ATTRIBUTES':
|
| 713 |
+
newState.cache = { ...newState.cache,
|
| 714 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.clientIds))
|
| 715 |
+
};
|
| 716 |
+
break;
|
| 717 |
|
| 718 |
+
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 719 |
+
const parentClientIds = fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.replacedClientIds));
|
| 720 |
+
newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.replacedClientIds),
|
| 721 |
+
...Object(external_lodash_["omit"])(parentClientIds, action.replacedClientIds),
|
| 722 |
+
...fillKeysWithEmptyObject(Object(external_lodash_["keys"])(flattenBlocks(action.blocks)))
|
| 723 |
+
};
|
| 724 |
+
break;
|
| 725 |
|
| 726 |
+
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 727 |
+
newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.removedClientIds),
|
| 728 |
+
...fillKeysWithEmptyObject(Object(external_lodash_["difference"])(getBlocksWithParentsClientIds(action.clientIds), action.clientIds))
|
| 729 |
+
};
|
| 730 |
+
break;
|
| 731 |
|
| 732 |
+
case 'MOVE_BLOCKS_TO_POSITION':
|
| 733 |
+
{
|
| 734 |
+
const updatedBlockUids = [...action.clientIds];
|
| 735 |
|
| 736 |
+
if (action.fromRootClientId) {
|
| 737 |
+
updatedBlockUids.push(action.fromRootClientId);
|
|
|
|
|
|
|
| 738 |
}
|
| 739 |
|
| 740 |
+
if (action.toRootClientId) {
|
| 741 |
+
updatedBlockUids.push(action.toRootClientId);
|
| 742 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 743 |
|
| 744 |
+
newState.cache = { ...newState.cache,
|
| 745 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 746 |
+
};
|
| 747 |
+
break;
|
| 748 |
+
}
|
|
|
|
|
|
|
| 749 |
|
| 750 |
+
case 'MOVE_BLOCKS_UP':
|
| 751 |
+
case 'MOVE_BLOCKS_DOWN':
|
| 752 |
+
{
|
| 753 |
+
const updatedBlockUids = [];
|
| 754 |
|
| 755 |
+
if (action.rootClientId) {
|
| 756 |
+
updatedBlockUids.push(action.rootClientId);
|
| 757 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
|
| 759 |
+
newState.cache = { ...newState.cache,
|
| 760 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 761 |
+
};
|
| 762 |
+
break;
|
| 763 |
+
}
|
| 764 |
|
| 765 |
+
case 'SAVE_REUSABLE_BLOCK_SUCCESS':
|
| 766 |
+
{
|
| 767 |
+
const updatedBlockUids = Object(external_lodash_["keys"])(Object(external_lodash_["omitBy"])(newState.attributes, (attributes, clientId) => {
|
| 768 |
+
return newState.byClientId[clientId].name !== 'core/block' || attributes.ref !== action.updatedId;
|
| 769 |
+
}));
|
| 770 |
+
newState.cache = { ...newState.cache,
|
| 771 |
+
...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids))
|
| 772 |
+
};
|
| 773 |
+
}
|
| 774 |
+
}
|
| 775 |
|
| 776 |
+
return newState;
|
| 777 |
+
};
|
| 778 |
+
/**
|
| 779 |
+
* Higher-order reducer intended to augment the blocks reducer, assigning an
|
| 780 |
+
* `isPersistentChange` property value corresponding to whether a change in
|
| 781 |
+
* state can be considered as persistent. All changes are considered persistent
|
| 782 |
+
* except when updating the same block attribute as in the previous action.
|
| 783 |
+
*
|
| 784 |
+
* @param {Function} reducer Original reducer function.
|
| 785 |
+
*
|
| 786 |
+
* @return {Function} Enhanced reducer function.
|
| 787 |
+
*/
|
| 788 |
|
|
|
|
|
|
|
|
|
|
| 789 |
|
| 790 |
+
function withPersistentBlockChange(reducer) {
|
| 791 |
+
let lastAction;
|
| 792 |
+
let markNextChangeAsNotPersistent = false;
|
| 793 |
+
return (state, action) => {
|
| 794 |
+
let nextState = reducer(state, action);
|
| 795 |
+
const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent; // Defer to previous state value (or default) unless changing or
|
| 796 |
+
// explicitly marking as persistent.
|
| 797 |
|
| 798 |
+
if (state === nextState && !isExplicitPersistentChange) {
|
| 799 |
+
var _state$isPersistentCh;
|
| 800 |
|
| 801 |
+
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
|
| 802 |
+
const nextIsPersistentChange = (_state$isPersistentCh = state === null || state === void 0 ? void 0 : state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true;
|
| 803 |
|
| 804 |
+
if (state.isPersistentChange === nextIsPersistentChange) {
|
| 805 |
+
return state;
|
| 806 |
+
}
|
| 807 |
|
| 808 |
+
return { ...nextState,
|
| 809 |
+
isPersistentChange: nextIsPersistentChange
|
| 810 |
+
};
|
| 811 |
}
|
|
|
|
| 812 |
|
| 813 |
+
nextState = { ...nextState,
|
| 814 |
+
isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
|
| 815 |
+
}; // In comparing against the previous action, consider only those which
|
| 816 |
+
// would have qualified as one which would have been ignored or not
|
| 817 |
+
// have resulted in a changed state.
|
| 818 |
|
| 819 |
+
lastAction = action;
|
| 820 |
+
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
|
| 821 |
+
return nextState;
|
| 822 |
+
};
|
| 823 |
+
}
|
| 824 |
+
/**
|
| 825 |
+
* Higher-order reducer intended to augment the blocks reducer, assigning an
|
| 826 |
+
* `isIgnoredChange` property value corresponding to whether a change in state
|
| 827 |
+
* can be considered as ignored. A change is considered ignored when the result
|
| 828 |
+
* of an action not incurred by direct user interaction.
|
| 829 |
+
*
|
| 830 |
+
* @param {Function} reducer Original reducer function.
|
| 831 |
+
*
|
| 832 |
+
* @return {Function} Enhanced reducer function.
|
| 833 |
+
*/
|
| 834 |
|
|
|
|
|
|
|
| 835 |
|
| 836 |
+
function withIgnoredBlockChange(reducer) {
|
| 837 |
+
/**
|
| 838 |
+
* Set of action types for which a blocks state change should be ignored.
|
| 839 |
+
*
|
| 840 |
+
* @type {Set}
|
| 841 |
+
*/
|
| 842 |
+
const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']);
|
| 843 |
+
return (state, action) => {
|
| 844 |
+
const nextState = reducer(state, action);
|
| 845 |
|
| 846 |
+
if (nextState !== state) {
|
| 847 |
+
nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
|
| 848 |
+
}
|
|
|
|
|
|
|
| 849 |
|
| 850 |
+
return nextState;
|
| 851 |
+
};
|
| 852 |
+
}
|
| 853 |
+
/**
|
| 854 |
+
* Higher-order reducer targeting the combined blocks reducer, augmenting
|
| 855 |
+
* block client IDs in remove action to include cascade of inner blocks.
|
| 856 |
+
*
|
| 857 |
+
* @param {Function} reducer Original reducer function.
|
| 858 |
+
*
|
| 859 |
+
* @return {Function} Enhanced reducer function.
|
| 860 |
+
*/
|
| 861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
|
| 863 |
+
const withInnerBlocksRemoveCascade = reducer => (state, action) => {
|
| 864 |
+
// Gets all children which need to be removed.
|
| 865 |
+
const getAllChildren = clientIds => {
|
| 866 |
+
let result = clientIds;
|
|
|
|
|
|
|
|
|
|
| 867 |
|
| 868 |
+
for (let i = 0; i < result.length; i++) {
|
| 869 |
+
if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
|
| 870 |
+
continue;
|
| 871 |
+
}
|
| 872 |
|
| 873 |
+
if (result === clientIds) {
|
| 874 |
+
result = [...result];
|
| 875 |
+
}
|
|
|
|
|
|
|
| 876 |
|
| 877 |
+
result.push(...state.order[result[i]]);
|
| 878 |
+
}
|
|
|
|
| 879 |
|
| 880 |
+
return result;
|
|
|
|
|
|
|
| 881 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 882 |
|
| 883 |
+
if (state) {
|
| 884 |
+
switch (action.type) {
|
| 885 |
+
case 'REMOVE_BLOCKS':
|
| 886 |
+
action = { ...action,
|
| 887 |
+
type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN',
|
| 888 |
+
removedClientIds: getAllChildren(action.clientIds)
|
| 889 |
+
};
|
| 890 |
+
break;
|
| 891 |
|
| 892 |
+
case 'REPLACE_BLOCKS':
|
| 893 |
+
action = { ...action,
|
| 894 |
+
type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN',
|
| 895 |
+
replacedClientIds: getAllChildren(action.clientIds)
|
| 896 |
+
};
|
| 897 |
+
break;
|
| 898 |
+
}
|
| 899 |
}
|
| 900 |
|
| 901 |
+
return reducer(state, action);
|
| 902 |
+
};
|
| 903 |
+
/**
|
| 904 |
+
* Higher-order reducer which targets the combined blocks reducer and handles
|
| 905 |
+
* the `RESET_BLOCKS` action. When dispatched, this action will replace all
|
| 906 |
+
* blocks that exist in the post, leaving blocks that exist only in state (e.g.
|
| 907 |
+
* reusable blocks and blocks controlled by inner blocks controllers) alone.
|
| 908 |
+
*
|
| 909 |
+
* @param {Function} reducer Original reducer function.
|
| 910 |
+
*
|
| 911 |
+
* @return {Function} Enhanced reducer function.
|
| 912 |
+
*/
|
| 913 |
|
|
|
|
| 914 |
|
| 915 |
+
const withBlockReset = reducer => (state, action) => {
|
| 916 |
+
if (state && action.type === 'RESET_BLOCKS') {
|
| 917 |
+
/**
|
| 918 |
+
* A list of client IDs associated with the top level entity (like a
|
| 919 |
+
* post or template). It excludes the client IDs of blocks associated
|
| 920 |
+
* with other entities, like inner block controllers or reusable blocks.
|
| 921 |
+
*/
|
| 922 |
+
const visibleClientIds = getNestedBlockClientIds(state.order, '', state.controlledInnerBlocks); // pickBy returns only the truthy values from controlledInnerBlocks
|
| 923 |
|
| 924 |
+
const controlledInnerBlocks = Object.keys(Object(external_lodash_["pickBy"])(state.controlledInnerBlocks));
|
| 925 |
+
/**
|
| 926 |
+
* Each update operation consists of a few parts:
|
| 927 |
+
* 1. First, the client IDs associated with the top level entity are
|
| 928 |
+
* removed from the existing state key, leaving in place controlled
|
| 929 |
+
* blocks (like reusable blocks and inner block controllers).
|
| 930 |
+
* 2. Second, the blocks from the reset action are used to calculate the
|
| 931 |
+
* individual state keys. This will re-populate the clientIDs which
|
| 932 |
+
* were removed in step 1.
|
| 933 |
+
* 3. In some cases, we remove the recalculated inner block controllers,
|
| 934 |
+
* letting their old values persist. We need to do this because the
|
| 935 |
+
* reset block action from a top-level entity is not aware of any
|
| 936 |
+
* inner blocks inside InnerBlock controllers. So if the new values
|
| 937 |
+
* were used, it would not take into account the existing InnerBlocks
|
| 938 |
+
* which already exist in the state for inner block controllers. For
|
| 939 |
+
* example, `attributes` uses the newly computed value for controllers
|
| 940 |
+
* since attributes are stored in the top-level entity. But `order`
|
| 941 |
+
* uses the previous value for the controllers since the new value
|
| 942 |
+
* does not include the order of controlled inner blocks. So if the
|
| 943 |
+
* new value was used, template parts would disappear from the editor
|
| 944 |
+
* whenever you try to undo a change in the top level entity.
|
| 945 |
+
*/
|
| 946 |
|
| 947 |
+
return { ...state,
|
| 948 |
+
byClientId: { ...Object(external_lodash_["omit"])(state.byClientId, visibleClientIds),
|
| 949 |
+
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 950 |
+
},
|
| 951 |
+
attributes: { ...Object(external_lodash_["omit"])(state.attributes, visibleClientIds),
|
| 952 |
+
...getFlattenedBlockAttributes(action.blocks)
|
| 953 |
+
},
|
| 954 |
+
order: { ...Object(external_lodash_["omit"])(state.order, visibleClientIds),
|
| 955 |
+
...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), controlledInnerBlocks)
|
| 956 |
+
},
|
| 957 |
+
parents: { ...Object(external_lodash_["omit"])(state.parents, visibleClientIds),
|
| 958 |
+
...mapBlockParents(action.blocks)
|
| 959 |
+
},
|
| 960 |
+
cache: { ...Object(external_lodash_["omit"])(state.cache, visibleClientIds),
|
| 961 |
+
...Object(external_lodash_["omit"])(Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})), controlledInnerBlocks)
|
| 962 |
+
}
|
| 963 |
+
};
|
| 964 |
}
|
| 965 |
|
| 966 |
+
return reducer(state, action);
|
| 967 |
+
};
|
| 968 |
+
/**
|
| 969 |
+
* Higher-order reducer which targets the combined blocks reducer and handles
|
| 970 |
+
* the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state
|
| 971 |
+
* should become equivalent to the execution of a `REMOVE_BLOCKS` action
|
| 972 |
+
* containing all the child's of the root block followed by the execution of
|
| 973 |
+
* `INSERT_BLOCKS` with the new blocks.
|
| 974 |
+
*
|
| 975 |
+
* @param {Function} reducer Original reducer function.
|
| 976 |
+
*
|
| 977 |
+
* @return {Function} Enhanced reducer function.
|
| 978 |
+
*/
|
| 979 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 980 |
|
| 981 |
+
const withReplaceInnerBlocks = reducer => (state, action) => {
|
| 982 |
+
if (action.type !== 'REPLACE_INNER_BLOCKS') {
|
| 983 |
+
return reducer(state, action);
|
| 984 |
+
} // Finds every nested inner block controller. We must check the action blocks
|
| 985 |
+
// and not just the block parent state because some inner block controllers
|
| 986 |
+
// should be deleted if specified, whereas others should not be deleted. If
|
| 987 |
+
// a controlled should not be deleted, then we need to avoid deleting its
|
| 988 |
+
// inner blocks from the block state because its inner blocks will not be
|
| 989 |
+
// attached to the block in the action.
|
| 990 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 991 |
|
| 992 |
+
const nestedControllers = {};
|
|
|
|
|
|
|
| 993 |
|
| 994 |
+
if (Object.keys(state.controlledInnerBlocks).length) {
|
| 995 |
+
const stack = [...action.blocks];
|
|
|
|
| 996 |
|
| 997 |
+
while (stack.length) {
|
| 998 |
+
const {
|
| 999 |
+
innerBlocks,
|
| 1000 |
+
...block
|
| 1001 |
+
} = stack.shift();
|
| 1002 |
+
stack.push(...innerBlocks);
|
| 1003 |
|
| 1004 |
+
if (!!state.controlledInnerBlocks[block.clientId]) {
|
| 1005 |
+
nestedControllers[block.clientId] = true;
|
| 1006 |
+
}
|
| 1007 |
+
}
|
| 1008 |
+
} // The `keepControlledInnerBlocks` prop will keep the inner blocks of the
|
| 1009 |
+
// marked block in the block state so that they can be reattached to the
|
| 1010 |
+
// marked block when we re-insert everything a few lines below.
|
| 1011 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1012 |
|
| 1013 |
+
let stateAfterBlocksRemoval = state;
|
|
|
|
|
|
|
| 1014 |
|
| 1015 |
+
if (state.order[action.rootClientId]) {
|
| 1016 |
+
stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
|
| 1017 |
+
type: 'REMOVE_BLOCKS',
|
| 1018 |
+
keepControlledInnerBlocks: nestedControllers,
|
| 1019 |
+
clientIds: state.order[action.rootClientId]
|
| 1020 |
+
});
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
+
let stateAfterInsert = stateAfterBlocksRemoval;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1024 |
|
| 1025 |
+
if (action.blocks.length) {
|
| 1026 |
+
stateAfterInsert = reducer(stateAfterInsert, { ...action,
|
| 1027 |
+
type: 'INSERT_BLOCKS',
|
| 1028 |
+
index: 0
|
| 1029 |
+
}); // We need to re-attach the block order of the controlled inner blocks.
|
| 1030 |
+
// Otherwise, an inner block controller's blocks will be deleted entirely
|
| 1031 |
+
// from its entity..
|
| 1032 |
|
| 1033 |
+
stateAfterInsert.order = { ...stateAfterInsert.order,
|
| 1034 |
+
...Object(external_lodash_["reduce"])(nestedControllers, (result, value, key) => {
|
| 1035 |
+
if (state.order[key]) {
|
| 1036 |
+
result[key] = state.order[key];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1037 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1038 |
|
| 1039 |
+
return result;
|
| 1040 |
+
}, {})
|
| 1041 |
+
};
|
| 1042 |
+
}
|
| 1043 |
+
|
| 1044 |
+
return stateAfterInsert;
|
| 1045 |
+
};
|
| 1046 |
/**
|
| 1047 |
+
* Higher-order reducer which targets the combined blocks reducer and handles
|
| 1048 |
+
* the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by
|
| 1049 |
+
* regular reducers and needs a higher-order reducer since it needs access to
|
| 1050 |
+
* both `byClientId` and `attributes` simultaneously.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1051 |
*
|
| 1052 |
+
* @param {Function} reducer Original reducer function.
|
|
|
|
|
|
|
|
|
|
| 1053 |
*
|
| 1054 |
+
* @return {Function} Enhanced reducer function.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1055 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1056 |
|
|
|
|
|
|
|
| 1057 |
|
| 1058 |
+
const withSaveReusableBlock = reducer => (state, action) => {
|
| 1059 |
+
if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') {
|
| 1060 |
+
const {
|
| 1061 |
+
id,
|
| 1062 |
+
updatedId
|
| 1063 |
+
} = action; // If a temporary reusable block is saved, we swap the temporary id with the final one
|
|
|
|
|
|
|
|
|
|
| 1064 |
|
| 1065 |
+
if (id === updatedId) {
|
| 1066 |
+
return state;
|
| 1067 |
+
}
|
|
|
|
| 1068 |
|
| 1069 |
+
state = { ...state
|
|
|
|
| 1070 |
};
|
| 1071 |
+
state.attributes = Object(external_lodash_["mapValues"])(state.attributes, (attributes, clientId) => {
|
| 1072 |
+
const {
|
| 1073 |
+
name
|
| 1074 |
+
} = state.byClientId[clientId];
|
| 1075 |
|
| 1076 |
+
if (name === 'core/block' && attributes.ref === id) {
|
| 1077 |
+
return { ...attributes,
|
| 1078 |
+
ref: updatedId
|
| 1079 |
+
};
|
| 1080 |
+
}
|
| 1081 |
|
| 1082 |
+
return attributes;
|
| 1083 |
+
});
|
| 1084 |
+
}
|
| 1085 |
|
| 1086 |
+
return reducer(state, action);
|
| 1087 |
+
};
|
| 1088 |
+
/**
|
| 1089 |
+
* Reducer returning the blocks state.
|
| 1090 |
+
*
|
| 1091 |
+
* @param {Object} state Current state.
|
| 1092 |
+
* @param {Object} action Dispatched action.
|
| 1093 |
+
*
|
| 1094 |
+
* @return {Object} Updated state.
|
| 1095 |
+
*/
|
| 1096 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1097 |
|
| 1098 |
+
const reducer_blocks = Object(external_lodash_["flow"])(external_wp_data_["combineReducers"], withSaveReusableBlock, // needs to be before withBlockCache
|
| 1099 |
+
withBlockCache, // needs to be before withInnerBlocksRemoveCascade
|
| 1100 |
+
withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade
|
| 1101 |
+
withBlockReset, withPersistentBlockChange, withIgnoredBlockChange)({
|
| 1102 |
+
byClientId(state = {}, action) {
|
| 1103 |
+
switch (action.type) {
|
| 1104 |
+
case 'RESET_BLOCKS':
|
| 1105 |
+
return getFlattenedBlocksWithoutAttributes(action.blocks);
|
| 1106 |
|
| 1107 |
+
case 'RECEIVE_BLOCKS':
|
| 1108 |
+
case 'INSERT_BLOCKS':
|
| 1109 |
+
return { ...state,
|
| 1110 |
+
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 1111 |
+
};
|
| 1112 |
|
| 1113 |
+
case 'UPDATE_BLOCK':
|
| 1114 |
+
// Ignore updates if block isn't known
|
| 1115 |
+
if (!state[action.clientId]) {
|
| 1116 |
+
return state;
|
| 1117 |
+
} // Do nothing if only attributes change.
|
| 1118 |
|
|
|
|
|
|
|
| 1119 |
|
| 1120 |
+
const changes = Object(external_lodash_["omit"])(action.updates, 'attributes');
|
|
|
|
|
|
|
|
|
|
| 1121 |
|
| 1122 |
+
if (Object(external_lodash_["isEmpty"])(changes)) {
|
| 1123 |
+
return state;
|
| 1124 |
+
}
|
| 1125 |
|
| 1126 |
+
return { ...state,
|
| 1127 |
+
[action.clientId]: { ...state[action.clientId],
|
| 1128 |
+
...changes
|
| 1129 |
+
}
|
| 1130 |
+
};
|
|
|
|
| 1131 |
|
| 1132 |
+
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1133 |
+
if (!action.blocks) {
|
| 1134 |
+
return state;
|
| 1135 |
+
}
|
| 1136 |
|
| 1137 |
+
return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds),
|
| 1138 |
+
...getFlattenedBlocksWithoutAttributes(action.blocks)
|
| 1139 |
+
};
|
| 1140 |
|
| 1141 |
+
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1142 |
+
return Object(external_lodash_["omit"])(state, action.removedClientIds);
|
| 1143 |
}
|
| 1144 |
|
| 1145 |
+
return state;
|
| 1146 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1147 |
|
| 1148 |
+
attributes(state = {}, action) {
|
| 1149 |
+
switch (action.type) {
|
| 1150 |
+
case 'RESET_BLOCKS':
|
| 1151 |
+
return getFlattenedBlockAttributes(action.blocks);
|
|
|
|
| 1152 |
|
| 1153 |
+
case 'RECEIVE_BLOCKS':
|
| 1154 |
+
case 'INSERT_BLOCKS':
|
| 1155 |
+
return { ...state,
|
| 1156 |
+
...getFlattenedBlockAttributes(action.blocks)
|
| 1157 |
+
};
|
| 1158 |
|
| 1159 |
+
case 'UPDATE_BLOCK':
|
| 1160 |
+
// Ignore updates if block isn't known or there are no attribute changes.
|
| 1161 |
+
if (!state[action.clientId] || !action.updates.attributes) {
|
| 1162 |
+
return state;
|
| 1163 |
+
}
|
| 1164 |
|
| 1165 |
+
return { ...state,
|
| 1166 |
+
[action.clientId]: { ...state[action.clientId],
|
| 1167 |
+
...action.updates.attributes
|
| 1168 |
+
}
|
| 1169 |
+
};
|
| 1170 |
|
| 1171 |
+
case 'UPDATE_BLOCK_ATTRIBUTES':
|
| 1172 |
+
{
|
| 1173 |
+
// Avoid a state change if none of the block IDs are known.
|
| 1174 |
+
if (action.clientIds.every(id => !state[id])) {
|
| 1175 |
+
return state;
|
| 1176 |
+
}
|
| 1177 |
|
| 1178 |
+
const next = action.clientIds.reduce((accumulator, id) => ({ ...accumulator,
|
| 1179 |
+
[id]: Object(external_lodash_["reduce"])(action.uniqueByBlock ? action.attributes[id] : action.attributes, (result, value, key) => {
|
| 1180 |
+
// Consider as updates only changed values.
|
| 1181 |
+
if (value !== result[key]) {
|
| 1182 |
+
result = getMutateSafeObject(state[id], result);
|
| 1183 |
+
result[key] = value;
|
| 1184 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1185 |
|
| 1186 |
+
return result;
|
| 1187 |
+
}, state[id])
|
| 1188 |
+
}), {});
|
| 1189 |
|
| 1190 |
+
if (action.clientIds.every(id => next[id] === state[id])) {
|
| 1191 |
+
return state;
|
| 1192 |
+
}
|
|
|
|
|
|
|
| 1193 |
|
| 1194 |
+
return { ...state,
|
| 1195 |
+
...next
|
| 1196 |
+
};
|
| 1197 |
+
}
|
| 1198 |
|
| 1199 |
+
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1200 |
+
if (!action.blocks) {
|
| 1201 |
+
return state;
|
| 1202 |
+
}
|
| 1203 |
|
| 1204 |
+
return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds),
|
| 1205 |
+
...getFlattenedBlockAttributes(action.blocks)
|
| 1206 |
+
};
|
| 1207 |
|
| 1208 |
+
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1209 |
+
return Object(external_lodash_["omit"])(state, action.removedClientIds);
|
| 1210 |
+
}
|
|
|
|
|
|
|
| 1211 |
|
| 1212 |
+
return state;
|
| 1213 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1214 |
|
| 1215 |
+
order(state = {}, action) {
|
| 1216 |
+
switch (action.type) {
|
| 1217 |
+
case 'RESET_BLOCKS':
|
| 1218 |
+
return mapBlockOrder(action.blocks);
|
| 1219 |
|
| 1220 |
+
case 'RECEIVE_BLOCKS':
|
| 1221 |
+
return { ...state,
|
| 1222 |
+
...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), '')
|
| 1223 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1224 |
|
| 1225 |
+
case 'INSERT_BLOCKS':
|
| 1226 |
+
{
|
| 1227 |
+
const {
|
| 1228 |
+
rootClientId = ''
|
| 1229 |
+
} = action;
|
| 1230 |
+
const subState = state[rootClientId] || [];
|
| 1231 |
+
const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
|
| 1232 |
+
const {
|
| 1233 |
+
index = subState.length
|
| 1234 |
+
} = action;
|
| 1235 |
+
return { ...state,
|
| 1236 |
+
...mappedBlocks,
|
| 1237 |
+
[rootClientId]: insertAt(subState, mappedBlocks[rootClientId], index)
|
| 1238 |
+
};
|
| 1239 |
+
}
|
| 1240 |
|
| 1241 |
+
case 'MOVE_BLOCKS_TO_POSITION':
|
| 1242 |
+
{
|
| 1243 |
+
const {
|
| 1244 |
+
fromRootClientId = '',
|
| 1245 |
+
toRootClientId = '',
|
| 1246 |
+
clientIds
|
| 1247 |
+
} = action;
|
| 1248 |
+
const {
|
| 1249 |
+
index = state[toRootClientId].length
|
| 1250 |
+
} = action; // Moving inside the same parent block
|
| 1251 |
|
| 1252 |
+
if (fromRootClientId === toRootClientId) {
|
| 1253 |
+
const subState = state[toRootClientId];
|
| 1254 |
+
const fromIndex = subState.indexOf(clientIds[0]);
|
| 1255 |
+
return { ...state,
|
| 1256 |
+
[toRootClientId]: moveTo(state[toRootClientId], fromIndex, index, clientIds.length)
|
| 1257 |
+
};
|
| 1258 |
+
} // Moving from a parent block to another
|
| 1259 |
|
|
|
|
|
|
|
| 1260 |
|
| 1261 |
+
return { ...state,
|
| 1262 |
+
[fromRootClientId]: Object(external_lodash_["without"])(state[fromRootClientId], ...clientIds),
|
| 1263 |
+
[toRootClientId]: insertAt(state[toRootClientId], clientIds, index)
|
| 1264 |
+
};
|
| 1265 |
+
}
|
| 1266 |
|
| 1267 |
+
case 'MOVE_BLOCKS_UP':
|
| 1268 |
+
{
|
| 1269 |
+
const {
|
| 1270 |
+
clientIds,
|
| 1271 |
+
rootClientId = ''
|
| 1272 |
+
} = action;
|
| 1273 |
+
const firstClientId = Object(external_lodash_["first"])(clientIds);
|
| 1274 |
+
const subState = state[rootClientId];
|
|
|
|
|
|
|
|
|
|
| 1275 |
|
| 1276 |
+
if (!subState.length || firstClientId === Object(external_lodash_["first"])(subState)) {
|
| 1277 |
+
return state;
|
| 1278 |
+
}
|
| 1279 |
|
| 1280 |
+
const firstIndex = subState.indexOf(firstClientId);
|
| 1281 |
+
return { ...state,
|
| 1282 |
+
[rootClientId]: moveTo(subState, firstIndex, firstIndex - 1, clientIds.length)
|
| 1283 |
+
};
|
| 1284 |
+
}
|
| 1285 |
|
| 1286 |
+
case 'MOVE_BLOCKS_DOWN':
|
| 1287 |
+
{
|
| 1288 |
+
const {
|
| 1289 |
+
clientIds,
|
| 1290 |
+
rootClientId = ''
|
| 1291 |
+
} = action;
|
| 1292 |
+
const firstClientId = Object(external_lodash_["first"])(clientIds);
|
| 1293 |
+
const lastClientId = Object(external_lodash_["last"])(clientIds);
|
| 1294 |
+
const subState = state[rootClientId];
|
| 1295 |
|
| 1296 |
+
if (!subState.length || lastClientId === Object(external_lodash_["last"])(subState)) {
|
| 1297 |
+
return state;
|
|
|
|
|
|
|
| 1298 |
}
|
| 1299 |
|
| 1300 |
+
const firstIndex = subState.indexOf(firstClientId);
|
| 1301 |
+
return { ...state,
|
| 1302 |
+
[rootClientId]: moveTo(subState, firstIndex, firstIndex + 1, clientIds.length)
|
| 1303 |
+
};
|
| 1304 |
+
}
|
| 1305 |
|
| 1306 |
+
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1307 |
+
{
|
| 1308 |
+
const {
|
| 1309 |
+
clientIds
|
| 1310 |
+
} = action;
|
| 1311 |
|
| 1312 |
+
if (!action.blocks) {
|
| 1313 |
+
return state;
|
| 1314 |
+
}
|
| 1315 |
|
| 1316 |
+
const mappedBlocks = mapBlockOrder(action.blocks);
|
| 1317 |
+
return Object(external_lodash_["flow"])([nextState => Object(external_lodash_["omit"])(nextState, action.replacedClientIds), nextState => ({ ...nextState,
|
| 1318 |
+
...Object(external_lodash_["omit"])(mappedBlocks, '')
|
| 1319 |
+
}), nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["reduce"])(subState, (result, clientId) => {
|
| 1320 |
+
if (clientId === clientIds[0]) {
|
| 1321 |
+
return [...result, ...mappedBlocks['']];
|
| 1322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1323 |
|
| 1324 |
+
if (clientIds.indexOf(clientId) === -1) {
|
| 1325 |
+
result.push(clientId);
|
| 1326 |
+
}
|
| 1327 |
|
| 1328 |
+
return result;
|
| 1329 |
+
}, []))])(state);
|
| 1330 |
+
}
|
| 1331 |
|
| 1332 |
+
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1333 |
+
return Object(external_lodash_["flow"])([// Remove inner block ordering for removed blocks
|
| 1334 |
+
nextState => Object(external_lodash_["omit"])(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings
|
| 1335 |
+
nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["without"])(subState, ...action.removedClientIds))])(state);
|
| 1336 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1337 |
|
| 1338 |
+
return state;
|
| 1339 |
+
},
|
|
|
|
|
|
|
|
|
|
| 1340 |
|
| 1341 |
+
// While technically redundant data as the inverse of `order`, it serves as
|
| 1342 |
+
// an optimization for the selectors which derive the ancestry of a block.
|
| 1343 |
+
parents(state = {}, action) {
|
| 1344 |
+
switch (action.type) {
|
| 1345 |
+
case 'RESET_BLOCKS':
|
| 1346 |
+
return mapBlockParents(action.blocks);
|
| 1347 |
|
| 1348 |
+
case 'RECEIVE_BLOCKS':
|
| 1349 |
+
return { ...state,
|
| 1350 |
+
...mapBlockParents(action.blocks)
|
| 1351 |
+
};
|
| 1352 |
|
| 1353 |
+
case 'INSERT_BLOCKS':
|
| 1354 |
+
return { ...state,
|
| 1355 |
+
...mapBlockParents(action.blocks, action.rootClientId || '')
|
| 1356 |
+
};
|
| 1357 |
|
| 1358 |
+
case 'MOVE_BLOCKS_TO_POSITION':
|
| 1359 |
+
{
|
| 1360 |
+
return { ...state,
|
| 1361 |
+
...action.clientIds.reduce((accumulator, id) => {
|
| 1362 |
+
accumulator[id] = action.toRootClientId || '';
|
| 1363 |
+
return accumulator;
|
| 1364 |
+
}, {})
|
| 1365 |
+
};
|
| 1366 |
+
}
|
| 1367 |
|
| 1368 |
+
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1369 |
+
return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds),
|
| 1370 |
+
...mapBlockParents(action.blocks, state[action.clientIds[0]])
|
| 1371 |
+
};
|
| 1372 |
|
| 1373 |
+
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
| 1374 |
+
return Object(external_lodash_["omit"])(state, action.removedClientIds);
|
| 1375 |
+
}
|
| 1376 |
|
| 1377 |
+
return state;
|
| 1378 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1379 |
|
| 1380 |
+
controlledInnerBlocks(state = {}, {
|
| 1381 |
+
type,
|
| 1382 |
+
clientId,
|
| 1383 |
+
hasControlledInnerBlocks
|
| 1384 |
+
}) {
|
| 1385 |
+
if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') {
|
| 1386 |
+
return { ...state,
|
| 1387 |
+
[clientId]: hasControlledInnerBlocks
|
| 1388 |
+
};
|
| 1389 |
+
}
|
| 1390 |
|
| 1391 |
+
return state;
|
| 1392 |
+
}
|
| 1393 |
|
| 1394 |
+
});
|
| 1395 |
+
/**
|
| 1396 |
+
* Reducer returning typing state.
|
| 1397 |
+
*
|
| 1398 |
+
* @param {boolean} state Current state.
|
| 1399 |
+
* @param {Object} action Dispatched action.
|
| 1400 |
+
*
|
| 1401 |
+
* @return {boolean} Updated state.
|
| 1402 |
+
*/
|
| 1403 |
|
| 1404 |
+
function isTyping(state = false, action) {
|
| 1405 |
+
switch (action.type) {
|
| 1406 |
+
case 'START_TYPING':
|
| 1407 |
+
return true;
|
|
|
|
|
|
|
| 1408 |
|
| 1409 |
+
case 'STOP_TYPING':
|
| 1410 |
+
return false;
|
| 1411 |
+
}
|
| 1412 |
|
| 1413 |
+
return state;
|
| 1414 |
+
}
|
| 1415 |
+
/**
|
| 1416 |
+
* Reducer returning dragged block client id.
|
| 1417 |
+
*
|
| 1418 |
+
* @param {string[]} state Current state.
|
| 1419 |
+
* @param {Object} action Dispatched action.
|
| 1420 |
+
*
|
| 1421 |
+
* @return {string[]} Updated state.
|
| 1422 |
+
*/
|
| 1423 |
|
| 1424 |
+
function draggedBlocks(state = [], action) {
|
| 1425 |
+
switch (action.type) {
|
| 1426 |
+
case 'START_DRAGGING_BLOCKS':
|
| 1427 |
+
return action.clientIds;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1428 |
|
| 1429 |
+
case 'STOP_DRAGGING_BLOCKS':
|
| 1430 |
+
return [];
|
| 1431 |
+
}
|
|
|
|
|
|
|
| 1432 |
|
| 1433 |
+
return state;
|
| 1434 |
+
}
|
| 1435 |
+
/**
|
| 1436 |
+
* Reducer returning whether the caret is within formatted text.
|
| 1437 |
+
*
|
| 1438 |
+
* @param {boolean} state Current state.
|
| 1439 |
+
* @param {Object} action Dispatched action.
|
| 1440 |
+
*
|
| 1441 |
+
* @return {boolean} Updated state.
|
| 1442 |
+
*/
|
| 1443 |
|
| 1444 |
+
function isCaretWithinFormattedText(state = false, action) {
|
| 1445 |
+
switch (action.type) {
|
| 1446 |
+
case 'ENTER_FORMATTED_TEXT':
|
| 1447 |
+
return true;
|
| 1448 |
|
| 1449 |
+
case 'EXIT_FORMATTED_TEXT':
|
| 1450 |
+
return false;
|
| 1451 |
+
}
|
| 1452 |
|
| 1453 |
+
return state;
|
| 1454 |
+
}
|
| 1455 |
+
/**
|
| 1456 |
+
* Internal helper reducer for selectionStart and selectionEnd. Can hold a block
|
| 1457 |
+
* selection, represented by an object with property clientId.
|
| 1458 |
+
*
|
| 1459 |
+
* @param {Object} state Current state.
|
| 1460 |
+
* @param {Object} action Dispatched action.
|
| 1461 |
+
*
|
| 1462 |
+
* @return {Object} Updated state.
|
| 1463 |
+
*/
|
| 1464 |
|
| 1465 |
+
function selectionHelper(state = {}, action) {
|
| 1466 |
+
switch (action.type) {
|
| 1467 |
+
case 'CLEAR_SELECTED_BLOCK':
|
| 1468 |
+
{
|
| 1469 |
+
if (state.clientId) {
|
| 1470 |
+
return {};
|
| 1471 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1472 |
|
| 1473 |
+
return state;
|
| 1474 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1475 |
|
| 1476 |
+
case 'SELECT_BLOCK':
|
| 1477 |
+
if (action.clientId === state.clientId) {
|
| 1478 |
+
return state;
|
| 1479 |
+
}
|
| 1480 |
|
| 1481 |
+
return {
|
| 1482 |
+
clientId: action.clientId
|
| 1483 |
+
};
|
|
|
|
| 1484 |
|
| 1485 |
+
case 'REPLACE_INNER_BLOCKS':
|
| 1486 |
+
case 'INSERT_BLOCKS':
|
| 1487 |
+
{
|
| 1488 |
+
if (!action.updateSelection || !action.blocks.length) {
|
| 1489 |
+
return state;
|
| 1490 |
+
}
|
| 1491 |
|
| 1492 |
+
return {
|
| 1493 |
+
clientId: action.blocks[0].clientId
|
| 1494 |
+
};
|
| 1495 |
+
}
|
| 1496 |
|
| 1497 |
+
case 'REMOVE_BLOCKS':
|
| 1498 |
+
if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) {
|
| 1499 |
+
return state;
|
| 1500 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1501 |
|
| 1502 |
+
return {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1503 |
|
| 1504 |
+
case 'REPLACE_BLOCKS':
|
| 1505 |
+
{
|
| 1506 |
+
if (action.clientIds.indexOf(state.clientId) === -1) {
|
| 1507 |
+
return state;
|
| 1508 |
}
|
| 1509 |
|
| 1510 |
+
const indexToSelect = action.indexToSelect || action.blocks.length - 1;
|
| 1511 |
+
const blockToSelect = action.blocks[indexToSelect];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1512 |
|
| 1513 |
+
if (!blockToSelect) {
|
| 1514 |
+
return {};
|
| 1515 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1516 |
|
| 1517 |
+
if (blockToSelect.clientId === state.clientId) {
|
| 1518 |
+
return state;
|
|
|
|
|
|
|
|
|
|
| 1519 |
}
|
| 1520 |
|
| 1521 |
+
return {
|
| 1522 |
+
clientId: blockToSelect.clientId
|
| 1523 |
+
};
|
| 1524 |
}
|
| 1525 |
+
}
|
| 1526 |
|
| 1527 |
+
return state;
|
| 1528 |
+
}
|
| 1529 |
+
/**
|
| 1530 |
+
* Reducer returning the selection state.
|
| 1531 |
+
*
|
| 1532 |
+
* @param {boolean} state Current state.
|
| 1533 |
+
* @param {Object} action Dispatched action.
|
| 1534 |
+
*
|
| 1535 |
+
* @return {boolean} Updated state.
|
| 1536 |
+
*/
|
| 1537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1538 |
|
| 1539 |
+
function selection(state = {}, action) {
|
| 1540 |
+
var _state$selectionStart, _state$selectionEnd;
|
| 1541 |
|
| 1542 |
+
switch (action.type) {
|
| 1543 |
+
case 'SELECTION_CHANGE':
|
| 1544 |
+
return {
|
| 1545 |
+
selectionStart: {
|
| 1546 |
+
clientId: action.clientId,
|
| 1547 |
+
attributeKey: action.attributeKey,
|
| 1548 |
+
offset: action.startOffset
|
| 1549 |
+
},
|
| 1550 |
+
selectionEnd: {
|
| 1551 |
+
clientId: action.clientId,
|
| 1552 |
+
attributeKey: action.attributeKey,
|
| 1553 |
+
offset: action.endOffset
|
| 1554 |
+
}
|
| 1555 |
+
};
|
| 1556 |
|
| 1557 |
+
case 'RESET_SELECTION':
|
| 1558 |
+
const {
|
| 1559 |
+
selectionStart,
|
| 1560 |
+
selectionEnd
|
| 1561 |
+
} = action;
|
| 1562 |
+
return {
|
| 1563 |
+
selectionStart,
|
| 1564 |
+
selectionEnd
|
| 1565 |
+
};
|
| 1566 |
|
| 1567 |
+
case 'MULTI_SELECT':
|
| 1568 |
+
const {
|
| 1569 |
+
start,
|
| 1570 |
+
end
|
| 1571 |
+
} = action;
|
| 1572 |
+
return {
|
| 1573 |
+
selectionStart: {
|
| 1574 |
+
clientId: start
|
| 1575 |
+
},
|
| 1576 |
+
selectionEnd: {
|
| 1577 |
+
clientId: end
|
| 1578 |
+
}
|
| 1579 |
+
};
|
| 1580 |
|
| 1581 |
+
case 'RESET_BLOCKS':
|
| 1582 |
+
const startClientId = state === null || state === void 0 ? void 0 : (_state$selectionStart = state.selectionStart) === null || _state$selectionStart === void 0 ? void 0 : _state$selectionStart.clientId;
|
| 1583 |
+
const endClientId = state === null || state === void 0 ? void 0 : (_state$selectionEnd = state.selectionEnd) === null || _state$selectionEnd === void 0 ? void 0 : _state$selectionEnd.clientId; // Do nothing if there's no selected block.
|
|
|
|
| 1584 |
|
| 1585 |
+
if (!startClientId && !endClientId) {
|
| 1586 |
+
return state;
|
| 1587 |
+
} // If the start of the selection won't exist after reset, remove selection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1589 |
|
| 1590 |
+
if (!action.blocks.some(block => block.clientId === startClientId)) {
|
| 1591 |
+
return {
|
| 1592 |
+
selectionStart: {},
|
| 1593 |
+
selectionEnd: {}
|
| 1594 |
+
};
|
| 1595 |
+
} // If the end of the selection won't exist after reset, collapse selection.
|
| 1596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1597 |
|
| 1598 |
+
if (!action.blocks.some(block => block.clientId === endClientId)) {
|
| 1599 |
+
return { ...state,
|
| 1600 |
+
selectionEnd: state.selectionStart
|
| 1601 |
+
};
|
| 1602 |
}
|
| 1603 |
|
| 1604 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1605 |
|
| 1606 |
+
return {
|
| 1607 |
+
selectionStart: selectionHelper(state.selectionStart, action),
|
| 1608 |
+
selectionEnd: selectionHelper(state.selectionEnd, action)
|
| 1609 |
+
};
|
| 1610 |
+
}
|
| 1611 |
+
/**
|
| 1612 |
+
* Reducer returning whether the user is multi-selecting.
|
| 1613 |
+
*
|
| 1614 |
+
* @param {boolean} state Current state.
|
| 1615 |
+
* @param {Object} action Dispatched action.
|
| 1616 |
+
*
|
| 1617 |
+
* @return {boolean} Updated state.
|
| 1618 |
*/
|
| 1619 |
|
| 1620 |
+
function isMultiSelecting(state = false, action) {
|
| 1621 |
+
switch (action.type) {
|
| 1622 |
+
case 'START_MULTI_SELECT':
|
| 1623 |
+
return true;
|
|
|
|
|
|
|
|
|
|
| 1624 |
|
| 1625 |
+
case 'STOP_MULTI_SELECT':
|
| 1626 |
+
return false;
|
| 1627 |
+
}
|
| 1628 |
|
| 1629 |
+
return state;
|
| 1630 |
+
}
|
| 1631 |
+
/**
|
| 1632 |
+
* Reducer returning whether selection is enabled.
|
| 1633 |
+
*
|
| 1634 |
+
* @param {boolean} state Current state.
|
| 1635 |
+
* @param {Object} action Dispatched action.
|
| 1636 |
+
*
|
| 1637 |
+
* @return {boolean} Updated state.
|
| 1638 |
*/
|
| 1639 |
|
| 1640 |
+
function isSelectionEnabled(state = true, action) {
|
| 1641 |
+
switch (action.type) {
|
| 1642 |
+
case 'TOGGLE_SELECTION':
|
| 1643 |
+
return action.isSelectionEnabled;
|
| 1644 |
+
}
|
| 1645 |
|
| 1646 |
+
return state;
|
| 1647 |
+
}
|
| 1648 |
+
/**
|
| 1649 |
+
* Reducer returning the intial block selection.
|
| 1650 |
+
*
|
| 1651 |
+
* Currently this in only used to restore the selection after block deletion and
|
| 1652 |
+
* pasting new content.This reducer should eventually be removed in favour of setting
|
| 1653 |
+
* selection directly.
|
| 1654 |
+
*
|
| 1655 |
+
* @param {boolean} state Current state.
|
| 1656 |
+
* @param {Object} action Dispatched action.
|
| 1657 |
+
*
|
| 1658 |
+
* @return {number|null} Initial position: 0, -1 or null.
|
| 1659 |
+
*/
|
| 1660 |
|
| 1661 |
+
function reducer_initialPosition(state = null, action) {
|
| 1662 |
+
if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) {
|
| 1663 |
+
return action.initialPosition;
|
| 1664 |
+
} else if (['SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) {
|
| 1665 |
+
return action.initialPosition;
|
| 1666 |
+
}
|
| 1667 |
|
| 1668 |
+
return state;
|
| 1669 |
+
}
|
| 1670 |
+
function blocksMode(state = {}, action) {
|
| 1671 |
+
if (action.type === 'TOGGLE_BLOCK_MODE') {
|
| 1672 |
+
const {
|
| 1673 |
+
clientId
|
| 1674 |
+
} = action;
|
| 1675 |
+
return { ...state,
|
| 1676 |
+
[clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1677 |
};
|
| 1678 |
+
}
|
| 1679 |
|
| 1680 |
+
return state;
|
| 1681 |
+
}
|
| 1682 |
+
/**
|
| 1683 |
+
* Reducer returning the block insertion point visibility, either null if there
|
| 1684 |
+
* is not an explicit insertion point assigned, or an object of its `index` and
|
| 1685 |
+
* `rootClientId`.
|
| 1686 |
+
*
|
| 1687 |
+
* @param {Object} state Current state.
|
| 1688 |
+
* @param {Object} action Dispatched action.
|
| 1689 |
+
*
|
| 1690 |
+
* @return {Object} Updated state.
|
| 1691 |
+
*/
|
| 1692 |
|
| 1693 |
+
function insertionPoint(state = null, action) {
|
| 1694 |
+
switch (action.type) {
|
| 1695 |
+
case 'SHOW_INSERTION_POINT':
|
| 1696 |
+
const {
|
| 1697 |
+
rootClientId,
|
| 1698 |
+
index,
|
| 1699 |
+
__unstableWithInserter
|
| 1700 |
+
} = action;
|
| 1701 |
+
return {
|
| 1702 |
+
rootClientId,
|
| 1703 |
+
index,
|
| 1704 |
+
__unstableWithInserter
|
| 1705 |
+
};
|
| 1706 |
|
| 1707 |
+
case 'HIDE_INSERTION_POINT':
|
| 1708 |
+
return null;
|
| 1709 |
+
}
|
| 1710 |
+
|
| 1711 |
+
return state;
|
| 1712 |
+
}
|
| 1713 |
+
/**
|
| 1714 |
+
* Reducer returning whether the post blocks match the defined template or not.
|
| 1715 |
+
*
|
| 1716 |
+
* @param {Object} state Current state.
|
| 1717 |
+
* @param {Object} action Dispatched action.
|
| 1718 |
+
*
|
| 1719 |
+
* @return {boolean} Updated state.
|
| 1720 |
*/
|
| 1721 |
|
| 1722 |
+
function reducer_template(state = {
|
| 1723 |
+
isValid: true
|
| 1724 |
+
}, action) {
|
| 1725 |
+
switch (action.type) {
|
| 1726 |
+
case 'SET_TEMPLATE_VALIDITY':
|
| 1727 |
+
return { ...state,
|
| 1728 |
+
isValid: action.isValid
|
| 1729 |
+
};
|
| 1730 |
+
}
|
| 1731 |
|
| 1732 |
+
return state;
|
| 1733 |
+
}
|
| 1734 |
+
/**
|
| 1735 |
+
* Reducer returning the editor setting.
|
| 1736 |
+
*
|
| 1737 |
+
* @param {Object} state Current state.
|
| 1738 |
+
* @param {Object} action Dispatched action.
|
| 1739 |
+
*
|
| 1740 |
+
* @return {Object} Updated state.
|
| 1741 |
+
*/
|
| 1742 |
|
| 1743 |
+
function settings(state = defaults["b" /* SETTINGS_DEFAULTS */], action) {
|
| 1744 |
+
switch (action.type) {
|
| 1745 |
+
case 'UPDATE_SETTINGS':
|
| 1746 |
+
return { ...state,
|
| 1747 |
+
...action.settings
|
| 1748 |
+
};
|
| 1749 |
+
}
|
| 1750 |
|
| 1751 |
+
return state;
|
| 1752 |
+
}
|
| 1753 |
+
/**
|
| 1754 |
+
* Reducer returning the user preferences.
|
| 1755 |
+
*
|
| 1756 |
+
* @param {Object} state Current state.
|
| 1757 |
+
* @param {Object} action Dispatched action.
|
| 1758 |
+
*
|
| 1759 |
+
* @return {string} Updated state.
|
| 1760 |
+
*/
|
| 1761 |
|
| 1762 |
+
function preferences(state = defaults["a" /* PREFERENCES_DEFAULTS */], action) {
|
| 1763 |
+
switch (action.type) {
|
| 1764 |
+
case 'INSERT_BLOCKS':
|
| 1765 |
+
case 'REPLACE_BLOCKS':
|
| 1766 |
+
return action.blocks.reduce((prevState, block) => {
|
| 1767 |
+
const {
|
| 1768 |
+
attributes,
|
| 1769 |
+
name: blockName
|
| 1770 |
+
} = block;
|
| 1771 |
+
const match = Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the
|
| 1772 |
+
// one that is used for block variations in the Inserter (`getItemFromVariation`).
|
| 1773 |
|
| 1774 |
+
let id = match !== null && match !== void 0 && match.name ? `${blockName}/${match.name}` : blockName;
|
| 1775 |
+
const insert = {
|
| 1776 |
+
name: id
|
| 1777 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1778 |
|
| 1779 |
+
if (blockName === 'core/block') {
|
| 1780 |
+
insert.ref = attributes.ref;
|
| 1781 |
+
id += '/' + attributes.ref;
|
| 1782 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1783 |
|
| 1784 |
+
return { ...prevState,
|
| 1785 |
+
insertUsage: { ...prevState.insertUsage,
|
| 1786 |
+
[id]: {
|
| 1787 |
+
time: action.time,
|
| 1788 |
+
count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1,
|
| 1789 |
+
insert
|
| 1790 |
+
}
|
| 1791 |
+
}
|
| 1792 |
+
};
|
| 1793 |
+
}, state);
|
| 1794 |
+
}
|
| 1795 |
|
| 1796 |
+
return state;
|
| 1797 |
+
}
|
| 1798 |
+
/**
|
| 1799 |
+
* Reducer returning an object where each key is a block client ID, its value
|
| 1800 |
+
* representing the settings for its nested blocks.
|
| 1801 |
+
*
|
| 1802 |
+
* @param {Object} state Current state.
|
| 1803 |
+
* @param {Object} action Dispatched action.
|
| 1804 |
+
*
|
| 1805 |
+
* @return {Object} Updated state.
|
| 1806 |
+
*/
|
| 1807 |
|
| 1808 |
+
const blockListSettings = (state = {}, action) => {
|
| 1809 |
+
switch (action.type) {
|
| 1810 |
+
// Even if the replaced blocks have the same client ID, our logic
|
| 1811 |
+
// should correct the state.
|
| 1812 |
+
case 'REPLACE_BLOCKS':
|
| 1813 |
+
case 'REMOVE_BLOCKS':
|
| 1814 |
+
{
|
| 1815 |
+
return Object(external_lodash_["omit"])(state, action.clientIds);
|
| 1816 |
+
}
|
| 1817 |
|
| 1818 |
+
case 'UPDATE_BLOCK_LIST_SETTINGS':
|
| 1819 |
+
{
|
| 1820 |
+
const {
|
| 1821 |
+
clientId
|
| 1822 |
+
} = action;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1823 |
|
| 1824 |
+
if (!action.settings) {
|
| 1825 |
+
if (state.hasOwnProperty(clientId)) {
|
| 1826 |
+
return Object(external_lodash_["omit"])(state, clientId);
|
| 1827 |
+
}
|
| 1828 |
|
| 1829 |
+
return state;
|
| 1830 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1831 |
|
| 1832 |
+
if (Object(external_lodash_["isEqual"])(state[clientId], action.settings)) {
|
| 1833 |
+
return state;
|
| 1834 |
+
}
|
| 1835 |
|
| 1836 |
+
return { ...state,
|
| 1837 |
+
[clientId]: action.settings
|
| 1838 |
+
};
|
| 1839 |
+
}
|
| 1840 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1841 |
|
| 1842 |
+
return state;
|
| 1843 |
+
};
|
| 1844 |
+
/**
|
| 1845 |
+
* Reducer returning whether the navigation mode is enabled or not.
|
| 1846 |
+
*
|
| 1847 |
+
* @param {string} state Current state.
|
| 1848 |
+
* @param {Object} action Dispatched action.
|
| 1849 |
+
*
|
| 1850 |
+
* @return {string} Updated state.
|
| 1851 |
+
*/
|
| 1852 |
|
| 1853 |
+
function reducer_isNavigationMode(state = false, action) {
|
| 1854 |
+
// Let inserting block always trigger Edit mode.
|
| 1855 |
+
if (action.type === 'INSERT_BLOCKS') {
|
| 1856 |
+
return false;
|
| 1857 |
}
|
| 1858 |
|
| 1859 |
+
if (action.type === 'SET_NAVIGATION_MODE') {
|
| 1860 |
+
return action.isNavigationMode;
|
| 1861 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1862 |
|
| 1863 |
+
return state;
|
| 1864 |
+
}
|
| 1865 |
+
/**
|
| 1866 |
+
* Reducer returning whether the block moving mode is enabled or not.
|
| 1867 |
+
*
|
| 1868 |
+
* @param {string|null} state Current state.
|
| 1869 |
+
* @param {Object} action Dispatched action.
|
| 1870 |
+
*
|
| 1871 |
+
* @return {string|null} Updated state.
|
| 1872 |
+
*/
|
| 1873 |
|
| 1874 |
+
function reducer_hasBlockMovingClientId(state = null, action) {
|
| 1875 |
+
// Let inserting block always trigger Edit mode.
|
| 1876 |
+
if (action.type === 'SET_BLOCK_MOVING_MODE') {
|
| 1877 |
+
return action.hasBlockMovingClientId;
|
| 1878 |
+
}
|
| 1879 |
|
| 1880 |
+
if (action.type === 'SET_NAVIGATION_MODE') {
|
| 1881 |
+
return null;
|
| 1882 |
+
}
|
| 1883 |
|
| 1884 |
+
return state;
|
| 1885 |
+
}
|
| 1886 |
+
/**
|
| 1887 |
+
* Reducer return an updated state representing the most recent block attribute
|
| 1888 |
+
* update. The state is structured as an object where the keys represent the
|
| 1889 |
+
* client IDs of blocks, the values a subset of attributes from the most recent
|
| 1890 |
+
* block update. The state is always reset to null if the last action is
|
| 1891 |
+
* anything other than an attributes update.
|
| 1892 |
+
*
|
| 1893 |
+
* @param {Object<string,Object>} state Current state.
|
| 1894 |
+
* @param {Object} action Action object.
|
| 1895 |
+
*
|
| 1896 |
+
* @return {[string,Object]} Updated state.
|
| 1897 |
+
*/
|
| 1898 |
|
| 1899 |
+
function lastBlockAttributesChange(state, action) {
|
| 1900 |
+
switch (action.type) {
|
| 1901 |
+
case 'UPDATE_BLOCK':
|
| 1902 |
+
if (!action.updates.attributes) {
|
| 1903 |
+
break;
|
| 1904 |
+
}
|
| 1905 |
|
| 1906 |
+
return {
|
| 1907 |
+
[action.clientId]: action.updates.attributes
|
| 1908 |
+
};
|
| 1909 |
|
| 1910 |
+
case 'UPDATE_BLOCK_ATTRIBUTES':
|
| 1911 |
+
return action.clientIds.reduce((accumulator, id) => ({ ...accumulator,
|
| 1912 |
+
[id]: action.uniqueByBlock ? action.attributes[id] : action.attributes
|
| 1913 |
+
}), {});
|
| 1914 |
}
|
| 1915 |
|
| 1916 |
+
return null;
|
| 1917 |
}
|
| 1918 |
+
/**
|
| 1919 |
+
* Reducer returning automatic change state.
|
| 1920 |
+
*
|
| 1921 |
+
* @param {boolean} state Current state.
|
| 1922 |
+
* @param {Object} action Dispatched action.
|
| 1923 |
+
*
|
| 1924 |
+
* @return {string} Updated state.
|
| 1925 |
+
*/
|
| 1926 |
|
| 1927 |
+
function automaticChangeStatus(state, action) {
|
| 1928 |
+
switch (action.type) {
|
| 1929 |
+
case 'MARK_AUTOMATIC_CHANGE':
|
| 1930 |
+
return 'pending';
|
| 1931 |
|
| 1932 |
+
case 'MARK_AUTOMATIC_CHANGE_FINAL':
|
| 1933 |
+
if (state === 'pending') {
|
| 1934 |
+
return 'final';
|
| 1935 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1936 |
|
| 1937 |
+
return;
|
|
|
|
|
|
|
| 1938 |
|
| 1939 |
+
case 'SELECTION_CHANGE':
|
| 1940 |
+
// As long as the state is not final, ignore any selection changes.
|
| 1941 |
+
if (state !== 'final') {
|
| 1942 |
+
return state;
|
| 1943 |
+
}
|
| 1944 |
|
| 1945 |
+
return;
|
| 1946 |
+
// Undoing an automatic change should still be possible after mouse
|
| 1947 |
+
// move.
|
| 1948 |
|
| 1949 |
+
case 'START_TYPING':
|
| 1950 |
+
case 'STOP_TYPING':
|
| 1951 |
+
return state;
|
| 1952 |
+
} // Reset the state by default (for any action not handled).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1953 |
|
| 1954 |
+
}
|
| 1955 |
+
/**
|
| 1956 |
+
* Reducer returning current highlighted block.
|
| 1957 |
+
*
|
| 1958 |
+
* @param {boolean} state Current highlighted block.
|
| 1959 |
+
* @param {Object} action Dispatched action.
|
| 1960 |
+
*
|
| 1961 |
+
* @return {string} Updated state.
|
| 1962 |
+
*/
|
| 1963 |
|
| 1964 |
+
function highlightedBlock(state, action) {
|
| 1965 |
+
switch (action.type) {
|
| 1966 |
+
case 'TOGGLE_BLOCK_HIGHLIGHT':
|
| 1967 |
+
const {
|
| 1968 |
+
clientId,
|
| 1969 |
+
isHighlighted
|
| 1970 |
+
} = action;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1971 |
|
| 1972 |
+
if (isHighlighted) {
|
| 1973 |
+
return clientId;
|
| 1974 |
+
} else if (state === clientId) {
|
| 1975 |
+
return null;
|
| 1976 |
+
}
|
| 1977 |
|
| 1978 |
+
return state;
|
| 1979 |
+
|
| 1980 |
+
case 'SELECT_BLOCK':
|
| 1981 |
+
if (action.clientId !== state) {
|
| 1982 |
+
return null;
|
| 1983 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1984 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1985 |
}
|
| 1986 |
|
| 1987 |
+
return state;
|
| 1988 |
+
}
|
| 1989 |
+
/**
|
| 1990 |
+
* Reducer returning the block insertion event list state.
|
| 1991 |
+
*
|
| 1992 |
+
* @param {Object} state Current state.
|
| 1993 |
+
* @param {Object} action Dispatched action.
|
| 1994 |
+
*
|
| 1995 |
+
* @return {Object} Updated state.
|
| 1996 |
+
*/
|
| 1997 |
|
| 1998 |
+
function lastBlockInserted(state = {}, action) {
|
| 1999 |
+
var _action$meta;
|
|
|
|
|
|
|
| 2000 |
|
| 2001 |
+
switch (action.type) {
|
| 2002 |
+
case 'INSERT_BLOCKS':
|
| 2003 |
+
if (!action.blocks.length) {
|
| 2004 |
+
return state;
|
| 2005 |
+
}
|
| 2006 |
|
| 2007 |
+
const clientId = action.blocks[0].clientId;
|
| 2008 |
+
const source = (_action$meta = action.meta) === null || _action$meta === void 0 ? void 0 : _action$meta.source;
|
| 2009 |
+
return {
|
| 2010 |
+
clientId,
|
| 2011 |
+
source
|
| 2012 |
+
};
|
| 2013 |
|
| 2014 |
+
case 'RESET_BLOCKS':
|
| 2015 |
+
return {};
|
| 2016 |
+
}
|
| 2017 |
+
|
| 2018 |
+
return state;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2019 |
}
|
| 2020 |
+
/* harmony default export */ var store_reducer = (Object(external_wp_data_["combineReducers"])({
|
| 2021 |
+
blocks: reducer_blocks,
|
| 2022 |
+
isTyping,
|
| 2023 |
+
draggedBlocks,
|
| 2024 |
+
isCaretWithinFormattedText,
|
| 2025 |
+
selection,
|
| 2026 |
+
isMultiSelecting,
|
| 2027 |
+
isSelectionEnabled,
|
| 2028 |
+
initialPosition: reducer_initialPosition,
|
| 2029 |
+
blocksMode,
|
| 2030 |
+
blockListSettings,
|
| 2031 |
+
insertionPoint,
|
| 2032 |
+
template: reducer_template,
|
| 2033 |
+
settings,
|
| 2034 |
+
preferences,
|
| 2035 |
+
lastBlockAttributesChange,
|
| 2036 |
+
isNavigationMode: reducer_isNavigationMode,
|
| 2037 |
+
hasBlockMovingClientId: reducer_hasBlockMovingClientId,
|
| 2038 |
+
automaticChangeStatus,
|
| 2039 |
+
highlightedBlock,
|
| 2040 |
+
lastBlockInserted
|
| 2041 |
+
}));
|
| 2042 |
+
//# sourceMappingURL=reducer.js.map
|
| 2043 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 2044 |
+
var external_wp_element_ = __webpack_require__(0);
|
| 2045 |
|
| 2046 |
+
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
|
| 2047 |
+
var rememo = __webpack_require__(30);
|
|
|
|
|
|
|
| 2048 |
|
| 2049 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 2050 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 2051 |
|
| 2052 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/selectors.js
|
|
|
|
|
|
|
| 2053 |
|
|
|
|
| 2054 |
|
| 2055 |
+
/**
|
| 2056 |
+
* External dependencies
|
| 2057 |
+
*/
|
| 2058 |
|
| 2059 |
+
|
| 2060 |
+
/**
|
| 2061 |
+
* WordPress dependencies
|
| 2062 |
+
*/
|
| 2063 |
+
|
| 2064 |
+
|
| 2065 |
+
|
| 2066 |
+
|
| 2067 |
+
/**
|
| 2068 |
+
* A block selection object.
|
| 2069 |
+
*
|
| 2070 |
+
* @typedef {Object} WPBlockSelection
|
| 2071 |
+
*
|
| 2072 |
+
* @property {string} clientId A block client ID.
|
| 2073 |
+
* @property {string} attributeKey A block attribute key.
|
| 2074 |
+
* @property {number} offset An attribute value offset, based on the rich
|
| 2075 |
+
* text value. See `wp.richText.create`.
|
| 2076 |
+
*/
|
| 2077 |
+
// Module constants
|
| 2078 |
+
|
| 2079 |
+
const MILLISECONDS_PER_HOUR = 3600 * 1000;
|
| 2080 |
+
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
|
| 2081 |
+
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
|
| 2082 |
+
const templateIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], {
|
| 2083 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 2084 |
+
viewBox: "0 0 24 24"
|
| 2085 |
+
}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], {
|
| 2086 |
+
x: "0",
|
| 2087 |
+
fill: "none",
|
| 2088 |
+
width: "24",
|
| 2089 |
+
height: "24"
|
| 2090 |
+
}), Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
|
| 2091 |
+
d: "M19 3H5c-1.105 0-2 .895-2 2v14c0 1.105.895 2 2 2h14c1.105 0 2-.895 2-2V5c0-1.105-.895-2-2-2zM6 6h5v5H6V6zm4.5 13C9.12 19 8 17.88 8 16.5S9.12 14 10.5 14s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm3-6l3-5 3 5h-6z"
|
| 2092 |
+
})));
|
| 2093 |
+
/**
|
| 2094 |
+
* Shared reference to an empty array for cases where it is important to avoid
|
| 2095 |
+
* returning a new array reference on every invocation, as in a connected or
|
| 2096 |
+
* other pure component which performs `shouldComponentUpdate` check on props.
|
| 2097 |
+
* This should be used as a last resort, since the normalized data should be
|
| 2098 |
+
* maintained by the reducer result in state.
|
| 2099 |
+
*
|
| 2100 |
+
* @type {Array}
|
| 2101 |
+
*/
|
| 2102 |
+
|
| 2103 |
+
const EMPTY_ARRAY = [];
|
| 2104 |
+
/**
|
| 2105 |
+
* Returns a block's name given its client ID, or null if no block exists with
|
| 2106 |
+
* the client ID.
|
| 2107 |
+
*
|
| 2108 |
+
* @param {Object} state Editor state.
|
| 2109 |
+
* @param {string} clientId Block client ID.
|
| 2110 |
+
*
|
| 2111 |
+
* @return {string} Block name.
|
| 2112 |
+
*/
|
| 2113 |
+
|
| 2114 |
+
function getBlockName(state, clientId) {
|
| 2115 |
+
const block = state.blocks.byClientId[clientId];
|
| 2116 |
+
const socialLinkName = 'core/social-link';
|
| 2117 |
+
|
| 2118 |
+
if (external_wp_element_["Platform"].OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) {
|
| 2119 |
+
const attributes = state.blocks.attributes[clientId];
|
| 2120 |
+
const {
|
| 2121 |
+
service
|
| 2122 |
+
} = attributes;
|
| 2123 |
+
return service ? `${socialLinkName}-${service}` : socialLinkName;
|
| 2124 |
}
|
| 2125 |
|
| 2126 |
+
return block ? block.name : null;
|
| 2127 |
+
}
|
| 2128 |
+
/**
|
| 2129 |
+
* Returns whether a block is valid or not.
|
| 2130 |
+
*
|
| 2131 |
+
* @param {Object} state Editor state.
|
| 2132 |
+
* @param {string} clientId Block client ID.
|
| 2133 |
+
*
|
| 2134 |
+
* @return {boolean} Is Valid.
|
| 2135 |
+
*/
|
| 2136 |
|
| 2137 |
+
function isBlockValid(state, clientId) {
|
| 2138 |
+
const block = state.blocks.byClientId[clientId];
|
| 2139 |
+
return !!block && block.isValid;
|
| 2140 |
+
}
|
| 2141 |
+
/**
|
| 2142 |
+
* Returns a block's attributes given its client ID, or null if no block exists with
|
| 2143 |
+
* the client ID.
|
| 2144 |
+
*
|
| 2145 |
+
* @param {Object} state Editor state.
|
| 2146 |
+
* @param {string} clientId Block client ID.
|
| 2147 |
+
*
|
| 2148 |
+
* @return {Object?} Block attributes.
|
| 2149 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2150 |
|
| 2151 |
+
function getBlockAttributes(state, clientId) {
|
| 2152 |
+
const block = state.blocks.byClientId[clientId];
|
|
|
|
| 2153 |
|
| 2154 |
+
if (!block) {
|
| 2155 |
+
return null;
|
|
|
|
| 2156 |
}
|
| 2157 |
|
| 2158 |
+
return state.blocks.attributes[clientId];
|
| 2159 |
}
|
| 2160 |
+
/**
|
| 2161 |
+
* Returns a block given its client ID. This is a parsed copy of the block,
|
| 2162 |
+
* containing its `blockName`, `clientId`, and current `attributes` state. This
|
| 2163 |
+
* is not the block's registration settings, which must be retrieved from the
|
| 2164 |
+
* blocks module registration store.
|
| 2165 |
+
*
|
| 2166 |
+
* getBlock recurses through its inner blocks until all its children blocks have
|
| 2167 |
+
* been retrieved. Note that getBlock will not return the child inner blocks of
|
| 2168 |
+
* an inner block controller. This is because an inner block controller syncs
|
| 2169 |
+
* itself with its own entity, and should therefore not be included with the
|
| 2170 |
+
* blocks of a different entity. For example, say you call `getBlocks( TP )` to
|
| 2171 |
+
* get the blocks of a template part. If another template part is a child of TP,
|
| 2172 |
+
* then the nested template part's child blocks will not be returned. This way,
|
| 2173 |
+
* the template block itself is considered part of the parent, but the children
|
| 2174 |
+
* are not.
|
| 2175 |
+
*
|
| 2176 |
+
* @param {Object} state Editor state.
|
| 2177 |
+
* @param {string} clientId Block client ID.
|
| 2178 |
+
*
|
| 2179 |
+
* @return {Object} Parsed block object.
|
| 2180 |
+
*/
|
| 2181 |
|
| 2182 |
+
const getBlock = Object(rememo["a" /* default */])((state, clientId) => {
|
| 2183 |
+
const block = state.blocks.byClientId[clientId];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2184 |
|
| 2185 |
+
if (!block) {
|
| 2186 |
+
return null;
|
| 2187 |
+
}
|
| 2188 |
|
| 2189 |
+
return { ...block,
|
| 2190 |
+
attributes: getBlockAttributes(state, clientId),
|
| 2191 |
+
innerBlocks: areInnerBlocksControlled(state, clientId) ? EMPTY_ARRAY : getBlocks(state, clientId)
|
| 2192 |
+
};
|
| 2193 |
+
}, (state, clientId) => [// Normally, we'd have both `getBlockAttributes` dependencies and
|
| 2194 |
+
// `getBlocks` (children) dependencies here but for performance reasons
|
| 2195 |
+
// we use a denormalized cache key computed in the reducer that takes both
|
| 2196 |
+
// the attributes and inner blocks into account. The value of the cache key
|
| 2197 |
+
// is being changed whenever one of these dependencies is out of date.
|
| 2198 |
+
state.blocks.cache[clientId]]);
|
| 2199 |
+
const __unstableGetBlockWithoutInnerBlocks = Object(rememo["a" /* default */])((state, clientId) => {
|
| 2200 |
+
const block = state.blocks.byClientId[clientId];
|
| 2201 |
|
| 2202 |
+
if (!block) {
|
| 2203 |
+
return null;
|
| 2204 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2205 |
|
| 2206 |
+
return { ...block,
|
| 2207 |
+
attributes: getBlockAttributes(state, clientId)
|
| 2208 |
+
};
|
| 2209 |
+
}, (state, clientId) => [state.blocks.byClientId[clientId], state.blocks.attributes[clientId]]);
|
| 2210 |
+
/**
|
| 2211 |
+
* Returns all block objects for the current post being edited as an array in
|
| 2212 |
+
* the order they appear in the post. Note that this will exclude child blocks
|
| 2213 |
+
* of nested inner block controllers.
|
| 2214 |
+
*
|
| 2215 |
+
* Note: It's important to memoize this selector to avoid return a new instance
|
| 2216 |
+
* on each call. We use the block cache state for each top-level block of the
|
| 2217 |
+
* given clientID. This way, the selector only refreshes on changes to blocks
|
| 2218 |
+
* associated with the given entity, and does not refresh when changes are made
|
| 2219 |
+
* to blocks which are part of different inner block controllers.
|
| 2220 |
+
*
|
| 2221 |
+
* @param {Object} state Editor state.
|
| 2222 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2223 |
+
*
|
| 2224 |
+
* @return {Object[]} Post blocks.
|
| 2225 |
+
*/
|
| 2226 |
|
| 2227 |
+
const getBlocks = Object(rememo["a" /* default */])((state, rootClientId) => {
|
| 2228 |
+
return Object(external_lodash_["map"])(getBlockOrder(state, rootClientId), clientId => getBlock(state, clientId));
|
| 2229 |
+
}, (state, rootClientId) => Object(external_lodash_["map"])(state.blocks.order[rootClientId || ''], id => state.blocks.cache[id]));
|
| 2230 |
+
/**
|
| 2231 |
+
* Similar to getBlock, except it will include the entire nested block tree as
|
| 2232 |
+
* inner blocks. The normal getBlock selector will exclude sections of the block
|
| 2233 |
+
* tree which belong to different entities.
|
| 2234 |
+
*
|
| 2235 |
+
* @param {Object} state Editor state.
|
| 2236 |
+
* @param {string} clientId Client ID of the block to get.
|
| 2237 |
+
*
|
| 2238 |
+
* @return {Object} The block with all
|
| 2239 |
+
*/
|
| 2240 |
|
| 2241 |
+
const __unstableGetBlockWithBlockTree = Object(rememo["a" /* default */])((state, clientId) => {
|
| 2242 |
+
const block = state.blocks.byClientId[clientId];
|
| 2243 |
|
| 2244 |
+
if (!block) {
|
| 2245 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2246 |
}
|
| 2247 |
|
| 2248 |
+
return { ...block,
|
| 2249 |
+
attributes: getBlockAttributes(state, clientId),
|
| 2250 |
+
innerBlocks: __unstableGetBlockTree(state, clientId)
|
| 2251 |
+
};
|
| 2252 |
+
}, state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
|
| 2253 |
+
/**
|
| 2254 |
+
* Similar to getBlocks, except this selector returns the entire block tree
|
| 2255 |
+
* represented in the block-editor store from the given root regardless of any
|
| 2256 |
+
* inner block controllers.
|
| 2257 |
+
*
|
| 2258 |
+
* @param {Object} state Editor state.
|
| 2259 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2260 |
+
*
|
| 2261 |
+
* @return {Object[]} Post blocks.
|
| 2262 |
+
*/
|
| 2263 |
|
| 2264 |
+
const __unstableGetBlockTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(getBlockOrder(state, rootClientId), clientId => __unstableGetBlockWithBlockTree(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
|
| 2265 |
+
/**
|
| 2266 |
+
* Returns a stripped down block object containing only its client ID,
|
| 2267 |
+
* and its inner blocks' client IDs.
|
| 2268 |
+
*
|
| 2269 |
+
* @param {Object} state Editor state.
|
| 2270 |
+
* @param {string} clientId Client ID of the block to get.
|
| 2271 |
+
*
|
| 2272 |
+
* @return {Object} Client IDs of the post blocks.
|
| 2273 |
+
*/
|
| 2274 |
|
| 2275 |
+
const __unstableGetClientIdWithClientIdsTree = Object(rememo["a" /* default */])((state, clientId) => ({
|
| 2276 |
+
clientId,
|
| 2277 |
+
innerBlocks: __unstableGetClientIdsTree(state, clientId)
|
| 2278 |
+
}), state => [state.blocks.order]);
|
| 2279 |
+
/**
|
| 2280 |
+
* Returns the block tree represented in the block-editor store from the
|
| 2281 |
+
* given root, consisting of stripped down block objects containing only
|
| 2282 |
+
* their client IDs, and their inner blocks' client IDs.
|
| 2283 |
+
*
|
| 2284 |
+
* @param {Object} state Editor state.
|
| 2285 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2286 |
+
*
|
| 2287 |
+
* @return {Object[]} Client IDs of the post blocks.
|
| 2288 |
+
*/
|
| 2289 |
|
| 2290 |
+
const __unstableGetClientIdsTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(getBlockOrder(state, rootClientId), clientId => __unstableGetClientIdWithClientIdsTree(state, clientId)), state => [state.blocks.order]);
|
| 2291 |
+
/**
|
| 2292 |
+
* Returns an array containing the clientIds of all descendants
|
| 2293 |
+
* of the blocks given.
|
| 2294 |
+
*
|
| 2295 |
+
* @param {Object} state Global application state.
|
| 2296 |
+
* @param {Array} clientIds Array of blocks to inspect.
|
| 2297 |
+
*
|
| 2298 |
+
* @return {Array} ids of descendants.
|
| 2299 |
+
*/
|
| 2300 |
|
| 2301 |
+
const getClientIdsOfDescendants = (state, clientIds) => Object(external_lodash_["flatMap"])(clientIds, clientId => {
|
| 2302 |
+
const descendants = getBlockOrder(state, clientId);
|
| 2303 |
+
return [...descendants, ...getClientIdsOfDescendants(state, descendants)];
|
| 2304 |
+
});
|
| 2305 |
+
/**
|
| 2306 |
+
* Returns an array containing the clientIds of the top-level blocks
|
| 2307 |
+
* and their descendants of any depth (for nested blocks).
|
| 2308 |
+
*
|
| 2309 |
+
* @param {Object} state Global application state.
|
| 2310 |
+
*
|
| 2311 |
+
* @return {Array} ids of top-level and descendant blocks.
|
| 2312 |
+
*/
|
| 2313 |
|
| 2314 |
+
const getClientIdsWithDescendants = Object(rememo["a" /* default */])(state => {
|
| 2315 |
+
const topLevelIds = getBlockOrder(state);
|
| 2316 |
+
return [...topLevelIds, ...getClientIdsOfDescendants(state, topLevelIds)];
|
| 2317 |
+
}, state => [state.blocks.order]);
|
| 2318 |
+
/**
|
| 2319 |
+
* Returns the total number of blocks, or the total number of blocks with a specific name in a post.
|
| 2320 |
+
* The number returned includes nested blocks.
|
| 2321 |
+
*
|
| 2322 |
+
* @param {Object} state Global application state.
|
| 2323 |
+
* @param {?string} blockName Optional block name, if specified only blocks of that type will be counted.
|
| 2324 |
+
*
|
| 2325 |
+
* @return {number} Number of blocks in the post, or number of blocks with name equal to blockName.
|
| 2326 |
+
*/
|
| 2327 |
|
| 2328 |
+
const getGlobalBlockCount = Object(rememo["a" /* default */])((state, blockName) => {
|
| 2329 |
+
const clientIds = getClientIdsWithDescendants(state);
|
| 2330 |
+
|
| 2331 |
+
if (!blockName) {
|
| 2332 |
+
return clientIds.length;
|
|
|
|
| 2333 |
}
|
| 2334 |
|
| 2335 |
+
return Object(external_lodash_["reduce"])(clientIds, (accumulator, clientId) => {
|
| 2336 |
+
const block = state.blocks.byClientId[clientId];
|
| 2337 |
+
return block.name === blockName ? accumulator + 1 : accumulator;
|
| 2338 |
+
}, 0);
|
| 2339 |
+
}, state => [state.blocks.order, state.blocks.byClientId]);
|
| 2340 |
+
/**
|
| 2341 |
+
* Given an array of block client IDs, returns the corresponding array of block
|
| 2342 |
+
* objects.
|
| 2343 |
+
*
|
| 2344 |
+
* @param {Object} state Editor state.
|
| 2345 |
+
* @param {string[]} clientIds Client IDs for which blocks are to be returned.
|
| 2346 |
+
*
|
| 2347 |
+
* @return {WPBlock[]} Block objects.
|
| 2348 |
+
*/
|
| 2349 |
|
| 2350 |
+
const getBlocksByClientId = Object(rememo["a" /* default */])((state, clientIds) => Object(external_lodash_["map"])(Object(external_lodash_["castArray"])(clientIds), clientId => getBlock(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
|
| 2351 |
+
/**
|
| 2352 |
+
* Returns the number of blocks currently present in the post.
|
| 2353 |
+
*
|
| 2354 |
+
* @param {Object} state Editor state.
|
| 2355 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2356 |
+
*
|
| 2357 |
+
* @return {number} Number of blocks in the post.
|
| 2358 |
+
*/
|
| 2359 |
|
| 2360 |
+
function getBlockCount(state, rootClientId) {
|
| 2361 |
+
return getBlockOrder(state, rootClientId).length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2362 |
}
|
| 2363 |
+
/**
|
| 2364 |
+
* Returns the current selection start block client ID, attribute key and text
|
| 2365 |
+
* offset.
|
| 2366 |
+
*
|
| 2367 |
+
* @param {Object} state Block editor state.
|
| 2368 |
+
*
|
| 2369 |
+
* @return {WPBlockSelection} Selection start information.
|
| 2370 |
+
*/
|
| 2371 |
|
| 2372 |
+
function getSelectionStart(state) {
|
| 2373 |
+
return state.selection.selectionStart;
|
|
|
|
|
|
|
|
|
|
| 2374 |
}
|
| 2375 |
+
/**
|
| 2376 |
+
* Returns the current selection end block client ID, attribute key and text
|
| 2377 |
+
* offset.
|
| 2378 |
+
*
|
| 2379 |
+
* @param {Object} state Block editor state.
|
| 2380 |
+
*
|
| 2381 |
+
* @return {WPBlockSelection} Selection end information.
|
| 2382 |
+
*/
|
| 2383 |
|
| 2384 |
+
function getSelectionEnd(state) {
|
| 2385 |
+
return state.selection.selectionEnd;
|
|
|
|
| 2386 |
}
|
| 2387 |
+
/**
|
| 2388 |
+
* Returns the current block selection start. This value may be null, and it
|
| 2389 |
+
* may represent either a singular block selection or multi-selection start.
|
| 2390 |
+
* A selection is singular if its start and end match.
|
| 2391 |
+
*
|
| 2392 |
+
* @param {Object} state Global application state.
|
| 2393 |
+
*
|
| 2394 |
+
* @return {?string} Client ID of block selection start.
|
| 2395 |
+
*/
|
| 2396 |
|
| 2397 |
+
function getBlockSelectionStart(state) {
|
| 2398 |
+
return state.selection.selectionStart.clientId;
|
|
|
|
|
|
|
|
|
|
| 2399 |
}
|
| 2400 |
+
/**
|
| 2401 |
+
* Returns the current block selection end. This value may be null, and it
|
| 2402 |
+
* may represent either a singular block selection or multi-selection end.
|
| 2403 |
+
* A selection is singular if its start and end match.
|
| 2404 |
+
*
|
| 2405 |
+
* @param {Object} state Global application state.
|
| 2406 |
+
*
|
| 2407 |
+
* @return {?string} Client ID of block selection end.
|
| 2408 |
+
*/
|
| 2409 |
|
| 2410 |
+
function getBlockSelectionEnd(state) {
|
| 2411 |
+
return state.selection.selectionEnd.clientId;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2412 |
}
|
| 2413 |
+
/**
|
| 2414 |
+
* Returns the number of blocks currently selected in the post.
|
| 2415 |
+
*
|
| 2416 |
+
* @param {Object} state Global application state.
|
| 2417 |
+
*
|
| 2418 |
+
* @return {number} Number of blocks selected in the post.
|
| 2419 |
+
*/
|
| 2420 |
|
| 2421 |
+
function getSelectedBlockCount(state) {
|
| 2422 |
+
const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2423 |
|
| 2424 |
+
if (multiSelectedBlockCount) {
|
| 2425 |
+
return multiSelectedBlockCount;
|
| 2426 |
+
}
|
| 2427 |
|
| 2428 |
+
return state.selection.selectionStart.clientId ? 1 : 0;
|
| 2429 |
+
}
|
| 2430 |
+
/**
|
| 2431 |
+
* Returns true if there is a single selected block, or false otherwise.
|
| 2432 |
+
*
|
| 2433 |
+
* @param {Object} state Editor state.
|
| 2434 |
+
*
|
| 2435 |
+
* @return {boolean} Whether a single block is selected.
|
| 2436 |
+
*/
|
| 2437 |
|
| 2438 |
+
function hasSelectedBlock(state) {
|
| 2439 |
+
const {
|
| 2440 |
+
selectionStart,
|
| 2441 |
+
selectionEnd
|
| 2442 |
+
} = state.selection;
|
| 2443 |
+
return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId;
|
| 2444 |
+
}
|
| 2445 |
/**
|
| 2446 |
+
* Returns the currently selected block client ID, or null if there is no
|
| 2447 |
+
* selected block.
|
|
|
|
| 2448 |
*
|
| 2449 |
+
* @param {Object} state Editor state.
|
| 2450 |
+
*
|
| 2451 |
+
* @return {?string} Selected block client ID.
|
| 2452 |
*/
|
| 2453 |
|
| 2454 |
+
function getSelectedBlockClientId(state) {
|
| 2455 |
+
const {
|
| 2456 |
+
selectionStart,
|
| 2457 |
+
selectionEnd
|
| 2458 |
+
} = state.selection;
|
| 2459 |
+
const {
|
| 2460 |
+
clientId
|
| 2461 |
+
} = selectionStart;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2462 |
|
| 2463 |
+
if (!clientId || clientId !== selectionEnd.clientId) {
|
| 2464 |
+
return null;
|
| 2465 |
+
}
|
| 2466 |
|
| 2467 |
+
return clientId;
|
| 2468 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2469 |
/**
|
| 2470 |
+
* Returns the currently selected block, or null if there is no selected block.
|
| 2471 |
+
*
|
| 2472 |
+
* @param {Object} state Global application state.
|
| 2473 |
+
*
|
| 2474 |
+
* @return {?Object} Selected block.
|
| 2475 |
*/
|
| 2476 |
|
| 2477 |
+
function getSelectedBlock(state) {
|
| 2478 |
+
const clientId = getSelectedBlockClientId(state);
|
| 2479 |
+
return clientId ? getBlock(state, clientId) : null;
|
| 2480 |
+
}
|
| 2481 |
/**
|
| 2482 |
+
* Given a block client ID, returns the root block from which the block is
|
| 2483 |
+
* nested, an empty string for top-level blocks, or null if the block does not
|
| 2484 |
+
* exist.
|
| 2485 |
*
|
| 2486 |
+
* @param {Object} state Editor state.
|
| 2487 |
+
* @param {string} clientId Block from which to find root client ID.
|
|
|
|
| 2488 |
*
|
| 2489 |
+
* @return {?string} Root client ID, if exists
|
| 2490 |
*/
|
| 2491 |
|
| 2492 |
+
function getBlockRootClientId(state, clientId) {
|
| 2493 |
+
return state.blocks.parents[clientId] !== undefined ? state.blocks.parents[clientId] : null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2494 |
}
|
| 2495 |
+
/**
|
| 2496 |
+
* Given a block client ID, returns the list of all its parents from top to bottom.
|
| 2497 |
+
*
|
| 2498 |
+
* @param {Object} state Editor state.
|
| 2499 |
+
* @param {string} clientId Block from which to find root client ID.
|
| 2500 |
+
* @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
|
| 2501 |
+
*
|
| 2502 |
+
* @return {Array} ClientIDs of the parent blocks.
|
| 2503 |
+
*/
|
| 2504 |
|
| 2505 |
+
const getBlockParents = Object(rememo["a" /* default */])((state, clientId, ascending = false) => {
|
| 2506 |
+
const parents = [];
|
| 2507 |
+
let current = clientId;
|
|
|
|
| 2508 |
|
| 2509 |
+
while (!!state.blocks.parents[current]) {
|
| 2510 |
+
current = state.blocks.parents[current];
|
| 2511 |
+
parents.push(current);
|
| 2512 |
+
}
|
| 2513 |
|
| 2514 |
+
return ascending ? parents : parents.reverse();
|
| 2515 |
+
}, state => [state.blocks.parents]);
|
| 2516 |
+
/**
|
| 2517 |
+
* Given a block client ID and a block name, returns the list of all its parents
|
| 2518 |
+
* from top to bottom, filtered by the given name(s). For example, if passed
|
| 2519 |
+
* 'core/group' as the blockName, it will only return parents which are group
|
| 2520 |
+
* blocks. If passed `[ 'core/group', 'core/cover']`, as the blockName, it will
|
| 2521 |
+
* return parents which are group blocks and parents which are cover blocks.
|
| 2522 |
+
*
|
| 2523 |
+
* @param {Object} state Editor state.
|
| 2524 |
+
* @param {string} clientId Block from which to find root client ID.
|
| 2525 |
+
* @param {string|string[]} blockName Block name(s) to filter.
|
| 2526 |
+
* @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
|
| 2527 |
+
*
|
| 2528 |
+
* @return {Array} ClientIDs of the parent blocks.
|
| 2529 |
+
*/
|
| 2530 |
|
| 2531 |
+
const getBlockParentsByBlockName = Object(rememo["a" /* default */])((state, clientId, blockName, ascending = false) => {
|
| 2532 |
+
const parents = getBlockParents(state, clientId, ascending);
|
| 2533 |
+
return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(Object(external_lodash_["map"])(parents, id => ({
|
| 2534 |
+
id,
|
| 2535 |
+
name: getBlockName(state, id)
|
| 2536 |
+
})), ({
|
| 2537 |
+
name
|
| 2538 |
+
}) => {
|
| 2539 |
+
if (Array.isArray(blockName)) {
|
| 2540 |
+
return blockName.includes(name);
|
| 2541 |
+
}
|
| 2542 |
|
| 2543 |
+
return name === blockName;
|
| 2544 |
+
}), ({
|
| 2545 |
+
id
|
| 2546 |
+
}) => id);
|
| 2547 |
+
}, state => [state.blocks.parents]);
|
| 2548 |
/**
|
| 2549 |
+
* Given a block client ID, returns the root of the hierarchy from which the block is nested, return the block itself for root level blocks.
|
| 2550 |
+
*
|
| 2551 |
+
* @param {Object} state Editor state.
|
| 2552 |
+
* @param {string} clientId Block from which to find root client ID.
|
| 2553 |
+
*
|
| 2554 |
+
* @return {string} Root client ID
|
| 2555 |
*/
|
| 2556 |
|
| 2557 |
+
function getBlockHierarchyRootClientId(state, clientId) {
|
| 2558 |
+
let current = clientId;
|
| 2559 |
+
let parent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2560 |
|
| 2561 |
+
do {
|
| 2562 |
+
parent = current;
|
| 2563 |
+
current = state.blocks.parents[current];
|
| 2564 |
+
} while (current);
|
| 2565 |
|
| 2566 |
+
return parent;
|
| 2567 |
+
}
|
| 2568 |
+
/**
|
| 2569 |
+
* Given a block client ID, returns the lowest common ancestor with selected client ID.
|
| 2570 |
+
*
|
| 2571 |
+
* @param {Object} state Editor state.
|
| 2572 |
+
* @param {string} clientId Block from which to find common ancestor client ID.
|
| 2573 |
+
*
|
| 2574 |
+
* @return {string} Common ancestor client ID or undefined
|
| 2575 |
+
*/
|
| 2576 |
|
| 2577 |
+
function getLowestCommonAncestorWithSelectedBlock(state, clientId) {
|
| 2578 |
+
const selectedId = getSelectedBlockClientId(state);
|
| 2579 |
+
const clientParents = [...getBlockParents(state, clientId), clientId];
|
| 2580 |
+
const selectedParents = [...getBlockParents(state, selectedId), selectedId];
|
| 2581 |
+
let lowestCommonAncestor;
|
| 2582 |
+
const maxDepth = Math.min(clientParents.length, selectedParents.length);
|
| 2583 |
|
| 2584 |
+
for (let index = 0; index < maxDepth; index++) {
|
| 2585 |
+
if (clientParents[index] === selectedParents[index]) {
|
| 2586 |
+
lowestCommonAncestor = clientParents[index];
|
| 2587 |
+
} else {
|
| 2588 |
+
break;
|
| 2589 |
+
}
|
| 2590 |
+
}
|
| 2591 |
|
| 2592 |
+
return lowestCommonAncestor;
|
| 2593 |
+
}
|
| 2594 |
+
/**
|
| 2595 |
+
* Returns the client ID of the block adjacent one at the given reference
|
| 2596 |
+
* startClientId and modifier directionality. Defaults start startClientId to
|
| 2597 |
+
* the selected block, and direction as next block. Returns null if there is no
|
| 2598 |
+
* adjacent block.
|
| 2599 |
+
*
|
| 2600 |
+
* @param {Object} state Editor state.
|
| 2601 |
+
* @param {?string} startClientId Optional client ID of block from which to
|
| 2602 |
+
* search.
|
| 2603 |
+
* @param {?number} modifier Directionality multiplier (1 next, -1
|
| 2604 |
+
* previous).
|
| 2605 |
+
*
|
| 2606 |
+
* @return {?string} Return the client ID of the block, or null if none exists.
|
| 2607 |
+
*/
|
| 2608 |
|
| 2609 |
+
function getAdjacentBlockClientId(state, startClientId, modifier = 1) {
|
| 2610 |
+
// Default to selected block.
|
| 2611 |
+
if (startClientId === undefined) {
|
| 2612 |
+
startClientId = getSelectedBlockClientId(state);
|
| 2613 |
+
} // Try multi-selection starting at extent based on modifier.
|
| 2614 |
|
|
|
|
|
|
|
| 2615 |
|
| 2616 |
+
if (startClientId === undefined) {
|
| 2617 |
+
if (modifier < 0) {
|
| 2618 |
+
startClientId = getFirstMultiSelectedBlockClientId(state);
|
| 2619 |
+
} else {
|
| 2620 |
+
startClientId = getLastMultiSelectedBlockClientId(state);
|
| 2621 |
+
}
|
| 2622 |
+
} // Validate working start client ID.
|
| 2623 |
|
|
|
|
| 2624 |
|
| 2625 |
+
if (!startClientId) {
|
| 2626 |
+
return null;
|
| 2627 |
+
} // Retrieve start block root client ID, being careful to allow the falsey
|
| 2628 |
+
// empty string top-level root by explicitly testing against null.
|
| 2629 |
|
|
|
|
| 2630 |
|
| 2631 |
+
const rootClientId = getBlockRootClientId(state, startClientId);
|
| 2632 |
|
| 2633 |
+
if (rootClientId === null) {
|
| 2634 |
+
return null;
|
| 2635 |
+
}
|
| 2636 |
|
| 2637 |
+
const {
|
| 2638 |
+
order
|
| 2639 |
+
} = state.blocks;
|
| 2640 |
+
const orderSet = order[rootClientId];
|
| 2641 |
+
const index = orderSet.indexOf(startClientId);
|
| 2642 |
+
const nextIndex = index + 1 * modifier; // Block was first in set and we're attempting to get previous.
|
| 2643 |
|
| 2644 |
+
if (nextIndex < 0) {
|
| 2645 |
+
return null;
|
| 2646 |
+
} // Block was last in set and we're attempting to get next.
|
| 2647 |
|
|
|
|
|
|
|
| 2648 |
|
| 2649 |
+
if (nextIndex === orderSet.length) {
|
| 2650 |
+
return null;
|
| 2651 |
+
} // Assume incremented index is within the set.
|
|
|
|
|
|
|
| 2652 |
|
| 2653 |
|
| 2654 |
+
return orderSet[nextIndex];
|
| 2655 |
+
}
|
| 2656 |
/**
|
| 2657 |
+
* Returns the previous block's client ID from the given reference start ID.
|
| 2658 |
+
* Defaults start to the selected block. Returns null if there is no previous
|
| 2659 |
+
* block.
|
| 2660 |
+
*
|
| 2661 |
+
* @param {Object} state Editor state.
|
| 2662 |
+
* @param {?string} startClientId Optional client ID of block from which to
|
| 2663 |
+
* search.
|
| 2664 |
+
*
|
| 2665 |
+
* @return {?string} Adjacent block's client ID, or null if none exists.
|
| 2666 |
*/
|
| 2667 |
|
| 2668 |
+
function getPreviousBlockClientId(state, startClientId) {
|
| 2669 |
+
return getAdjacentBlockClientId(state, startClientId, -1);
|
| 2670 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2671 |
/**
|
| 2672 |
+
* Returns the next block's client ID from the given reference start ID.
|
| 2673 |
+
* Defaults start to the selected block. Returns null if there is no next
|
| 2674 |
+
* block.
|
| 2675 |
*
|
| 2676 |
+
* @param {Object} state Editor state.
|
| 2677 |
+
* @param {?string} startClientId Optional client ID of block from which to
|
| 2678 |
+
* search.
|
| 2679 |
+
*
|
| 2680 |
+
* @return {?string} Adjacent block's client ID, or null if none exists.
|
| 2681 |
*/
|
| 2682 |
|
| 2683 |
+
function getNextBlockClientId(state, startClientId) {
|
| 2684 |
+
return getAdjacentBlockClientId(state, startClientId, 1);
|
| 2685 |
+
}
|
| 2686 |
+
/**
|
| 2687 |
+
* Returns the initial caret position for the selected block.
|
| 2688 |
+
* This position is to used to position the caret properly when the selected block changes.
|
| 2689 |
+
* If the current block is not a RichText, having initial position set to 0 means "focus block"
|
| 2690 |
+
*
|
| 2691 |
+
* @param {Object} state Global application state.
|
| 2692 |
+
*
|
| 2693 |
+
* @return {0|-1|null} Initial position.
|
| 2694 |
+
*/
|
| 2695 |
|
| 2696 |
+
function getSelectedBlocksInitialCaretPosition(state) {
|
| 2697 |
+
return state.initialPosition;
|
| 2698 |
+
}
|
| 2699 |
+
/**
|
| 2700 |
+
* Returns the current selection set of block client IDs (multiselection or single selection).
|
| 2701 |
+
*
|
| 2702 |
+
* @param {Object} state Editor state.
|
| 2703 |
+
*
|
| 2704 |
+
* @return {Array} Multi-selected block client IDs.
|
| 2705 |
+
*/
|
| 2706 |
|
| 2707 |
+
const getSelectedBlockClientIds = Object(rememo["a" /* default */])(state => {
|
| 2708 |
+
const {
|
| 2709 |
+
selectionStart,
|
| 2710 |
+
selectionEnd
|
| 2711 |
+
} = state.selection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2712 |
|
| 2713 |
+
if (selectionStart.clientId === undefined || selectionEnd.clientId === undefined) {
|
| 2714 |
+
return EMPTY_ARRAY;
|
| 2715 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2716 |
|
| 2717 |
+
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 2718 |
+
return [selectionStart.clientId];
|
| 2719 |
+
} // Retrieve root client ID to aid in retrieving relevant nested block
|
| 2720 |
+
// order, being careful to allow the falsey empty string top-level root
|
| 2721 |
+
// by explicitly testing against null.
|
| 2722 |
|
|
|
|
| 2723 |
|
| 2724 |
+
const rootClientId = getBlockRootClientId(state, selectionStart.clientId);
|
|
|
|
| 2725 |
|
| 2726 |
+
if (rootClientId === null) {
|
| 2727 |
+
return EMPTY_ARRAY;
|
| 2728 |
+
}
|
| 2729 |
|
| 2730 |
+
const blockOrder = getBlockOrder(state, rootClientId);
|
| 2731 |
+
const startIndex = blockOrder.indexOf(selectionStart.clientId);
|
| 2732 |
+
const endIndex = blockOrder.indexOf(selectionEnd.clientId);
|
| 2733 |
|
| 2734 |
+
if (startIndex > endIndex) {
|
| 2735 |
+
return blockOrder.slice(endIndex, startIndex + 1);
|
| 2736 |
+
}
|
| 2737 |
|
| 2738 |
+
return blockOrder.slice(startIndex, endIndex + 1);
|
| 2739 |
+
}, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
|
| 2740 |
/**
|
| 2741 |
+
* Returns the current multi-selection set of block client IDs, or an empty
|
| 2742 |
+
* array if there is no multi-selection.
|
| 2743 |
*
|
| 2744 |
+
* @param {Object} state Editor state.
|
| 2745 |
+
*
|
| 2746 |
+
* @return {Array} Multi-selected block client IDs.
|
| 2747 |
*/
|
| 2748 |
|
| 2749 |
+
function getMultiSelectedBlockClientIds(state) {
|
| 2750 |
+
const {
|
| 2751 |
+
selectionStart,
|
| 2752 |
+
selectionEnd
|
| 2753 |
+
} = state.selection;
|
| 2754 |
|
| 2755 |
+
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 2756 |
+
return EMPTY_ARRAY;
|
| 2757 |
+
}
|
| 2758 |
|
| 2759 |
+
return getSelectedBlockClientIds(state);
|
| 2760 |
+
}
|
| 2761 |
+
/**
|
| 2762 |
+
* Returns the current multi-selection set of blocks, or an empty array if
|
| 2763 |
+
* there is no multi-selection.
|
| 2764 |
+
*
|
| 2765 |
+
* @param {Object} state Editor state.
|
| 2766 |
+
*
|
| 2767 |
+
* @return {Array} Multi-selected block objects.
|
| 2768 |
+
*/
|
| 2769 |
|
| 2770 |
+
const getMultiSelectedBlocks = Object(rememo["a" /* default */])(state => {
|
| 2771 |
+
const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
|
| 2772 |
|
| 2773 |
+
if (!multiSelectedBlockClientIds.length) {
|
| 2774 |
+
return EMPTY_ARRAY;
|
| 2775 |
+
}
|
| 2776 |
|
| 2777 |
+
return multiSelectedBlockClientIds.map(clientId => getBlock(state, clientId));
|
| 2778 |
+
}, state => [...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
|
| 2779 |
+
/**
|
| 2780 |
+
* Returns the client ID of the first block in the multi-selection set, or null
|
| 2781 |
+
* if there is no multi-selection.
|
| 2782 |
+
*
|
| 2783 |
+
* @param {Object} state Editor state.
|
| 2784 |
+
*
|
| 2785 |
+
* @return {?string} First block client ID in the multi-selection set.
|
| 2786 |
+
*/
|
| 2787 |
|
| 2788 |
+
function getFirstMultiSelectedBlockClientId(state) {
|
| 2789 |
+
return Object(external_lodash_["first"])(getMultiSelectedBlockClientIds(state)) || null;
|
| 2790 |
+
}
|
| 2791 |
+
/**
|
| 2792 |
+
* Returns the client ID of the last block in the multi-selection set, or null
|
| 2793 |
+
* if there is no multi-selection.
|
| 2794 |
+
*
|
| 2795 |
+
* @param {Object} state Editor state.
|
| 2796 |
+
*
|
| 2797 |
+
* @return {?string} Last block client ID in the multi-selection set.
|
| 2798 |
+
*/
|
| 2799 |
|
| 2800 |
+
function getLastMultiSelectedBlockClientId(state) {
|
| 2801 |
+
return Object(external_lodash_["last"])(getMultiSelectedBlockClientIds(state)) || null;
|
| 2802 |
+
}
|
| 2803 |
+
/**
|
| 2804 |
+
* Returns true if a multi-selection exists, and the block corresponding to the
|
| 2805 |
+
* specified client ID is the first block of the multi-selection set, or false
|
| 2806 |
+
* otherwise.
|
| 2807 |
+
*
|
| 2808 |
+
* @param {Object} state Editor state.
|
| 2809 |
+
* @param {string} clientId Block client ID.
|
| 2810 |
+
*
|
| 2811 |
+
* @return {boolean} Whether block is first in multi-selection.
|
| 2812 |
+
*/
|
| 2813 |
|
| 2814 |
+
function isFirstMultiSelectedBlock(state, clientId) {
|
| 2815 |
+
return getFirstMultiSelectedBlockClientId(state) === clientId;
|
| 2816 |
+
}
|
| 2817 |
+
/**
|
| 2818 |
+
* Returns true if the client ID occurs within the block multi-selection, or
|
| 2819 |
+
* false otherwise.
|
| 2820 |
+
*
|
| 2821 |
+
* @param {Object} state Editor state.
|
| 2822 |
+
* @param {string} clientId Block client ID.
|
| 2823 |
+
*
|
| 2824 |
+
* @return {boolean} Whether block is in multi-selection set.
|
| 2825 |
+
*/
|
| 2826 |
|
| 2827 |
+
function isBlockMultiSelected(state, clientId) {
|
| 2828 |
+
return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1;
|
| 2829 |
+
}
|
| 2830 |
+
/**
|
| 2831 |
+
* Returns true if an ancestor of the block is multi-selected, or false
|
| 2832 |
+
* otherwise.
|
| 2833 |
+
*
|
| 2834 |
+
* @param {Object} state Editor state.
|
| 2835 |
+
* @param {string} clientId Block client ID.
|
| 2836 |
+
*
|
| 2837 |
+
* @return {boolean} Whether an ancestor of the block is in multi-selection
|
| 2838 |
+
* set.
|
| 2839 |
+
*/
|
| 2840 |
|
| 2841 |
+
const isAncestorMultiSelected = Object(rememo["a" /* default */])((state, clientId) => {
|
| 2842 |
+
let ancestorClientId = clientId;
|
| 2843 |
+
let isMultiSelected = false;
|
| 2844 |
|
| 2845 |
+
while (ancestorClientId && !isMultiSelected) {
|
| 2846 |
+
ancestorClientId = getBlockRootClientId(state, ancestorClientId);
|
| 2847 |
+
isMultiSelected = isBlockMultiSelected(state, ancestorClientId);
|
| 2848 |
+
}
|
| 2849 |
|
| 2850 |
+
return isMultiSelected;
|
| 2851 |
+
}, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
|
| 2852 |
+
/**
|
| 2853 |
+
* Returns the client ID of the block which begins the multi-selection set, or
|
| 2854 |
+
* null if there is no multi-selection.
|
| 2855 |
+
*
|
| 2856 |
+
* This is not necessarily the first client ID in the selection.
|
| 2857 |
+
*
|
| 2858 |
+
* @see getFirstMultiSelectedBlockClientId
|
| 2859 |
+
*
|
| 2860 |
+
* @param {Object} state Editor state.
|
| 2861 |
+
*
|
| 2862 |
+
* @return {?string} Client ID of block beginning multi-selection.
|
| 2863 |
+
*/
|
| 2864 |
|
| 2865 |
+
function getMultiSelectedBlocksStartClientId(state) {
|
| 2866 |
+
const {
|
| 2867 |
+
selectionStart,
|
| 2868 |
+
selectionEnd
|
| 2869 |
+
} = state.selection;
|
| 2870 |
|
| 2871 |
+
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 2872 |
+
return null;
|
| 2873 |
+
}
|
| 2874 |
|
| 2875 |
+
return selectionStart.clientId || null;
|
| 2876 |
+
}
|
| 2877 |
/**
|
| 2878 |
+
* Returns the client ID of the block which ends the multi-selection set, or
|
| 2879 |
+
* null if there is no multi-selection.
|
| 2880 |
+
*
|
| 2881 |
+
* This is not necessarily the last client ID in the selection.
|
| 2882 |
+
*
|
| 2883 |
+
* @see getLastMultiSelectedBlockClientId
|
| 2884 |
+
*
|
| 2885 |
+
* @param {Object} state Editor state.
|
| 2886 |
+
*
|
| 2887 |
+
* @return {?string} Client ID of block ending multi-selection.
|
| 2888 |
*/
|
| 2889 |
|
| 2890 |
+
function getMultiSelectedBlocksEndClientId(state) {
|
| 2891 |
+
const {
|
| 2892 |
+
selectionStart,
|
| 2893 |
+
selectionEnd
|
| 2894 |
+
} = state.selection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2895 |
|
| 2896 |
+
if (selectionStart.clientId === selectionEnd.clientId) {
|
| 2897 |
+
return null;
|
| 2898 |
+
}
|
|
|
|
| 2899 |
|
| 2900 |
+
return selectionEnd.clientId || null;
|
| 2901 |
+
}
|
| 2902 |
+
/**
|
| 2903 |
+
* Returns an array containing all block client IDs in the editor in the order
|
| 2904 |
+
* they appear. Optionally accepts a root client ID of the block list for which
|
| 2905 |
+
* the order should be returned, defaulting to the top-level block order.
|
| 2906 |
+
*
|
| 2907 |
+
* @param {Object} state Editor state.
|
| 2908 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2909 |
+
*
|
| 2910 |
+
* @return {Array} Ordered client IDs of editor blocks.
|
| 2911 |
+
*/
|
| 2912 |
|
| 2913 |
+
function getBlockOrder(state, rootClientId) {
|
| 2914 |
+
return state.blocks.order[rootClientId || ''] || EMPTY_ARRAY;
|
| 2915 |
+
}
|
| 2916 |
+
/**
|
| 2917 |
+
* Returns the index at which the block corresponding to the specified client
|
| 2918 |
+
* ID occurs within the block order, or `-1` if the block does not exist.
|
| 2919 |
+
*
|
| 2920 |
+
* @param {Object} state Editor state.
|
| 2921 |
+
* @param {string} clientId Block client ID.
|
| 2922 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 2923 |
+
*
|
| 2924 |
+
* @return {number} Index at which block exists in order.
|
| 2925 |
+
*/
|
| 2926 |
|
| 2927 |
+
function getBlockIndex(state, clientId, rootClientId) {
|
| 2928 |
+
return getBlockOrder(state, rootClientId).indexOf(clientId);
|
| 2929 |
}
|
| 2930 |
+
/**
|
| 2931 |
+
* Returns true if the block corresponding to the specified client ID is
|
| 2932 |
+
* currently selected and no multi-selection exists, or false otherwise.
|
| 2933 |
+
*
|
| 2934 |
+
* @param {Object} state Editor state.
|
| 2935 |
+
* @param {string} clientId Block client ID.
|
| 2936 |
+
*
|
| 2937 |
+
* @return {boolean} Whether block is selected and multi-selection exists.
|
| 2938 |
+
*/
|
| 2939 |
|
| 2940 |
+
function isBlockSelected(state, clientId) {
|
| 2941 |
+
const {
|
| 2942 |
+
selectionStart,
|
| 2943 |
+
selectionEnd
|
| 2944 |
+
} = state.selection;
|
| 2945 |
|
| 2946 |
+
if (selectionStart.clientId !== selectionEnd.clientId) {
|
| 2947 |
+
return false;
|
| 2948 |
+
}
|
| 2949 |
|
| 2950 |
+
return selectionStart.clientId === clientId;
|
| 2951 |
+
}
|
| 2952 |
+
/**
|
| 2953 |
+
* Returns true if one of the block's inner blocks is selected.
|
| 2954 |
+
*
|
| 2955 |
+
* @param {Object} state Editor state.
|
| 2956 |
+
* @param {string} clientId Block client ID.
|
| 2957 |
+
* @param {boolean} deep Perform a deep check.
|
| 2958 |
+
*
|
| 2959 |
+
* @return {boolean} Whether the block as an inner block selected
|
| 2960 |
+
*/
|
| 2961 |
|
| 2962 |
+
function hasSelectedInnerBlock(state, clientId, deep = false) {
|
| 2963 |
+
return Object(external_lodash_["some"])(getBlockOrder(state, clientId), innerClientId => isBlockSelected(state, innerClientId) || isBlockMultiSelected(state, innerClientId) || deep && hasSelectedInnerBlock(state, innerClientId, deep));
|
| 2964 |
+
}
|
| 2965 |
+
/**
|
| 2966 |
+
* Returns true if the block corresponding to the specified client ID is
|
| 2967 |
+
* currently selected but isn't the last of the selected blocks. Here "last"
|
| 2968 |
+
* refers to the block sequence in the document, _not_ the sequence of
|
| 2969 |
+
* multi-selection, which is why `state.selectionEnd` isn't used.
|
| 2970 |
+
*
|
| 2971 |
+
* @param {Object} state Editor state.
|
| 2972 |
+
* @param {string} clientId Block client ID.
|
| 2973 |
+
*
|
| 2974 |
+
* @return {boolean} Whether block is selected and not the last in the
|
| 2975 |
+
* selection.
|
| 2976 |
+
*/
|
| 2977 |
|
| 2978 |
+
function isBlockWithinSelection(state, clientId) {
|
| 2979 |
+
if (!clientId) {
|
| 2980 |
+
return false;
|
| 2981 |
+
}
|
| 2982 |
|
| 2983 |
+
const clientIds = getMultiSelectedBlockClientIds(state);
|
| 2984 |
+
const index = clientIds.indexOf(clientId);
|
| 2985 |
+
return index > -1 && index < clientIds.length - 1;
|
| 2986 |
+
}
|
| 2987 |
/**
|
| 2988 |
+
* Returns true if a multi-selection has been made, or false otherwise.
|
| 2989 |
+
*
|
| 2990 |
+
* @param {Object} state Editor state.
|
| 2991 |
+
*
|
| 2992 |
+
* @return {boolean} Whether multi-selection has been made.
|
| 2993 |
*/
|
| 2994 |
|
| 2995 |
+
function hasMultiSelection(state) {
|
| 2996 |
+
const {
|
| 2997 |
+
selectionStart,
|
| 2998 |
+
selectionEnd
|
| 2999 |
+
} = state.selection;
|
| 3000 |
+
return selectionStart.clientId !== selectionEnd.clientId;
|
| 3001 |
+
}
|
| 3002 |
+
/**
|
| 3003 |
+
* Whether in the process of multi-selecting or not. This flag is only true
|
| 3004 |
+
* while the multi-selection is being selected (by mouse move), and is false
|
| 3005 |
+
* once the multi-selection has been settled.
|
| 3006 |
+
*
|
| 3007 |
+
* @see hasMultiSelection
|
| 3008 |
+
*
|
| 3009 |
+
* @param {Object} state Global application state.
|
| 3010 |
+
*
|
| 3011 |
+
* @return {boolean} True if multi-selecting, false if not.
|
| 3012 |
+
*/
|
| 3013 |
|
| 3014 |
+
function selectors_isMultiSelecting(state) {
|
| 3015 |
+
return state.isMultiSelecting;
|
| 3016 |
+
}
|
| 3017 |
+
/**
|
| 3018 |
+
* Selector that returns if multi-selection is enabled or not.
|
| 3019 |
+
*
|
| 3020 |
+
* @param {Object} state Global application state.
|
| 3021 |
+
*
|
| 3022 |
+
* @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled.
|
| 3023 |
+
*/
|
| 3024 |
|
| 3025 |
+
function selectors_isSelectionEnabled(state) {
|
| 3026 |
+
return state.isSelectionEnabled;
|
| 3027 |
+
}
|
| 3028 |
+
/**
|
| 3029 |
+
* Returns the block's editing mode, defaulting to "visual" if not explicitly
|
| 3030 |
+
* assigned.
|
| 3031 |
+
*
|
| 3032 |
+
* @param {Object} state Editor state.
|
| 3033 |
+
* @param {string} clientId Block client ID.
|
| 3034 |
+
*
|
| 3035 |
+
* @return {Object} Block editing mode.
|
| 3036 |
+
*/
|
| 3037 |
|
| 3038 |
+
function getBlockMode(state, clientId) {
|
| 3039 |
+
return state.blocksMode[clientId] || 'visual';
|
| 3040 |
+
}
|
| 3041 |
+
/**
|
| 3042 |
+
* Returns true if the user is typing, or false otherwise.
|
| 3043 |
+
*
|
| 3044 |
+
* @param {Object} state Global application state.
|
| 3045 |
+
*
|
| 3046 |
+
* @return {boolean} Whether user is typing.
|
| 3047 |
+
*/
|
| 3048 |
|
| 3049 |
+
function selectors_isTyping(state) {
|
| 3050 |
+
return state.isTyping;
|
| 3051 |
+
}
|
| 3052 |
/**
|
| 3053 |
+
* Returns true if the user is dragging blocks, or false otherwise.
|
| 3054 |
+
*
|
| 3055 |
+
* @param {Object} state Global application state.
|
| 3056 |
+
*
|
| 3057 |
+
* @return {boolean} Whether user is dragging blocks.
|
| 3058 |
*/
|
| 3059 |
|
| 3060 |
+
function isDraggingBlocks(state) {
|
| 3061 |
+
return !!state.draggedBlocks.length;
|
| 3062 |
+
}
|
| 3063 |
+
/**
|
| 3064 |
+
* Returns the client ids of any blocks being directly dragged.
|
| 3065 |
+
*
|
| 3066 |
+
* This does not include children of a parent being dragged.
|
| 3067 |
+
*
|
| 3068 |
+
* @param {Object} state Global application state.
|
| 3069 |
+
*
|
| 3070 |
+
* @return {string[]} Array of dragged block client ids.
|
| 3071 |
+
*/
|
| 3072 |
|
| 3073 |
+
function getDraggedBlockClientIds(state) {
|
| 3074 |
+
return state.draggedBlocks;
|
| 3075 |
+
}
|
| 3076 |
+
/**
|
| 3077 |
+
* Returns whether the block is being dragged.
|
| 3078 |
+
*
|
| 3079 |
+
* Only returns true if the block is being directly dragged,
|
| 3080 |
+
* not if the block is a child of a parent being dragged.
|
| 3081 |
+
* See `isAncestorBeingDragged` for child blocks.
|
| 3082 |
+
*
|
| 3083 |
+
* @param {Object} state Global application state.
|
| 3084 |
+
* @param {string} clientId Client id for block to check.
|
| 3085 |
+
*
|
| 3086 |
+
* @return {boolean} Whether the block is being dragged.
|
| 3087 |
+
*/
|
| 3088 |
|
| 3089 |
+
function isBlockBeingDragged(state, clientId) {
|
| 3090 |
+
return state.draggedBlocks.includes(clientId);
|
| 3091 |
+
}
|
| 3092 |
+
/**
|
| 3093 |
+
* Returns whether a parent/ancestor of the block is being dragged.
|
| 3094 |
+
*
|
| 3095 |
+
* @param {Object} state Global application state.
|
| 3096 |
+
* @param {string} clientId Client id for block to check.
|
| 3097 |
+
*
|
| 3098 |
+
* @return {boolean} Whether the block's ancestor is being dragged.
|
| 3099 |
+
*/
|
| 3100 |
|
| 3101 |
+
function isAncestorBeingDragged(state, clientId) {
|
| 3102 |
+
// Return early if no blocks are being dragged rather than
|
| 3103 |
+
// the more expensive check for parents.
|
| 3104 |
+
if (!isDraggingBlocks(state)) {
|
| 3105 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3106 |
}
|
| 3107 |
+
|
| 3108 |
+
const parents = getBlockParents(state, clientId);
|
| 3109 |
+
return Object(external_lodash_["some"])(parents, parentClientId => isBlockBeingDragged(state, parentClientId));
|
| 3110 |
+
}
|
| 3111 |
+
/**
|
| 3112 |
+
* Returns true if the caret is within formatted text, or false otherwise.
|
| 3113 |
+
*
|
| 3114 |
+
* @param {Object} state Global application state.
|
| 3115 |
+
*
|
| 3116 |
+
* @return {boolean} Whether the caret is within formatted text.
|
| 3117 |
+
*/
|
| 3118 |
+
|
| 3119 |
+
function selectors_isCaretWithinFormattedText(state) {
|
| 3120 |
+
return state.isCaretWithinFormattedText;
|
| 3121 |
}
|
| 3122 |
+
/**
|
| 3123 |
+
* Returns the insertion point, the index at which the new inserted block would
|
| 3124 |
+
* be placed. Defaults to the last index.
|
| 3125 |
+
*
|
| 3126 |
+
* @param {Object} state Editor state.
|
| 3127 |
+
*
|
| 3128 |
+
* @return {Object} Insertion point object with `rootClientId`, `index`.
|
| 3129 |
+
*/
|
| 3130 |
|
| 3131 |
+
function getBlockInsertionPoint(state) {
|
| 3132 |
+
let rootClientId, index;
|
| 3133 |
+
const {
|
| 3134 |
+
insertionPoint,
|
| 3135 |
+
selection: {
|
| 3136 |
+
selectionEnd
|
| 3137 |
+
}
|
| 3138 |
+
} = state;
|
| 3139 |
|
| 3140 |
+
if (insertionPoint !== null) {
|
| 3141 |
+
return insertionPoint;
|
| 3142 |
+
}
|
| 3143 |
|
| 3144 |
+
const {
|
| 3145 |
+
clientId
|
| 3146 |
+
} = selectionEnd;
|
| 3147 |
|
| 3148 |
+
if (clientId) {
|
| 3149 |
+
rootClientId = getBlockRootClientId(state, clientId) || undefined;
|
| 3150 |
+
index = getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1;
|
| 3151 |
+
} else {
|
| 3152 |
+
index = getBlockOrder(state).length;
|
| 3153 |
+
}
|
| 3154 |
|
| 3155 |
+
return {
|
| 3156 |
+
rootClientId,
|
| 3157 |
+
index
|
| 3158 |
+
};
|
| 3159 |
+
}
|
| 3160 |
+
/**
|
| 3161 |
+
* Returns true if we should show the block insertion point.
|
| 3162 |
+
*
|
| 3163 |
+
* @param {Object} state Global application state.
|
| 3164 |
+
*
|
| 3165 |
+
* @return {?boolean} Whether the insertion point is visible or not.
|
| 3166 |
+
*/
|
| 3167 |
|
| 3168 |
+
function isBlockInsertionPointVisible(state) {
|
| 3169 |
+
return state.insertionPoint !== null;
|
| 3170 |
+
}
|
| 3171 |
/**
|
| 3172 |
+
* Returns whether the blocks matches the template or not.
|
| 3173 |
+
*
|
| 3174 |
+
* @param {boolean} state
|
| 3175 |
+
* @return {?boolean} Whether the template is valid or not.
|
| 3176 |
*/
|
| 3177 |
|
| 3178 |
+
function selectors_isValidTemplate(state) {
|
| 3179 |
+
return state.template.isValid;
|
| 3180 |
+
}
|
| 3181 |
+
/**
|
| 3182 |
+
* Returns the defined block template
|
| 3183 |
+
*
|
| 3184 |
+
* @param {boolean} state
|
| 3185 |
+
*
|
| 3186 |
+
* @return {?Array} Block Template.
|
| 3187 |
+
*/
|
| 3188 |
|
| 3189 |
+
function getTemplate(state) {
|
| 3190 |
+
return state.settings.template;
|
| 3191 |
+
}
|
| 3192 |
+
/**
|
| 3193 |
+
* Returns the defined block template lock. Optionally accepts a root block
|
| 3194 |
+
* client ID as context, otherwise defaulting to the global context.
|
| 3195 |
+
*
|
| 3196 |
+
* @param {Object} state Editor state.
|
| 3197 |
+
* @param {?string} rootClientId Optional block root client ID.
|
| 3198 |
+
*
|
| 3199 |
+
* @return {?string} Block Template Lock
|
| 3200 |
+
*/
|
| 3201 |
|
| 3202 |
+
function getTemplateLock(state, rootClientId) {
|
| 3203 |
+
if (!rootClientId) {
|
| 3204 |
+
return state.settings.templateLock;
|
| 3205 |
+
}
|
| 3206 |
|
| 3207 |
+
const blockListSettings = getBlockListSettings(state, rootClientId);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3208 |
|
| 3209 |
+
if (!blockListSettings) {
|
| 3210 |
+
return null;
|
|
|
|
|
|
|
| 3211 |
}
|
| 3212 |
|
| 3213 |
+
return blockListSettings.templateLock;
|
| 3214 |
}
|
| 3215 |
|
| 3216 |
+
const checkAllowList = (list, item, defaultResult = null) => {
|
| 3217 |
+
if (Object(external_lodash_["isBoolean"])(list)) {
|
| 3218 |
+
return list;
|
| 3219 |
+
}
|
|
|
|
|
|
|
|
|
|
| 3220 |
|
| 3221 |
+
if (Object(external_lodash_["isArray"])(list)) {
|
| 3222 |
+
// TODO: when there is a canonical way to detect that we are editing a post
|
| 3223 |
+
// the following check should be changed to something like:
|
| 3224 |
+
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
|
| 3225 |
+
if (list.includes('core/post-content') && item === null) {
|
| 3226 |
+
return true;
|
| 3227 |
+
}
|
| 3228 |
|
| 3229 |
+
return list.includes(item);
|
| 3230 |
+
}
|
|
|
|
|
|
|
|
|
|
| 3231 |
|
| 3232 |
+
return defaultResult;
|
| 3233 |
+
};
|
| 3234 |
+
/**
|
| 3235 |
+
* Determines if the given block type is allowed to be inserted into the block list.
|
| 3236 |
+
* This function is not exported and not memoized because using a memoized selector
|
| 3237 |
+
* inside another memoized selector is just a waste of time.
|
| 3238 |
+
*
|
| 3239 |
+
* @param {Object} state Editor state.
|
| 3240 |
+
* @param {string|Object} blockName The block type object, e.g., the response
|
| 3241 |
+
* from the block directory; or a string name of
|
| 3242 |
+
* an installed block type, e.g.' core/paragraph'.
|
| 3243 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3244 |
+
*
|
| 3245 |
+
* @return {boolean} Whether the given block type is allowed to be inserted.
|
| 3246 |
+
*/
|
| 3247 |
|
|
|
|
| 3248 |
|
| 3249 |
+
const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => {
|
| 3250 |
+
let blockType;
|
| 3251 |
|
| 3252 |
+
if (blockName && 'object' === typeof blockName) {
|
| 3253 |
+
blockType = blockName;
|
| 3254 |
+
blockName = blockType.name;
|
| 3255 |
+
} else {
|
| 3256 |
+
blockType = Object(external_wp_blocks_["getBlockType"])(blockName);
|
| 3257 |
+
}
|
| 3258 |
|
| 3259 |
+
if (!blockType) {
|
| 3260 |
+
return false;
|
| 3261 |
+
}
|
| 3262 |
|
| 3263 |
+
const {
|
| 3264 |
+
allowedBlockTypes
|
| 3265 |
+
} = getSettings(state);
|
| 3266 |
+
const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true);
|
| 3267 |
|
| 3268 |
+
if (!isBlockAllowedInEditor) {
|
| 3269 |
+
return false;
|
| 3270 |
+
}
|
| 3271 |
|
| 3272 |
+
const isLocked = !!getTemplateLock(state, rootClientId);
|
|
|
|
| 3273 |
|
| 3274 |
+
if (isLocked) {
|
| 3275 |
+
return false;
|
|
|
|
| 3276 |
}
|
| 3277 |
|
| 3278 |
+
const parentBlockListSettings = getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support
|
| 3279 |
+
// inner blocks, return false.
|
| 3280 |
|
| 3281 |
+
if (rootClientId && parentBlockListSettings === undefined) {
|
| 3282 |
+
return false;
|
| 3283 |
+
}
|
| 3284 |
|
| 3285 |
+
const parentAllowedBlocks = parentBlockListSettings === null || parentBlockListSettings === void 0 ? void 0 : parentBlockListSettings.allowedBlocks;
|
| 3286 |
+
const hasParentAllowedBlock = checkAllowList(parentAllowedBlocks, blockName);
|
| 3287 |
+
const blockAllowedParentBlocks = blockType.parent;
|
| 3288 |
+
const parentName = getBlockName(state, rootClientId);
|
| 3289 |
+
const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName);
|
| 3290 |
|
| 3291 |
+
if (hasParentAllowedBlock !== null && hasBlockAllowedParent !== null) {
|
| 3292 |
+
return hasParentAllowedBlock || hasBlockAllowedParent;
|
| 3293 |
+
} else if (hasParentAllowedBlock !== null) {
|
| 3294 |
+
return hasParentAllowedBlock;
|
| 3295 |
+
} else if (hasBlockAllowedParent !== null) {
|
| 3296 |
+
return hasBlockAllowedParent;
|
| 3297 |
+
}
|
| 3298 |
|
| 3299 |
+
return true;
|
| 3300 |
+
};
|
| 3301 |
+
/**
|
| 3302 |
+
* Determines if the given block type is allowed to be inserted into the block list.
|
| 3303 |
+
*
|
| 3304 |
+
* @param {Object} state Editor state.
|
| 3305 |
+
* @param {string} blockName The name of the block type, e.g.' core/paragraph'.
|
| 3306 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3307 |
+
*
|
| 3308 |
+
* @return {boolean} Whether the given block type is allowed to be inserted.
|
| 3309 |
+
*/
|
| 3310 |
|
| 3311 |
|
| 3312 |
+
const canInsertBlockType = Object(rememo["a" /* default */])(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]);
|
| 3313 |
+
/**
|
| 3314 |
+
* Determines if the given blocks are allowed to be inserted into the block
|
| 3315 |
+
* list.
|
| 3316 |
+
*
|
| 3317 |
+
* @param {Object} state Editor state.
|
| 3318 |
+
* @param {string} clientIds The block client IDs to be inserted.
|
| 3319 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3320 |
+
*
|
| 3321 |
+
* @return {boolean} Whether the given blocks are allowed to be inserted.
|
| 3322 |
+
*/
|
| 3323 |
|
| 3324 |
+
function selectors_canInsertBlocks(state, clientIds, rootClientId = null) {
|
| 3325 |
+
return clientIds.every(id => canInsertBlockType(state, getBlockName(state, id), rootClientId));
|
| 3326 |
+
}
|
| 3327 |
+
/**
|
| 3328 |
+
* Returns information about how recently and frequently a block has been inserted.
|
| 3329 |
+
*
|
| 3330 |
+
* @param {Object} state Global application state.
|
| 3331 |
+
* @param {string} id A string which identifies the insert, e.g. 'core/block/12'
|
| 3332 |
+
*
|
| 3333 |
+
* @return {?{ time: number, count: number }} An object containing `time` which is when the last
|
| 3334 |
+
* insert occurred as a UNIX epoch, and `count` which is
|
| 3335 |
+
* the number of inserts that have occurred.
|
| 3336 |
+
*/
|
| 3337 |
|
| 3338 |
+
function getInsertUsage(state, id) {
|
| 3339 |
+
var _state$preferences$in, _state$preferences$in2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3340 |
|
| 3341 |
+
return (_state$preferences$in = (_state$preferences$in2 = state.preferences.insertUsage) === null || _state$preferences$in2 === void 0 ? void 0 : _state$preferences$in2[id]) !== null && _state$preferences$in !== void 0 ? _state$preferences$in : null;
|
| 3342 |
+
}
|
| 3343 |
+
/**
|
| 3344 |
+
* Returns whether we can show a block type in the inserter
|
| 3345 |
+
*
|
| 3346 |
+
* @param {Object} state Global State
|
| 3347 |
+
* @param {Object} blockType BlockType
|
| 3348 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3349 |
+
*
|
| 3350 |
+
* @return {boolean} Whether the given block type is allowed to be shown in the inserter.
|
| 3351 |
+
*/
|
| 3352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3353 |
|
| 3354 |
+
const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => {
|
| 3355 |
+
if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'inserter', true)) {
|
| 3356 |
+
return false;
|
| 3357 |
}
|
| 3358 |
|
| 3359 |
+
return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId);
|
| 3360 |
+
};
|
| 3361 |
+
/**
|
| 3362 |
+
* Return a function to be used to tranform a block variation to an inserter item
|
| 3363 |
+
*
|
| 3364 |
+
* @param {Object} state Global State
|
| 3365 |
+
* @param {Object} item Denormalized inserter item
|
| 3366 |
+
* @return {Function} Function to transform a block variation to inserter item
|
| 3367 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3369 |
|
| 3370 |
+
const getItemFromVariation = (state, item) => variation => {
|
| 3371 |
+
const variationId = `${item.id}/${variation.name}`;
|
| 3372 |
+
const {
|
| 3373 |
+
time,
|
| 3374 |
+
count = 0
|
| 3375 |
+
} = getInsertUsage(state, variationId) || {};
|
| 3376 |
+
return { ...item,
|
| 3377 |
+
id: variationId,
|
| 3378 |
+
icon: variation.icon || item.icon,
|
| 3379 |
+
title: variation.title || item.title,
|
| 3380 |
+
description: variation.description || item.description,
|
| 3381 |
+
category: variation.category || item.category,
|
| 3382 |
+
// If `example` is explicitly undefined for the variation, the preview will not be shown.
|
| 3383 |
+
example: variation.hasOwnProperty('example') ? variation.example : item.example,
|
| 3384 |
+
initialAttributes: { ...item.initialAttributes,
|
| 3385 |
+
...variation.attributes
|
| 3386 |
+
},
|
| 3387 |
+
innerBlocks: variation.innerBlocks,
|
| 3388 |
+
keywords: variation.keywords || item.keywords,
|
| 3389 |
+
frecency: calculateFrecency(time, count)
|
| 3390 |
+
};
|
| 3391 |
+
};
|
| 3392 |
+
/**
|
| 3393 |
+
* Returns the calculated frecency.
|
| 3394 |
+
*
|
| 3395 |
+
* 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 3396 |
+
* that combines block usage frequenty and recency.
|
| 3397 |
+
*
|
| 3398 |
+
* @param {number} time When the last insert occurred as a UNIX epoch
|
| 3399 |
+
* @param {number} count The number of inserts that have occurred.
|
| 3400 |
+
*
|
| 3401 |
+
* @return {number} The calculated frecency.
|
| 3402 |
+
*/
|
| 3403 |
|
|
|
|
| 3404 |
|
| 3405 |
+
const calculateFrecency = (time, count) => {
|
| 3406 |
+
if (!time) {
|
| 3407 |
+
return count;
|
| 3408 |
+
} // The selector is cached, which means Date.now() is the last time that the
|
| 3409 |
+
// relevant state changed. This suits our needs.
|
| 3410 |
|
|
|
|
|
|
|
| 3411 |
|
| 3412 |
+
const duration = Date.now() - time;
|
| 3413 |
|
| 3414 |
+
switch (true) {
|
| 3415 |
+
case duration < MILLISECONDS_PER_HOUR:
|
| 3416 |
+
return count * 4;
|
| 3417 |
|
| 3418 |
+
case duration < MILLISECONDS_PER_DAY:
|
| 3419 |
+
return count * 2;
|
| 3420 |
|
| 3421 |
+
case duration < MILLISECONDS_PER_WEEK:
|
| 3422 |
+
return count / 2;
|
| 3423 |
|
| 3424 |
+
default:
|
| 3425 |
+
return count / 4;
|
| 3426 |
+
}
|
| 3427 |
+
};
|
| 3428 |
+
/**
|
| 3429 |
+
* Returns a function that accepts a block type and builds an item to be shown
|
| 3430 |
+
* in a specific context. It's used for building items for Inserter and available
|
| 3431 |
+
* block Transfroms list.
|
| 3432 |
+
*
|
| 3433 |
+
* @param {Object} state Editor state.
|
| 3434 |
+
* @param {Object} options Options object for handling the building of a block type.
|
| 3435 |
+
* @param {string} options.buildScope The scope for which the item is going to be used.
|
| 3436 |
+
* @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list).
|
| 3437 |
+
*/
|
| 3438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3439 |
|
| 3440 |
+
const buildBlockTypeItem = (state, {
|
| 3441 |
+
buildScope = 'inserter'
|
| 3442 |
+
}) => blockType => {
|
| 3443 |
+
const id = blockType.name;
|
| 3444 |
+
let isDisabled = false;
|
| 3445 |
|
| 3446 |
+
if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType.name, 'multiple', true)) {
|
| 3447 |
+
isDisabled = Object(external_lodash_["some"])(getBlocksByClientId(state, getClientIdsWithDescendants(state)), {
|
| 3448 |
+
name: blockType.name
|
| 3449 |
+
});
|
| 3450 |
+
}
|
| 3451 |
|
| 3452 |
+
const {
|
| 3453 |
+
time,
|
| 3454 |
+
count = 0
|
| 3455 |
+
} = getInsertUsage(state, id) || {};
|
| 3456 |
+
const blockItemBase = {
|
| 3457 |
+
id,
|
| 3458 |
+
name: blockType.name,
|
| 3459 |
+
title: blockType.title,
|
| 3460 |
+
icon: blockType.icon,
|
| 3461 |
+
isDisabled,
|
| 3462 |
+
frecency: calculateFrecency(time, count)
|
| 3463 |
+
};
|
| 3464 |
+
if (buildScope === 'transform') return blockItemBase;
|
| 3465 |
+
const inserterVariations = blockType.variations.filter(({
|
| 3466 |
+
scope
|
| 3467 |
+
}) => !scope || scope.includes('inserter'));
|
| 3468 |
+
return { ...blockItemBase,
|
| 3469 |
+
initialAttributes: {},
|
| 3470 |
+
description: blockType.description,
|
| 3471 |
+
category: blockType.category,
|
| 3472 |
+
keywords: blockType.keywords,
|
| 3473 |
+
variations: inserterVariations,
|
| 3474 |
+
example: blockType.example,
|
| 3475 |
+
utility: 1 // deprecated
|
| 3476 |
|
| 3477 |
+
};
|
| 3478 |
+
};
|
| 3479 |
+
/**
|
| 3480 |
+
* Determines the items that appear in the inserter. Includes both static
|
| 3481 |
+
* items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
|
| 3482 |
+
*
|
| 3483 |
+
* Each item object contains what's necessary to display a button in the
|
| 3484 |
+
* inserter and handle its selection.
|
| 3485 |
+
*
|
| 3486 |
+
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 3487 |
+
* that combines block usage frequenty and recency.
|
| 3488 |
+
*
|
| 3489 |
+
* Items are returned ordered descendingly by their 'utility' and 'frecency'.
|
| 3490 |
+
*
|
| 3491 |
+
* @param {Object} state Editor state.
|
| 3492 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3493 |
+
*
|
| 3494 |
+
* @return {WPEditorInserterItem[]} Items that appear in inserter.
|
| 3495 |
+
*
|
| 3496 |
+
* @typedef {Object} WPEditorInserterItem
|
| 3497 |
+
* @property {string} id Unique identifier for the item.
|
| 3498 |
+
* @property {string} name The type of block to create.
|
| 3499 |
+
* @property {Object} initialAttributes Attributes to pass to the newly created block.
|
| 3500 |
+
* @property {string} title Title of the item, as it appears in the inserter.
|
| 3501 |
+
* @property {string} icon Dashicon for the item, as it appears in the inserter.
|
| 3502 |
+
* @property {string} category Block category that the item is associated with.
|
| 3503 |
+
* @property {string[]} keywords Keywords that can be searched to find this item.
|
| 3504 |
+
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
|
| 3505 |
+
* this item.
|
| 3506 |
+
* @property {number} frecency Heuristic that combines frequency and recency.
|
| 3507 |
+
*/
|
| 3508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3509 |
|
| 3510 |
+
const getInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => {
|
| 3511 |
+
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
|
| 3512 |
+
buildScope: 'inserter'
|
| 3513 |
+
});
|
| 3514 |
|
| 3515 |
+
const buildReusableBlockInserterItem = reusableBlock => {
|
| 3516 |
+
const id = `core/block/${reusableBlock.id}`;
|
|
|
|
|
|
|
|
|
|
| 3517 |
|
| 3518 |
+
const referencedBlocks = __experimentalGetParsedReusableBlock(state, reusableBlock.id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3519 |
|
| 3520 |
+
let referencedBlockType;
|
|
|
|
|
|
|
| 3521 |
|
| 3522 |
+
if (referencedBlocks.length === 1) {
|
| 3523 |
+
referencedBlockType = Object(external_wp_blocks_["getBlockType"])(referencedBlocks[0].name);
|
| 3524 |
+
}
|
| 3525 |
|
| 3526 |
+
const {
|
| 3527 |
+
time,
|
| 3528 |
+
count = 0
|
| 3529 |
+
} = getInsertUsage(state, id) || {};
|
| 3530 |
+
const frecency = calculateFrecency(time, count);
|
| 3531 |
+
return {
|
| 3532 |
+
id,
|
| 3533 |
+
name: 'core/block',
|
| 3534 |
+
initialAttributes: {
|
| 3535 |
+
ref: reusableBlock.id
|
| 3536 |
+
},
|
| 3537 |
+
title: reusableBlock.title.raw,
|
| 3538 |
+
icon: referencedBlockType ? referencedBlockType.icon : templateIcon,
|
| 3539 |
+
category: 'reusable',
|
| 3540 |
+
keywords: [],
|
| 3541 |
+
isDisabled: false,
|
| 3542 |
+
utility: 1,
|
| 3543 |
+
// deprecated
|
| 3544 |
+
frecency
|
| 3545 |
+
};
|
| 3546 |
+
};
|
| 3547 |
|
| 3548 |
+
const blockTypeInserterItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
|
| 3549 |
+
const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; // Exclude any block type item that is to be replaced by a default
|
| 3550 |
+
// variation.
|
|
|
|
| 3551 |
|
| 3552 |
+
const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(({
|
| 3553 |
+
variations = []
|
| 3554 |
+
}) => !variations.some(({
|
| 3555 |
+
isDefault
|
| 3556 |
+
}) => isDefault));
|
| 3557 |
+
const blockVariations = []; // Show all available blocks with variations
|
| 3558 |
|
| 3559 |
+
for (const item of blockTypeInserterItems) {
|
| 3560 |
+
const {
|
| 3561 |
+
variations = []
|
| 3562 |
+
} = item;
|
|
|
|
|
|
|
| 3563 |
|
| 3564 |
+
if (variations.length) {
|
| 3565 |
+
const variationMapper = getItemFromVariation(state, item);
|
| 3566 |
+
blockVariations.push(...variations.map(variationMapper));
|
| 3567 |
+
}
|
| 3568 |
+
} // Prioritize core blocks's display in inserter.
|
| 3569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3570 |
|
| 3571 |
+
const prioritizeCoreBlocks = (a, b) => {
|
| 3572 |
+
const coreBlockNamePrefix = 'core/';
|
| 3573 |
+
const firstIsCoreBlock = a.name.startsWith(coreBlockNamePrefix);
|
| 3574 |
+
const secondIsCoreBlock = b.name.startsWith(coreBlockNamePrefix);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3575 |
|
| 3576 |
+
if (firstIsCoreBlock && secondIsCoreBlock) {
|
| 3577 |
+
return 0;
|
| 3578 |
+
}
|
| 3579 |
|
| 3580 |
+
return firstIsCoreBlock && !secondIsCoreBlock ? -1 : 1;
|
| 3581 |
+
}; // Ensure core blocks are prioritized in the returned results,
|
| 3582 |
+
// because third party blocks can be registered earlier than
|
| 3583 |
+
// the core blocks (usually by using the `init` action),
|
| 3584 |
+
// thus affecting the display order.
|
| 3585 |
+
// We don't sort reusable blocks as they are handled differently.
|
| 3586 |
|
|
|
|
|
|
|
| 3587 |
|
| 3588 |
+
const sortedBlockTypes = [...visibleBlockTypeInserterItems, ...blockVariations].sort(prioritizeCoreBlocks);
|
| 3589 |
+
return [...sortedBlockTypes, ...reusableBlockInserterItems];
|
| 3590 |
+
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]);
|
| 3591 |
+
/**
|
| 3592 |
+
* Determines the items that appear in the available block transforms list.
|
| 3593 |
+
*
|
| 3594 |
+
* Each item object contains what's necessary to display a menu item in the
|
| 3595 |
+
* transform list and handle its selection.
|
| 3596 |
+
*
|
| 3597 |
+
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
| 3598 |
+
* that combines block usage frequenty and recency.
|
| 3599 |
+
*
|
| 3600 |
+
* Items are returned ordered descendingly by their 'frecency'.
|
| 3601 |
+
*
|
| 3602 |
+
* @param {Object} state Editor state.
|
| 3603 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3604 |
+
*
|
| 3605 |
+
* @return {WPEditorTransformItem[]} Items that appear in inserter.
|
| 3606 |
+
*
|
| 3607 |
+
* @typedef {Object} WPEditorTransformItem
|
| 3608 |
+
* @property {string} id Unique identifier for the item.
|
| 3609 |
+
* @property {string} name The type of block to create.
|
| 3610 |
+
* @property {string} title Title of the item, as it appears in the inserter.
|
| 3611 |
+
* @property {string} icon Dashicon for the item, as it appears in the inserter.
|
| 3612 |
+
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
|
| 3613 |
+
* this item.
|
| 3614 |
+
* @property {number} frecency Heuristic that combines frequency and recency.
|
| 3615 |
+
*/
|
| 3616 |
|
| 3617 |
+
const getBlockTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => {
|
| 3618 |
+
const buildBlockTypeTransformItem = buildBlockTypeItem(state, {
|
| 3619 |
+
buildScope: 'transform'
|
| 3620 |
+
});
|
| 3621 |
+
const blockTypeTransformItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
|
| 3622 |
+
const itemsByName = Object(external_lodash_["mapKeys"])(blockTypeTransformItems, ({
|
| 3623 |
+
name
|
| 3624 |
+
}) => name);
|
| 3625 |
+
const possibleTransforms = Object(external_wp_blocks_["getPossibleBlockTransformations"])(blocks).reduce((accumulator, block) => {
|
| 3626 |
+
if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) {
|
| 3627 |
+
accumulator.push(itemsByName[block.name]);
|
| 3628 |
+
}
|
| 3629 |
|
| 3630 |
+
return accumulator;
|
| 3631 |
+
}, []);
|
| 3632 |
+
const possibleBlockTransformations = Object(external_lodash_["orderBy"])(possibleTransforms, block => itemsByName[block.name].frecency, 'desc');
|
| 3633 |
+
return possibleBlockTransformations;
|
| 3634 |
+
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]);
|
| 3635 |
+
/**
|
| 3636 |
+
* Determines whether there are items to show in the inserter.
|
| 3637 |
+
*
|
| 3638 |
+
* @param {Object} state Editor state.
|
| 3639 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3640 |
+
*
|
| 3641 |
+
* @return {boolean} Items that appear in inserter.
|
| 3642 |
+
*/
|
| 3643 |
+
|
| 3644 |
+
const hasInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => {
|
| 3645 |
+
const hasBlockType = Object(external_lodash_["some"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
|
| 3646 |
+
|
| 3647 |
+
if (hasBlockType) {
|
| 3648 |
+
return true;
|
| 3649 |
}
|
|
|
|
| 3650 |
|
| 3651 |
+
const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0;
|
| 3652 |
+
return hasReusableBlock;
|
| 3653 |
+
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]);
|
| 3654 |
+
/**
|
| 3655 |
+
* Returns the list of allowed inserter blocks for inner blocks children
|
| 3656 |
+
*
|
| 3657 |
+
* @param {Object} state Editor state.
|
| 3658 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3659 |
+
*
|
| 3660 |
+
* @return {Array?} The list of allowed block types.
|
| 3661 |
+
*/
|
| 3662 |
|
| 3663 |
+
const __experimentalGetAllowedBlocks = Object(rememo["a" /* default */])((state, rootClientId = null) => {
|
| 3664 |
+
if (!rootClientId) {
|
| 3665 |
+
return;
|
| 3666 |
+
}
|
|
|
|
| 3667 |
|
| 3668 |
+
return Object(external_lodash_["filter"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
|
| 3669 |
+
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]);
|
|
|
|
|
|
|
| 3670 |
|
| 3671 |
+
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
| 3672 |
+
if (Object(external_lodash_["isBoolean"])(allowedBlockTypes)) {
|
| 3673 |
+
return allowedBlockTypes;
|
|
|
|
|
|
|
|
|
|
| 3674 |
}
|
| 3675 |
|
| 3676 |
+
const blocksQueue = [...blocks];
|
| 3677 |
|
| 3678 |
+
while (blocksQueue.length > 0) {
|
| 3679 |
+
var _block$innerBlocks;
|
| 3680 |
+
|
| 3681 |
+
const block = blocksQueue.shift();
|
| 3682 |
+
const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true);
|
| 3683 |
+
|
| 3684 |
+
if (!isAllowed) {
|
| 3685 |
+
return false;
|
| 3686 |
}
|
| 3687 |
+
|
| 3688 |
+
(_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.forEach(innerBlock => {
|
| 3689 |
+
blocksQueue.push(innerBlock);
|
| 3690 |
+
});
|
| 3691 |
}
|
|
|
|
| 3692 |
|
| 3693 |
+
return true;
|
| 3694 |
+
};
|
| 3695 |
+
|
| 3696 |
+
const __experimentalGetParsedPattern = Object(rememo["a" /* default */])((state, patternName) => {
|
| 3697 |
+
const patterns = state.settings.__experimentalBlockPatterns;
|
| 3698 |
+
const pattern = patterns.find(({
|
| 3699 |
+
name
|
| 3700 |
+
}) => name === patternName);
|
| 3701 |
+
|
| 3702 |
+
if (!pattern) {
|
| 3703 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3704 |
}
|
|
|
|
|
|
|
| 3705 |
|
| 3706 |
+
return { ...pattern,
|
| 3707 |
+
blocks: Object(external_wp_blocks_["parse"])(pattern.content)
|
| 3708 |
+
};
|
| 3709 |
+
}, state => [state.settings.__experimentalBlockPatterns]);
|
| 3710 |
+
const getAllAllowedPatterns = Object(rememo["a" /* default */])(state => {
|
| 3711 |
+
const patterns = state.settings.__experimentalBlockPatterns;
|
| 3712 |
+
const {
|
| 3713 |
+
allowedBlockTypes
|
| 3714 |
+
} = getSettings(state);
|
| 3715 |
+
const parsedPatterns = patterns.map(({
|
| 3716 |
+
name
|
| 3717 |
+
}) => __experimentalGetParsedPattern(state, name));
|
| 3718 |
+
const allowedPatterns = parsedPatterns.filter(({
|
| 3719 |
+
blocks
|
| 3720 |
+
}) => checkAllowListRecursive(blocks, allowedBlockTypes));
|
| 3721 |
+
return allowedPatterns;
|
| 3722 |
+
}, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]);
|
| 3723 |
/**
|
| 3724 |
+
* Returns the list of allowed patterns for inner blocks children.
|
| 3725 |
+
*
|
| 3726 |
+
* @param {Object} state Editor state.
|
| 3727 |
+
* @param {?string} rootClientId Optional target root client ID.
|
| 3728 |
+
*
|
| 3729 |
+
* @return {Array?} The list of allowed patterns.
|
| 3730 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3731 |
|
| 3732 |
+
const __experimentalGetAllowedPatterns = Object(rememo["a" /* default */])((state, rootClientId = null) => {
|
| 3733 |
+
const availableParsedPatterns = getAllAllowedPatterns(state);
|
| 3734 |
+
const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, ({
|
| 3735 |
+
blocks
|
| 3736 |
+
}) => blocks.every(({
|
| 3737 |
+
name
|
| 3738 |
+
}) => canInsertBlockType(state, name, rootClientId)));
|
| 3739 |
+
return patternsAllowed;
|
| 3740 |
+
}, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId]]);
|
| 3741 |
+
/**
|
| 3742 |
+
* Returns the list of patterns based on their declared `blockTypes`
|
| 3743 |
+
* and a block's name.
|
| 3744 |
+
* Patterns can use `blockTypes` to integrate in work flows like
|
| 3745 |
+
* suggesting appropriate patterns in a Placeholder state(during insertion)
|
| 3746 |
+
* or blocks transformations.
|
| 3747 |
+
*
|
| 3748 |
+
* @param {Object} state Editor state.
|
| 3749 |
+
* @param {string|string[]} blockNames Block's name or array of block names to find matching pattens.
|
| 3750 |
+
* @param {?string} rootClientId Optional target root client ID.
|
| 3751 |
+
*
|
| 3752 |
+
* @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
|
| 3753 |
+
*/
|
| 3754 |
|
| 3755 |
+
const __experimentalGetPatternsByBlockTypes = Object(rememo["a" /* default */])((state, blockNames, rootClientId = null) => {
|
| 3756 |
+
if (!blockNames) return EMPTY_ARRAY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3757 |
|
| 3758 |
+
const patterns = __experimentalGetAllowedPatterns(state, rootClientId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3759 |
|
| 3760 |
+
const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
|
| 3761 |
+
return patterns.filter(pattern => {
|
| 3762 |
+
var _pattern$blockTypes, _pattern$blockTypes$s;
|
| 3763 |
+
|
| 3764 |
+
return pattern === null || pattern === void 0 ? void 0 : (_pattern$blockTypes = pattern.blockTypes) === null || _pattern$blockTypes === void 0 ? void 0 : (_pattern$blockTypes$s = _pattern$blockTypes.some) === null || _pattern$blockTypes$s === void 0 ? void 0 : _pattern$blockTypes$s.call(_pattern$blockTypes, blockName => normalizedBlockNames.includes(blockName));
|
| 3765 |
+
});
|
| 3766 |
+
}, (state, rootClientId) => [...__experimentalGetAllowedPatterns.getDependants(state, rootClientId)]);
|
| 3767 |
+
/**
|
| 3768 |
+
* Determines the items that appear in the available pattern transforms list.
|
| 3769 |
+
*
|
| 3770 |
+
* For now we only handle blocks without InnerBlocks and take into account
|
| 3771 |
+
* the `__experimentalRole` property of blocks' attributes for the transformation.
|
| 3772 |
+
*
|
| 3773 |
+
* We return the first set of possible eligible block patterns,
|
| 3774 |
+
* by checking the `blockTypes` property. We still have to recurse through
|
| 3775 |
+
* block pattern's blocks and try to find matches from the selected blocks.
|
| 3776 |
+
* Now this happens in the consumer to avoid heavy operations in the selector.
|
| 3777 |
+
*
|
| 3778 |
+
* @param {Object} state Editor state.
|
| 3779 |
+
* @param {Object[]} blocks The selected blocks.
|
| 3780 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
| 3781 |
+
*
|
| 3782 |
+
* @return {WPBlockPattern[]} Items that are eligible for a pattern transformation.
|
| 3783 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3784 |
|
| 3785 |
+
const __experimentalGetPatternTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => {
|
| 3786 |
+
if (!blocks) return EMPTY_ARRAY;
|
| 3787 |
+
/**
|
| 3788 |
+
* For now we only handle blocks without InnerBlocks and take into account
|
| 3789 |
+
* the `__experimentalRole` property of blocks' attributes for the transformation.
|
| 3790 |
+
* Note that the blocks have been retrieved through `getBlock`, which doesn't
|
| 3791 |
+
* return the inner blocks of an inner block controller, so we still need
|
| 3792 |
+
* to check for this case too.
|
| 3793 |
+
*/
|
| 3794 |
|
| 3795 |
+
if (blocks.some(({
|
| 3796 |
+
clientId,
|
| 3797 |
+
innerBlocks
|
| 3798 |
+
}) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) {
|
| 3799 |
+
return EMPTY_ARRAY;
|
| 3800 |
+
} // Create a Set of the selected block names that is used in patterns filtering.
|
| 3801 |
+
|
| 3802 |
+
|
| 3803 |
+
const selectedBlockNames = Array.from(new Set(blocks.map(({
|
| 3804 |
+
name
|
| 3805 |
+
}) => name)));
|
| 3806 |
+
/**
|
| 3807 |
+
* Here we will return first set of possible eligible block patterns,
|
| 3808 |
+
* by checking the `blockTypes` property. We still have to recurse through
|
| 3809 |
+
* block pattern's blocks and try to find matches from the selected blocks.
|
| 3810 |
+
* Now this happens in the consumer to avoid heavy operations in the selector.
|
| 3811 |
+
*/
|
| 3812 |
+
|
| 3813 |
+
return __experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId);
|
| 3814 |
+
}, (state, rootClientId) => [...__experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]);
|
| 3815 |
+
/**
|
| 3816 |
+
* Returns the Block List settings of a block, if any exist.
|
| 3817 |
+
*
|
| 3818 |
+
* @param {Object} state Editor state.
|
| 3819 |
+
* @param {?string} clientId Block client ID.
|
| 3820 |
+
*
|
| 3821 |
+
* @return {?Object} Block settings of the block if set.
|
| 3822 |
+
*/
|
| 3823 |
+
|
| 3824 |
+
function getBlockListSettings(state, clientId) {
|
| 3825 |
+
return state.blockListSettings[clientId];
|
| 3826 |
}
|
| 3827 |
+
/**
|
| 3828 |
+
* Returns the editor settings.
|
| 3829 |
+
*
|
| 3830 |
+
* @param {Object} state Editor state.
|
| 3831 |
+
*
|
| 3832 |
+
* @return {Object} The editor settings object.
|
| 3833 |
+
*/
|
| 3834 |
|
| 3835 |
+
function getSettings(state) {
|
| 3836 |
+
return state.settings;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3837 |
}
|
| 3838 |
+
/**
|
| 3839 |
+
* Returns true if the most recent block change is be considered persistent, or
|
| 3840 |
+
* false otherwise. A persistent change is one committed by BlockEditorProvider
|
| 3841 |
+
* via its `onChange` callback, in addition to `onInput`.
|
| 3842 |
+
*
|
| 3843 |
+
* @param {Object} state Block editor state.
|
| 3844 |
+
*
|
| 3845 |
+
* @return {boolean} Whether the most recent block change was persistent.
|
| 3846 |
+
*/
|
| 3847 |
|
| 3848 |
+
function isLastBlockChangePersistent(state) {
|
| 3849 |
+
return state.blocks.isPersistentChange;
|
| 3850 |
+
}
|
| 3851 |
+
/**
|
| 3852 |
+
* Returns the block list settings for an array of blocks, if any exist.
|
| 3853 |
+
*
|
| 3854 |
+
* @param {Object} state Editor state.
|
| 3855 |
+
* @param {Array} clientIds Block client IDs.
|
| 3856 |
+
*
|
| 3857 |
+
* @return {Object} An object where the keys are client ids and the values are
|
| 3858 |
+
* a block list setting object.
|
| 3859 |
+
*/
|
| 3860 |
|
| 3861 |
+
const __experimentalGetBlockListSettingsForBlocks = Object(rememo["a" /* default */])((state, clientIds = []) => {
|
| 3862 |
+
return clientIds.reduce((blockListSettingsForBlocks, clientId) => {
|
| 3863 |
+
if (!state.blockListSettings[clientId]) {
|
| 3864 |
+
return blockListSettingsForBlocks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3865 |
}
|
|
|
|
|
|
|
|
|
|
| 3866 |
|
| 3867 |
+
return { ...blockListSettingsForBlocks,
|
| 3868 |
+
[clientId]: state.blockListSettings[clientId]
|
| 3869 |
+
};
|
| 3870 |
+
}, {});
|
| 3871 |
+
}, state => [state.blockListSettings]);
|
| 3872 |
+
/**
|
| 3873 |
+
* Returns the parsed block saved as shared block with the given ID.
|
| 3874 |
+
*
|
| 3875 |
+
* @param {Object} state Global application state.
|
| 3876 |
+
* @param {number|string} ref The shared block's ID.
|
| 3877 |
+
*
|
| 3878 |
+
* @return {Object} The parsed block.
|
| 3879 |
+
*/
|
| 3880 |
|
| 3881 |
+
const __experimentalGetParsedReusableBlock = Object(rememo["a" /* default */])((state, ref) => {
|
| 3882 |
+
const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref);
|
|
|
|
|
|
|
| 3883 |
|
| 3884 |
+
if (!reusableBlock) {
|
| 3885 |
+
return null;
|
| 3886 |
+
} // Only reusableBlock.content.raw should be used here, `reusableBlock.content` is a
|
| 3887 |
+
// workaround until #22127 is fixed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3888 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3889 |
|
| 3890 |
+
return Object(external_wp_blocks_["parse"])(typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content);
|
| 3891 |
+
}, state => [getReusableBlocks(state)]);
|
| 3892 |
+
/**
|
| 3893 |
+
* Returns the title of a given reusable block
|
| 3894 |
+
*
|
| 3895 |
+
* @param {Object} state Global application state.
|
| 3896 |
+
* @param {number|string} ref The shared block's ID.
|
| 3897 |
+
*
|
| 3898 |
+
* @return {string} The reusable block saved title.
|
| 3899 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3900 |
|
| 3901 |
+
const __experimentalGetReusableBlockTitle = Object(rememo["a" /* default */])((state, ref) => {
|
| 3902 |
+
var _reusableBlock$title;
|
|
|
|
| 3903 |
|
| 3904 |
+
const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref);
|
| 3905 |
|
| 3906 |
+
if (!reusableBlock) {
|
| 3907 |
+
return null;
|
| 3908 |
+
}
|
| 3909 |
|
| 3910 |
+
return (_reusableBlock$title = reusableBlock.title) === null || _reusableBlock$title === void 0 ? void 0 : _reusableBlock$title.raw;
|
| 3911 |
+
}, state => [getReusableBlocks(state)]);
|
| 3912 |
+
/**
|
| 3913 |
+
* Returns true if the most recent block change is be considered ignored, or
|
| 3914 |
+
* false otherwise. An ignored change is one not to be committed by
|
| 3915 |
+
* BlockEditorProvider, neither via `onChange` nor `onInput`.
|
| 3916 |
+
*
|
| 3917 |
+
* @param {Object} state Block editor state.
|
| 3918 |
+
*
|
| 3919 |
+
* @return {boolean} Whether the most recent block change was ignored.
|
| 3920 |
+
*/
|
| 3921 |
|
| 3922 |
+
function __unstableIsLastBlockChangeIgnored(state) {
|
| 3923 |
+
// TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be
|
| 3924 |
+
// ignored if in-fact they result in a change in blocks state. The current
|
| 3925 |
+
// need to ignore changes not a result of user interaction should be
|
| 3926 |
+
// accounted for in the refactoring of reusable blocks as occurring within
|
| 3927 |
+
// their own separate block editor / state (#7119).
|
| 3928 |
+
return state.blocks.isIgnoredChange;
|
| 3929 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3930 |
/**
|
| 3931 |
+
* Returns the block attributes changed as a result of the last dispatched
|
| 3932 |
+
* action.
|
| 3933 |
+
*
|
| 3934 |
+
* @param {Object} state Block editor state.
|
| 3935 |
+
*
|
| 3936 |
+
* @return {Object<string,Object>} Subsets of block attributes changed, keyed
|
| 3937 |
+
* by block client ID.
|
| 3938 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3939 |
|
| 3940 |
+
function __experimentalGetLastBlockAttributeChanges(state) {
|
| 3941 |
+
return state.lastBlockAttributesChange;
|
| 3942 |
+
}
|
| 3943 |
+
/**
|
| 3944 |
+
* Returns the available reusable blocks
|
| 3945 |
+
*
|
| 3946 |
+
* @param {Object} state Global application state.
|
| 3947 |
+
*
|
| 3948 |
+
* @return {Array} Reusable blocks
|
| 3949 |
+
*/
|
| 3950 |
|
| 3951 |
+
function getReusableBlocks(state) {
|
| 3952 |
+
var _state$settings$__exp, _state$settings;
|
| 3953 |
|
| 3954 |
+
return (_state$settings$__exp = state === null || state === void 0 ? void 0 : (_state$settings = state.settings) === null || _state$settings === void 0 ? void 0 : _state$settings.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY;
|
| 3955 |
+
}
|
| 3956 |
+
/**
|
| 3957 |
+
* Returns whether the navigation mode is enabled.
|
| 3958 |
+
*
|
| 3959 |
+
* @param {Object} state Editor state.
|
| 3960 |
+
*
|
| 3961 |
+
* @return {boolean} Is navigation mode enabled.
|
| 3962 |
+
*/
|
| 3963 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3964 |
|
| 3965 |
+
function selectors_isNavigationMode(state) {
|
| 3966 |
+
return state.isNavigationMode;
|
| 3967 |
+
}
|
| 3968 |
+
/**
|
| 3969 |
+
* Returns whether block moving mode is enabled.
|
| 3970 |
+
*
|
| 3971 |
+
* @param {Object} state Editor state.
|
| 3972 |
+
*
|
| 3973 |
+
* @return {string} Client Id of moving block.
|
| 3974 |
+
*/
|
| 3975 |
|
| 3976 |
+
function selectors_hasBlockMovingClientId(state) {
|
| 3977 |
+
return state.hasBlockMovingClientId;
|
| 3978 |
+
}
|
| 3979 |
+
/**
|
| 3980 |
+
* Returns true if the last change was an automatic change, false otherwise.
|
| 3981 |
+
*
|
| 3982 |
+
* @param {Object} state Global application state.
|
| 3983 |
+
*
|
| 3984 |
+
* @return {boolean} Whether the last change was automatic.
|
| 3985 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3986 |
|
| 3987 |
+
function didAutomaticChange(state) {
|
| 3988 |
+
return !!state.automaticChangeStatus;
|
| 3989 |
+
}
|
| 3990 |
+
/**
|
| 3991 |
+
* Returns true if the current highlighted block matches the block clientId.
|
| 3992 |
+
*
|
| 3993 |
+
* @param {Object} state Global application state.
|
| 3994 |
+
* @param {string} clientId The block to check.
|
| 3995 |
+
*
|
| 3996 |
+
* @return {boolean} Whether the block is currently highlighted.
|
| 3997 |
+
*/
|
|
|
|
|
|
|
| 3998 |
|
| 3999 |
+
function isBlockHighlighted(state, clientId) {
|
| 4000 |
+
return state.highlightedBlock === clientId;
|
| 4001 |
+
}
|
| 4002 |
+
/**
|
| 4003 |
+
* Checks if a given block has controlled inner blocks.
|
| 4004 |
+
*
|
| 4005 |
+
* @param {Object} state Global application state.
|
| 4006 |
+
* @param {string} clientId The block to check.
|
| 4007 |
+
*
|
| 4008 |
+
* @return {boolean} True if the block has controlled inner blocks.
|
| 4009 |
+
*/
|
| 4010 |
|
| 4011 |
+
function areInnerBlocksControlled(state, clientId) {
|
| 4012 |
+
return !!state.blocks.controlledInnerBlocks[clientId];
|
| 4013 |
+
}
|
| 4014 |
+
/**
|
| 4015 |
+
* Returns the clientId for the first 'active' block of a given array of block names.
|
| 4016 |
+
* A block is 'active' if it (or a child) is the selected block.
|
| 4017 |
+
* Returns the first match moving up the DOM from the selected block.
|
| 4018 |
+
*
|
| 4019 |
+
* @param {Object} state Global application state.
|
| 4020 |
+
* @param {string[]} validBlocksNames The names of block types to check for.
|
| 4021 |
+
*
|
| 4022 |
+
* @return {string} The matching block's clientId.
|
| 4023 |
+
*/
|
| 4024 |
|
| 4025 |
+
const __experimentalGetActiveBlockIdByBlockNames = Object(rememo["a" /* default */])((state, validBlockNames) => {
|
| 4026 |
+
if (!validBlockNames.length) {
|
| 4027 |
+
return null;
|
| 4028 |
+
} // Check if selected block is a valid entity area.
|
| 4029 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4030 |
|
| 4031 |
+
const selectedBlockClientId = getSelectedBlockClientId(state);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4032 |
|
| 4033 |
+
if (validBlockNames.includes(getBlockName(state, selectedBlockClientId))) {
|
| 4034 |
+
return selectedBlockClientId;
|
| 4035 |
+
} // Check if first selected block is a child of a valid entity area.
|
| 4036 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4037 |
|
| 4038 |
+
const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
|
| 4039 |
+
const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames);
|
| 4040 |
|
| 4041 |
+
if (entityAreaParents) {
|
| 4042 |
+
// Last parent closest/most interior.
|
| 4043 |
+
return Object(external_lodash_["last"])(entityAreaParents);
|
| 4044 |
+
}
|
| 4045 |
|
| 4046 |
+
return null;
|
| 4047 |
+
}, (state, validBlockNames) => [state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames]);
|
| 4048 |
+
/**
|
| 4049 |
+
* Tells if the block with the passed clientId was just inserted.
|
| 4050 |
+
*
|
| 4051 |
+
* @param {Object} state Global application state.
|
| 4052 |
+
* @param {Object} clientId Client Id of the block.
|
| 4053 |
+
* @param {?string} source Optional insertion source of the block.
|
| 4054 |
+
* @return {boolean} True if the block matches the last block inserted from the specified source.
|
| 4055 |
+
*/
|
| 4056 |
|
| 4057 |
+
function wasBlockJustInserted(state, clientId, source) {
|
| 4058 |
+
const {
|
| 4059 |
+
lastBlockInserted
|
| 4060 |
+
} = state;
|
| 4061 |
+
return lastBlockInserted.clientId === clientId && lastBlockInserted.source === source;
|
| 4062 |
+
}
|
| 4063 |
+
//# sourceMappingURL=selectors.js.map
|
| 4064 |
+
// EXTERNAL MODULE: external ["wp","a11y"]
|
| 4065 |
+
var external_wp_a11y_ = __webpack_require__(31);
|
| 4066 |
|
| 4067 |
+
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 4068 |
+
var external_wp_i18n_ = __webpack_require__(1);
|
|
|
|
|
|
|
|
|
|
| 4069 |
|
| 4070 |
+
// EXTERNAL MODULE: external ["wp","richText"]
|
| 4071 |
+
var external_wp_richText_ = __webpack_require__(17);
|
| 4072 |
|
| 4073 |
+
// EXTERNAL MODULE: external ["wp","deprecated"]
|
| 4074 |
+
var external_wp_deprecated_ = __webpack_require__(26);
|
| 4075 |
+
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
|
| 4076 |
|
| 4077 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/controls.js
|
| 4078 |
+
/**
|
| 4079 |
+
* WordPress dependencies
|
| 4080 |
+
*/
|
| 4081 |
|
| 4082 |
+
/**
|
| 4083 |
+
* Internal dependencies
|
| 4084 |
+
*/
|
|
|
|
| 4085 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4086 |
|
| 4087 |
+
const __unstableMarkAutomaticChangeFinalControl = function () {
|
| 4088 |
+
return {
|
| 4089 |
+
type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL'
|
| 4090 |
+
};
|
| 4091 |
+
};
|
| 4092 |
+
const controls = {
|
| 4093 |
+
SLEEP({
|
| 4094 |
+
duration
|
| 4095 |
+
}) {
|
| 4096 |
+
return new Promise(resolve => {
|
| 4097 |
+
setTimeout(resolve, duration);
|
| 4098 |
+
});
|
| 4099 |
+
},
|
| 4100 |
|
| 4101 |
+
MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: Object(external_wp_data_["createRegistryControl"])(registry => () => {
|
| 4102 |
+
const {
|
| 4103 |
+
requestIdleCallback = callback => setTimeout(callback, 100)
|
| 4104 |
+
} = window;
|
| 4105 |
+
requestIdleCallback(() => registry.dispatch(store).__unstableMarkAutomaticChangeFinal());
|
| 4106 |
+
})
|
| 4107 |
+
};
|
| 4108 |
+
/* harmony default export */ var store_controls = (controls);
|
| 4109 |
+
//# sourceMappingURL=controls.js.map
|
| 4110 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/constants.js
|
| 4111 |
+
var constants = __webpack_require__(40);
|
| 4112 |
|
| 4113 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/actions.js
|
| 4114 |
+
/**
|
| 4115 |
+
* External dependencies
|
| 4116 |
+
*/
|
| 4117 |
|
| 4118 |
+
/**
|
| 4119 |
+
* WordPress dependencies
|
| 4120 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4124 |
|
|
|
|
| 4125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4126 |
|
|
|
|
|
|
|
|
|
|
| 4127 |
|
| 4128 |
+
/**
|
| 4129 |
+
* Internal dependencies
|
| 4130 |
+
*/
|
| 4131 |
|
|
|
|
|
|
|
| 4132 |
|
|
|
|
|
|
|
| 4133 |
|
| 4134 |
/**
|
| 4135 |
+
* Generator which will yield a default block insert action if there
|
| 4136 |
+
* are no other blocks at the root of the editor. This generator should be used
|
| 4137 |
+
* in actions which may result in no blocks remaining in the editor (removal,
|
| 4138 |
+
* replacement, etc).
|
| 4139 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4140 |
|
| 4141 |
+
function* ensureDefaultBlock() {
|
| 4142 |
+
const count = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockCount'); // To avoid a focus loss when removing the last block, assure there is
|
| 4143 |
+
// always a default block if the last of the blocks have been removed.
|
|
|
|
|
|
|
| 4144 |
|
| 4145 |
+
if (count === 0) {
|
| 4146 |
+
const {
|
| 4147 |
+
__unstableHasCustomAppender
|
| 4148 |
+
} = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getSettings'); // If there's an custom appender, don't insert default block.
|
| 4149 |
+
// We have to remember to manually move the focus elsewhere to
|
| 4150 |
+
// prevent it from being lost though.
|
| 4151 |
|
| 4152 |
+
if (__unstableHasCustomAppender) {
|
| 4153 |
+
return;
|
|
|
|
|
|
|
|
|
|
| 4154 |
}
|
|
|
|
| 4155 |
|
| 4156 |
+
return yield insertDefaultBlock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4157 |
}
|
| 4158 |
+
}
|
| 4159 |
+
/**
|
| 4160 |
+
* Returns an action object used in signalling that blocks state should be
|
| 4161 |
+
* reset to the specified array of blocks, taking precedence over any other
|
| 4162 |
+
* content reflected as an edit in state.
|
| 4163 |
+
*
|
| 4164 |
+
* @param {Array} blocks Array of blocks.
|
| 4165 |
+
*/
|
| 4166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4167 |
|
| 4168 |
+
function* resetBlocks(blocks) {
|
| 4169 |
+
yield {
|
| 4170 |
+
type: 'RESET_BLOCKS',
|
| 4171 |
+
blocks
|
| 4172 |
+
};
|
| 4173 |
+
return yield* validateBlocksToTemplate(blocks);
|
| 4174 |
+
}
|
| 4175 |
+
/**
|
| 4176 |
+
* Block validity is a function of blocks state (at the point of a
|
| 4177 |
+
* reset) and the template setting. As a compromise to its placement
|
| 4178 |
+
* across distinct parts of state, it is implemented here as a side-
|
| 4179 |
+
* effect of the block reset action.
|
| 4180 |
+
*
|
| 4181 |
+
* @param {Array} blocks Array of blocks.
|
| 4182 |
+
*/
|
| 4183 |
|
| 4184 |
+
function* validateBlocksToTemplate(blocks) {
|
| 4185 |
+
const template = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplate');
|
| 4186 |
+
const templateLock = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplateLock'); // Unlocked templates are considered always valid because they act
|
| 4187 |
+
// as default values only.
|
|
|
|
| 4188 |
|
| 4189 |
+
const isBlocksValidToTemplate = !template || templateLock !== 'all' || Object(external_wp_blocks_["doBlocksMatchTemplate"])(blocks, template); // Update if validity has changed.
|
|
|
|
|
|
|
| 4190 |
|
| 4191 |
+
const isValidTemplate = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'isValidTemplate');
|
|
|
|
|
|
|
| 4192 |
|
| 4193 |
+
if (isBlocksValidToTemplate !== isValidTemplate) {
|
| 4194 |
+
yield setTemplateValidity(isBlocksValidToTemplate);
|
| 4195 |
+
return isBlocksValidToTemplate;
|
| 4196 |
}
|
|
|
|
|
|
|
|
|
|
| 4197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4198 |
/**
|
| 4199 |
+
* A block selection object.
|
| 4200 |
+
*
|
| 4201 |
+
* @typedef {Object} WPBlockSelection
|
| 4202 |
+
*
|
| 4203 |
+
* @property {string} clientId A block client ID.
|
| 4204 |
+
* @property {string} attributeKey A block attribute key.
|
| 4205 |
+
* @property {number} offset An attribute value offset, based on the rich
|
| 4206 |
+
* text value. See `wp.richText.create`.
|
| 4207 |
*/
|
| 4208 |
|
| 4209 |
+
/**
|
| 4210 |
+
* Returns an action object used in signalling that selection state should be
|
| 4211 |
+
* reset to the specified selection.
|
| 4212 |
+
*
|
| 4213 |
+
* @param {WPBlockSelection} selectionStart The selection start.
|
| 4214 |
+
* @param {WPBlockSelection} selectionEnd The selection end.
|
| 4215 |
+
* @param {0|-1|null} initialPosition Initial block position.
|
| 4216 |
+
*
|
| 4217 |
+
* @return {Object} Action object.
|
| 4218 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4219 |
|
| 4220 |
+
function resetSelection(selectionStart, selectionEnd, initialPosition) {
|
| 4221 |
+
return {
|
| 4222 |
+
type: 'RESET_SELECTION',
|
| 4223 |
+
selectionStart,
|
| 4224 |
+
selectionEnd,
|
| 4225 |
+
initialPosition
|
| 4226 |
+
};
|
| 4227 |
+
}
|
| 4228 |
+
/**
|
| 4229 |
+
* Returns an action object used in signalling that blocks have been received.
|
| 4230 |
+
* Unlike resetBlocks, these should be appended to the existing known set, not
|
| 4231 |
+
* replacing.
|
| 4232 |
+
*
|
| 4233 |
+
* @param {Object[]} blocks Array of block objects.
|
| 4234 |
+
*
|
| 4235 |
+
* @return {Object} Action object.
|
| 4236 |
+
*/
|
| 4237 |
|
| 4238 |
+
function receiveBlocks(blocks) {
|
| 4239 |
+
return {
|
| 4240 |
+
type: 'RECEIVE_BLOCKS',
|
| 4241 |
+
blocks
|
| 4242 |
+
};
|
| 4243 |
+
}
|
| 4244 |
/**
|
| 4245 |
+
* Returns an action object used in signalling that the multiple blocks'
|
| 4246 |
+
* attributes with the specified client IDs have been updated.
|
| 4247 |
+
*
|
| 4248 |
+
* @param {string|string[]} clientIds Block client IDs.
|
| 4249 |
+
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
| 4250 |
+
* uniqueByBlock is true.
|
| 4251 |
+
* @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes
|
| 4252 |
+
* @return {Object} Action object.
|
| 4253 |
*/
|
| 4254 |
|
| 4255 |
+
function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
|
| 4256 |
+
return {
|
| 4257 |
+
type: 'UPDATE_BLOCK_ATTRIBUTES',
|
| 4258 |
+
clientIds: Object(external_lodash_["castArray"])(clientIds),
|
| 4259 |
+
attributes,
|
| 4260 |
+
uniqueByBlock
|
| 4261 |
+
};
|
| 4262 |
+
}
|
| 4263 |
+
/**
|
| 4264 |
+
* Returns an action object used in signalling that the block with the
|
| 4265 |
+
* specified client ID has been updated.
|
| 4266 |
+
*
|
| 4267 |
+
* @param {string} clientId Block client ID.
|
| 4268 |
+
* @param {Object} updates Block attributes to be merged.
|
| 4269 |
+
*
|
| 4270 |
+
* @return {Object} Action object.
|
| 4271 |
+
*/
|
| 4272 |
|
| 4273 |
+
function updateBlock(clientId, updates) {
|
| 4274 |
+
return {
|
| 4275 |
+
type: 'UPDATE_BLOCK',
|
| 4276 |
+
clientId,
|
| 4277 |
+
updates
|
| 4278 |
+
};
|
| 4279 |
+
}
|
| 4280 |
+
/**
|
| 4281 |
+
* Returns an action object used in signalling that the block with the
|
| 4282 |
+
* specified client ID has been selected, optionally accepting a position
|
| 4283 |
+
* value reflecting its selection directionality. An initialPosition of -1
|
| 4284 |
+
* reflects a reverse selection.
|
| 4285 |
+
*
|
| 4286 |
+
* @param {string} clientId Block client ID.
|
| 4287 |
+
* @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to
|
| 4288 |
+
* reflect reverse selection.
|
| 4289 |
+
*
|
| 4290 |
+
* @return {Object} Action object.
|
| 4291 |
+
*/
|
| 4292 |
|
| 4293 |
+
function selectBlock(clientId, initialPosition = 0) {
|
| 4294 |
+
return {
|
| 4295 |
+
type: 'SELECT_BLOCK',
|
| 4296 |
+
initialPosition,
|
| 4297 |
+
clientId
|
| 4298 |
+
};
|
| 4299 |
+
}
|
| 4300 |
+
/**
|
| 4301 |
+
* Yields action objects used in signalling that the block preceding the given
|
| 4302 |
+
* clientId should be selected.
|
| 4303 |
+
*
|
| 4304 |
+
* @param {string} clientId Block client ID.
|
| 4305 |
+
*/
|
| 4306 |
|
| 4307 |
+
function* selectPreviousBlock(clientId) {
|
| 4308 |
+
const previousBlockClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getPreviousBlockClientId', clientId);
|
| 4309 |
|
| 4310 |
+
if (previousBlockClientId) {
|
| 4311 |
+
yield selectBlock(previousBlockClientId, -1);
|
| 4312 |
+
return [previousBlockClientId];
|
| 4313 |
+
}
|
| 4314 |
+
}
|
| 4315 |
+
/**
|
| 4316 |
+
* Yields action objects used in signalling that the block following the given
|
| 4317 |
+
* clientId should be selected.
|
| 4318 |
+
*
|
| 4319 |
+
* @param {string} clientId Block client ID.
|
| 4320 |
+
*/
|
| 4321 |
|
| 4322 |
+
function* selectNextBlock(clientId) {
|
| 4323 |
+
const nextBlockClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getNextBlockClientId', clientId);
|
| 4324 |
|
| 4325 |
+
if (nextBlockClientId) {
|
| 4326 |
+
yield selectBlock(nextBlockClientId);
|
| 4327 |
+
return [nextBlockClientId];
|
| 4328 |
+
}
|
| 4329 |
+
}
|
| 4330 |
+
/**
|
| 4331 |
+
* Returns an action object used in signalling that a block multi-selection has started.
|
| 4332 |
+
*
|
| 4333 |
+
* @return {Object} Action object.
|
| 4334 |
+
*/
|
| 4335 |
|
| 4336 |
+
function startMultiSelect() {
|
| 4337 |
+
return {
|
| 4338 |
+
type: 'START_MULTI_SELECT'
|
| 4339 |
+
};
|
| 4340 |
+
}
|
| 4341 |
+
/**
|
| 4342 |
+
* Returns an action object used in signalling that block multi-selection stopped.
|
| 4343 |
+
*
|
| 4344 |
+
* @return {Object} Action object.
|
| 4345 |
+
*/
|
| 4346 |
|
| 4347 |
+
function stopMultiSelect() {
|
| 4348 |
+
return {
|
| 4349 |
+
type: 'STOP_MULTI_SELECT'
|
| 4350 |
+
};
|
| 4351 |
+
}
|
| 4352 |
+
/**
|
| 4353 |
+
* Returns an action object used in signalling that block multi-selection changed.
|
| 4354 |
+
*
|
| 4355 |
+
* @param {string} start First block of the multi selection.
|
| 4356 |
+
* @param {string} end Last block of the multiselection.
|
| 4357 |
+
*/
|
| 4358 |
|
| 4359 |
+
function* multiSelect(start, end) {
|
| 4360 |
+
const startBlockRootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', start);
|
| 4361 |
+
const endBlockRootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', end); // Only allow block multi-selections at the same level.
|
| 4362 |
|
| 4363 |
+
if (startBlockRootClientId !== endBlockRootClientId) {
|
| 4364 |
+
return;
|
| 4365 |
+
}
|
| 4366 |
|
| 4367 |
+
yield {
|
| 4368 |
+
type: 'MULTI_SELECT',
|
| 4369 |
+
start,
|
| 4370 |
+
end
|
| 4371 |
+
};
|
| 4372 |
+
const blockCount = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getSelectedBlockCount');
|
| 4373 |
+
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["sprintf"])(
|
| 4374 |
+
/* translators: %s: number of selected blocks */
|
| 4375 |
+
Object(external_wp_i18n_["_n"])('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
| 4376 |
+
}
|
| 4377 |
/**
|
| 4378 |
+
* Returns an action object used in signalling that the block selection is cleared.
|
| 4379 |
+
*
|
| 4380 |
+
* @return {Object} Action object.
|
| 4381 |
*/
|
| 4382 |
|
| 4383 |
+
function clearSelectedBlock() {
|
| 4384 |
+
return {
|
| 4385 |
+
type: 'CLEAR_SELECTED_BLOCK'
|
| 4386 |
+
};
|
| 4387 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4388 |
/**
|
| 4389 |
+
* Returns an action object that enables or disables block selection.
|
| 4390 |
+
*
|
| 4391 |
+
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
| 4392 |
+
* be enabled.
|
| 4393 |
+
*
|
| 4394 |
+
* @return {Object} Action object.
|
| 4395 |
*/
|
| 4396 |
|
| 4397 |
+
function toggleSelection(isSelectionEnabled = true) {
|
| 4398 |
+
return {
|
| 4399 |
+
type: 'TOGGLE_SELECTION',
|
| 4400 |
+
isSelectionEnabled
|
| 4401 |
+
};
|
| 4402 |
+
}
|
|
|
|
| 4403 |
|
| 4404 |
+
function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
| 4405 |
+
var _blockEditorSettings$, _blockEditorSettings$2;
|
| 4406 |
|
| 4407 |
+
const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings === null || blockEditorSettings === void 0 ? void 0 : (_blockEditorSettings$2 = blockEditorSettings.__experimentalPreferredStyleVariations) === null || _blockEditorSettings$2 === void 0 ? void 0 : _blockEditorSettings$2.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {};
|
| 4408 |
+
return blocks.map(block => {
|
| 4409 |
+
var _block$attributes;
|
| 4410 |
|
| 4411 |
+
const blockName = block.name;
|
|
|
|
| 4412 |
|
| 4413 |
+
if (!Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'defaultStylePicker', true)) {
|
| 4414 |
+
return block;
|
| 4415 |
+
}
|
| 4416 |
|
| 4417 |
+
if (!preferredStyleVariations[blockName]) {
|
| 4418 |
+
return block;
|
| 4419 |
+
}
|
| 4420 |
|
| 4421 |
+
const className = (_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.className;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4422 |
|
| 4423 |
+
if (className !== null && className !== void 0 && className.includes('is-style-')) {
|
| 4424 |
+
return block;
|
| 4425 |
+
}
|
| 4426 |
|
| 4427 |
+
const {
|
| 4428 |
+
attributes = {}
|
| 4429 |
+
} = block;
|
| 4430 |
+
const blockStyle = preferredStyleVariations[blockName];
|
| 4431 |
+
return { ...block,
|
| 4432 |
+
attributes: { ...attributes,
|
| 4433 |
+
className: `${className || ''} is-style-${blockStyle}`.trim()
|
| 4434 |
+
}
|
| 4435 |
+
};
|
| 4436 |
+
});
|
| 4437 |
+
}
|
| 4438 |
/**
|
| 4439 |
+
* Returns an action object signalling that a blocks should be replaced with
|
| 4440 |
+
* one or more replacement blocks.
|
| 4441 |
+
*
|
| 4442 |
+
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
| 4443 |
+
* @param {(Object|Object[])} blocks Replacement block(s).
|
| 4444 |
+
* @param {number} indexToSelect Index of replacement block to select.
|
| 4445 |
+
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
| 4446 |
+
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 4447 |
+
*
|
| 4448 |
+
* @yield {Object} Action object.
|
| 4449 |
*/
|
| 4450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4451 |
|
| 4452 |
+
function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, meta) {
|
| 4453 |
+
clientIds = Object(external_lodash_["castArray"])(clientIds);
|
| 4454 |
+
blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getSettings'));
|
| 4455 |
+
const rootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', Object(external_lodash_["first"])(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
|
| 4456 |
|
| 4457 |
+
for (let index = 0; index < blocks.length; index++) {
|
| 4458 |
+
const block = blocks[index];
|
| 4459 |
+
const canInsertBlock = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'canInsertBlockType', block.name, rootClientId);
|
|
|
|
|
|
|
| 4460 |
|
| 4461 |
+
if (!canInsertBlock) {
|
| 4462 |
+
return;
|
| 4463 |
+
}
|
| 4464 |
+
}
|
| 4465 |
|
| 4466 |
+
yield {
|
| 4467 |
+
type: 'REPLACE_BLOCKS',
|
| 4468 |
+
clientIds,
|
| 4469 |
+
blocks,
|
| 4470 |
+
time: Date.now(),
|
| 4471 |
+
indexToSelect,
|
| 4472 |
+
initialPosition,
|
| 4473 |
+
meta
|
| 4474 |
+
};
|
| 4475 |
+
yield* ensureDefaultBlock();
|
| 4476 |
+
}
|
| 4477 |
/**
|
| 4478 |
+
* Returns an action object signalling that a single block should be replaced
|
| 4479 |
+
* with one or more replacement blocks.
|
| 4480 |
+
*
|
| 4481 |
+
* @param {(string|string[])} clientId Block client ID to replace.
|
| 4482 |
+
* @param {(Object|Object[])} block Replacement block(s).
|
| 4483 |
+
*
|
| 4484 |
+
* @return {Object} Action object.
|
| 4485 |
*/
|
| 4486 |
|
| 4487 |
+
function replaceBlock(clientId, block) {
|
| 4488 |
+
return replaceBlocks(clientId, block);
|
| 4489 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4490 |
/**
|
| 4491 |
+
* Higher-order action creator which, given the action type to dispatch creates
|
| 4492 |
+
* an action creator for managing block movement.
|
| 4493 |
+
*
|
| 4494 |
+
* @param {string} type Action type to dispatch.
|
| 4495 |
+
*
|
| 4496 |
+
* @return {Function} Action creator.
|
| 4497 |
*/
|
| 4498 |
|
| 4499 |
+
function createOnMove(type) {
|
| 4500 |
+
return (clientIds, rootClientId) => {
|
| 4501 |
+
return {
|
| 4502 |
+
clientIds: Object(external_lodash_["castArray"])(clientIds),
|
| 4503 |
+
type,
|
| 4504 |
+
rootClientId
|
| 4505 |
+
};
|
| 4506 |
+
};
|
| 4507 |
+
}
|
|
|
|
| 4508 |
|
| 4509 |
+
const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
|
| 4510 |
+
const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
|
| 4511 |
+
/**
|
| 4512 |
+
* Returns an action object signalling that the given blocks should be moved to
|
| 4513 |
+
* a new position.
|
| 4514 |
+
*
|
| 4515 |
+
* @param {?string} clientIds The client IDs of the blocks.
|
| 4516 |
+
* @param {?string} fromRootClientId Root client ID source.
|
| 4517 |
+
* @param {?string} toRootClientId Root client ID destination.
|
| 4518 |
+
* @param {number} index The index to move the blocks to.
|
| 4519 |
+
*
|
| 4520 |
+
* @yield {Object} Action object.
|
| 4521 |
+
*/
|
| 4522 |
|
| 4523 |
+
function* moveBlocksToPosition(clientIds, fromRootClientId = '', toRootClientId = '', index) {
|
| 4524 |
+
const templateLock = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplateLock', fromRootClientId); // If locking is equal to all on the original clientId (fromRootClientId),
|
| 4525 |
+
// it is not possible to move the block to any other position.
|
|
|
|
|
|
|
| 4526 |
|
| 4527 |
+
if (templateLock === 'all') {
|
| 4528 |
+
return;
|
| 4529 |
+
}
|
| 4530 |
|
| 4531 |
+
const action = {
|
| 4532 |
+
type: 'MOVE_BLOCKS_TO_POSITION',
|
| 4533 |
+
fromRootClientId,
|
| 4534 |
+
toRootClientId,
|
| 4535 |
+
clientIds,
|
| 4536 |
+
index
|
| 4537 |
+
}; // If moving inside the same root block the move is always possible.
|
| 4538 |
|
| 4539 |
+
if (fromRootClientId === toRootClientId) {
|
| 4540 |
+
yield action;
|
| 4541 |
+
return;
|
| 4542 |
+
} // If templateLock is insert we can not remove the block from the parent.
|
| 4543 |
+
// Given that here we know that we are moving the block to a different
|
| 4544 |
+
// parent, the move should not be possible if the condition is true.
|
|
|
|
|
|
|
| 4545 |
|
|
|
|
| 4546 |
|
| 4547 |
+
if (templateLock === 'insert') {
|
| 4548 |
+
return;
|
| 4549 |
+
}
|
| 4550 |
|
| 4551 |
+
const canInsertBlocks = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'canInsertBlocks', clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4552 |
|
| 4553 |
+
if (canInsertBlocks) {
|
| 4554 |
+
yield action;
|
| 4555 |
+
}
|
| 4556 |
+
}
|
| 4557 |
+
/**
|
| 4558 |
+
* Returns an action object signalling that the given block should be moved to a
|
| 4559 |
+
* new position.
|
| 4560 |
+
*
|
| 4561 |
+
* @param {?string} clientId The client ID of the block.
|
| 4562 |
+
* @param {?string} fromRootClientId Root client ID source.
|
| 4563 |
+
* @param {?string} toRootClientId Root client ID destination.
|
| 4564 |
+
* @param {number} index The index to move the block to.
|
| 4565 |
+
*
|
| 4566 |
+
* @yield {Object} Action object.
|
| 4567 |
+
*/
|
| 4568 |
|
| 4569 |
+
function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
|
| 4570 |
+
yield moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
|
| 4571 |
+
}
|
| 4572 |
/**
|
| 4573 |
+
* Returns an action object used in signalling that a single block should be
|
| 4574 |
+
* inserted, optionally at a specific index respective a root block list.
|
| 4575 |
+
*
|
| 4576 |
+
* @param {Object} block Block object to insert.
|
| 4577 |
+
* @param {?number} index Index at which block should be inserted.
|
| 4578 |
+
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
| 4579 |
+
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
|
| 4580 |
+
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 4581 |
+
*
|
| 4582 |
+
* @return {Object} Action object.
|
| 4583 |
*/
|
| 4584 |
|
| 4585 |
+
function insertBlock(block, index, rootClientId, updateSelection = true, meta) {
|
| 4586 |
+
return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
|
| 4587 |
+
}
|
| 4588 |
+
/**
|
| 4589 |
+
* Returns an action object used in signalling that an array of blocks should
|
| 4590 |
+
* be inserted, optionally at a specific index respective a root block list.
|
| 4591 |
+
*
|
| 4592 |
+
* @param {Object[]} blocks Block objects to insert.
|
| 4593 |
+
* @param {?number} index Index at which block should be inserted.
|
| 4594 |
+
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
| 4595 |
+
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
|
| 4596 |
+
* @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
|
| 4597 |
+
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 4598 |
+
* @return {Object} Action object.
|
| 4599 |
+
*/
|
| 4600 |
|
| 4601 |
+
function* insertBlocks(blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) {
|
| 4602 |
+
if (Object(external_lodash_["isObject"])(initialPosition)) {
|
| 4603 |
+
meta = initialPosition;
|
| 4604 |
+
initialPosition = 0;
|
| 4605 |
+
external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", {
|
| 4606 |
+
since: '10.1',
|
| 4607 |
+
plugin: 'Gutenberg',
|
| 4608 |
+
hint: 'The meta argument is now the 6th argument of the function'
|
| 4609 |
+
});
|
| 4610 |
+
}
|
| 4611 |
|
| 4612 |
+
blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getSettings'));
|
| 4613 |
+
const allowedBlocks = [];
|
| 4614 |
|
| 4615 |
+
for (const block of blocks) {
|
| 4616 |
+
const isValid = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'canInsertBlockType', block.name, rootClientId);
|
| 4617 |
|
| 4618 |
+
if (isValid) {
|
| 4619 |
+
allowedBlocks.push(block);
|
| 4620 |
+
}
|
| 4621 |
+
}
|
| 4622 |
|
| 4623 |
+
if (allowedBlocks.length) {
|
| 4624 |
+
return {
|
| 4625 |
+
type: 'INSERT_BLOCKS',
|
| 4626 |
+
blocks: allowedBlocks,
|
| 4627 |
+
index,
|
| 4628 |
+
rootClientId,
|
| 4629 |
+
time: Date.now(),
|
| 4630 |
+
updateSelection,
|
| 4631 |
+
initialPosition: updateSelection ? initialPosition : null,
|
| 4632 |
+
meta
|
| 4633 |
+
};
|
| 4634 |
+
}
|
| 4635 |
+
}
|
| 4636 |
+
/**
|
| 4637 |
+
* Returns an action object used in signalling that the insertion point should
|
| 4638 |
+
* be shown.
|
| 4639 |
+
*
|
| 4640 |
+
* @param {?string} rootClientId Optional root client ID of block list on
|
| 4641 |
+
* which to insert.
|
| 4642 |
+
* @param {?number} index Index at which block should be inserted.
|
| 4643 |
+
* @param {Object} __unstableOptions Wether or not to show an inserter button.
|
| 4644 |
+
*
|
| 4645 |
+
* @return {Object} Action object.
|
| 4646 |
+
*/
|
| 4647 |
|
| 4648 |
+
function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
|
| 4649 |
+
const {
|
| 4650 |
+
__unstableWithInserter
|
| 4651 |
+
} = __unstableOptions;
|
| 4652 |
+
return {
|
| 4653 |
+
type: 'SHOW_INSERTION_POINT',
|
| 4654 |
+
rootClientId,
|
| 4655 |
+
index,
|
| 4656 |
+
__unstableWithInserter
|
| 4657 |
+
};
|
| 4658 |
+
}
|
| 4659 |
/**
|
| 4660 |
+
* Returns an action object hiding the insertion point.
|
| 4661 |
*
|
| 4662 |
+
* @return {Object} Action object.
|
|
|
|
| 4663 |
*/
|
| 4664 |
|
| 4665 |
+
function hideInsertionPoint() {
|
| 4666 |
+
return {
|
| 4667 |
+
type: 'HIDE_INSERTION_POINT'
|
| 4668 |
+
};
|
| 4669 |
}
|
| 4670 |
+
/**
|
| 4671 |
+
* Returns an action object resetting the template validity.
|
| 4672 |
+
*
|
| 4673 |
+
* @param {boolean} isValid template validity flag.
|
| 4674 |
+
*
|
| 4675 |
+
* @return {Object} Action object.
|
| 4676 |
+
*/
|
| 4677 |
|
| 4678 |
+
function setTemplateValidity(isValid) {
|
| 4679 |
+
return {
|
| 4680 |
+
type: 'SET_TEMPLATE_VALIDITY',
|
| 4681 |
+
isValid
|
| 4682 |
+
};
|
| 4683 |
+
}
|
| 4684 |
+
/**
|
| 4685 |
+
* Returns an action object synchronize the template with the list of blocks
|
| 4686 |
+
*
|
| 4687 |
+
* @return {Object} Action object.
|
| 4688 |
+
*/
|
| 4689 |
|
| 4690 |
+
function* synchronizeTemplate() {
|
| 4691 |
+
yield {
|
| 4692 |
+
type: 'SYNCHRONIZE_TEMPLATE'
|
| 4693 |
+
};
|
| 4694 |
+
const blocks = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlocks');
|
| 4695 |
+
const template = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplate');
|
| 4696 |
+
const updatedBlockList = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template);
|
| 4697 |
+
return yield resetBlocks(updatedBlockList);
|
| 4698 |
+
}
|
| 4699 |
+
/**
|
| 4700 |
+
* Returns an action object used in signalling that two blocks should be merged
|
| 4701 |
+
*
|
| 4702 |
+
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
| 4703 |
+
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
| 4704 |
+
*/
|
| 4705 |
|
| 4706 |
+
function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
| 4707 |
+
const blocks = [firstBlockClientId, secondBlockClientId];
|
| 4708 |
+
yield {
|
| 4709 |
+
type: 'MERGE_BLOCKS',
|
| 4710 |
+
blocks
|
| 4711 |
+
};
|
| 4712 |
+
const [clientIdA, clientIdB] = blocks;
|
| 4713 |
+
const blockA = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlock', clientIdA);
|
| 4714 |
+
const blockAType = Object(external_wp_blocks_["getBlockType"])(blockA.name); // Only focus the previous block if it's not mergeable
|
| 4715 |
|
| 4716 |
+
if (!blockAType.merge) {
|
| 4717 |
+
yield selectBlock(blockA.clientId);
|
| 4718 |
+
return;
|
| 4719 |
+
}
|
| 4720 |
|
| 4721 |
+
const blockB = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlock', clientIdB);
|
| 4722 |
+
const blockBType = Object(external_wp_blocks_["getBlockType"])(blockB.name);
|
| 4723 |
+
const {
|
| 4724 |
+
clientId,
|
| 4725 |
+
attributeKey,
|
| 4726 |
+
offset
|
| 4727 |
+
} = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getSelectionStart');
|
| 4728 |
+
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
| 4729 |
+
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
| 4730 |
+
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
| 4731 |
+
// is not a defined block attribute key. This can be the case if the
|
| 4732 |
+
// fallback intance ID is used to store selection (and no RichText
|
| 4733 |
+
// identifier is set), or when the identifier is wrong.
|
| 4734 |
+
!!attributeDefinition;
|
| 4735 |
|
| 4736 |
+
if (!attributeDefinition) {
|
| 4737 |
+
if (typeof attributeKey === 'number') {
|
| 4738 |
+
window.console.error(`RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was ${typeof attributeKey}`);
|
| 4739 |
+
} else {
|
| 4740 |
+
window.console.error('The RichText identifier prop does not match any attributes defined by the block.');
|
| 4741 |
+
}
|
| 4742 |
+
} // A robust way to retain selection position through various transforms
|
| 4743 |
+
// is to insert a special character at the position and then recover it.
|
| 4744 |
|
|
|
|
| 4745 |
|
| 4746 |
+
const START_OF_SELECTED_AREA = '\u0086'; // Clone the blocks so we don't insert the character in a "live" block.
|
| 4747 |
|
| 4748 |
+
const cloneA = Object(external_wp_blocks_["cloneBlock"])(blockA);
|
| 4749 |
+
const cloneB = Object(external_wp_blocks_["cloneBlock"])(blockB);
|
| 4750 |
|
| 4751 |
+
if (canRestoreTextSelection) {
|
| 4752 |
+
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
| 4753 |
+
const html = selectedBlock.attributes[attributeKey];
|
| 4754 |
+
const {
|
| 4755 |
+
multiline: multilineTag,
|
| 4756 |
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
| 4757 |
+
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
| 4758 |
+
} = attributeDefinition;
|
| 4759 |
+
const value = Object(external_wp_richText_["insert"])(Object(external_wp_richText_["create"])({
|
| 4760 |
+
html,
|
| 4761 |
+
multilineTag,
|
| 4762 |
+
multilineWrapperTags,
|
| 4763 |
+
preserveWhiteSpace
|
| 4764 |
+
}), START_OF_SELECTED_AREA, offset, offset);
|
| 4765 |
+
selectedBlock.attributes[attributeKey] = Object(external_wp_richText_["toHTMLString"])({
|
| 4766 |
+
value,
|
| 4767 |
+
multilineTag,
|
| 4768 |
+
preserveWhiteSpace
|
| 4769 |
+
});
|
| 4770 |
+
} // We can only merge blocks with similar types
|
| 4771 |
+
// thus, we transform the block to merge first
|
| 4772 |
|
| 4773 |
|
| 4774 |
+
const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : Object(external_wp_blocks_["switchToBlockType"])(cloneB, blockA.name); // If the block types can not match, do nothing
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4775 |
|
| 4776 |
+
if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
|
| 4777 |
+
return;
|
| 4778 |
+
} // Calling the merge to update the attributes and remove the block to be merged
|
|
|
|
|
|
|
|
|
|
| 4779 |
|
|
|
|
| 4780 |
|
| 4781 |
+
const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4782 |
|
| 4783 |
+
if (canRestoreTextSelection) {
|
| 4784 |
+
const newAttributeKey = Object(external_lodash_["findKey"])(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
| 4785 |
+
const convertedHtml = updatedAttributes[newAttributeKey];
|
| 4786 |
+
const {
|
| 4787 |
+
multiline: multilineTag,
|
| 4788 |
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
| 4789 |
+
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
| 4790 |
+
} = blockAType.attributes[newAttributeKey];
|
| 4791 |
+
const convertedValue = Object(external_wp_richText_["create"])({
|
| 4792 |
+
html: convertedHtml,
|
| 4793 |
+
multilineTag,
|
| 4794 |
+
multilineWrapperTags,
|
| 4795 |
+
preserveWhiteSpace
|
| 4796 |
+
});
|
| 4797 |
+
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
| 4798 |
+
const newValue = Object(external_wp_richText_["remove"])(convertedValue, newOffset, newOffset + 1);
|
| 4799 |
+
const newHtml = Object(external_wp_richText_["toHTMLString"])({
|
| 4800 |
+
value: newValue,
|
| 4801 |
+
multilineTag,
|
| 4802 |
+
preserveWhiteSpace
|
| 4803 |
+
});
|
| 4804 |
+
updatedAttributes[newAttributeKey] = newHtml;
|
| 4805 |
+
yield selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
| 4806 |
+
}
|
| 4807 |
|
| 4808 |
+
yield* replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
|
| 4809 |
+
attributes: { ...blockA.attributes,
|
| 4810 |
+
...updatedAttributes
|
| 4811 |
+
}
|
| 4812 |
+
}, ...blocksWithTheSameType.slice(1)]);
|
| 4813 |
}
|
| 4814 |
+
/**
|
| 4815 |
+
* Yields action objects used in signalling that the blocks corresponding to
|
| 4816 |
+
* the set of specified client IDs are to be removed.
|
| 4817 |
+
*
|
| 4818 |
+
* @param {string|string[]} clientIds Client IDs of blocks to remove.
|
| 4819 |
+
* @param {boolean} selectPrevious True if the previous block should be
|
| 4820 |
+
* selected when a block is removed.
|
| 4821 |
+
*/
|
| 4822 |
|
| 4823 |
+
function* removeBlocks(clientIds, selectPrevious = true) {
|
| 4824 |
+
if (!clientIds || !clientIds.length) {
|
| 4825 |
+
return;
|
| 4826 |
+
}
|
| 4827 |
|
| 4828 |
+
clientIds = Object(external_lodash_["castArray"])(clientIds);
|
| 4829 |
+
const rootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', clientIds[0]);
|
| 4830 |
+
const isLocked = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplateLock', rootClientId);
|
| 4831 |
|
| 4832 |
+
if (isLocked) {
|
| 4833 |
+
return;
|
| 4834 |
+
}
|
| 4835 |
|
| 4836 |
+
let previousBlockId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4837 |
|
| 4838 |
+
if (selectPrevious) {
|
| 4839 |
+
previousBlockId = yield selectPreviousBlock(clientIds[0]);
|
| 4840 |
+
} else {
|
| 4841 |
+
previousBlockId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getPreviousBlockClientId', clientIds[0]);
|
| 4842 |
+
}
|
| 4843 |
|
| 4844 |
+
yield {
|
| 4845 |
+
type: 'REMOVE_BLOCKS',
|
| 4846 |
+
clientIds
|
| 4847 |
+
}; // To avoid a focus loss when removing the last block, assure there is
|
| 4848 |
+
// always a default block if the last of the blocks have been removed.
|
| 4849 |
|
| 4850 |
+
const defaultBlockId = yield* ensureDefaultBlock();
|
| 4851 |
+
return [previousBlockId || defaultBlockId];
|
| 4852 |
+
}
|
| 4853 |
+
/**
|
| 4854 |
+
* Returns an action object used in signalling that the block with the
|
| 4855 |
+
* specified client ID is to be removed.
|
| 4856 |
+
*
|
| 4857 |
+
* @param {string} clientId Client ID of block to remove.
|
| 4858 |
+
* @param {boolean} selectPrevious True if the previous block should be
|
| 4859 |
+
* selected when a block is removed.
|
| 4860 |
+
*
|
| 4861 |
+
* @return {Object} Action object.
|
| 4862 |
+
*/
|
| 4863 |
|
| 4864 |
+
function removeBlock(clientId, selectPrevious) {
|
| 4865 |
+
return removeBlocks([clientId], selectPrevious);
|
| 4866 |
+
}
|
| 4867 |
+
/**
|
| 4868 |
+
* Returns an action object used in signalling that the inner blocks with the
|
| 4869 |
+
* specified client ID should be replaced.
|
| 4870 |
+
*
|
| 4871 |
+
* @param {string} rootClientId Client ID of the block whose InnerBlocks will re replaced.
|
| 4872 |
+
* @param {Object[]} blocks Block objects to insert as new InnerBlocks
|
| 4873 |
+
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false.
|
| 4874 |
+
* @param {0|-1|null} initialPosition Initial block position.
|
| 4875 |
+
* @return {Object} Action object.
|
| 4876 |
+
*/
|
| 4877 |
|
| 4878 |
+
function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
|
| 4879 |
+
return {
|
| 4880 |
+
type: 'REPLACE_INNER_BLOCKS',
|
| 4881 |
+
rootClientId,
|
| 4882 |
+
blocks,
|
| 4883 |
+
updateSelection,
|
| 4884 |
+
initialPosition: updateSelection ? initialPosition : null,
|
| 4885 |
+
time: Date.now()
|
| 4886 |
+
};
|
| 4887 |
+
}
|
| 4888 |
+
/**
|
| 4889 |
+
* Returns an action object used to toggle the block editing mode between
|
| 4890 |
+
* visual and HTML modes.
|
| 4891 |
+
*
|
| 4892 |
+
* @param {string} clientId Block client ID.
|
| 4893 |
+
*
|
| 4894 |
+
* @return {Object} Action object.
|
| 4895 |
+
*/
|
| 4896 |
|
| 4897 |
+
function toggleBlockMode(clientId) {
|
| 4898 |
+
return {
|
| 4899 |
+
type: 'TOGGLE_BLOCK_MODE',
|
| 4900 |
+
clientId
|
| 4901 |
+
};
|
| 4902 |
+
}
|
| 4903 |
+
/**
|
| 4904 |
+
* Returns an action object used in signalling that the user has begun to type.
|
| 4905 |
+
*
|
| 4906 |
+
* @return {Object} Action object.
|
| 4907 |
+
*/
|
| 4908 |
|
| 4909 |
+
function startTyping() {
|
| 4910 |
+
return {
|
| 4911 |
+
type: 'START_TYPING'
|
| 4912 |
+
};
|
| 4913 |
+
}
|
| 4914 |
+
/**
|
| 4915 |
+
* Returns an action object used in signalling that the user has stopped typing.
|
| 4916 |
+
*
|
| 4917 |
+
* @return {Object} Action object.
|
| 4918 |
+
*/
|
| 4919 |
|
| 4920 |
+
function stopTyping() {
|
| 4921 |
+
return {
|
| 4922 |
+
type: 'STOP_TYPING'
|
| 4923 |
+
};
|
| 4924 |
+
}
|
| 4925 |
+
/**
|
| 4926 |
+
* Returns an action object used in signalling that the user has begun to drag blocks.
|
| 4927 |
+
*
|
| 4928 |
+
* @param {string[]} clientIds An array of client ids being dragged
|
| 4929 |
+
*
|
| 4930 |
+
* @return {Object} Action object.
|
| 4931 |
+
*/
|
| 4932 |
|
| 4933 |
+
function startDraggingBlocks(clientIds = []) {
|
| 4934 |
+
return {
|
| 4935 |
+
type: 'START_DRAGGING_BLOCKS',
|
| 4936 |
+
clientIds
|
| 4937 |
+
};
|
| 4938 |
+
}
|
| 4939 |
+
/**
|
| 4940 |
+
* Returns an action object used in signalling that the user has stopped dragging blocks.
|
| 4941 |
+
*
|
| 4942 |
+
* @return {Object} Action object.
|
| 4943 |
+
*/
|
| 4944 |
|
| 4945 |
+
function stopDraggingBlocks() {
|
| 4946 |
+
return {
|
| 4947 |
+
type: 'STOP_DRAGGING_BLOCKS'
|
| 4948 |
+
};
|
| 4949 |
+
}
|
| 4950 |
+
/**
|
| 4951 |
+
* Returns an action object used in signalling that the caret has entered formatted text.
|
| 4952 |
+
*
|
| 4953 |
+
* @return {Object} Action object.
|
| 4954 |
+
*/
|
| 4955 |
|
| 4956 |
+
function enterFormattedText() {
|
| 4957 |
+
return {
|
| 4958 |
+
type: 'ENTER_FORMATTED_TEXT'
|
| 4959 |
+
};
|
| 4960 |
+
}
|
| 4961 |
+
/**
|
| 4962 |
+
* Returns an action object used in signalling that the user caret has exited formatted text.
|
| 4963 |
+
*
|
| 4964 |
+
* @return {Object} Action object.
|
| 4965 |
+
*/
|
| 4966 |
|
| 4967 |
+
function exitFormattedText() {
|
| 4968 |
+
return {
|
| 4969 |
+
type: 'EXIT_FORMATTED_TEXT'
|
| 4970 |
+
};
|
| 4971 |
+
}
|
| 4972 |
+
/**
|
| 4973 |
+
* Returns an action object used in signalling that the user caret has changed
|
| 4974 |
+
* position.
|
| 4975 |
+
*
|
| 4976 |
+
* @param {string} clientId The selected block client ID.
|
| 4977 |
+
* @param {string} attributeKey The selected block attribute key.
|
| 4978 |
+
* @param {number} startOffset The start offset.
|
| 4979 |
+
* @param {number} endOffset The end offset.
|
| 4980 |
+
*
|
| 4981 |
+
* @return {Object} Action object.
|
| 4982 |
+
*/
|
| 4983 |
|
| 4984 |
+
function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
| 4985 |
+
return {
|
| 4986 |
+
type: 'SELECTION_CHANGE',
|
| 4987 |
+
clientId,
|
| 4988 |
+
attributeKey,
|
| 4989 |
+
startOffset,
|
| 4990 |
+
endOffset
|
| 4991 |
+
};
|
| 4992 |
+
}
|
| 4993 |
+
/**
|
| 4994 |
+
* Returns an action object used in signalling that a new block of the default
|
| 4995 |
+
* type should be added to the block list.
|
| 4996 |
+
*
|
| 4997 |
+
* @param {?Object} attributes Optional attributes of the block to assign.
|
| 4998 |
+
* @param {?string} rootClientId Optional root client ID of block list on which
|
| 4999 |
+
* to append.
|
| 5000 |
+
* @param {?number} index Optional index where to insert the default block
|
| 5001 |
+
*
|
| 5002 |
+
* @return {Object} Action object
|
| 5003 |
+
*/
|
| 5004 |
|
| 5005 |
+
function insertDefaultBlock(attributes, rootClientId, index) {
|
| 5006 |
+
// Abort if there is no default block type (if it has been unregistered).
|
| 5007 |
+
const defaultBlockName = Object(external_wp_blocks_["getDefaultBlockName"])();
|
|
|
|
|
|
|
|
|
|
| 5008 |
|
| 5009 |
+
if (!defaultBlockName) {
|
| 5010 |
+
return;
|
| 5011 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5012 |
|
| 5013 |
+
const block = Object(external_wp_blocks_["createBlock"])(defaultBlockName, attributes);
|
| 5014 |
+
return insertBlock(block, index, rootClientId);
|
| 5015 |
+
}
|
| 5016 |
+
/**
|
| 5017 |
+
* Returns an action object that changes the nested settings of a given block.
|
| 5018 |
+
*
|
| 5019 |
+
* @param {string} clientId Client ID of the block whose nested setting are
|
| 5020 |
+
* being received.
|
| 5021 |
+
* @param {Object} settings Object with the new settings for the nested block.
|
| 5022 |
+
*
|
| 5023 |
+
* @return {Object} Action object
|
| 5024 |
+
*/
|
| 5025 |
|
| 5026 |
+
function updateBlockListSettings(clientId, settings) {
|
| 5027 |
+
return {
|
| 5028 |
+
type: 'UPDATE_BLOCK_LIST_SETTINGS',
|
| 5029 |
+
clientId,
|
| 5030 |
+
settings
|
| 5031 |
+
};
|
| 5032 |
}
|
| 5033 |
+
/**
|
| 5034 |
+
* Returns an action object used in signalling that the block editor settings have been updated.
|
| 5035 |
+
*
|
| 5036 |
+
* @param {Object} settings Updated settings
|
| 5037 |
+
*
|
| 5038 |
+
* @return {Object} Action object
|
| 5039 |
+
*/
|
| 5040 |
|
| 5041 |
+
function updateSettings(settings) {
|
| 5042 |
+
return {
|
| 5043 |
+
type: 'UPDATE_SETTINGS',
|
| 5044 |
+
settings
|
| 5045 |
+
};
|
| 5046 |
+
}
|
| 5047 |
+
/**
|
| 5048 |
+
* Returns an action object used in signalling that a temporary reusable blocks have been saved
|
| 5049 |
+
* in order to switch its temporary id with the real id.
|
| 5050 |
+
*
|
| 5051 |
+
* @param {string} id Reusable block's id.
|
| 5052 |
+
* @param {string} updatedId Updated block's id.
|
| 5053 |
+
*
|
| 5054 |
+
* @return {Object} Action object.
|
| 5055 |
+
*/
|
| 5056 |
|
| 5057 |
+
function __unstableSaveReusableBlock(id, updatedId) {
|
| 5058 |
+
return {
|
| 5059 |
+
type: 'SAVE_REUSABLE_BLOCK_SUCCESS',
|
| 5060 |
+
id,
|
| 5061 |
+
updatedId
|
| 5062 |
+
};
|
| 5063 |
+
}
|
| 5064 |
+
/**
|
| 5065 |
+
* Returns an action object used in signalling that the last block change should be marked explicitly as persistent.
|
| 5066 |
+
*
|
| 5067 |
+
* @return {Object} Action object.
|
| 5068 |
+
*/
|
| 5069 |
|
| 5070 |
+
function __unstableMarkLastChangeAsPersistent() {
|
| 5071 |
+
return {
|
| 5072 |
+
type: 'MARK_LAST_CHANGE_AS_PERSISTENT'
|
| 5073 |
+
};
|
| 5074 |
+
}
|
| 5075 |
+
/**
|
| 5076 |
+
* Returns an action object used in signalling that the next block change should be marked explicitly as not persistent.
|
| 5077 |
+
*
|
| 5078 |
+
* @return {Object} Action object.
|
| 5079 |
+
*/
|
| 5080 |
|
| 5081 |
+
function __unstableMarkNextChangeAsNotPersistent() {
|
| 5082 |
+
return {
|
| 5083 |
+
type: 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'
|
| 5084 |
+
};
|
| 5085 |
+
}
|
| 5086 |
+
/**
|
| 5087 |
+
* Returns an action object used in signalling that the last block change is
|
| 5088 |
+
* an automatic change, meaning it was not performed by the user, and can be
|
| 5089 |
+
* undone using the `Escape` and `Backspace` keys. This action must be called
|
| 5090 |
+
* after the change was made, and any actions that are a consequence of it, so
|
| 5091 |
+
* it is recommended to be called at the next idle period to ensure all
|
| 5092 |
+
* selection changes have been recorded.
|
| 5093 |
+
*/
|
| 5094 |
|
| 5095 |
+
function* __unstableMarkAutomaticChange() {
|
| 5096 |
+
yield {
|
| 5097 |
+
type: 'MARK_AUTOMATIC_CHANGE'
|
| 5098 |
+
};
|
| 5099 |
+
yield __unstableMarkAutomaticChangeFinalControl();
|
| 5100 |
+
}
|
| 5101 |
+
function __unstableMarkAutomaticChangeFinal() {
|
| 5102 |
+
return {
|
| 5103 |
+
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
|
| 5104 |
+
};
|
| 5105 |
+
}
|
| 5106 |
+
/**
|
| 5107 |
+
* Generators that triggers an action used to enable or disable the navigation mode.
|
| 5108 |
+
*
|
| 5109 |
+
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
| 5110 |
+
*/
|
| 5111 |
|
| 5112 |
+
function* setNavigationMode(isNavigationMode = true) {
|
| 5113 |
+
yield {
|
| 5114 |
+
type: 'SET_NAVIGATION_MODE',
|
| 5115 |
+
isNavigationMode
|
| 5116 |
+
};
|
|
|
|
| 5117 |
|
| 5118 |
+
if (isNavigationMode) {
|
| 5119 |
+
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.'));
|
| 5120 |
+
} else {
|
| 5121 |
+
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in edit mode. To return to the navigation mode, press Escape.'));
|
| 5122 |
+
}
|
| 5123 |
}
|
| 5124 |
+
/**
|
| 5125 |
+
* Generator that triggers an action used to enable or disable the block moving mode.
|
| 5126 |
+
*
|
| 5127 |
+
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
| 5128 |
+
*/
|
| 5129 |
|
| 5130 |
+
function* setBlockMovingClientId(hasBlockMovingClientId = null) {
|
| 5131 |
+
yield {
|
| 5132 |
+
type: 'SET_BLOCK_MOVING_MODE',
|
| 5133 |
+
hasBlockMovingClientId
|
| 5134 |
+
};
|
| 5135 |
|
| 5136 |
+
if (hasBlockMovingClientId) {
|
| 5137 |
+
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.'));
|
| 5138 |
+
}
|
| 5139 |
+
}
|
| 5140 |
+
/**
|
| 5141 |
+
* Generator that triggers an action used to duplicate a list of blocks.
|
| 5142 |
+
*
|
| 5143 |
+
* @param {string[]} clientIds
|
| 5144 |
+
* @param {boolean} updateSelection
|
| 5145 |
+
*/
|
| 5146 |
|
| 5147 |
+
function* duplicateBlocks(clientIds, updateSelection = true) {
|
| 5148 |
+
if (!clientIds && !clientIds.length) {
|
| 5149 |
+
return;
|
| 5150 |
+
}
|
| 5151 |
|
| 5152 |
+
const blocks = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlocksByClientId', clientIds);
|
| 5153 |
+
const rootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist.
|
| 5154 |
|
| 5155 |
+
if (Object(external_lodash_["some"])(blocks, block => !block)) {
|
| 5156 |
+
return;
|
| 5157 |
+
}
|
| 5158 |
|
| 5159 |
+
const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage.
|
| 5160 |
+
|
| 5161 |
+
if (Object(external_lodash_["some"])(blockNames, blockName => !Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'multiple', true))) {
|
| 5162 |
+
return;
|
| 5163 |
+
}
|
| 5164 |
+
|
| 5165 |
+
const lastSelectedIndex = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockIndex', Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(clientIds)), rootClientId);
|
| 5166 |
+
const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["__experimentalCloneSanitizedBlock"])(block));
|
| 5167 |
+
yield insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
|
| 5168 |
+
|
| 5169 |
+
if (clonedBlocks.length > 1 && updateSelection) {
|
| 5170 |
+
yield multiSelect(Object(external_lodash_["first"])(clonedBlocks).clientId, Object(external_lodash_["last"])(clonedBlocks).clientId);
|
| 5171 |
+
}
|
| 5172 |
+
|
| 5173 |
+
return clonedBlocks.map(block => block.clientId);
|
| 5174 |
}
|
| 5175 |
+
/**
|
| 5176 |
+
* Generator used to insert an empty block after a given block.
|
| 5177 |
+
*
|
| 5178 |
+
* @param {string} clientId
|
| 5179 |
+
*/
|
| 5180 |
|
| 5181 |
+
function* insertBeforeBlock(clientId) {
|
| 5182 |
+
if (!clientId) {
|
| 5183 |
+
return;
|
| 5184 |
+
}
|
| 5185 |
|
| 5186 |
+
const rootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', clientId);
|
| 5187 |
+
const isLocked = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplateLock', rootClientId);
|
| 5188 |
+
|
| 5189 |
+
if (isLocked) {
|
| 5190 |
+
return;
|
| 5191 |
+
}
|
| 5192 |
+
|
| 5193 |
+
const firstSelectedIndex = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockIndex', clientId, rootClientId);
|
| 5194 |
+
return yield insertDefaultBlock({}, rootClientId, firstSelectedIndex);
|
|
|
|
| 5195 |
}
|
| 5196 |
+
/**
|
| 5197 |
+
* Generator used to insert an empty block before a given block.
|
| 5198 |
+
*
|
| 5199 |
+
* @param {string} clientId
|
| 5200 |
+
*/
|
| 5201 |
|
| 5202 |
+
function* insertAfterBlock(clientId) {
|
| 5203 |
+
if (!clientId) {
|
| 5204 |
+
return;
|
| 5205 |
+
}
|
| 5206 |
|
| 5207 |
+
const rootClientId = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockRootClientId', clientId);
|
| 5208 |
+
const isLocked = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getTemplateLock', rootClientId);
|
| 5209 |
|
| 5210 |
+
if (isLocked) {
|
| 5211 |
+
return;
|
| 5212 |
+
}
|
| 5213 |
|
| 5214 |
+
const firstSelectedIndex = yield external_wp_data_["controls"].select(constants["a" /* STORE_NAME */], 'getBlockIndex', clientId, rootClientId);
|
| 5215 |
+
return yield insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
|
| 5216 |
+
}
|
| 5217 |
+
/**
|
| 5218 |
+
* Returns an action object that toggles the highlighted block state.
|
| 5219 |
+
*
|
| 5220 |
+
* @param {string} clientId The block's clientId.
|
| 5221 |
+
* @param {boolean} isHighlighted The highlight state.
|
| 5222 |
+
*/
|
| 5223 |
|
| 5224 |
+
function toggleBlockHighlight(clientId, isHighlighted) {
|
| 5225 |
+
return {
|
| 5226 |
+
type: 'TOGGLE_BLOCK_HIGHLIGHT',
|
| 5227 |
+
clientId,
|
| 5228 |
+
isHighlighted
|
| 5229 |
+
};
|
| 5230 |
}
|
| 5231 |
+
/**
|
| 5232 |
+
* Yields action objects used in signalling that the block corresponding to the
|
| 5233 |
+
* given clientId should appear to "flash" by rhythmically highlighting it.
|
| 5234 |
+
*
|
| 5235 |
+
* @param {string} clientId Target block client ID.
|
| 5236 |
+
*/
|
| 5237 |
|
| 5238 |
+
function* flashBlock(clientId) {
|
| 5239 |
+
yield toggleBlockHighlight(clientId, true);
|
| 5240 |
+
yield {
|
| 5241 |
+
type: 'SLEEP',
|
| 5242 |
+
duration: 150
|
| 5243 |
+
};
|
| 5244 |
+
yield toggleBlockHighlight(clientId, false);
|
| 5245 |
+
}
|
| 5246 |
+
/**
|
| 5247 |
+
* Returns an action object that sets whether the block has controlled innerblocks.
|
| 5248 |
+
*
|
| 5249 |
+
* @param {string} clientId The block's clientId.
|
| 5250 |
+
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|
| 5251 |
+
*/
|
| 5252 |
|
| 5253 |
+
function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
|
| 5254 |
+
return {
|
| 5255 |
+
type: 'SET_HAS_CONTROLLED_INNER_BLOCKS',
|
| 5256 |
+
hasControlledInnerBlocks,
|
| 5257 |
+
clientId
|
| 5258 |
+
};
|
| 5259 |
+
}
|
| 5260 |
+
//# sourceMappingURL=actions.js.map
|
| 5261 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/store/index.js
|
| 5262 |
+
/**
|
| 5263 |
+
* WordPress dependencies
|
| 5264 |
+
*/
|
| 5265 |
|
| 5266 |
+
/**
|
| 5267 |
+
* Internal dependencies
|
| 5268 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5269 |
|
|
|
|
|
|
|
|
|
|
| 5270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5274 |
|
| 5275 |
+
/**
|
| 5276 |
+
* Block editor data store configuration.
|
| 5277 |
+
*
|
| 5278 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
|
| 5279 |
+
*
|
| 5280 |
+
* @type {Object}
|
| 5281 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5282 |
|
| 5283 |
+
const storeConfig = {
|
| 5284 |
+
reducer: store_reducer,
|
| 5285 |
+
selectors: selectors_namespaceObject,
|
| 5286 |
+
actions: actions_namespaceObject,
|
| 5287 |
+
controls: store_controls
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5288 |
};
|
| 5289 |
+
/**
|
| 5290 |
+
* Store definition for the block editor namespace.
|
| 5291 |
+
*
|
| 5292 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
| 5293 |
+
*
|
| 5294 |
+
* @type {Object}
|
| 5295 |
+
*/
|
| 5296 |
|
| 5297 |
+
const store = Object(external_wp_data_["createReduxStore"])(constants["a" /* STORE_NAME */], { ...storeConfig,
|
| 5298 |
+
persist: ['preferences']
|
| 5299 |
+
}); // Ideally we'd use register instead of register stores.
|
|
|
|
|
|
|
|
|
|
| 5300 |
|
| 5301 |
+
Object(external_wp_data_["registerStore"])(constants["a" /* STORE_NAME */], { ...storeConfig,
|
| 5302 |
+
persist: ['preferences']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5303 |
});
|
| 5304 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5305 |
|
| 5306 |
/***/ }),
|
| 5307 |
+
/* 14 */
|
|
|
|
| 5308 |
/***/ (function(module, exports) {
|
| 5309 |
|
| 5310 |
+
(function() { module.exports = window["wp"]["keycodes"]; }());
|
| 5311 |
|
| 5312 |
/***/ }),
|
| 5313 |
+
/* 15 */,
|
| 5314 |
+
/* 16 */,
|
| 5315 |
+
/* 17 */
|
| 5316 |
+
/***/ (function(module, exports) {
|
| 5317 |
|
| 5318 |
+
(function() { module.exports = window["wp"]["richText"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5319 |
|
| 5320 |
/***/ }),
|
| 5321 |
+
/* 18 */,
|
| 5322 |
+
/* 19 */,
|
| 5323 |
+
/* 20 */
|
| 5324 |
+
/***/ (function(module, exports) {
|
| 5325 |
|
| 5326 |
+
(function() { module.exports = window["wp"]["url"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5327 |
|
| 5328 |
+
/***/ }),
|
| 5329 |
+
/* 21 */
|
| 5330 |
+
/***/ (function(module, exports) {
|
| 5331 |
|
| 5332 |
+
(function() { module.exports = window["wp"]["hooks"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5333 |
|
| 5334 |
/***/ }),
|
| 5335 |
+
/* 22 */
|
| 5336 |
+
/***/ (function(module, exports) {
|
| 5337 |
|
| 5338 |
+
(function() { module.exports = window["wp"]["dom"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5339 |
|
| 5340 |
+
/***/ }),
|
| 5341 |
+
/* 23 */,
|
| 5342 |
+
/* 24 */
|
| 5343 |
+
/***/ (function(module, exports, __webpack_require__) {
|
| 5344 |
|
| 5345 |
/**
|
| 5346 |
+
* Copyright (c) 2013-present, Facebook, Inc.
|
| 5347 |
+
*
|
| 5348 |
+
* This source code is licensed under the MIT license found in the
|
| 5349 |
+
* LICENSE file in the root directory of this source tree.
|
| 5350 |
*/
|
| 5351 |
|
| 5352 |
+
if (false) { var throwOnDirectAccess, ReactIs; } else {
|
| 5353 |
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
| 5354 |
+
// http://fb.me/prop-types-in-prod
|
| 5355 |
+
module.exports = __webpack_require__(169)();
|
| 5356 |
+
}
|
| 5357 |
+
|
|
|
|
|
|
|
| 5358 |
|
| 5359 |
/***/ }),
|
| 5360 |
+
/* 25 */
|
| 5361 |
+
/***/ (function(module, exports) {
|
| 5362 |
|
| 5363 |
+
(function() { module.exports = window["wp"]["keyboardShortcuts"]; }());
|
|
|
|
| 5364 |
|
| 5365 |
+
/***/ }),
|
| 5366 |
+
/* 26 */
|
| 5367 |
+
/***/ (function(module, exports) {
|
|
|
|
|
|
|
| 5368 |
|
| 5369 |
+
(function() { module.exports = window["wp"]["deprecated"]; }());
|
| 5370 |
|
| 5371 |
+
/***/ }),
|
| 5372 |
+
/* 27 */,
|
| 5373 |
+
/* 28 */,
|
| 5374 |
+
/* 29 */
|
| 5375 |
+
/***/ (function(module, exports) {
|
| 5376 |
|
| 5377 |
+
(function() { module.exports = window["wp"]["notices"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5378 |
|
| 5379 |
/***/ }),
|
| 5380 |
+
/* 30 */
|
|
|
|
| 5381 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5382 |
|
| 5383 |
"use strict";
|
| 5658 |
|
| 5659 |
|
| 5660 |
/***/ }),
|
| 5661 |
+
/* 31 */
|
| 5662 |
+
/***/ (function(module, exports) {
|
| 5663 |
|
| 5664 |
+
(function() { module.exports = window["wp"]["a11y"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5665 |
|
| 5666 |
+
/***/ }),
|
| 5667 |
+
/* 32 */,
|
| 5668 |
+
/* 33 */
|
| 5669 |
+
/***/ (function(module, exports) {
|
| 5670 |
|
| 5671 |
+
(function() { module.exports = window["wp"]["blob"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5672 |
|
| 5673 |
/***/ }),
|
| 5674 |
+
/* 34 */,
|
| 5675 |
+
/* 35 */,
|
| 5676 |
+
/* 36 */,
|
| 5677 |
+
/* 37 */,
|
| 5678 |
+
/* 38 */,
|
| 5679 |
+
/* 39 */,
|
| 5680 |
+
/* 40 */
|
| 5681 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 5682 |
|
| 5683 |
"use strict";
|
| 5684 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return STORE_NAME; });
|
| 5685 |
+
const STORE_NAME = 'core/block-editor';
|
| 5686 |
+
//# sourceMappingURL=constants.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5687 |
|
| 5688 |
+
/***/ }),
|
| 5689 |
+
/* 41 */
|
| 5690 |
+
/***/ (function(module, exports) {
|
| 5691 |
|
| 5692 |
+
(function() { module.exports = window["wp"]["htmlEntities"]; }());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5693 |
|
| 5694 |
+
/***/ }),
|
| 5695 |
+
/* 42 */
|
| 5696 |
+
/***/ (function(module, exports, __webpack_require__) {
|
| 5697 |
|
| 5698 |
+
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2
|
| 5699 |
+
// https://github.com/bgrins/TinyColor
|
| 5700 |
+
// Brian Grinstead, MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5701 |
|
| 5702 |
+
(function(Math) {
|
| 5703 |
|
| 5704 |
+
var trimLeft = /^\s+/,
|
| 5705 |
+
trimRight = /\s+$/,
|
| 5706 |
+
tinyCounter = 0,
|
| 5707 |
+
mathRound = Math.round,
|
| 5708 |
+
mathMin = Math.min,
|
| 5709 |
+
mathMax = Math.max,
|
| 5710 |
+
mathRandom = Math.random;
|
| 5711 |
|
| 5712 |
+
function tinycolor (color, opts) {
|
| 5713 |
|
| 5714 |
+
color = (color) ? color : '';
|
| 5715 |
+
opts = opts || { };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5716 |
|
| 5717 |
+
// If input is already a tinycolor, return itself
|
| 5718 |
+
if (color instanceof tinycolor) {
|
| 5719 |
+
return color;
|
| 5720 |
+
}
|
| 5721 |
+
// If we are called as a function, call using new instead
|
| 5722 |
+
if (!(this instanceof tinycolor)) {
|
| 5723 |
+
return new tinycolor(color, opts);
|
| 5724 |
+
}
|
| 5725 |
|
| 5726 |
+
var rgb = inputToRGB(color);
|
| 5727 |
+
this._originalInput = color,
|
| 5728 |
+
this._r = rgb.r,
|
| 5729 |
+
this._g = rgb.g,
|
| 5730 |
+
this._b = rgb.b,
|
| 5731 |
+
this._a = rgb.a,
|
| 5732 |
+
this._roundA = mathRound(100*this._a) / 100,
|
| 5733 |
+
this._format = opts.format || rgb.format;
|
| 5734 |
+
this._gradientType = opts.gradientType;
|
| 5735 |
|
| 5736 |
+
// Don't let the range of [0,255] come back in [0,1].
|
| 5737 |
+
// Potentially lose a little bit of precision here, but will fix issues where
|
| 5738 |
+
// .5 gets interpreted as half of the total, instead of half of 1
|
| 5739 |
+
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
| 5740 |
+
if (this._r < 1) { this._r = mathRound(this._r); }
|
| 5741 |
+
if (this._g < 1) { this._g = mathRound(this._g); }
|
| 5742 |
+
if (this._b < 1) { this._b = mathRound(this._b); }
|
| 5743 |
|
| 5744 |
+
this._ok = rgb.ok;
|
| 5745 |
+
this._tc_id = tinyCounter++;
|
| 5746 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5747 |
|
| 5748 |
+
tinycolor.prototype = {
|
| 5749 |
+
isDark: function() {
|
| 5750 |
+
return this.getBrightness() < 128;
|
| 5751 |
+
},
|
| 5752 |
+
isLight: function() {
|
| 5753 |
+
return !this.isDark();
|
| 5754 |
+
},
|
| 5755 |
+
isValid: function() {
|
| 5756 |
+
return this._ok;
|
| 5757 |
+
},
|
| 5758 |
+
getOriginalInput: function() {
|
| 5759 |
+
return this._originalInput;
|
| 5760 |
+
},
|
| 5761 |
+
getFormat: function() {
|
| 5762 |
+
return this._format;
|
| 5763 |
+
},
|
| 5764 |
+
getAlpha: function() {
|
| 5765 |
+
return this._a;
|
| 5766 |
+
},
|
| 5767 |
+
getBrightness: function() {
|
| 5768 |
+
//http://www.w3.org/TR/AERT#color-contrast
|
| 5769 |
+
var rgb = this.toRgb();
|
| 5770 |
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
| 5771 |
+
},
|
| 5772 |
+
getLuminance: function() {
|
| 5773 |
+
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
| 5774 |
+
var rgb = this.toRgb();
|
| 5775 |
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
| 5776 |
+
RsRGB = rgb.r/255;
|
| 5777 |
+
GsRGB = rgb.g/255;
|
| 5778 |
+
BsRGB = rgb.b/255;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5779 |
|
| 5780 |
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
| 5781 |
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
| 6892 |
|
| 6893 |
|
| 6894 |
/***/ }),
|
| 6895 |
+
/* 43 */,
|
| 6896 |
+
/* 44 */,
|
| 6897 |
+
/* 45 */,
|
| 6898 |
+
/* 46 */,
|
| 6899 |
+
/* 47 */,
|
| 6900 |
+
/* 48 */,
|
| 6901 |
+
/* 49 */,
|
| 6902 |
+
/* 50 */,
|
| 6903 |
+
/* 51 */
|
| 6904 |
/***/ (function(module, exports) {
|
| 6905 |
|
| 6906 |
+
(function() { module.exports = window["wp"]["isShallowEqual"]; }());
|
| 6907 |
|
| 6908 |
/***/ }),
|
| 6909 |
+
/* 52 */
|
|
|
|
| 6910 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 6911 |
|
| 6912 |
"use strict";
|
| 6913 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BlockIcon; });
|
| 6914 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 6915 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 6916 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
|
| 6917 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
|
| 6918 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
| 6919 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
|
| 6920 |
+
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(146);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6921 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6922 |
|
| 6923 |
+
/**
|
| 6924 |
+
* External dependencies
|
| 6925 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6926 |
|
| 6927 |
+
/**
|
| 6928 |
+
* WordPress dependencies
|
| 6929 |
+
*/
|
| 6930 |
|
|
|
|
|
|
|
| 6931 |
|
|
|
|
|
|
|
|
|
|
| 6932 |
|
| 6933 |
+
function BlockIcon({
|
| 6934 |
+
icon,
|
| 6935 |
+
showColors = false,
|
| 6936 |
+
className
|
| 6937 |
+
}) {
|
| 6938 |
+
var _icon;
|
| 6939 |
|
| 6940 |
+
if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') {
|
| 6941 |
+
icon = {
|
| 6942 |
+
src: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"]
|
| 6943 |
+
};
|
| 6944 |
+
}
|
| 6945 |
|
| 6946 |
+
const renderedIcon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Icon"], {
|
| 6947 |
+
icon: icon && icon.src ? icon.src : icon
|
| 6948 |
+
});
|
| 6949 |
+
const style = showColors ? {
|
| 6950 |
+
backgroundColor: icon && icon.background,
|
| 6951 |
+
color: icon && icon.foreground
|
| 6952 |
+
} : {};
|
| 6953 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
|
| 6954 |
+
style: style,
|
| 6955 |
+
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('block-editor-block-icon', className, {
|
| 6956 |
+
'has-colors': showColors
|
| 6957 |
+
})
|
| 6958 |
+
}, renderedIcon);
|
| 6959 |
+
}
|
| 6960 |
+
//# sourceMappingURL=index.js.map
|
| 6961 |
|
| 6962 |
+
/***/ }),
|
| 6963 |
+
/* 53 */,
|
| 6964 |
+
/* 54 */,
|
| 6965 |
+
/* 55 */,
|
| 6966 |
+
/* 56 */,
|
| 6967 |
+
/* 57 */,
|
| 6968 |
+
/* 58 */,
|
| 6969 |
+
/* 59 */,
|
| 6970 |
+
/* 60 */,
|
| 6971 |
+
/* 61 */,
|
| 6972 |
+
/* 62 */,
|
| 6973 |
+
/* 63 */,
|
| 6974 |
+
/* 64 */,
|
| 6975 |
+
/* 65 */,
|
| 6976 |
+
/* 66 */
|
| 6977 |
+
/***/ (function(module, exports) {
|
| 6978 |
|
| 6979 |
+
(function() { module.exports = window["wp"]["warning"]; }());
|
|
|
|
| 6980 |
|
| 6981 |
+
/***/ }),
|
| 6982 |
+
/* 67 */,
|
| 6983 |
+
/* 68 */,
|
| 6984 |
+
/* 69 */
|
| 6985 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 6986 |
|
| 6987 |
+
"use strict";
|
| 6988 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Provider; });
|
| 6989 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useBlockEditContext; });
|
| 6990 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 6991 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 6992 |
/**
|
| 6993 |
* WordPress dependencies
|
| 6994 |
*/
|
| 6995 |
|
| 6996 |
+
const Context = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])({
|
| 6997 |
name: '',
|
| 6998 |
isSelected: false,
|
| 6999 |
clientId: null
|
| 7000 |
});
|
| 7001 |
const {
|
| 7002 |
+
Provider
|
| 7003 |
} = Context;
|
| 7004 |
|
| 7005 |
/**
|
| 7009 |
*/
|
| 7010 |
|
| 7011 |
function useBlockEditContext() {
|
| 7012 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(Context);
|
| 7013 |
}
|
| 7014 |
//# sourceMappingURL=context.js.map
|
|
|
|
|
|
|
| 7015 |
|
| 7016 |
+
/***/ }),
|
| 7017 |
+
/* 70 */,
|
| 7018 |
+
/* 71 */
|
| 7019 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 7020 |
+
|
| 7021 |
+
"use strict";
|
| 7022 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return useBlockRefProvider; });
|
| 7023 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useBlockRef; });
|
| 7024 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBlockElement; });
|
| 7025 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 7026 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 7027 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
| 7028 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__);
|
| 7029 |
+
/* harmony import */ var _provider_block_refs_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(165);
|
| 7030 |
/**
|
| 7031 |
* WordPress dependencies
|
| 7032 |
*/
|
| 7033 |
|
| 7034 |
+
|
|
|
|
|
|
|
| 7035 |
/**
|
| 7036 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7037 |
*/
|
| 7038 |
|
| 7039 |
+
|
| 7040 |
+
/** @typedef {import('@wordpress/element').RefCallback} RefCallback */
|
| 7041 |
+
|
| 7042 |
+
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
| 7043 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7044 |
/**
|
| 7045 |
+
* Provides a ref to the BlockRefs context.
|
| 7046 |
+
*
|
| 7047 |
+
* @param {string} clientId The client ID of the element ref.
|
| 7048 |
+
*
|
| 7049 |
+
* @return {RefCallback} Ref callback.
|
| 7050 |
*/
|
| 7051 |
|
| 7052 |
+
function useBlockRefProvider(clientId) {
|
| 7053 |
+
const {
|
| 7054 |
+
refs,
|
| 7055 |
+
callbacks
|
| 7056 |
+
} = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_provider_block_refs_provider__WEBPACK_IMPORTED_MODULE_2__[/* BlockRefs */ "a"]);
|
| 7057 |
+
const ref = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useRef"])();
|
| 7058 |
+
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"])(() => {
|
| 7059 |
+
refs.set(ref, clientId);
|
| 7060 |
+
return () => {
|
| 7061 |
+
refs.delete(ref);
|
| 7062 |
+
};
|
| 7063 |
+
}, [clientId]);
|
| 7064 |
+
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__["useRefEffect"])(element => {
|
| 7065 |
+
// Update the ref in the provider.
|
| 7066 |
+
ref.current = element; // Call any update functions.
|
| 7067 |
+
|
| 7068 |
+
callbacks.forEach((id, setElement) => {
|
| 7069 |
+
if (clientId === id) {
|
| 7070 |
+
setElement(element);
|
| 7071 |
+
}
|
| 7072 |
+
});
|
| 7073 |
+
}, [clientId]);
|
| 7074 |
+
}
|
| 7075 |
/**
|
| 7076 |
+
* Gets a ref pointing to the current block element. Continues to return a
|
| 7077 |
+
* stable ref even if the block client ID changes.
|
| 7078 |
*
|
| 7079 |
+
* @param {string} clientId The client ID to get a ref for.
|
|
|
|
|
|
|
| 7080 |
*
|
| 7081 |
+
* @return {RefObject} A ref containing the element.
|
| 7082 |
*/
|
| 7083 |
|
| 7084 |
+
function useBlockRef(clientId) {
|
| 7085 |
+
const {
|
| 7086 |
+
refs
|
| 7087 |
+
} = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_provider_block_refs_provider__WEBPACK_IMPORTED_MODULE_2__[/* BlockRefs */ "a"]);
|
| 7088 |
+
const freshClientId = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useRef"])();
|
| 7089 |
+
freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so
|
| 7090 |
+
// that `current` works at a later point.
|
| 7091 |
+
|
| 7092 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(() => ({
|
| 7093 |
+
get current() {
|
| 7094 |
+
let element = null; // Multiple refs may be created for a single block. Find the
|
| 7095 |
+
// first that has an element set.
|
| 7096 |
+
|
| 7097 |
+
for (const [ref, id] of refs.entries()) {
|
| 7098 |
+
if (id === freshClientId.current && ref.current) {
|
| 7099 |
+
element = ref.current;
|
| 7100 |
+
}
|
| 7101 |
+
}
|
| 7102 |
+
|
| 7103 |
+
return element;
|
| 7104 |
+
}
|
| 7105 |
+
|
| 7106 |
+
}), []);
|
| 7107 |
}
|
| 7108 |
/**
|
| 7109 |
+
* Return the element for a given client ID. Updates whenever the element
|
| 7110 |
+
* changes, becomes available, or disappears.
|
| 7111 |
*
|
| 7112 |
+
* @param {string} clientId The client ID to an element for.
|
|
|
|
|
|
|
|
|
|
| 7113 |
*
|
| 7114 |
+
* @return {Element|null} The block's wrapper element.
|
| 7115 |
*/
|
| 7116 |
|
| 7117 |
+
|
| 7118 |
+
function useBlockElement(clientId) {
|
| 7119 |
+
const {
|
| 7120 |
+
callbacks
|
| 7121 |
+
} = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_provider_block_refs_provider__WEBPACK_IMPORTED_MODULE_2__[/* BlockRefs */ "a"]);
|
| 7122 |
+
const ref = useBlockRef(clientId);
|
| 7123 |
+
const [element, setElement] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(null);
|
| 7124 |
+
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"])(() => {
|
| 7125 |
+
if (!clientId) {
|
| 7126 |
+
return;
|
| 7127 |
+
}
|
| 7128 |
+
|
| 7129 |
+
callbacks.set(setElement, clientId);
|
| 7130 |
+
return () => {
|
| 7131 |
+
callbacks.delete(setElement);
|
| 7132 |
+
};
|
| 7133 |
+
}, [clientId]);
|
| 7134 |
+
return ref.current || element;
|
| 7135 |
}
|
| 7136 |
+
|
| 7137 |
+
|
| 7138 |
+
|
| 7139 |
+
//# sourceMappingURL=use-block-refs.js.map
|
| 7140 |
+
|
| 7141 |
+
/***/ }),
|
| 7142 |
+
/* 72 */,
|
| 7143 |
+
/* 73 */,
|
| 7144 |
+
/* 74 */,
|
| 7145 |
+
/* 75 */
|
| 7146 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 7147 |
+
|
| 7148 |
+
"use strict";
|
| 7149 |
+
|
| 7150 |
+
// UNUSED EXPORTS: BlockPreview
|
| 7151 |
+
|
| 7152 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 7153 |
+
var external_wp_element_ = __webpack_require__(0);
|
| 7154 |
+
|
| 7155 |
+
// EXTERNAL MODULE: external "lodash"
|
| 7156 |
+
var external_lodash_ = __webpack_require__(2);
|
| 7157 |
+
|
| 7158 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 7159 |
+
var external_wp_data_ = __webpack_require__(4);
|
| 7160 |
+
|
| 7161 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/provider/index.js + 1 modules
|
| 7162 |
+
var provider = __webpack_require__(214);
|
| 7163 |
+
|
| 7164 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 7165 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 7166 |
+
|
| 7167 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-list/index.js + 4 modules
|
| 7168 |
+
var block_list = __webpack_require__(101);
|
| 7169 |
+
|
| 7170 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/live.js
|
| 7171 |
+
|
| 7172 |
+
|
| 7173 |
/**
|
| 7174 |
+
* WordPress dependencies
|
| 7175 |
*/
|
| 7176 |
|
| 7177 |
/**
|
| 7178 |
+
* Internal dependencies
|
| 7179 |
*/
|
| 7180 |
|
| 7181 |
|
| 7182 |
+
function LiveBlockPreview({
|
| 7183 |
+
onClick
|
| 7184 |
+
}) {
|
| 7185 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 7186 |
+
tabIndex: 0,
|
| 7187 |
+
role: "button",
|
| 7188 |
+
onClick: onClick,
|
| 7189 |
+
onKeyPress: onClick
|
| 7190 |
+
}, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(block_list["c" /* default */], null)));
|
| 7191 |
+
}
|
| 7192 |
+
//# sourceMappingURL=live.js.map
|
| 7193 |
+
// EXTERNAL MODULE: external ["wp","compose"]
|
| 7194 |
+
var external_wp_compose_ = __webpack_require__(9);
|
| 7195 |
+
|
| 7196 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/auto.js
|
| 7197 |
+
|
| 7198 |
|
| 7199 |
/**
|
| 7200 |
+
* WordPress dependencies
|
| 7201 |
*/
|
| 7202 |
|
| 7203 |
|
|
|
|
| 7204 |
/**
|
| 7205 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7206 |
*/
|
| 7207 |
|
| 7208 |
+
// This is used to avoid rendering the block list if the sizes change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7209 |
|
| 7210 |
+
let MemoizedBlockList;
|
| 7211 |
|
| 7212 |
+
function AutoBlockPreview({
|
| 7213 |
+
viewportWidth,
|
| 7214 |
+
__experimentalPadding
|
| 7215 |
+
}) {
|
| 7216 |
+
const [containerResizeListener, {
|
| 7217 |
+
width: containerWidth
|
| 7218 |
+
}] = Object(external_wp_compose_["useResizeObserver"])();
|
| 7219 |
+
const [containtResizeListener, {
|
| 7220 |
+
height: contentHeight
|
| 7221 |
+
}] = Object(external_wp_compose_["useResizeObserver"])(); // Initialize on render instead of module top level, to avoid circular dependency issues.
|
| 7222 |
+
|
| 7223 |
+
MemoizedBlockList = MemoizedBlockList || Object(external_wp_compose_["pure"])(block_list["c" /* default */]);
|
| 7224 |
+
const scale = (containerWidth - 2 * __experimentalPadding) / viewportWidth;
|
| 7225 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 7226 |
+
className: "block-editor-block-preview__container editor-styles-wrapper",
|
| 7227 |
+
"aria-hidden": true,
|
| 7228 |
+
style: {
|
| 7229 |
+
height: contentHeight * scale + 2 * __experimentalPadding
|
| 7230 |
+
}
|
| 7231 |
+
}, containerResizeListener, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], {
|
| 7232 |
+
style: {
|
| 7233 |
+
transform: `scale(${scale})`,
|
| 7234 |
+
width: viewportWidth,
|
| 7235 |
+
left: __experimentalPadding,
|
| 7236 |
+
right: __experimentalPadding,
|
| 7237 |
+
top: __experimentalPadding
|
| 7238 |
+
},
|
| 7239 |
+
className: "block-editor-block-preview__content"
|
| 7240 |
+
}, containtResizeListener, Object(external_wp_element_["createElement"])(MemoizedBlockList, null)));
|
| 7241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7242 |
|
| 7243 |
+
/* harmony default export */ var auto = (AutoBlockPreview);
|
| 7244 |
+
//# sourceMappingURL=auto.js.map
|
| 7245 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/index.js + 5 modules
|
| 7246 |
+
var store = __webpack_require__(13);
|
| 7247 |
|
| 7248 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/index.js
|
|
|
|
|
|
|
| 7249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7250 |
|
|
|
|
|
|
|
| 7251 |
/**
|
| 7252 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7253 |
*/
|
| 7254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7255 |
/**
|
| 7256 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7257 |
*/
|
| 7258 |
|
| 7259 |
|
| 7260 |
+
|
|
|
|
|
|
|
| 7261 |
/**
|
| 7262 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7263 |
*/
|
| 7264 |
|
| 7265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7267 |
|
| 7268 |
|
| 7269 |
+
function BlockPreview({
|
| 7270 |
+
blocks,
|
| 7271 |
+
__experimentalPadding = 0,
|
| 7272 |
+
viewportWidth = 1200,
|
| 7273 |
+
__experimentalLive = false,
|
| 7274 |
+
__experimentalOnClick
|
| 7275 |
+
}) {
|
| 7276 |
+
const originalSettings = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).getSettings(), []);
|
| 7277 |
+
const settings = Object(external_wp_element_["useMemo"])(() => {
|
| 7278 |
+
const _settings = { ...originalSettings
|
| 7279 |
};
|
| 7280 |
+
_settings.__experimentalBlockPatterns = [];
|
| 7281 |
+
return _settings;
|
| 7282 |
+
}, [originalSettings]);
|
| 7283 |
+
const renderedBlocks = Object(external_wp_element_["useMemo"])(() => Object(external_lodash_["castArray"])(blocks), [blocks]);
|
| 7284 |
+
|
| 7285 |
+
if (!blocks || blocks.length === 0) {
|
| 7286 |
+
return null;
|
| 7287 |
}
|
| 7288 |
|
| 7289 |
+
return Object(external_wp_element_["createElement"])(provider["a" /* default */], {
|
| 7290 |
+
value: renderedBlocks,
|
| 7291 |
+
settings: settings
|
| 7292 |
+
}, __experimentalLive ? Object(external_wp_element_["createElement"])(LiveBlockPreview, {
|
| 7293 |
+
onClick: __experimentalOnClick
|
| 7294 |
+
}) : Object(external_wp_element_["createElement"])(auto, {
|
| 7295 |
+
viewportWidth: viewportWidth,
|
| 7296 |
+
__experimentalPadding: __experimentalPadding
|
| 7297 |
+
}));
|
| 7298 |
}
|
| 7299 |
/**
|
| 7300 |
+
* BlockPreview renders a preview of a block or array of blocks.
|
|
|
|
| 7301 |
*
|
| 7302 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md
|
|
|
|
| 7303 |
*
|
| 7304 |
+
* @param {Object} preview options for how the preview should be shown
|
| 7305 |
+
* @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.
|
| 7306 |
+
* @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.
|
| 7307 |
+
*
|
| 7308 |
+
* @return {WPComponent} The component to be rendered.
|
| 7309 |
*/
|
| 7310 |
|
| 7311 |
+
/* harmony default export */ var block_preview = __webpack_exports__["a"] = (Object(external_wp_element_["memo"])(BlockPreview));
|
| 7312 |
+
//# sourceMappingURL=index.js.map
|
| 7313 |
|
| 7314 |
+
/***/ }),
|
| 7315 |
+
/* 76 */,
|
| 7316 |
+
/* 77 */,
|
| 7317 |
+
/* 78 */,
|
| 7318 |
+
/* 79 */,
|
| 7319 |
+
/* 80 */,
|
| 7320 |
+
/* 81 */,
|
| 7321 |
+
/* 82 */,
|
| 7322 |
+
/* 83 */
|
| 7323 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 7324 |
+
|
| 7325 |
+
"use strict";
|
| 7326 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBlockDisplayInformation; });
|
| 7327 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
| 7328 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
| 7329 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
| 7330 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__);
|
| 7331 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
|
| 7332 |
/**
|
| 7333 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7334 |
*/
|
| 7335 |
|
| 7336 |
+
|
|
|
|
|
|
|
| 7337 |
/**
|
| 7338 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
| 7339 |
*/
|
| 7340 |
|
| 7341 |
+
|
| 7342 |
+
/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */
|
| 7343 |
+
|
|
|
|
|
|
|
|
|
|
| 7344 |
/**
|
| 7345 |
+
* Contains basic block's information for display reasons.
|
|
|
|
|
|
|
| 7346 |
*
|
| 7347 |
+
* @typedef {Object} WPBlockDisplayInformation
|
| 7348 |
*
|
| 7349 |
+
* @property {string} title Human-readable block type label.
|
| 7350 |
+
* @property {WPIcon} icon Block type icon.
|
| 7351 |
+
* @property {string} description A detailed block type description.
|
| 7352 |
*/
|
| 7353 |
|
| 7354 |
+
/**
|
| 7355 |
+
* Hook used to try to find a matching block variation and return
|
| 7356 |
+
* the appropriate information for display reasons. In order to
|
| 7357 |
+
* to try to find a match we need to things:
|
| 7358 |
+
* 1. Block's client id to extract it's current attributes.
|
| 7359 |
+
* 2. A block variation should have set `isActive` prop to a proper function.
|
| 7360 |
+
*
|
| 7361 |
+
* If for any reason a block variaton match cannot be found,
|
| 7362 |
+
* the returned information come from the Block Type.
|
| 7363 |
+
* If no blockType is found with the provided clientId, returns null.
|
| 7364 |
+
*
|
| 7365 |
+
* @param {string} clientId Block's client id.
|
| 7366 |
+
* @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.
|
| 7367 |
+
*/
|
| 7368 |
|
| 7369 |
+
function useBlockDisplayInformation(clientId) {
|
| 7370 |
+
return Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__["useSelect"])(select => {
|
| 7371 |
+
if (!clientId) return null;
|
| 7372 |
+
const {
|
| 7373 |
+
getBlockName,
|
| 7374 |
+
getBlockAttributes
|
| 7375 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_2__[/* store */ "a"]);
|
| 7376 |
+
const {
|
| 7377 |
+
getBlockType,
|
| 7378 |
+
getActiveBlockVariation
|
| 7379 |
+
} = select(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__["store"]);
|
| 7380 |
+
const blockName = getBlockName(clientId);
|
| 7381 |
+
const blockType = getBlockType(blockName);
|
| 7382 |
+
if (!blockType) return null;
|
| 7383 |
+
const attributes = getBlockAttributes(clientId);
|
| 7384 |
+
const match = getActiveBlockVariation(blockName, attributes);
|
| 7385 |
+
const blockTypeInfo = {
|
| 7386 |
+
title: blockType.title,
|
| 7387 |
+
icon: blockType.icon,
|
| 7388 |
+
description: blockType.description,
|
| 7389 |
+
anchor: attributes === null || attributes === void 0 ? void 0 : attributes.anchor
|
| 7390 |
+
};
|
| 7391 |
+
if (!match) return blockTypeInfo;
|
| 7392 |
+
return {
|
| 7393 |
+
title: match.title || blockType.title,
|
| 7394 |
+
icon: match.icon || blockType.icon,
|
| 7395 |
+
description: match.description || blockType.description
|
| 7396 |
+
};
|
| 7397 |
+
}, [clientId]);
|
| 7398 |
+
}
|
| 7399 |
+
//# sourceMappingURL=index.js.map
|
| 7400 |
|
| 7401 |
+
/***/ }),
|
| 7402 |
+
/* 84 */,
|
| 7403 |
+
/* 85 */,
|
| 7404 |
+
/* 86 */,
|
| 7405 |
+
/* 87 */
|
| 7406 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 7407 |
|
| 7408 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7409 |
|
| 7410 |
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 7411 |
+
var esm_extends = __webpack_require__(7);
|
|
|
|
| 7412 |
|
| 7413 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 7414 |
+
var external_wp_element_ = __webpack_require__(0);
|
|
|
|
|
|
|
| 7415 |
|
| 7416 |
+
// EXTERNAL MODULE: external "lodash"
|
| 7417 |
+
var external_lodash_ = __webpack_require__(2);
|
|
|
|
| 7418 |
|
| 7419 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 7420 |
+
var classnames = __webpack_require__(10);
|
| 7421 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
| 7422 |
|
| 7423 |
+
// EXTERNAL MODULE: external ["wp","a11y"]
|
| 7424 |
+
var external_wp_a11y_ = __webpack_require__(31);
|
|
|
|
|
|
|
| 7425 |
|
| 7426 |
+
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 7427 |
+
var external_wp_i18n_ = __webpack_require__(1);
|
|
|
|
| 7428 |
|
| 7429 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 7430 |
+
var external_wp_components_ = __webpack_require__(3);
|
|
|
|
|
|
|
|
|
|
| 7431 |
|
| 7432 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 7433 |
+
var external_wp_data_ = __webpack_require__(4);
|
|
|
|
|
|
|
|
|
|
| 7434 |
|
| 7435 |
+
// EXTERNAL MODULE: external ["wp","compose"]
|
| 7436 |
+
var external_wp_compose_ = __webpack_require__(9);
|
|
|
|
|
|
|
|
|
|
| 7437 |
|
| 7438 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 7439 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7440 |
|
| 7441 |
+
// EXTERNAL MODULE: ./packages/icons/build-module/library/plus.js
|
| 7442 |
+
var plus = __webpack_require__(145);
|
|
|
|
|
|
|
|
|
|
| 7443 |
|
| 7444 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter/menu.js + 7 modules
|
| 7445 |
+
var menu = __webpack_require__(233);
|
|
|
|
| 7446 |
|
| 7447 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter/search-results.js
|
| 7448 |
+
var search_results = __webpack_require__(220);
|
|
|
|
| 7449 |
|
| 7450 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
|
| 7451 |
+
var use_insertion_point = __webpack_require__(156);
|
|
|
|
| 7452 |
|
| 7453 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
|
| 7454 |
+
var use_patterns_state = __webpack_require__(157);
|
|
|
|
|
|
|
|
|
|
| 7455 |
|
| 7456 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-block-types-state.js
|
| 7457 |
+
var use_block_types_state = __webpack_require__(102);
|
|
|
|
|
|
|
| 7458 |
|
| 7459 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/index.js + 5 modules
|
| 7460 |
+
var store = __webpack_require__(13);
|
|
|
|
| 7461 |
|
| 7462 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/quick-inserter.js
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7464 |
|
|
|
|
|
|
|
| 7465 |
/**
|
| 7466 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7467 |
*/
|
| 7468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7469 |
/**
|
| 7470 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7471 |
*/
|
| 7472 |
|
| 7473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7474 |
|
|
|
|
|
|
|
|
|
|
| 7475 |
|
| 7476 |
+
|
|
|
|
|
|
|
| 7477 |
/**
|
| 7478 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7479 |
*/
|
| 7480 |
|
| 7481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7482 |
|
|
|
|
|
|
|
| 7483 |
|
|
|
|
|
|
|
| 7484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7485 |
|
| 7486 |
+
const SEARCH_THRESHOLD = 6;
|
| 7487 |
+
const SHOWN_BLOCK_TYPES = 6;
|
| 7488 |
+
const SHOWN_BLOCK_PATTERNS = 2;
|
| 7489 |
+
function QuickInserter({
|
| 7490 |
+
onSelect,
|
| 7491 |
+
rootClientId,
|
| 7492 |
+
clientId,
|
| 7493 |
+
isAppender
|
| 7494 |
+
}) {
|
| 7495 |
+
const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])('');
|
| 7496 |
+
const [destinationRootClientId, onInsertBlocks] = Object(use_insertion_point["a" /* default */])({
|
| 7497 |
+
onSelect,
|
| 7498 |
+
rootClientId,
|
| 7499 |
+
clientId,
|
| 7500 |
+
isAppender
|
| 7501 |
+
});
|
| 7502 |
+
const [blockTypes] = Object(use_block_types_state["a" /* default */])(destinationRootClientId, onInsertBlocks);
|
| 7503 |
+
const [patterns] = Object(use_patterns_state["a" /* default */])(onInsertBlocks, destinationRootClientId);
|
| 7504 |
+
const showPatterns = patterns.length && !!filterValue;
|
| 7505 |
+
const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD;
|
| 7506 |
+
const {
|
| 7507 |
+
setInserterIsOpened,
|
| 7508 |
+
insertionIndex
|
| 7509 |
+
} = Object(external_wp_data_["useSelect"])(select => {
|
| 7510 |
+
const {
|
| 7511 |
+
getSettings,
|
| 7512 |
+
getBlockIndex,
|
| 7513 |
+
getBlockCount
|
| 7514 |
+
} = select(store["a" /* store */]);
|
| 7515 |
+
const index = getBlockIndex(clientId, rootClientId);
|
| 7516 |
+
return {
|
| 7517 |
+
setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
|
| 7518 |
+
insertionIndex: index === -1 ? getBlockCount() : index
|
| 7519 |
+
};
|
| 7520 |
+
}, [clientId, rootClientId]);
|
| 7521 |
+
Object(external_wp_element_["useEffect"])(() => {
|
| 7522 |
+
if (setInserterIsOpened) {
|
| 7523 |
+
setInserterIsOpened(false);
|
| 7524 |
}
|
| 7525 |
+
}, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as
|
| 7526 |
+
// the insertion point can work as expected
|
| 7527 |
+
|
| 7528 |
+
const onBrowseAll = () => {
|
| 7529 |
+
setInserterIsOpened({
|
| 7530 |
+
rootClientId,
|
| 7531 |
+
insertionIndex
|
| 7532 |
+
});
|
| 7533 |
+
};
|
| 7534 |
+
|
| 7535 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 7536 |
+
className: classnames_default()('block-editor-inserter__quick-inserter', {
|
| 7537 |
+
'has-search': showSearch,
|
| 7538 |
+
'has-expand': setInserterIsOpened
|
| 7539 |
+
})
|
| 7540 |
+
}, showSearch && Object(external_wp_element_["createElement"])(external_wp_components_["SearchControl"], {
|
| 7541 |
+
className: "block-editor-inserter__search",
|
| 7542 |
+
value: filterValue,
|
| 7543 |
+
onChange: value => {
|
| 7544 |
+
setFilterValue(value);
|
| 7545 |
+
},
|
| 7546 |
+
label: Object(external_wp_i18n_["__"])('Search for blocks and patterns'),
|
| 7547 |
+
placeholder: Object(external_wp_i18n_["__"])('Search')
|
| 7548 |
+
}), Object(external_wp_element_["createElement"])("div", {
|
| 7549 |
+
className: "block-editor-inserter__quick-inserter-results"
|
| 7550 |
+
}, Object(external_wp_element_["createElement"])(search_results["a" /* default */], {
|
| 7551 |
+
filterValue: filterValue,
|
| 7552 |
+
onSelect: onSelect,
|
| 7553 |
+
rootClientId: rootClientId,
|
| 7554 |
+
clientId: clientId,
|
| 7555 |
+
isAppender: isAppender,
|
| 7556 |
+
maxBlockPatterns: showPatterns ? SHOWN_BLOCK_PATTERNS : 0,
|
| 7557 |
+
maxBlockTypes: SHOWN_BLOCK_TYPES,
|
| 7558 |
+
isDraggable: false
|
| 7559 |
+
})), setInserterIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
| 7560 |
+
className: "block-editor-inserter__quick-inserter-expand",
|
| 7561 |
+
onClick: onBrowseAll,
|
| 7562 |
+
"aria-label": Object(external_wp_i18n_["__"])('Browse all. This will open the main inserter panel in the editor toolbar.')
|
| 7563 |
+
}, Object(external_wp_i18n_["__"])('Browse all')));
|
| 7564 |
+
}
|
| 7565 |
+
//# sourceMappingURL=quick-inserter.js.map
|
| 7566 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/index.js
|
| 7567 |
+
|
| 7568 |
+
|
| 7569 |
|
|
|
|
|
|
|
| 7570 |
/**
|
| 7571 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7572 |
*/
|
| 7573 |
|
| 7574 |
|
| 7575 |
+
/**
|
| 7576 |
+
* WordPress dependencies
|
| 7577 |
+
*/
|
| 7578 |
+
|
| 7579 |
+
|
| 7580 |
+
|
| 7581 |
+
|
| 7582 |
+
|
| 7583 |
+
|
| 7584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7586 |
|
|
|
|
|
|
|
| 7587 |
/**
|
| 7588 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7589 |
*/
|
| 7590 |
|
| 7591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7592 |
|
| 7593 |
|
|
|
|
| 7594 |
|
| 7595 |
+
const defaultRenderToggle = ({
|
| 7596 |
+
onToggle,
|
| 7597 |
+
disabled,
|
| 7598 |
+
isOpen,
|
| 7599 |
+
blockTitle,
|
| 7600 |
+
hasSingleBlockType,
|
| 7601 |
+
toggleProps = {}
|
| 7602 |
+
}) => {
|
| 7603 |
+
let label;
|
| 7604 |
|
| 7605 |
+
if (hasSingleBlockType) {
|
| 7606 |
+
label = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block when there is only one
|
| 7607 |
+
Object(external_wp_i18n_["_x"])('Add %s', 'directly add the only allowed block'), blockTitle);
|
| 7608 |
+
} else {
|
| 7609 |
+
label = Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button');
|
| 7610 |
+
}
|
| 7611 |
|
| 7612 |
+
const {
|
| 7613 |
+
onClick,
|
| 7614 |
+
...rest
|
| 7615 |
+
} = toggleProps; // Handle both onClick functions from the toggle and the parent component
|
| 7616 |
+
|
| 7617 |
+
function handleClick(event) {
|
| 7618 |
+
if (onToggle) {
|
| 7619 |
+
onToggle(event);
|
| 7620 |
}
|
|
|
|
|
|
|
|
|
|
| 7621 |
|
| 7622 |
+
if (onClick) {
|
| 7623 |
+
onClick(event);
|
| 7624 |
+
}
|
| 7625 |
+
}
|
| 7626 |
|
| 7627 |
+
return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({
|
| 7628 |
+
icon: plus["a" /* default */],
|
| 7629 |
+
label: label,
|
| 7630 |
+
tooltipPosition: "bottom",
|
| 7631 |
+
onClick: handleClick,
|
| 7632 |
+
className: "block-editor-inserter__toggle",
|
| 7633 |
+
"aria-haspopup": !hasSingleBlockType ? 'true' : false,
|
| 7634 |
+
"aria-expanded": !hasSingleBlockType ? isOpen : false,
|
| 7635 |
+
disabled: disabled
|
| 7636 |
+
}, rest));
|
| 7637 |
+
};
|
| 7638 |
|
| 7639 |
+
class inserter_Inserter extends external_wp_element_["Component"] {
|
| 7640 |
+
constructor() {
|
| 7641 |
+
super(...arguments);
|
| 7642 |
+
this.onToggle = this.onToggle.bind(this);
|
| 7643 |
+
this.renderToggle = this.renderToggle.bind(this);
|
| 7644 |
+
this.renderContent = this.renderContent.bind(this);
|
| 7645 |
}
|
| 7646 |
|
| 7647 |
+
onToggle(isOpen) {
|
| 7648 |
+
const {
|
| 7649 |
+
onToggle
|
| 7650 |
+
} = this.props; // Surface toggle callback to parent component
|
| 7651 |
|
| 7652 |
+
if (onToggle) {
|
| 7653 |
+
onToggle(isOpen);
|
| 7654 |
+
}
|
| 7655 |
+
}
|
| 7656 |
+
/**
|
| 7657 |
+
* Render callback to display Dropdown toggle element.
|
| 7658 |
+
*
|
| 7659 |
+
* @param {Object} options
|
| 7660 |
+
* @param {Function} options.onToggle Callback to invoke when toggle is
|
| 7661 |
+
* pressed.
|
| 7662 |
+
* @param {boolean} options.isOpen Whether dropdown is currently open.
|
| 7663 |
+
*
|
| 7664 |
+
* @return {WPElement} Dropdown toggle element.
|
| 7665 |
+
*/
|
| 7666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7667 |
|
| 7668 |
+
renderToggle({
|
| 7669 |
+
onToggle,
|
| 7670 |
+
isOpen
|
| 7671 |
+
}) {
|
| 7672 |
+
const {
|
| 7673 |
+
disabled,
|
| 7674 |
+
blockTitle,
|
| 7675 |
+
hasSingleBlockType,
|
| 7676 |
+
toggleProps,
|
| 7677 |
+
hasItems,
|
| 7678 |
+
renderToggle = defaultRenderToggle
|
| 7679 |
+
} = this.props;
|
| 7680 |
+
return renderToggle({
|
| 7681 |
+
onToggle,
|
| 7682 |
+
isOpen,
|
| 7683 |
+
disabled: disabled || !hasItems,
|
| 7684 |
+
blockTitle,
|
| 7685 |
+
hasSingleBlockType,
|
| 7686 |
+
toggleProps
|
| 7687 |
+
});
|
| 7688 |
}
|
| 7689 |
+
/**
|
| 7690 |
+
* Render callback to display Dropdown content element.
|
| 7691 |
+
*
|
| 7692 |
+
* @param {Object} options
|
| 7693 |
+
* @param {Function} options.onClose Callback to invoke when dropdown is
|
| 7694 |
+
* closed.
|
| 7695 |
+
*
|
| 7696 |
+
* @return {WPElement} Dropdown content element.
|
| 7697 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7698 |
|
| 7699 |
|
| 7700 |
+
renderContent({
|
| 7701 |
+
onClose
|
| 7702 |
+
}) {
|
| 7703 |
const {
|
| 7704 |
+
rootClientId,
|
| 7705 |
+
clientId,
|
| 7706 |
+
isAppender,
|
| 7707 |
+
showInserterHelpPanel,
|
| 7708 |
+
// This prop is experimental to give some time for the quick inserter to mature
|
| 7709 |
+
// Feel free to make them stable after a few releases.
|
| 7710 |
+
__experimentalIsQuick: isQuick
|
| 7711 |
+
} = this.props;
|
| 7712 |
|
| 7713 |
+
if (isQuick) {
|
| 7714 |
+
return Object(external_wp_element_["createElement"])(QuickInserter, {
|
| 7715 |
+
onSelect: () => {
|
| 7716 |
+
onClose();
|
| 7717 |
+
},
|
| 7718 |
+
rootClientId: rootClientId,
|
| 7719 |
+
clientId: clientId,
|
| 7720 |
+
isAppender: isAppender
|
| 7721 |
+
});
|
| 7722 |
}
|
| 7723 |
|
| 7724 |
+
return Object(external_wp_element_["createElement"])(menu["a" /* default */], {
|
| 7725 |
+
onSelect: () => {
|
| 7726 |
+
onClose();
|
| 7727 |
+
},
|
| 7728 |
+
rootClientId: rootClientId,
|
| 7729 |
+
clientId: clientId,
|
| 7730 |
+
isAppender: isAppender,
|
| 7731 |
+
showInserterHelpPanel: showInserterHelpPanel
|
| 7732 |
+
});
|
| 7733 |
+
}
|
| 7734 |
|
| 7735 |
+
render() {
|
| 7736 |
+
const {
|
| 7737 |
+
position,
|
| 7738 |
+
hasSingleBlockType,
|
| 7739 |
+
insertOnlyAllowedBlock,
|
| 7740 |
+
__experimentalIsQuick: isQuick,
|
| 7741 |
+
onSelectOrClose
|
| 7742 |
+
} = this.props;
|
| 7743 |
|
| 7744 |
+
if (hasSingleBlockType) {
|
| 7745 |
+
return this.renderToggle({
|
| 7746 |
+
onToggle: insertOnlyAllowedBlock
|
| 7747 |
+
});
|
| 7748 |
+
}
|
| 7749 |
+
|
| 7750 |
+
return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
|
| 7751 |
+
className: "block-editor-inserter",
|
| 7752 |
+
contentClassName: classnames_default()('block-editor-inserter__popover', {
|
| 7753 |
+
'is-quick': isQuick
|
| 7754 |
+
}),
|
| 7755 |
+
position: position,
|
| 7756 |
+
onToggle: this.onToggle,
|
| 7757 |
+
expandOnMobile: true,
|
| 7758 |
+
headerTitle: Object(external_wp_i18n_["__"])('Add a block'),
|
| 7759 |
+
renderToggle: this.renderToggle,
|
| 7760 |
+
renderContent: this.renderContent,
|
| 7761 |
+
onClose: onSelectOrClose
|
| 7762 |
});
|
| 7763 |
}
|
| 7764 |
|
| 7765 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7766 |
|
| 7767 |
+
/* harmony default export */ var inserter = __webpack_exports__["a"] = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
|
| 7768 |
+
clientId,
|
| 7769 |
+
rootClientId
|
| 7770 |
+
}) => {
|
| 7771 |
+
const {
|
| 7772 |
+
getBlockRootClientId,
|
| 7773 |
+
hasInserterItems,
|
| 7774 |
+
__experimentalGetAllowedBlocks
|
| 7775 |
+
} = select(store["a" /* store */]);
|
| 7776 |
+
const {
|
| 7777 |
+
getBlockVariations
|
| 7778 |
+
} = select(external_wp_blocks_["store"]);
|
| 7779 |
+
rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
|
| 7780 |
|
| 7781 |
+
const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7782 |
|
| 7783 |
+
const hasSingleBlockType = Object(external_lodash_["size"])(allowedBlocks) === 1 && Object(external_lodash_["size"])(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0;
|
| 7784 |
+
let allowedBlockType = false;
|
|
|
|
|
|
|
|
|
|
| 7785 |
|
| 7786 |
+
if (hasSingleBlockType) {
|
| 7787 |
+
allowedBlockType = allowedBlocks[0];
|
| 7788 |
+
}
|
|
|
|
|
|
|
| 7789 |
|
| 7790 |
+
return {
|
| 7791 |
+
hasItems: hasInserterItems(rootClientId),
|
| 7792 |
+
hasSingleBlockType,
|
| 7793 |
+
blockTitle: allowedBlockType ? allowedBlockType.title : '',
|
| 7794 |
+
allowedBlockType,
|
| 7795 |
+
rootClientId
|
| 7796 |
+
};
|
| 7797 |
+
}), Object(external_wp_data_["withDispatch"])((dispatch, ownProps, {
|
| 7798 |
+
select
|
| 7799 |
+
}) => {
|
| 7800 |
+
return {
|
| 7801 |
+
insertOnlyAllowedBlock() {
|
| 7802 |
+
const {
|
| 7803 |
+
rootClientId,
|
| 7804 |
+
clientId,
|
| 7805 |
+
isAppender,
|
| 7806 |
+
hasSingleBlockType,
|
| 7807 |
+
allowedBlockType,
|
| 7808 |
+
onSelectOrClose
|
| 7809 |
+
} = ownProps;
|
| 7810 |
|
| 7811 |
+
if (!hasSingleBlockType) {
|
| 7812 |
+
return;
|
| 7813 |
+
}
|
| 7814 |
|
| 7815 |
+
function getInsertionIndex() {
|
| 7816 |
+
const {
|
| 7817 |
+
getBlockIndex,
|
| 7818 |
+
getBlockSelectionEnd,
|
| 7819 |
+
getBlockOrder,
|
| 7820 |
+
getBlockRootClientId
|
| 7821 |
+
} = select(store["a" /* store */]); // If the clientId is defined, we insert at the position of the block.
|
| 7822 |
|
| 7823 |
+
if (clientId) {
|
| 7824 |
+
return getBlockIndex(clientId, rootClientId);
|
| 7825 |
+
} // If there a selected block, we insert after the selected block.
|
|
|
|
|
|
|
| 7826 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7827 |
|
| 7828 |
+
const end = getBlockSelectionEnd();
|
|
|
|
|
|
|
| 7829 |
|
| 7830 |
+
if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
|
| 7831 |
+
return getBlockIndex(end, rootClientId) + 1;
|
| 7832 |
+
} // Otherwise, we insert at the end of the current rootClientId
|
| 7833 |
|
|
|
|
|
|
|
| 7834 |
|
| 7835 |
+
return getBlockOrder(rootClientId).length;
|
| 7836 |
+
}
|
|
|
|
|
|
|
| 7837 |
|
| 7838 |
+
const {
|
| 7839 |
+
insertBlock
|
| 7840 |
+
} = dispatch(store["a" /* store */]);
|
| 7841 |
+
const blockToInsert = Object(external_wp_blocks_["createBlock"])(allowedBlockType.name);
|
| 7842 |
+
insertBlock(blockToInsert, getInsertionIndex(), rootClientId);
|
| 7843 |
|
| 7844 |
+
if (onSelectOrClose) {
|
| 7845 |
+
onSelectOrClose();
|
| 7846 |
+
}
|
|
|
|
|
|
|
| 7847 |
|
| 7848 |
+
const message = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block that has been added
|
| 7849 |
+
Object(external_wp_i18n_["__"])('%s block added'), allowedBlockType.title);
|
| 7850 |
+
Object(external_wp_a11y_["speak"])(message);
|
| 7851 |
+
}
|
|
|
|
| 7852 |
|
| 7853 |
+
};
|
| 7854 |
+
}), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
|
| 7855 |
+
// a way to detect the global Inserter.
|
| 7856 |
+
Object(external_wp_compose_["ifCondition"])(({
|
| 7857 |
+
hasItems,
|
| 7858 |
+
isAppender,
|
| 7859 |
+
rootClientId,
|
| 7860 |
+
clientId
|
| 7861 |
+
}) => hasItems || !isAppender && !rootClientId && !clientId)])(inserter_Inserter));
|
| 7862 |
+
//# sourceMappingURL=index.js.map
|
| 7863 |
|
| 7864 |
+
/***/ }),
|
| 7865 |
+
/* 88 */,
|
| 7866 |
+
/* 89 */
|
| 7867 |
+
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
| 7868 |
|
| 7869 |
+
// shim for using process in browser
|
| 7870 |
+
var process = module.exports = {};
|
|
|
|
| 7871 |
|
| 7872 |
+
// cached from whatever global is present so that test runners that stub it
|
| 7873 |
+
// don't break things. But we need to wrap it in a try catch in case it is
|
| 7874 |
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
| 7875 |
+
// function because try/catches deoptimize in certain engines.
|
| 7876 |
|
| 7877 |
+
var cachedSetTimeout;
|
| 7878 |
+
var cachedClearTimeout;
|
|
|
|
|
|
|
| 7879 |
|
| 7880 |
+
function defaultSetTimout() {
|
| 7881 |
+
throw new Error('setTimeout has not been defined');
|
| 7882 |
+
}
|
| 7883 |
+
function defaultClearTimeout () {
|
| 7884 |
+
throw new Error('clearTimeout has not been defined');
|
| 7885 |
+
}
|
| 7886 |
+
(function () {
|
| 7887 |
+
try {
|
| 7888 |
+
if (typeof setTimeout === 'function') {
|
| 7889 |
+
cachedSetTimeout = setTimeout;
|
| 7890 |
+
} else {
|
| 7891 |
+
cachedSetTimeout = defaultSetTimout;
|
| 7892 |
}
|
| 7893 |
+
} catch (e) {
|
| 7894 |
+
cachedSetTimeout = defaultSetTimout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7895 |
}
|
| 7896 |
+
try {
|
| 7897 |
+
if (typeof clearTimeout === 'function') {
|
| 7898 |
+
cachedClearTimeout = clearTimeout;
|
| 7899 |
+
} else {
|
| 7900 |
+
cachedClearTimeout = defaultClearTimeout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7901 |
}
|
| 7902 |
+
} catch (e) {
|
| 7903 |
+
cachedClearTimeout = defaultClearTimeout;
|
| 7904 |
+
}
|
| 7905 |
+
} ())
|
| 7906 |
+
function runTimeout(fun) {
|
| 7907 |
+
if (cachedSetTimeout === setTimeout) {
|
| 7908 |
+
//normal enviroments in sane situations
|
| 7909 |
+
return setTimeout(fun, 0);
|
| 7910 |
+
}
|
| 7911 |
+
// if setTimeout wasn't available but was latter defined
|
| 7912 |
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
| 7913 |
+
cachedSetTimeout = setTimeout;
|
| 7914 |
+
return setTimeout(fun, 0);
|
| 7915 |
+
}
|
| 7916 |
+
try {
|
| 7917 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
| 7918 |
+
return cachedSetTimeout(fun, 0);
|
| 7919 |
+
} catch(e){
|
| 7920 |
+
try {
|
| 7921 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
| 7922 |
+
return cachedSetTimeout.call(null, fun, 0);
|
| 7923 |
+
} catch(e){
|
| 7924 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
| 7925 |
+
return cachedSetTimeout.call(this, fun, 0);
|
|
|
|
| 7926 |
}
|
| 7927 |
+
}
|
| 7928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7929 |
|
| 7930 |
+
}
|
| 7931 |
+
function runClearTimeout(marker) {
|
| 7932 |
+
if (cachedClearTimeout === clearTimeout) {
|
| 7933 |
+
//normal enviroments in sane situations
|
| 7934 |
+
return clearTimeout(marker);
|
| 7935 |
+
}
|
| 7936 |
+
// if clearTimeout wasn't available but was latter defined
|
| 7937 |
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
| 7938 |
+
cachedClearTimeout = clearTimeout;
|
| 7939 |
+
return clearTimeout(marker);
|
| 7940 |
+
}
|
| 7941 |
+
try {
|
| 7942 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
| 7943 |
+
return cachedClearTimeout(marker);
|
| 7944 |
+
} catch (e){
|
| 7945 |
+
try {
|
| 7946 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
| 7947 |
+
return cachedClearTimeout.call(null, marker);
|
| 7948 |
+
} catch (e){
|
| 7949 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
| 7950 |
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
| 7951 |
+
return cachedClearTimeout.call(this, marker);
|
| 7952 |
}
|
| 7953 |
+
}
|
| 7954 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7955 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7956 |
|
| 7957 |
+
}
|
| 7958 |
+
var queue = [];
|
| 7959 |
+
var draining = false;
|
| 7960 |
+
var currentQueue;
|
| 7961 |
+
var queueIndex = -1;
|
| 7962 |
|
| 7963 |
+
function cleanUpNextTick() {
|
| 7964 |
+
if (!draining || !currentQueue) {
|
| 7965 |
+
return;
|
| 7966 |
+
}
|
| 7967 |
+
draining = false;
|
| 7968 |
+
if (currentQueue.length) {
|
| 7969 |
+
queue = currentQueue.concat(queue);
|
| 7970 |
+
} else {
|
| 7971 |
+
queueIndex = -1;
|
| 7972 |
+
}
|
| 7973 |
+
if (queue.length) {
|
| 7974 |
+
drainQueue();
|
| 7975 |
+
}
|
| 7976 |
+
}
|
| 7977 |
|
| 7978 |
+
function drainQueue() {
|
| 7979 |
+
if (draining) {
|
| 7980 |
+
return;
|
| 7981 |
+
}
|
| 7982 |
+
var timeout = runTimeout(cleanUpNextTick);
|
| 7983 |
+
draining = true;
|
|
|
|
| 7984 |
|
| 7985 |
+
var len = queue.length;
|
| 7986 |
+
while(len) {
|
| 7987 |
+
currentQueue = queue;
|
| 7988 |
+
queue = [];
|
| 7989 |
+
while (++queueIndex < len) {
|
| 7990 |
+
if (currentQueue) {
|
| 7991 |
+
currentQueue[queueIndex].run();
|
| 7992 |
}
|
|
|
|
|
|
|
|
|
|
| 7993 |
}
|
| 7994 |
+
queueIndex = -1;
|
| 7995 |
+
len = queue.length;
|
|
|
|
|
|
|
|
|
|
| 7996 |
}
|
| 7997 |
+
currentQueue = null;
|
| 7998 |
+
draining = false;
|
| 7999 |
+
runClearTimeout(timeout);
|
| 8000 |
+
}
|
| 8001 |
|
| 8002 |
+
process.nextTick = function (fun) {
|
| 8003 |
+
var args = new Array(arguments.length - 1);
|
| 8004 |
+
if (arguments.length > 1) {
|
| 8005 |
+
for (var i = 1; i < arguments.length; i++) {
|
| 8006 |
+
args[i - 1] = arguments[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8007 |
}
|
| 8008 |
+
}
|
| 8009 |
+
queue.push(new Item(fun, args));
|
| 8010 |
+
if (queue.length === 1 && !draining) {
|
| 8011 |
+
runTimeout(drainQueue);
|
| 8012 |
+
}
|
| 8013 |
+
};
|
| 8014 |
|
| 8015 |
+
// v8 likes predictible objects
|
| 8016 |
+
function Item(fun, array) {
|
| 8017 |
+
this.fun = fun;
|
| 8018 |
+
this.array = array;
|
| 8019 |
+
}
|
| 8020 |
+
Item.prototype.run = function () {
|
| 8021 |
+
this.fun.apply(null, this.array);
|
| 8022 |
+
};
|
| 8023 |
+
process.title = 'browser';
|
| 8024 |
+
process.browser = true;
|
| 8025 |
+
process.env = {};
|
| 8026 |
+
process.argv = [];
|
| 8027 |
+
process.version = ''; // empty string to avoid regexp issues
|
| 8028 |
+
process.versions = {};
|
| 8029 |
+
|
| 8030 |
+
function noop() {}
|
| 8031 |
+
|
| 8032 |
+
process.on = noop;
|
| 8033 |
+
process.addListener = noop;
|
| 8034 |
+
process.once = noop;
|
| 8035 |
+
process.off = noop;
|
| 8036 |
+
process.removeListener = noop;
|
| 8037 |
+
process.removeAllListeners = noop;
|
| 8038 |
+
process.emit = noop;
|
| 8039 |
+
process.prependListener = noop;
|
| 8040 |
+
process.prependOnceListener = noop;
|
| 8041 |
+
|
| 8042 |
+
process.listeners = function (name) { return [] }
|
| 8043 |
+
|
| 8044 |
+
process.binding = function (name) {
|
| 8045 |
+
throw new Error('process.binding is not supported');
|
| 8046 |
+
};
|
| 8047 |
|
| 8048 |
+
process.cwd = function () { return '/' };
|
| 8049 |
+
process.chdir = function (dir) {
|
| 8050 |
+
throw new Error('process.chdir is not supported');
|
| 8051 |
+
};
|
| 8052 |
+
process.umask = function() { return 0; };
|
| 8053 |
|
|
|
|
|
|
|
| 8054 |
|
| 8055 |
+
/***/ }),
|
| 8056 |
+
/* 90 */,
|
| 8057 |
+
/* 91 */,
|
| 8058 |
+
/* 92 */,
|
| 8059 |
+
/* 93 */,
|
| 8060 |
+
/* 94 */,
|
| 8061 |
+
/* 95 */,
|
| 8062 |
+
/* 96 */,
|
| 8063 |
+
/* 97 */
|
| 8064 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 8065 |
|
| 8066 |
+
"use strict";
|
| 8067 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BlockTitle; });
|
| 8068 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
| 8069 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
| 8070 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
| 8071 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
| 8072 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
| 8073 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
|
| 8074 |
+
/* harmony import */ var _use_block_display_information__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83);
|
| 8075 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
|
| 8076 |
+
/**
|
| 8077 |
+
* External dependencies
|
| 8078 |
+
*/
|
| 8079 |
|
|
|
|
| 8080 |
/**
|
| 8081 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8082 |
*/
|
| 8083 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8084 |
|
|
|
|
|
|
|
|
|
|
| 8085 |
|
|
|
|
|
|
|
| 8086 |
/**
|
| 8087 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8088 |
*/
|
| 8089 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8090 |
|
|
|
|
|
|
|
|
|
|
| 8091 |
|
|
|
|
|
|
|
| 8092 |
/**
|
| 8093 |
+
* Renders the block's configured title as a string, or empty if the title
|
| 8094 |
+
* cannot be determined.
|
| 8095 |
*
|
| 8096 |
+
* @example
|
|
|
|
| 8097 |
*
|
| 8098 |
+
* ```jsx
|
| 8099 |
+
* <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
|
| 8100 |
+
* ```
|
| 8101 |
+
*
|
| 8102 |
+
* @param {Object} props
|
| 8103 |
+
* @param {string} props.clientId Client ID of block.
|
| 8104 |
+
*
|
| 8105 |
+
* @return {?string} Block title.
|
| 8106 |
*/
|
| 8107 |
|
| 8108 |
+
function BlockTitle({
|
| 8109 |
+
clientId
|
| 8110 |
+
}) {
|
| 8111 |
+
const {
|
| 8112 |
+
attributes,
|
| 8113 |
+
name,
|
| 8114 |
+
reusableBlockTitle
|
| 8115 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => {
|
| 8116 |
+
if (!clientId) {
|
| 8117 |
+
return {};
|
| 8118 |
+
}
|
| 8119 |
|
| 8120 |
+
const {
|
| 8121 |
+
getBlockName,
|
| 8122 |
+
getBlockAttributes,
|
| 8123 |
+
__experimentalGetReusableBlockTitle
|
| 8124 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_4__[/* store */ "a"]);
|
| 8125 |
+
const blockName = getBlockName(clientId);
|
| 8126 |
+
|
| 8127 |
+
if (!blockName) {
|
| 8128 |
+
return {};
|
| 8129 |
+
}
|
| 8130 |
+
|
| 8131 |
+
const isReusable = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["isReusableBlock"])(Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["getBlockType"])(blockName));
|
| 8132 |
+
return {
|
| 8133 |
+
attributes: getBlockAttributes(clientId),
|
| 8134 |
+
name: blockName,
|
| 8135 |
+
reusableBlockTitle: isReusable && __experimentalGetReusableBlockTitle(getBlockAttributes(clientId).ref)
|
| 8136 |
+
};
|
| 8137 |
+
}, [clientId]);
|
| 8138 |
+
const blockInformation = Object(_use_block_display_information__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(clientId);
|
| 8139 |
+
if (!name || !blockInformation) return null;
|
| 8140 |
+
const blockType = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["getBlockType"])(name);
|
| 8141 |
+
const label = reusableBlockTitle || Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["__experimentalGetBlockLabel"])(blockType, attributes); // Label will fallback to the title if no label is defined for the current
|
| 8142 |
+
// label context. If the label is defined we prioritize it over possible
|
| 8143 |
+
// possible block variation title match.
|
| 8144 |
+
|
| 8145 |
+
if (label !== blockType.title) {
|
| 8146 |
+
return Object(lodash__WEBPACK_IMPORTED_MODULE_0__["truncate"])(label, {
|
| 8147 |
+
length: 35
|
| 8148 |
+
});
|
| 8149 |
}
|
| 8150 |
|
| 8151 |
+
return blockInformation.title;
|
| 8152 |
}
|
| 8153 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8154 |
|
| 8155 |
+
/***/ }),
|
| 8156 |
+
/* 98 */,
|
| 8157 |
+
/* 99 */,
|
| 8158 |
+
/* 100 */,
|
| 8159 |
+
/* 101 */
|
| 8160 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
| 8161 |
|
| 8162 |
+
"use strict";
|
|
|
|
| 8163 |
|
| 8164 |
+
// EXPORTS
|
| 8165 |
+
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ IntersectionObserver; });
|
| 8166 |
+
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ BlockList; });
|
| 8167 |
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BlockListItems; });
|
| 8168 |
|
| 8169 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 8170 |
+
var external_wp_element_ = __webpack_require__(0);
|
|
|
|
| 8171 |
|
| 8172 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 8173 |
+
var classnames = __webpack_require__(10);
|
| 8174 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
|
|
|
|
|
|
| 8175 |
|
| 8176 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 8177 |
+
var external_wp_data_ = __webpack_require__(4);
|
|
|
|
|
|
|
| 8178 |
|
| 8179 |
+
// EXTERNAL MODULE: external ["wp","compose"]
|
| 8180 |
+
var external_wp_compose_ = __webpack_require__(9);
|
|
|
|
|
|
|
| 8181 |
|
| 8182 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-list/block.js + 6 modules
|
| 8183 |
+
var block = __webpack_require__(163);
|
| 8184 |
|
| 8185 |
+
// EXTERNAL MODULE: external "lodash"
|
| 8186 |
+
var external_lodash_ = __webpack_require__(2);
|
|
|
|
|
|
|
|
|
|
| 8187 |
|
| 8188 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 8189 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
| 8190 |
|
| 8191 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/default-block-appender/index.js
|
| 8192 |
+
var default_block_appender = __webpack_require__(149);
|
|
|
|
| 8193 |
|
| 8194 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/button-block-appender/index.js
|
| 8195 |
+
var button_block_appender = __webpack_require__(137);
|
| 8196 |
+
|
| 8197 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/index.js + 5 modules
|
| 8198 |
+
var store = __webpack_require__(13);
|
| 8199 |
+
|
| 8200 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list-appender/index.js
|
| 8201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8202 |
|
|
|
|
|
|
|
| 8203 |
/**
|
| 8204 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8205 |
*/
|
| 8206 |
|
| 8207 |
|
| 8208 |
+
/**
|
| 8209 |
+
* WordPress dependencies
|
| 8210 |
+
*/
|
| 8211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8214 |
|
| 8215 |
+
/**
|
| 8216 |
+
* Internal dependencies
|
| 8217 |
+
*/
|
| 8218 |
|
|
|
|
|
|
|
|
|
|
| 8219 |
|
| 8220 |
|
| 8221 |
+
// A Context to store the map of the appender map.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8222 |
|
| 8223 |
+
const AppenderNodesContext = Object(external_wp_element_["createContext"])();
|
| 8224 |
|
| 8225 |
+
function stopPropagation(event) {
|
| 8226 |
+
event.stopPropagation();
|
| 8227 |
+
}
|
|
|
|
|
|
|
| 8228 |
|
| 8229 |
+
function BlockListAppender({
|
| 8230 |
+
blockClientIds,
|
| 8231 |
+
rootClientId,
|
| 8232 |
+
canInsertDefaultBlock,
|
| 8233 |
+
isLocked,
|
| 8234 |
+
renderAppender: CustomAppender,
|
| 8235 |
+
className,
|
| 8236 |
+
selectedBlockClientId,
|
| 8237 |
+
tagName: TagName = 'div'
|
| 8238 |
+
}) {
|
| 8239 |
+
if (isLocked || CustomAppender === false) {
|
| 8240 |
+
return null;
|
| 8241 |
}
|
| 8242 |
|
| 8243 |
+
let appender;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8244 |
|
| 8245 |
+
if (CustomAppender) {
|
| 8246 |
+
// Prefer custom render prop if provided.
|
| 8247 |
+
appender = Object(external_wp_element_["createElement"])(CustomAppender, null);
|
| 8248 |
+
} else {
|
| 8249 |
+
const isDocumentAppender = !rootClientId;
|
| 8250 |
+
const isParentSelected = selectedBlockClientId === rootClientId;
|
| 8251 |
+
const isAnotherDefaultAppenderAlreadyDisplayed = selectedBlockClientId && !blockClientIds.includes(selectedBlockClientId);
|
| 8252 |
|
| 8253 |
+
if (!isDocumentAppender && !isParentSelected && (!selectedBlockClientId || isAnotherDefaultAppenderAlreadyDisplayed)) {
|
| 8254 |
+
return null;
|
| 8255 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8256 |
|
| 8257 |
+
if (canInsertDefaultBlock) {
|
| 8258 |
+
// Render the default block appender when renderAppender has not been
|
| 8259 |
+
// provided and the context supports use of the default appender.
|
| 8260 |
+
appender = Object(external_wp_element_["createElement"])(default_block_appender["a" /* default */], {
|
| 8261 |
+
rootClientId: rootClientId,
|
| 8262 |
+
lastBlockClientId: Object(external_lodash_["last"])(blockClientIds)
|
| 8263 |
+
});
|
| 8264 |
+
} else {
|
| 8265 |
+
// Fallback in the case no renderAppender has been provided and the
|
| 8266 |
+
// default block can't be inserted.
|
| 8267 |
+
appender = Object(external_wp_element_["createElement"])(button_block_appender["b" /* default */], {
|
| 8268 |
+
rootClientId: rootClientId,
|
| 8269 |
+
className: "block-list-appender__toggle"
|
| 8270 |
+
});
|
| 8271 |
+
}
|
| 8272 |
}
|
| 8273 |
|
| 8274 |
+
return Object(external_wp_element_["createElement"])(TagName // A `tabIndex` is used on the wrapping `div` element in order to
|
| 8275 |
+
// force a focus event to occur when an appender `button` element
|
| 8276 |
+
// is clicked. In some browsers (Firefox, Safari), button clicks do
|
| 8277 |
+
// not emit a focus event, which could cause this event to propagate
|
| 8278 |
+
// unexpectedly. The `tabIndex` ensures that the interaction is
|
| 8279 |
+
// captured as a focus, without also adding an extra tab stop.
|
| 8280 |
+
//
|
| 8281 |
+
// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
| 8282 |
+
, {
|
| 8283 |
+
tabIndex: -1 // Prevent the block from being selected when the appender is
|
| 8284 |
+
// clicked.
|
| 8285 |
+
,
|
| 8286 |
+
onFocus: stopPropagation,
|
| 8287 |
+
className: classnames_default()('block-list-appender', className)
|
| 8288 |
+
}, appender);
|
| 8289 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8290 |
|
| 8291 |
+
/* harmony default export */ var block_list_appender = (Object(external_wp_data_["withSelect"])((select, {
|
| 8292 |
+
rootClientId
|
| 8293 |
+
}) => {
|
| 8294 |
+
const {
|
| 8295 |
+
getBlockOrder,
|
| 8296 |
+
canInsertBlockType,
|
| 8297 |
+
getTemplateLock,
|
| 8298 |
+
getSelectedBlockClientId
|
| 8299 |
+
} = select(store["a" /* store */]);
|
| 8300 |
+
return {
|
| 8301 |
+
isLocked: !!getTemplateLock(rootClientId),
|
| 8302 |
+
blockClientIds: getBlockOrder(rootClientId),
|
| 8303 |
+
canInsertDefaultBlock: canInsertBlockType(Object(external_wp_blocks_["getDefaultBlockName"])(), rootClientId),
|
| 8304 |
+
selectedBlockClientId: getSelectedBlockClientId()
|
| 8305 |
+
};
|
| 8306 |
+
})(BlockListAppender));
|
| 8307 |
+
//# sourceMappingURL=index.js.map
|
| 8308 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/use-block-drop-zone/index.js
|
| 8309 |
+
var use_block_drop_zone = __webpack_require__(219);
|
| 8310 |
|
| 8311 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-tools/insertion-point.js
|
| 8312 |
+
var insertion_point = __webpack_require__(142);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8313 |
|
| 8314 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-in-between-inserter.js
|
|
|
|
| 8315 |
/**
|
| 8316 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8317 |
*/
|
| 8318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8319 |
|
|
|
|
|
|
|
|
|
|
| 8320 |
|
|
|
|
|
|
|
| 8321 |
/**
|
| 8322 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8323 |
*/
|
| 8324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8326 |
|
| 8327 |
+
function useInBetweenInserter() {
|
| 8328 |
+
const openRef = Object(external_wp_element_["useContext"])(insertion_point["a" /* InsertionPointOpenRef */]);
|
| 8329 |
+
const hasReducedUI = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).getSettings().hasReducedUI, []);
|
| 8330 |
+
const {
|
| 8331 |
+
getBlockListSettings,
|
| 8332 |
+
getBlockRootClientId,
|
| 8333 |
+
getBlockIndex,
|
| 8334 |
+
isBlockInsertionPointVisible,
|
| 8335 |
+
isMultiSelecting,
|
| 8336 |
+
getSelectedBlockClientIds,
|
| 8337 |
+
getTemplateLock
|
| 8338 |
+
} = Object(external_wp_data_["useSelect"])(store["a" /* store */]);
|
| 8339 |
+
const {
|
| 8340 |
+
showInsertionPoint,
|
| 8341 |
+
hideInsertionPoint
|
| 8342 |
+
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
|
| 8343 |
+
return Object(external_wp_compose_["useRefEffect"])(node => {
|
| 8344 |
+
if (hasReducedUI) {
|
| 8345 |
+
return;
|
| 8346 |
+
}
|
| 8347 |
|
| 8348 |
+
function onMouseMove(event) {
|
| 8349 |
+
var _getBlockListSettings;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8350 |
|
| 8351 |
+
if (openRef.current) {
|
| 8352 |
+
return;
|
| 8353 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8354 |
|
| 8355 |
+
if (isMultiSelecting()) {
|
| 8356 |
+
return;
|
| 8357 |
+
}
|
|
|
|
| 8358 |
|
| 8359 |
+
if (!event.target.classList.contains('block-editor-block-list__layout')) {
|
| 8360 |
+
if (isBlockInsertionPointVisible()) {
|
| 8361 |
+
hideInsertionPoint();
|
| 8362 |
}
|
| 8363 |
|
| 8364 |
+
return;
|
| 8365 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8366 |
|
| 8367 |
+
let rootClientId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8368 |
|
| 8369 |
+
if (!event.target.classList.contains('is-root-container')) {
|
| 8370 |
+
const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
|
| 8371 |
+
rootClientId = blockElement.getAttribute('data-block');
|
| 8372 |
+
} // Don't set the insertion point if the template is locked.
|
| 8373 |
+
|
| 8374 |
+
|
| 8375 |
+
if (getTemplateLock(rootClientId)) {
|
| 8376 |
+
return;
|
| 8377 |
}
|
| 8378 |
|
| 8379 |
+
const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical';
|
| 8380 |
+
const rect = event.target.getBoundingClientRect();
|
| 8381 |
+
const offsetTop = event.clientY - rect.top;
|
| 8382 |
+
const offsetLeft = event.clientX - rect.left;
|
| 8383 |
+
const children = Array.from(event.target.children);
|
| 8384 |
+
let element = children.find(blockEl => {
|
| 8385 |
+
return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft;
|
| 8386 |
+
});
|
| 8387 |
|
| 8388 |
+
if (!element) {
|
| 8389 |
+
return;
|
| 8390 |
+
} // The block may be in an alignment wrapper, so check the first direct
|
| 8391 |
+
// child if the element has no ID.
|
| 8392 |
|
| 8393 |
+
|
| 8394 |
+
if (!element.id) {
|
| 8395 |
+
element = element.firstElementChild;
|
| 8396 |
+
|
| 8397 |
+
if (!element) {
|
| 8398 |
+
return;
|
| 8399 |
}
|
| 8400 |
+
}
|
| 8401 |
|
| 8402 |
+
const clientId = element.id.slice('block-'.length);
|
| 8403 |
+
|
| 8404 |
+
if (!clientId) {
|
| 8405 |
+
return;
|
| 8406 |
+
} // Don't show the inserter when hovering above (conflicts with
|
| 8407 |
+
// block toolbar) or inside selected block(s).
|
| 8408 |
+
|
| 8409 |
+
|
| 8410 |
+
if (getSelectedBlockClientIds().includes(clientId)) {
|
| 8411 |
+
return;
|
| 8412 |
+
}
|
| 8413 |
+
|
| 8414 |
+
const elementRect = element.getBoundingClientRect();
|
| 8415 |
+
|
| 8416 |
+
if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) {
|
| 8417 |
+
if (isBlockInsertionPointVisible()) {
|
| 8418 |
+
hideInsertionPoint();
|
| 8419 |
}
|
| 8420 |
|
| 8421 |
+
return;
|
|
|
|
|
|
|
| 8422 |
}
|
|
|
|
| 8423 |
|
| 8424 |
+
const index = getBlockIndex(clientId, rootClientId); // Don't show the in-between inserter before the first block in
|
| 8425 |
+
// the list (preserves the original behaviour).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8426 |
|
| 8427 |
+
if (index === 0) {
|
| 8428 |
+
if (isBlockInsertionPointVisible()) {
|
| 8429 |
+
hideInsertionPoint();
|
| 8430 |
+
}
|
|
|
|
| 8431 |
|
| 8432 |
+
return;
|
| 8433 |
+
}
|
|
|
|
| 8434 |
|
| 8435 |
+
showInsertionPoint(rootClientId, index, {
|
| 8436 |
+
__unstableWithInserter: true
|
| 8437 |
+
});
|
| 8438 |
+
}
|
| 8439 |
+
|
| 8440 |
+
node.addEventListener('mousemove', onMouseMove);
|
| 8441 |
+
return () => {
|
| 8442 |
+
node.removeEventListener('mousemove', onMouseMove);
|
| 8443 |
+
};
|
| 8444 |
+
}, [openRef, getBlockListSettings, getBlockRootClientId, getBlockIndex, isBlockInsertionPointVisible, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds]);
|
| 8445 |
}
|
| 8446 |
+
//# sourceMappingURL=use-in-between-inserter.js.map
|
| 8447 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/pre-parse-patterns.js
|
| 8448 |
/**
|
| 8449 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8450 |
*/
|
| 8451 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8452 |
|
|
|
|
|
|
|
| 8453 |
/**
|
| 8454 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8455 |
*/
|
| 8456 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8457 |
|
|
|
|
|
|
|
|
|
|
| 8458 |
|
| 8459 |
+
const requestIdleCallback = (() => {
|
| 8460 |
+
if (typeof window === 'undefined') {
|
| 8461 |
+
return callback => {
|
| 8462 |
+
setTimeout(() => callback(Date.now()), 0);
|
| 8463 |
+
};
|
| 8464 |
}
|
| 8465 |
|
| 8466 |
+
return window.requestIdleCallback || window.requestAnimationFrame;
|
| 8467 |
+
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8468 |
|
| 8469 |
+
const cancelIdleCallback = (() => {
|
| 8470 |
+
if (typeof window === 'undefined') {
|
| 8471 |
+
return clearTimeout;
|
| 8472 |
+
}
|
| 8473 |
|
| 8474 |
+
return window.cancelIdleCallback || window.cancelAnimationFrame;
|
| 8475 |
+
})();
|
|
|
|
|
|
|
| 8476 |
|
| 8477 |
+
function usePreParsePatterns() {
|
| 8478 |
+
const patterns = Object(external_wp_data_["useSelect"])(_select => _select(store["a" /* store */]).getSettings().__experimentalBlockPatterns, []);
|
| 8479 |
+
Object(external_wp_element_["useEffect"])(() => {
|
| 8480 |
+
if (!(patterns !== null && patterns !== void 0 && patterns.length)) {
|
| 8481 |
return;
|
| 8482 |
+
}
|
| 8483 |
|
| 8484 |
+
let handle;
|
| 8485 |
+
let index = -1;
|
| 8486 |
+
|
| 8487 |
+
const callback = () => {
|
| 8488 |
+
index++;
|
| 8489 |
+
|
| 8490 |
+
if (index >= patterns.length) {
|
| 8491 |
+
return;
|
| 8492 |
}
|
| 8493 |
|
| 8494 |
+
Object(external_wp_data_["select"])(store["a" /* store */]).__experimentalGetParsedPattern(patterns[index].name);
|
|
|
|
|
|
|
| 8495 |
|
| 8496 |
+
handle = requestIdleCallback(callback);
|
| 8497 |
+
};
|
|
|
|
|
|
|
| 8498 |
|
| 8499 |
+
handle = requestIdleCallback(callback);
|
| 8500 |
+
return () => cancelIdleCallback(handle);
|
| 8501 |
+
}, [patterns]);
|
| 8502 |
+
return null;
|
| 8503 |
}
|
| 8504 |
+
//# sourceMappingURL=pre-parse-patterns.js.map
|
| 8505 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-list/layout.js
|
| 8506 |
+
var block_list_layout = __webpack_require__(112);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8507 |
|
| 8508 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 8509 |
+
var external_wp_components_ = __webpack_require__(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8510 |
|
| 8511 |
+
// EXTERNAL MODULE: external ["wp","deprecated"]
|
| 8512 |
+
var external_wp_deprecated_ = __webpack_require__(26);
|
| 8513 |
+
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
|
|
|
|
|
|
|
| 8514 |
|
| 8515 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-tools/block-popover.js + 1 modules
|
| 8516 |
+
var block_popover = __webpack_require__(235);
|
| 8517 |
|
| 8518 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/back-compat.js
|
|
|
|
|
|
|
|
|
|
| 8519 |
|
|
|
|
| 8520 |
|
|
|
|
|
|
|
| 8521 |
/**
|
| 8522 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8523 |
*/
|
| 8524 |
|
|
|
|
|
|
|
| 8525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8526 |
|
| 8527 |
+
/**
|
| 8528 |
+
* Internal dependencies
|
| 8529 |
+
*/
|
|
|
|
|
|
|
|
|
|
| 8530 |
|
| 8531 |
+
|
| 8532 |
+
|
| 8533 |
+
function BlockToolsBackCompat({
|
| 8534 |
+
children
|
| 8535 |
+
}) {
|
| 8536 |
+
const openRef = Object(external_wp_element_["useContext"])(insertion_point["a" /* InsertionPointOpenRef */]);
|
| 8537 |
+
const isDisabled = Object(external_wp_element_["useContext"])(external_wp_components_["Disabled"].Context); // If context is set, `BlockTools` is a parent component.
|
| 8538 |
+
|
| 8539 |
+
if (openRef || isDisabled) {
|
| 8540 |
+
return children;
|
| 8541 |
}
|
| 8542 |
|
| 8543 |
+
external_wp_deprecated_default()('wp.components.Popover.Slot name="block-toolbar"', {
|
| 8544 |
+
alternative: 'wp.blockEditor.BlockTools'
|
| 8545 |
+
});
|
| 8546 |
+
return Object(external_wp_element_["createElement"])(insertion_point["b" /* default */], {
|
| 8547 |
+
__unstablePopoverSlot: "block-toolbar"
|
| 8548 |
+
}, Object(external_wp_element_["createElement"])(block_popover["a" /* default */], {
|
| 8549 |
+
__unstablePopoverSlot: "block-toolbar"
|
| 8550 |
+
}), children);
|
| 8551 |
}
|
| 8552 |
+
//# sourceMappingURL=back-compat.js.map
|
| 8553 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-selection-clearer/index.js
|
| 8554 |
+
var block_selection_clearer = __webpack_require__(136);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8555 |
|
| 8556 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-list/head.js
|
| 8557 |
+
var head = __webpack_require__(154);
|
| 8558 |
+
|
| 8559 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/index.js
|
| 8560 |
|
| 8561 |
|
| 8562 |
/**
|
| 8563 |
* External dependencies
|
| 8564 |
*/
|
| 8565 |
|
|
|
|
| 8566 |
/**
|
| 8567 |
* WordPress dependencies
|
| 8568 |
*/
|
| 8571 |
|
| 8572 |
|
| 8573 |
/**
|
| 8574 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8575 |
*/
|
|
|
|
| 8576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8578 |
|
|
|
|
|
|
|
|
|
|
| 8579 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8580 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8582 |
|
|
|
|
|
|
|
| 8583 |
|
|
|
|
|
|
|
|
|
|
| 8584 |
|
| 8585 |
+
|
| 8586 |
+
|
| 8587 |
+
const IntersectionObserver = Object(external_wp_element_["createContext"])();
|
| 8588 |
+
|
| 8589 |
+
function Root({
|
| 8590 |
+
className,
|
| 8591 |
+
children
|
| 8592 |
+
}) {
|
| 8593 |
+
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium');
|
| 8594 |
+
const {
|
| 8595 |
+
isOutlineMode,
|
| 8596 |
+
isFocusMode,
|
| 8597 |
+
isNavigationMode
|
| 8598 |
+
} = Object(external_wp_data_["useSelect"])(select => {
|
| 8599 |
+
const {
|
| 8600 |
+
getSettings,
|
| 8601 |
+
isNavigationMode: _isNavigationMode
|
| 8602 |
+
} = select(store["a" /* store */]);
|
| 8603 |
+
const {
|
| 8604 |
+
outlineMode,
|
| 8605 |
+
focusMode
|
| 8606 |
+
} = getSettings();
|
| 8607 |
+
return {
|
| 8608 |
+
isOutlineMode: outlineMode,
|
| 8609 |
+
isFocusMode: focusMode,
|
| 8610 |
+
isNavigationMode: _isNavigationMode()
|
| 8611 |
+
};
|
| 8612 |
+
}, []);
|
| 8613 |
+
return Object(external_wp_element_["createElement"])(head["a" /* Head */], null, Object(external_wp_element_["createElement"])("div", {
|
| 8614 |
+
ref: Object(external_wp_compose_["useMergeRefs"])([Object(block_selection_clearer["b" /* useBlockSelectionClearer */])(), Object(use_block_drop_zone["a" /* default */])(), useInBetweenInserter()]),
|
| 8615 |
+
className: classnames_default()('block-editor-block-list__layout is-root-container', className, {
|
| 8616 |
+
'is-outline-mode': isOutlineMode,
|
| 8617 |
+
'is-focus-mode': isFocusMode && isLargeViewport,
|
| 8618 |
+
'is-navigate-mode': isNavigationMode
|
| 8619 |
+
})
|
| 8620 |
+
}, children));
|
| 8621 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8622 |
|
| 8623 |
+
function BlockList({
|
| 8624 |
+
className,
|
| 8625 |
+
...props
|
| 8626 |
+
}) {
|
| 8627 |
+
usePreParsePatterns();
|
| 8628 |
+
return Object(external_wp_element_["createElement"])(BlockToolsBackCompat, null, Object(external_wp_element_["createElement"])(Root, {
|
| 8629 |
+
className: className
|
| 8630 |
+
}, Object(external_wp_element_["createElement"])(BlockListItems, props)));
|
| 8631 |
+
}
|
| 8632 |
|
| 8633 |
+
function Items({
|
| 8634 |
+
placeholder,
|
| 8635 |
+
rootClientId,
|
| 8636 |
+
renderAppender,
|
| 8637 |
+
__experimentalAppenderTagName,
|
| 8638 |
+
__experimentalLayout: layout = block_list_layout["c" /* defaultLayout */]
|
| 8639 |
+
}) {
|
| 8640 |
+
const [intersectingBlocks, setIntersectingBlocks] = Object(external_wp_element_["useState"])(new Set());
|
| 8641 |
+
const intersectionObserver = Object(external_wp_element_["useMemo"])(() => {
|
| 8642 |
+
const {
|
| 8643 |
+
IntersectionObserver: Observer
|
| 8644 |
+
} = window;
|
| 8645 |
|
| 8646 |
+
if (!Observer) {
|
| 8647 |
+
return;
|
| 8648 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8649 |
|
| 8650 |
+
return new Observer(entries => {
|
| 8651 |
+
setIntersectingBlocks(oldIntersectingBlocks => {
|
| 8652 |
+
const newIntersectingBlocks = new Set(oldIntersectingBlocks);
|
| 8653 |
|
| 8654 |
+
for (const entry of entries) {
|
| 8655 |
+
const clientId = entry.target.getAttribute('data-block');
|
| 8656 |
+
const action = entry.isIntersecting ? 'add' : 'delete';
|
| 8657 |
+
newIntersectingBlocks[action](clientId);
|
| 8658 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8659 |
|
| 8660 |
+
return newIntersectingBlocks;
|
| 8661 |
+
});
|
| 8662 |
+
});
|
| 8663 |
+
}, [setIntersectingBlocks]);
|
| 8664 |
+
const {
|
| 8665 |
+
order,
|
| 8666 |
+
selectedBlocks
|
| 8667 |
+
} = Object(external_wp_data_["useSelect"])(select => {
|
| 8668 |
+
const {
|
| 8669 |
+
getBlockOrder,
|
| 8670 |
+
getSelectedBlockClientIds
|
| 8671 |
+
} = select(store["a" /* store */]);
|
| 8672 |
+
return {
|
| 8673 |
+
order: getBlockOrder(rootClientId),
|
| 8674 |
+
selectedBlocks: getSelectedBlockClientIds()
|
| 8675 |
+
};
|
| 8676 |
+
}, [rootClientId]);
|
| 8677 |
+
return Object(external_wp_element_["createElement"])(block_list_layout["a" /* LayoutProvider */], {
|
| 8678 |
+
value: layout
|
| 8679 |
+
}, Object(external_wp_element_["createElement"])(IntersectionObserver.Provider, {
|
| 8680 |
+
value: intersectionObserver
|
| 8681 |
+
}, order.map(clientId => Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], {
|
| 8682 |
+
key: clientId,
|
| 8683 |
+
value: // Only provide data asynchronously if the block is
|
| 8684 |
+
// not visible and not selected.
|
| 8685 |
+
!intersectingBlocks.has(clientId) && !selectedBlocks.includes(clientId)
|
| 8686 |
+
}, Object(external_wp_element_["createElement"])(block["b" /* default */], {
|
| 8687 |
+
rootClientId: rootClientId,
|
| 8688 |
+
clientId: clientId
|
| 8689 |
+
})))), order.length < 1 && placeholder, Object(external_wp_element_["createElement"])(block_list_appender, {
|
| 8690 |
+
tagName: __experimentalAppenderTagName,
|
| 8691 |
+
rootClientId: rootClientId,
|
| 8692 |
+
renderAppender: renderAppender
|
| 8693 |
+
}));
|
| 8694 |
+
}
|
| 8695 |
|
| 8696 |
+
function BlockListItems(props) {
|
| 8697 |
+
// This component needs to always be synchronous as it's the one changing
|
| 8698 |
+
// the async mode depending on the block selection.
|
| 8699 |
+
return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], {
|
| 8700 |
+
value: false
|
| 8701 |
+
}, Object(external_wp_element_["createElement"])(Items, props));
|
| 8702 |
+
}
|
| 8703 |
+
//# sourceMappingURL=index.js.map
|
| 8704 |
|
| 8705 |
+
/***/ }),
|
| 8706 |
+
/* 102 */
|
| 8707 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 8708 |
|
| 8709 |
+
"use strict";
|
| 8710 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
| 8711 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
|
| 8712 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
| 8713 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
| 8714 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
|
| 8715 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);
|
| 8716 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
|
| 8717 |
/**
|
| 8718 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8719 |
*/
|
| 8720 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8721 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8722 |
|
|
|
|
| 8723 |
/**
|
| 8724 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8725 |
*/
|
| 8726 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8728 |
/**
|
| 8729 |
+
* Retrieves the block types inserter state.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8730 |
*
|
| 8731 |
+
* @param {string=} rootClientId Insertion's root client ID.
|
| 8732 |
+
* @param {Function} onInsert function called when inserter a list of blocks.
|
| 8733 |
+
* @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
|
| 8734 |
*/
|
| 8735 |
|
| 8736 |
+
const useBlockTypesState = (rootClientId, onInsert) => {
|
| 8737 |
+
const {
|
| 8738 |
+
categories,
|
| 8739 |
+
collections,
|
| 8740 |
+
items
|
| 8741 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => {
|
| 8742 |
+
const {
|
| 8743 |
+
getInserterItems
|
| 8744 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_3__[/* store */ "a"]);
|
| 8745 |
+
const {
|
| 8746 |
+
getCategories,
|
| 8747 |
+
getCollections
|
| 8748 |
+
} = select(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["store"]);
|
| 8749 |
+
return {
|
| 8750 |
+
categories: getCategories(),
|
| 8751 |
+
collections: getCollections(),
|
| 8752 |
+
items: getInserterItems(rootClientId)
|
| 8753 |
+
};
|
| 8754 |
+
}, [rootClientId]);
|
| 8755 |
+
const onSelectItem = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["useCallback"])(({
|
| 8756 |
+
name,
|
| 8757 |
+
initialAttributes,
|
| 8758 |
+
innerBlocks
|
| 8759 |
+
}, shouldFocusBlock) => {
|
| 8760 |
+
const insertedBlock = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["createBlock"])(name, initialAttributes, Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["createBlocksFromInnerBlocksTemplate"])(innerBlocks));
|
| 8761 |
+
onInsert(insertedBlock, undefined, shouldFocusBlock);
|
| 8762 |
+
}, [onInsert]);
|
| 8763 |
+
return [items, categories, collections, onSelectItem];
|
| 8764 |
+
};
|
| 8765 |
|
| 8766 |
+
/* harmony default export */ __webpack_exports__["a"] = (useBlockTypesState);
|
| 8767 |
+
//# sourceMappingURL=use-block-types-state.js.map
|
|
|
|
| 8768 |
|
| 8769 |
+
/***/ }),
|
| 8770 |
+
/* 103 */
|
| 8771 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8772 |
|
| 8773 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8774 |
|
| 8775 |
+
// EXPORTS
|
| 8776 |
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BlockFormatControls; });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8777 |
|
| 8778 |
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 8779 |
+
var esm_extends = __webpack_require__(7);
|
| 8780 |
+
|
| 8781 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 8782 |
+
var external_wp_element_ = __webpack_require__(0);
|
| 8783 |
+
|
| 8784 |
+
// EXTERNAL MODULE: external "lodash"
|
| 8785 |
+
var external_lodash_ = __webpack_require__(2);
|
| 8786 |
+
|
| 8787 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 8788 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 8789 |
+
|
| 8790 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/use-display-block-controls/index.js
|
| 8791 |
+
var use_display_block_controls = __webpack_require__(153);
|
| 8792 |
+
|
| 8793 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/groups.js
|
| 8794 |
/**
|
| 8795 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8796 |
*/
|
| 8797 |
|
| 8798 |
+
const BlockControlsDefault = Object(external_wp_components_["createSlotFill"])('BlockControls');
|
| 8799 |
+
const BlockControlsBlock = Object(external_wp_components_["createSlotFill"])('BlockControlsBlock');
|
| 8800 |
+
const BlockControlsInline = Object(external_wp_components_["createSlotFill"])('BlockFormatControls');
|
| 8801 |
+
const BlockControlsOther = Object(external_wp_components_["createSlotFill"])('BlockControlsOther');
|
| 8802 |
+
const groups = {
|
| 8803 |
+
default: BlockControlsDefault,
|
| 8804 |
+
block: BlockControlsBlock,
|
| 8805 |
+
inline: BlockControlsInline,
|
| 8806 |
+
other: BlockControlsOther
|
| 8807 |
+
};
|
| 8808 |
+
/* harmony default export */ var block_controls_groups = (groups);
|
| 8809 |
+
//# sourceMappingURL=groups.js.map
|
| 8810 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/fill.js
|
| 8811 |
+
|
| 8812 |
+
|
| 8813 |
/**
|
| 8814 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8815 |
*/
|
| 8816 |
|
|
|
|
|
|
|
|
|
|
| 8817 |
/**
|
| 8818 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8819 |
*/
|
| 8820 |
|
| 8821 |
+
|
|
|
|
|
|
|
| 8822 |
/**
|
| 8823 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8824 |
*/
|
| 8825 |
|
|
|
|
|
|
|
| 8826 |
|
| 8827 |
+
|
| 8828 |
+
function BlockControlsFill({
|
| 8829 |
+
group = 'default',
|
| 8830 |
+
controls,
|
| 8831 |
+
children
|
| 8832 |
+
}) {
|
| 8833 |
+
if (!Object(use_display_block_controls["a" /* default */])()) {
|
| 8834 |
+
return null;
|
| 8835 |
}
|
| 8836 |
|
| 8837 |
+
const Fill = block_controls_groups[group].Fill;
|
| 8838 |
+
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], {
|
| 8839 |
+
document: document
|
| 8840 |
+
}, Object(external_wp_element_["createElement"])(Fill, null, fillProps => {
|
| 8841 |
+
// Children passed to BlockControlsFill will not have access to any
|
| 8842 |
+
// React Context whose Provider is part of the BlockControlsSlot tree.
|
| 8843 |
+
// So we re-create the Provider in this subtree.
|
| 8844 |
+
const value = !Object(external_lodash_["isEmpty"])(fillProps) ? fillProps : null;
|
| 8845 |
+
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalToolbarContext"].Provider, {
|
| 8846 |
+
value: value
|
| 8847 |
+
}, group === 'default' && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], {
|
| 8848 |
+
controls: controls
|
| 8849 |
+
}), children);
|
| 8850 |
+
}));
|
|
|
|
|
|
|
| 8851 |
}
|
| 8852 |
+
//# sourceMappingURL=fill.js.map
|
| 8853 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/slot.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8854 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8855 |
|
|
|
|
|
|
|
|
|
|
| 8856 |
|
|
|
|
|
|
|
| 8857 |
/**
|
| 8858 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8859 |
*/
|
| 8860 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8861 |
|
|
|
|
|
|
|
|
|
|
| 8862 |
/**
|
| 8863 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8864 |
*/
|
| 8865 |
|
|
|
|
|
|
|
|
|
|
| 8866 |
|
| 8867 |
+
function BlockControlsSlot({
|
| 8868 |
+
group = 'default',
|
| 8869 |
+
...props
|
| 8870 |
+
}) {
|
| 8871 |
+
const accessibleToolbarState = Object(external_wp_element_["useContext"])(external_wp_components_["__experimentalToolbarContext"]);
|
| 8872 |
+
const Slot = block_controls_groups[group].Slot;
|
| 8873 |
+
const slot = Object(external_wp_components_["__experimentalUseSlot"])(Slot.__unstableName);
|
| 8874 |
+
const hasFills = Boolean(slot.fills && slot.fills.length);
|
| 8875 |
+
|
| 8876 |
+
if (!hasFills) {
|
| 8877 |
+
return null;
|
| 8878 |
}
|
| 8879 |
|
| 8880 |
+
if (group === 'default') {
|
| 8881 |
+
return Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, {
|
| 8882 |
+
bubblesVirtually: true,
|
| 8883 |
+
fillProps: accessibleToolbarState
|
| 8884 |
+
}));
|
| 8885 |
+
}
|
| 8886 |
+
|
| 8887 |
+
return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, {
|
| 8888 |
+
bubblesVirtually: true,
|
| 8889 |
+
fillProps: accessibleToolbarState
|
| 8890 |
+
})));
|
| 8891 |
+
}
|
| 8892 |
+
//# sourceMappingURL=slot.js.map
|
| 8893 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-controls/index.js
|
| 8894 |
+
|
|
|
|
| 8895 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8896 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8897 |
/**
|
| 8898 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8899 |
*/
|
| 8900 |
|
|
|
|
|
|
|
|
|
|
| 8901 |
|
| 8902 |
+
const BlockControls = BlockControlsFill;
|
| 8903 |
+
BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility
|
|
|
|
|
|
|
| 8904 |
|
| 8905 |
+
const BlockFormatControls = props => {
|
| 8906 |
+
return Object(external_wp_element_["createElement"])(BlockControlsFill, Object(esm_extends["a" /* default */])({
|
| 8907 |
+
group: "inline"
|
| 8908 |
+
}, props));
|
| 8909 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8910 |
|
| 8911 |
+
BlockFormatControls.Slot = props => {
|
| 8912 |
+
return Object(external_wp_element_["createElement"])(BlockControlsSlot, Object(esm_extends["a" /* default */])({
|
| 8913 |
+
group: "inline"
|
| 8914 |
+
}, props));
|
| 8915 |
+
};
|
|
|
|
| 8916 |
|
| 8917 |
+
/* harmony default export */ var block_controls = __webpack_exports__["b"] = (BlockControls);
|
| 8918 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8919 |
|
| 8920 |
+
/***/ }),
|
| 8921 |
+
/* 104 */,
|
| 8922 |
+
/* 105 */
|
| 8923 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 8924 |
+
|
| 8925 |
+
"use strict";
|
| 8926 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PREFERENCES_DEFAULTS; });
|
| 8927 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SETTINGS_DEFAULTS; });
|
| 8928 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
| 8929 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
|
| 8930 |
/**
|
| 8931 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8932 |
*/
|
| 8933 |
|
| 8934 |
+
const PREFERENCES_DEFAULTS = {
|
| 8935 |
+
insertUsage: {}
|
| 8936 |
+
};
|
| 8937 |
+
/**
|
| 8938 |
+
* The default editor settings
|
| 8939 |
+
*
|
| 8940 |
+
* @typedef {Object} SETTINGS_DEFAULT
|
| 8941 |
+
* @property {boolean} alignWide Enable/Disable Wide/Full Alignments
|
| 8942 |
+
* @property {boolean} supportsLayout Enable/disable layouts support in container blocks.
|
| 8943 |
+
* @property {boolean} imageEditing Image Editing settings set to false to disable.
|
| 8944 |
+
* @property {Array} imageSizes Available image sizes
|
| 8945 |
+
* @property {number} maxWidth Max width to constraint resizing
|
| 8946 |
+
* @property {boolean|Array} allowedBlockTypes Allowed block types
|
| 8947 |
+
* @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed
|
| 8948 |
+
* @property {boolean} focusMode Whether the focus mode is enabled or not
|
| 8949 |
+
* @property {Array} styles Editor Styles
|
| 8950 |
+
* @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode
|
| 8951 |
+
* @property {string} bodyPlaceholder Empty post placeholder
|
| 8952 |
+
* @property {string} titlePlaceholder Empty title placeholder
|
| 8953 |
+
* @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
|
| 8954 |
+
* @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
|
| 8955 |
+
* @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
|
| 8956 |
+
* @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
|
| 8957 |
+
* @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
|
| 8958 |
+
*/
|
| 8959 |
|
| 8960 |
+
const SETTINGS_DEFAULTS = {
|
| 8961 |
+
alignWide: false,
|
| 8962 |
+
supportsLayout: true,
|
| 8963 |
+
// colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
| 8964 |
+
// The setting is only kept for backward compatibility purposes.
|
| 8965 |
+
colors: [{
|
| 8966 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Black'),
|
| 8967 |
+
slug: 'black',
|
| 8968 |
+
color: '#000000'
|
| 8969 |
+
}, {
|
| 8970 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Cyan bluish gray'),
|
| 8971 |
+
slug: 'cyan-bluish-gray',
|
| 8972 |
+
color: '#abb8c3'
|
| 8973 |
+
}, {
|
| 8974 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('White'),
|
| 8975 |
+
slug: 'white',
|
| 8976 |
+
color: '#ffffff'
|
| 8977 |
+
}, {
|
| 8978 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Pale pink'),
|
| 8979 |
+
slug: 'pale-pink',
|
| 8980 |
+
color: '#f78da7'
|
| 8981 |
+
}, {
|
| 8982 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Vivid red'),
|
| 8983 |
+
slug: 'vivid-red',
|
| 8984 |
+
color: '#cf2e2e'
|
| 8985 |
+
}, {
|
| 8986 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Luminous vivid orange'),
|
| 8987 |
+
slug: 'luminous-vivid-orange',
|
| 8988 |
+
color: '#ff6900'
|
| 8989 |
+
}, {
|
| 8990 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Luminous vivid amber'),
|
| 8991 |
+
slug: 'luminous-vivid-amber',
|
| 8992 |
+
color: '#fcb900'
|
| 8993 |
+
}, {
|
| 8994 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Light green cyan'),
|
| 8995 |
+
slug: 'light-green-cyan',
|
| 8996 |
+
color: '#7bdcb5'
|
| 8997 |
+
}, {
|
| 8998 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Vivid green cyan'),
|
| 8999 |
+
slug: 'vivid-green-cyan',
|
| 9000 |
+
color: '#00d084'
|
| 9001 |
+
}, {
|
| 9002 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Pale cyan blue'),
|
| 9003 |
+
slug: 'pale-cyan-blue',
|
| 9004 |
+
color: '#8ed1fc'
|
| 9005 |
+
}, {
|
| 9006 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Vivid cyan blue'),
|
| 9007 |
+
slug: 'vivid-cyan-blue',
|
| 9008 |
+
color: '#0693e3'
|
| 9009 |
+
}, {
|
| 9010 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Vivid purple'),
|
| 9011 |
+
slug: 'vivid-purple',
|
| 9012 |
+
color: '#9b51e0'
|
| 9013 |
+
}],
|
| 9014 |
+
// fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
| 9015 |
+
// The setting is only kept for backward compatibility purposes.
|
| 9016 |
+
fontSizes: [{
|
| 9017 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["_x"])('Small', 'font size name'),
|
| 9018 |
+
size: 13,
|
| 9019 |
+
slug: 'small'
|
| 9020 |
+
}, {
|
| 9021 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["_x"])('Normal', 'font size name'),
|
| 9022 |
+
size: 16,
|
| 9023 |
+
slug: 'normal'
|
| 9024 |
+
}, {
|
| 9025 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["_x"])('Medium', 'font size name'),
|
| 9026 |
+
size: 20,
|
| 9027 |
+
slug: 'medium'
|
| 9028 |
+
}, {
|
| 9029 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["_x"])('Large', 'font size name'),
|
| 9030 |
+
size: 36,
|
| 9031 |
+
slug: 'large'
|
| 9032 |
+
}, {
|
| 9033 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["_x"])('Huge', 'font size name'),
|
| 9034 |
+
size: 42,
|
| 9035 |
+
slug: 'huge'
|
| 9036 |
+
}],
|
| 9037 |
+
// Image default size slug.
|
| 9038 |
+
imageDefaultSize: 'large',
|
| 9039 |
+
imageSizes: [{
|
| 9040 |
+
slug: 'thumbnail',
|
| 9041 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Thumbnail')
|
| 9042 |
+
}, {
|
| 9043 |
+
slug: 'medium',
|
| 9044 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Medium')
|
| 9045 |
+
}, {
|
| 9046 |
+
slug: 'large',
|
| 9047 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Large')
|
| 9048 |
+
}, {
|
| 9049 |
+
slug: 'full',
|
| 9050 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Full Size')
|
| 9051 |
+
}],
|
| 9052 |
+
// Allow plugin to disable Image Editor if need be
|
| 9053 |
+
imageEditing: true,
|
| 9054 |
+
// This is current max width of the block inner area
|
| 9055 |
+
// It's used to constraint image resizing and this value could be overridden later by themes
|
| 9056 |
+
maxWidth: 580,
|
| 9057 |
+
// Allowed block types for the editor, defaulting to true (all supported).
|
| 9058 |
+
allowedBlockTypes: true,
|
| 9059 |
+
// Maximum upload size in bytes allowed for the site.
|
| 9060 |
+
maxUploadFileSize: 0,
|
| 9061 |
+
// List of allowed mime types and file extensions.
|
| 9062 |
+
allowedMimeTypes: null,
|
| 9063 |
+
__experimentalCanUserUseUnfilteredHTML: false,
|
| 9064 |
+
__experimentalBlockDirectory: false,
|
| 9065 |
+
__mobileEnablePageTemplates: false,
|
| 9066 |
+
__experimentalBlockPatterns: [],
|
| 9067 |
+
__experimentalBlockPatternCategories: [],
|
| 9068 |
+
__experimentalSpotlightEntityBlocks: [],
|
| 9069 |
+
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
| 9070 |
+
// The setting is only kept for backward compatibility purposes.
|
| 9071 |
+
gradients: [{
|
| 9072 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Vivid cyan blue to vivid purple'),
|
| 9073 |
+
gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
|
| 9074 |
+
slug: 'vivid-cyan-blue-to-vivid-purple'
|
| 9075 |
+
}, {
|
| 9076 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Light green cyan to vivid green cyan'),
|
| 9077 |
+
gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',
|
| 9078 |
+
slug: 'light-green-cyan-to-vivid-green-cyan'
|
| 9079 |
+
}, {
|
| 9080 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Luminous vivid amber to luminous vivid orange'),
|
| 9081 |
+
gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',
|
| 9082 |
+
slug: 'luminous-vivid-amber-to-luminous-vivid-orange'
|
| 9083 |
+
}, {
|
| 9084 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Luminous vivid orange to vivid red'),
|
| 9085 |
+
gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',
|
| 9086 |
+
slug: 'luminous-vivid-orange-to-vivid-red'
|
| 9087 |
+
}, {
|
| 9088 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Very light gray to cyan bluish gray'),
|
| 9089 |
+
gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',
|
| 9090 |
+
slug: 'very-light-gray-to-cyan-bluish-gray'
|
| 9091 |
+
}, {
|
| 9092 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Cool to warm spectrum'),
|
| 9093 |
+
gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',
|
| 9094 |
+
slug: 'cool-to-warm-spectrum'
|
| 9095 |
+
}, {
|
| 9096 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Blush light purple'),
|
| 9097 |
+
gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',
|
| 9098 |
+
slug: 'blush-light-purple'
|
| 9099 |
+
}, {
|
| 9100 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Blush bordeaux'),
|
| 9101 |
+
gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',
|
| 9102 |
+
slug: 'blush-bordeaux'
|
| 9103 |
+
}, {
|
| 9104 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Luminous dusk'),
|
| 9105 |
+
gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',
|
| 9106 |
+
slug: 'luminous-dusk'
|
| 9107 |
+
}, {
|
| 9108 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Pale ocean'),
|
| 9109 |
+
gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',
|
| 9110 |
+
slug: 'pale-ocean'
|
| 9111 |
+
}, {
|
| 9112 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Electric grass'),
|
| 9113 |
+
gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',
|
| 9114 |
+
slug: 'electric-grass'
|
| 9115 |
+
}, {
|
| 9116 |
+
name: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Midnight'),
|
| 9117 |
+
gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',
|
| 9118 |
+
slug: 'midnight'
|
| 9119 |
+
}]
|
| 9120 |
+
};
|
| 9121 |
+
//# sourceMappingURL=defaults.js.map
|
| 9122 |
|
| 9123 |
+
/***/ }),
|
| 9124 |
+
/* 106 */,
|
| 9125 |
+
/* 107 */
|
| 9126 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 9127 |
|
| 9128 |
+
"use strict";
|
| 9129 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 9130 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 9131 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
| 9132 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
|
| 9133 |
|
| 9134 |
|
| 9135 |
+
/**
|
| 9136 |
+
* WordPress dependencies
|
| 9137 |
+
*/
|
| 9138 |
|
|
|
|
|
|
|
|
|
|
| 9139 |
|
| 9140 |
+
function InserterPanel({
|
| 9141 |
+
title,
|
| 9142 |
+
icon,
|
| 9143 |
+
children
|
| 9144 |
+
}) {
|
| 9145 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 9146 |
+
className: "block-editor-inserter__panel-header"
|
| 9147 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("h2", {
|
| 9148 |
+
className: "block-editor-inserter__panel-title"
|
| 9149 |
+
}, title), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["Icon"], {
|
| 9150 |
+
icon: icon
|
| 9151 |
+
})), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 9152 |
+
className: "block-editor-inserter__panel-content"
|
| 9153 |
+
}, children));
|
| 9154 |
+
}
|
| 9155 |
|
| 9156 |
+
/* harmony default export */ __webpack_exports__["a"] = (InserterPanel);
|
| 9157 |
+
//# sourceMappingURL=panel.js.map
|
|
|
|
| 9158 |
|
| 9159 |
+
/***/ }),
|
| 9160 |
+
/* 108 */,
|
| 9161 |
+
/* 109 */
|
| 9162 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 9163 |
|
| 9164 |
+
"use strict";
|
| 9165 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 9166 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 9167 |
+
/**
|
| 9168 |
+
* WordPress dependencies
|
| 9169 |
+
*/
|
| 9170 |
|
| 9171 |
+
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
|
| 9172 |
|
|
|
|
|
|
|
| 9173 |
/**
|
| 9174 |
+
* Return an SVG icon.
|
|
|
|
|
|
|
| 9175 |
*
|
| 9176 |
+
* @param {IconProps} props icon is the SVG component to render
|
| 9177 |
+
* size is a number specifiying the icon size in pixels
|
| 9178 |
+
* Other props will be passed to wrapped SVG component
|
| 9179 |
*
|
| 9180 |
+
* @return {JSX.Element} Icon component
|
| 9181 |
*/
|
| 9182 |
|
| 9183 |
+
function Icon({
|
| 9184 |
+
icon,
|
| 9185 |
+
size = 24,
|
| 9186 |
+
...props
|
| 9187 |
+
}) {
|
| 9188 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
|
| 9189 |
+
width: size,
|
| 9190 |
+
height: size,
|
| 9191 |
+
...props
|
| 9192 |
+
});
|
| 9193 |
}
|
| 9194 |
+
|
| 9195 |
+
/* harmony default export */ __webpack_exports__["a"] = (Icon);
|
| 9196 |
+
//# sourceMappingURL=index.js.map
|
| 9197 |
+
|
| 9198 |
+
/***/ }),
|
| 9199 |
+
/* 110 */,
|
| 9200 |
+
/* 111 */,
|
| 9201 |
+
/* 112 */
|
| 9202 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 9203 |
+
|
| 9204 |
+
"use strict";
|
| 9205 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return defaultLayout; });
|
| 9206 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LayoutProvider; });
|
| 9207 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return useLayout; });
|
| 9208 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LayoutStyle; });
|
| 9209 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 9210 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 9211 |
+
|
| 9212 |
+
|
| 9213 |
/**
|
| 9214 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9215 |
*/
|
| 9216 |
|
| 9217 |
+
const defaultLayout = {
|
| 9218 |
+
type: 'default'
|
| 9219 |
+
};
|
| 9220 |
+
const Layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])(defaultLayout);
|
| 9221 |
+
|
| 9222 |
+
function appendSelectors(selectors, append) {
|
| 9223 |
+
// Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here
|
| 9224 |
+
// The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style
|
| 9225 |
+
// it's used to reset the default margin added by wp-admin to paragraphs
|
| 9226 |
+
// so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers
|
| 9227 |
+
// When the post editor is fully iframed, this extra classname could be removed.
|
| 9228 |
+
return selectors.split(',').map(subselector => `.editor-styles-wrapper ${subselector} ${append}`).join(',');
|
| 9229 |
}
|
| 9230 |
/**
|
| 9231 |
+
* Allows to define the layout.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9232 |
*/
|
| 9233 |
|
| 9234 |
+
|
| 9235 |
+
const LayoutProvider = Layout.Provider;
|
|
|
|
| 9236 |
/**
|
| 9237 |
+
* React hook used to retrieve the layout config.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9238 |
*/
|
| 9239 |
|
| 9240 |
+
function useLayout() {
|
| 9241 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(Layout);
|
| 9242 |
+
}
|
| 9243 |
+
function LayoutStyle({
|
| 9244 |
+
selector,
|
| 9245 |
+
layout = {}
|
| 9246 |
+
}) {
|
| 9247 |
const {
|
| 9248 |
+
contentSize,
|
| 9249 |
+
wideSize
|
| 9250 |
+
} = layout;
|
| 9251 |
+
let style = !!contentSize || !!wideSize ? `
|
| 9252 |
+
${appendSelectors(selector, '> *')} {
|
| 9253 |
+
max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
|
| 9254 |
+
margin-left: auto !important;
|
| 9255 |
+
margin-right: auto !important;
|
| 9256 |
+
}
|
| 9257 |
|
| 9258 |
+
${appendSelectors(selector, '> [data-align="wide"]')} {
|
| 9259 |
+
max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
|
| 9260 |
+
}
|
| 9261 |
|
| 9262 |
+
${appendSelectors(selector, '> [data-align="full"]')} {
|
| 9263 |
+
max-width: none;
|
| 9264 |
+
}
|
| 9265 |
+
` : '';
|
| 9266 |
+
style += `
|
| 9267 |
+
${appendSelectors(selector, '> [data-align="left"]')} {
|
| 9268 |
+
float: left;
|
| 9269 |
+
margin-right: 2em;
|
| 9270 |
+
}
|
| 9271 |
|
| 9272 |
+
${appendSelectors(selector, '> [data-align="right"]')} {
|
| 9273 |
+
float: right;
|
| 9274 |
+
margin-left: 2em;
|
| 9275 |
+
}
|
| 9276 |
+
`;
|
| 9277 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("style", null, style);
|
| 9278 |
+
}
|
| 9279 |
+
//# sourceMappingURL=layout.js.map
|
| 9280 |
|
| 9281 |
+
/***/ }),
|
| 9282 |
+
/* 113 */
|
| 9283 |
+
/***/ (function(module, exports, __webpack_require__) {
|
| 9284 |
|
| 9285 |
+
"use strict";
|
|
|
|
|
|
|
| 9286 |
|
| 9287 |
+
exports.__esModule = true;
|
| 9288 |
+
var TextareaAutosize_1 = __webpack_require__(249);
|
| 9289 |
+
exports["default"] = TextareaAutosize_1.TextareaAutosize;
|
| 9290 |
|
|
|
|
|
|
|
|
|
|
| 9291 |
|
| 9292 |
+
/***/ }),
|
| 9293 |
+
/* 114 */,
|
| 9294 |
+
/* 115 */
|
| 9295 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9296 |
|
| 9297 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9298 |
|
| 9299 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 9300 |
+
var external_wp_element_ = __webpack_require__(0);
|
|
|
|
| 9301 |
|
| 9302 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 9303 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
| 9304 |
+
|
| 9305 |
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 9306 |
+
var esm_extends = __webpack_require__(7);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9307 |
|
| 9308 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 9309 |
+
var classnames = __webpack_require__(10);
|
| 9310 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
| 9311 |
|
| 9312 |
+
// EXTERNAL MODULE: external ["wp","keycodes"]
|
| 9313 |
+
var external_wp_keycodes_ = __webpack_require__(14);
|
|
|
|
| 9314 |
|
| 9315 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-icon/index.js
|
| 9316 |
+
var block_icon = __webpack_require__(52);
|
| 9317 |
+
|
| 9318 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter-listbox/item.js
|
| 9319 |
+
var inserter_listbox_item = __webpack_require__(277);
|
| 9320 |
+
|
| 9321 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter-draggable-blocks/index.js
|
| 9322 |
+
var inserter_draggable_blocks = __webpack_require__(221);
|
| 9323 |
+
|
| 9324 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-list-item/index.js
|
| 9325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9327 |
|
|
|
|
|
|
|
|
|
|
| 9328 |
/**
|
| 9329 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9330 |
*/
|
| 9331 |
|
|
|
|
|
|
|
|
|
|
| 9332 |
/**
|
| 9333 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9334 |
*/
|
| 9335 |
|
|
|
|
|
|
|
|
|
|
| 9336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9337 |
|
| 9338 |
+
|
|
|
|
| 9339 |
/**
|
| 9340 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9341 |
*/
|
| 9342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9343 |
|
|
|
|
|
|
|
|
|
|
| 9344 |
|
| 9345 |
+
|
|
|
|
| 9346 |
/**
|
| 9347 |
+
* Return true if platform is MacOS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9348 |
*
|
| 9349 |
+
* @param {Object} _window window object by default; used for DI testing.
|
| 9350 |
*
|
| 9351 |
+
* @return {boolean} True if MacOS; false otherwise.
|
| 9352 |
*/
|
| 9353 |
|
| 9354 |
+
function isAppleOS(_window = window) {
|
| 9355 |
const {
|
| 9356 |
+
platform
|
| 9357 |
+
} = _window.navigator;
|
| 9358 |
+
return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9359 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9360 |
|
| 9361 |
+
function InserterListItem({
|
| 9362 |
+
className,
|
| 9363 |
+
isFirst,
|
| 9364 |
+
item,
|
| 9365 |
+
onSelect,
|
| 9366 |
+
onHover,
|
| 9367 |
+
isDraggable,
|
| 9368 |
+
...props
|
| 9369 |
+
}) {
|
| 9370 |
+
const isDragging = Object(external_wp_element_["useRef"])(false);
|
| 9371 |
+
const itemIconStyle = item.icon ? {
|
| 9372 |
+
backgroundColor: item.icon.background,
|
| 9373 |
+
color: item.icon.foreground
|
| 9374 |
+
} : {};
|
| 9375 |
+
const blocks = Object(external_wp_element_["useMemo"])(() => {
|
| 9376 |
+
return [Object(external_wp_blocks_["createBlock"])(item.name, item.initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(item.innerBlocks))];
|
| 9377 |
+
}, [item.name, item.initialAttributes, item.initialAttributes]);
|
| 9378 |
+
return Object(external_wp_element_["createElement"])(inserter_draggable_blocks["a" /* default */], {
|
| 9379 |
+
isEnabled: isDraggable && !item.disabled,
|
| 9380 |
+
blocks: blocks,
|
| 9381 |
+
icon: item.icon
|
| 9382 |
+
}, ({
|
| 9383 |
+
draggable,
|
| 9384 |
+
onDragStart,
|
| 9385 |
+
onDragEnd
|
| 9386 |
+
}) => Object(external_wp_element_["createElement"])("div", {
|
| 9387 |
+
className: "block-editor-block-types-list__list-item",
|
| 9388 |
+
draggable: draggable,
|
| 9389 |
+
onDragStart: event => {
|
| 9390 |
+
isDragging.current = true;
|
| 9391 |
|
| 9392 |
+
if (onDragStart) {
|
| 9393 |
+
onHover(null);
|
| 9394 |
+
onDragStart(event);
|
| 9395 |
+
}
|
| 9396 |
+
},
|
| 9397 |
+
onDragEnd: event => {
|
| 9398 |
+
isDragging.current = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9399 |
|
| 9400 |
+
if (onDragEnd) {
|
| 9401 |
+
onDragEnd(event);
|
| 9402 |
+
}
|
| 9403 |
+
}
|
| 9404 |
+
}, Object(external_wp_element_["createElement"])(inserter_listbox_item["a" /* default */], Object(esm_extends["a" /* default */])({
|
| 9405 |
+
isFirst: isFirst,
|
| 9406 |
+
className: classnames_default()('block-editor-block-types-list__item', className),
|
| 9407 |
+
disabled: item.isDisabled,
|
| 9408 |
+
onClick: event => {
|
| 9409 |
+
event.preventDefault();
|
| 9410 |
+
onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
|
| 9411 |
+
onHover(null);
|
| 9412 |
+
},
|
| 9413 |
+
onKeyDown: event => {
|
| 9414 |
+
const {
|
| 9415 |
+
keyCode
|
| 9416 |
+
} = event;
|
| 9417 |
|
| 9418 |
+
if (keyCode === external_wp_keycodes_["ENTER"]) {
|
| 9419 |
+
event.preventDefault();
|
| 9420 |
+
onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
|
| 9421 |
+
onHover(null);
|
| 9422 |
+
}
|
| 9423 |
+
},
|
| 9424 |
+
onFocus: () => {
|
| 9425 |
+
if (isDragging.current) {
|
| 9426 |
+
return;
|
| 9427 |
+
}
|
| 9428 |
|
| 9429 |
+
onHover(item);
|
| 9430 |
+
},
|
| 9431 |
+
onMouseEnter: () => {
|
| 9432 |
+
if (isDragging.current) {
|
| 9433 |
+
return;
|
| 9434 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9435 |
|
| 9436 |
+
onHover(item);
|
| 9437 |
+
},
|
| 9438 |
+
onMouseLeave: () => onHover(null),
|
| 9439 |
+
onBlur: () => onHover(null)
|
| 9440 |
+
}, props), Object(external_wp_element_["createElement"])("span", {
|
| 9441 |
+
className: "block-editor-block-types-list__item-icon",
|
| 9442 |
+
style: itemIconStyle
|
| 9443 |
+
}, Object(external_wp_element_["createElement"])(block_icon["a" /* default */], {
|
| 9444 |
+
icon: item.icon,
|
| 9445 |
+
showColors: true
|
| 9446 |
+
})), Object(external_wp_element_["createElement"])("span", {
|
| 9447 |
+
className: "block-editor-block-types-list__item-title"
|
| 9448 |
+
}, item.title))));
|
| 9449 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9450 |
|
| 9451 |
+
/* harmony default export */ var inserter_list_item = (Object(external_wp_element_["memo"])(InserterListItem));
|
| 9452 |
+
//# sourceMappingURL=index.js.map
|
| 9453 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter-listbox/group.js
|
| 9454 |
+
var group = __webpack_require__(275);
|
| 9455 |
|
| 9456 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/inserter-listbox/row.js
|
| 9457 |
+
var inserter_listbox_row = __webpack_require__(276);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9458 |
|
| 9459 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-types-list/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9461 |
|
|
|
|
|
|
|
|
|
|
| 9462 |
/**
|
| 9463 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9464 |
*/
|
| 9465 |
|
|
|
|
|
|
|
|
|
|
| 9466 |
/**
|
| 9467 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9468 |
*/
|
| 9469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9472 |
|
| 9473 |
+
function chunk(array, size) {
|
| 9474 |
+
const chunks = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9475 |
|
| 9476 |
+
for (let i = 0, j = array.length; i < j; i += size) {
|
| 9477 |
+
chunks.push(array.slice(i, i + size));
|
|
|
|
|
|
|
|
|
|
| 9478 |
}
|
| 9479 |
|
| 9480 |
+
return chunks;
|
|
|
|
| 9481 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9482 |
|
| 9483 |
+
function BlockTypesList({
|
| 9484 |
+
items = [],
|
| 9485 |
+
onSelect,
|
| 9486 |
+
onHover = () => {},
|
| 9487 |
+
children,
|
| 9488 |
+
label,
|
| 9489 |
+
isDraggable = true
|
| 9490 |
+
}) {
|
| 9491 |
+
return Object(external_wp_element_["createElement"])(group["a" /* default */], {
|
| 9492 |
+
className: "block-editor-block-types-list",
|
| 9493 |
+
"aria-label": label
|
| 9494 |
+
}, chunk(items, 3).map((row, i) => Object(external_wp_element_["createElement"])(inserter_listbox_row["a" /* default */], {
|
| 9495 |
+
key: i
|
| 9496 |
+
}, row.map((item, j) => Object(external_wp_element_["createElement"])(inserter_list_item, {
|
| 9497 |
+
key: item.id,
|
| 9498 |
+
item: item,
|
| 9499 |
+
className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(item.id),
|
| 9500 |
+
onSelect: onSelect,
|
| 9501 |
+
onHover: onHover,
|
| 9502 |
+
isDraggable: isDraggable,
|
| 9503 |
+
isFirst: i === 0 && j === 0
|
| 9504 |
+
})))), children);
|
| 9505 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9506 |
|
| 9507 |
+
/* harmony default export */ var block_types_list = __webpack_exports__["a"] = (BlockTypesList);
|
| 9508 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9509 |
|
| 9510 |
+
/***/ }),
|
| 9511 |
+
/* 116 */
|
| 9512 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 9513 |
|
| 9514 |
+
"use strict";
|
| 9515 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 9516 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 9517 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 9518 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 9519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9521 |
/**
|
| 9522 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9523 |
*/
|
| 9524 |
|
| 9525 |
+
const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 9526 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 9527 |
+
viewBox: "0 0 24 24"
|
| 9528 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 9529 |
+
d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
|
| 9530 |
+
}));
|
| 9531 |
+
/* harmony default export */ __webpack_exports__["a"] = (check);
|
| 9532 |
+
//# sourceMappingURL=check.js.map
|
|
|
|
| 9533 |
|
| 9534 |
+
/***/ }),
|
| 9535 |
+
/* 117 */,
|
| 9536 |
+
/* 118 */,
|
| 9537 |
+
/* 119 */,
|
| 9538 |
+
/* 120 */,
|
| 9539 |
+
/* 121 */,
|
| 9540 |
+
/* 122 */,
|
| 9541 |
+
/* 123 */,
|
| 9542 |
+
/* 124 */,
|
| 9543 |
+
/* 125 */,
|
| 9544 |
+
/* 126 */
|
| 9545 |
+
/***/ (function(module, exports, __webpack_require__) {
|
| 9546 |
|
| 9547 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9548 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9549 |
|
| 9550 |
+
Object.defineProperty(exports, '__esModule', { value: true });
|
| 9551 |
|
| 9552 |
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
|
|
|
|
|
| 9553 |
|
| 9554 |
+
var _extends = _interopDefault(__webpack_require__(192));
|
| 9555 |
+
var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__(243));
|
| 9556 |
+
var React = __webpack_require__(11);
|
| 9557 |
+
var React__default = _interopDefault(React);
|
| 9558 |
+
var _inheritsLoose = _interopDefault(__webpack_require__(244));
|
| 9559 |
+
var _assertThisInitialized = _interopDefault(__webpack_require__(246));
|
| 9560 |
|
| 9561 |
+
var is = {
|
| 9562 |
+
arr: Array.isArray,
|
| 9563 |
+
obj: function obj(a) {
|
| 9564 |
+
return Object.prototype.toString.call(a) === '[object Object]';
|
| 9565 |
+
},
|
| 9566 |
+
fun: function fun(a) {
|
| 9567 |
+
return typeof a === 'function';
|
| 9568 |
+
},
|
| 9569 |
+
str: function str(a) {
|
| 9570 |
+
return typeof a === 'string';
|
| 9571 |
+
},
|
| 9572 |
+
num: function num(a) {
|
| 9573 |
+
return typeof a === 'number';
|
| 9574 |
+
},
|
| 9575 |
+
und: function und(a) {
|
| 9576 |
+
return a === void 0;
|
| 9577 |
+
},
|
| 9578 |
+
nul: function nul(a) {
|
| 9579 |
+
return a === null;
|
| 9580 |
+
},
|
| 9581 |
+
set: function set(a) {
|
| 9582 |
+
return a instanceof Set;
|
| 9583 |
+
},
|
| 9584 |
+
map: function map(a) {
|
| 9585 |
+
return a instanceof Map;
|
| 9586 |
+
},
|
| 9587 |
+
equ: function equ(a, b) {
|
| 9588 |
+
if (typeof a !== typeof b) return false;
|
| 9589 |
+
if (is.str(a) || is.num(a)) return a === b;
|
| 9590 |
+
if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true;
|
| 9591 |
+
var i;
|
| 9592 |
|
| 9593 |
+
for (i in a) {
|
| 9594 |
+
if (!(i in b)) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9595 |
}
|
| 9596 |
|
| 9597 |
+
for (i in b) {
|
| 9598 |
+
if (a[i] !== b[i]) return false;
|
| 9599 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9600 |
|
| 9601 |
+
return is.und(i) ? a === b : true;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9602 |
}
|
| 9603 |
+
};
|
| 9604 |
+
function merge(target, lowercase) {
|
| 9605 |
+
if (lowercase === void 0) {
|
| 9606 |
+
lowercase = true;
|
| 9607 |
}
|
| 9608 |
|
| 9609 |
+
return function (object) {
|
| 9610 |
+
return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) {
|
| 9611 |
+
var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element;
|
| 9612 |
+
acc[key] = target(key);
|
| 9613 |
+
return acc;
|
| 9614 |
+
}, target);
|
| 9615 |
+
};
|
| 9616 |
+
}
|
| 9617 |
+
function useForceUpdate() {
|
| 9618 |
+
var _useState = React.useState(false),
|
| 9619 |
+
f = _useState[1];
|
| 9620 |
|
| 9621 |
+
var forceUpdate = React.useCallback(function () {
|
| 9622 |
+
return f(function (v) {
|
| 9623 |
+
return !v;
|
| 9624 |
+
});
|
| 9625 |
+
}, []);
|
| 9626 |
+
return forceUpdate;
|
| 9627 |
+
}
|
| 9628 |
+
function withDefault(value, defaultValue) {
|
| 9629 |
+
return is.und(value) || is.nul(value) ? defaultValue : value;
|
| 9630 |
+
}
|
| 9631 |
+
function toArray(a) {
|
| 9632 |
+
return !is.und(a) ? is.arr(a) ? a : [a] : [];
|
| 9633 |
+
}
|
| 9634 |
+
function callProp(obj) {
|
| 9635 |
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
| 9636 |
+
args[_key - 1] = arguments[_key];
|
| 9637 |
}
|
| 9638 |
|
| 9639 |
+
return is.fun(obj) ? obj.apply(void 0, args) : obj;
|
| 9640 |
+
}
|
| 9641 |
|
| 9642 |
+
function getForwardProps(props) {
|
| 9643 |
+
var to = props.to,
|
| 9644 |
+
from = props.from,
|
| 9645 |
+
config = props.config,
|
| 9646 |
+
onStart = props.onStart,
|
| 9647 |
+
onRest = props.onRest,
|
| 9648 |
+
onFrame = props.onFrame,
|
| 9649 |
+
children = props.children,
|
| 9650 |
+
reset = props.reset,
|
| 9651 |
+
reverse = props.reverse,
|
| 9652 |
+
force = props.force,
|
| 9653 |
+
immediate = props.immediate,
|
| 9654 |
+
delay = props.delay,
|
| 9655 |
+
attach = props.attach,
|
| 9656 |
+
destroyed = props.destroyed,
|
| 9657 |
+
interpolateTo = props.interpolateTo,
|
| 9658 |
+
ref = props.ref,
|
| 9659 |
+
lazy = props.lazy,
|
| 9660 |
+
forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]);
|
| 9661 |
|
| 9662 |
+
return forward;
|
| 9663 |
+
}
|
| 9664 |
|
| 9665 |
+
function interpolateTo(props) {
|
| 9666 |
+
var forward = getForwardProps(props);
|
| 9667 |
+
if (is.und(forward)) return _extends({
|
| 9668 |
+
to: forward
|
| 9669 |
+
}, props);
|
| 9670 |
+
var rest = Object.keys(props).reduce(function (a, k) {
|
| 9671 |
+
var _extends2;
|
| 9672 |
+
|
| 9673 |
+
return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2));
|
| 9674 |
+
}, {});
|
| 9675 |
+
return _extends({
|
| 9676 |
+
to: forward
|
| 9677 |
+
}, rest);
|
| 9678 |
+
}
|
| 9679 |
+
function handleRef(ref, forward) {
|
| 9680 |
+
if (forward) {
|
| 9681 |
+
// If it's a function, assume it's a ref callback
|
| 9682 |
+
if (is.fun(forward)) forward(ref);else if (is.obj(forward)) {
|
| 9683 |
+
forward.current = ref;
|
| 9684 |
+
}
|
| 9685 |
}
|
| 9686 |
|
| 9687 |
+
return ref;
|
| 9688 |
+
}
|
|
|
|
|
|
|
|
|
|
| 9689 |
|
| 9690 |
+
var Animated =
|
| 9691 |
+
/*#__PURE__*/
|
| 9692 |
+
function () {
|
| 9693 |
+
function Animated() {
|
| 9694 |
+
this.payload = void 0;
|
| 9695 |
+
this.children = [];
|
| 9696 |
}
|
| 9697 |
|
| 9698 |
+
var _proto = Animated.prototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9699 |
|
| 9700 |
+
_proto.getAnimatedValue = function getAnimatedValue() {
|
| 9701 |
+
return this.getValue();
|
| 9702 |
+
};
|
| 9703 |
|
| 9704 |
+
_proto.getPayload = function getPayload() {
|
| 9705 |
+
return this.payload || this;
|
| 9706 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9707 |
|
| 9708 |
+
_proto.attach = function attach() {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9709 |
|
| 9710 |
+
_proto.detach = function detach() {};
|
|
|
|
| 9711 |
|
| 9712 |
+
_proto.getChildren = function getChildren() {
|
| 9713 |
+
return this.children;
|
| 9714 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9715 |
|
| 9716 |
+
_proto.addChild = function addChild(child) {
|
| 9717 |
+
if (this.children.length === 0) this.attach();
|
| 9718 |
+
this.children.push(child);
|
| 9719 |
+
};
|
| 9720 |
|
| 9721 |
+
_proto.removeChild = function removeChild(child) {
|
| 9722 |
+
var index = this.children.indexOf(child);
|
| 9723 |
+
this.children.splice(index, 1);
|
| 9724 |
+
if (this.children.length === 0) this.detach();
|
| 9725 |
+
};
|
| 9726 |
|
| 9727 |
+
return Animated;
|
| 9728 |
+
}();
|
| 9729 |
+
var AnimatedArray =
|
| 9730 |
+
/*#__PURE__*/
|
| 9731 |
+
function (_Animated) {
|
| 9732 |
+
_inheritsLoose(AnimatedArray, _Animated);
|
|
|
|
|
|
|
|
|
|
| 9733 |
|
| 9734 |
+
function AnimatedArray() {
|
| 9735 |
+
var _this;
|
| 9736 |
|
| 9737 |
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
| 9738 |
+
args[_key] = arguments[_key];
|
| 9739 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9740 |
|
| 9741 |
+
_this = _Animated.call.apply(_Animated, [this].concat(args)) || this;
|
| 9742 |
+
_this.payload = [];
|
| 9743 |
|
| 9744 |
+
_this.attach = function () {
|
| 9745 |
+
return _this.payload.forEach(function (p) {
|
| 9746 |
+
return p instanceof Animated && p.addChild(_assertThisInitialized(_this));
|
| 9747 |
+
});
|
| 9748 |
+
};
|
| 9749 |
|
| 9750 |
+
_this.detach = function () {
|
| 9751 |
+
return _this.payload.forEach(function (p) {
|
| 9752 |
+
return p instanceof Animated && p.removeChild(_assertThisInitialized(_this));
|
| 9753 |
+
});
|
| 9754 |
+
};
|
| 9755 |
|
| 9756 |
+
return _this;
|
| 9757 |
+
}
|
| 9758 |
|
| 9759 |
+
return AnimatedArray;
|
| 9760 |
+
}(Animated);
|
| 9761 |
+
var AnimatedObject =
|
| 9762 |
+
/*#__PURE__*/
|
| 9763 |
+
function (_Animated2) {
|
| 9764 |
+
_inheritsLoose(AnimatedObject, _Animated2);
|
| 9765 |
|
| 9766 |
+
function AnimatedObject() {
|
| 9767 |
+
var _this2;
|
| 9768 |
|
| 9769 |
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
| 9770 |
+
args[_key3] = arguments[_key3];
|
| 9771 |
+
}
|
| 9772 |
|
| 9773 |
+
_this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this;
|
| 9774 |
+
_this2.payload = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9775 |
|
| 9776 |
+
_this2.attach = function () {
|
| 9777 |
+
return Object.values(_this2.payload).forEach(function (s) {
|
| 9778 |
+
return s instanceof Animated && s.addChild(_assertThisInitialized(_this2));
|
| 9779 |
+
});
|
| 9780 |
+
};
|
| 9781 |
|
| 9782 |
+
_this2.detach = function () {
|
| 9783 |
+
return Object.values(_this2.payload).forEach(function (s) {
|
| 9784 |
+
return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2));
|
| 9785 |
+
});
|
| 9786 |
+
};
|
| 9787 |
|
| 9788 |
+
return _this2;
|
|
|
|
|
|
|
|
|
|
| 9789 |
}
|
| 9790 |
|
| 9791 |
+
var _proto2 = AnimatedObject.prototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9792 |
|
| 9793 |
+
_proto2.getValue = function getValue(animated) {
|
| 9794 |
+
if (animated === void 0) {
|
| 9795 |
+
animated = false;
|
| 9796 |
+
}
|
| 9797 |
|
| 9798 |
+
var payload = {};
|
|
|
|
|
|
|
|
|
|
| 9799 |
|
| 9800 |
+
for (var _key4 in this.payload) {
|
| 9801 |
+
var value = this.payload[_key4];
|
| 9802 |
+
if (animated && !(value instanceof Animated)) continue;
|
| 9803 |
+
payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value;
|
| 9804 |
+
}
|
| 9805 |
|
| 9806 |
+
return payload;
|
| 9807 |
+
};
|
| 9808 |
|
| 9809 |
+
_proto2.getAnimatedValue = function getAnimatedValue() {
|
| 9810 |
+
return this.getValue(true);
|
| 9811 |
+
};
|
| 9812 |
|
| 9813 |
+
return AnimatedObject;
|
| 9814 |
+
}(Animated);
|
|
|
|
| 9815 |
|
| 9816 |
+
var applyAnimatedValues;
|
| 9817 |
+
function injectApplyAnimatedValues(fn, transform) {
|
| 9818 |
+
applyAnimatedValues = {
|
| 9819 |
+
fn: fn,
|
| 9820 |
+
transform: transform
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9821 |
};
|
| 9822 |
+
}
|
| 9823 |
+
var colorNames;
|
| 9824 |
+
function injectColorNames(names) {
|
| 9825 |
+
colorNames = names;
|
| 9826 |
+
}
|
| 9827 |
+
var requestFrame = function requestFrame(cb) {
|
| 9828 |
+
return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1;
|
| 9829 |
+
};
|
| 9830 |
+
var cancelFrame = function cancelFrame(id) {
|
| 9831 |
+
typeof window !== 'undefined' && window.cancelAnimationFrame(id);
|
| 9832 |
+
};
|
| 9833 |
+
function injectFrame(raf, caf) {
|
| 9834 |
+
requestFrame = raf;
|
| 9835 |
+
cancelFrame = caf;
|
| 9836 |
+
}
|
| 9837 |
+
var interpolation;
|
| 9838 |
+
function injectStringInterpolator(fn) {
|
| 9839 |
+
interpolation = fn;
|
| 9840 |
+
}
|
| 9841 |
+
var now = function now() {
|
| 9842 |
+
return Date.now();
|
| 9843 |
+
};
|
| 9844 |
+
function injectNow(nowFn) {
|
| 9845 |
+
now = nowFn;
|
| 9846 |
+
}
|
| 9847 |
+
var defaultElement;
|
| 9848 |
+
function injectDefaultElement(el) {
|
| 9849 |
+
defaultElement = el;
|
| 9850 |
+
}
|
| 9851 |
+
var animatedApi = function animatedApi(node) {
|
| 9852 |
+
return node.current;
|
| 9853 |
+
};
|
| 9854 |
+
function injectAnimatedApi(fn) {
|
| 9855 |
+
animatedApi = fn;
|
| 9856 |
+
}
|
| 9857 |
+
var createAnimatedStyle;
|
| 9858 |
+
function injectCreateAnimatedStyle(factory) {
|
| 9859 |
+
createAnimatedStyle = factory;
|
| 9860 |
+
}
|
| 9861 |
+
var manualFrameloop;
|
| 9862 |
+
function injectManualFrameloop(callback) {
|
| 9863 |
+
manualFrameloop = callback;
|
| 9864 |
+
}
|
| 9865 |
|
| 9866 |
+
var Globals = /*#__PURE__*/Object.freeze({
|
| 9867 |
+
get applyAnimatedValues () { return applyAnimatedValues; },
|
| 9868 |
+
injectApplyAnimatedValues: injectApplyAnimatedValues,
|
| 9869 |
+
get colorNames () { return colorNames; },
|
| 9870 |
+
injectColorNames: injectColorNames,
|
| 9871 |
+
get requestFrame () { return requestFrame; },
|
| 9872 |
+
get cancelFrame () { return cancelFrame; },
|
| 9873 |
+
injectFrame: injectFrame,
|
| 9874 |
+
get interpolation () { return interpolation; },
|
| 9875 |
+
injectStringInterpolator: injectStringInterpolator,
|
| 9876 |
+
get now () { return now; },
|
| 9877 |
+
injectNow: injectNow,
|
| 9878 |
+
get defaultElement () { return defaultElement; },
|
| 9879 |
+
injectDefaultElement: injectDefaultElement,
|
| 9880 |
+
get animatedApi () { return animatedApi; },
|
| 9881 |
+
injectAnimatedApi: injectAnimatedApi,
|
| 9882 |
+
get createAnimatedStyle () { return createAnimatedStyle; },
|
| 9883 |
+
injectCreateAnimatedStyle: injectCreateAnimatedStyle,
|
| 9884 |
+
get manualFrameloop () { return manualFrameloop; },
|
| 9885 |
+
injectManualFrameloop: injectManualFrameloop
|
| 9886 |
+
});
|
| 9887 |
|
| 9888 |
+
/**
|
| 9889 |
+
* Wraps the `style` property with `AnimatedStyle`.
|
| 9890 |
+
*/
|
|
|
|
|
|
|
| 9891 |
|
| 9892 |
+
var AnimatedProps =
|
| 9893 |
+
/*#__PURE__*/
|
| 9894 |
+
function (_AnimatedObject) {
|
| 9895 |
+
_inheritsLoose(AnimatedProps, _AnimatedObject);
|
| 9896 |
|
| 9897 |
+
function AnimatedProps(props, callback) {
|
| 9898 |
+
var _this;
|
|
|
|
|
|
|
| 9899 |
|
| 9900 |
+
_this = _AnimatedObject.call(this) || this;
|
| 9901 |
+
_this.update = void 0;
|
| 9902 |
+
_this.payload = !props.style ? props : _extends({}, props, {
|
| 9903 |
+
style: createAnimatedStyle(props.style)
|
| 9904 |
+
});
|
| 9905 |
+
_this.update = callback;
|
| 9906 |
|
| 9907 |
+
_this.attach();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9908 |
|
| 9909 |
+
return _this;
|
| 9910 |
+
}
|
| 9911 |
|
| 9912 |
+
return AnimatedProps;
|
| 9913 |
+
}(AnimatedObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9914 |
|
| 9915 |
+
var createAnimatedComponent = function createAnimatedComponent(Component) {
|
| 9916 |
+
var AnimatedComponent = React.forwardRef(function (props, _ref) {
|
| 9917 |
+
var forceUpdate = useForceUpdate();
|
| 9918 |
+
var mounted = React.useRef(true);
|
| 9919 |
+
var propsAnimated = React.useRef(null);
|
| 9920 |
+
var node = React.useRef(null);
|
| 9921 |
+
var attachProps = React.useCallback(function (props) {
|
| 9922 |
+
var oldPropsAnimated = propsAnimated.current;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9923 |
|
| 9924 |
+
var callback = function callback() {
|
| 9925 |
+
if (node.current) {
|
| 9926 |
+
var didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue());
|
| 9927 |
+
if (didUpdate === false) forceUpdate();
|
| 9928 |
+
}
|
| 9929 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9930 |
|
| 9931 |
+
propsAnimated.current = new AnimatedProps(props, callback);
|
| 9932 |
+
oldPropsAnimated && oldPropsAnimated.detach();
|
| 9933 |
+
}, []);
|
| 9934 |
+
React.useEffect(function () {
|
| 9935 |
+
return function () {
|
| 9936 |
+
mounted.current = false;
|
| 9937 |
+
propsAnimated.current && propsAnimated.current.detach();
|
| 9938 |
+
};
|
| 9939 |
+
}, []);
|
| 9940 |
+
React.useImperativeHandle(_ref, function () {
|
| 9941 |
+
return animatedApi(node, mounted, forceUpdate);
|
| 9942 |
+
});
|
| 9943 |
+
attachProps(props);
|
| 9944 |
|
| 9945 |
+
var _getValue = propsAnimated.current.getValue(),
|
| 9946 |
+
scrollTop = _getValue.scrollTop,
|
| 9947 |
+
scrollLeft = _getValue.scrollLeft,
|
| 9948 |
+
animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]);
|
| 9949 |
|
| 9950 |
+
return React__default.createElement(Component, _extends({}, animatedProps, {
|
| 9951 |
+
ref: function ref(childRef) {
|
| 9952 |
+
return node.current = handleRef(childRef, _ref);
|
| 9953 |
+
}
|
| 9954 |
+
}));
|
| 9955 |
+
});
|
| 9956 |
+
return AnimatedComponent;
|
| 9957 |
+
};
|
|
|
|
|
|
|
|
|
|
| 9958 |
|
| 9959 |
+
var active = false;
|
| 9960 |
+
var controllers = new Set();
|
|
|
|
|
|
|
| 9961 |
|
| 9962 |
+
var update = function update() {
|
| 9963 |
+
if (!active) return false;
|
| 9964 |
+
var time = now();
|
| 9965 |
|
| 9966 |
+
for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
| 9967 |
+
var _ref;
|
|
|
|
|
|
|
| 9968 |
|
| 9969 |
+
if (_isArray) {
|
| 9970 |
+
if (_i >= _iterator.length) break;
|
| 9971 |
+
_ref = _iterator[_i++];
|
| 9972 |
+
} else {
|
| 9973 |
+
_i = _iterator.next();
|
| 9974 |
+
if (_i.done) break;
|
| 9975 |
+
_ref = _i.value;
|
| 9976 |
+
}
|
| 9977 |
|
| 9978 |
+
var controller = _ref;
|
| 9979 |
+
var isActive = false;
|
| 9980 |
|
| 9981 |
+
for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) {
|
| 9982 |
+
var config = controller.configs[configIdx];
|
| 9983 |
+
var endOfAnimation = void 0,
|
| 9984 |
+
lastTime = void 0;
|
| 9985 |
|
| 9986 |
+
for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) {
|
| 9987 |
+
var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude
|
|
|
|
| 9988 |
|
| 9989 |
+
if (animation.done) continue;
|
| 9990 |
+
var from = config.fromValues[valIdx];
|
| 9991 |
+
var to = config.toValues[valIdx];
|
| 9992 |
+
var position = animation.lastPosition;
|
| 9993 |
+
var isAnimated = to instanceof Animated;
|
| 9994 |
+
var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity;
|
| 9995 |
+
if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state
|
| 9996 |
|
| 9997 |
+
if (config.immediate) {
|
| 9998 |
+
animation.setValue(to);
|
| 9999 |
+
animation.done = true;
|
| 10000 |
+
continue;
|
| 10001 |
+
} // Break animation when string values are involved
|
| 10002 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10003 |
|
| 10004 |
+
if (typeof from === 'string' || typeof to === 'string') {
|
| 10005 |
+
animation.setValue(to);
|
| 10006 |
+
animation.done = true;
|
| 10007 |
+
continue;
|
| 10008 |
+
}
|
| 10009 |
|
| 10010 |
+
if (config.duration !== void 0) {
|
| 10011 |
+
/** Duration easing */
|
| 10012 |
+
position = from + config.easing((time - animation.startTime) / config.duration) * (to - from);
|
| 10013 |
+
endOfAnimation = time >= animation.startTime + config.duration;
|
| 10014 |
+
} else if (config.decay) {
|
| 10015 |
+
/** Decay easing */
|
| 10016 |
+
position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime)));
|
| 10017 |
+
endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1;
|
| 10018 |
+
if (endOfAnimation) to = position;
|
| 10019 |
+
} else {
|
| 10020 |
+
/** Spring easing */
|
| 10021 |
+
lastTime = animation.lastTime !== void 0 ? animation.lastTime : time;
|
| 10022 |
+
velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10023 |
|
| 10024 |
+
if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10025 |
|
| 10026 |
+
var numSteps = Math.floor(time - lastTime);
|
|
|
|
| 10027 |
|
| 10028 |
+
for (var i = 0; i < numSteps; ++i) {
|
| 10029 |
+
var force = -config.tension * (position - to);
|
| 10030 |
+
var damping = -config.friction * velocity;
|
| 10031 |
+
var acceleration = (force + damping) / config.mass;
|
| 10032 |
+
velocity = velocity + acceleration * 1 / 1000;
|
| 10033 |
+
position = position + velocity * 1 / 1000;
|
| 10034 |
+
} // Conditions for stopping the spring animation
|
| 10035 |
|
|
|
|
|
|
|
|
|
|
| 10036 |
|
| 10037 |
+
var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false;
|
| 10038 |
+
var isVelocity = Math.abs(velocity) <= config.precision;
|
| 10039 |
+
var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true;
|
| 10040 |
+
endOfAnimation = isOvershooting || isVelocity && isDisplacement;
|
| 10041 |
+
animation.lastVelocity = velocity;
|
| 10042 |
+
animation.lastTime = time;
|
| 10043 |
+
} // Trails aren't done until their parents conclude
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10044 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10045 |
|
| 10046 |
+
if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10047 |
|
| 10048 |
+
if (endOfAnimation) {
|
| 10049 |
+
// Ensure that we end up with a round value
|
| 10050 |
+
if (animation.value !== to) position = to;
|
| 10051 |
+
animation.done = true;
|
| 10052 |
+
} else isActive = true;
|
| 10053 |
|
| 10054 |
+
animation.setValue(position);
|
| 10055 |
+
animation.lastPosition = position;
|
| 10056 |
+
} // Keep track of updated values only when necessary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10057 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10058 |
|
| 10059 |
+
if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue();
|
| 10060 |
+
} // Update callbacks in the end of the frame
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10061 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10062 |
|
| 10063 |
+
if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10064 |
|
| 10065 |
+
if (!isActive) {
|
| 10066 |
+
controllers.delete(controller);
|
| 10067 |
+
controller.stop(true);
|
|
|
|
| 10068 |
}
|
| 10069 |
+
} // Loop over as long as there are controllers ...
|
| 10070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10071 |
|
| 10072 |
+
if (controllers.size) {
|
| 10073 |
+
if (manualFrameloop) manualFrameloop();else requestFrame(update);
|
| 10074 |
+
} else {
|
| 10075 |
+
active = false;
|
| 10076 |
+
}
|
| 10077 |
|
| 10078 |
+
return active;
|
| 10079 |
+
};
|
|
|
|
|
|
|
| 10080 |
|
| 10081 |
+
var start = function start(controller) {
|
| 10082 |
+
if (!controllers.has(controller)) controllers.add(controller);
|
| 10083 |
|
| 10084 |
+
if (!active) {
|
| 10085 |
+
active = true;
|
| 10086 |
+
if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update);
|
| 10087 |
+
}
|
| 10088 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10089 |
|
| 10090 |
+
var stop = function stop(controller) {
|
| 10091 |
+
if (controllers.has(controller)) controllers.delete(controller);
|
| 10092 |
+
};
|
| 10093 |
|
| 10094 |
+
function createInterpolator(range, output, extrapolate) {
|
| 10095 |
+
if (typeof range === 'function') {
|
| 10096 |
+
return range;
|
| 10097 |
+
}
|
| 10098 |
|
| 10099 |
+
if (Array.isArray(range)) {
|
| 10100 |
+
return createInterpolator({
|
| 10101 |
+
range: range,
|
| 10102 |
+
output: output,
|
| 10103 |
+
extrapolate: extrapolate
|
| 10104 |
+
});
|
| 10105 |
}
|
| 10106 |
|
| 10107 |
+
if (interpolation && typeof range.output[0] === 'string') {
|
| 10108 |
+
return interpolation(range);
|
| 10109 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10110 |
|
| 10111 |
+
var config = range;
|
| 10112 |
+
var outputRange = config.output;
|
| 10113 |
+
var inputRange = config.range || [0, 1];
|
| 10114 |
+
var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';
|
| 10115 |
+
var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10116 |
|
| 10117 |
+
var easing = config.easing || function (t) {
|
| 10118 |
+
return t;
|
| 10119 |
+
};
|
| 10120 |
+
|
| 10121 |
+
return function (input) {
|
| 10122 |
+
var range = findRange(input, inputRange);
|
| 10123 |
+
return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);
|
| 10124 |
+
};
|
| 10125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10126 |
|
| 10127 |
+
function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
|
| 10128 |
+
var result = map ? map(input) : input; // Extrapolate
|
| 10129 |
|
| 10130 |
+
if (result < inputMin) {
|
| 10131 |
+
if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;
|
| 10132 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10133 |
|
| 10134 |
+
if (result > inputMax) {
|
| 10135 |
+
if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;
|
| 10136 |
+
}
|
| 10137 |
|
| 10138 |
+
if (outputMin === outputMax) return outputMin;
|
| 10139 |
+
if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10140 |
|
| 10141 |
+
if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10142 |
|
| 10143 |
+
result = easing(result); // Output Range
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10144 |
|
| 10145 |
+
if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;
|
| 10146 |
+
return result;
|
| 10147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10148 |
|
| 10149 |
+
function findRange(input, inputRange) {
|
| 10150 |
+
for (var i = 1; i < inputRange.length - 1; ++i) {
|
| 10151 |
+
if (inputRange[i] >= input) break;
|
| 10152 |
+
}
|
| 10153 |
+
|
| 10154 |
+
return i - 1;
|
| 10155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10156 |
|
| 10157 |
+
var AnimatedInterpolation =
|
| 10158 |
+
/*#__PURE__*/
|
| 10159 |
+
function (_AnimatedArray) {
|
| 10160 |
+
_inheritsLoose(AnimatedInterpolation, _AnimatedArray);
|
| 10161 |
|
| 10162 |
+
function AnimatedInterpolation(parents, range, output) {
|
| 10163 |
+
var _this;
|
| 10164 |
+
|
| 10165 |
+
_this = _AnimatedArray.call(this) || this;
|
| 10166 |
+
_this.calc = void 0;
|
| 10167 |
+
_this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents];
|
| 10168 |
+
_this.calc = createInterpolator(range, output);
|
| 10169 |
+
return _this;
|
| 10170 |
+
}
|
| 10171 |
|
| 10172 |
+
var _proto = AnimatedInterpolation.prototype;
|
| 10173 |
|
| 10174 |
+
_proto.getValue = function getValue() {
|
| 10175 |
+
return this.calc.apply(this, this.payload.map(function (value) {
|
| 10176 |
+
return value.getValue();
|
| 10177 |
+
}));
|
| 10178 |
+
};
|
| 10179 |
|
| 10180 |
+
_proto.updateConfig = function updateConfig(range, output) {
|
| 10181 |
+
this.calc = createInterpolator(range, output);
|
| 10182 |
+
};
|
| 10183 |
|
| 10184 |
+
_proto.interpolate = function interpolate(range, output) {
|
| 10185 |
+
return new AnimatedInterpolation(this, range, output);
|
| 10186 |
+
};
|
| 10187 |
|
| 10188 |
+
return AnimatedInterpolation;
|
| 10189 |
+
}(AnimatedArray);
|
| 10190 |
+
|
| 10191 |
+
var interpolate$1 = function interpolate(parents, range, output) {
|
| 10192 |
+
return parents && new AnimatedInterpolation(parents, range, output);
|
| 10193 |
+
};
|
| 10194 |
+
|
| 10195 |
+
var config = {
|
| 10196 |
+
default: {
|
| 10197 |
+
tension: 170,
|
| 10198 |
+
friction: 26
|
| 10199 |
+
},
|
| 10200 |
+
gentle: {
|
| 10201 |
+
tension: 120,
|
| 10202 |
+
friction: 14
|
| 10203 |
+
},
|
| 10204 |
+
wobbly: {
|
| 10205 |
+
tension: 180,
|
| 10206 |
+
friction: 12
|
| 10207 |
+
},
|
| 10208 |
+
stiff: {
|
| 10209 |
+
tension: 210,
|
| 10210 |
+
friction: 20
|
| 10211 |
+
},
|
| 10212 |
+
slow: {
|
| 10213 |
+
tension: 280,
|
| 10214 |
+
friction: 60
|
| 10215 |
+
},
|
| 10216 |
+
molasses: {
|
| 10217 |
+
tension: 280,
|
| 10218 |
+
friction: 120
|
| 10219 |
}
|
| 10220 |
+
};
|
| 10221 |
|
| 10222 |
+
/** API
|
| 10223 |
+
* useChain(references, timeSteps, timeFrame)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10224 |
*/
|
| 10225 |
|
| 10226 |
+
function useChain(refs, timeSteps, timeFrame) {
|
| 10227 |
+
if (timeFrame === void 0) {
|
| 10228 |
+
timeFrame = 1000;
|
| 10229 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10230 |
|
| 10231 |
+
var previous = React.useRef();
|
| 10232 |
+
React.useEffect(function () {
|
| 10233 |
+
if (is.equ(refs, previous.current)) refs.forEach(function (_ref) {
|
| 10234 |
+
var current = _ref.current;
|
| 10235 |
+
return current && current.start();
|
| 10236 |
+
});else if (timeSteps) {
|
| 10237 |
+
refs.forEach(function (_ref2, index) {
|
| 10238 |
+
var current = _ref2.current;
|
| 10239 |
|
| 10240 |
+
if (current) {
|
| 10241 |
+
var ctrls = current.controllers;
|
|
|
|
| 10242 |
|
| 10243 |
+
if (ctrls.length) {
|
| 10244 |
+
var t = timeFrame * timeSteps[index];
|
| 10245 |
+
ctrls.forEach(function (ctrl) {
|
| 10246 |
+
ctrl.queue = ctrl.queue.map(function (e) {
|
| 10247 |
+
return _extends({}, e, {
|
| 10248 |
+
delay: e.delay + t
|
| 10249 |
+
});
|
| 10250 |
+
});
|
| 10251 |
+
ctrl.start();
|
| 10252 |
+
});
|
| 10253 |
+
}
|
| 10254 |
+
}
|
| 10255 |
+
});
|
| 10256 |
+
} else refs.reduce(function (q, _ref3, rI) {
|
| 10257 |
+
var current = _ref3.current;
|
| 10258 |
+
return q = q.then(function () {
|
| 10259 |
+
return current.start();
|
| 10260 |
+
});
|
| 10261 |
+
}, Promise.resolve());
|
| 10262 |
+
previous.current = refs;
|
| 10263 |
+
});
|
| 10264 |
+
}
|
| 10265 |
|
| 10266 |
/**
|
| 10267 |
+
* Animated works by building a directed acyclic graph of dependencies
|
| 10268 |
+
* transparently when you render your Animated components.
|
| 10269 |
+
*
|
| 10270 |
+
* new Animated.Value(0)
|
| 10271 |
+
* .interpolate() .interpolate() new Animated.Value(1)
|
| 10272 |
+
* opacity translateY scale
|
| 10273 |
+
* style transform
|
| 10274 |
+
* View#234 style
|
| 10275 |
+
* View#123
|
| 10276 |
+
*
|
| 10277 |
+
* A) Top Down phase
|
| 10278 |
+
* When an AnimatedValue is updated, we recursively go down through this
|
| 10279 |
+
* graph in order to find leaf nodes: the views that we flag as needing
|
| 10280 |
+
* an update.
|
| 10281 |
+
*
|
| 10282 |
+
* B) Bottom Up phase
|
| 10283 |
+
* When a view is flagged as needing an update, we recursively go back up
|
| 10284 |
+
* in order to build the new value that it needs. The reason why we need
|
| 10285 |
+
* this two-phases process is to deal with composite props such as
|
| 10286 |
+
* transform which can receive values from multiple parents.
|
| 10287 |
*/
|
| 10288 |
+
function addAnimatedStyles(node, styles) {
|
| 10289 |
+
if ('update' in node) {
|
| 10290 |
+
styles.add(node);
|
| 10291 |
+
} else {
|
| 10292 |
+
node.getChildren().forEach(function (child) {
|
| 10293 |
+
return addAnimatedStyles(child, styles);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10294 |
});
|
| 10295 |
+
}
|
| 10296 |
+
}
|
| 10297 |
|
| 10298 |
+
var AnimatedValue =
|
| 10299 |
+
/*#__PURE__*/
|
| 10300 |
+
function (_Animated) {
|
| 10301 |
+
_inheritsLoose(AnimatedValue, _Animated);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10302 |
|
| 10303 |
+
function AnimatedValue(_value) {
|
| 10304 |
+
var _this;
|
|
|
|
| 10305 |
|
| 10306 |
+
_this = _Animated.call(this) || this;
|
| 10307 |
+
_this.animatedStyles = new Set();
|
| 10308 |
+
_this.value = void 0;
|
| 10309 |
+
_this.startPosition = void 0;
|
| 10310 |
+
_this.lastPosition = void 0;
|
| 10311 |
+
_this.lastVelocity = void 0;
|
| 10312 |
+
_this.startTime = void 0;
|
| 10313 |
+
_this.lastTime = void 0;
|
| 10314 |
+
_this.done = false;
|
| 10315 |
|
| 10316 |
+
_this.setValue = function (value, flush) {
|
| 10317 |
+
if (flush === void 0) {
|
| 10318 |
+
flush = true;
|
| 10319 |
+
}
|
| 10320 |
|
| 10321 |
+
_this.value = value;
|
| 10322 |
+
if (flush) _this.flush();
|
| 10323 |
+
};
|
| 10324 |
|
| 10325 |
+
_this.value = _value;
|
| 10326 |
+
_this.startPosition = _value;
|
| 10327 |
+
_this.lastPosition = _value;
|
| 10328 |
+
return _this;
|
| 10329 |
+
}
|
| 10330 |
|
| 10331 |
+
var _proto = AnimatedValue.prototype;
|
| 10332 |
|
| 10333 |
+
_proto.flush = function flush() {
|
| 10334 |
+
if (this.animatedStyles.size === 0) {
|
| 10335 |
+
addAnimatedStyles(this, this.animatedStyles);
|
| 10336 |
+
}
|
| 10337 |
|
| 10338 |
+
this.animatedStyles.forEach(function (animatedStyle) {
|
| 10339 |
+
return animatedStyle.update();
|
| 10340 |
+
});
|
| 10341 |
+
};
|
| 10342 |
|
| 10343 |
+
_proto.clearStyles = function clearStyles() {
|
| 10344 |
+
this.animatedStyles.clear();
|
| 10345 |
+
};
|
| 10346 |
|
| 10347 |
+
_proto.getValue = function getValue() {
|
| 10348 |
+
return this.value;
|
| 10349 |
+
};
|
| 10350 |
|
| 10351 |
+
_proto.interpolate = function interpolate(range, output) {
|
| 10352 |
+
return new AnimatedInterpolation(this, range, output);
|
| 10353 |
+
};
|
|
|
|
|
|
|
|
|
|
| 10354 |
|
| 10355 |
+
return AnimatedValue;
|
| 10356 |
+
}(Animated);
|
|
|
|
| 10357 |
|
| 10358 |
+
var AnimatedValueArray =
|
| 10359 |
+
/*#__PURE__*/
|
| 10360 |
+
function (_AnimatedArray) {
|
| 10361 |
+
_inheritsLoose(AnimatedValueArray, _AnimatedArray);
|
|
|
|
|
|
|
| 10362 |
|
| 10363 |
+
function AnimatedValueArray(values) {
|
| 10364 |
+
var _this;
|
|
|
|
| 10365 |
|
| 10366 |
+
_this = _AnimatedArray.call(this) || this;
|
| 10367 |
+
_this.payload = values.map(function (n) {
|
| 10368 |
+
return new AnimatedValue(n);
|
| 10369 |
+
});
|
| 10370 |
+
return _this;
|
| 10371 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10372 |
|
| 10373 |
+
var _proto = AnimatedValueArray.prototype;
|
| 10374 |
|
| 10375 |
+
_proto.setValue = function setValue(value, flush) {
|
| 10376 |
+
var _this2 = this;
|
| 10377 |
+
|
| 10378 |
+
if (flush === void 0) {
|
| 10379 |
+
flush = true;
|
| 10380 |
+
}
|
| 10381 |
+
|
| 10382 |
+
if (Array.isArray(value)) {
|
| 10383 |
+
if (value.length === this.payload.length) {
|
| 10384 |
+
value.forEach(function (v, i) {
|
| 10385 |
+
return _this2.payload[i].setValue(v, flush);
|
| 10386 |
+
});
|
| 10387 |
+
}
|
| 10388 |
+
} else {
|
| 10389 |
+
this.payload.forEach(function (p) {
|
| 10390 |
+
return p.setValue(value, flush);
|
| 10391 |
+
});
|
| 10392 |
+
}
|
| 10393 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10394 |
|
| 10395 |
+
_proto.getValue = function getValue() {
|
| 10396 |
+
return this.payload.map(function (v) {
|
| 10397 |
+
return v.getValue();
|
| 10398 |
+
});
|
| 10399 |
+
};
|
| 10400 |
|
| 10401 |
+
_proto.interpolate = function interpolate(range, output) {
|
| 10402 |
+
return new AnimatedInterpolation(this, range, output);
|
| 10403 |
+
};
|
| 10404 |
|
| 10405 |
+
return AnimatedValueArray;
|
| 10406 |
+
}(AnimatedArray);
|
| 10407 |
|
| 10408 |
+
var G = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10409 |
|
| 10410 |
+
var Controller =
|
| 10411 |
+
/*#__PURE__*/
|
| 10412 |
+
function () {
|
| 10413 |
+
function Controller() {
|
| 10414 |
+
var _this = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10415 |
|
| 10416 |
+
this.id = void 0;
|
| 10417 |
+
this.idle = true;
|
| 10418 |
+
this.hasChanged = false;
|
| 10419 |
+
this.guid = 0;
|
| 10420 |
+
this.local = 0;
|
| 10421 |
+
this.props = {};
|
| 10422 |
+
this.merged = {};
|
| 10423 |
+
this.animations = {};
|
| 10424 |
+
this.interpolations = {};
|
| 10425 |
+
this.values = {};
|
| 10426 |
+
this.configs = [];
|
| 10427 |
+
this.listeners = [];
|
| 10428 |
+
this.queue = [];
|
| 10429 |
+
this.localQueue = void 0;
|
|
|
|
|
|
|
|
|
|
| 10430 |
|
| 10431 |
+
this.getValues = function () {
|
| 10432 |
+
return _this.interpolations;
|
| 10433 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10434 |
|
| 10435 |
+
this.id = G++;
|
| 10436 |
+
}
|
| 10437 |
+
/** update(props)
|
| 10438 |
+
* This function filters input props and creates an array of tasks which are executed in .start()
|
| 10439 |
+
* Each task is allowed to carry a delay, which means it can execute asnychroneously */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10441 |
|
| 10442 |
+
var _proto = Controller.prototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10443 |
|
| 10444 |
+
_proto.update = function update$$1(args) {
|
| 10445 |
+
//this._id = n + this.id
|
| 10446 |
+
if (!args) return this; // Extract delay and the to-prop from props
|
| 10447 |
|
| 10448 |
+
var _ref = interpolateTo(args),
|
| 10449 |
+
_ref$delay = _ref.delay,
|
| 10450 |
+
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
| 10451 |
+
to = _ref.to,
|
| 10452 |
+
props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10453 |
|
| 10454 |
+
if (is.arr(to) || is.fun(to)) {
|
| 10455 |
+
// If config is either a function or an array queue it up as is
|
| 10456 |
+
this.queue.push(_extends({}, props, {
|
| 10457 |
+
delay: delay,
|
| 10458 |
+
to: to
|
| 10459 |
+
}));
|
| 10460 |
+
} else if (to) {
|
| 10461 |
+
// Otherwise go through each key since it could be delayed individually
|
| 10462 |
+
var ops = {};
|
| 10463 |
+
Object.entries(to).forEach(function (_ref2) {
|
| 10464 |
+
var _to;
|
| 10465 |
|
| 10466 |
+
var k = _ref2[0],
|
| 10467 |
+
v = _ref2[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10468 |
|
| 10469 |
+
// Fetch delay and create an entry, consisting of the to-props, the delay, and basic props
|
| 10470 |
+
var entry = _extends({
|
| 10471 |
+
to: (_to = {}, _to[k] = v, _to),
|
| 10472 |
+
delay: callProp(delay, k)
|
| 10473 |
+
}, props);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10474 |
|
| 10475 |
+
var previous = ops[entry.delay] && ops[entry.delay].to;
|
| 10476 |
+
ops[entry.delay] = _extends({}, ops[entry.delay], entry, {
|
| 10477 |
+
to: _extends({}, previous, entry.to)
|
| 10478 |
+
});
|
| 10479 |
+
});
|
| 10480 |
+
this.queue = Object.values(ops);
|
| 10481 |
+
} // Sort queue, so that async calls go last
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10482 |
|
|
|
|
|
|
|
|
|
|
| 10483 |
|
| 10484 |
+
this.queue = this.queue.sort(function (a, b) {
|
| 10485 |
+
return a.delay - b.delay;
|
| 10486 |
+
}); // Diff the reduced props immediately (they'll contain the from-prop and some config)
|
| 10487 |
|
| 10488 |
+
this.diff(props);
|
| 10489 |
+
return this;
|
| 10490 |
+
}
|
| 10491 |
+
/** start(onEnd)
|
| 10492 |
+
* This function either executes a queue, if present, or starts the frameloop, which animates */
|
| 10493 |
+
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10494 |
|
| 10495 |
+
_proto.start = function start$$1(onEnd) {
|
| 10496 |
+
var _this2 = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10497 |
|
| 10498 |
+
// If a queue is present we must excecute it
|
| 10499 |
+
if (this.queue.length) {
|
| 10500 |
+
this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values
|
|
|
|
|
|
|
|
|
|
| 10501 |
|
| 10502 |
+
if (this.localQueue) {
|
| 10503 |
+
this.localQueue.forEach(function (_ref3) {
|
| 10504 |
+
var _ref3$from = _ref3.from,
|
| 10505 |
+
from = _ref3$from === void 0 ? {} : _ref3$from,
|
| 10506 |
+
_ref3$to = _ref3.to,
|
| 10507 |
+
to = _ref3$to === void 0 ? {} : _ref3$to;
|
| 10508 |
+
if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged);
|
| 10509 |
+
if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to);
|
| 10510 |
+
});
|
| 10511 |
+
} // The guid helps us tracking frames, a new queue over an old one means an override
|
| 10512 |
+
// We discard async calls in that caseÍ
|
| 10513 |
|
|
|
|
|
|
|
|
|
|
| 10514 |
|
| 10515 |
+
var local = this.local = ++this.guid;
|
| 10516 |
+
var queue = this.localQueue = this.queue;
|
| 10517 |
+
this.queue = []; // Go through each entry and execute it
|
| 10518 |
|
| 10519 |
+
queue.forEach(function (_ref4, index) {
|
| 10520 |
+
var delay = _ref4.delay,
|
| 10521 |
+
props = _objectWithoutPropertiesLoose(_ref4, ["delay"]);
|
| 10522 |
|
| 10523 |
+
var cb = function cb(finished) {
|
| 10524 |
+
if (index === queue.length - 1 && local === _this2.guid && finished) {
|
| 10525 |
+
_this2.idle = true;
|
| 10526 |
+
if (_this2.props.onRest) _this2.props.onRest(_this2.merged);
|
| 10527 |
+
}
|
| 10528 |
|
| 10529 |
+
if (onEnd) onEnd();
|
| 10530 |
+
}; // Entries can be delayed, ansyc or immediate
|
| 10531 |
|
|
|
|
|
|
|
|
|
|
| 10532 |
|
| 10533 |
+
var async = is.arr(props.to) || is.fun(props.to);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10534 |
|
| 10535 |
+
if (delay) {
|
| 10536 |
+
setTimeout(function () {
|
| 10537 |
+
if (local === _this2.guid) {
|
| 10538 |
+
if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb);
|
| 10539 |
+
}
|
| 10540 |
+
}, delay);
|
| 10541 |
+
} else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb);
|
| 10542 |
+
});
|
| 10543 |
+
} // Otherwise we kick of the frameloop
|
| 10544 |
+
else {
|
| 10545 |
+
if (is.fun(onEnd)) this.listeners.push(onEnd);
|
| 10546 |
+
if (this.props.onStart) this.props.onStart();
|
| 10547 |
|
| 10548 |
+
start(this);
|
| 10549 |
+
}
|
|
|
|
|
|
|
| 10550 |
|
| 10551 |
+
return this;
|
| 10552 |
+
};
|
|
|
|
| 10553 |
|
| 10554 |
+
_proto.stop = function stop$$1(finished) {
|
| 10555 |
+
this.listeners.forEach(function (onEnd) {
|
| 10556 |
+
return onEnd(finished);
|
| 10557 |
+
});
|
| 10558 |
+
this.listeners = [];
|
| 10559 |
+
return this;
|
| 10560 |
}
|
| 10561 |
+
/** Pause sets onEnd listeners free, but also removes the controller from the frameloop */
|
| 10562 |
+
;
|
| 10563 |
|
| 10564 |
+
_proto.pause = function pause(finished) {
|
| 10565 |
+
this.stop(true);
|
| 10566 |
+
if (finished) stop(this);
|
| 10567 |
+
return this;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10568 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10569 |
|
| 10570 |
+
_proto.runAsync = function runAsync(_ref5, onEnd) {
|
| 10571 |
+
var _this3 = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10572 |
|
| 10573 |
+
var delay = _ref5.delay,
|
| 10574 |
+
props = _objectWithoutPropertiesLoose(_ref5, ["delay"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10575 |
|
| 10576 |
+
var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now
|
| 10577 |
+
// If the view relies on certain values "from" has to be present
|
|
|
|
| 10578 |
|
| 10579 |
+
var queue = Promise.resolve(undefined);
|
|
|
|
|
|
|
| 10580 |
|
| 10581 |
+
if (is.arr(props.to)) {
|
| 10582 |
+
var _loop = function _loop(i) {
|
| 10583 |
+
var index = i;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10584 |
|
| 10585 |
+
var fresh = _extends({}, props, interpolateTo(props.to[index]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10586 |
|
| 10587 |
+
if (is.arr(fresh.config)) fresh.config = fresh.config[index];
|
| 10588 |
+
queue = queue.then(function () {
|
| 10589 |
+
//this.stop()
|
| 10590 |
+
if (local === _this3.guid) return new Promise(function (r) {
|
| 10591 |
+
return _this3.diff(fresh).start(r);
|
| 10592 |
+
});
|
| 10593 |
+
});
|
| 10594 |
+
};
|
| 10595 |
|
| 10596 |
+
for (var i = 0; i < props.to.length; i++) {
|
| 10597 |
+
_loop(i);
|
| 10598 |
+
}
|
| 10599 |
+
} else if (is.fun(props.to)) {
|
| 10600 |
+
var index = 0;
|
| 10601 |
+
var last;
|
| 10602 |
+
queue = queue.then(function () {
|
| 10603 |
+
return props.to( // next(props)
|
| 10604 |
+
function (p) {
|
| 10605 |
+
var fresh = _extends({}, props, interpolateTo(p));
|
| 10606 |
|
| 10607 |
+
if (is.arr(fresh.config)) fresh.config = fresh.config[index];
|
| 10608 |
+
index++; //this.stop()
|
| 10609 |
|
| 10610 |
+
if (local === _this3.guid) return last = new Promise(function (r) {
|
| 10611 |
+
return _this3.diff(fresh).start(r);
|
| 10612 |
+
});
|
| 10613 |
+
return;
|
| 10614 |
+
}, // cancel()
|
| 10615 |
+
function (finished) {
|
| 10616 |
+
if (finished === void 0) {
|
| 10617 |
+
finished = true;
|
| 10618 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10619 |
|
| 10620 |
+
return _this3.stop(finished);
|
| 10621 |
+
}).then(function () {
|
| 10622 |
+
return last;
|
| 10623 |
+
});
|
| 10624 |
+
});
|
| 10625 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10626 |
|
| 10627 |
+
queue.then(onEnd);
|
| 10628 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10629 |
|
| 10630 |
+
_proto.diff = function diff(props) {
|
| 10631 |
+
var _this4 = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10632 |
|
| 10633 |
+
this.props = _extends({}, this.props, props);
|
| 10634 |
+
var _this$props = this.props,
|
| 10635 |
+
_this$props$from = _this$props.from,
|
| 10636 |
+
from = _this$props$from === void 0 ? {} : _this$props$from,
|
| 10637 |
+
_this$props$to = _this$props.to,
|
| 10638 |
+
to = _this$props$to === void 0 ? {} : _this$props$to,
|
| 10639 |
+
_this$props$config = _this$props.config,
|
| 10640 |
+
config = _this$props$config === void 0 ? {} : _this$props$config,
|
| 10641 |
+
reverse = _this$props.reverse,
|
| 10642 |
+
attach = _this$props.attach,
|
| 10643 |
+
reset = _this$props.reset,
|
| 10644 |
+
immediate = _this$props.immediate; // Reverse values when requested
|
| 10645 |
|
| 10646 |
+
if (reverse) {
|
| 10647 |
+
var _ref6 = [to, from];
|
| 10648 |
+
from = _ref6[0];
|
| 10649 |
+
to = _ref6[1];
|
| 10650 |
+
} // This will collect all props that were ever set, reset merged props when necessary
|
| 10651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10652 |
|
| 10653 |
+
this.merged = _extends({}, from, this.merged, to);
|
| 10654 |
+
this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10655 |
|
| 10656 |
+
var target = attach && attach(this); // Reduces input { name: value } pairs into animated values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10657 |
|
| 10658 |
+
this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) {
|
| 10659 |
+
var name = _ref7[0],
|
| 10660 |
+
value = _ref7[1];
|
| 10661 |
+
// Issue cached entries, except on reset
|
| 10662 |
+
var entry = acc[name] || {}; // Figure out what the value is supposed to be
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10663 |
|
| 10664 |
+
var isNumber = is.num(value);
|
| 10665 |
+
var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value];
|
| 10666 |
+
var isArray = is.arr(value);
|
| 10667 |
+
var isInterpolation = !isNumber && !isArray && !isString;
|
| 10668 |
+
var fromValue = !is.und(from[name]) ? from[name] : value;
|
| 10669 |
+
var toValue = isNumber || isArray ? value : isString ? value : 1;
|
| 10670 |
+
var toConfig = callProp(config, name);
|
| 10671 |
+
if (target) toValue = target.animations[name].parent;
|
| 10672 |
+
var parent = entry.parent,
|
| 10673 |
+
interpolation$$1 = entry.interpolation,
|
| 10674 |
+
toValues = toArray(target ? toValue.getPayload() : toValue),
|
| 10675 |
+
animatedValues;
|
| 10676 |
+
var newValue = value;
|
| 10677 |
+
if (isInterpolation) newValue = interpolation({
|
| 10678 |
+
range: [0, 1],
|
| 10679 |
+
output: [value, value]
|
| 10680 |
+
})(1);
|
| 10681 |
+
var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags
|
| 10682 |
|
| 10683 |
+
var isFirst = is.und(parent);
|
| 10684 |
+
var isActive = !isFirst && entry.animatedValues.some(function (v) {
|
| 10685 |
+
return !v.done;
|
| 10686 |
+
});
|
| 10687 |
+
var currentValueDiffersFromGoal = !is.equ(newValue, currentValue);
|
| 10688 |
+
var hasNewGoal = !is.equ(newValue, entry.previous);
|
| 10689 |
+
var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one)
|
| 10690 |
+
// and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10691 |
|
| 10692 |
+
if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) {
|
| 10693 |
+
var _extends2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10694 |
|
| 10695 |
+
// Convert regular values into animated values, ALWAYS re-use if possible
|
| 10696 |
+
if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) {
|
| 10697 |
+
var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value);
|
| 10698 |
+
prev = prev !== void 0 && !reset ? prev : fromValue;
|
| 10699 |
|
| 10700 |
+
if (entry.parent) {
|
| 10701 |
+
parent = entry.parent;
|
| 10702 |
+
parent.setValue(0, false);
|
| 10703 |
+
} else parent = new AnimatedValue(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10704 |
|
| 10705 |
+
var range = {
|
| 10706 |
+
output: [prev, value]
|
| 10707 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10708 |
|
| 10709 |
+
if (entry.interpolation) {
|
| 10710 |
+
interpolation$$1 = entry.interpolation;
|
| 10711 |
+
entry.interpolation.updateConfig(range);
|
| 10712 |
+
} else interpolation$$1 = parent.interpolate(range);
|
| 10713 |
+
}
|
| 10714 |
+
toValues = toArray(target ? toValue.getPayload() : toValue);
|
| 10715 |
+
animatedValues = toArray(parent.getPayload());
|
| 10716 |
+
if (reset && !isInterpolation) parent.setValue(fromValue, false);
|
| 10717 |
+
_this4.hasChanged = true; // Reset animated values
|
| 10718 |
|
| 10719 |
+
animatedValues.forEach(function (value) {
|
| 10720 |
+
value.startPosition = value.value;
|
| 10721 |
+
value.lastPosition = value.value;
|
| 10722 |
+
value.lastVelocity = isActive ? value.lastVelocity : undefined;
|
| 10723 |
+
value.lastTime = isActive ? value.lastTime : undefined;
|
| 10724 |
+
value.startTime = now();
|
| 10725 |
+
value.done = false;
|
| 10726 |
+
value.animatedStyles.clear();
|
| 10727 |
+
}); // Set immediate values
|
| 10728 |
|
| 10729 |
+
if (callProp(immediate, name)) {
|
| 10730 |
+
parent.setValue(isInterpolation ? toValue : value, false);
|
| 10731 |
+
}
|
| 10732 |
|
| 10733 |
+
return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, {
|
| 10734 |
+
name: name,
|
| 10735 |
+
parent: parent,
|
| 10736 |
+
interpolation: interpolation$$1,
|
| 10737 |
+
animatedValues: animatedValues,
|
| 10738 |
+
toValues: toValues,
|
| 10739 |
+
previous: newValue,
|
| 10740 |
+
config: toConfig,
|
| 10741 |
+
fromValues: toArray(parent.getValue()),
|
| 10742 |
+
immediate: callProp(immediate, name),
|
| 10743 |
+
initialVelocity: withDefault(toConfig.velocity, 0),
|
| 10744 |
+
clamp: withDefault(toConfig.clamp, false),
|
| 10745 |
+
precision: withDefault(toConfig.precision, 0.01),
|
| 10746 |
+
tension: withDefault(toConfig.tension, 170),
|
| 10747 |
+
friction: withDefault(toConfig.friction, 26),
|
| 10748 |
+
mass: withDefault(toConfig.mass, 1),
|
| 10749 |
+
duration: toConfig.duration,
|
| 10750 |
+
easing: withDefault(toConfig.easing, function (t) {
|
| 10751 |
+
return t;
|
| 10752 |
+
}),
|
| 10753 |
+
decay: toConfig.decay
|
| 10754 |
+
}), _extends2));
|
| 10755 |
+
} else {
|
| 10756 |
+
if (!currentValueDiffersFromGoal) {
|
| 10757 |
+
var _extends3;
|
| 10758 |
|
| 10759 |
+
// So ... the current target value (newValue) appears to be different from the previous value,
|
| 10760 |
+
// which normally constitutes an update, but the actual value (currentValue) matches the target!
|
| 10761 |
+
// In order to resolve this without causing an animation update we silently flag the animation as done,
|
| 10762 |
+
// which it technically is. Interpolations also needs a config update with their target set to 1.
|
| 10763 |
+
if (isInterpolation) {
|
| 10764 |
+
parent.setValue(1, false);
|
| 10765 |
+
interpolation$$1.updateConfig({
|
| 10766 |
+
output: [newValue, newValue]
|
| 10767 |
+
});
|
| 10768 |
+
}
|
| 10769 |
|
| 10770 |
+
parent.done = true;
|
| 10771 |
+
_this4.hasChanged = true;
|
| 10772 |
+
return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], {
|
| 10773 |
+
previous: newValue
|
| 10774 |
+
}), _extends3));
|
| 10775 |
+
}
|
| 10776 |
|
| 10777 |
+
return acc;
|
| 10778 |
+
}
|
| 10779 |
+
}, this.animations);
|
| 10780 |
+
|
| 10781 |
+
if (this.hasChanged) {
|
| 10782 |
+
// Make animations available to frameloop
|
| 10783 |
+
this.configs = Object.values(this.animations);
|
| 10784 |
+
this.values = {};
|
| 10785 |
+
this.interpolations = {};
|
| 10786 |
|
| 10787 |
+
for (var key in this.animations) {
|
| 10788 |
+
this.interpolations[key] = this.animations[key].interpolation;
|
| 10789 |
+
this.values[key] = this.animations[key].interpolation.getValue();
|
| 10790 |
+
}
|
| 10791 |
+
}
|
| 10792 |
|
| 10793 |
+
return this;
|
| 10794 |
+
};
|
| 10795 |
|
| 10796 |
+
_proto.destroy = function destroy() {
|
| 10797 |
+
this.stop();
|
| 10798 |
+
this.props = {};
|
| 10799 |
+
this.merged = {};
|
| 10800 |
+
this.animations = {};
|
| 10801 |
+
this.interpolations = {};
|
| 10802 |
+
this.values = {};
|
| 10803 |
+
this.configs = [];
|
| 10804 |
+
this.local = 0;
|
| 10805 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10806 |
|
| 10807 |
+
return Controller;
|
| 10808 |
+
}();
|
| 10809 |
+
|
| 10810 |
+
/** API
|
| 10811 |
+
* const props = useSprings(number, [{ ... }, { ... }, ...])
|
| 10812 |
+
* const [props, set] = useSprings(number, (i, controller) => ({ ... }))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10813 |
*/
|
| 10814 |
|
| 10815 |
+
var useSprings = function useSprings(length, props) {
|
| 10816 |
+
var mounted = React.useRef(false);
|
| 10817 |
+
var ctrl = React.useRef();
|
| 10818 |
+
var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations
|
| 10819 |
|
| 10820 |
+
var _useMemo = React.useMemo(function () {
|
| 10821 |
+
// Remove old controllers
|
| 10822 |
+
if (ctrl.current) {
|
| 10823 |
+
ctrl.current.map(function (c) {
|
| 10824 |
+
return c.destroy();
|
| 10825 |
+
});
|
| 10826 |
+
ctrl.current = undefined;
|
| 10827 |
+
}
|
| 10828 |
|
| 10829 |
+
var ref;
|
| 10830 |
+
return [new Array(length).fill().map(function (_, i) {
|
| 10831 |
+
var ctrl = new Controller();
|
| 10832 |
+
var newProps = isFn ? callProp(props, i, ctrl) : props[i];
|
| 10833 |
+
if (i === 0) ref = newProps.ref;
|
| 10834 |
+
ctrl.update(newProps);
|
| 10835 |
+
if (!ref) ctrl.start();
|
| 10836 |
+
return ctrl;
|
| 10837 |
+
}), ref];
|
| 10838 |
+
}, [length]),
|
| 10839 |
+
controllers = _useMemo[0],
|
| 10840 |
+
ref = _useMemo[1];
|
| 10841 |
|
| 10842 |
+
ctrl.current = controllers; // The hooks reference api gets defined here ...
|
| 10843 |
|
| 10844 |
+
var api = React.useImperativeHandle(ref, function () {
|
| 10845 |
+
return {
|
| 10846 |
+
start: function start() {
|
| 10847 |
+
return Promise.all(ctrl.current.map(function (c) {
|
| 10848 |
+
return new Promise(function (r) {
|
| 10849 |
+
return c.start(r);
|
| 10850 |
+
});
|
| 10851 |
+
}));
|
| 10852 |
+
},
|
| 10853 |
+
stop: function stop(finished) {
|
| 10854 |
+
return ctrl.current.forEach(function (c) {
|
| 10855 |
+
return c.stop(finished);
|
| 10856 |
+
});
|
| 10857 |
+
},
|
| 10858 |
|
| 10859 |
+
get controllers() {
|
| 10860 |
+
return ctrl.current;
|
| 10861 |
+
}
|
|
|
|
|
|
|
| 10862 |
|
| 10863 |
+
};
|
| 10864 |
+
}); // This function updates the controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10865 |
|
| 10866 |
+
var updateCtrl = React.useMemo(function () {
|
| 10867 |
+
return function (updateProps) {
|
| 10868 |
+
return ctrl.current.map(function (c, i) {
|
| 10869 |
+
c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]);
|
| 10870 |
+
if (!ref) c.start();
|
| 10871 |
+
});
|
| 10872 |
+
};
|
| 10873 |
+
}, [length]); // Update controller if props aren't functional
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10874 |
|
| 10875 |
+
React.useEffect(function () {
|
| 10876 |
+
if (mounted.current) {
|
| 10877 |
+
if (!isFn) updateCtrl(props);
|
| 10878 |
+
} else if (!ref) ctrl.current.forEach(function (c) {
|
| 10879 |
+
return c.start();
|
| 10880 |
+
});
|
| 10881 |
+
}); // Update mounted flag and destroy controller on unmount
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10882 |
|
| 10883 |
+
React.useEffect(function () {
|
| 10884 |
+
return mounted.current = true, function () {
|
| 10885 |
+
return ctrl.current.forEach(function (c) {
|
| 10886 |
+
return c.destroy();
|
| 10887 |
+
});
|
| 10888 |
+
};
|
| 10889 |
+
}, []); // Return animated props, or, anim-props + the update-setter above
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10890 |
|
| 10891 |
+
var propValues = ctrl.current.map(function (c) {
|
| 10892 |
+
return c.getValues();
|
| 10893 |
+
});
|
| 10894 |
+
return isFn ? [propValues, updateCtrl, function (finished) {
|
| 10895 |
+
return ctrl.current.forEach(function (c) {
|
| 10896 |
+
return c.pause(finished);
|
| 10897 |
+
});
|
| 10898 |
+
}] : propValues;
|
| 10899 |
+
};
|
|
|
|
| 10900 |
|
| 10901 |
+
/** API
|
| 10902 |
+
* const props = useSpring({ ... })
|
| 10903 |
+
* const [props, set] = useSpring(() => ({ ... }))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10904 |
*/
|
| 10905 |
|
| 10906 |
+
var useSpring = function useSpring(props) {
|
| 10907 |
+
var isFn = is.fun(props);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10908 |
|
| 10909 |
+
var _useSprings = useSprings(1, isFn ? props : [props]),
|
| 10910 |
+
result = _useSprings[0],
|
| 10911 |
+
set = _useSprings[1],
|
| 10912 |
+
pause = _useSprings[2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10913 |
|
| 10914 |
+
return isFn ? [result[0], set, pause] : result;
|
| 10915 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10916 |
|
| 10917 |
+
/** API
|
| 10918 |
+
* const trails = useTrail(number, { ... })
|
| 10919 |
+
* const [trails, set] = useTrail(number, () => ({ ... }))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10920 |
*/
|
| 10921 |
|
| 10922 |
+
var useTrail = function useTrail(length, props) {
|
| 10923 |
+
var mounted = React.useRef(false);
|
| 10924 |
+
var isFn = is.fun(props);
|
| 10925 |
+
var updateProps = callProp(props);
|
| 10926 |
+
var instances = React.useRef();
|
| 10927 |
|
| 10928 |
+
var _useSprings = useSprings(length, function (i, ctrl) {
|
| 10929 |
+
if (i === 0) instances.current = [];
|
| 10930 |
+
instances.current.push(ctrl);
|
| 10931 |
+
return _extends({}, updateProps, {
|
| 10932 |
+
config: callProp(updateProps.config, i),
|
| 10933 |
+
attach: i > 0 && function () {
|
| 10934 |
+
return instances.current[i - 1];
|
| 10935 |
+
}
|
| 10936 |
+
});
|
| 10937 |
+
}),
|
| 10938 |
+
result = _useSprings[0],
|
| 10939 |
+
set = _useSprings[1],
|
| 10940 |
+
pause = _useSprings[2]; // Set up function to update controller
|
| 10941 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10942 |
|
| 10943 |
+
var updateCtrl = React.useMemo(function () {
|
| 10944 |
+
return function (props) {
|
| 10945 |
+
return set(function (i, ctrl) {
|
| 10946 |
+
var last = props.reverse ? i === 0 : length - 1 === i;
|
| 10947 |
+
var attachIdx = props.reverse ? i + 1 : i - 1;
|
| 10948 |
+
var attachController = instances.current[attachIdx];
|
| 10949 |
+
return _extends({}, props, {
|
| 10950 |
+
config: callProp(props.config || updateProps.config, i),
|
| 10951 |
+
attach: attachController && function () {
|
| 10952 |
+
return attachController;
|
| 10953 |
+
}
|
| 10954 |
+
});
|
| 10955 |
+
});
|
| 10956 |
+
};
|
| 10957 |
+
}, [length, updateProps.reverse]); // Update controller if props aren't functional
|
| 10958 |
|
| 10959 |
+
React.useEffect(function () {
|
| 10960 |
+
return void (mounted.current && !isFn && updateCtrl(props));
|
| 10961 |
+
}); // Update mounted flag and destroy controller on unmount
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10962 |
|
| 10963 |
+
React.useEffect(function () {
|
| 10964 |
+
return void (mounted.current = true);
|
| 10965 |
+
}, []);
|
| 10966 |
+
return isFn ? [result, updateCtrl, pause] : result;
|
| 10967 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10968 |
|
| 10969 |
+
/** API
|
| 10970 |
+
* const transitions = useTransition(items, itemKeys, { ... })
|
| 10971 |
+
* const [transitions, update] = useTransition(items, itemKeys, () => ({ ... }))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10972 |
*/
|
| 10973 |
|
| 10974 |
+
var guid = 0;
|
| 10975 |
+
var ENTER = 'enter';
|
| 10976 |
+
var LEAVE = 'leave';
|
| 10977 |
+
var UPDATE = 'update';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10978 |
|
| 10979 |
+
var mapKeys = function mapKeys(items, keys) {
|
| 10980 |
+
return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String);
|
| 10981 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10982 |
|
| 10983 |
+
var get = function get(props) {
|
| 10984 |
+
var items = props.items,
|
| 10985 |
+
_props$keys = props.keys,
|
| 10986 |
+
keys = _props$keys === void 0 ? function (item) {
|
| 10987 |
+
return item;
|
| 10988 |
+
} : _props$keys,
|
| 10989 |
+
rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]);
|
| 10990 |
|
| 10991 |
+
items = toArray(items !== void 0 ? items : null);
|
| 10992 |
+
return _extends({
|
| 10993 |
+
items: items,
|
| 10994 |
+
keys: mapKeys(items, keys)
|
| 10995 |
+
}, rest);
|
| 10996 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10997 |
|
| 10998 |
+
function useTransition(input, keyTransform, config) {
|
| 10999 |
+
var props = _extends({
|
| 11000 |
+
items: input,
|
| 11001 |
+
keys: keyTransform || function (i) {
|
| 11002 |
+
return i;
|
| 11003 |
+
}
|
| 11004 |
+
}, config);
|
| 11005 |
|
| 11006 |
+
var _get = get(props),
|
| 11007 |
+
_get$lazy = _get.lazy,
|
| 11008 |
+
lazy = _get$lazy === void 0 ? false : _get$lazy,
|
| 11009 |
+
_get$unique = _get.unique,
|
| 11010 |
+
_get$reset = _get.reset,
|
| 11011 |
+
reset = _get$reset === void 0 ? false : _get$reset,
|
| 11012 |
+
enter = _get.enter,
|
| 11013 |
+
leave = _get.leave,
|
| 11014 |
+
update = _get.update,
|
| 11015 |
+
onDestroyed = _get.onDestroyed,
|
| 11016 |
+
keys = _get.keys,
|
| 11017 |
+
items = _get.items,
|
| 11018 |
+
onFrame = _get.onFrame,
|
| 11019 |
+
_onRest = _get.onRest,
|
| 11020 |
+
onStart = _get.onStart,
|
| 11021 |
+
ref = _get.ref,
|
| 11022 |
+
extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]);
|
| 11023 |
|
| 11024 |
+
var forceUpdate = useForceUpdate();
|
| 11025 |
+
var mounted = React.useRef(false);
|
| 11026 |
+
var state = React.useRef({
|
| 11027 |
+
mounted: false,
|
| 11028 |
+
first: true,
|
| 11029 |
+
deleted: [],
|
| 11030 |
+
current: {},
|
| 11031 |
+
transitions: [],
|
| 11032 |
+
prevProps: {},
|
| 11033 |
+
paused: !!props.ref,
|
| 11034 |
+
instances: !mounted.current && new Map(),
|
| 11035 |
+
forceUpdate: forceUpdate
|
| 11036 |
+
});
|
| 11037 |
+
React.useImperativeHandle(props.ref, function () {
|
| 11038 |
+
return {
|
| 11039 |
+
start: function start() {
|
| 11040 |
+
return Promise.all(Array.from(state.current.instances).map(function (_ref) {
|
| 11041 |
+
var c = _ref[1];
|
| 11042 |
+
return new Promise(function (r) {
|
| 11043 |
+
return c.start(r);
|
| 11044 |
+
});
|
| 11045 |
+
}));
|
| 11046 |
+
},
|
| 11047 |
+
stop: function stop(finished) {
|
| 11048 |
+
return Array.from(state.current.instances).forEach(function (_ref2) {
|
| 11049 |
+
var c = _ref2[1];
|
| 11050 |
+
return c.stop(finished);
|
| 11051 |
+
});
|
| 11052 |
+
},
|
| 11053 |
|
| 11054 |
+
get controllers() {
|
| 11055 |
+
return Array.from(state.current.instances).map(function (_ref3) {
|
| 11056 |
+
var c = _ref3[1];
|
| 11057 |
+
return c;
|
| 11058 |
+
});
|
| 11059 |
+
}
|
| 11060 |
|
| 11061 |
+
};
|
| 11062 |
+
}); // Update state
|
|
|
|
| 11063 |
|
| 11064 |
+
state.current = diffItems(state.current, props);
|
| 11065 |
|
| 11066 |
+
if (state.current.changed) {
|
| 11067 |
+
// Update state
|
| 11068 |
+
state.current.transitions.forEach(function (transition) {
|
| 11069 |
+
var slot = transition.slot,
|
| 11070 |
+
from = transition.from,
|
| 11071 |
+
to = transition.to,
|
| 11072 |
+
config = transition.config,
|
| 11073 |
+
trail = transition.trail,
|
| 11074 |
+
key = transition.key,
|
| 11075 |
+
item = transition.item;
|
| 11076 |
+
if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object
|
| 11077 |
|
| 11078 |
+
var ctrl = state.current.instances.get(key);
|
|
|
|
|
|
|
| 11079 |
|
| 11080 |
+
var newProps = _extends({}, extra, {
|
| 11081 |
+
to: to,
|
| 11082 |
+
from: from,
|
| 11083 |
+
config: config,
|
| 11084 |
+
ref: ref,
|
| 11085 |
+
onRest: function onRest(values) {
|
| 11086 |
+
if (state.current.mounted) {
|
| 11087 |
+
if (transition.destroyed) {
|
| 11088 |
+
// If no ref is given delete destroyed items immediately
|
| 11089 |
+
if (!ref && !lazy) cleanUp(state, key);
|
| 11090 |
+
if (onDestroyed) onDestroyed(item);
|
| 11091 |
+
} // A transition comes to rest once all its springs conclude
|
| 11092 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11093 |
|
| 11094 |
+
var curInstances = Array.from(state.current.instances);
|
| 11095 |
+
var active = curInstances.some(function (_ref4) {
|
| 11096 |
+
var c = _ref4[1];
|
| 11097 |
+
return !c.idle;
|
| 11098 |
+
});
|
| 11099 |
+
if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state);
|
| 11100 |
+
if (_onRest) _onRest(item, slot, values);
|
| 11101 |
+
}
|
| 11102 |
+
},
|
| 11103 |
+
onStart: onStart && function () {
|
| 11104 |
+
return onStart(item, slot);
|
| 11105 |
+
},
|
| 11106 |
+
onFrame: onFrame && function (values) {
|
| 11107 |
+
return onFrame(item, slot, values);
|
| 11108 |
+
},
|
| 11109 |
+
delay: trail,
|
| 11110 |
+
reset: reset && slot === ENTER // Update controller
|
| 11111 |
|
| 11112 |
+
});
|
|
|
|
| 11113 |
|
| 11114 |
+
ctrl.update(newProps);
|
| 11115 |
+
if (!state.current.paused) ctrl.start();
|
| 11116 |
+
});
|
| 11117 |
}
|
| 11118 |
|
| 11119 |
+
React.useEffect(function () {
|
| 11120 |
+
state.current.mounted = mounted.current = true;
|
| 11121 |
+
return function () {
|
| 11122 |
+
state.current.mounted = mounted.current = false;
|
| 11123 |
+
Array.from(state.current.instances).map(function (_ref5) {
|
| 11124 |
+
var c = _ref5[1];
|
| 11125 |
+
return c.destroy();
|
| 11126 |
+
});
|
| 11127 |
+
state.current.instances.clear();
|
| 11128 |
+
};
|
| 11129 |
+
}, []);
|
| 11130 |
+
return state.current.transitions.map(function (_ref6) {
|
| 11131 |
+
var item = _ref6.item,
|
| 11132 |
+
slot = _ref6.slot,
|
| 11133 |
+
key = _ref6.key;
|
| 11134 |
+
return {
|
| 11135 |
+
item: item,
|
| 11136 |
+
key: key,
|
| 11137 |
+
state: slot,
|
| 11138 |
+
props: state.current.instances.get(key).getValues()
|
| 11139 |
+
};
|
| 11140 |
+
});
|
| 11141 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11142 |
|
| 11143 |
+
function cleanUp(state, filterKey) {
|
| 11144 |
+
var deleted = state.current.deleted;
|
|
|
|
|
|
|
| 11145 |
|
| 11146 |
+
var _loop = function _loop() {
|
| 11147 |
+
if (_isArray) {
|
| 11148 |
+
if (_i >= _iterator.length) return "break";
|
| 11149 |
+
_ref8 = _iterator[_i++];
|
| 11150 |
+
} else {
|
| 11151 |
+
_i = _iterator.next();
|
| 11152 |
+
if (_i.done) return "break";
|
| 11153 |
+
_ref8 = _i.value;
|
| 11154 |
+
}
|
| 11155 |
|
| 11156 |
+
var _ref7 = _ref8;
|
| 11157 |
+
var key = _ref7.key;
|
|
|
|
| 11158 |
|
| 11159 |
+
var filter = function filter(t) {
|
| 11160 |
+
return t.key !== key;
|
| 11161 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11162 |
|
| 11163 |
+
if (is.und(filterKey) || filterKey === key) {
|
| 11164 |
+
state.current.instances.delete(key);
|
| 11165 |
+
state.current.transitions = state.current.transitions.filter(filter);
|
| 11166 |
+
state.current.deleted = state.current.deleted.filter(filter);
|
| 11167 |
+
}
|
| 11168 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11169 |
|
| 11170 |
+
for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
| 11171 |
+
var _ref8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11172 |
|
| 11173 |
+
var _ret = _loop();
|
| 11174 |
+
|
| 11175 |
+
if (_ret === "break") break;
|
| 11176 |
+
}
|
| 11177 |
+
|
| 11178 |
+
state.current.forceUpdate();
|
| 11179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11180 |
|
| 11181 |
+
function diffItems(_ref9, props) {
|
| 11182 |
+
var first = _ref9.first,
|
| 11183 |
+
prevProps = _ref9.prevProps,
|
| 11184 |
+
state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]);
|
| 11185 |
|
| 11186 |
+
var _get2 = get(props),
|
| 11187 |
+
items = _get2.items,
|
| 11188 |
+
keys = _get2.keys,
|
| 11189 |
+
initial = _get2.initial,
|
| 11190 |
+
from = _get2.from,
|
| 11191 |
+
enter = _get2.enter,
|
| 11192 |
+
leave = _get2.leave,
|
| 11193 |
+
update = _get2.update,
|
| 11194 |
+
_get2$trail = _get2.trail,
|
| 11195 |
+
trail = _get2$trail === void 0 ? 0 : _get2$trail,
|
| 11196 |
+
unique = _get2.unique,
|
| 11197 |
+
config = _get2.config,
|
| 11198 |
+
_get2$order = _get2.order,
|
| 11199 |
+
order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order;
|
| 11200 |
|
| 11201 |
+
var _get3 = get(prevProps),
|
| 11202 |
+
_keys = _get3.keys,
|
| 11203 |
+
_items = _get3.items;
|
| 11204 |
|
| 11205 |
+
var current = _extends({}, state.current);
|
| 11206 |
|
| 11207 |
+
var deleted = [].concat(state.deleted); // Compare next keys with current keys
|
| 11208 |
|
| 11209 |
+
var currentKeys = Object.keys(current);
|
| 11210 |
+
var currentSet = new Set(currentKeys);
|
| 11211 |
+
var nextSet = new Set(keys);
|
| 11212 |
+
var added = keys.filter(function (item) {
|
| 11213 |
+
return !currentSet.has(item);
|
| 11214 |
+
});
|
| 11215 |
+
var removed = state.transitions.filter(function (item) {
|
| 11216 |
+
return !item.destroyed && !nextSet.has(item.originalKey);
|
| 11217 |
+
}).map(function (i) {
|
| 11218 |
+
return i.originalKey;
|
| 11219 |
+
});
|
| 11220 |
+
var updated = keys.filter(function (item) {
|
| 11221 |
+
return currentSet.has(item);
|
| 11222 |
+
});
|
| 11223 |
+
var delay = -trail;
|
| 11224 |
|
| 11225 |
+
while (order.length) {
|
| 11226 |
+
var changeType = order.shift();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11227 |
|
| 11228 |
+
switch (changeType) {
|
| 11229 |
+
case ENTER:
|
| 11230 |
+
{
|
| 11231 |
+
added.forEach(function (key, index) {
|
| 11232 |
+
// In unique mode, remove fading out transitions if their key comes in again
|
| 11233 |
+
if (unique && deleted.find(function (d) {
|
| 11234 |
+
return d.originalKey === key;
|
| 11235 |
+
})) deleted = deleted.filter(function (t) {
|
| 11236 |
+
return t.originalKey !== key;
|
| 11237 |
+
});
|
| 11238 |
+
var keyIndex = keys.indexOf(key);
|
| 11239 |
+
var item = items[keyIndex];
|
| 11240 |
+
var slot = first && initial !== void 0 ? 'initial' : ENTER;
|
| 11241 |
+
current[key] = {
|
| 11242 |
+
slot: slot,
|
| 11243 |
+
originalKey: key,
|
| 11244 |
+
key: unique ? String(key) : guid++,
|
| 11245 |
+
item: item,
|
| 11246 |
+
trail: delay = delay + trail,
|
| 11247 |
+
config: callProp(config, item, slot),
|
| 11248 |
+
from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item),
|
| 11249 |
+
to: callProp(enter, item)
|
| 11250 |
+
};
|
| 11251 |
+
});
|
| 11252 |
+
break;
|
| 11253 |
+
}
|
| 11254 |
|
| 11255 |
+
case LEAVE:
|
| 11256 |
+
{
|
| 11257 |
+
removed.forEach(function (key) {
|
| 11258 |
+
var keyIndex = _keys.indexOf(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11259 |
|
| 11260 |
+
var item = _items[keyIndex];
|
| 11261 |
+
var slot = LEAVE;
|
| 11262 |
+
deleted.unshift(_extends({}, current[key], {
|
| 11263 |
+
slot: slot,
|
| 11264 |
+
destroyed: true,
|
| 11265 |
+
left: _keys[Math.max(0, keyIndex - 1)],
|
| 11266 |
+
right: _keys[Math.min(_keys.length, keyIndex + 1)],
|
| 11267 |
+
trail: delay = delay + trail,
|
| 11268 |
+
config: callProp(config, item, slot),
|
| 11269 |
+
to: callProp(leave, item)
|
| 11270 |
+
}));
|
| 11271 |
+
delete current[key];
|
| 11272 |
+
});
|
| 11273 |
+
break;
|
| 11274 |
+
}
|
| 11275 |
|
| 11276 |
+
case UPDATE:
|
| 11277 |
+
{
|
| 11278 |
+
updated.forEach(function (key) {
|
| 11279 |
+
var keyIndex = keys.indexOf(key);
|
| 11280 |
+
var item = items[keyIndex];
|
| 11281 |
+
var slot = UPDATE;
|
| 11282 |
+
current[key] = _extends({}, current[key], {
|
| 11283 |
+
item: item,
|
| 11284 |
+
slot: slot,
|
| 11285 |
+
trail: delay = delay + trail,
|
| 11286 |
+
config: callProp(config, item, slot),
|
| 11287 |
+
to: callProp(update, item)
|
| 11288 |
+
});
|
| 11289 |
+
});
|
| 11290 |
+
break;
|
| 11291 |
+
}
|
| 11292 |
+
}
|
| 11293 |
+
}
|
| 11294 |
|
| 11295 |
+
var out = keys.map(function (key) {
|
| 11296 |
+
return current[key];
|
| 11297 |
+
}); // This tries to restore order for deleted items by finding their last known siblings
|
| 11298 |
+
// only using the left sibling to keep order placement consistent for all deleted items
|
| 11299 |
|
| 11300 |
+
deleted.forEach(function (_ref10) {
|
| 11301 |
+
var left = _ref10.left,
|
| 11302 |
+
right = _ref10.right,
|
| 11303 |
+
item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11304 |
|
| 11305 |
+
var pos; // Was it the element on the left, if yes, move there ...
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11306 |
|
| 11307 |
+
if ((pos = out.findIndex(function (t) {
|
| 11308 |
+
return t.originalKey === left;
|
| 11309 |
+
})) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯
|
| 11310 |
|
| 11311 |
+
pos = Math.max(0, pos);
|
| 11312 |
+
out = [].concat(out.slice(0, pos), [item], out.slice(pos));
|
| 11313 |
+
});
|
| 11314 |
+
return _extends({}, state, {
|
| 11315 |
+
changed: added.length || removed.length || updated.length,
|
| 11316 |
+
first: first && added.length === 0,
|
| 11317 |
+
transitions: out,
|
| 11318 |
+
current: current,
|
| 11319 |
+
deleted: deleted,
|
| 11320 |
+
prevProps: props
|
| 11321 |
+
});
|
| 11322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11323 |
|
| 11324 |
+
var AnimatedStyle =
|
| 11325 |
+
/*#__PURE__*/
|
| 11326 |
+
function (_AnimatedObject) {
|
| 11327 |
+
_inheritsLoose(AnimatedStyle, _AnimatedObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11328 |
|
| 11329 |
+
function AnimatedStyle(style) {
|
| 11330 |
+
var _this;
|
| 11331 |
|
| 11332 |
+
if (style === void 0) {
|
| 11333 |
+
style = {};
|
| 11334 |
+
}
|
| 11335 |
|
| 11336 |
+
_this = _AnimatedObject.call(this) || this;
|
|
|
|
|
|
|
| 11337 |
|
| 11338 |
+
if (style.transform && !(style.transform instanceof Animated)) {
|
| 11339 |
+
style = applyAnimatedValues.transform(style);
|
| 11340 |
+
}
|
| 11341 |
|
| 11342 |
+
_this.payload = style;
|
| 11343 |
+
return _this;
|
| 11344 |
+
}
|
| 11345 |
+
|
| 11346 |
+
return AnimatedStyle;
|
| 11347 |
+
}(AnimatedObject);
|
| 11348 |
|
| 11349 |
+
// http://www.w3.org/TR/css3-color/#svg-color
|
| 11350 |
+
var colors = {
|
| 11351 |
+
transparent: 0x00000000,
|
| 11352 |
+
aliceblue: 0xf0f8ffff,
|
| 11353 |
+
antiquewhite: 0xfaebd7ff,
|
| 11354 |
+
aqua: 0x00ffffff,
|
| 11355 |
+
aquamarine: 0x7fffd4ff,
|
| 11356 |
+
azure: 0xf0ffffff,
|
| 11357 |
+
beige: 0xf5f5dcff,
|
| 11358 |
+
bisque: 0xffe4c4ff,
|
| 11359 |
+
black: 0x000000ff,
|
| 11360 |
+
blanchedalmond: 0xffebcdff,
|
| 11361 |
+
blue: 0x0000ffff,
|
| 11362 |
+
blueviolet: 0x8a2be2ff,
|
| 11363 |
+
brown: 0xa52a2aff,
|
| 11364 |
+
burlywood: 0xdeb887ff,
|
| 11365 |
+
burntsienna: 0xea7e5dff,
|
| 11366 |
+
cadetblue: 0x5f9ea0ff,
|
| 11367 |
+
chartreuse: 0x7fff00ff,
|
| 11368 |
+
chocolate: 0xd2691eff,
|
| 11369 |
+
coral: 0xff7f50ff,
|
| 11370 |
+
cornflowerblue: 0x6495edff,
|
| 11371 |
+
cornsilk: 0xfff8dcff,
|
| 11372 |
+
crimson: 0xdc143cff,
|
| 11373 |
+
cyan: 0x00ffffff,
|
| 11374 |
+
darkblue: 0x00008bff,
|
| 11375 |
+
darkcyan: 0x008b8bff,
|
| 11376 |
+
darkgoldenrod: 0xb8860bff,
|
| 11377 |
+
darkgray: 0xa9a9a9ff,
|
| 11378 |
+
darkgreen: 0x006400ff,
|
| 11379 |
+
darkgrey: 0xa9a9a9ff,
|
| 11380 |
+
darkkhaki: 0xbdb76bff,
|
| 11381 |
+
darkmagenta: 0x8b008bff,
|
| 11382 |
+
darkolivegreen: 0x556b2fff,
|
| 11383 |
+
darkorange: 0xff8c00ff,
|
| 11384 |
+
darkorchid: 0x9932ccff,
|
| 11385 |
+
darkred: 0x8b0000ff,
|
| 11386 |
+
darksalmon: 0xe9967aff,
|
| 11387 |
+
darkseagreen: 0x8fbc8fff,
|
| 11388 |
+
darkslateblue: 0x483d8bff,
|
| 11389 |
+
darkslategray: 0x2f4f4fff,
|
| 11390 |
+
darkslategrey: 0x2f4f4fff,
|
| 11391 |
+
darkturquoise: 0x00ced1ff,
|
| 11392 |
+
darkviolet: 0x9400d3ff,
|
| 11393 |
+
deeppink: 0xff1493ff,
|
| 11394 |
+
deepskyblue: 0x00bfffff,
|
| 11395 |
+
dimgray: 0x696969ff,
|
| 11396 |
+
dimgrey: 0x696969ff,
|
| 11397 |
+
dodgerblue: 0x1e90ffff,
|
| 11398 |
+
firebrick: 0xb22222ff,
|
| 11399 |
+
floralwhite: 0xfffaf0ff,
|
| 11400 |
+
forestgreen: 0x228b22ff,
|
| 11401 |
+
fuchsia: 0xff00ffff,
|
| 11402 |
+
gainsboro: 0xdcdcdcff,
|
| 11403 |
+
ghostwhite: 0xf8f8ffff,
|
| 11404 |
+
gold: 0xffd700ff,
|
| 11405 |
+
goldenrod: 0xdaa520ff,
|
| 11406 |
+
gray: 0x808080ff,
|
| 11407 |
+
green: 0x008000ff,
|
| 11408 |
+
greenyellow: 0xadff2fff,
|
| 11409 |
+
grey: 0x808080ff,
|
| 11410 |
+
honeydew: 0xf0fff0ff,
|
| 11411 |
+
hotpink: 0xff69b4ff,
|
| 11412 |
+
indianred: 0xcd5c5cff,
|
| 11413 |
+
indigo: 0x4b0082ff,
|
| 11414 |
+
ivory: 0xfffff0ff,
|
| 11415 |
+
khaki: 0xf0e68cff,
|
| 11416 |
+
lavender: 0xe6e6faff,
|
| 11417 |
+
lavenderblush: 0xfff0f5ff,
|
| 11418 |
+
lawngreen: 0x7cfc00ff,
|
| 11419 |
+
lemonchiffon: 0xfffacdff,
|
| 11420 |
+
lightblue: 0xadd8e6ff,
|
| 11421 |
+
lightcoral: 0xf08080ff,
|
| 11422 |
+
lightcyan: 0xe0ffffff,
|
| 11423 |
+
lightgoldenrodyellow: 0xfafad2ff,
|
| 11424 |
+
lightgray: 0xd3d3d3ff,
|
| 11425 |
+
lightgreen: 0x90ee90ff,
|
| 11426 |
+
lightgrey: 0xd3d3d3ff,
|
| 11427 |
+
lightpink: 0xffb6c1ff,
|
| 11428 |
+
lightsalmon: 0xffa07aff,
|
| 11429 |
+
lightseagreen: 0x20b2aaff,
|
| 11430 |
+
lightskyblue: 0x87cefaff,
|
| 11431 |
+
lightslategray: 0x778899ff,
|
| 11432 |
+
lightslategrey: 0x778899ff,
|
| 11433 |
+
lightsteelblue: 0xb0c4deff,
|
| 11434 |
+
lightyellow: 0xffffe0ff,
|
| 11435 |
+
lime: 0x00ff00ff,
|
| 11436 |
+
limegreen: 0x32cd32ff,
|
| 11437 |
+
linen: 0xfaf0e6ff,
|
| 11438 |
+
magenta: 0xff00ffff,
|
| 11439 |
+
maroon: 0x800000ff,
|
| 11440 |
+
mediumaquamarine: 0x66cdaaff,
|
| 11441 |
+
mediumblue: 0x0000cdff,
|
| 11442 |
+
mediumorchid: 0xba55d3ff,
|
| 11443 |
+
mediumpurple: 0x9370dbff,
|
| 11444 |
+
mediumseagreen: 0x3cb371ff,
|
| 11445 |
+
mediumslateblue: 0x7b68eeff,
|
| 11446 |
+
mediumspringgreen: 0x00fa9aff,
|
| 11447 |
+
mediumturquoise: 0x48d1ccff,
|
| 11448 |
+
mediumvioletred: 0xc71585ff,
|
| 11449 |
+
midnightblue: 0x191970ff,
|
| 11450 |
+
mintcream: 0xf5fffaff,
|
| 11451 |
+
mistyrose: 0xffe4e1ff,
|
| 11452 |
+
moccasin: 0xffe4b5ff,
|
| 11453 |
+
navajowhite: 0xffdeadff,
|
| 11454 |
+
navy: 0x000080ff,
|
| 11455 |
+
oldlace: 0xfdf5e6ff,
|
| 11456 |
+
olive: 0x808000ff,
|
| 11457 |
+
olivedrab: 0x6b8e23ff,
|
| 11458 |
+
orange: 0xffa500ff,
|
| 11459 |
+
orangered: 0xff4500ff,
|
| 11460 |
+
orchid: 0xda70d6ff,
|
| 11461 |
+
palegoldenrod: 0xeee8aaff,
|
| 11462 |
+
palegreen: 0x98fb98ff,
|
| 11463 |
+
paleturquoise: 0xafeeeeff,
|
| 11464 |
+
palevioletred: 0xdb7093ff,
|
| 11465 |
+
papayawhip: 0xffefd5ff,
|
| 11466 |
+
peachpuff: 0xffdab9ff,
|
| 11467 |
+
peru: 0xcd853fff,
|
| 11468 |
+
pink: 0xffc0cbff,
|
| 11469 |
+
plum: 0xdda0ddff,
|
| 11470 |
+
powderblue: 0xb0e0e6ff,
|
| 11471 |
+
purple: 0x800080ff,
|
| 11472 |
+
rebeccapurple: 0x663399ff,
|
| 11473 |
+
red: 0xff0000ff,
|
| 11474 |
+
rosybrown: 0xbc8f8fff,
|
| 11475 |
+
royalblue: 0x4169e1ff,
|
| 11476 |
+
saddlebrown: 0x8b4513ff,
|
| 11477 |
+
salmon: 0xfa8072ff,
|
| 11478 |
+
sandybrown: 0xf4a460ff,
|
| 11479 |
+
seagreen: 0x2e8b57ff,
|
| 11480 |
+
seashell: 0xfff5eeff,
|
| 11481 |
+
sienna: 0xa0522dff,
|
| 11482 |
+
silver: 0xc0c0c0ff,
|
| 11483 |
+
skyblue: 0x87ceebff,
|
| 11484 |
+
slateblue: 0x6a5acdff,
|
| 11485 |
+
slategray: 0x708090ff,
|
| 11486 |
+
slategrey: 0x708090ff,
|
| 11487 |
+
snow: 0xfffafaff,
|
| 11488 |
+
springgreen: 0x00ff7fff,
|
| 11489 |
+
steelblue: 0x4682b4ff,
|
| 11490 |
+
tan: 0xd2b48cff,
|
| 11491 |
+
teal: 0x008080ff,
|
| 11492 |
+
thistle: 0xd8bfd8ff,
|
| 11493 |
+
tomato: 0xff6347ff,
|
| 11494 |
+
turquoise: 0x40e0d0ff,
|
| 11495 |
+
violet: 0xee82eeff,
|
| 11496 |
+
wheat: 0xf5deb3ff,
|
| 11497 |
+
white: 0xffffffff,
|
| 11498 |
+
whitesmoke: 0xf5f5f5ff,
|
| 11499 |
+
yellow: 0xffff00ff,
|
| 11500 |
+
yellowgreen: 0x9acd32ff
|
| 11501 |
+
};
|
| 11502 |
|
| 11503 |
+
// const INTEGER = '[-+]?\\d+';
|
| 11504 |
+
var NUMBER = '[-+]?\\d*\\.?\\d+';
|
| 11505 |
+
var PERCENTAGE = NUMBER + '%';
|
| 11506 |
|
| 11507 |
+
function call() {
|
| 11508 |
+
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
| 11509 |
+
parts[_key] = arguments[_key];
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11510 |
}
|
| 11511 |
|
| 11512 |
+
return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11513 |
}
|
|
|
|
|
|
|
|
|
|
| 11514 |
|
| 11515 |
+
var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
|
| 11516 |
+
var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
| 11517 |
+
var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
| 11518 |
+
var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
| 11519 |
+
var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
| 11520 |
+
var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
| 11521 |
+
var hex6 = /^#([0-9a-fA-F]{6})$/;
|
| 11522 |
+
var hex8 = /^#([0-9a-fA-F]{8})$/;
|
| 11523 |
|
| 11524 |
+
/*
|
| 11525 |
+
https://github.com/react-community/normalize-css-color
|
|
|
|
| 11526 |
|
| 11527 |
+
BSD 3-Clause License
|
| 11528 |
|
| 11529 |
+
Copyright (c) 2016, React Community
|
| 11530 |
+
All rights reserved.
|
|
|
|
| 11531 |
|
| 11532 |
+
Redistribution and use in source and binary forms, with or without
|
| 11533 |
+
modification, are permitted provided that the following conditions are met:
|
| 11534 |
|
| 11535 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 11536 |
+
list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11537 |
|
| 11538 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 11539 |
+
this list of conditions and the following disclaimer in the documentation
|
| 11540 |
+
and/or other materials provided with the distribution.
|
| 11541 |
|
| 11542 |
+
* Neither the name of the copyright holder nor the names of its
|
| 11543 |
+
contributors may be used to endorse or promote products derived from
|
| 11544 |
+
this software without specific prior written permission.
|
|
|
|
|
|
|
|
|
|
| 11545 |
|
| 11546 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 11547 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 11548 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 11549 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 11550 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 11551 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 11552 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 11553 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 11554 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 11555 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 11556 |
+
*/
|
| 11557 |
+
function normalizeColor(color) {
|
| 11558 |
+
var match;
|
| 11559 |
|
| 11560 |
+
if (typeof color === 'number') {
|
| 11561 |
+
return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;
|
| 11562 |
+
} // Ordered based on occurrences on Facebook codebase
|
| 11563 |
|
| 11564 |
|
| 11565 |
+
if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;
|
| 11566 |
+
if (colors.hasOwnProperty(color)) return colors[color];
|
|
|
|
| 11567 |
|
| 11568 |
+
if (match = rgb.exec(color)) {
|
| 11569 |
+
return (parse255(match[1]) << 24 | // r
|
| 11570 |
+
parse255(match[2]) << 16 | // g
|
| 11571 |
+
parse255(match[3]) << 8 | // b
|
| 11572 |
+
0x000000ff) >>> // a
|
| 11573 |
+
0;
|
| 11574 |
+
}
|
| 11575 |
|
| 11576 |
+
if (match = rgba.exec(color)) {
|
| 11577 |
+
return (parse255(match[1]) << 24 | // r
|
| 11578 |
+
parse255(match[2]) << 16 | // g
|
| 11579 |
+
parse255(match[3]) << 8 | // b
|
| 11580 |
+
parse1(match[4])) >>> // a
|
| 11581 |
+
0;
|
| 11582 |
+
}
|
| 11583 |
|
| 11584 |
+
if (match = hex3.exec(color)) {
|
| 11585 |
+
return parseInt(match[1] + match[1] + // r
|
| 11586 |
+
match[2] + match[2] + // g
|
| 11587 |
+
match[3] + match[3] + // b
|
| 11588 |
+
'ff', // a
|
| 11589 |
+
16) >>> 0;
|
| 11590 |
+
} // https://drafts.csswg.org/css-color-4/#hex-notation
|
| 11591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11592 |
|
| 11593 |
+
if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;
|
|
|
|
|
|
|
|
|
|
| 11594 |
|
| 11595 |
+
if (match = hex4.exec(color)) {
|
| 11596 |
+
return parseInt(match[1] + match[1] + // r
|
| 11597 |
+
match[2] + match[2] + // g
|
| 11598 |
+
match[3] + match[3] + // b
|
| 11599 |
+
match[4] + match[4], // a
|
| 11600 |
+
16) >>> 0;
|
| 11601 |
+
}
|
| 11602 |
|
| 11603 |
+
if (match = hsl.exec(color)) {
|
| 11604 |
+
return (hslToRgb(parse360(match[1]), // h
|
| 11605 |
+
parsePercentage(match[2]), // s
|
| 11606 |
+
parsePercentage(match[3]) // l
|
| 11607 |
+
) | 0x000000ff) >>> // a
|
| 11608 |
+
0;
|
| 11609 |
+
}
|
| 11610 |
|
| 11611 |
+
if (match = hsla.exec(color)) {
|
| 11612 |
+
return (hslToRgb(parse360(match[1]), // h
|
| 11613 |
+
parsePercentage(match[2]), // s
|
| 11614 |
+
parsePercentage(match[3]) // l
|
| 11615 |
+
) | parse1(match[4])) >>> // a
|
| 11616 |
+
0;
|
| 11617 |
+
}
|
| 11618 |
|
| 11619 |
+
return null;
|
| 11620 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11621 |
|
| 11622 |
+
function hue2rgb(p, q, t) {
|
| 11623 |
+
if (t < 0) t += 1;
|
| 11624 |
+
if (t > 1) t -= 1;
|
| 11625 |
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
| 11626 |
+
if (t < 1 / 2) return q;
|
| 11627 |
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
| 11628 |
+
return p;
|
| 11629 |
+
}
|
| 11630 |
|
| 11631 |
+
function hslToRgb(h, s, l) {
|
| 11632 |
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
| 11633 |
+
var p = 2 * l - q;
|
| 11634 |
+
var r = hue2rgb(p, q, h + 1 / 3);
|
| 11635 |
+
var g = hue2rgb(p, q, h);
|
| 11636 |
+
var b = hue2rgb(p, q, h - 1 / 3);
|
| 11637 |
+
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
| 11638 |
+
}
|
| 11639 |
|
| 11640 |
+
function parse255(str) {
|
| 11641 |
+
var int = parseInt(str, 10);
|
| 11642 |
+
if (int < 0) return 0;
|
| 11643 |
+
if (int > 255) return 255;
|
| 11644 |
+
return int;
|
| 11645 |
+
}
|
|
|
|
|
|
|
|
|
|
| 11646 |
|
| 11647 |
+
function parse360(str) {
|
| 11648 |
+
var int = parseFloat(str);
|
| 11649 |
+
return (int % 360 + 360) % 360 / 360;
|
| 11650 |
+
}
|
| 11651 |
|
| 11652 |
+
function parse1(str) {
|
| 11653 |
+
var num = parseFloat(str);
|
| 11654 |
+
if (num < 0) return 0;
|
| 11655 |
+
if (num > 1) return 255;
|
| 11656 |
+
return Math.round(num * 255);
|
| 11657 |
+
}
|
| 11658 |
|
| 11659 |
+
function parsePercentage(str) {
|
| 11660 |
+
// parseFloat conveniently ignores the final %
|
| 11661 |
+
var int = parseFloat(str);
|
| 11662 |
+
if (int < 0) return 0;
|
| 11663 |
+
if (int > 100) return 1;
|
| 11664 |
+
return int / 100;
|
| 11665 |
+
}
|
|
|
|
|
|
|
| 11666 |
|
| 11667 |
+
function colorToRgba(input) {
|
| 11668 |
+
var int32Color = normalizeColor(input);
|
| 11669 |
+
if (int32Color === null) return input;
|
| 11670 |
+
int32Color = int32Color || 0;
|
| 11671 |
+
var r = (int32Color & 0xff000000) >>> 24;
|
| 11672 |
+
var g = (int32Color & 0x00ff0000) >>> 16;
|
| 11673 |
+
var b = (int32Color & 0x0000ff00) >>> 8;
|
| 11674 |
+
var a = (int32Color & 0x000000ff) / 255;
|
| 11675 |
+
return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
| 11676 |
+
} // Problem: https://github.com/animatedjs/animated/pull/102
|
| 11677 |
+
// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662
|
| 11678 |
|
|
|
|
|
|
|
|
|
|
| 11679 |
|
| 11680 |
+
var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla
|
| 11681 |
+
// Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11682 |
|
| 11683 |
+
var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.)
|
| 11684 |
|
| 11685 |
+
var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g');
|
| 11686 |
/**
|
| 11687 |
+
* Supports string shapes by extracting numbers so new values can be computed,
|
| 11688 |
+
* and recombines those values into new strings of the same shape. Supports
|
| 11689 |
+
* things like:
|
| 11690 |
+
*
|
| 11691 |
+
* rgba(123, 42, 99, 0.36) // colors
|
| 11692 |
+
* -45deg // values with units
|
| 11693 |
+
* 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows
|
| 11694 |
*/
|
| 11695 |
|
| 11696 |
+
var createStringInterpolator = function createStringInterpolator(config) {
|
| 11697 |
+
// Replace colors with rgba
|
| 11698 |
+
var outputRange = config.output.map(function (rangeValue) {
|
| 11699 |
+
return rangeValue.replace(colorRegex, colorToRgba);
|
| 11700 |
+
}).map(function (rangeValue) {
|
| 11701 |
+
return rangeValue.replace(colorNamesRegex, colorToRgba);
|
| 11702 |
+
});
|
| 11703 |
+
var outputRanges = outputRange[0].match(stringShapeRegex).map(function () {
|
| 11704 |
+
return [];
|
| 11705 |
+
});
|
| 11706 |
+
outputRange.forEach(function (value) {
|
| 11707 |
+
value.match(stringShapeRegex).forEach(function (number, i) {
|
| 11708 |
+
return outputRanges[i].push(+number);
|
| 11709 |
+
});
|
| 11710 |
+
});
|
| 11711 |
+
var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) {
|
| 11712 |
+
return createInterpolator(_extends({}, config, {
|
| 11713 |
+
output: outputRanges[i]
|
| 11714 |
+
}));
|
| 11715 |
+
});
|
| 11716 |
+
return function (input) {
|
| 11717 |
+
var i = 0;
|
| 11718 |
+
return outputRange[0] // 'rgba(0, 100, 200, 0)'
|
| 11719 |
+
// ->
|
| 11720 |
+
// 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...'
|
| 11721 |
+
.replace(stringShapeRegex, function () {
|
| 11722 |
+
return interpolations[i++](input);
|
| 11723 |
+
}) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to
|
| 11724 |
+
// round the opacity (4th column).
|
| 11725 |
+
.replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) {
|
| 11726 |
+
return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")";
|
| 11727 |
+
});
|
| 11728 |
+
};
|
| 11729 |
+
};
|
| 11730 |
|
| 11731 |
+
var isUnitlessNumber = {
|
| 11732 |
+
animationIterationCount: true,
|
| 11733 |
+
borderImageOutset: true,
|
| 11734 |
+
borderImageSlice: true,
|
| 11735 |
+
borderImageWidth: true,
|
| 11736 |
+
boxFlex: true,
|
| 11737 |
+
boxFlexGroup: true,
|
| 11738 |
+
boxOrdinalGroup: true,
|
| 11739 |
+
columnCount: true,
|
| 11740 |
+
columns: true,
|
| 11741 |
+
flex: true,
|
| 11742 |
+
flexGrow: true,
|
| 11743 |
+
flexPositive: true,
|
| 11744 |
+
flexShrink: true,
|
| 11745 |
+
flexNegative: true,
|
| 11746 |
+
flexOrder: true,
|
| 11747 |
+
gridRow: true,
|
| 11748 |
+
gridRowEnd: true,
|
| 11749 |
+
gridRowSpan: true,
|
| 11750 |
+
gridRowStart: true,
|
| 11751 |
+
gridColumn: true,
|
| 11752 |
+
gridColumnEnd: true,
|
| 11753 |
+
gridColumnSpan: true,
|
| 11754 |
+
gridColumnStart: true,
|
| 11755 |
+
fontWeight: true,
|
| 11756 |
+
lineClamp: true,
|
| 11757 |
+
lineHeight: true,
|
| 11758 |
+
opacity: true,
|
| 11759 |
+
order: true,
|
| 11760 |
+
orphans: true,
|
| 11761 |
+
tabSize: true,
|
| 11762 |
+
widows: true,
|
| 11763 |
+
zIndex: true,
|
| 11764 |
+
zoom: true,
|
| 11765 |
+
// SVG-related properties
|
| 11766 |
+
fillOpacity: true,
|
| 11767 |
+
floodOpacity: true,
|
| 11768 |
+
stopOpacity: true,
|
| 11769 |
+
strokeDasharray: true,
|
| 11770 |
+
strokeDashoffset: true,
|
| 11771 |
+
strokeMiterlimit: true,
|
| 11772 |
+
strokeOpacity: true,
|
| 11773 |
+
strokeWidth: true
|
| 11774 |
+
};
|
| 11775 |
|
| 11776 |
+
var prefixKey = function prefixKey(prefix, key) {
|
| 11777 |
+
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
| 11778 |
};
|
|
|
|
| 11779 |
|
| 11780 |
+
var prefixes = ['Webkit', 'Ms', 'Moz', 'O'];
|
| 11781 |
+
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) {
|
| 11782 |
+
prefixes.forEach(function (prefix) {
|
| 11783 |
+
return acc[prefixKey(prefix, prop)] = acc[prop];
|
| 11784 |
+
});
|
| 11785 |
+
return acc;
|
| 11786 |
+
}, isUnitlessNumber);
|
| 11787 |
+
|
| 11788 |
+
function dangerousStyleValue(name, value, isCustomProperty) {
|
| 11789 |
+
if (value == null || typeof value === 'boolean' || value === '') return '';
|
| 11790 |
+
if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
|
| 11791 |
+
|
| 11792 |
+
return ('' + value).trim();
|
| 11793 |
}
|
|
|
|
|
|
|
|
|
|
| 11794 |
|
| 11795 |
+
var attributeCache = {};
|
| 11796 |
+
injectCreateAnimatedStyle(function (style) {
|
| 11797 |
+
return new AnimatedStyle(style);
|
| 11798 |
+
});
|
| 11799 |
+
injectDefaultElement('div');
|
| 11800 |
+
injectStringInterpolator(createStringInterpolator);
|
| 11801 |
+
injectColorNames(colors);
|
| 11802 |
+
injectApplyAnimatedValues(function (instance, props) {
|
| 11803 |
+
if (instance.nodeType && instance.setAttribute !== undefined) {
|
| 11804 |
+
var style = props.style,
|
| 11805 |
+
children = props.children,
|
| 11806 |
+
scrollTop = props.scrollTop,
|
| 11807 |
+
scrollLeft = props.scrollLeft,
|
| 11808 |
+
attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]);
|
| 11809 |
|
| 11810 |
+
var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';
|
| 11811 |
+
if (scrollTop !== void 0) instance.scrollTop = scrollTop;
|
| 11812 |
+
if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value
|
|
|
|
| 11813 |
|
| 11814 |
+
if (children !== void 0) instance.textContent = children; // Set styles ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11815 |
|
| 11816 |
+
for (var styleName in style) {
|
| 11817 |
+
if (!style.hasOwnProperty(styleName)) continue;
|
| 11818 |
+
var isCustomProperty = styleName.indexOf('--') === 0;
|
| 11819 |
+
var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty);
|
| 11820 |
+
if (styleName === 'float') styleName = 'cssFloat';
|
| 11821 |
+
if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue;
|
| 11822 |
+
} // Set attributes ...
|
| 11823 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11824 |
|
| 11825 |
+
for (var name in attributes) {
|
| 11826 |
+
// Attributes are written in dash case
|
| 11827 |
+
var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) {
|
| 11828 |
+
return '-' + n.toLowerCase();
|
| 11829 |
+
}));
|
| 11830 |
+
if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]);
|
| 11831 |
+
}
|
| 11832 |
+
|
| 11833 |
+
return;
|
| 11834 |
+
} else return false;
|
| 11835 |
+
}, function (style) {
|
| 11836 |
+
return style;
|
| 11837 |
+
});
|
| 11838 |
+
|
| 11839 |
+
var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
|
| 11840 |
+
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
|
| 11841 |
+
// Extend animated with all the available THREE elements
|
| 11842 |
+
var apply = merge(createAnimatedComponent, false);
|
| 11843 |
+
var extendedAnimated = apply(domElements);
|
| 11844 |
+
|
| 11845 |
+
exports.apply = apply;
|
| 11846 |
+
exports.config = config;
|
| 11847 |
+
exports.update = update;
|
| 11848 |
+
exports.animated = extendedAnimated;
|
| 11849 |
+
exports.a = extendedAnimated;
|
| 11850 |
+
exports.interpolate = interpolate$1;
|
| 11851 |
+
exports.Globals = Globals;
|
| 11852 |
+
exports.useSpring = useSpring;
|
| 11853 |
+
exports.useTrail = useTrail;
|
| 11854 |
+
exports.useTransition = useTransition;
|
| 11855 |
+
exports.useChain = useChain;
|
| 11856 |
+
exports.useSprings = useSprings;
|
| 11857 |
+
|
| 11858 |
+
|
| 11859 |
+
/***/ }),
|
| 11860 |
+
/* 127 */
|
| 11861 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 11862 |
+
|
| 11863 |
+
"use strict";
|
| 11864 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isInSameBlock; });
|
| 11865 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isInsideRootBlock; });
|
| 11866 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getBlockClientId; });
|
| 11867 |
+
const BLOCK_SELECTOR = '.block-editor-block-list__block';
|
| 11868 |
+
/**
|
| 11869 |
+
* Returns true if two elements are contained within the same block.
|
| 11870 |
+
*
|
| 11871 |
+
* @param {Element} a First element.
|
| 11872 |
+
* @param {Element} b Second element.
|
| 11873 |
+
*
|
| 11874 |
+
* @return {boolean} Whether elements are in the same block.
|
| 11875 |
+
*/
|
| 11876 |
+
|
| 11877 |
+
function isInSameBlock(a, b) {
|
| 11878 |
+
return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR);
|
| 11879 |
}
|
|
|
|
|
|
|
| 11880 |
/**
|
| 11881 |
+
* Returns true if an element is considered part of the block and not its
|
| 11882 |
+
* children.
|
| 11883 |
+
*
|
| 11884 |
+
* @param {Element} blockElement Block container element.
|
| 11885 |
+
* @param {Element} element Element.
|
| 11886 |
+
*
|
| 11887 |
+
* @return {boolean} Whether element is in the block Element but not its
|
| 11888 |
+
* children.
|
| 11889 |
*/
|
| 11890 |
|
| 11891 |
+
function isInsideRootBlock(blockElement, element) {
|
| 11892 |
+
const parentBlock = element.closest(BLOCK_SELECTOR);
|
| 11893 |
+
return parentBlock === blockElement;
|
| 11894 |
+
}
|
| 11895 |
/**
|
| 11896 |
+
* Finds the block client ID given any DOM node inside the block.
|
| 11897 |
+
*
|
| 11898 |
+
* @param {Node?} node DOM node.
|
| 11899 |
+
*
|
| 11900 |
+
* @return {string|undefined} Client ID or undefined if the node is not part of
|
| 11901 |
+
* a block.
|
| 11902 |
*/
|
| 11903 |
|
| 11904 |
+
function getBlockClientId(node) {
|
| 11905 |
+
while (node && node.nodeType !== node.ELEMENT_NODE) {
|
| 11906 |
+
node = node.parentNode;
|
| 11907 |
+
}
|
| 11908 |
|
| 11909 |
+
if (!node) {
|
| 11910 |
+
return;
|
| 11911 |
+
}
|
| 11912 |
|
| 11913 |
+
const elementNode =
|
| 11914 |
+
/** @type {Element} */
|
| 11915 |
+
node;
|
| 11916 |
+
const blockNode = elementNode.closest(BLOCK_SELECTOR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11917 |
|
| 11918 |
+
if (!blockNode) {
|
| 11919 |
+
return;
|
| 11920 |
}
|
| 11921 |
|
| 11922 |
+
return blockNode.id.slice('block-'.length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11923 |
}
|
| 11924 |
+
//# sourceMappingURL=dom.js.map
|
| 11925 |
+
|
| 11926 |
+
/***/ }),
|
| 11927 |
+
/* 128 */,
|
| 11928 |
+
/* 129 */,
|
| 11929 |
+
/* 130 */,
|
| 11930 |
+
/* 131 */,
|
| 11931 |
+
/* 132 */
|
| 11932 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 11933 |
|
| 11934 |
+
"use strict";
|
| 11935 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 11936 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 11937 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 11938 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 11939 |
|
| 11940 |
|
| 11941 |
/**
|
| 11942 |
* WordPress dependencies
|
| 11943 |
*/
|
| 11944 |
|
| 11945 |
+
const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 11946 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 11947 |
+
viewBox: "0 0 24 24"
|
| 11948 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 11949 |
+
d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
|
| 11950 |
+
}));
|
| 11951 |
+
/* harmony default export */ __webpack_exports__["a"] = (close);
|
| 11952 |
+
//# sourceMappingURL=close.js.map
|
| 11953 |
|
| 11954 |
+
/***/ }),
|
| 11955 |
+
/* 133 */,
|
| 11956 |
+
/* 134 */,
|
| 11957 |
+
/* 135 */
|
| 11958 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 11959 |
|
| 11960 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
| 11961 |
|
| 11962 |
+
// EXPORTS
|
| 11963 |
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BlockEdit; });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11964 |
|
| 11965 |
+
// UNUSED EXPORTS: useBlockEditContext
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11966 |
|
| 11967 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 11968 |
+
var external_wp_element_ = __webpack_require__(0);
|
|
|
|
| 11969 |
|
| 11970 |
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
| 11971 |
+
var esm_extends = __webpack_require__(7);
|
|
|
|
| 11972 |
|
| 11973 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 11974 |
+
var classnames = __webpack_require__(10);
|
| 11975 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11976 |
|
| 11977 |
+
// EXTERNAL MODULE: external "lodash"
|
| 11978 |
+
var external_lodash_ = __webpack_require__(2);
|
|
|
|
| 11979 |
|
| 11980 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 11981 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 11982 |
|
| 11983 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 11984 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
| 11985 |
|
| 11986 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-context/index.js
|
| 11987 |
+
var block_context = __webpack_require__(147);
|
|
|
|
| 11988 |
|
| 11989 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/edit.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11990 |
|
| 11991 |
|
| 11992 |
|
| 12007 |
*/
|
| 12008 |
|
| 12009 |
|
|
|
|
| 12010 |
/**
|
| 12011 |
+
* Default value used for blocks which do not define their own context needs,
|
| 12012 |
+
* used to guarantee that a block's `context` prop will always be an object. It
|
| 12013 |
+
* is assigned as a constant since it is always expected to be an empty object,
|
| 12014 |
+
* and in order to avoid unnecessary React reconciliations of a changing object.
|
| 12015 |
*
|
| 12016 |
+
* @type {{}}
|
|
|
|
| 12017 |
*/
|
| 12018 |
|
| 12019 |
+
const DEFAULT_BLOCK_CONTEXT = {};
|
| 12020 |
+
const Edit = props => {
|
| 12021 |
+
const {
|
| 12022 |
+
attributes = {},
|
| 12023 |
+
name
|
| 12024 |
+
} = props;
|
| 12025 |
+
const blockType = Object(external_wp_blocks_["getBlockType"])(name);
|
| 12026 |
+
const blockContext = Object(external_wp_element_["useContext"])(block_context["b" /* default */]); // Assign context values using the block type's declared context needs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12027 |
|
| 12028 |
+
const context = Object(external_wp_element_["useMemo"])(() => {
|
| 12029 |
+
return blockType && blockType.usesContext ? Object(external_lodash_["pick"])(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT;
|
| 12030 |
+
}, [blockType, blockContext]);
|
|
|
|
|
|
|
| 12031 |
|
| 12032 |
+
if (!blockType) {
|
| 12033 |
+
return null;
|
| 12034 |
+
} // `edit` and `save` are functions or components describing the markup
|
| 12035 |
+
// with which a block is displayed. If `blockType` is valid, assign
|
| 12036 |
+
// them preferentially as the render value for the block.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12037 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12038 |
|
| 12039 |
+
const Component = blockType.edit || blockType.save;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12040 |
|
| 12041 |
+
if (blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false)) {
|
| 12042 |
+
return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, {
|
| 12043 |
+
context: context
|
| 12044 |
+
}));
|
| 12045 |
+
} // Generate a class name for the block's editable form
|
| 12046 |
|
|
|
|
|
|
|
|
|
|
| 12047 |
|
| 12048 |
+
const generatedClassName = Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'className', true) ? Object(external_wp_blocks_["getBlockDefaultClassName"])(name) : null;
|
| 12049 |
+
const className = classnames_default()(generatedClassName, attributes.className);
|
| 12050 |
+
return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, {
|
| 12051 |
+
context: context,
|
| 12052 |
+
className: className
|
| 12053 |
+
}));
|
| 12054 |
+
};
|
| 12055 |
+
/* harmony default export */ var edit = (Object(external_wp_components_["withFilters"])('editor.BlockEdit')(Edit));
|
| 12056 |
+
//# sourceMappingURL=edit.js.map
|
| 12057 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-edit/context.js
|
| 12058 |
+
var block_edit_context = __webpack_require__(69);
|
| 12059 |
|
| 12060 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/index.js
|
|
|
|
|
|
|
|
|
|
| 12061 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12062 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12063 |
/**
|
| 12064 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12065 |
*/
|
| 12066 |
|
| 12067 |
+
/**
|
| 12068 |
+
* Internal dependencies
|
| 12069 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12070 |
|
|
|
|
| 12071 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12072 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12073 |
|
| 12074 |
+
function BlockEdit(props) {
|
| 12075 |
const {
|
| 12076 |
+
name,
|
| 12077 |
+
isSelected,
|
| 12078 |
+
clientId
|
| 12079 |
+
} = props;
|
| 12080 |
+
const context = {
|
| 12081 |
+
name,
|
| 12082 |
+
isSelected,
|
| 12083 |
+
clientId
|
| 12084 |
+
};
|
| 12085 |
+
return Object(external_wp_element_["createElement"])(block_edit_context["a" /* BlockEditContextProvider */] // It is important to return the same object if props haven't
|
| 12086 |
+
// changed to avoid unnecessary rerenders.
|
| 12087 |
+
// See https://reactjs.org/docs/context.html#caveats.
|
| 12088 |
+
, {
|
| 12089 |
+
value: Object(external_wp_element_["useMemo"])(() => context, Object.values(context))
|
| 12090 |
+
}, Object(external_wp_element_["createElement"])(edit, props));
|
| 12091 |
+
}
|
| 12092 |
+
//# sourceMappingURL=index.js.map
|
| 12093 |
|
| 12094 |
+
/***/ }),
|
| 12095 |
+
/* 136 */
|
| 12096 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12097 |
|
| 12098 |
+
"use strict";
|
| 12099 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useBlockSelectionClearer; });
|
| 12100 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BlockSelectionClearer; });
|
| 12101 |
+
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
|
| 12102 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
| 12103 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
| 12104 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
| 12105 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
| 12106 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
|
| 12107 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__);
|
| 12108 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
|
| 12109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12110 |
|
| 12111 |
|
| 12112 |
/**
|
| 12113 |
* WordPress dependencies
|
| 12114 |
*/
|
| 12115 |
|
| 12116 |
+
|
| 12117 |
/**
|
| 12118 |
* Internal dependencies
|
| 12119 |
*/
|
| 12120 |
|
| 12121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12122 |
/**
|
| 12123 |
+
* Pass the returned ref callback to an element that should clear block
|
| 12124 |
+
* selection. Selection will only be cleared if the element is clicked directly,
|
| 12125 |
+
* not if a child element is clicked.
|
| 12126 |
+
*
|
| 12127 |
+
* @return {import('react').RefCallback} Ref callback.
|
| 12128 |
*/
|
| 12129 |
|
| 12130 |
+
function useBlockSelectionClearer() {
|
| 12131 |
+
const {
|
| 12132 |
+
hasSelectedBlock,
|
| 12133 |
+
hasMultiSelection
|
| 12134 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useSelect"])(_store__WEBPACK_IMPORTED_MODULE_4__[/* store */ "a"]);
|
| 12135 |
+
const {
|
| 12136 |
+
clearSelectedBlock
|
| 12137 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useDispatch"])(_store__WEBPACK_IMPORTED_MODULE_4__[/* store */ "a"]);
|
| 12138 |
+
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__["useRefEffect"])(node => {
|
| 12139 |
+
function onMouseDown(event) {
|
| 12140 |
+
if (!hasSelectedBlock() && !hasMultiSelection()) {
|
| 12141 |
+
return;
|
| 12142 |
+
} // Only handle clicks on the element, not the children.
|
| 12143 |
|
|
|
|
|
|
|
|
|
|
| 12144 |
|
| 12145 |
+
if (event.target !== node) {
|
| 12146 |
+
return;
|
| 12147 |
+
}
|
| 12148 |
|
| 12149 |
+
clearSelectedBlock();
|
| 12150 |
+
}
|
|
|
|
|
|
|
| 12151 |
|
| 12152 |
+
node.addEventListener('mousedown', onMouseDown);
|
| 12153 |
+
return () => {
|
| 12154 |
+
node.removeEventListener('mousedown', onMouseDown);
|
| 12155 |
+
};
|
| 12156 |
+
}, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
|
| 12157 |
+
}
|
| 12158 |
+
function BlockSelectionClearer(props) {
|
| 12159 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({
|
| 12160 |
+
ref: useBlockSelectionClearer()
|
| 12161 |
+
}, props));
|
| 12162 |
}
|
| 12163 |
+
//# sourceMappingURL=index.js.map
|
| 12164 |
|
| 12165 |
+
/***/ }),
|
| 12166 |
+
/* 137 */
|
| 12167 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
| 12168 |
|
| 12169 |
+
"use strict";
|
| 12170 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ButtonBlockerAppender; });
|
| 12171 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12172 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12173 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
|
| 12174 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
|
| 12175 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
| 12176 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
|
| 12177 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
|
| 12178 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
| 12179 |
+
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(109);
|
| 12180 |
+
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(145);
|
| 12181 |
+
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(26);
|
| 12182 |
+
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_6__);
|
| 12183 |
+
/* harmony import */ var _inserter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(87);
|
| 12184 |
|
| 12185 |
|
| 12186 |
/**
|
| 12196 |
|
| 12197 |
|
| 12198 |
|
|
|
|
| 12199 |
/**
|
| 12200 |
* Internal dependencies
|
| 12201 |
*/
|
| 12202 |
|
| 12203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12204 |
|
| 12205 |
+
function ButtonBlockAppender({
|
| 12206 |
+
rootClientId,
|
| 12207 |
+
className,
|
| 12208 |
+
onFocus,
|
| 12209 |
+
tabIndex
|
| 12210 |
+
}, ref) {
|
| 12211 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_inserter__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], {
|
| 12212 |
+
position: "bottom center",
|
| 12213 |
+
rootClientId: rootClientId,
|
| 12214 |
+
__experimentalIsQuick: true,
|
| 12215 |
+
renderToggle: ({
|
| 12216 |
+
onToggle,
|
| 12217 |
+
disabled,
|
| 12218 |
+
isOpen,
|
| 12219 |
+
blockTitle,
|
| 12220 |
+
hasSingleBlockType
|
| 12221 |
+
}) => {
|
| 12222 |
+
let label;
|
| 12223 |
|
| 12224 |
+
if (hasSingleBlockType) {
|
| 12225 |
+
label = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["sprintf"])( // translators: %s: the name of the block when there is only one
|
| 12226 |
+
Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["_x"])('Add %s', 'directly add the only allowed block'), blockTitle);
|
| 12227 |
+
} else {
|
| 12228 |
+
label = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["_x"])('Add block', 'Generic label for block inserter button');
|
| 12229 |
+
}
|
| 12230 |
|
| 12231 |
+
const isToggleButton = !hasSingleBlockType;
|
| 12232 |
+
let inserterButton = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Button"], {
|
| 12233 |
+
ref: ref,
|
| 12234 |
+
onFocus: onFocus,
|
| 12235 |
+
tabIndex: tabIndex,
|
| 12236 |
+
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(className, 'block-editor-button-block-appender'),
|
| 12237 |
+
onClick: onToggle,
|
| 12238 |
+
"aria-haspopup": isToggleButton ? 'true' : undefined,
|
| 12239 |
+
"aria-expanded": isToggleButton ? isOpen : undefined,
|
| 12240 |
+
disabled: disabled,
|
| 12241 |
+
label: label
|
| 12242 |
+
}, !hasSingleBlockType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["VisuallyHidden"], {
|
| 12243 |
+
as: "span"
|
| 12244 |
+
}, label), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_icons__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"], {
|
| 12245 |
+
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]
|
| 12246 |
+
}));
|
| 12247 |
+
|
| 12248 |
+
if (isToggleButton || hasSingleBlockType) {
|
| 12249 |
+
inserterButton = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Tooltip"], {
|
| 12250 |
+
text: label
|
| 12251 |
+
}, inserterButton);
|
| 12252 |
}
|
|
|
|
|
|
|
| 12253 |
|
| 12254 |
+
return inserterButton;
|
| 12255 |
+
},
|
| 12256 |
+
isAppender: true
|
| 12257 |
+
});
|
| 12258 |
}
|
| 12259 |
/**
|
| 12260 |
+
* Use `ButtonBlockAppender` instead.
|
|
|
|
|
|
|
|
|
|
| 12261 |
*
|
| 12262 |
+
* @deprecated
|
| 12263 |
*/
|
| 12264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12265 |
|
| 12266 |
+
const ButtonBlockerAppender = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])((props, ref) => {
|
| 12267 |
+
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_6___default()(`wp.blockEditor.ButtonBlockerAppender`, {
|
| 12268 |
+
alternative: 'wp.blockEditor.ButtonBlockAppender'
|
| 12269 |
+
});
|
| 12270 |
+
return ButtonBlockAppender(props, ref);
|
| 12271 |
+
});
|
| 12272 |
/**
|
| 12273 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12274 |
*/
|
| 12275 |
|
| 12276 |
+
/* harmony default export */ __webpack_exports__["b"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])(ButtonBlockAppender));
|
| 12277 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
| 12278 |
|
| 12279 |
+
/***/ }),
|
| 12280 |
+
/* 138 */
|
| 12281 |
+
/***/ (function(module, exports, __webpack_require__) {
|
| 12282 |
+
|
| 12283 |
+
"use strict";
|
| 12284 |
+
|
| 12285 |
+
|
| 12286 |
+
module.exports = __webpack_require__(247);
|
| 12287 |
+
|
| 12288 |
+
/***/ }),
|
| 12289 |
+
/* 139 */
|
| 12290 |
+
/***/ (function(module, exports) {
|
| 12291 |
+
|
| 12292 |
+
(function() { module.exports = window["wp"]["wordcount"]; }());
|
| 12293 |
+
|
| 12294 |
+
/***/ }),
|
| 12295 |
+
/* 140 */,
|
| 12296 |
+
/* 141 */,
|
| 12297 |
+
/* 142 */
|
| 12298 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12299 |
+
|
| 12300 |
+
"use strict";
|
| 12301 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InsertionPointOpenRef; });
|
| 12302 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return InsertionPoint; });
|
| 12303 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12304 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12305 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
|
| 12306 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
|
| 12307 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
| 12308 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
| 12309 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
| 12310 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
|
| 12311 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
|
| 12312 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
|
| 12313 |
+
/* harmony import */ var _inserter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(87);
|
| 12314 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(13);
|
| 12315 |
+
/* harmony import */ var _block_list_use_block_props_use_block_refs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(71);
|
| 12316 |
+
/* harmony import */ var _use_popover_scroll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(155);
|
| 12317 |
|
| 12318 |
|
| 12319 |
/**
|
| 12320 |
* External dependencies
|
| 12321 |
*/
|
| 12322 |
|
|
|
|
| 12323 |
/**
|
| 12324 |
* WordPress dependencies
|
| 12325 |
*/
|
| 12328 |
|
| 12329 |
|
| 12330 |
|
|
|
|
| 12331 |
/**
|
| 12332 |
* Internal dependencies
|
| 12333 |
*/
|
| 12334 |
|
| 12335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12338 |
|
| 12339 |
+
const InsertionPointOpenRef = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])();
|
|
|
|
|
|
|
| 12340 |
|
| 12341 |
+
function InsertionPointPopover({
|
| 12342 |
+
__unstablePopoverSlot,
|
| 12343 |
+
__unstableContentRef
|
| 12344 |
+
}) {
|
| 12345 |
+
const {
|
| 12346 |
+
selectBlock
|
| 12347 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useDispatch"])(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 12348 |
+
const openRef = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(InsertionPointOpenRef);
|
| 12349 |
+
const ref = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useRef"])();
|
| 12350 |
+
const {
|
| 12351 |
+
orientation,
|
| 12352 |
+
previousClientId,
|
| 12353 |
+
nextClientId,
|
| 12354 |
+
rootClientId,
|
| 12355 |
+
isInserterShown
|
| 12356 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useSelect"])(select => {
|
| 12357 |
+
var _getBlockListSettings;
|
| 12358 |
+
|
| 12359 |
+
const {
|
| 12360 |
+
getBlockOrder,
|
| 12361 |
+
getBlockListSettings,
|
| 12362 |
+
getBlockInsertionPoint,
|
| 12363 |
+
isBlockBeingDragged,
|
| 12364 |
+
getPreviousBlockClientId,
|
| 12365 |
+
getNextBlockClientId
|
| 12366 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 12367 |
+
const insertionPoint = getBlockInsertionPoint();
|
| 12368 |
+
const order = getBlockOrder(insertionPoint.rootClientId);
|
| 12369 |
+
|
| 12370 |
+
if (!order.length) {
|
| 12371 |
+
return {};
|
| 12372 |
}
|
| 12373 |
|
| 12374 |
+
let _previousClientId = order[insertionPoint.index - 1];
|
| 12375 |
+
let _nextClientId = order[insertionPoint.index];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12376 |
|
| 12377 |
+
while (isBlockBeingDragged(_previousClientId)) {
|
| 12378 |
+
_previousClientId = getPreviousBlockClientId(_previousClientId);
|
| 12379 |
+
}
|
|
|
|
| 12380 |
|
| 12381 |
+
while (isBlockBeingDragged(_nextClientId)) {
|
| 12382 |
+
_nextClientId = getNextBlockClientId(_nextClientId);
|
| 12383 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12384 |
|
| 12385 |
+
return {
|
| 12386 |
+
previousClientId: _previousClientId,
|
| 12387 |
+
nextClientId: _nextClientId,
|
| 12388 |
+
orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
|
| 12389 |
+
rootClientId: insertionPoint.rootClientId,
|
| 12390 |
+
isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter
|
| 12391 |
+
};
|
| 12392 |
+
}, []);
|
| 12393 |
+
const previousElement = Object(_block_list_use_block_props_use_block_refs__WEBPACK_IMPORTED_MODULE_7__[/* __unstableUseBlockElement */ "a"])(previousClientId);
|
| 12394 |
+
const nextElement = Object(_block_list_use_block_props_use_block_refs__WEBPACK_IMPORTED_MODULE_7__[/* __unstableUseBlockElement */ "a"])(nextClientId);
|
| 12395 |
+
const style = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(() => {
|
| 12396 |
+
if (!previousElement && !nextElement) {
|
| 12397 |
+
return {};
|
| 12398 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12399 |
|
| 12400 |
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
| 12401 |
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12402 |
|
| 12403 |
+
if (orientation === 'vertical') {
|
| 12404 |
+
return {
|
| 12405 |
+
width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
|
| 12406 |
+
height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
|
| 12407 |
+
};
|
| 12408 |
}
|
|
|
|
| 12409 |
|
| 12410 |
+
let width = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12411 |
|
| 12412 |
+
if (previousRect && nextRect) {
|
| 12413 |
+
width = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["isRTL"])() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
|
| 12414 |
+
}
|
| 12415 |
|
| 12416 |
+
return {
|
| 12417 |
+
width,
|
| 12418 |
+
height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
|
| 12419 |
+
};
|
| 12420 |
+
}, [previousElement, nextElement]);
|
| 12421 |
+
const getAnchorRect = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(() => {
|
| 12422 |
+
if (!previousElement && !nextElement) {
|
| 12423 |
+
return {};
|
| 12424 |
+
}
|
| 12425 |
|
| 12426 |
+
const {
|
| 12427 |
+
ownerDocument
|
| 12428 |
+
} = previousElement || nextElement;
|
| 12429 |
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
| 12430 |
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
| 12431 |
|
| 12432 |
+
if (orientation === 'vertical') {
|
| 12433 |
+
if (Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["isRTL"])()) {
|
| 12434 |
+
return {
|
| 12435 |
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
| 12436 |
+
left: previousRect ? previousRect.right : nextRect.right,
|
| 12437 |
+
right: previousRect ? previousRect.left : nextRect.left,
|
| 12438 |
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
| 12439 |
+
ownerDocument
|
| 12440 |
+
};
|
| 12441 |
+
}
|
| 12442 |
|
| 12443 |
+
return {
|
| 12444 |
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
| 12445 |
+
left: previousRect ? previousRect.left : nextRect.left,
|
| 12446 |
+
right: previousRect ? previousRect.right : nextRect.right,
|
| 12447 |
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
| 12448 |
+
ownerDocument
|
| 12449 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12450 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12451 |
|
| 12452 |
+
if (Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["isRTL"])()) {
|
| 12453 |
+
return {
|
| 12454 |
+
top: previousRect ? previousRect.top : nextRect.top,
|
| 12455 |
+
left: previousRect ? previousRect.left : nextRect.right,
|
| 12456 |
+
right: nextRect ? nextRect.right : previousRect.left,
|
| 12457 |
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
| 12458 |
+
ownerDocument
|
| 12459 |
+
};
|
| 12460 |
+
}
|
| 12461 |
|
| 12462 |
+
return {
|
| 12463 |
+
top: previousRect ? previousRect.top : nextRect.top,
|
| 12464 |
+
left: previousRect ? previousRect.right : nextRect.left,
|
| 12465 |
+
right: nextRect ? nextRect.left : previousRect.right,
|
| 12466 |
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
| 12467 |
+
ownerDocument
|
| 12468 |
+
};
|
| 12469 |
+
}, [previousElement, nextElement]);
|
| 12470 |
+
const popoverScrollRef = Object(_use_popover_scroll__WEBPACK_IMPORTED_MODULE_8__[/* usePopoverScroll */ "a"])(__unstableContentRef);
|
| 12471 |
+
const className = classnames__WEBPACK_IMPORTED_MODULE_1___default()('block-editor-block-list__insertion-point', 'is-' + orientation);
|
| 12472 |
|
| 12473 |
+
function onClick(event) {
|
| 12474 |
+
if (event.target === ref.current && nextClientId) {
|
| 12475 |
+
selectBlock(nextClientId, -1);
|
| 12476 |
+
}
|
| 12477 |
+
}
|
| 12478 |
|
| 12479 |
+
function onFocus(event) {
|
| 12480 |
+
// Only handle click on the wrapper specifically, and not an event
|
| 12481 |
+
// bubbled from the inserter itself.
|
| 12482 |
+
if (event.target !== ref.current) {
|
| 12483 |
+
openRef.current = true;
|
| 12484 |
+
}
|
| 12485 |
+
} // Only show the in-between inserter between blocks, so when there's a
|
| 12486 |
+
// previous and a next element.
|
| 12487 |
|
| 12488 |
|
| 12489 |
+
const showInsertionPointInserter = previousElement && nextElement && isInserterShown;
|
| 12490 |
+
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
| 12491 |
+
// While ideally it would be enough to capture the
|
| 12492 |
+
// bubbling focus event from the Inserter, due to the
|
| 12493 |
+
// characteristics of click focusing of `button`s in
|
| 12494 |
+
// Firefox and Safari, it is not reliable.
|
| 12495 |
+
//
|
| 12496 |
+
// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12497 |
|
| 12498 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Popover"], {
|
| 12499 |
+
ref: popoverScrollRef,
|
| 12500 |
+
noArrow: true,
|
| 12501 |
+
animate: false,
|
| 12502 |
+
getAnchorRect: getAnchorRect,
|
| 12503 |
+
focusOnMount: false,
|
| 12504 |
+
className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility,
|
| 12505 |
+
// otherwise render in place (not in the the default popover slot).
|
| 12506 |
+
,
|
| 12507 |
+
__unstableSlotName: __unstablePopoverSlot || null
|
| 12508 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 12509 |
+
ref: ref,
|
| 12510 |
+
tabIndex: -1,
|
| 12511 |
+
onClick: onClick,
|
| 12512 |
+
onFocus: onFocus,
|
| 12513 |
+
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(className, {
|
| 12514 |
+
'is-with-inserter': showInsertionPointInserter
|
| 12515 |
+
}),
|
| 12516 |
+
style: style
|
| 12517 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 12518 |
+
className: "block-editor-block-list__insertion-point-indicator"
|
| 12519 |
+
}), showInsertionPointInserter && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 12520 |
+
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('block-editor-block-list__insertion-point-inserter')
|
| 12521 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_inserter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
|
| 12522 |
+
position: "bottom center",
|
| 12523 |
+
clientId: nextClientId,
|
| 12524 |
+
rootClientId: rootClientId,
|
| 12525 |
+
__experimentalIsQuick: true,
|
| 12526 |
+
onToggle: isOpen => {
|
| 12527 |
+
openRef.current = isOpen;
|
| 12528 |
+
},
|
| 12529 |
+
onSelectOrClose: () => {
|
| 12530 |
+
openRef.current = false;
|
| 12531 |
}
|
| 12532 |
+
}))));
|
| 12533 |
+
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
| 12534 |
+
}
|
| 12535 |
|
| 12536 |
+
function InsertionPoint({
|
| 12537 |
+
children,
|
| 12538 |
+
__unstablePopoverSlot,
|
| 12539 |
+
__unstableContentRef
|
| 12540 |
+
}) {
|
| 12541 |
+
const isVisible = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["useSelect"])(select => {
|
| 12542 |
+
return select(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]).isBlockInsertionPointVisible();
|
| 12543 |
+
}, []);
|
| 12544 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(InsertionPointOpenRef.Provider, {
|
| 12545 |
+
value: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useRef"])(false)
|
| 12546 |
+
}, isVisible && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(InsertionPointPopover, {
|
| 12547 |
+
__unstablePopoverSlot: __unstablePopoverSlot,
|
| 12548 |
+
__unstableContentRef: __unstableContentRef
|
| 12549 |
+
}), children);
|
| 12550 |
+
}
|
| 12551 |
+
//# sourceMappingURL=insertion-point.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12552 |
|
| 12553 |
+
/***/ }),
|
| 12554 |
+
/* 143 */
|
| 12555 |
+
/***/ (function(module, exports) {
|
| 12556 |
|
| 12557 |
+
(function() { module.exports = window["wp"]["shortcode"]; }());
|
|
|
|
|
|
|
| 12558 |
|
| 12559 |
+
/***/ }),
|
| 12560 |
+
/* 144 */,
|
| 12561 |
+
/* 145 */
|
| 12562 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12563 |
|
| 12564 |
+
"use strict";
|
| 12565 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12566 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12567 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 12568 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 12569 |
|
|
|
|
|
|
|
| 12570 |
|
| 12571 |
+
/**
|
| 12572 |
+
* WordPress dependencies
|
| 12573 |
+
*/
|
| 12574 |
|
| 12575 |
+
const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 12576 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 12577 |
+
viewBox: "0 0 24 24"
|
| 12578 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 12579 |
+
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
|
| 12580 |
+
}));
|
| 12581 |
+
/* harmony default export */ __webpack_exports__["a"] = (plus);
|
| 12582 |
+
//# sourceMappingURL=plus.js.map
|
| 12583 |
|
| 12584 |
+
/***/ }),
|
| 12585 |
+
/* 146 */
|
| 12586 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
| 12587 |
|
| 12588 |
+
"use strict";
|
| 12589 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12590 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12591 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
| 12592 |
+
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
|
| 12593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12594 |
|
|
|
|
| 12595 |
/**
|
| 12596 |
+
* WordPress dependencies
|
| 12597 |
*/
|
| 12598 |
|
| 12599 |
+
const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
|
| 12600 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 12601 |
+
viewBox: "0 0 24 24"
|
| 12602 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
|
| 12603 |
+
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"
|
| 12604 |
+
}));
|
| 12605 |
+
/* harmony default export */ __webpack_exports__["a"] = (blockDefault);
|
| 12606 |
+
//# sourceMappingURL=block-default.js.map
|
| 12607 |
|
| 12608 |
+
/***/ }),
|
| 12609 |
+
/* 147 */
|
| 12610 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12611 |
|
| 12612 |
+
"use strict";
|
| 12613 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BlockContextProvider; });
|
| 12614 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12615 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
| 12616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12618 |
/**
|
| 12619 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12620 |
*/
|
| 12621 |
|
| 12622 |
+
/** @typedef {import('react').ReactNode} ReactNode */
|
| 12623 |
+
|
|
|
|
|
|
|
|
|
|
| 12624 |
/**
|
| 12625 |
+
* @typedef BlockContextProviderProps
|
|
|
|
|
|
|
|
|
|
| 12626 |
*
|
| 12627 |
+
* @property {Record<string,*>} value Context value to merge with current
|
| 12628 |
+
* value.
|
| 12629 |
+
* @property {ReactNode} children Component children.
|
| 12630 |
*/
|
| 12631 |
|
| 12632 |
+
/** @type {import('react').Context<Record<string,*>>} */
|
|
|
|
|
|
|
|
|
|
| 12633 |
|
| 12634 |
+
const Context = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])({});
|
|
|
|
| 12635 |
/**
|
| 12636 |
+
* Component which merges passed value with current consumed block context.
|
| 12637 |
*
|
| 12638 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md
|
|
|
|
| 12639 |
*
|
| 12640 |
+
* @param {BlockContextProviderProps} props
|
| 12641 |
*/
|
| 12642 |
|
| 12643 |
+
function BlockContextProvider({
|
| 12644 |
+
value,
|
| 12645 |
+
children
|
| 12646 |
+
}) {
|
| 12647 |
+
const context = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(Context);
|
| 12648 |
+
const nextValue = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(() => ({ ...context,
|
| 12649 |
+
...value
|
| 12650 |
+
}), [context, value]);
|
| 12651 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(Context.Provider, {
|
| 12652 |
+
value: nextValue,
|
| 12653 |
+
children: children
|
| 12654 |
+
});
|
| 12655 |
}
|
| 12656 |
+
/* harmony default export */ __webpack_exports__["b"] = (Context);
|
| 12657 |
+
//# sourceMappingURL=index.js.map
|
| 12658 |
+
|
| 12659 |
+
/***/ }),
|
| 12660 |
+
/* 148 */
|
| 12661 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12662 |
+
|
| 12663 |
+
"use strict";
|
| 12664 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12665 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12666 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
| 12667 |
+
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
|
| 12668 |
+
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(158);
|
| 12669 |
+
|
| 12670 |
|
| 12671 |
/**
|
| 12672 |
* WordPress dependencies
|
| 12673 |
*/
|
| 12674 |
|
|
|
|
|
|
|
| 12675 |
/**
|
| 12676 |
* Internal dependencies
|
| 12677 |
*/
|
| 12679 |
|
| 12680 |
|
| 12681 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12682 |
|
| 12683 |
+
|
| 12684 |
+
function InserterListbox({
|
| 12685 |
+
children
|
| 12686 |
+
}) {
|
| 12687 |
+
const compositeState = Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["__unstableUseCompositeState"])({
|
| 12688 |
+
shift: true,
|
| 12689 |
+
wrap: 'horizontal'
|
| 12690 |
+
});
|
| 12691 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_context__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Provider, {
|
| 12692 |
+
value: compositeState
|
| 12693 |
+
}, children);
|
| 12694 |
}
|
| 12695 |
+
|
| 12696 |
+
/* harmony default export */ __webpack_exports__["a"] = (InserterListbox);
|
| 12697 |
+
//# sourceMappingURL=index.js.map
|
| 12698 |
+
|
| 12699 |
+
/***/ }),
|
| 12700 |
+
/* 149 */
|
| 12701 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12702 |
+
|
| 12703 |
+
"use strict";
|
| 12704 |
+
/* unused harmony export ZWNBSP */
|
| 12705 |
+
/* unused harmony export DefaultBlockAppender */
|
| 12706 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12707 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 12708 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
| 12709 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
| 12710 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
|
| 12711 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
| 12712 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
|
| 12713 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__);
|
| 12714 |
+
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(41);
|
| 12715 |
+
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);
|
| 12716 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4);
|
| 12717 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__);
|
| 12718 |
+
/* harmony import */ var _inserter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(87);
|
| 12719 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(13);
|
| 12720 |
+
|
| 12721 |
+
|
| 12722 |
/**
|
| 12723 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12724 |
*/
|
| 12725 |
|
| 12726 |
+
|
| 12727 |
+
|
| 12728 |
+
|
| 12729 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12730 |
/**
|
| 12731 |
+
* Internal dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12732 |
*/
|
| 12733 |
|
|
|
|
|
|
|
| 12734 |
|
| 12735 |
+
|
| 12736 |
+
/**
|
| 12737 |
+
* Zero width non-breaking space, used as padding for the paragraph when it is
|
| 12738 |
+
* empty.
|
| 12739 |
+
*/
|
| 12740 |
+
|
| 12741 |
+
const ZWNBSP = '\ufeff';
|
| 12742 |
+
function DefaultBlockAppender({
|
| 12743 |
+
isLocked,
|
| 12744 |
+
isVisible,
|
| 12745 |
+
onAppend,
|
| 12746 |
+
showPrompt,
|
| 12747 |
+
placeholder,
|
| 12748 |
+
rootClientId
|
| 12749 |
+
}) {
|
| 12750 |
+
if (isLocked || !isVisible) {
|
| 12751 |
+
return null;
|
| 12752 |
+
}
|
| 12753 |
+
|
| 12754 |
+
const value = Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__["decodeEntities"])(placeholder) || Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Type / to choose a block');
|
| 12755 |
+
|
| 12756 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 12757 |
+
"data-root-client-id": rootClientId || '',
|
| 12758 |
+
className: "block-editor-default-block-appender"
|
| 12759 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", {
|
| 12760 |
+
tabIndex: "0" // Only necessary for `useCanvasClickRedirect` to consider it
|
| 12761 |
+
// as a target. Ideally it should consider any tabbable target,
|
| 12762 |
+
// but the inserter is rendered in place while it should be
|
| 12763 |
+
// rendered in a popover, just like it does for an empty
|
| 12764 |
+
// paragraph block.
|
| 12765 |
+
,
|
| 12766 |
+
contentEditable: true,
|
| 12767 |
+
suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes.
|
| 12768 |
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
| 12769 |
+
,
|
| 12770 |
+
role: "button",
|
| 12771 |
+
"aria-label": Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Add block') // The wp-block className is important for editor styles.
|
| 12772 |
+
,
|
| 12773 |
+
className: "wp-block block-editor-default-block-appender__content",
|
| 12774 |
+
onFocus: onAppend
|
| 12775 |
+
}, showPrompt ? value : ZWNBSP), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_inserter__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
|
| 12776 |
+
rootClientId: rootClientId,
|
| 12777 |
+
position: "bottom right",
|
| 12778 |
+
isAppender: true,
|
| 12779 |
+
__experimentalIsQuick: true
|
| 12780 |
+
}));
|
| 12781 |
+
}
|
| 12782 |
+
/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["withSelect"])((select, ownProps) => {
|
| 12783 |
const {
|
| 12784 |
+
getBlockCount,
|
| 12785 |
+
getBlockName,
|
| 12786 |
+
isBlockValid,
|
| 12787 |
+
getSettings,
|
| 12788 |
+
getTemplateLock
|
| 12789 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_7__[/* store */ "a"]);
|
| 12790 |
+
const isEmpty = !getBlockCount(ownProps.rootClientId);
|
| 12791 |
+
const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__["getDefaultBlockName"])();
|
| 12792 |
+
const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId);
|
|
|
|
|
|
|
|
|
|
| 12793 |
const {
|
| 12794 |
+
bodyPlaceholder
|
| 12795 |
+
} = getSettings();
|
| 12796 |
+
return {
|
| 12797 |
+
isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid,
|
| 12798 |
+
showPrompt: isEmpty,
|
| 12799 |
+
isLocked: !!getTemplateLock(ownProps.rootClientId),
|
| 12800 |
+
placeholder: bodyPlaceholder
|
| 12801 |
+
};
|
| 12802 |
+
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["withDispatch"])((dispatch, ownProps) => {
|
| 12803 |
+
const {
|
| 12804 |
+
insertDefaultBlock,
|
| 12805 |
+
startTyping
|
| 12806 |
+
} = dispatch(_store__WEBPACK_IMPORTED_MODULE_7__[/* store */ "a"]);
|
| 12807 |
+
return {
|
| 12808 |
+
onAppend() {
|
| 12809 |
+
const {
|
| 12810 |
+
rootClientId
|
| 12811 |
+
} = ownProps;
|
| 12812 |
+
insertDefaultBlock(undefined, rootClientId);
|
| 12813 |
+
startTyping();
|
| 12814 |
}
|
| 12815 |
|
| 12816 |
+
};
|
| 12817 |
+
}))(DefaultBlockAppender));
|
| 12818 |
+
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
| 12819 |
|
| 12820 |
+
/***/ }),
|
| 12821 |
+
/* 150 */,
|
| 12822 |
+
/* 151 */,
|
| 12823 |
+
/* 152 */
|
| 12824 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12825 |
|
| 12826 |
+
"use strict";
|
| 12827 |
|
| 12828 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 12829 |
+
var external_wp_element_ = __webpack_require__(0);
|
|
|
|
|
|
|
|
|
|
| 12830 |
|
| 12831 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 12832 |
+
var classnames = __webpack_require__(10);
|
| 12833 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
| 12834 |
+
|
| 12835 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 12836 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 12837 |
+
|
| 12838 |
+
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 12839 |
+
var external_wp_i18n_ = __webpack_require__(1);
|
| 12840 |
+
|
| 12841 |
+
// EXTERNAL MODULE: external ["wp","primitives"]
|
| 12842 |
+
var external_wp_primitives_ = __webpack_require__(6);
|
| 12843 |
|
| 12844 |
+
// CONCATENATED MODULE: ./packages/icons/build-module/library/more-horizontal.js
|
| 12845 |
|
| 12846 |
|
| 12847 |
/**
|
| 12848 |
+
* WordPress dependencies
|
| 12849 |
*/
|
| 12850 |
|
| 12851 |
+
const moreHorizontal = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
|
| 12852 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 12853 |
+
viewBox: "0 0 24 24"
|
| 12854 |
+
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
|
| 12855 |
+
d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"
|
| 12856 |
+
}));
|
| 12857 |
+
/* harmony default export */ var more_horizontal = (moreHorizontal);
|
| 12858 |
+
//# sourceMappingURL=more-horizontal.js.map
|
| 12859 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/warning/index.js
|
| 12860 |
+
|
| 12861 |
+
|
| 12862 |
+
/**
|
| 12863 |
+
* External dependencies
|
| 12864 |
+
*/
|
| 12865 |
|
| 12866 |
/**
|
| 12867 |
* WordPress dependencies
|
| 12870 |
|
| 12871 |
|
| 12872 |
|
| 12873 |
+
|
| 12874 |
+
|
| 12875 |
+
function Warning({
|
| 12876 |
+
className,
|
| 12877 |
+
actions,
|
| 12878 |
+
children,
|
| 12879 |
+
secondaryActions
|
| 12880 |
+
}) {
|
| 12881 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 12882 |
+
className: classnames_default()(className, 'block-editor-warning')
|
| 12883 |
+
}, Object(external_wp_element_["createElement"])("div", {
|
| 12884 |
+
className: "block-editor-warning__contents"
|
| 12885 |
+
}, Object(external_wp_element_["createElement"])("p", {
|
| 12886 |
+
className: "block-editor-warning__message"
|
| 12887 |
+
}, children), (external_wp_element_["Children"].count(actions) > 0 || secondaryActions) && Object(external_wp_element_["createElement"])("div", {
|
| 12888 |
+
className: "block-editor-warning__actions"
|
| 12889 |
+
}, external_wp_element_["Children"].count(actions) > 0 && external_wp_element_["Children"].map(actions, (action, i) => Object(external_wp_element_["createElement"])("span", {
|
| 12890 |
+
key: i,
|
| 12891 |
+
className: "block-editor-warning__action"
|
| 12892 |
+
}, action)), secondaryActions && Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], {
|
| 12893 |
+
className: "block-editor-warning__secondary",
|
| 12894 |
+
icon: more_horizontal,
|
| 12895 |
+
label: Object(external_wp_i18n_["__"])('More options'),
|
| 12896 |
+
popoverProps: {
|
| 12897 |
+
position: 'bottom left',
|
| 12898 |
+
className: 'block-editor-warning__dropdown'
|
| 12899 |
+
},
|
| 12900 |
+
noIcons: true
|
| 12901 |
+
}, () => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, secondaryActions.map((item, pos) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
|
| 12902 |
+
onClick: item.onClick,
|
| 12903 |
+
key: pos
|
| 12904 |
+
}, item.title)))))));
|
| 12905 |
+
}
|
| 12906 |
/**
|
| 12907 |
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md
|
| 12908 |
*/
|
| 12909 |
|
| 12910 |
|
| 12911 |
+
/* harmony default export */ var warning = __webpack_exports__["a"] = (Warning);
|
| 12912 |
+
//# sourceMappingURL=index.js.map
|
| 12913 |
|
| 12914 |
+
/***/ }),
|
| 12915 |
+
/* 153 */
|
| 12916 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12917 |
|
| 12918 |
+
"use strict";
|
| 12919 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useDisplayBlockControls; });
|
| 12920 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
| 12921 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
| 12922 |
+
/* harmony import */ var _block_edit_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(69);
|
| 12923 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
|
| 12924 |
+
/**
|
| 12925 |
+
* WordPress dependencies
|
| 12926 |
+
*/
|
| 12927 |
|
| 12928 |
+
/**
|
| 12929 |
+
* Internal dependencies
|
| 12930 |
+
*/
|
| 12931 |
|
|
|
|
| 12932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12933 |
|
| 12934 |
+
function useDisplayBlockControls() {
|
| 12935 |
+
const {
|
| 12936 |
+
isSelected,
|
| 12937 |
+
clientId,
|
| 12938 |
+
name
|
| 12939 |
+
} = Object(_block_edit_context__WEBPACK_IMPORTED_MODULE_1__[/* useBlockEditContext */ "b"])();
|
| 12940 |
+
const isFirstAndSameTypeMultiSelected = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__["useSelect"])(select => {
|
| 12941 |
+
// Don't bother checking, see OR statement below.
|
| 12942 |
+
if (isSelected) {
|
| 12943 |
+
return;
|
| 12944 |
}
|
|
|
|
|
|
|
| 12945 |
|
| 12946 |
+
const {
|
| 12947 |
+
getBlockName,
|
| 12948 |
+
isFirstMultiSelectedBlock,
|
| 12949 |
+
getMultiSelectedBlockClientIds
|
| 12950 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_2__[/* store */ "a"]);
|
| 12951 |
|
| 12952 |
+
if (!isFirstMultiSelectedBlock(clientId)) {
|
| 12953 |
+
return false;
|
| 12954 |
+
}
|
| 12955 |
|
| 12956 |
+
return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name);
|
| 12957 |
+
}, [clientId, isSelected, name]);
|
| 12958 |
+
return isSelected || isFirstAndSameTypeMultiSelected;
|
|
|
|
| 12959 |
}
|
| 12960 |
+
//# sourceMappingURL=index.js.map
|
| 12961 |
|
| 12962 |
+
/***/ }),
|
| 12963 |
+
/* 154 */
|
| 12964 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12965 |
|
| 12966 |
+
"use strict";
|
| 12967 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Head; });
|
| 12968 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 12969 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12970 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12971 |
|
| 12972 |
+
/**
|
| 12973 |
+
* WordPress dependencies
|
| 12974 |
+
*/
|
|
|
|
| 12975 |
|
| 12976 |
+
const context = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])();
|
| 12977 |
+
function Head({
|
| 12978 |
+
children
|
| 12979 |
+
}) {
|
| 12980 |
+
const [element, setElement] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])();
|
| 12981 |
+
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(context.Provider, {
|
| 12982 |
+
value: element
|
| 12983 |
+
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
|
| 12984 |
+
ref: setElement
|
| 12985 |
+
}), children);
|
| 12986 |
}
|
| 12987 |
+
Head.context = context;
|
| 12988 |
+
//# sourceMappingURL=head.js.map
|
| 12989 |
|
| 12990 |
+
/***/ }),
|
| 12991 |
+
/* 155 */
|
| 12992 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 12993 |
+
|
| 12994 |
+
"use strict";
|
| 12995 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePopoverScroll; });
|
| 12996 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
|
| 12997 |
+
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
|
| 12998 |
/**
|
| 12999 |
+
* WordPress dependencies
|
| 13000 |
*/
|
| 13001 |
|
| 13002 |
/**
|
| 13003 |
+
* Allow scrolling "through" popovers over the canvas. This is only called for
|
| 13004 |
+
* as long as the pointer is over a popover. Do not use React events because it
|
| 13005 |
+
* will bubble through portals.
|
| 13006 |
*
|
| 13007 |
+
* @param {Object} scrollableRef
|
|
|
|
| 13008 |
*/
|
| 13009 |
|
| 13010 |
+
function usePopoverScroll(scrollableRef) {
|
| 13011 |
+
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["useRefEffect"])(node => {
|
| 13012 |
+
if (!scrollableRef) {
|
| 13013 |
+
return;
|
| 13014 |
+
}
|
| 13015 |
|
| 13016 |
+
function onWheel(event) {
|
| 13017 |
+
const {
|
| 13018 |
+
deltaX,
|
| 13019 |
+
deltaY
|
| 13020 |
+
} = event;
|
| 13021 |
+
scrollableRef.current.scrollBy(deltaX, deltaY);
|
| 13022 |
+
}
|
| 13023 |
|
| 13024 |
+
node.addEventListener('wheel', onWheel);
|
| 13025 |
+
return () => {
|
| 13026 |
+
node.removeEventListener('wheel', onWheel);
|
| 13027 |
+
};
|
| 13028 |
+
}, [scrollableRef]);
|
| 13029 |
+
}
|
| 13030 |
+
//# sourceMappingURL=use-popover-scroll.js.map
|
| 13031 |
|
| 13032 |
+
/***/ }),
|
| 13033 |
+
/* 156 */
|
| 13034 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 13035 |
|
| 13036 |
+
"use strict";
|
| 13037 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
| 13038 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
| 13039 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
| 13040 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
| 13041 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
| 13042 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
|
| 13043 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
|
| 13044 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
| 13045 |
+
/* harmony import */ var _wordpress_a11y__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
|
| 13046 |
+
/* harmony import */ var _wordpress_a11y__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_a11y__WEBPACK_IMPORTED_MODULE_4__);
|
| 13047 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(0);
|
| 13048 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
|
| 13049 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(13);
|
| 13050 |
/**
|
| 13051 |
* External dependencies
|
| 13052 |
*/
|
| 13058 |
|
| 13059 |
|
| 13060 |
|
| 13061 |
+
|
| 13062 |
+
|
| 13063 |
/**
|
| 13064 |
* Internal dependencies
|
| 13065 |
*/
|
| 13066 |
|
| 13067 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13068 |
/**
|
| 13069 |
+
* @typedef WPInserterConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13070 |
*
|
| 13071 |
+
* @property {string=} rootClientId If set, insertion will be into the
|
| 13072 |
+
* block with this ID.
|
| 13073 |
+
* @property {number=} insertionIndex If set, insertion will be into this
|
| 13074 |
+
* explicit position.
|
| 13075 |
+
* @property {string=} clientId If set, insertion will be after the
|
| 13076 |
+
* block with this ID.
|
| 13077 |
+
* @property {boolean=} isAppender Whether the inserter is an appender
|
| 13078 |
+
* or not.
|
| 13079 |
+
* @property {Function=} onSelect Called after insertion.
|
| 13080 |
*/
|
| 13081 |
|
| 13082 |
+
/**
|
| 13083 |
+
* Returns the insertion point state given the inserter config.
|
| 13084 |
+
*
|
| 13085 |
+
* @param {WPInserterConfig} config Inserter Config.
|
| 13086 |
+
* @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle).
|
| 13087 |
+
*/
|
| 13088 |
|
| 13089 |
+
function useInsertionPoint({
|
| 13090 |
+
rootClientId = '',
|
| 13091 |
+
insertionIndex,
|
| 13092 |
+
clientId,
|
| 13093 |
+
isAppender,
|
| 13094 |
+
onSelect,
|
| 13095 |
+
shouldFocusBlock = true
|
| 13096 |
+
}) {
|
| 13097 |
const {
|
| 13098 |
+
getSelectedBlock
|
| 13099 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 13100 |
+
const {
|
| 13101 |
+
destinationRootClientId,
|
| 13102 |
+
destinationIndex
|
| 13103 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => {
|
| 13104 |
+
const {
|
| 13105 |
+
getSelectedBlockClientId,
|
| 13106 |
+
getBlockRootClientId,
|
| 13107 |
+
getBlockIndex,
|
| 13108 |
+
getBlockOrder
|
| 13109 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 13110 |
+
const selectedBlockClientId = getSelectedBlockClientId();
|
| 13111 |
+
let _destinationRootClientId = rootClientId;
|
| 13112 |
|
| 13113 |
+
let _destinationIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13114 |
|
| 13115 |
+
if (insertionIndex !== undefined) {
|
| 13116 |
+
// Insert into a specific index.
|
| 13117 |
+
_destinationIndex = insertionIndex;
|
| 13118 |
+
} else if (clientId) {
|
| 13119 |
+
// Insert after a specific client ID.
|
| 13120 |
+
_destinationIndex = getBlockIndex(clientId, _destinationRootClientId);
|
| 13121 |
+
} else if (!isAppender && selectedBlockClientId) {
|
| 13122 |
+
_destinationRootClientId = getBlockRootClientId(selectedBlockClientId);
|
| 13123 |
+
_destinationIndex = getBlockIndex(selectedBlockClientId, _destinationRootClientId) + 1;
|
| 13124 |
+
} else {
|
| 13125 |
+
// Insert at the end of the list.
|
| 13126 |
+
_destinationIndex = getBlockOrder(_destinationRootClientId).length;
|
| 13127 |
+
}
|
| 13128 |
|
| 13129 |
+
return {
|
| 13130 |
+
destinationRootClientId: _destinationRootClientId,
|
| 13131 |
+
destinationIndex: _destinationIndex
|
| 13132 |
+
};
|
| 13133 |
+
}, [rootClientId, insertionIndex, clientId, isAppender]);
|
| 13134 |
+
const {
|
| 13135 |
+
replaceBlocks,
|
| 13136 |
+
insertBlocks,
|
| 13137 |
+
showInsertionPoint,
|
| 13138 |
+
hideInsertionPoint
|
| 13139 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useDispatch"])(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 13140 |
+
const onInsertBlocks = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["useCallback"])((blocks, meta, shouldForceFocusBlock = false) => {
|
| 13141 |
+
const selectedBlock = getSelectedBlock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13142 |
|
| 13143 |
+
if (!isAppender && selectedBlock && Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["isUnmodifiedDefaultBlock"])(selectedBlock)) {
|
| 13144 |
+
replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
|
| 13145 |
+
} else {
|
| 13146 |
+
insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
|
| 13147 |
+
}
|
| 13148 |
|
| 13149 |
+
const message = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["sprintf"])( // translators: %d: the name of the block that has been added
|
| 13150 |
+
Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["_n"])('%d block added.', '%d blocks added.', Object(lodash__WEBPACK_IMPORTED_MODULE_0__["castArray"])(blocks).length), Object(lodash__WEBPACK_IMPORTED_MODULE_0__["castArray"])(blocks).length);
|
| 13151 |
+
Object(_wordpress_a11y__WEBPACK_IMPORTED_MODULE_4__["speak"])(message);
|
| 13152 |
|
| 13153 |
+
if (onSelect) {
|
| 13154 |
+
onSelect();
|
| 13155 |
+
}
|
| 13156 |
+
}, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]);
|
| 13157 |
+
const onToggleInsertionPoint = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(show => {
|
| 13158 |
+
if (show) {
|
| 13159 |
+
showInsertionPoint(destinationRootClientId, destinationIndex);
|
| 13160 |
+
} else {
|
| 13161 |
+
hideInsertionPoint();
|
| 13162 |
+
}
|
| 13163 |
+
}, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]);
|
| 13164 |
+
return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint];
|
| 13165 |
+
}
|
| 13166 |
|
| 13167 |
+
/* harmony default export */ __webpack_exports__["a"] = (useInsertionPoint);
|
| 13168 |
+
//# sourceMappingURL=use-insertion-point.js.map
|
| 13169 |
|
| 13170 |
+
/***/ }),
|
| 13171 |
+
/* 157 */
|
| 13172 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 13173 |
+
|
| 13174 |
+
"use strict";
|
| 13175 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
| 13176 |
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
| 13177 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
| 13178 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
| 13179 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
| 13180 |
+
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
|
| 13181 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
| 13182 |
+
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__);
|
| 13183 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
|
| 13184 |
+
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
|
| 13185 |
+
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29);
|
| 13186 |
+
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__);
|
| 13187 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(13);
|
| 13188 |
/**
|
| 13189 |
+
* External dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13190 |
*/
|
| 13191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13192 |
/**
|
| 13193 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13194 |
*/
|
| 13195 |
|
| 13196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13197 |
|
|
|
|
| 13198 |
|
|
|
|
|
|
|
| 13199 |
|
|
|
|
|
|
|
|
|
|
| 13200 |
|
| 13201 |
+
/**
|
| 13202 |
+
* Internal dependencies
|
| 13203 |
+
*/
|
| 13204 |
+
|
| 13205 |
|
|
|
|
|
|
|
| 13206 |
/**
|
| 13207 |
+
* Retrieves the block patterns inserter state.
|
|
|
|
| 13208 |
*
|
| 13209 |
+
* @param {Function} onInsert function called when inserter a list of blocks.
|
| 13210 |
+
* @param {string=} rootClientId Insertion's root client ID.
|
| 13211 |
*
|
| 13212 |
+
* @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
|
| 13213 |
*/
|
| 13214 |
|
| 13215 |
+
const usePatternsState = (onInsert, rootClientId) => {
|
|
|
|
|
|
|
|
|
|
| 13216 |
const {
|
| 13217 |
+
patternCategories,
|
| 13218 |
+
patterns
|
| 13219 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__["useSelect"])(select => {
|
| 13220 |
+
const {
|
| 13221 |
+
__experimentalGetAllowedPatterns,
|
| 13222 |
+
getSettings
|
| 13223 |
+
} = select(_store__WEBPACK_IMPORTED_MODULE_6__[/* store */ "a"]);
|
| 13224 |
+
return {
|
| 13225 |
+
patterns: __experimentalGetAllowedPatterns(rootClientId),
|
| 13226 |
+
patternCategories: getSettings().__experimentalBlockPatternCategories
|
| 13227 |
+
};
|
| 13228 |
+
}, [rootClientId]);
|
| 13229 |
const {
|
| 13230 |
+
createSuccessNotice
|
| 13231 |
+
} = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__["useDispatch"])(_wordpress_notices__WEBPACK_IMPORTED_MODULE_5__["store"]);
|
| 13232 |
+
const onClickPattern = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])((pattern, blocks) => {
|
| 13233 |
+
onInsert(Object(lodash__WEBPACK_IMPORTED_MODULE_0__["map"])(blocks, block => Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["cloneBlock"])(block)), pattern.name);
|
| 13234 |
+
createSuccessNotice(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["sprintf"])(
|
| 13235 |
+
/* translators: %s: block pattern title. */
|
| 13236 |
+
Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('Block pattern "%s" inserted.'), pattern.title), {
|
| 13237 |
+
type: 'snackbar'
|
| 13238 |
+
});
|
| 13239 |
+
}, []);
|
| 13240 |
+
return [patterns, patternCategories, onClickPattern];
|
| 13241 |
+
};
|
| 13242 |
|
| 13243 |
+
/* harmony default export */ __webpack_exports__["a"] = (usePatternsState);
|
| 13244 |
+
//# sourceMappingURL=use-patterns-state.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13245 |
|
| 13246 |
+
/***/ }),
|
| 13247 |
+
/* 158 */
|
| 13248 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 13249 |
|
| 13250 |
+
"use strict";
|
| 13251 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
| 13252 |
+
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
| 13253 |
/**
|
| 13254 |
* WordPress dependencies
|
| 13255 |
*/
|
| 13256 |
|
| 13257 |
+
const InserterListboxContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])();
|
| 13258 |
+
/* harmony default export */ __webpack_exports__["a"] = (InserterListboxContext);
|
| 13259 |
+
//# sourceMappingURL=context.js.map
|
| 13260 |
|
| 13261 |
+
/***/ }),
|
| 13262 |
+
/* 159 */,
|
| 13263 |
+
/* 160 */,
|
| 13264 |
+
/* 161 */,
|
| 13265 |
+
/* 162 */,
|
| 13266 |
+
/* 163 */
|
| 13267 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
| 13268 |
|
| 13269 |
+
"use strict";
|
|
|
|
|
|
|
| 13270 |
|
| 13271 |
+
// EXPORTS
|
| 13272 |
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BlockListBlockContext; });
|
| 13273 |
|
| 13274 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 13275 |
+
var external_wp_element_ = __webpack_require__(0);
|
| 13276 |
|
| 13277 |
+
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
| 13278 |
+
var classnames = __webpack_require__(10);
|
| 13279 |
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13280 |
|
| 13281 |
+
// EXTERNAL MODULE: external "lodash"
|
| 13282 |
+
var external_lodash_ = __webpack_require__(2);
|
| 13283 |
|
| 13284 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 13285 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13286 |
|
| 13287 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 13288 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 13289 |
|
| 13290 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 13291 |
+
var external_wp_data_ = __webpack_require__(4);
|
|
|
|
| 13292 |
|
| 13293 |
+
// EXTERNAL MODULE: external ["wp","compose"]
|
| 13294 |
+
var external_wp_compose_ = __webpack_require__(9);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13295 |
|
| 13296 |
+
// EXTERNAL MODULE: external ["wp","dom"]
|
| 13297 |
+
var external_wp_dom_ = __webpack_require__(22);
|
|
|
|
| 13298 |
|
| 13299 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-edit/index.js + 1 modules
|
| 13300 |
+
var block_edit = __webpack_require__(135);
|
|
|
|
|
|
|
| 13301 |
|
| 13302 |
+
// EXTERNAL MODULE: external ["wp","i18n"]
|
| 13303 |
+
var external_wp_i18n_ = __webpack_require__(1);
|
| 13304 |
+
|
| 13305 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/warning/index.js + 1 modules
|
| 13306 |
+
var warning = __webpack_require__(152);
|
| 13307 |
+
|
| 13308 |
+
// EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js
|
| 13309 |
+
var character = __webpack_require__(338);
|
| 13310 |
+
|
| 13311 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/block-view.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13312 |
|
| 13313 |
|
| 13314 |
/**
|
| 13316 |
*/
|
| 13317 |
|
| 13318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13319 |
|
| 13320 |
+
function BlockView({
|
| 13321 |
+
title,
|
| 13322 |
+
rawContent,
|
| 13323 |
+
renderedContent,
|
| 13324 |
+
action,
|
| 13325 |
+
actionText,
|
| 13326 |
+
className
|
| 13327 |
}) {
|
| 13328 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 13329 |
+
className: className
|
| 13330 |
+
}, Object(external_wp_element_["createElement"])("div", {
|
| 13331 |
+
className: "block-editor-block-compare__content"
|
| 13332 |
+
}, Object(external_wp_element_["createElement"])("h2", {
|
| 13333 |
+
className: "block-editor-block-compare__heading"
|
| 13334 |
+
}, title), Object(external_wp_element_["createElement"])("div", {
|
| 13335 |
+
className: "block-editor-block-compare__html"
|
| 13336 |
+
}, rawContent), Object(external_wp_element_["createElement"])("div", {
|
| 13337 |
+
className: "block-editor-block-compare__preview edit-post-visual-editor"
|
| 13338 |
+
}, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(renderedContent)))), Object(external_wp_element_["createElement"])("div", {
|
| 13339 |
+
className: "block-editor-block-compare__action"
|
| 13340 |
+
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
| 13341 |
+
variant: "secondary",
|
| 13342 |
+
tabIndex: "0",
|
| 13343 |
+
onClick: action
|
| 13344 |
+
}, actionText)));
|
| 13345 |
}
|
| 13346 |
+
//# sourceMappingURL=block-view.js.map
|
| 13347 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/index.js
|
| 13348 |
|
| 13349 |
|
| 13350 |
/**
|
| 13351 |
+
* External dependencies
|
| 13352 |
*/
|
| 13353 |
|
| 13354 |
+
// diff doesn't tree-shake correctly, so we import from the individual
|
| 13355 |
+
// module here, to avoid including too much of the library
|
| 13356 |
+
|
| 13357 |
|
| 13358 |
/**
|
| 13359 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13360 |
*/
|
| 13361 |
|
|
|
|
|
|
|
| 13362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13363 |
|
| 13364 |
+
/**
|
| 13365 |
+
* Internal dependencies
|
| 13366 |
+
*/
|
| 13367 |
+
|
| 13368 |
+
|
| 13369 |
+
|
| 13370 |
+
function BlockCompare({
|
| 13371 |
+
block,
|
| 13372 |
+
onKeep,
|
| 13373 |
+
onConvert,
|
| 13374 |
+
convertor,
|
| 13375 |
+
convertButtonText
|
| 13376 |
+
}) {
|
| 13377 |
+
function getDifference(originalContent, newContent) {
|
| 13378 |
+
const difference = Object(character["diffChars"])(originalContent, newContent);
|
| 13379 |
+
return difference.map((item, pos) => {
|
| 13380 |
+
const classes = classnames_default()({
|
| 13381 |
+
'block-editor-block-compare__added': item.added,
|
| 13382 |
+
'block-editor-block-compare__removed': item.removed
|
| 13383 |
+
});
|
| 13384 |
+
return Object(external_wp_element_["createElement"])("span", {
|
| 13385 |
+
key: pos,
|
| 13386 |
+
className: classes
|
| 13387 |
+
}, item.value);
|
| 13388 |
});
|
| 13389 |
+
}
|
| 13390 |
|
| 13391 |
+
function getConvertedContent(convertedBlock) {
|
| 13392 |
+
// The convertor may return an array of items or a single item
|
| 13393 |
+
const newBlocks = Object(external_lodash_["castArray"])(convertedBlock); // Get converted block details
|
| 13394 |
+
|
| 13395 |
+
const newContent = newBlocks.map(item => Object(external_wp_blocks_["getSaveContent"])(item.name, item.attributes, item.innerBlocks));
|
| 13396 |
+
return newContent.join('');
|
| 13397 |
+
}
|
| 13398 |
+
|
| 13399 |
+
const converted = getConvertedContent(convertor(block));
|
| 13400 |
+
const difference = getDifference(block.originalContent, converted);
|
| 13401 |
+
return Object(external_wp_element_["createElement"])("div", {
|
| 13402 |
+
className: "block-editor-block-compare__wrapper"
|
| 13403 |
+
}, Object(external_wp_element_["createElement"])(BlockView, {
|
| 13404 |
+
title: Object(external_wp_i18n_["__"])('Current'),
|
| 13405 |
+
className: "block-editor-block-compare__current",
|
| 13406 |
+
action: onKeep,
|
| 13407 |
+
actionText: Object(external_wp_i18n_["__"])('Convert to HTML'),
|
| 13408 |
+
rawContent: block.originalContent,
|
| 13409 |
+
renderedContent: block.originalContent
|
| 13410 |
+
}), Object(external_wp_element_["createElement"])(BlockView, {
|
| 13411 |
+
title: Object(external_wp_i18n_["__"])('After Conversion'),
|
| 13412 |
+
className: "block-editor-block-compare__converted",
|
| 13413 |
+
action: onConvert,
|
| 13414 |
+
actionText: convertButtonText,
|
| 13415 |
+
rawContent: difference,
|
| 13416 |
+
renderedContent: converted
|
| 13417 |
+
}));
|
| 13418 |
+
}
|
| 13419 |
+
|
| 13420 |
+
/* harmony default export */ var block_compare = (BlockCompare);
|
| 13421 |
+
//# sourceMappingURL=index.js.map
|
| 13422 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/index.js + 5 modules
|
| 13423 |
+
var store = __webpack_require__(13);
|
| 13424 |
+
|
| 13425 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-invalid-warning.js
|
| 13426 |
|
| 13427 |
|
| 13428 |
/**
|
| 13431 |
|
| 13432 |
|
| 13433 |
|
| 13434 |
+
|
| 13435 |
+
|
| 13436 |
+
|
| 13437 |
/**
|
| 13438 |
* Internal dependencies
|
| 13439 |
*/
|
| 13440 |
|
| 13441 |
|
| 13442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13443 |
|
| 13444 |
+
function BlockInvalidWarning({
|
| 13445 |
+
convertToHTML,
|
| 13446 |
+
convertToBlocks,
|
| 13447 |
+
convertToClassic,
|
| 13448 |
+
attemptBlockRecovery,
|
| 13449 |
+
block
|
| 13450 |
+
}) {
|
| 13451 |
+
const hasHTMLBlock = !!Object(external_wp_blocks_["getBlockType"])('core/html');
|
| 13452 |
+
const [compare, setCompare] = Object(external_wp_element_["useState"])(false);
|
| 13453 |
+
const onCompare = Object(external_wp_element_["useCallback"])(() => setCompare(true), []);
|
| 13454 |
+
const onCompareClose = Object(external_wp_element_["useCallback"])(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly
|
| 13455 |
+
|
| 13456 |
+
const hiddenActions = Object(external_wp_element_["useMemo"])(() => [{
|
| 13457 |
+
// translators: Button to fix block content
|
| 13458 |
+
title: Object(external_wp_i18n_["_x"])('Resolve', 'imperative verb'),
|
| 13459 |
+
onClick: onCompare
|
| 13460 |
+
}, hasHTMLBlock && {
|
| 13461 |
+
title: Object(external_wp_i18n_["__"])('Convert to HTML'),
|
| 13462 |
+
onClick: convertToHTML
|
| 13463 |
+
}, {
|
| 13464 |
+
title: Object(external_wp_i18n_["__"])('Convert to Classic Block'),
|
| 13465 |
+
onClick: convertToClassic
|
| 13466 |
+
}].filter(Boolean), [onCompare, convertToHTML, convertToClassic]);
|
| 13467 |
+
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(warning["a" /* default */], {
|
| 13468 |
+
actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
| 13469 |
+
key: "recover",
|
| 13470 |
+
onClick: attemptBlockRecovery,
|
| 13471 |
+
variant: "primary"
|
| 13472 |
+
}, Object(external_wp_i18n_["__"])('Attempt Block Recovery'))],
|
| 13473 |
+
secondaryActions: hiddenActions
|
| 13474 |
+
}, Object(external_wp_i18n_["__"])('This block contains unexpected or invalid content.')), compare && Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
|
| 13475 |
+
title: // translators: Dialog title to fix block content
|
| 13476 |
+
Object(external_wp_i18n_["__"])('Resolve Block'),
|
| 13477 |
+
onRequestClose: onCompareClose,
|
| 13478 |
+
className: "block-editor-block-compare"
|
| 13479 |
+
}, Object(external_wp_element_["createElement"])(block_compare, {
|
| 13480 |
+
block: block,
|
| 13481 |
+
onKeep: convertToHTML,
|
| 13482 |
+
onConvert: convertToBlocks,
|
| 13483 |
+
convertor: blockToBlocks,
|
| 13484 |
+
convertButtonText: Object(external_wp_i18n_["__"])('Convert to Blocks')
|
| 13485 |
+
})));
|
| 13486 |
+
}
|
| 13487 |
+
|
| 13488 |
+
const blockToClassic = block => Object(external_wp_blocks_["createBlock"])('core/freeform', {
|
| 13489 |
+
content: block.originalContent
|
| 13490 |
+
});
|
| 13491 |
+
|
| 13492 |
+
const blockToHTML = block => Object(external_wp_blocks_["createBlock"])('core/html', {
|
| 13493 |
+
content: block.originalContent
|
| 13494 |
+
});
|
| 13495 |
+
|
| 13496 |
+
const blockToBlocks = block => Object(external_wp_blocks_["rawHandler"])({
|
| 13497 |
+
HTML: block.originalContent
|
| 13498 |
+
});
|
| 13499 |
+
|
| 13500 |
+
const recoverBlock = ({
|
| 13501 |
+
name,
|
| 13502 |
+
attributes,
|
| 13503 |
+
innerBlocks
|
| 13504 |
+
}) => Object(external_wp_blocks_["createBlock"])(name, attributes, innerBlocks);
|
| 13505 |
|
| 13506 |
+
/* harmony default export */ var block_invalid_warning = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
|
| 13507 |
+
clientId
|
| 13508 |
+
}) => ({
|
| 13509 |
+
block: select(store["a" /* store */]).getBlock(clientId)
|
| 13510 |
+
})), Object(external_wp_data_["withDispatch"])((dispatch, {
|
| 13511 |
+
block
|
| 13512 |
+
}) => {
|
| 13513 |
const {
|
| 13514 |
+
replaceBlock
|
| 13515 |
+
} = dispatch(store["a" /* store */]);
|
| 13516 |
+
return {
|
| 13517 |
+
convertToClassic() {
|
| 13518 |
+
replaceBlock(block.clientId, blockToClassic(block));
|
| 13519 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13520 |
|
| 13521 |
+
convertToHTML() {
|
| 13522 |
+
replaceBlock(block.clientId, blockToHTML(block));
|
| 13523 |
+
},
|
| 13524 |
|
| 13525 |
+
convertToBlocks() {
|
| 13526 |
+
replaceBlock(block.clientId, blockToBlocks(block));
|
| 13527 |
+
},
|
|
|
|
|
|
|
|
|
|
| 13528 |
|
| 13529 |
+
attemptBlockRecovery() {
|
| 13530 |
+
replaceBlock(block.clientId, recoverBlock(block));
|
| 13531 |
}
|
| 13532 |
|
|
|
|
|
|
|
|
|
|
| 13533 |
};
|
| 13534 |
+
})])(BlockInvalidWarning));
|
| 13535 |
+
//# sourceMappingURL=block-invalid-warning.js.map
|
| 13536 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-warning.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13537 |
|
| 13538 |
|
| 13539 |
/**
|
| 13540 |
* WordPress dependencies
|
| 13541 |
*/
|
| 13542 |
|
|
|
|
|
|
|
|
|
|
| 13543 |
/**
|
| 13544 |
* Internal dependencies
|
| 13545 |
*/
|
| 13546 |
|
| 13547 |
|
| 13548 |
+
const block_crash_warning_warning = Object(external_wp_element_["createElement"])(warning["a" /* default */], {
|
| 13549 |
+
className: "block-editor-block-list__block-crash-warning"
|
| 13550 |
+
}, Object(external_wp_i18n_["__"])('This block has encountered an error and cannot be previewed.'));
|
| 13551 |
+
/* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning);
|
| 13552 |
+
//# sourceMappingURL=block-crash-warning.js.map
|
| 13553 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-boundary.js
|
| 13554 |
+
/**
|
| 13555 |
+
* WordPress dependencies
|
| 13556 |
+
*/
|
| 13557 |
|
| 13558 |
|
| 13559 |
+
class block_crash_boundary_BlockCrashBoundary extends external_wp_element_["Component"] {
|
| 13560 |
+
constructor() {
|
| 13561 |
+
super(...arguments);
|
| 13562 |
+
this.state = {
|
| 13563 |
+
hasError: false
|
| 13564 |
+
};
|
| 13565 |
+
}
|
| 13566 |
|
| 13567 |
+
componentDidCatch() {
|
| 13568 |
+
this.setState({
|
| 13569 |
+
hasError: true
|
| 13570 |
+
});
|
| 13571 |
+
}
|
| 13572 |
|
| 13573 |
+
render() {
|
| 13574 |
+
if (this.state.hasError) {
|
| 13575 |
+
return this.props.fallback;
|
| 13576 |
+
}
|
| 13577 |
|
| 13578 |
+
return this.props.children;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13579 |
}
|
| 13580 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13581 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13582 |
|
| 13583 |
+
/* harmony default export */ var block_crash_boundary = (block_crash_boundary_BlockCrashBoundary);
|
| 13584 |
+
//# sourceMappingURL=block-crash-boundary.js.map
|
| 13585 |
+
// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
|
| 13586 |
+
var lib = __webpack_require__(113);
|
| 13587 |
+
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13588 |
|
| 13589 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-html.js
|
| 13590 |
|
| 13591 |
|
| 13592 |
/**
|
| 13593 |
* External dependencies
|
| 13594 |
*/
|
| 13595 |
|
|
|
|
| 13596 |
/**
|
| 13597 |
* WordPress dependencies
|
| 13598 |
*/
|
| 13599 |
|
| 13600 |
|
| 13601 |
|
| 13602 |
+
|
| 13603 |
/**
|
| 13604 |
* Internal dependencies
|
| 13605 |
*/
|
| 13606 |
|
| 13607 |
|
| 13608 |
|
| 13609 |
+
function BlockHTML({
|
| 13610 |
+
clientId
|
| 13611 |
+
}) {
|
| 13612 |
+
const [html, setHtml] = Object(external_wp_element_["useState"])('');
|
| 13613 |
+
const block = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).getBlock(clientId), [clientId]);
|
| 13614 |
+
const {
|
| 13615 |
+
updateBlock
|
| 13616 |
+
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
|
| 13617 |
|
| 13618 |
+
const onChange = () => {
|
| 13619 |
+
const blockType = Object(external_wp_blocks_["getBlockType"])(block.name);
|
| 13620 |
+
const attributes = Object(external_wp_blocks_["getBlockAttributes"])(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13621 |
|
| 13622 |
+
const content = html ? html : Object(external_wp_blocks_["getSaveContent"])(blockType, attributes);
|
| 13623 |
+
const isValid = html ? Object(external_wp_blocks_["isValidBlockContent"])(blockType, attributes, content) : true;
|
| 13624 |
+
updateBlock(clientId, {
|
| 13625 |
+
attributes,
|
| 13626 |
+
originalContent: content,
|
| 13627 |
+
isValid
|
| 13628 |
+
}); // Ensure the state is updated if we reset so it displays the default content
|
| 13629 |
|
| 13630 |
+
if (!html) {
|
| 13631 |
+
setHtml({
|
| 13632 |
+
content
|
| 13633 |
+
});
|
| 13634 |
}
|
| 13635 |
+
};
|
| 13636 |
|
| 13637 |
+
Object(external_wp_element_["useEffect"])(() => {
|
| 13638 |
+
setHtml(Object(external_wp_blocks_["getBlockContent"])(block));
|
| 13639 |
+
}, [block]);
|
| 13640 |
+
return Object(external_wp_element_["createElement"])(lib_default.a, {
|
| 13641 |
+
className: "block-editor-block-list__block-html-textarea",
|
| 13642 |
+
value: html,
|
| 13643 |
+
onBlur: onChange,
|
| 13644 |
+
onChange: event => setHtml(event.target.value)
|
| 13645 |
});
|
| 13646 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13647 |
|
| 13648 |
+
/* harmony default export */ var block_html = (BlockHTML);
|
| 13649 |
+
//# sourceMappingURL=block-html.js.map
|
| 13650 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/index.js
|
| 13651 |
+
var use_block_props = __webpack_require__(201);
|
| 13652 |
|
| 13653 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block.js
|
|
|
|
|
|
|
| 13654 |
|
| 13655 |
|
| 13656 |
/**
|
| 13657 |
* External dependencies
|
| 13658 |
*/
|
| 13659 |
|
| 13660 |
+
|
| 13661 |
/**
|
| 13662 |
* WordPress dependencies
|
| 13663 |
*/
|
| 13667 |
|
| 13668 |
|
| 13669 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13670 |
|
| 13671 |
/**
|
| 13672 |
* Internal dependencies
|
| 13673 |
*/
|
| 13674 |
|
| 13675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13677 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13678 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13680 |
|
|
|
|
|
|
|
| 13681 |
|
| 13682 |
+
const BlockListBlockContext = Object(external_wp_element_["createContext"])();
|
|
|
|
| 13683 |
/**
|
| 13684 |
+
* Merges wrapper props with special handling for classNames and styles.
|
|
|
|
| 13685 |
*
|
| 13686 |
+
* @param {Object} propsA
|
| 13687 |
+
* @param {Object} propsB
|
| 13688 |
*
|
| 13689 |
+
* @return {Object} Merged props.
|
| 13690 |
*/
|
| 13691 |
|
| 13692 |
+
function mergeWrapperProps(propsA, propsB) {
|
| 13693 |
+
const newProps = { ...propsA,
|
| 13694 |
+
...propsB
|
| 13695 |
+
};
|
| 13696 |
|
| 13697 |
+
if (propsA && propsB && propsA.className && propsB.className) {
|
| 13698 |
+
newProps.className = classnames_default()(propsA.className, propsB.className);
|
| 13699 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13700 |
|
| 13701 |
+
if (propsA && propsB && propsA.style && propsB.style) {
|
| 13702 |
+
newProps.style = { ...propsA.style,
|
| 13703 |
+
...propsB.style
|
| 13704 |
};
|
| 13705 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13706 |
|
| 13707 |
+
return newProps;
|
| 13708 |
+
}
|
| 13709 |
|
| 13710 |
+
function Block({
|
| 13711 |
+
children,
|
| 13712 |
+
isHtml,
|
| 13713 |
+
...props
|
| 13714 |
+
}) {
|
| 13715 |
+
return Object(external_wp_element_["createElement"])("div", Object(use_block_props["a" /* useBlockProps */])(props, {
|
| 13716 |
+
__unstableIsHtml: isHtml
|
| 13717 |
+
}), children);
|
| 13718 |
}
|
| 13719 |
|
| 13720 |
+
function BlockListBlock({
|
| 13721 |
+
mode,
|
| 13722 |
+
isLocked,
|
| 13723 |
clientId,
|
| 13724 |
+
isSelected,
|
| 13725 |
+
isSelectionEnabled,
|
| 13726 |
+
className,
|
| 13727 |
+
name,
|
| 13728 |
+
isValid,
|
| 13729 |
+
attributes,
|
| 13730 |
+
wrapperProps,
|
| 13731 |
+
setAttributes,
|
| 13732 |
+
onReplace,
|
| 13733 |
+
onInsertBlocksAfter,
|
| 13734 |
+
onMerge,
|
| 13735 |
+
toggleSelection
|
| 13736 |
}) {
|
| 13737 |
+
const {
|
| 13738 |
+
removeBlock
|
| 13739 |
+
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
|
| 13740 |
+
const onRemove = Object(external_wp_element_["useCallback"])(() => removeBlock(clientId), [clientId]); // We wrap the BlockEdit component in a div that hides it when editing in
|
| 13741 |
+
// HTML mode. This allows us to render all of the ancillary pieces
|
| 13742 |
+
// (InspectorControls, etc.) which are inside `BlockEdit` but not
|
| 13743 |
+
// `BlockHTML`, even in HTML mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13744 |
|
| 13745 |
+
let blockEdit = Object(external_wp_element_["createElement"])(block_edit["a" /* default */], {
|
| 13746 |
+
name: name,
|
| 13747 |
+
isSelected: isSelected,
|
| 13748 |
+
attributes: attributes,
|
| 13749 |
+
setAttributes: setAttributes,
|
| 13750 |
+
insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter,
|
| 13751 |
+
onReplace: isLocked ? undefined : onReplace,
|
| 13752 |
+
onRemove: isLocked ? undefined : onRemove,
|
| 13753 |
+
mergeBlocks: isLocked ? undefined : onMerge,
|
| 13754 |
+
clientId: clientId,
|
| 13755 |
+
isSelectionEnabled: isSelectionEnabled,
|
| 13756 |
+
toggleSelection: toggleSelection
|
| 13757 |
});
|
| 13758 |
+
const blockType = Object(external_wp_blocks_["getBlockType"])(name);
|
| 13759 |
+
const lightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); // Determine whether the block has props to apply to the wrapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13760 |
|
| 13761 |
+
if (blockType.getEditWrapperProps) {
|
| 13762 |
+
wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes));
|
| 13763 |
+
}
|
| 13764 |
|
| 13765 |
+
const isAligned = wrapperProps && !!wrapperProps['data-align']; // For aligned blocks, provide a wrapper element so the block can be
|
| 13766 |
+
// positioned relative to the block column.
|
| 13767 |
|
| 13768 |
+
if (isAligned) {
|
| 13769 |
+
blockEdit = Object(external_wp_element_["createElement"])("div", {
|
| 13770 |
+
className: "wp-block",
|
| 13771 |
+
"data-align": wrapperProps['data-align']
|
| 13772 |
+
}, blockEdit);
|
| 13773 |
+
}
|
| 13774 |
|
| 13775 |
+
let block;
|
| 13776 |
|
| 13777 |
+
if (!isValid) {
|
| 13778 |
+
const saveContent = Object(external_wp_blocks_["getSaveContent"])(blockType, attributes);
|
| 13779 |
+
block = Object(external_wp_element_["createElement"])(Block, {
|
| 13780 |
+
className: "has-warning"
|
| 13781 |
+
}, Object(external_wp_element_["createElement"])(block_invalid_warning, {
|
| 13782 |
+
clientId: clientId
|
| 13783 |
+
}), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(saveContent)));
|
| 13784 |
+
} else if (mode === 'html') {
|
| 13785 |
+
// Render blockEdit so the inspector controls don't disappear.
|
| 13786 |
+
// See #8969.
|
| 13787 |
+
block = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
|
| 13788 |
+
style: {
|
| 13789 |
+
display: 'none'
|
| 13790 |
+
}
|
| 13791 |
+
}, blockEdit), Object(external_wp_element_["createElement"])(Block, {
|
| 13792 |
+
isHtml: true
|
| 13793 |
+
}, Object(external_wp_element_["createElement"])(block_html, {
|
| 13794 |
+
clientId: clientId
|
| 13795 |
+
})));
|
| 13796 |
+
} else if (lightBlockWrapper) {
|
| 13797 |
+
block = blockEdit;
|
| 13798 |
+
} else {
|
| 13799 |
+
block = Object(external_wp_element_["createElement"])(Block, wrapperProps, blockEdit);
|
| 13800 |
+
}
|
| 13801 |
|
| 13802 |
+
const value = {
|
| 13803 |
+
clientId,
|
| 13804 |
+
className,
|
| 13805 |
+
wrapperProps: Object(external_lodash_["omit"])(wrapperProps, ['data-align']),
|
| 13806 |
+
isAligned
|
| 13807 |
+
};
|
| 13808 |
+
const memoizedValue = Object(external_wp_element_["useMemo"])(() => value, Object.values(value));
|
| 13809 |
+
return Object(external_wp_element_["createElement"])(BlockListBlockContext.Provider, {
|
| 13810 |
+
value: memoizedValue
|
| 13811 |
+
}, Object(external_wp_element_["createElement"])(block_crash_boundary, {
|
| 13812 |
+
fallback: Object(external_wp_element_["createElement"])(Block, {
|
| 13813 |
+
className: "has-warning"
|
| 13814 |
+
}, Object(external_wp_element_["createElement"])(block_crash_warning, null))
|
| 13815 |
+
}, block));
|
| 13816 |
+
}
|
| 13817 |
|
| 13818 |
+
const applyWithSelect = Object(external_wp_data_["withSelect"])((select, {
|
| 13819 |
+
clientId,
|
| 13820 |
+
rootClientId
|
| 13821 |
+
}) => {
|
| 13822 |
+
const {
|
| 13823 |
+
isBlockSelected,
|
| 13824 |
+
getBlockMode,
|
| 13825 |
+
isSelectionEnabled,
|
| 13826 |
+
getTemplateLock,
|
| 13827 |
+
__unstableGetBlockWithoutInnerBlocks
|
| 13828 |
+
} = select(store["a" /* store */]);
|
| 13829 |
|
| 13830 |
+
const block = __unstableGetBlockWithoutInnerBlocks(clientId);
|
| 13831 |
|
| 13832 |
+
const isSelected = isBlockSelected(clientId);
|
| 13833 |
+
const templateLock = getTemplateLock(rootClientId); // The fallback to `{}` is a temporary fix.
|
| 13834 |
+
// This function should never be called when a block is not present in
|
| 13835 |
+
// the state. It happens now because the order in withSelect rendering
|
| 13836 |
+
// is not correct.
|
| 13837 |
|
| 13838 |
+
const {
|
| 13839 |
+
name,
|
| 13840 |
+
attributes,
|
| 13841 |
+
isValid
|
| 13842 |
+
} = block || {}; // Do not add new properties here, use `useSelect` instead to avoid
|
| 13843 |
+
// leaking new props to the public API (editor.BlockListBlock filter).
|
| 13844 |
|
| 13845 |
+
return {
|
| 13846 |
+
mode: getBlockMode(clientId),
|
| 13847 |
+
isSelectionEnabled: isSelectionEnabled(),
|
| 13848 |
+
isLocked: !!templateLock,
|
| 13849 |
+
// Users of the editor.BlockListBlock filter used to be able to
|
| 13850 |
+
// access the block prop.
|
| 13851 |
+
// Ideally these blocks would rely on the clientId prop only.
|
| 13852 |
+
// This is kept for backward compatibility reasons.
|
| 13853 |
+
block,
|
| 13854 |
+
name,
|
| 13855 |
+
attributes,
|
| 13856 |
+
isValid,
|
| 13857 |
+
isSelected
|
| 13858 |
+
};
|
| 13859 |
+
});
|
| 13860 |
+
const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, ownProps, {
|
| 13861 |
+
select
|
| 13862 |
+
}) => {
|
| 13863 |
+
const {
|
| 13864 |
+
updateBlockAttributes,
|
| 13865 |
+
insertBlocks,
|
| 13866 |
+
mergeBlocks,
|
| 13867 |
+
replaceBlocks,
|
| 13868 |
+
toggleSelection,
|
| 13869 |
+
__unstableMarkLastChangeAsPersistent
|
| 13870 |
+
} = dispatch(store["a" /* store */]); // Do not add new properties here, use `useDispatch` instead to avoid
|
| 13871 |
+
// leaking new props to the public API (editor.BlockListBlock filter).
|
| 13872 |
|
| 13873 |
+
return {
|
| 13874 |
+
setAttributes(newAttributes) {
|
| 13875 |
+
const {
|
| 13876 |
+
getMultiSelectedBlockClientIds
|
| 13877 |
+
} = select(store["a" /* store */]);
|
| 13878 |
+
const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds();
|
| 13879 |
+
const {
|
| 13880 |
+
clientId
|
| 13881 |
+
} = ownProps;
|
| 13882 |
+
const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId];
|
| 13883 |
+
updateBlockAttributes(clientIds, newAttributes);
|
| 13884 |
+
},
|
| 13885 |
|
| 13886 |
+
onInsertBlocks(blocks, index) {
|
| 13887 |
+
const {
|
| 13888 |
+
rootClientId
|
| 13889 |
+
} = ownProps;
|
| 13890 |
+
insertBlocks(blocks, index, rootClientId);
|
| 13891 |
+
},
|
| 13892 |
|
| 13893 |
+
onInsertBlocksAfter(blocks) {
|
| 13894 |
+
const {
|
| 13895 |
+
clientId,
|
| 13896 |
+
rootClientId
|
| 13897 |
+
} = ownProps;
|
| 13898 |
+
const {
|
| 13899 |
+
getBlockIndex
|
| 13900 |
+
} = select(store["a" /* store */]);
|
| 13901 |
+
const index = getBlockIndex(clientId, rootClientId);
|
| 13902 |
+
insertBlocks(blocks, index + 1, rootClientId);
|
| 13903 |
+
},
|
| 13904 |
|
| 13905 |
+
onMerge(forward) {
|
| 13906 |
+
const {
|
| 13907 |
+
clientId
|
| 13908 |
+
} = ownProps;
|
| 13909 |
+
const {
|
| 13910 |
+
getPreviousBlockClientId,
|
| 13911 |
+
getNextBlockClientId
|
| 13912 |
+
} = select(store["a" /* store */]);
|
| 13913 |
|
| 13914 |
+
if (forward) {
|
| 13915 |
+
const nextBlockClientId = getNextBlockClientId(clientId);
|
| 13916 |
|
| 13917 |
+
if (nextBlockClientId) {
|
| 13918 |
+
mergeBlocks(clientId, nextBlockClientId);
|
| 13919 |
+
}
|
| 13920 |
+
} else {
|
| 13921 |
+
const previousBlockClientId = getPreviousBlockClientId(clientId);
|
| 13922 |
|
| 13923 |
+
if (previousBlockClientId) {
|
| 13924 |
+
mergeBlocks(previousBlockClientId, clientId);
|
| 13925 |
+
}
|
| 13926 |
+
}
|
| 13927 |
+
},
|
| 13928 |
|
| 13929 |
+
onReplace(blocks, indexToSelect, initialPosition) {
|
| 13930 |
+
if (blocks.length && !Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[blocks.length - 1])) {
|
| 13931 |
+
__unstableMarkLastChangeAsPersistent();
|
| 13932 |
+
}
|
| 13933 |
|
| 13934 |
+
replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition);
|
| 13935 |
+
},
|
|
|
|
| 13936 |
|
| 13937 |
+
toggleSelection(selectionEnabled) {
|
| 13938 |
+
toggleSelection(selectionEnabled);
|
| 13939 |
+
}
|
|
|
|
| 13940 |
|
| 13941 |
+
};
|
| 13942 |
+
});
|
| 13943 |
+
/* harmony default export */ var block_list_block = __webpack_exports__["b"] = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], applyWithSelect, applyWithDispatch, // block is sometimes not mounted at the right time, causing it be undefined
|
| 13944 |
+
// see issue for more info
|
| 13945 |
+
// https://github.com/WordPress/gutenberg/issues/17013
|
| 13946 |
+
Object(external_wp_compose_["ifCondition"])(({
|
| 13947 |
+
block
|
| 13948 |
+
}) => !!block), Object(external_wp_components_["withFilters"])('editor.BlockListBlock'))(BlockListBlock));
|
| 13949 |
+
//# sourceMappingURL=block.js.map
|
| 13950 |
|
| 13951 |
+
/***/ }),
|
| 13952 |
+
/* 164 */
|
| 13953 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
| 13954 |
|
| 13955 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13956 |
|
| 13957 |
+
// EXTERNAL MODULE: external ["wp","element"]
|
| 13958 |
+
var external_wp_element_ = __webpack_require__(0);
|
| 13959 |
|
| 13960 |
+
// EXTERNAL MODULE: external ["wp","blocks"]
|
| 13961 |
+
var external_wp_blocks_ = __webpack_require__(8);
|
|
|
|
|
|
|
| 13962 |
|
| 13963 |
+
// EXTERNAL MODULE: external ["wp","components"]
|
| 13964 |
+
var external_wp_components_ = __webpack_require__(3);
|
| 13965 |
|
| 13966 |
+
// EXTERNAL MODULE: external ["wp","data"]
|
| 13967 |
+
var external_wp_data_ = __webpack_require__(4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13968 |
|
| 13969 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/components/block-draggable/draggable-chip.js
|
| 13970 |
+
var draggable_chip = __webpack_require__(218);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13971 |
|
| 13972 |
+
// EXTERNAL MODULE: external ["wp","dom"]
|
| 13973 |
+
var external_wp_dom_ = __webpack_require__(22);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13974 |
|
| 13975 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js
|
|
|
|
| 13976 |
/**
|
| 13977 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13978 |
*/
|
| 13979 |
|
| 13980 |
|
| 13981 |
+
const SCROLL_INACTIVE_DISTANCE_PX = 50;
|
| 13982 |
+
const SCROLL_INTERVAL_MS = 25;
|
| 13983 |
+
const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000;
|
| 13984 |
+
const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13985 |
/**
|
| 13986 |
+
* React hook that scrolls the scroll container when a block is being dragged.
|
|
|
|
|
|
|
|
|
|
| 13987 |
*
|
| 13988 |
+
* @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling`
|
| 13989 |
+
* functions to be called in `onDragStart`, `onDragOver`
|
| 13990 |
+
* and `onDragEnd` events respectively.
|
| 13991 |
*/
|
| 13992 |
|
| 13993 |
+
function useScrollWhenDragging() {
|
| 13994 |
+
const dragStartY = Object(external_wp_element_["useRef"])(null);
|
| 13995 |
+
const velocityY = Object(external_wp_element_["useRef"])(null);
|
| 13996 |
+
const scrollParentY = Object(external_wp_element_["useRef"])(null);
|
| 13997 |
+
const scrollEditorInterval = Object(external_wp_element_["useRef"])(null); // Clear interval when unmounting.
|
| 13998 |
|
| 13999 |
+
Object(external_wp_element_["useEffect"])(() => () => {
|
| 14000 |
+
if (scrollEditorInterval.current) {
|
| 14001 |
+
clearInterval(scrollEditorInterval.current);
|
| 14002 |
+
scrollEditorInterval.current = null;
|
| 14003 |
+
}
|
| 14004 |
+
}, []);
|
| 14005 |
+
const startScrolling = Object(external_wp_element_["useCallback"])(event => {
|
| 14006 |
+
dragStartY.current = event.clientY; // Find nearest parent(s) to scroll.
|
| 14007 |
|
| 14008 |
+
scrollParentY.current = Object(external_wp_dom_["getScrollContainer"])(event.target);
|
| 14009 |
+
scrollEditorInterval.current = setInterval(() => {
|
| 14010 |
+
if (scrollParentY.current && velocityY.current) {
|
| 14011 |
+
const newTop = scrollParentY.current.scrollTop + velocityY.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance.
|
| 14012 |
+
// Better to use a small scroll interval.
|
| 14013 |
|
| 14014 |
+
scrollParentY.current.scroll({
|
| 14015 |
+
top: newTop
|
| 14016 |
+
});
|
| 14017 |
+
}
|
| 14018 |
+
}, SCROLL_INTERVAL_MS);
|
| 14019 |
+
}, []);
|
| 14020 |
+
const scrollOnDragOver = Object(external_wp_element_["useCallback"])(event => {
|
| 14021 |
+
if (!scrollParentY.current) {
|
| 14022 |
+
return;
|
| 14023 |
}
|
| 14024 |
|
| 14025 |
+
const scrollParentHeight = scrollParentY.current.offsetHeight;
|
| 14026 |
+
const offsetDragStartPosition = dragStartY.current - scrollParentY.current.offsetTop;
|
| 14027 |
+
const offsetDragPosition = event.clientY - scrollParentY.current.offsetTop;
|
| 14028 |
+
|
| 14029 |
+
if (event.clientY > offsetDragStartPosition) {
|
| 14030 |
+
// User is dragging downwards.
|
| 14031 |
+
const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
| 14032 |
+
const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
| 14033 |
+
const distancePercentage = dragDistance / moveableDistance;
|
| 14034 |
+
velocityY.current = VELOCITY_MULTIPLIER * distancePercentage;
|
| 14035 |
+
} else if (event.clientY < offsetDragStartPosition) {
|
| 14036 |
+
// User is dragging upwards.
|
| 14037 |
+
const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
| 14038 |
+
const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
| 14039 |
+
const distancePercentage = dragDistance / moveableDistance;
|
| 14040 |
+
velocityY.current = -VELOCITY_MULTIPLIER * distancePercentage;
|
| 14041 |
+
} else {
|
| 14042 |
+
velocityY.current = 0;
|
| 14043 |
+
}
|
| 14044 |
+
}, []);
|
| 14045 |
+
|
| 14046 |
+
const stopScrolling = () => {
|
| 14047 |
+
dragStartY.current = null;
|
| 14048 |
+
scrollParentY.current = null;
|
| 14049 |
+
|
| 14050 |
+
if (scrollEditorInterval.current) {
|
| 14051 |
+
clearInterval(scrollEditorInterval.current);
|
| 14052 |
+
scrollEditorInterval.current = null;
|
| 14053 |
+
}
|
| 14054 |
};
|
| 14055 |
|
| 14056 |
+
return [startScrolling, scrollOnDragOver, stopScrolling];
|
| 14057 |
}
|
| 14058 |
+
//# sourceMappingURL=use-scroll-when-dragging.js.map
|
| 14059 |
+
// EXTERNAL MODULE: ./packages/block-editor/build-module/store/index.js + 5 modules
|
| 14060 |
+
var store = __webpack_require__(13);
|
| 14061 |
|
| 14062 |
+
// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14063 |
|
|
|
|
|
|
|
| 14064 |
|
|
|
|
|
|
|
|
|
|
| 14065 |
/**
|
| 14066 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14067 |
*/
|
| 14068 |
|
| 14069 |
|
|
|
|
|
|
|
| 14070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14071 |
|
| 14072 |
+
/**
|
| 14073 |
+
* Internal dependencies
|
| 14074 |
+
*/
|
|
|
|
| 14075 |
|
|
|
|
|
|
|
|
|
|
| 14076 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14077 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14078 |
|
|
|
|
|
|
|
| 14079 |
|
| 14080 |
+
const BlockDraggable = ({
|
| 14081 |
+
children,
|
| 14082 |
+
clientIds,
|
| 14083 |
+
cloneClassname,
|
| 14084 |
+
onDragStart,
|
| 14085 |
+
onDragEnd
|
| 14086 |
+
}) => {
|
| 14087 |
+
const {
|
| 14088 |
+
srcRootClientId,
|
| 14089 |
+
isDraggable,
|
| 14090 |
+
icon
|
| 14091 |
+
} = Object(external_wp_data_["useSelect"])(select => {
|
| 14092 |
+
var _getBlockType;
|
| 14093 |
|
| 14094 |
+
const {
|
| 14095 |
+
getBlockRootClientId,
|
| 14096 |
+
getTemplateLock,
|
| 14097 |
+
getBlockName
|
| 14098 |
+
} = select(store["a" /* store */]);
|
| 14099 |
+
const rootClientId = getBlockRootClientId(clientIds[0]);
|
| 14100 |
+
const templateLock = rootClientId ? getTemplateLock(rootClientId) : null;
|
| 14101 |
+
const blockName = getBlockName(clientIds[0]);
|
| 14102 |
+
return {
|
| 14103 |
+
srcRootClientId: rootClientId,
|
| 14104 |
+
isDraggable: 'all' !== templateLock,
|
| 14105 |
+
icon: (_getBlockType = Object(external_wp_blocks_["getBlockType"])(blockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon
|
| 14106 |
};
|
| 14107 |
+
}, [clientIds]);
|
| 14108 |
+
const isDragging = Object(external_wp_element_["useRef"])(false);
|
| 14109 |
+
const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging();
|
| 14110 |
+
const {
|
| 14111 |
+
startDraggingBlocks,
|
| 14112 |
+
stopDraggingBlocks
|
| 14113 |
+
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); // Stop dragging blocks if the block dra
|
