| @@ -1,4910 +1,32 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ var __webpack_modules__ = ({ | |
| 3 | - | |
| 4 | -/***/ 4184: | |
| 5 | -/***/ (function(module, exports) { | |
| 6 | - | |
| 7 | -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | |
| 8 | - Copyright (c) 2018 Jed Watson. | |
| 9 | - Licensed under the MIT License (MIT), see | |
| 10 | - http://jedwatson.github.io/classnames | |
| 11 | -*/ | |
| 12 | -/* global define */ | |
| 13 | - | |
| 14 | -(function () { | |
| 15 | - 'use strict'; | |
| 16 | - | |
| 17 | - var hasOwn = {}.hasOwnProperty; | |
| 18 | - | |
| 19 | - function classNames() { | |
| 20 | - var classes = []; | |
| 21 | - | |
| 22 | - for (var i = 0; i < arguments.length; i++) { | |
| 23 | - var arg = arguments[i]; | |
| 24 | - if (!arg) continue; | |
| 25 | - | |
| 26 | - var argType = typeof arg; | |
| 27 | - | |
| 28 | - if (argType === 'string' || argType === 'number') { | |
| 29 | - classes.push(arg); | |
| 30 | - } else if (Array.isArray(arg)) { | |
| 31 | - if (arg.length) { | |
| 32 | - var inner = classNames.apply(null, arg); | |
| 33 | - if (inner) { | |
| 34 | - classes.push(inner); | |
| 35 | - } | |
| 36 | - } | |
| 37 | - } else if (argType === 'object') { | |
| 38 | - if (arg.toString === Object.prototype.toString) { | |
| 39 | - for (var key in arg) { | |
| 40 | - if (hasOwn.call(arg, key) && arg[key]) { | |
| 41 | - classes.push(key); | |
| 42 | - } | |
| 43 | - } | |
| 44 | - } else { | |
| 45 | - classes.push(arg.toString()); | |
| 46 | - } | |
| 47 | - } | |
| 48 | - } | |
| 49 | - | |
| 50 | - return classes.join(' '); | |
| 51 | - } | |
| 52 | - | |
| 53 | - if ( true && module.exports) { | |
| 54 | - classNames.default = classNames; | |
| 55 | - module.exports = classNames; | |
| 56 | - } else if (true) { | |
| 57 | - // register as 'classnames', consistent with npm package name | |
| 58 | - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { | |
| 59 | - return classNames; | |
| 60 | - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | |
| 61 | - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
| 62 | - } else {} | |
| 63 | -}()); | |
| 64 | - | |
| 65 | - | |
| 66 | -/***/ }) | |
| 67 | - | |
| 68 | -/******/ }); | |
| 69 | -/************************************************************************/ | |
| 70 | -/******/ // The module cache | |
| 71 | -/******/ var __webpack_module_cache__ = {}; | |
| 72 | -/******/ | |
| 73 | -/******/ // The require function | |
| 74 | -/******/ function __webpack_require__(moduleId) { | |
| 75 | -/******/ // Check if module is in cache | |
| 76 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 77 | -/******/ if (cachedModule !== undefined) { | |
| 78 | -/******/ return cachedModule.exports; | |
| 79 | -/******/ } | |
| 80 | -/******/ // Create a new module (and put it into the cache) | |
| 81 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 82 | -/******/ // no module.id needed | |
| 83 | -/******/ // no module.loaded needed | |
| 84 | -/******/ exports: {} | |
| 85 | -/******/ }; | |
| 86 | -/******/ | |
| 87 | -/******/ // Execute the module function | |
| 88 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 89 | -/******/ | |
| 90 | -/******/ // Return the exports of the module | |
| 91 | -/******/ return module.exports; | |
| 92 | -/******/ } | |
| 93 | -/******/ | |
| 94 | -/************************************************************************/ | |
| 95 | -/******/ /* webpack/runtime/compat get default export */ | |
| 96 | -/******/ !function() { | |
| 97 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 98 | -/******/ __webpack_require__.n = function(module) { | |
| 99 | -/******/ var getter = module && module.__esModule ? | |
| 100 | -/******/ function() { return module['default']; } : | |
| 101 | -/******/ function() { return module; }; | |
| 102 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 103 | -/******/ return getter; | |
| 104 | -/******/ }; | |
| 105 | -/******/ }(); | |
| 106 | -/******/ | |
| 107 | -/******/ /* webpack/runtime/define property getters */ | |
| 108 | -/******/ !function() { | |
| 109 | -/******/ // define getter functions for harmony exports | |
| 110 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 111 | -/******/ for(var key in definition) { | |
| 112 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 113 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 114 | -/******/ } | |
| 115 | -/******/ } | |
| 116 | -/******/ }; | |
| 117 | -/******/ }(); | |
| 118 | -/******/ | |
| 119 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 120 | -/******/ !function() { | |
| 121 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 122 | -/******/ }(); | |
| 123 | -/******/ | |
| 124 | -/******/ /* webpack/runtime/make namespace object */ | |
| 125 | -/******/ !function() { | |
| 126 | -/******/ // define __esModule on exports | |
| 127 | -/******/ __webpack_require__.r = function(exports) { | |
| 128 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 129 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 130 | -/******/ } | |
| 131 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 132 | -/******/ }; | |
| 133 | -/******/ }(); | |
| 134 | -/******/ | |
| 135 | -/************************************************************************/ | |
| 136 | -var __webpack_exports__ = {}; | |
| 137 | -// This entry need to be wrapped in an IIFE because it need to be in strict mode. | |
| 138 | -!function() { | |
| 139 | -"use strict"; | |
| 140 | -// ESM COMPAT FLAG | |
| 141 | -__webpack_require__.r(__webpack_exports__); | |
| 142 | - | |
| 143 | -// EXPORTS | |
| 144 | -__webpack_require__.d(__webpack_exports__, { | |
| 145 | - "initialize": function() { return /* binding */ initialize; }, | |
| 146 | - "reinitializeEditor": function() { return /* binding */ reinitializeEditor; } | |
| 147 | -}); | |
| 148 | - | |
| 149 | -// NAMESPACE OBJECT: ./packages/interface/build-module/store/actions.js | |
| 150 | -var actions_namespaceObject = {}; | |
| 151 | -__webpack_require__.r(actions_namespaceObject); | |
| 152 | -__webpack_require__.d(actions_namespaceObject, { | |
| 153 | - "disableComplementaryArea": function() { return disableComplementaryArea; }, | |
| 154 | - "enableComplementaryArea": function() { return enableComplementaryArea; }, | |
| 155 | - "pinItem": function() { return pinItem; }, | |
| 156 | - "setFeatureDefaults": function() { return setFeatureDefaults; }, | |
| 157 | - "setFeatureValue": function() { return setFeatureValue; }, | |
| 158 | - "toggleFeature": function() { return toggleFeature; }, | |
| 159 | - "unpinItem": function() { return unpinItem; } | |
| 160 | -}); | |
| 161 | - | |
| 162 | -// NAMESPACE OBJECT: ./packages/interface/build-module/store/selectors.js | |
| 163 | -var selectors_namespaceObject = {}; | |
| 164 | -__webpack_require__.r(selectors_namespaceObject); | |
| 165 | -__webpack_require__.d(selectors_namespaceObject, { | |
| 166 | - "getActiveComplementaryArea": function() { return getActiveComplementaryArea; }, | |
| 167 | - "isFeatureActive": function() { return isFeatureActive; }, | |
| 168 | - "isItemPinned": function() { return isItemPinned; } | |
| 169 | -}); | |
| 170 | - | |
| 171 | -// NAMESPACE OBJECT: ./packages/edit-widgets/build-module/store/actions.js | |
| 172 | -var store_actions_namespaceObject = {}; | |
| 173 | -__webpack_require__.r(store_actions_namespaceObject); | |
| 174 | -__webpack_require__.d(store_actions_namespaceObject, { | |
| 175 | - "closeGeneralSidebar": function() { return closeGeneralSidebar; }, | |
| 176 | - "moveBlockToWidgetArea": function() { return moveBlockToWidgetArea; }, | |
| 177 | - "persistStubPost": function() { return persistStubPost; }, | |
| 178 | - "saveEditedWidgetAreas": function() { return saveEditedWidgetAreas; }, | |
| 179 | - "saveWidgetArea": function() { return saveWidgetArea; }, | |
| 180 | - "saveWidgetAreas": function() { return saveWidgetAreas; }, | |
| 181 | - "setIsInserterOpened": function() { return setIsInserterOpened; }, | |
| 182 | - "setIsListViewOpened": function() { return setIsListViewOpened; }, | |
| 183 | - "setIsWidgetAreaOpen": function() { return setIsWidgetAreaOpen; }, | |
| 184 | - "setWidgetAreasOpenState": function() { return setWidgetAreasOpenState; }, | |
| 185 | - "setWidgetIdForClientId": function() { return setWidgetIdForClientId; } | |
| 186 | -}); | |
| 187 | - | |
| 188 | -// NAMESPACE OBJECT: ./packages/edit-widgets/build-module/store/resolvers.js | |
| 189 | -var resolvers_namespaceObject = {}; | |
| 190 | -__webpack_require__.r(resolvers_namespaceObject); | |
| 191 | -__webpack_require__.d(resolvers_namespaceObject, { | |
| 192 | - "getWidgetAreas": function() { return getWidgetAreas; }, | |
| 193 | - "getWidgets": function() { return getWidgets; } | |
| 194 | -}); | |
| 195 | - | |
| 196 | -// NAMESPACE OBJECT: ./packages/edit-widgets/build-module/store/selectors.js | |
| 197 | -var store_selectors_namespaceObject = {}; | |
| 198 | -__webpack_require__.r(store_selectors_namespaceObject); | |
| 199 | -__webpack_require__.d(store_selectors_namespaceObject, { | |
| 200 | - "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; }, | |
| 201 | - "canInsertBlockInWidgetArea": function() { return canInsertBlockInWidgetArea; }, | |
| 202 | - "getEditedWidgetAreas": function() { return getEditedWidgetAreas; }, | |
| 203 | - "getIsWidgetAreaOpen": function() { return getIsWidgetAreaOpen; }, | |
| 204 | - "getParentWidgetAreaBlock": function() { return getParentWidgetAreaBlock; }, | |
| 205 | - "getReferenceWidgetBlocks": function() { return getReferenceWidgetBlocks; }, | |
| 206 | - "getWidget": function() { return getWidget; }, | |
| 207 | - "getWidgetAreaForWidgetId": function() { return getWidgetAreaForWidgetId; }, | |
| 208 | - "getWidgetAreas": function() { return selectors_getWidgetAreas; }, | |
| 209 | - "getWidgets": function() { return selectors_getWidgets; }, | |
| 210 | - "isInserterOpened": function() { return isInserterOpened; }, | |
| 211 | - "isListViewOpened": function() { return isListViewOpened; }, | |
| 212 | - "isSavingWidgetAreas": function() { return isSavingWidgetAreas; } | |
| 213 | -}); | |
| 214 | - | |
| 215 | -// NAMESPACE OBJECT: ./packages/edit-widgets/build-module/blocks/widget-area/index.js | |
| 216 | -var widget_area_namespaceObject = {}; | |
| 217 | -__webpack_require__.r(widget_area_namespaceObject); | |
| 218 | -__webpack_require__.d(widget_area_namespaceObject, { | |
| 219 | - "metadata": function() { return metadata; }, | |
| 220 | - "name": function() { return widget_area_name; }, | |
| 221 | - "settings": function() { return settings; } | |
| 222 | -}); | |
| 223 | - | |
| 224 | -;// CONCATENATED MODULE: external ["wp","element"] | |
| 225 | -var external_wp_element_namespaceObject = window["wp"]["element"]; | |
| 226 | -;// CONCATENATED MODULE: external ["wp","blocks"] | |
| 227 | -var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; | |
| 228 | -;// CONCATENATED MODULE: external ["wp","data"] | |
| 229 | -var external_wp_data_namespaceObject = window["wp"]["data"]; | |
| 230 | -;// CONCATENATED MODULE: external ["wp","blockLibrary"] | |
| 231 | -var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; | |
| 232 | -;// CONCATENATED MODULE: external ["wp","coreData"] | |
| 233 | -var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; | |
| 234 | -;// CONCATENATED MODULE: external ["wp","widgets"] | |
| 235 | -var external_wp_widgets_namespaceObject = window["wp"]["widgets"]; | |
| 236 | -;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js | |
| 237 | -function _extends() { | |
| 238 | - _extends = Object.assign || function (target) { | |
| 239 | - for (var i = 1; i < arguments.length; i++) { | |
| 240 | - var source = arguments[i]; | |
| 241 | - | |
| 242 | - for (var key in source) { | |
| 243 | - if (Object.prototype.hasOwnProperty.call(source, key)) { | |
| 244 | - target[key] = source[key]; | |
| 245 | - } | |
| 246 | - } | |
| 247 | - } | |
| 248 | - | |
| 249 | - return target; | |
| 250 | - }; | |
| 251 | - | |
| 252 | - return _extends.apply(this, arguments); | |
| 253 | -} | |
| 254 | -// EXTERNAL MODULE: ./node_modules/classnames/index.js | |
| 255 | -var classnames = __webpack_require__(4184); | |
| 256 | -var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); | |
| 257 | -;// CONCATENATED MODULE: external ["wp","components"] | |
| 258 | -var external_wp_components_namespaceObject = window["wp"]["components"]; | |
| 259 | -;// CONCATENATED MODULE: external ["wp","i18n"] | |
| 260 | -var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; | |
| 261 | -;// CONCATENATED MODULE: external ["wp","primitives"] | |
| 262 | -var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; | |
| 263 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js | |
| 264 | - | |
| 265 | - | |
| 266 | -/** | |
| 267 | - * WordPress dependencies | |
| 268 | - */ | |
| 269 | - | |
| 270 | -const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 271 | - xmlns: "http://www.w3.org/2000/svg", | |
| 272 | - viewBox: "0 0 24 24" | |
| 273 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 274 | - d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" | |
| 275 | -})); | |
| 276 | -/* harmony default export */ var library_check = (check); | |
| 277 | -//# sourceMappingURL=check.js.map | |
| 278 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-filled.js | |
| 279 | - | |
| 280 | - | |
| 281 | -/** | |
| 282 | - * WordPress dependencies | |
| 283 | - */ | |
| 284 | - | |
| 285 | -const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 286 | - xmlns: "http://www.w3.org/2000/svg", | |
| 287 | - viewBox: "0 0 24 24" | |
| 288 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 289 | - 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" | |
| 290 | -})); | |
| 291 | -/* harmony default export */ var star_filled = (starFilled); | |
| 292 | -//# sourceMappingURL=star-filled.js.map | |
| 293 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-empty.js | |
| 294 | - | |
| 295 | - | |
| 296 | -/** | |
| 297 | - * WordPress dependencies | |
| 298 | - */ | |
| 299 | - | |
| 300 | -const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 301 | - xmlns: "http://www.w3.org/2000/svg", | |
| 302 | - viewBox: "0 0 24 24" | |
| 303 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 304 | - fillRule: "evenodd", | |
| 305 | - 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", | |
| 306 | - clipRule: "evenodd" | |
| 307 | -})); | |
| 308 | -/* harmony default export */ var star_empty = (starEmpty); | |
| 309 | -//# sourceMappingURL=star-empty.js.map | |
| 310 | -;// CONCATENATED MODULE: external ["wp","viewport"] | |
| 311 | -var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; | |
| 312 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js | |
| 313 | - | |
| 314 | - | |
| 315 | -/** | |
| 316 | - * WordPress dependencies | |
| 317 | - */ | |
| 318 | - | |
| 319 | -const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 320 | - xmlns: "http://www.w3.org/2000/svg", | |
| 321 | - viewBox: "0 0 24 24" | |
| 322 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 323 | - d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" | |
| 324 | -})); | |
| 325 | -/* harmony default export */ var close_small = (closeSmall); | |
| 326 | -//# sourceMappingURL=close-small.js.map | |
| 327 | -;// CONCATENATED MODULE: external "lodash" | |
| 328 | -var external_lodash_namespaceObject = window["lodash"]; | |
| 329 | -;// CONCATENATED MODULE: ./packages/interface/build-module/store/reducer.js | |
| 330 | -/** | |
| 331 | - * External dependencies | |
| 332 | - */ | |
| 333 | - | |
| 334 | -/** | |
| 335 | - * WordPress dependencies | |
| 336 | - */ | |
| 337 | - | |
| 338 | - | |
| 339 | -/** | |
| 340 | - * Reducer to keep tract of the active area per scope. | |
| 341 | - * | |
| 342 | - * @param {boolean} state Previous state. | |
| 343 | - * @param {Object} action Action object. | |
| 344 | - * @param {string} action.type Action type. | |
| 345 | - * @param {string} action.itemType Type of item. | |
| 346 | - * @param {string} action.scope Item scope. | |
| 347 | - * @param {string} action.item Item name. | |
| 348 | - * | |
| 349 | - * @return {Object} Updated state. | |
| 350 | - */ | |
| 351 | - | |
| 352 | -function singleEnableItems() { | |
| 353 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 354 | - let { | |
| 355 | - type, | |
| 356 | - itemType, | |
| 357 | - scope, | |
| 358 | - item | |
| 359 | - } = arguments.length > 1 ? arguments[1] : undefined; | |
| 360 | - | |
| 361 | - if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) { | |
| 362 | - return state; | |
| 363 | - } | |
| 364 | - | |
| 365 | - return { ...state, | |
| 366 | - [itemType]: { ...state[itemType], | |
| 367 | - [scope]: item || null | |
| 368 | - } | |
| 369 | - }; | |
| 370 | -} | |
| 371 | -/** | |
| 372 | - * Reducer keeping track of the "pinned" items per scope. | |
| 373 | - * | |
| 374 | - * @param {boolean} state Previous state. | |
| 375 | - * @param {Object} action Action object. | |
| 376 | - * @param {string} action.type Action type. | |
| 377 | - * @param {string} action.itemType Type of item. | |
| 378 | - * @param {string} action.scope Item scope. | |
| 379 | - * @param {string} action.item Item name. | |
| 380 | - * @param {boolean} action.isEnable Whether the item is pinned. | |
| 381 | - * | |
| 382 | - * @return {Object} Updated state. | |
| 383 | - */ | |
| 384 | - | |
| 385 | -function multipleEnableItems() { | |
| 386 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 387 | - let { | |
| 388 | - type, | |
| 389 | - itemType, | |
| 390 | - scope, | |
| 391 | - item, | |
| 392 | - isEnable | |
| 393 | - } = arguments.length > 1 ? arguments[1] : undefined; | |
| 394 | - | |
| 395 | - if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || (0,external_lodash_namespaceObject.get)(state, [itemType, scope, item]) === isEnable) { | |
| 396 | - return state; | |
| 397 | - } | |
| 398 | - | |
| 399 | - const currentTypeState = state[itemType] || {}; | |
| 400 | - const currentScopeState = currentTypeState[scope] || {}; | |
| 401 | - return { ...state, | |
| 402 | - [itemType]: { ...currentTypeState, | |
| 403 | - [scope]: { ...currentScopeState, | |
| 404 | - [item]: isEnable || false | |
| 405 | - } | |
| 406 | - } | |
| 407 | - }; | |
| 408 | -} | |
| 409 | -/** | |
| 410 | - * Reducer returning the defaults for user preferences. | |
| 411 | - * | |
| 412 | - * This is kept intentionally separate from the preferences | |
| 413 | - * themselves so that defaults are not persisted. | |
| 414 | - * | |
| 415 | - * @param {Object} state Current state. | |
| 416 | - * @param {Object} action Dispatched action. | |
| 417 | - * | |
| 418 | - * @return {Object} Updated state. | |
| 419 | - */ | |
| 420 | - | |
| 421 | -const preferenceDefaults = (0,external_wp_data_namespaceObject.combineReducers)({ | |
| 422 | - features() { | |
| 423 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 424 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 425 | - | |
| 426 | - if (action.type === 'SET_FEATURE_DEFAULTS') { | |
| 427 | - const { | |
| 428 | - scope, | |
| 429 | - defaults | |
| 430 | - } = action; | |
| 431 | - return { ...state, | |
| 432 | - [scope]: { ...state[scope], | |
| 433 | - ...defaults | |
| 434 | - } | |
| 435 | - }; | |
| 436 | - } | |
| 437 | - | |
| 438 | - return state; | |
| 439 | - } | |
| 440 | - | |
| 441 | -}); | |
| 442 | -/** | |
| 443 | - * Reducer returning the user preferences. | |
| 444 | - * | |
| 445 | - * @param {Object} state Current state. | |
| 446 | - * @param {Object} action Dispatched action. | |
| 447 | - * | |
| 448 | - * @return {Object} Updated state. | |
| 449 | - */ | |
| 450 | - | |
| 451 | -const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ | |
| 452 | - features() { | |
| 453 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 454 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 455 | - | |
| 456 | - if (action.type === 'SET_FEATURE_VALUE') { | |
| 457 | - const { | |
| 458 | - scope, | |
| 459 | - featureName, | |
| 460 | - value | |
| 461 | - } = action; | |
| 462 | - return { ...state, | |
| 463 | - [scope]: { ...state[scope], | |
| 464 | - [featureName]: value | |
| 465 | - } | |
| 466 | - }; | |
| 467 | - } | |
| 468 | - | |
| 469 | - return state; | |
| 470 | - } | |
| 471 | - | |
| 472 | -}); | |
| 473 | -const enableItems = (0,external_wp_data_namespaceObject.combineReducers)({ | |
| 474 | - singleEnableItems, | |
| 475 | - multipleEnableItems | |
| 476 | -}); | |
| 477 | -/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ | |
| 478 | - enableItems, | |
| 479 | - preferenceDefaults, | |
| 480 | - preferences | |
| 481 | -})); | |
| 482 | -//# sourceMappingURL=reducer.js.map | |
| 483 | -;// CONCATENATED MODULE: ./packages/interface/build-module/store/actions.js | |
| 484 | -/** | |
| 485 | - * Returns an action object used in signalling that an active area should be changed. | |
| 486 | - * | |
| 487 | - * @param {string} itemType Type of item. | |
| 488 | - * @param {string} scope Item scope. | |
| 489 | - * @param {string} item Item identifier. | |
| 490 | - * | |
| 491 | - * @return {Object} Action object. | |
| 492 | - */ | |
| 493 | -function setSingleEnableItem(itemType, scope, item) { | |
| 494 | - return { | |
| 495 | - type: 'SET_SINGLE_ENABLE_ITEM', | |
| 496 | - itemType, | |
| 497 | - scope, | |
| 498 | - item | |
| 499 | - }; | |
| 500 | -} | |
| 501 | -/** | |
| 502 | - * Returns an action object used in signalling that a complementary item should be enabled. | |
| 503 | - * | |
| 504 | - * @param {string} scope Complementary area scope. | |
| 505 | - * @param {string} area Area identifier. | |
| 506 | - * | |
| 507 | - * @return {Object} Action object. | |
| 508 | - */ | |
| 509 | - | |
| 510 | - | |
| 511 | -function enableComplementaryArea(scope, area) { | |
| 512 | - return setSingleEnableItem('complementaryArea', scope, area); | |
| 513 | -} | |
| 514 | -/** | |
| 515 | - * Returns an action object used in signalling that the complementary area of a given scope should be disabled. | |
| 516 | - * | |
| 517 | - * @param {string} scope Complementary area scope. | |
| 518 | - * | |
| 519 | - * @return {Object} Action object. | |
| 520 | - */ | |
| 521 | - | |
| 522 | -function disableComplementaryArea(scope) { | |
| 523 | - return setSingleEnableItem('complementaryArea', scope, undefined); | |
| 524 | -} | |
| 525 | -/** | |
| 526 | - * Returns an action object to make an area enabled/disabled. | |
| 527 | - * | |
| 528 | - * @param {string} itemType Type of item. | |
| 529 | - * @param {string} scope Item scope. | |
| 530 | - * @param {string} item Item identifier. | |
| 531 | - * @param {boolean} isEnable Boolean indicating if an area should be pinned or not. | |
| 532 | - * | |
| 533 | - * @return {Object} Action object. | |
| 534 | - */ | |
| 535 | - | |
| 536 | -function setMultipleEnableItem(itemType, scope, item, isEnable) { | |
| 537 | - return { | |
| 538 | - type: 'SET_MULTIPLE_ENABLE_ITEM', | |
| 539 | - itemType, | |
| 540 | - scope, | |
| 541 | - item, | |
| 542 | - isEnable | |
| 543 | - }; | |
| 544 | -} | |
| 545 | -/** | |
| 546 | - * Returns an action object used in signalling that an item should be pinned. | |
| 547 | - * | |
| 548 | - * @param {string} scope Item scope. | |
| 549 | - * @param {string} itemId Item identifier. | |
| 550 | - * | |
| 551 | - * @return {Object} Action object. | |
| 552 | - */ | |
| 553 | - | |
| 554 | - | |
| 555 | -function pinItem(scope, itemId) { | |
| 556 | - return setMultipleEnableItem('pinnedItems', scope, itemId, true); | |
| 557 | -} | |
| 558 | -/** | |
| 559 | - * Returns an action object used in signalling that an item should be unpinned. | |
| 560 | - * | |
| 561 | - * @param {string} scope Item scope. | |
| 562 | - * @param {string} itemId Item identifier. | |
| 563 | - * | |
| 564 | - * @return {Object} Action object. | |
| 565 | - */ | |
| 566 | - | |
| 567 | -function unpinItem(scope, itemId) { | |
| 568 | - return setMultipleEnableItem('pinnedItems', scope, itemId, false); | |
| 569 | -} | |
| 570 | -/** | |
| 571 | - * Returns an action object used in signalling that a feature should be toggled. | |
| 572 | - * | |
| 573 | - * @param {string} scope The feature scope (e.g. core/edit-post). | |
| 574 | - * @param {string} featureName The feature name. | |
| 575 | - */ | |
| 576 | - | |
| 577 | -function toggleFeature(scope, featureName) { | |
| 578 | - return function (_ref) { | |
| 579 | - let { | |
| 580 | - select, | |
| 581 | - dispatch | |
| 582 | - } = _ref; | |
| 583 | - const currentValue = select.isFeatureActive(scope, featureName); | |
| 584 | - dispatch.setFeatureValue(scope, featureName, !currentValue); | |
| 585 | - }; | |
| 586 | -} | |
| 587 | -/** | |
| 588 | - * Returns an action object used in signalling that a feature should be set to | |
| 589 | - * a true or false value | |
| 590 | - * | |
| 591 | - * @param {string} scope The feature scope (e.g. core/edit-post). | |
| 592 | - * @param {string} featureName The feature name. | |
| 593 | - * @param {boolean} value The value to set. | |
| 594 | - * | |
| 595 | - * @return {Object} Action object. | |
| 596 | - */ | |
| 597 | - | |
| 598 | -function setFeatureValue(scope, featureName, value) { | |
| 599 | - return { | |
| 600 | - type: 'SET_FEATURE_VALUE', | |
| 601 | - scope, | |
| 602 | - featureName, | |
| 603 | - value: !!value | |
| 604 | - }; | |
| 605 | -} | |
| 606 | -/** | |
| 607 | - * Returns an action object used in signalling that defaults should be set for features. | |
| 608 | - * | |
| 609 | - * @param {string} scope The feature scope (e.g. core/edit-post). | |
| 610 | - * @param {Object<string, boolean>} defaults A key/value map of feature names to values. | |
| 611 | - * | |
| 612 | - * @return {Object} Action object. | |
| 613 | - */ | |
| 614 | - | |
| 615 | -function setFeatureDefaults(scope, defaults) { | |
| 616 | - return { | |
| 617 | - type: 'SET_FEATURE_DEFAULTS', | |
| 618 | - scope, | |
| 619 | - defaults | |
| 620 | - }; | |
| 621 | -} | |
| 622 | -//# sourceMappingURL=actions.js.map | |
| 623 | -;// CONCATENATED MODULE: ./packages/interface/build-module/store/selectors.js | |
| 624 | -/** | |
| 625 | - * External dependencies | |
| 626 | - */ | |
| 627 | - | |
| 628 | -/** | |
| 629 | - * Returns the item that is enabled in a given scope. | |
| 630 | - * | |
| 631 | - * @param {Object} state Global application state. | |
| 632 | - * @param {string} itemType Type of item. | |
| 633 | - * @param {string} scope Item scope. | |
| 634 | - * | |
| 635 | - * @return {?string|null} The item that is enabled in the passed scope and type. | |
| 636 | - */ | |
| 637 | - | |
| 638 | -function getSingleEnableItem(state, itemType, scope) { | |
| 639 | - return (0,external_lodash_namespaceObject.get)(state.enableItems.singleEnableItems, [itemType, scope]); | |
| 640 | -} | |
| 641 | -/** | |
| 642 | - * Returns the complementary area that is active in a given scope. | |
| 643 | - * | |
| 644 | - * @param {Object} state Global application state. | |
| 645 | - * @param {string} scope Item scope. | |
| 646 | - * | |
| 647 | - * @return {string} The complementary area that is active in the given scope. | |
| 648 | - */ | |
| 649 | - | |
| 650 | - | |
| 651 | -function getActiveComplementaryArea(state, scope) { | |
| 652 | - return getSingleEnableItem(state, 'complementaryArea', scope); | |
| 653 | -} | |
| 654 | -/** | |
| 655 | - * Returns a boolean indicating if an item is enabled or not in a given scope. | |
| 656 | - * | |
| 657 | - * @param {Object} state Global application state. | |
| 658 | - * @param {string} itemType Type of item. | |
| 659 | - * @param {string} scope Scope. | |
| 660 | - * @param {string} item Item to check. | |
| 661 | - * | |
| 662 | - * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item. | |
| 663 | - */ | |
| 664 | - | |
| 665 | -function isMultipleEnabledItemEnabled(state, itemType, scope, item) { | |
| 666 | - return (0,external_lodash_namespaceObject.get)(state.enableItems.multipleEnableItems, [itemType, scope, item]); | |
| 667 | -} | |
| 668 | -/** | |
| 669 | - * Returns a boolean indicating if an item is pinned or not. | |
| 670 | - * | |
| 671 | - * @param {Object} state Global application state. | |
| 672 | - * @param {string} scope Scope. | |
| 673 | - * @param {string} item Item to check. | |
| 674 | - * | |
| 675 | - * @return {boolean} True if the item is pinned and false otherwise. | |
| 676 | - */ | |
| 677 | - | |
| 678 | - | |
| 679 | -function isItemPinned(state, scope, item) { | |
| 680 | - return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false; | |
| 681 | -} | |
| 682 | -/** | |
| 683 | - * Returns a boolean indicating whether a feature is active for a particular | |
| 684 | - * scope. | |
| 685 | - * | |
| 686 | - * @param {Object} state The store state. | |
| 687 | - * @param {string} scope The scope of the feature (e.g. core/edit-post). | |
| 688 | - * @param {string} featureName The name of the feature. | |
| 689 | - * | |
| 690 | - * @return {boolean} Is the feature enabled? | |
| 691 | - */ | |
| 692 | - | |
| 693 | -function isFeatureActive(state, scope, featureName) { | |
| 694 | - var _state$preferences$fe, _state$preferenceDefa; | |
| 695 | - | |
| 696 | - const featureValue = (_state$preferences$fe = state.preferences.features[scope]) === null || _state$preferences$fe === void 0 ? void 0 : _state$preferences$fe[featureName]; | |
| 697 | - const defaultedFeatureValue = featureValue !== undefined ? featureValue : (_state$preferenceDefa = state.preferenceDefaults.features[scope]) === null || _state$preferenceDefa === void 0 ? void 0 : _state$preferenceDefa[featureName]; | |
| 698 | - return !!defaultedFeatureValue; | |
| 699 | -} | |
| 700 | -//# sourceMappingURL=selectors.js.map | |
| 701 | -;// CONCATENATED MODULE: ./packages/interface/build-module/store/constants.js | |
| 702 | -/** | |
| 703 | - * The identifier for the data store. | |
| 704 | - * | |
| 705 | - * @type {string} | |
| 706 | - */ | |
| 707 | -const STORE_NAME = 'core/interface'; | |
| 708 | -//# sourceMappingURL=constants.js.map | |
| 709 | -;// CONCATENATED MODULE: ./packages/interface/build-module/store/index.js | |
| 710 | -/** | |
| 711 | - * WordPress dependencies | |
| 712 | - */ | |
| 713 | - | |
| 714 | -/** | |
| 715 | - * Internal dependencies | |
| 716 | - */ | |
| 717 | - | |
| 718 | - | |
| 719 | - | |
| 720 | - | |
| 721 | - | |
| 722 | -/** | |
| 723 | - * Store definition for the interface namespace. | |
| 724 | - * | |
| 725 | - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore | |
| 726 | - * | |
| 727 | - * @type {Object} | |
| 728 | - */ | |
| 729 | - | |
| 730 | -const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { | |
| 731 | - reducer: reducer, | |
| 732 | - actions: actions_namespaceObject, | |
| 733 | - selectors: selectors_namespaceObject, | |
| 734 | - persist: ['enableItems', 'preferences'], | |
| 735 | - __experimentalUseThunks: true | |
| 736 | -}); // Once we build a more generic persistence plugin that works across types of stores | |
| 737 | -// we'd be able to replace this with a register call. | |
| 738 | - | |
| 739 | -(0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { | |
| 740 | - reducer: reducer, | |
| 741 | - actions: actions_namespaceObject, | |
| 742 | - selectors: selectors_namespaceObject, | |
| 743 | - persist: ['enableItems', 'preferences'], | |
| 744 | - __experimentalUseThunks: true | |
| 745 | -}); | |
| 746 | -//# sourceMappingURL=index.js.map | |
| 747 | -;// CONCATENATED MODULE: external ["wp","plugins"] | |
| 748 | -var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; | |
| 749 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-context/index.js | |
| 750 | -/** | |
| 751 | - * WordPress dependencies | |
| 752 | - */ | |
| 753 | - | |
| 754 | -/* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { | |
| 755 | - return { | |
| 756 | - icon: ownProps.icon || context.icon, | |
| 757 | - identifier: ownProps.identifier || `${context.name}/${ownProps.name}` | |
| 758 | - }; | |
| 759 | -})); | |
| 760 | -//# sourceMappingURL=index.js.map | |
| 761 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-toggle/index.js | |
| 762 | - | |
| 763 | - | |
| 764 | - | |
| 765 | -/** | |
| 766 | - * External dependencies | |
| 767 | - */ | |
| 768 | - | |
| 769 | -/** | |
| 770 | - * WordPress dependencies | |
| 771 | - */ | |
| 772 | - | |
| 773 | - | |
| 774 | - | |
| 775 | -/** | |
| 776 | - * Internal dependencies | |
| 777 | - */ | |
| 778 | - | |
| 779 | - | |
| 780 | - | |
| 781 | - | |
| 782 | -function ComplementaryAreaToggle(_ref) { | |
| 783 | - let { | |
| 784 | - as = external_wp_components_namespaceObject.Button, | |
| 785 | - scope, | |
| 786 | - identifier, | |
| 787 | - icon, | |
| 788 | - selectedIcon, | |
| 789 | - ...props | |
| 790 | - } = _ref; | |
| 791 | - const ComponentToUse = as; | |
| 792 | - const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); | |
| 793 | - const { | |
| 794 | - enableComplementaryArea, | |
| 795 | - disableComplementaryArea | |
| 796 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 797 | - return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({ | |
| 798 | - icon: selectedIcon && isSelected ? selectedIcon : icon, | |
| 799 | - onClick: () => { | |
| 800 | - if (isSelected) { | |
| 801 | - disableComplementaryArea(scope); | |
| 802 | - } else { | |
| 803 | - enableComplementaryArea(scope, identifier); | |
| 804 | - } | |
| 805 | - } | |
| 806 | - }, (0,external_lodash_namespaceObject.omit)(props, ['name']))); | |
| 807 | -} | |
| 808 | - | |
| 809 | -/* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); | |
| 810 | -//# sourceMappingURL=index.js.map | |
| 811 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-header/index.js | |
| 812 | - | |
| 813 | - | |
| 814 | - | |
| 815 | -/** | |
| 816 | - * External dependencies | |
| 817 | - */ | |
| 818 | - | |
| 819 | -/** | |
| 820 | - * WordPress dependencies | |
| 821 | - */ | |
| 822 | - | |
| 823 | - | |
| 824 | -/** | |
| 825 | - * Internal dependencies | |
| 826 | - */ | |
| 827 | - | |
| 828 | - | |
| 829 | - | |
| 830 | -const ComplementaryAreaHeader = _ref => { | |
| 831 | - let { | |
| 832 | - smallScreenTitle, | |
| 833 | - children, | |
| 834 | - className, | |
| 835 | - toggleButtonProps | |
| 836 | - } = _ref; | |
| 837 | - const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({ | |
| 838 | - icon: close_small | |
| 839 | - }, toggleButtonProps)); | |
| 840 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 841 | - className: "components-panel__header interface-complementary-area-header__small" | |
| 842 | - }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { | |
| 843 | - className: "interface-complementary-area-header__small-title" | |
| 844 | - }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 845 | - className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), | |
| 846 | - tabIndex: -1 | |
| 847 | - }, children, toggleButton)); | |
| 848 | -}; | |
| 849 | - | |
| 850 | -/* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); | |
| 851 | -//# sourceMappingURL=index.js.map | |
| 852 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/action-item/index.js | |
| 853 | - | |
| 854 | - | |
| 855 | - | |
| 856 | -/** | |
| 857 | - * External dependencies | |
| 858 | - */ | |
| 859 | - | |
| 860 | -/** | |
| 861 | - * WordPress dependencies | |
| 862 | - */ | |
| 863 | - | |
| 864 | - | |
| 865 | - | |
| 866 | - | |
| 867 | -function ActionItemSlot(_ref) { | |
| 868 | - let { | |
| 869 | - name, | |
| 870 | - as: Component = external_wp_components_namespaceObject.ButtonGroup, | |
| 871 | - fillProps = {}, | |
| 872 | - bubblesVirtually, | |
| 873 | - ...props | |
| 874 | - } = _ref; | |
| 875 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { | |
| 876 | - name: name, | |
| 877 | - bubblesVirtually: bubblesVirtually, | |
| 878 | - fillProps: fillProps | |
| 879 | - }, fills => { | |
| 880 | - if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) { | |
| 881 | - return null; | |
| 882 | - } // Special handling exists for backward compatibility. | |
| 883 | - // It ensures that menu items created by plugin authors aren't | |
| 884 | - // duplicated with automatically injected menu items coming | |
| 885 | - // from pinnable plugin sidebars. | |
| 886 | - // @see https://github.com/WordPress/gutenberg/issues/14457 | |
| 887 | - | |
| 888 | - | |
| 889 | - const initializedByPlugins = []; | |
| 890 | - external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => { | |
| 891 | - let { | |
| 892 | - props: { | |
| 893 | - __unstableExplicitMenuItem, | |
| 894 | - __unstableTarget | |
| 895 | - } | |
| 896 | - } = _ref2; | |
| 897 | - | |
| 898 | - if (__unstableTarget && __unstableExplicitMenuItem) { | |
| 899 | - initializedByPlugins.push(__unstableTarget); | |
| 900 | - } | |
| 901 | - }); | |
| 902 | - const children = external_wp_element_namespaceObject.Children.map(fills, child => { | |
| 903 | - if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { | |
| 904 | - return null; | |
| 905 | - } | |
| 906 | - | |
| 907 | - return child; | |
| 908 | - }); | |
| 909 | - return (0,external_wp_element_namespaceObject.createElement)(Component, props, children); | |
| 910 | - }); | |
| 911 | -} | |
| 912 | - | |
| 913 | -function ActionItem(_ref3) { | |
| 914 | - let { | |
| 915 | - name, | |
| 916 | - as: Component = external_wp_components_namespaceObject.Button, | |
| 917 | - onClick, | |
| 918 | - ...props | |
| 919 | - } = _ref3; | |
| 920 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { | |
| 921 | - name: name | |
| 922 | - }, _ref4 => { | |
| 923 | - let { | |
| 924 | - onClick: fpOnClick | |
| 925 | - } = _ref4; | |
| 926 | - return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({ | |
| 927 | - onClick: onClick || fpOnClick ? function () { | |
| 928 | - (onClick || external_lodash_namespaceObject.noop)(...arguments); | |
| 929 | - (fpOnClick || external_lodash_namespaceObject.noop)(...arguments); | |
| 930 | - } : undefined | |
| 931 | - }, props)); | |
| 932 | - }); | |
| 933 | -} | |
| 934 | - | |
| 935 | -ActionItem.Slot = ActionItemSlot; | |
| 936 | -/* harmony default export */ var action_item = (ActionItem); | |
| 937 | -//# sourceMappingURL=index.js.map | |
| 938 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-more-menu-item/index.js | |
| 939 | - | |
| 940 | - | |
| 941 | - | |
| 942 | -/** | |
| 943 | - * External dependencies | |
| 944 | - */ | |
| 945 | - | |
| 946 | -/** | |
| 947 | - * WordPress dependencies | |
| 948 | - */ | |
| 949 | - | |
| 950 | - | |
| 951 | - | |
| 952 | -/** | |
| 953 | - * Internal dependencies | |
| 954 | - */ | |
| 955 | - | |
| 956 | - | |
| 957 | - | |
| 958 | - | |
| 959 | -const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. | |
| 960 | -// They are removed so they don't leak to DOM elements. | |
| 961 | -// @see https://github.com/WordPress/gutenberg/issues/14457 | |
| 962 | -(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); | |
| 963 | - | |
| 964 | -function ComplementaryAreaMoreMenuItem(_ref) { | |
| 965 | - let { | |
| 966 | - scope, | |
| 967 | - target, | |
| 968 | - __unstableExplicitMenuItem, | |
| 969 | - ...props | |
| 970 | - } = _ref; | |
| 971 | - return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({ | |
| 972 | - as: toggleProps => { | |
| 973 | - return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({ | |
| 974 | - __unstableExplicitMenuItem: __unstableExplicitMenuItem, | |
| 975 | - __unstableTarget: `${scope}/${target}`, | |
| 976 | - as: PluginsMenuItem, | |
| 977 | - name: `${scope}/plugin-more-menu` | |
| 978 | - }, toggleProps)); | |
| 979 | - }, | |
| 980 | - role: "menuitemcheckbox", | |
| 981 | - selectedIcon: library_check, | |
| 982 | - name: target, | |
| 983 | - scope: scope | |
| 984 | - }, props)); | |
| 985 | -} | |
| 986 | -//# sourceMappingURL=index.js.map | |
| 987 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/pinned-items/index.js | |
| 988 | - | |
| 989 | - | |
| 990 | - | |
| 991 | -/** | |
| 992 | - * External dependencies | |
| 993 | - */ | |
| 994 | - | |
| 995 | - | |
| 996 | -/** | |
| 997 | - * WordPress dependencies | |
| 998 | - */ | |
| 999 | - | |
| 1000 | - | |
| 1001 | - | |
| 1002 | -function PinnedItems(_ref) { | |
| 1003 | - let { | |
| 1004 | - scope, | |
| 1005 | - ...props | |
| 1006 | - } = _ref; | |
| 1007 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({ | |
| 1008 | - name: `PinnedItems/${scope}` | |
| 1009 | - }, props)); | |
| 1010 | -} | |
| 1011 | - | |
| 1012 | -function PinnedItemsSlot(_ref2) { | |
| 1013 | - let { | |
| 1014 | - scope, | |
| 1015 | - className, | |
| 1016 | - ...props | |
| 1017 | - } = _ref2; | |
| 1018 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({ | |
| 1019 | - name: `PinnedItems/${scope}` | |
| 1020 | - }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1021 | - className: classnames_default()(className, 'interface-pinned-items') | |
| 1022 | - }, fills)); | |
| 1023 | -} | |
| 1024 | - | |
| 1025 | -PinnedItems.Slot = PinnedItemsSlot; | |
| 1026 | -/* harmony default export */ var pinned_items = (PinnedItems); | |
| 1027 | -//# sourceMappingURL=index.js.map | |
| 1028 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area/index.js | |
| 1029 | - | |
| 1030 | - | |
| 1031 | - | |
| 1032 | -/** | |
| 1033 | - * External dependencies | |
| 1034 | - */ | |
| 1035 | - | |
| 1036 | -/** | |
| 1037 | - * WordPress dependencies | |
| 1038 | - */ | |
| 1039 | - | |
| 1040 | - | |
| 1041 | - | |
| 1042 | - | |
| 1043 | - | |
| 1044 | - | |
| 1045 | - | |
| 1046 | -/** | |
| 1047 | - * Internal dependencies | |
| 1048 | - */ | |
| 1049 | - | |
| 1050 | - | |
| 1051 | - | |
| 1052 | - | |
| 1053 | - | |
| 1054 | - | |
| 1055 | - | |
| 1056 | - | |
| 1057 | -function ComplementaryAreaSlot(_ref) { | |
| 1058 | - let { | |
| 1059 | - scope, | |
| 1060 | - ...props | |
| 1061 | - } = _ref; | |
| 1062 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({ | |
| 1063 | - name: `ComplementaryArea/${scope}` | |
| 1064 | - }, props)); | |
| 1065 | -} | |
| 1066 | - | |
| 1067 | -function ComplementaryAreaFill(_ref2) { | |
| 1068 | - let { | |
| 1069 | - scope, | |
| 1070 | - children, | |
| 1071 | - className | |
| 1072 | - } = _ref2; | |
| 1073 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { | |
| 1074 | - name: `ComplementaryArea/${scope}` | |
| 1075 | - }, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1076 | - className: className | |
| 1077 | - }, children)); | |
| 1078 | -} | |
| 1079 | - | |
| 1080 | -function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { | |
| 1081 | - const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); | |
| 1082 | - const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); | |
| 1083 | - const { | |
| 1084 | - enableComplementaryArea, | |
| 1085 | - disableComplementaryArea | |
| 1086 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 1087 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 1088 | - // If the complementary area is active and the editor is switching from a big to a small window size. | |
| 1089 | - if (isActive && isSmall && !previousIsSmall.current) { | |
| 1090 | - // Disable the complementary area. | |
| 1091 | - disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. | |
| 1092 | - | |
| 1093 | - shouldOpenWhenNotSmall.current = true; | |
| 1094 | - } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size | |
| 1095 | - // and we are going from a small to big window size. | |
| 1096 | - shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { | |
| 1097 | - // Remove the flag indicating the complementary area should be enabled. | |
| 1098 | - shouldOpenWhenNotSmall.current = false; // Enable the complementary area. | |
| 1099 | - | |
| 1100 | - enableComplementaryArea(scope, identifier); | |
| 1101 | - } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, | |
| 1102 | - // remove the flag. | |
| 1103 | - shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { | |
| 1104 | - shouldOpenWhenNotSmall.current = false; | |
| 1105 | - } | |
| 1106 | - | |
| 1107 | - if (isSmall !== previousIsSmall.current) { | |
| 1108 | - previousIsSmall.current = isSmall; | |
| 1109 | - } | |
| 1110 | - }, [isActive, isSmall, scope, identifier, activeArea]); | |
| 1111 | -} | |
| 1112 | - | |
| 1113 | -function ComplementaryArea(_ref3) { | |
| 1114 | - let { | |
| 1115 | - children, | |
| 1116 | - className, | |
| 1117 | - closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), | |
| 1118 | - identifier, | |
| 1119 | - header, | |
| 1120 | - headerClassName, | |
| 1121 | - icon, | |
| 1122 | - isPinnable = true, | |
| 1123 | - panelClassName, | |
| 1124 | - scope, | |
| 1125 | - name, | |
| 1126 | - smallScreenTitle, | |
| 1127 | - title, | |
| 1128 | - toggleShortcut, | |
| 1129 | - isActiveByDefault, | |
| 1130 | - showIconLabels = false | |
| 1131 | - } = _ref3; | |
| 1132 | - const { | |
| 1133 | - isActive, | |
| 1134 | - isPinned, | |
| 1135 | - activeArea, | |
| 1136 | - isSmall, | |
| 1137 | - isLarge | |
| 1138 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 1139 | - const { | |
| 1140 | - getActiveComplementaryArea, | |
| 1141 | - isItemPinned | |
| 1142 | - } = select(store); | |
| 1143 | - | |
| 1144 | - const _activeArea = getActiveComplementaryArea(scope); | |
| 1145 | - | |
| 1146 | - return { | |
| 1147 | - isActive: _activeArea === identifier, | |
| 1148 | - isPinned: isItemPinned(scope, identifier), | |
| 1149 | - activeArea: _activeArea, | |
| 1150 | - isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), | |
| 1151 | - isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') | |
| 1152 | - }; | |
| 1153 | - }, [identifier, scope]); | |
| 1154 | - useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); | |
| 1155 | - const { | |
| 1156 | - enableComplementaryArea, | |
| 1157 | - disableComplementaryArea, | |
| 1158 | - pinItem, | |
| 1159 | - unpinItem | |
| 1160 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 1161 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 1162 | - if (isActiveByDefault && activeArea === undefined && !isSmall) { | |
| 1163 | - enableComplementaryArea(scope, identifier); | |
| 1164 | - } | |
| 1165 | - }, [activeArea, isActiveByDefault, scope, identifier, isSmall]); | |
| 1166 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { | |
| 1167 | - scope: scope | |
| 1168 | - }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { | |
| 1169 | - scope: scope, | |
| 1170 | - identifier: identifier, | |
| 1171 | - isPressed: isActive && (!showIconLabels || isLarge), | |
| 1172 | - "aria-expanded": isActive, | |
| 1173 | - label: title, | |
| 1174 | - icon: showIconLabels ? library_check : icon, | |
| 1175 | - showTooltip: !showIconLabels, | |
| 1176 | - variant: showIconLabels ? 'tertiary' : undefined | |
| 1177 | - })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { | |
| 1178 | - target: name, | |
| 1179 | - scope: scope, | |
| 1180 | - icon: icon | |
| 1181 | - }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { | |
| 1182 | - className: classnames_default()('interface-complementary-area', className), | |
| 1183 | - scope: scope | |
| 1184 | - }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { | |
| 1185 | - className: headerClassName, | |
| 1186 | - closeLabel: closeLabel, | |
| 1187 | - onClose: () => disableComplementaryArea(scope), | |
| 1188 | - smallScreenTitle: smallScreenTitle, | |
| 1189 | - toggleButtonProps: { | |
| 1190 | - label: closeLabel, | |
| 1191 | - shortcut: toggleShortcut, | |
| 1192 | - scope, | |
| 1193 | - identifier | |
| 1194 | - } | |
| 1195 | - }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 1196 | - className: "interface-complementary-area__pin-unpin-item", | |
| 1197 | - icon: isPinned ? star_filled : star_empty, | |
| 1198 | - label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), | |
| 1199 | - onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), | |
| 1200 | - isPressed: isPinned, | |
| 1201 | - "aria-expanded": isPinned | |
| 1202 | - }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { | |
| 1203 | - className: panelClassName | |
| 1204 | - }, children))); | |
| 1205 | -} | |
| 1206 | - | |
| 1207 | -const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); | |
| 1208 | -ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; | |
| 1209 | -/* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); | |
| 1210 | -//# sourceMappingURL=index.js.map | |
| 1211 | -;// CONCATENATED MODULE: external ["wp","compose"] | |
| 1212 | -var external_wp_compose_namespaceObject = window["wp"]["compose"]; | |
| 1213 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/interface-skeleton/index.js | |
| 1214 | - | |
| 1215 | - | |
| 1216 | - | |
| 1217 | -/** | |
| 1218 | - * External dependencies | |
| 1219 | - */ | |
| 1220 | - | |
| 1221 | -/** | |
| 1222 | - * WordPress dependencies | |
| 1223 | - */ | |
| 1224 | - | |
| 1225 | -/** | |
| 1226 | - * WordPress dependencies | |
| 1227 | - */ | |
| 1228 | - | |
| 1229 | - | |
| 1230 | - | |
| 1231 | - | |
| 1232 | - | |
| 1233 | - | |
| 1234 | -function useHTMLClass(className) { | |
| 1235 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 1236 | - const element = document && document.querySelector(`html:not(.${className})`); | |
| 1237 | - | |
| 1238 | - if (!element) { | |
| 1239 | - return; | |
| 1240 | - } | |
| 1241 | - | |
| 1242 | - element.classList.toggle(className); | |
| 1243 | - return () => { | |
| 1244 | - element.classList.toggle(className); | |
| 1245 | - }; | |
| 1246 | - }, [className]); | |
| 1247 | -} | |
| 1248 | - | |
| 1249 | -function InterfaceSkeleton(_ref, ref) { | |
| 1250 | - let { | |
| 1251 | - footer, | |
| 1252 | - header, | |
| 1253 | - sidebar, | |
| 1254 | - secondarySidebar, | |
| 1255 | - notices, | |
| 1256 | - content, | |
| 1257 | - drawer, | |
| 1258 | - actions, | |
| 1259 | - labels, | |
| 1260 | - className, | |
| 1261 | - shortcuts | |
| 1262 | - } = _ref; | |
| 1263 | - const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); | |
| 1264 | - useHTMLClass('interface-interface-skeleton__html-container'); | |
| 1265 | - const defaultLabels = { | |
| 1266 | - /* translators: accessibility text for the nav bar landmark region. */ | |
| 1267 | - drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'), | |
| 1268 | - | |
| 1269 | - /* translators: accessibility text for the top bar landmark region. */ | |
| 1270 | - header: (0,external_wp_i18n_namespaceObject.__)('Header'), | |
| 1271 | - | |
| 1272 | - /* translators: accessibility text for the content landmark region. */ | |
| 1273 | - body: (0,external_wp_i18n_namespaceObject.__)('Content'), | |
| 1274 | - | |
| 1275 | - /* translators: accessibility text for the secondary sidebar landmark region. */ | |
| 1276 | - secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), | |
| 1277 | - | |
| 1278 | - /* translators: accessibility text for the settings landmark region. */ | |
| 1279 | - sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), | |
| 1280 | - | |
| 1281 | - /* translators: accessibility text for the publish landmark region. */ | |
| 1282 | - actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), | |
| 1283 | - | |
| 1284 | - /* translators: accessibility text for the footer landmark region. */ | |
| 1285 | - footer: (0,external_wp_i18n_namespaceObject.__)('Footer') | |
| 1286 | - }; | |
| 1287 | - const mergedLabels = { ...defaultLabels, | |
| 1288 | - ...labels | |
| 1289 | - }; | |
| 1290 | - return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, { | |
| 1291 | - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]), | |
| 1292 | - className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') | |
| 1293 | - }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1294 | - className: "interface-interface-skeleton__drawer", | |
| 1295 | - role: "region", | |
| 1296 | - "aria-label": mergedLabels.drawer, | |
| 1297 | - tabIndex: "-1" | |
| 1298 | - }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1299 | - className: "interface-interface-skeleton__editor" | |
| 1300 | - }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1301 | - className: "interface-interface-skeleton__header", | |
| 1302 | - role: "region", | |
| 1303 | - "aria-label": mergedLabels.header, | |
| 1304 | - tabIndex: "-1" | |
| 1305 | - }, header), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1306 | - className: "interface-interface-skeleton__body" | |
| 1307 | - }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1308 | - className: "interface-interface-skeleton__secondary-sidebar", | |
| 1309 | - role: "region", | |
| 1310 | - "aria-label": mergedLabels.secondarySidebar, | |
| 1311 | - tabIndex: "-1" | |
| 1312 | - }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1313 | - className: "interface-interface-skeleton__notices" | |
| 1314 | - }, notices), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1315 | - className: "interface-interface-skeleton__content", | |
| 1316 | - role: "region", | |
| 1317 | - "aria-label": mergedLabels.body, | |
| 1318 | - tabIndex: "-1" | |
| 1319 | - }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1320 | - className: "interface-interface-skeleton__sidebar", | |
| 1321 | - role: "region", | |
| 1322 | - "aria-label": mergedLabels.sidebar, | |
| 1323 | - tabIndex: "-1" | |
| 1324 | - }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1325 | - className: "interface-interface-skeleton__actions", | |
| 1326 | - role: "region", | |
| 1327 | - "aria-label": mergedLabels.actions, | |
| 1328 | - tabIndex: "-1" | |
| 1329 | - }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 1330 | - className: "interface-interface-skeleton__footer", | |
| 1331 | - role: "region", | |
| 1332 | - "aria-label": mergedLabels.footer, | |
| 1333 | - tabIndex: "-1" | |
| 1334 | - }, footer)); | |
| 1335 | -} | |
| 1336 | - | |
| 1337 | -/* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); | |
| 1338 | -//# sourceMappingURL=index.js.map | |
| 1339 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js | |
| 1340 | - | |
| 1341 | - | |
| 1342 | -/** | |
| 1343 | - * WordPress dependencies | |
| 1344 | - */ | |
| 1345 | - | |
| 1346 | -const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 1347 | - xmlns: "http://www.w3.org/2000/svg", | |
| 1348 | - viewBox: "0 0 24 24" | |
| 1349 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 1350 | - d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" | |
| 1351 | -})); | |
| 1352 | -/* harmony default export */ var more_vertical = (moreVertical); | |
| 1353 | -//# sourceMappingURL=more-vertical.js.map | |
| 1354 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-dropdown/index.js | |
| 1355 | - | |
| 1356 | - | |
| 1357 | -/** | |
| 1358 | - * External dependencies | |
| 1359 | - */ | |
| 1360 | - | |
| 1361 | -/** | |
| 1362 | - * WordPress dependencies | |
| 1363 | - */ | |
| 1364 | - | |
| 1365 | - | |
| 1366 | - | |
| 1367 | - | |
| 1368 | -function MoreMenuDropdown(_ref) { | |
| 1369 | - let { | |
| 1370 | - as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, | |
| 1371 | - className, | |
| 1372 | - | |
| 1373 | - /* translators: button label text should, if possible, be under 16 characters. */ | |
| 1374 | - label = (0,external_wp_i18n_namespaceObject.__)('Options'), | |
| 1375 | - popoverProps, | |
| 1376 | - toggleProps, | |
| 1377 | - children | |
| 1378 | - } = _ref; | |
| 1379 | - return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, { | |
| 1380 | - className: classnames_default()('interface-more-menu-dropdown', className), | |
| 1381 | - icon: more_vertical, | |
| 1382 | - label: label, | |
| 1383 | - popoverProps: { | |
| 1384 | - position: 'bottom left', | |
| 1385 | - ...popoverProps, | |
| 1386 | - className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className) | |
| 1387 | - }, | |
| 1388 | - toggleProps: { | |
| 1389 | - tooltipPosition: 'bottom', | |
| 1390 | - ...toggleProps | |
| 1391 | - } | |
| 1392 | - }, onClose => children(onClose)); | |
| 1393 | -} | |
| 1394 | -//# sourceMappingURL=index.js.map | |
| 1395 | -;// CONCATENATED MODULE: external ["wp","a11y"] | |
| 1396 | -var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; | |
| 1397 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-feature-toggle/index.js | |
| 1398 | - | |
| 1399 | - | |
| 1400 | -/** | |
| 1401 | - * WordPress dependencies | |
| 1402 | - */ | |
| 1403 | - | |
| 1404 | - | |
| 1405 | - | |
| 1406 | - | |
| 1407 | - | |
| 1408 | -/** | |
| 1409 | - * Internal dependencies | |
| 1410 | - */ | |
| 1411 | - | |
| 1412 | - | |
| 1413 | -function MoreMenuFeatureToggle(_ref) { | |
| 1414 | - let { | |
| 1415 | - scope, | |
| 1416 | - label, | |
| 1417 | - info, | |
| 1418 | - messageActivated, | |
| 1419 | - messageDeactivated, | |
| 1420 | - shortcut, | |
| 1421 | - feature | |
| 1422 | - } = _ref; | |
| 1423 | - const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isFeatureActive(scope, feature), [feature]); | |
| 1424 | - const { | |
| 1425 | - toggleFeature | |
| 1426 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 1427 | - | |
| 1428 | - const speakMessage = () => { | |
| 1429 | - if (isActive) { | |
| 1430 | - (0,external_wp_a11y_namespaceObject.speak)(messageDeactivated || (0,external_wp_i18n_namespaceObject.__)('Feature deactivated')); | |
| 1431 | - } else { | |
| 1432 | - (0,external_wp_a11y_namespaceObject.speak)(messageActivated || (0,external_wp_i18n_namespaceObject.__)('Feature activated')); | |
| 1433 | - } | |
| 1434 | - }; | |
| 1435 | - | |
| 1436 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { | |
| 1437 | - icon: isActive && library_check, | |
| 1438 | - isSelected: isActive, | |
| 1439 | - onClick: () => { | |
| 1440 | - toggleFeature(scope, feature); | |
| 1441 | - speakMessage(); | |
| 1442 | - }, | |
| 1443 | - role: "menuitemcheckbox", | |
| 1444 | - info: info, | |
| 1445 | - shortcut: shortcut | |
| 1446 | - }, label); | |
| 1447 | -} | |
| 1448 | -//# sourceMappingURL=index.js.map | |
| 1449 | -;// CONCATENATED MODULE: ./packages/interface/build-module/components/index.js | |
| 1450 | - | |
| 1451 | - | |
| 1452 | - | |
| 1453 | - | |
| 1454 | - | |
| 1455 | - | |
| 1456 | - | |
| 1457 | - | |
| 1458 | -//# sourceMappingURL=index.js.map | |
| 1459 | -;// CONCATENATED MODULE: ./packages/interface/build-module/index.js | |
| 1460 | - | |
| 1461 | - | |
| 1462 | -//# sourceMappingURL=index.js.map | |
| 1463 | -;// CONCATENATED MODULE: external ["wp","apiFetch"] | |
| 1464 | -var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; | |
| 1465 | -var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); | |
| 1466 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/reducer.js | |
| 1467 | -/** | |
| 1468 | - * WordPress dependencies | |
| 1469 | - */ | |
| 1470 | - | |
| 1471 | -/** | |
| 1472 | - * Controls the open state of the widget areas. | |
| 1473 | - * | |
| 1474 | - * @param {Object} state Redux state. | |
| 1475 | - * @param {Object} action Redux action. | |
| 1476 | - * | |
| 1477 | - * @return {Array} Updated state. | |
| 1478 | - */ | |
| 1479 | - | |
| 1480 | -function widgetAreasOpenState() { | |
| 1481 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 1482 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 1483 | - const { | |
| 1484 | - type | |
| 1485 | - } = action; | |
| 1486 | - | |
| 1487 | - switch (type) { | |
| 1488 | - case 'SET_WIDGET_AREAS_OPEN_STATE': | |
| 1489 | - { | |
| 1490 | - return action.widgetAreasOpenState; | |
| 1491 | - } | |
| 1492 | - | |
| 1493 | - case 'SET_IS_WIDGET_AREA_OPEN': | |
| 1494 | - { | |
| 1495 | - const { | |
| 1496 | - clientId, | |
| 1497 | - isOpen | |
| 1498 | - } = action; | |
| 1499 | - return { ...state, | |
| 1500 | - [clientId]: isOpen | |
| 1501 | - }; | |
| 1502 | - } | |
| 1503 | - | |
| 1504 | - default: | |
| 1505 | - { | |
| 1506 | - return state; | |
| 1507 | - } | |
| 1508 | - } | |
| 1509 | -} | |
| 1510 | -/** | |
| 1511 | - * Reducer to set the block inserter panel open or closed. | |
| 1512 | - * | |
| 1513 | - * Note: this reducer interacts with the list view panel reducer | |
| 1514 | - * to make sure that only one of the two panels is open at the same time. | |
| 1515 | - * | |
| 1516 | - * @param {Object} state Current state. | |
| 1517 | - * @param {Object} action Dispatched action. | |
| 1518 | - */ | |
| 1519 | - | |
| 1520 | -function blockInserterPanel() { | |
| 1521 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
| 1522 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 1523 | - | |
| 1524 | - switch (action.type) { | |
| 1525 | - case 'SET_IS_LIST_VIEW_OPENED': | |
| 1526 | - return action.isOpen ? false : state; | |
| 1527 | - | |
| 1528 | - case 'SET_IS_INSERTER_OPENED': | |
| 1529 | - return action.value; | |
| 1530 | - } | |
| 1531 | - | |
| 1532 | - return state; | |
| 1533 | -} | |
| 1534 | -/** | |
| 1535 | - * Reducer to set the list view panel open or closed. | |
| 1536 | - * | |
| 1537 | - * Note: this reducer interacts with the inserter panel reducer | |
| 1538 | - * to make sure that only one of the two panels is open at the same time. | |
| 1539 | - * | |
| 1540 | - * @param {Object} state Current state. | |
| 1541 | - * @param {Object} action Dispatched action. | |
| 1542 | - */ | |
| 1543 | - | |
| 1544 | -function listViewPanel() { | |
| 1545 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
| 1546 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 1547 | - | |
| 1548 | - switch (action.type) { | |
| 1549 | - case 'SET_IS_INSERTER_OPENED': | |
| 1550 | - return action.value ? false : state; | |
| 1551 | - | |
| 1552 | - case 'SET_IS_LIST_VIEW_OPENED': | |
| 1553 | - return action.isOpen; | |
| 1554 | - } | |
| 1555 | - | |
| 1556 | - return state; | |
| 1557 | -} | |
| 1558 | -/* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ | |
| 1559 | - blockInserterPanel, | |
| 1560 | - listViewPanel, | |
| 1561 | - widgetAreasOpenState | |
| 1562 | -})); | |
| 1563 | -//# sourceMappingURL=reducer.js.map | |
| 1564 | -;// CONCATENATED MODULE: external ["wp","notices"] | |
| 1565 | -var external_wp_notices_namespaceObject = window["wp"]["notices"]; | |
| 1566 | -;// CONCATENATED MODULE: external ["wp","blockEditor"] | |
| 1567 | -var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; | |
| 1568 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/transformers.js | |
| 1569 | -/** | |
| 1570 | - * WordPress dependencies | |
| 1571 | - */ | |
| 1572 | - | |
| 1573 | - | |
| 1574 | -/** | |
| 1575 | - * Converts a widget entity record into a block. | |
| 1576 | - * | |
| 1577 | - * @param {Object} widget The widget entity record. | |
| 1578 | - * @return {Object} a block (converted from the entity record). | |
| 1579 | - */ | |
| 1580 | - | |
| 1581 | -function transformWidgetToBlock(widget) { | |
| 1582 | - if (widget.id_base === 'block') { | |
| 1583 | - const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content); | |
| 1584 | - | |
| 1585 | - if (!parsedBlocks.length) { | |
| 1586 | - return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}, []), widget.id); | |
| 1587 | - } | |
| 1588 | - | |
| 1589 | - return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(parsedBlocks[0], widget.id); | |
| 1590 | - } | |
| 1591 | - | |
| 1592 | - let attributes; | |
| 1593 | - | |
| 1594 | - if (widget._embedded.about[0].is_multi) { | |
| 1595 | - attributes = { | |
| 1596 | - idBase: widget.id_base, | |
| 1597 | - instance: widget.instance | |
| 1598 | - }; | |
| 1599 | - } else { | |
| 1600 | - attributes = { | |
| 1601 | - id: widget.id | |
| 1602 | - }; | |
| 1603 | - } | |
| 1604 | - | |
| 1605 | - return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', attributes, []), widget.id); | |
| 1606 | -} | |
| 1607 | -/** | |
| 1608 | - * Converts a block to a widget entity record. | |
| 1609 | - * | |
| 1610 | - * @param {Object} block The block. | |
| 1611 | - * @param {Object?} relatedWidget A related widget entity record from the API (optional). | |
| 1612 | - * @return {Object} the widget object (converted from block). | |
| 1613 | - */ | |
| 1614 | - | |
| 1615 | -function transformBlockToWidget(block) { | |
| 1616 | - let relatedWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 1617 | - let widget; | |
| 1618 | - const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance); | |
| 1619 | - | |
| 1620 | - if (isValidLegacyWidgetBlock) { | |
| 1621 | - var _block$attributes$id, _block$attributes$idB, _block$attributes$ins; | |
| 1622 | - | |
| 1623 | - widget = { ...relatedWidget, | |
| 1624 | - id: (_block$attributes$id = block.attributes.id) !== null && _block$attributes$id !== void 0 ? _block$attributes$id : relatedWidget.id, | |
| 1625 | - id_base: (_block$attributes$idB = block.attributes.idBase) !== null && _block$attributes$idB !== void 0 ? _block$attributes$idB : relatedWidget.id_base, | |
| 1626 | - instance: (_block$attributes$ins = block.attributes.instance) !== null && _block$attributes$ins !== void 0 ? _block$attributes$ins : relatedWidget.instance | |
| 1627 | - }; | |
| 1628 | - } else { | |
| 1629 | - widget = { ...relatedWidget, | |
| 1630 | - id_base: 'block', | |
| 1631 | - instance: { | |
| 1632 | - raw: { | |
| 1633 | - content: (0,external_wp_blocks_namespaceObject.serialize)(block) | |
| 1634 | - } | |
| 1635 | - } | |
| 1636 | - }; | |
| 1637 | - } // Delete read-only properties. | |
| 1638 | - | |
| 1639 | - | |
| 1640 | - delete widget.rendered; | |
| 1641 | - delete widget.rendered_form; | |
| 1642 | - return widget; | |
| 1643 | -} | |
| 1644 | -//# sourceMappingURL=transformers.js.map | |
| 1645 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/utils.js | |
| 1646 | -/** | |
| 1647 | - * "Kind" of the navigation post. | |
| 1648 | - * | |
| 1649 | - * @type {string} | |
| 1650 | - */ | |
| 1651 | -const KIND = 'root'; | |
| 1652 | -/** | |
| 1653 | - * "post type" of the navigation post. | |
| 1654 | - * | |
| 1655 | - * @type {string} | |
| 1656 | - */ | |
| 1657 | - | |
| 1658 | -const WIDGET_AREA_ENTITY_TYPE = 'sidebar'; | |
| 1659 | -/** | |
| 1660 | - * "post type" of the widget area post. | |
| 1661 | - * | |
| 1662 | - * @type {string} | |
| 1663 | - */ | |
| 1664 | - | |
| 1665 | -const POST_TYPE = 'postType'; | |
| 1666 | -/** | |
| 1667 | - * Builds an ID for a new widget area post. | |
| 1668 | - * | |
| 1669 | - * @param {number} widgetAreaId Widget area id. | |
| 1670 | - * @return {string} An ID. | |
| 1671 | - */ | |
| 1672 | - | |
| 1673 | -const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`; | |
| 1674 | -/** | |
| 1675 | - * Builds an ID for a global widget areas post. | |
| 1676 | - * | |
| 1677 | - * @return {string} An ID. | |
| 1678 | - */ | |
| 1679 | - | |
| 1680 | -const buildWidgetAreasPostId = () => `widget-areas`; | |
| 1681 | -/** | |
| 1682 | - * Builds a query to resolve sidebars. | |
| 1683 | - * | |
| 1684 | - * @return {Object} Query. | |
| 1685 | - */ | |
| 1686 | - | |
| 1687 | -function buildWidgetAreasQuery() { | |
| 1688 | - return { | |
| 1689 | - per_page: -1 | |
| 1690 | - }; | |
| 1691 | -} | |
| 1692 | -/** | |
| 1693 | - * Builds a query to resolve widgets. | |
| 1694 | - * | |
| 1695 | - * @return {Object} Query. | |
| 1696 | - */ | |
| 1697 | - | |
| 1698 | -function buildWidgetsQuery() { | |
| 1699 | - return { | |
| 1700 | - per_page: -1, | |
| 1701 | - _embed: 'about' | |
| 1702 | - }; | |
| 1703 | -} | |
| 1704 | -/** | |
| 1705 | - * Creates a stub post with given id and set of blocks. Used as a governing entity records | |
| 1706 | - * for all widget areas. | |
| 1707 | - * | |
| 1708 | - * @param {string} id Post ID. | |
| 1709 | - * @param {Array} blocks The list of blocks. | |
| 1710 | - * @return {Object} A stub post object formatted in compliance with the data layer. | |
| 1711 | - */ | |
| 1712 | - | |
| 1713 | -const createStubPost = (id, blocks) => ({ | |
| 1714 | - id, | |
| 1715 | - slug: id, | |
| 1716 | - status: 'draft', | |
| 1717 | - type: 'page', | |
| 1718 | - blocks, | |
| 1719 | - meta: { | |
| 1720 | - widgetAreaId: id | |
| 1721 | - } | |
| 1722 | -}); | |
| 1723 | -//# sourceMappingURL=utils.js.map | |
| 1724 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/constants.js | |
| 1725 | -/** | |
| 1726 | - * Module Constants | |
| 1727 | - */ | |
| 1728 | -const constants_STORE_NAME = 'core/edit-widgets'; | |
| 1729 | -//# sourceMappingURL=constants.js.map | |
| 1730 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/actions.js | |
| 1731 | -/** | |
| 1732 | - * WordPress dependencies | |
| 1733 | - */ | |
| 1734 | - | |
| 1735 | - | |
| 1736 | - | |
| 1737 | - | |
| 1738 | - | |
| 1739 | - | |
| 1740 | -/** | |
| 1741 | - * Internal dependencies | |
| 1742 | - */ | |
| 1743 | - | |
| 1744 | - | |
| 1745 | - | |
| 1746 | - | |
| 1747 | -/** | |
| 1748 | - * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and | |
| 1749 | - * shouldn't be saved via the API. | |
| 1750 | - * | |
| 1751 | - * @param {string} id Post ID. | |
| 1752 | - * @param {Array} blocks Blocks the post should consist of. | |
| 1753 | - * @return {Object} The post object. | |
| 1754 | - */ | |
| 1755 | - | |
| 1756 | -const persistStubPost = (id, blocks) => _ref => { | |
| 1757 | - let { | |
| 1758 | - registry | |
| 1759 | - } = _ref; | |
| 1760 | - const stubPost = createStubPost(id, blocks); | |
| 1761 | - registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, stubPost, { | |
| 1762 | - id: stubPost.id | |
| 1763 | - }, false); | |
| 1764 | - return stubPost; | |
| 1765 | -}; | |
| 1766 | -/** | |
| 1767 | - * Converts all the blocks from edited widget areas into widgets, | |
| 1768 | - * and submits a batch request to save everything at once. | |
| 1769 | - * | |
| 1770 | - * Creates a snackbar notice on either success or error. | |
| 1771 | - * | |
| 1772 | - * @return {Function} An action creator. | |
| 1773 | - */ | |
| 1774 | - | |
| 1775 | -const saveEditedWidgetAreas = () => async _ref2 => { | |
| 1776 | - let { | |
| 1777 | - select, | |
| 1778 | - dispatch, | |
| 1779 | - registry | |
| 1780 | - } = _ref2; | |
| 1781 | - const editedWidgetAreas = select.getEditedWidgetAreas(); | |
| 1782 | - | |
| 1783 | - if (!(editedWidgetAreas !== null && editedWidgetAreas !== void 0 && editedWidgetAreas.length)) { | |
| 1784 | - return; | |
| 1785 | - } | |
| 1786 | - | |
| 1787 | - try { | |
| 1788 | - await dispatch.saveWidgetAreas(editedWidgetAreas); | |
| 1789 | - registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Widgets saved.'), { | |
| 1790 | - type: 'snackbar' | |
| 1791 | - }); | |
| 1792 | - } catch (e) { | |
| 1793 | - registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( | |
| 1794 | - /* translators: %s: The error message. */ | |
| 1795 | - (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('There was an error. %s'), e.message), { | |
| 1796 | - type: 'snackbar' | |
| 1797 | - }); | |
| 1798 | - } | |
| 1799 | -}; | |
| 1800 | -/** | |
| 1801 | - * Converts all the blocks from specified widget areas into widgets, | |
| 1802 | - * and submits a batch request to save everything at once. | |
| 1803 | - * | |
| 1804 | - * @param {Object[]} widgetAreas Widget areas to save. | |
| 1805 | - * @return {Function} An action creator. | |
| 1806 | - */ | |
| 1807 | - | |
| 1808 | -const saveWidgetAreas = widgetAreas => async _ref3 => { | |
| 1809 | - let { | |
| 1810 | - dispatch, | |
| 1811 | - registry | |
| 1812 | - } = _ref3; | |
| 1813 | - | |
| 1814 | - try { | |
| 1815 | - for (const widgetArea of widgetAreas) { | |
| 1816 | - await dispatch.saveWidgetArea(widgetArea.id); | |
| 1817 | - } | |
| 1818 | - } finally { | |
| 1819 | - // saveEditedEntityRecord resets the resolution status, let's fix it manually | |
| 1820 | - await registry.dispatch(external_wp_coreData_namespaceObject.store).finishResolution('getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery()); | |
| 1821 | - } | |
| 1822 | -}; | |
| 1823 | -/** | |
| 1824 | - * Converts all the blocks from a widget area specified by ID into widgets, | |
| 1825 | - * and submits a batch request to save everything at once. | |
| 1826 | - * | |
| 1827 | - * @param {string} widgetAreaId ID of the widget area to process. | |
| 1828 | - * @return {Function} An action creator. | |
| 1829 | - */ | |
| 1830 | - | |
| 1831 | -const saveWidgetArea = widgetAreaId => async _ref4 => { | |
| 1832 | - let { | |
| 1833 | - dispatch, | |
| 1834 | - select, | |
| 1835 | - registry | |
| 1836 | - } = _ref4; | |
| 1837 | - const widgets = select.getWidgets(); | |
| 1838 | - const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId)); // Get all widgets from this area | |
| 1839 | - | |
| 1840 | - const areaWidgets = Object.values(widgets).filter(_ref5 => { | |
| 1841 | - let { | |
| 1842 | - sidebar | |
| 1843 | - } = _ref5; | |
| 1844 | - return sidebar === widgetAreaId; | |
| 1845 | - }); // Remove all duplicate reference widget instances for legacy widgets. | |
| 1846 | - // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget | |
| 1847 | - // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to | |
| 1848 | - // save multiple instances of these in different sidebars you will run into undefined behaviors. | |
| 1849 | - | |
| 1850 | - const usedReferenceWidgets = []; | |
| 1851 | - const widgetsBlocks = post.blocks.filter(block => { | |
| 1852 | - const { | |
| 1853 | - id | |
| 1854 | - } = block.attributes; | |
| 1855 | - | |
| 1856 | - if (block.name === 'core/legacy-widget' && id) { | |
| 1857 | - if (usedReferenceWidgets.includes(id)) { | |
| 1858 | - return false; | |
| 1859 | - } | |
| 1860 | - | |
| 1861 | - usedReferenceWidgets.push(id); | |
| 1862 | - } | |
| 1863 | - | |
| 1864 | - return true; | |
| 1865 | - }); // Determine which widgets have been deleted. We can tell if a widget is | |
| 1866 | - // deleted and not just moved to a different area by looking to see if | |
| 1867 | - // getWidgetAreaForWidgetId() finds something. | |
| 1868 | - | |
| 1869 | - const deletedWidgets = []; | |
| 1870 | - | |
| 1871 | - for (const widget of areaWidgets) { | |
| 1872 | - const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id); | |
| 1873 | - | |
| 1874 | - if (!widgetsNewArea) { | |
| 1875 | - deletedWidgets.push(widget); | |
| 1876 | - } | |
| 1877 | - } | |
| 1878 | - | |
| 1879 | - const batchMeta = []; | |
| 1880 | - const batchTasks = []; | |
| 1881 | - const sidebarWidgetsIds = []; | |
| 1882 | - | |
| 1883 | - for (let i = 0; i < widgetsBlocks.length; i++) { | |
| 1884 | - const block = widgetsBlocks[i]; | |
| 1885 | - const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block); | |
| 1886 | - const oldWidget = widgets[widgetId]; | |
| 1887 | - const widget = transformBlockToWidget(block, oldWidget); // We'll replace the null widgetId after save, but we track it here | |
| 1888 | - // since order is important. | |
| 1889 | - | |
| 1890 | - sidebarWidgetsIds.push(widgetId); // Check oldWidget as widgetId might refer to an ID which has been | |
| 1891 | - // deleted, e.g. if a deleted block is restored via undo after saving. | |
| 1892 | - | |
| 1893 | - if (oldWidget) { | |
| 1894 | - // Update an existing widget. | |
| 1895 | - registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('root', 'widget', widgetId, { ...widget, | |
| 1896 | - sidebar: widgetAreaId | |
| 1897 | - }, { | |
| 1898 | - undoIgnore: true | |
| 1899 | - }); | |
| 1900 | - const hasEdits = registry.select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('root', 'widget', widgetId); | |
| 1901 | - | |
| 1902 | - if (!hasEdits) { | |
| 1903 | - continue; | |
| 1904 | - } | |
| 1905 | - | |
| 1906 | - batchTasks.push(_ref6 => { | |
| 1907 | - let { | |
| 1908 | - saveEditedEntityRecord | |
| 1909 | - } = _ref6; | |
| 1910 | - return saveEditedEntityRecord('root', 'widget', widgetId); | |
| 1911 | - }); | |
| 1912 | - } else { | |
| 1913 | - // Create a new widget. | |
| 1914 | - batchTasks.push(_ref7 => { | |
| 1915 | - let { | |
| 1916 | - saveEntityRecord | |
| 1917 | - } = _ref7; | |
| 1918 | - return saveEntityRecord('root', 'widget', { ...widget, | |
| 1919 | - sidebar: widgetAreaId | |
| 1920 | - }); | |
| 1921 | - }); | |
| 1922 | - } | |
| 1923 | - | |
| 1924 | - batchMeta.push({ | |
| 1925 | - block, | |
| 1926 | - position: i, | |
| 1927 | - clientId: block.clientId | |
| 1928 | - }); | |
| 1929 | - } | |
| 1930 | - | |
| 1931 | - for (const widget of deletedWidgets) { | |
| 1932 | - batchTasks.push(_ref8 => { | |
| 1933 | - let { | |
| 1934 | - deleteEntityRecord | |
| 1935 | - } = _ref8; | |
| 1936 | - return deleteEntityRecord('root', 'widget', widget.id, { | |
| 1937 | - force: true | |
| 1938 | - }); | |
| 1939 | - }); | |
| 1940 | - } | |
| 1941 | - | |
| 1942 | - const records = await registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalBatch(batchTasks); | |
| 1943 | - const preservedRecords = records.filter(record => !record.hasOwnProperty('deleted')); | |
| 1944 | - const failedWidgetNames = []; | |
| 1945 | - | |
| 1946 | - for (let i = 0; i < preservedRecords.length; i++) { | |
| 1947 | - const widget = preservedRecords[i]; | |
| 1948 | - const { | |
| 1949 | - block, | |
| 1950 | - position | |
| 1951 | - } = batchMeta[i]; // Set __internalWidgetId on the block. This will be persisted to the | |
| 1952 | - // store when we dispatch receiveEntityRecords( post ) below. | |
| 1953 | - | |
| 1954 | - post.blocks[position].attributes.__internalWidgetId = widget.id; | |
| 1955 | - const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('root', 'widget', widget.id); | |
| 1956 | - | |
| 1957 | - if (error) { | |
| 1958 | - var _block$attributes; | |
| 1959 | - | |
| 1960 | - failedWidgetNames.push(((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.name) || (block === null || block === void 0 ? void 0 : block.name)); | |
| 1961 | - } | |
| 1962 | - | |
| 1963 | - if (!sidebarWidgetsIds[position]) { | |
| 1964 | - sidebarWidgetsIds[position] = widget.id; | |
| 1965 | - } | |
| 1966 | - } | |
| 1967 | - | |
| 1968 | - if (failedWidgetNames.length) { | |
| 1969 | - throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( | |
| 1970 | - /* translators: %s: List of widget names */ | |
| 1971 | - (0,external_wp_i18n_namespaceObject.__)('Could not save the following widgets: %s.'), failedWidgetNames.join(', '))); | |
| 1972 | - } | |
| 1973 | - | |
| 1974 | - registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { | |
| 1975 | - widgets: sidebarWidgetsIds | |
| 1976 | - }, { | |
| 1977 | - undoIgnore: true | |
| 1978 | - }); | |
| 1979 | - dispatch(trySaveWidgetArea(widgetAreaId)); | |
| 1980 | - registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, post, undefined); | |
| 1981 | -}; | |
| 1982 | - | |
| 1983 | -const trySaveWidgetArea = widgetAreaId => _ref9 => { | |
| 1984 | - let { | |
| 1985 | - registry | |
| 1986 | - } = _ref9; | |
| 1987 | - const saveErrorBefore = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); | |
| 1988 | - registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); | |
| 1989 | - const saveErrorAfter = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); | |
| 1990 | - | |
| 1991 | - if (saveErrorAfter && saveErrorBefore !== saveErrorAfter) { | |
| 1992 | - throw new Error(saveErrorAfter); | |
| 1993 | - } | |
| 1994 | -}; | |
| 1995 | -/** | |
| 1996 | - * Sets the clientId stored for a particular widgetId. | |
| 1997 | - * | |
| 1998 | - * @param {number} clientId Client id. | |
| 1999 | - * @param {number} widgetId Widget id. | |
| 2000 | - * | |
| 2001 | - * @return {Object} Action. | |
| 2002 | - */ | |
| 2003 | - | |
| 2004 | - | |
| 2005 | -function setWidgetIdForClientId(clientId, widgetId) { | |
| 2006 | - return { | |
| 2007 | - type: 'SET_WIDGET_ID_FOR_CLIENT_ID', | |
| 2008 | - clientId, | |
| 2009 | - widgetId | |
| 2010 | - }; | |
| 2011 | -} | |
| 2012 | -/** | |
| 2013 | - * Sets the open state of all the widget areas. | |
| 2014 | - * | |
| 2015 | - * @param {Object} widgetAreasOpenState The open states of all the widget areas. | |
| 2016 | - * | |
| 2017 | - * @return {Object} Action. | |
| 2018 | - */ | |
| 2019 | - | |
| 2020 | -function setWidgetAreasOpenState(widgetAreasOpenState) { | |
| 2021 | - return { | |
| 2022 | - type: 'SET_WIDGET_AREAS_OPEN_STATE', | |
| 2023 | - widgetAreasOpenState | |
| 2024 | - }; | |
| 2025 | -} | |
| 2026 | -/** | |
| 2027 | - * Sets the open state of the widget area. | |
| 2028 | - * | |
| 2029 | - * @param {string} clientId The clientId of the widget area. | |
| 2030 | - * @param {boolean} isOpen Whether the widget area should be opened. | |
| 2031 | - * | |
| 2032 | - * @return {Object} Action. | |
| 2033 | - */ | |
| 2034 | - | |
| 2035 | -function setIsWidgetAreaOpen(clientId, isOpen) { | |
| 2036 | - return { | |
| 2037 | - type: 'SET_IS_WIDGET_AREA_OPEN', | |
| 2038 | - clientId, | |
| 2039 | - isOpen | |
| 2040 | - }; | |
| 2041 | -} | |
| 2042 | -/** | |
| 2043 | - * Returns an action object used to open/close the inserter. | |
| 2044 | - * | |
| 2045 | - * @param {boolean|Object} value Whether the inserter should be | |
| 2046 | - * opened (true) or closed (false). | |
| 2047 | - * To specify an insertion point, | |
| 2048 | - * use an object. | |
| 2049 | - * @param {string} value.rootClientId The root client ID to insert at. | |
| 2050 | - * @param {number} value.insertionIndex The index to insert at. | |
| 2051 | - * | |
| 2052 | - * @return {Object} Action object. | |
| 2053 | - */ | |
| 2054 | - | |
| 2055 | -function setIsInserterOpened(value) { | |
| 2056 | - return { | |
| 2057 | - type: 'SET_IS_INSERTER_OPENED', | |
| 2058 | - value | |
| 2059 | - }; | |
| 2060 | -} | |
| 2061 | -/** | |
| 2062 | - * Returns an action object used to open/close the list view. | |
| 2063 | - * | |
| 2064 | - * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. | |
| 2065 | - * @return {Object} Action object. | |
| 2066 | - */ | |
| 2067 | - | |
| 2068 | -function setIsListViewOpened(isOpen) { | |
| 2069 | - return { | |
| 2070 | - type: 'SET_IS_LIST_VIEW_OPENED', | |
| 2071 | - isOpen | |
| 2072 | - }; | |
| 2073 | -} | |
| 2074 | -/** | |
| 2075 | - * Returns an action object signalling that the user closed the sidebar. | |
| 2076 | - * | |
| 2077 | - * @return {Object} Action creator. | |
| 2078 | - */ | |
| 2079 | - | |
| 2080 | -const closeGeneralSidebar = () => _ref10 => { | |
| 2081 | - let { | |
| 2082 | - registry | |
| 2083 | - } = _ref10; | |
| 2084 | - registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME); | |
| 2085 | -}; | |
| 2086 | -/** | |
| 2087 | - * Action that handles moving a block between widget areas | |
| 2088 | - * | |
| 2089 | - * @param {string} clientId The clientId of the block to move. | |
| 2090 | - * @param {string} widgetAreaId The id of the widget area to move the block to. | |
| 2091 | - */ | |
| 2092 | - | |
| 2093 | -const moveBlockToWidgetArea = (clientId, widgetAreaId) => async _ref11 => { | |
| 2094 | - let { | |
| 2095 | - dispatch, | |
| 2096 | - select, | |
| 2097 | - registry | |
| 2098 | - } = _ref11; | |
| 2099 | - const sourceRootClientId = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockRootClientId([clientId]); // Search the top level blocks (widget areas) for the one with the matching | |
| 2100 | - // id attribute. Makes the assumption that all top-level blocks are widget | |
| 2101 | - // areas. | |
| 2102 | - | |
| 2103 | - const widgetAreas = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(); | |
| 2104 | - const destinationWidgetAreaBlock = widgetAreas.find(_ref12 => { | |
| 2105 | - let { | |
| 2106 | - attributes | |
| 2107 | - } = _ref12; | |
| 2108 | - return attributes.id === widgetAreaId; | |
| 2109 | - }); | |
| 2110 | - const destinationRootClientId = destinationWidgetAreaBlock.clientId; // Get the index for moving to the end of the the destination widget area. | |
| 2111 | - | |
| 2112 | - const destinationInnerBlocksClientIds = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(destinationRootClientId); | |
| 2113 | - const destinationIndex = destinationInnerBlocksClientIds.length; // Reveal the widget area, if it's not open. | |
| 2114 | - | |
| 2115 | - const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(destinationRootClientId); | |
| 2116 | - | |
| 2117 | - if (!isDestinationWidgetAreaOpen) { | |
| 2118 | - dispatch.setIsWidgetAreaOpen(destinationRootClientId, true); | |
| 2119 | - } // Move the block. | |
| 2120 | - | |
| 2121 | - | |
| 2122 | - registry.dispatch(external_wp_blockEditor_namespaceObject.store).moveBlocksToPosition([clientId], sourceRootClientId, destinationRootClientId, destinationIndex); | |
| 2123 | -}; | |
| 2124 | -//# sourceMappingURL=actions.js.map | |
| 2125 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/resolvers.js | |
| 2126 | -/** | |
| 2127 | - * WordPress dependencies | |
| 2128 | - */ | |
| 2129 | - | |
| 2130 | - | |
| 2131 | -/** | |
| 2132 | - * Internal dependencies | |
| 2133 | - */ | |
| 2134 | - | |
| 2135 | - | |
| 2136 | - | |
| 2137 | - | |
| 2138 | -/** | |
| 2139 | - * Creates a "stub" widgets post reflecting all available widget areas. The | |
| 2140 | - * post is meant as a convenient to only exists in runtime and should never be saved. It | |
| 2141 | - * enables a convenient way of editing the widgets by using a regular post editor. | |
| 2142 | - * | |
| 2143 | - * Fetches all widgets from all widgets aras, converts them into blocks, and hydrates a new post with them. | |
| 2144 | - * | |
| 2145 | - * @return {Function} An action creator. | |
| 2146 | - */ | |
| 2147 | - | |
| 2148 | -const getWidgetAreas = () => async _ref => { | |
| 2149 | - let { | |
| 2150 | - dispatch, | |
| 2151 | - registry | |
| 2152 | - } = _ref; | |
| 2153 | - const query = buildWidgetAreasQuery(); | |
| 2154 | - const widgetAreas = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); | |
| 2155 | - const widgetAreaBlocks = []; | |
| 2156 | - const sortedWidgetAreas = widgetAreas.sort((a, b) => { | |
| 2157 | - if (a.id === 'wp_inactive_widgets') { | |
| 2158 | - return 1; | |
| 2159 | - } | |
| 2160 | - | |
| 2161 | - if (b.id === 'wp_inactive_widgets') { | |
| 2162 | - return -1; | |
| 2163 | - } | |
| 2164 | - | |
| 2165 | - return 0; | |
| 2166 | - }); | |
| 2167 | - | |
| 2168 | - for (const widgetArea of sortedWidgetAreas) { | |
| 2169 | - widgetAreaBlocks.push((0,external_wp_blocks_namespaceObject.createBlock)('core/widget-area', { | |
| 2170 | - id: widgetArea.id, | |
| 2171 | - name: widgetArea.name | |
| 2172 | - })); | |
| 2173 | - | |
| 2174 | - if (!widgetArea.widgets.length) { | |
| 2175 | - // If this widget area has no widgets, it won't get a post setup by | |
| 2176 | - // the getWidgets resolver. | |
| 2177 | - dispatch(persistStubPost(buildWidgetAreaPostId(widgetArea.id), [])); | |
| 2178 | - } | |
| 2179 | - } | |
| 2180 | - | |
| 2181 | - const widgetAreasOpenState = {}; | |
| 2182 | - widgetAreaBlocks.forEach((widgetAreaBlock, index) => { | |
| 2183 | - // Defaults to open the first widget area. | |
| 2184 | - widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0; | |
| 2185 | - }); | |
| 2186 | - dispatch(setWidgetAreasOpenState(widgetAreasOpenState)); | |
| 2187 | - dispatch(persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks)); | |
| 2188 | -}; | |
| 2189 | -/** | |
| 2190 | - * Fetches all widgets from all widgets ares, and groups them by widget area Id. | |
| 2191 | - * | |
| 2192 | - * @return {Function} An action creator. | |
| 2193 | - */ | |
| 2194 | - | |
| 2195 | -const getWidgets = () => async _ref2 => { | |
| 2196 | - let { | |
| 2197 | - dispatch, | |
| 2198 | - registry | |
| 2199 | - } = _ref2; | |
| 2200 | - const query = buildWidgetsQuery(); | |
| 2201 | - const widgets = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', query); | |
| 2202 | - const groupedBySidebar = {}; | |
| 2203 | - | |
| 2204 | - for (const widget of widgets) { | |
| 2205 | - const block = transformWidgetToBlock(widget); | |
| 2206 | - groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; | |
| 2207 | - groupedBySidebar[widget.sidebar].push(block); | |
| 2208 | - } | |
| 2209 | - | |
| 2210 | - for (const sidebarId in groupedBySidebar) { | |
| 2211 | - if (groupedBySidebar.hasOwnProperty(sidebarId)) { | |
| 2212 | - // Persist the actual post containing the widget block | |
| 2213 | - dispatch(persistStubPost(buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId])); | |
| 2214 | - } | |
| 2215 | - } | |
| 2216 | -}; | |
| 2217 | -//# sourceMappingURL=resolvers.js.map | |
| 2218 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/selectors.js | |
| 2219 | -/** | |
| 2220 | - * External dependencies | |
| 2221 | - */ | |
| 2222 | - | |
| 2223 | -/** | |
| 2224 | - * WordPress dependencies | |
| 2225 | - */ | |
| 2226 | - | |
| 2227 | - | |
| 2228 | - | |
| 2229 | - | |
| 2230 | - | |
| 2231 | -/** | |
| 2232 | - * Internal dependencies | |
| 2233 | - */ | |
| 2234 | - | |
| 2235 | - | |
| 2236 | - | |
| 2237 | -/** | |
| 2238 | - * Returns all API widgets. | |
| 2239 | - * | |
| 2240 | - * @return {Object[]} API List of widgets. | |
| 2241 | - */ | |
| 2242 | - | |
| 2243 | -const selectors_getWidgets = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { | |
| 2244 | - const widgets = select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', buildWidgetsQuery()); | |
| 2245 | - return (0,external_lodash_namespaceObject.keyBy)(widgets, 'id'); | |
| 2246 | -}); | |
| 2247 | -/** | |
| 2248 | - * Returns API widget data for a particular widget ID. | |
| 2249 | - * | |
| 2250 | - * @param {number} id Widget ID. | |
| 2251 | - * | |
| 2252 | - * @return {Object} API widget data for a particular widget ID. | |
| 2253 | - */ | |
| 2254 | - | |
| 2255 | -const getWidget = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, id) => { | |
| 2256 | - const widgets = select(constants_STORE_NAME).getWidgets(); | |
| 2257 | - return widgets[id]; | |
| 2258 | -}); | |
| 2259 | -/** | |
| 2260 | - * Returns all API widget areas. | |
| 2261 | - * | |
| 2262 | - * @return {Object[]} API List of widget areas. | |
| 2263 | - */ | |
| 2264 | - | |
| 2265 | -const selectors_getWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { | |
| 2266 | - const query = buildWidgetAreasQuery(); | |
| 2267 | - return select(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); | |
| 2268 | -}); | |
| 2269 | -/** | |
| 2270 | - * Returns widgetArea containing a block identify by given widgetId | |
| 2271 | - * | |
| 2272 | - * @param {string} widgetId The ID of the widget. | |
| 2273 | - * @return {Object} Containing widget area. | |
| 2274 | - */ | |
| 2275 | - | |
| 2276 | -const getWidgetAreaForWidgetId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, widgetId) => { | |
| 2277 | - const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); | |
| 2278 | - return widgetAreas.find(widgetArea => { | |
| 2279 | - const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id)); | |
| 2280 | - const blockWidgetIds = post.blocks.map(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block)); | |
| 2281 | - return blockWidgetIds.includes(widgetId); | |
| 2282 | - }); | |
| 2283 | -}); | |
| 2284 | -/** | |
| 2285 | - * Given a child client id, returns the parent widget area block. | |
| 2286 | - * | |
| 2287 | - * @param {string} clientId The client id of a block in a widget area. | |
| 2288 | - * | |
| 2289 | - * @return {WPBlock} The widget area block. | |
| 2290 | - */ | |
| 2291 | - | |
| 2292 | -const getParentWidgetAreaBlock = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId) => { | |
| 2293 | - const { | |
| 2294 | - getBlock, | |
| 2295 | - getBlockName, | |
| 2296 | - getBlockParents | |
| 2297 | - } = select(external_wp_blockEditor_namespaceObject.store); | |
| 2298 | - const blockParents = getBlockParents(clientId); | |
| 2299 | - const widgetAreaClientId = blockParents.find(parentClientId => getBlockName(parentClientId) === 'core/widget-area'); | |
| 2300 | - return getBlock(widgetAreaClientId); | |
| 2301 | -}); | |
| 2302 | -/** | |
| 2303 | - * Returns all edited widget area entity records. | |
| 2304 | - * | |
| 2305 | - * @return {Object[]} List of edited widget area entity records. | |
| 2306 | - */ | |
| 2307 | - | |
| 2308 | -const getEditedWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ids) => { | |
| 2309 | - let widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); | |
| 2310 | - | |
| 2311 | - if (!widgetAreas) { | |
| 2312 | - return []; | |
| 2313 | - } | |
| 2314 | - | |
| 2315 | - if (ids) { | |
| 2316 | - widgetAreas = widgetAreas.filter(_ref => { | |
| 2317 | - let { | |
| 2318 | - id | |
| 2319 | - } = _ref; | |
| 2320 | - return ids.includes(id); | |
| 2321 | - }); | |
| 2322 | - } | |
| 2323 | - | |
| 2324 | - return widgetAreas.filter(_ref2 => { | |
| 2325 | - let { | |
| 2326 | - id | |
| 2327 | - } = _ref2; | |
| 2328 | - return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(id)); | |
| 2329 | - }).map(_ref3 => { | |
| 2330 | - let { | |
| 2331 | - id | |
| 2332 | - } = _ref3; | |
| 2333 | - return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id); | |
| 2334 | - }); | |
| 2335 | -}); | |
| 2336 | -/** | |
| 2337 | - * Returns all blocks representing reference widgets. | |
| 2338 | - * | |
| 2339 | - * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned. | |
| 2340 | - * @return {Array} List of all blocks representing reference widgets | |
| 2341 | - */ | |
| 2342 | - | |
| 2343 | -const getReferenceWidgetBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) { | |
| 2344 | - let referenceWidgetName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | |
| 2345 | - const results = []; | |
| 2346 | - const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); | |
| 2347 | - | |
| 2348 | - for (const _widgetArea of widgetAreas) { | |
| 2349 | - const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id)); | |
| 2350 | - | |
| 2351 | - for (const block of post.blocks) { | |
| 2352 | - var _block$attributes; | |
| 2353 | - | |
| 2354 | - if (block.name === 'core/legacy-widget' && (!referenceWidgetName || ((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.referenceWidgetName) === referenceWidgetName)) { | |
| 2355 | - results.push(block); | |
| 2356 | - } | |
| 2357 | - } | |
| 2358 | - } | |
| 2359 | - | |
| 2360 | - return results; | |
| 2361 | -}); | |
| 2362 | -/** | |
| 2363 | - * Returns true if any widget area is currently being saved. | |
| 2364 | - * | |
| 2365 | - * @return {boolean} True if any widget area is currently being saved. False otherwise. | |
| 2366 | - */ | |
| 2367 | - | |
| 2368 | -const isSavingWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { | |
| 2369 | - var _select$getWidgetArea; | |
| 2370 | - | |
| 2371 | - const widgetAreasIds = (_select$getWidgetArea = select(constants_STORE_NAME).getWidgetAreas()) === null || _select$getWidgetArea === void 0 ? void 0 : _select$getWidgetArea.map(_ref4 => { | |
| 2372 | - let { | |
| 2373 | - id | |
| 2374 | - } = _ref4; | |
| 2375 | - return id; | |
| 2376 | - }); | |
| 2377 | - | |
| 2378 | - if (!widgetAreasIds) { | |
| 2379 | - return false; | |
| 2380 | - } | |
| 2381 | - | |
| 2382 | - for (const id of widgetAreasIds) { | |
| 2383 | - const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id); | |
| 2384 | - | |
| 2385 | - if (isSaving) { | |
| 2386 | - return true; | |
| 2387 | - } | |
| 2388 | - } | |
| 2389 | - | |
| 2390 | - const widgetIds = [...Object.keys(select(constants_STORE_NAME).getWidgets()), undefined // account for new widgets without an ID | |
| 2391 | - ]; | |
| 2392 | - | |
| 2393 | - for (const id of widgetIds) { | |
| 2394 | - const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('root', 'widget', id); | |
| 2395 | - | |
| 2396 | - if (isSaving) { | |
| 2397 | - return true; | |
| 2398 | - } | |
| 2399 | - } | |
| 2400 | - | |
| 2401 | - return false; | |
| 2402 | -}); | |
| 2403 | -/** | |
| 2404 | - * Gets whether the widget area is opened. | |
| 2405 | - * | |
| 2406 | - * @param {Array} state The open state of the widget areas. | |
| 2407 | - * @param {string} clientId The clientId of the widget area. | |
| 2408 | - * | |
| 2409 | - * @return {boolean} True if the widget area is open. | |
| 2410 | - */ | |
| 2411 | - | |
| 2412 | -const getIsWidgetAreaOpen = (state, clientId) => { | |
| 2413 | - const { | |
| 2414 | - widgetAreasOpenState | |
| 2415 | - } = state; | |
| 2416 | - return !!widgetAreasOpenState[clientId]; | |
| 2417 | -}; | |
| 2418 | -/** | |
| 2419 | - * Returns true if the inserter is opened. | |
| 2420 | - * | |
| 2421 | - * @param {Object} state Global application state. | |
| 2422 | - * | |
| 2423 | - * @return {boolean} Whether the inserter is opened. | |
| 2424 | - */ | |
| 2425 | - | |
| 2426 | -function isInserterOpened(state) { | |
| 2427 | - return !!state.blockInserterPanel; | |
| 2428 | -} | |
| 2429 | -/** | |
| 2430 | - * Get the insertion point for the inserter. | |
| 2431 | - * | |
| 2432 | - * @param {Object} state Global application state. | |
| 2433 | - * | |
| 2434 | - * @return {Object} The root client ID and index to insert at. | |
| 2435 | - */ | |
| 2436 | - | |
| 2437 | -function __experimentalGetInsertionPoint(state) { | |
| 2438 | - const { | |
| 2439 | - rootClientId, | |
| 2440 | - insertionIndex | |
| 2441 | - } = state.blockInserterPanel; | |
| 2442 | - return { | |
| 2443 | - rootClientId, | |
| 2444 | - insertionIndex | |
| 2445 | - }; | |
| 2446 | -} | |
| 2447 | -/** | |
| 2448 | - * Returns true if a block can be inserted into a widget area. | |
| 2449 | - * | |
| 2450 | - * @param {Array} state The open state of the widget areas. | |
| 2451 | - * @param {string} blockName The name of the block being inserted. | |
| 2452 | - * | |
| 2453 | - * @return {boolean} True if the block can be inserted in a widget area. | |
| 2454 | - */ | |
| 2455 | - | |
| 2456 | -const canInsertBlockInWidgetArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, blockName) => { | |
| 2457 | - // Widget areas are always top-level blocks, which getBlocks will return. | |
| 2458 | - const widgetAreas = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); // Makes an assumption that a block that can be inserted into one | |
| 2459 | - // widget area can be inserted into any widget area. Uses the first | |
| 2460 | - // widget area for testing whether the block can be inserted. | |
| 2461 | - | |
| 2462 | - const [firstWidgetArea] = widgetAreas; | |
| 2463 | - return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, firstWidgetArea.clientId); | |
| 2464 | -}); | |
| 2465 | -/** | |
| 2466 | - * Returns true if the list view is opened. | |
| 2467 | - * | |
| 2468 | - * @param {Object} state Global application state. | |
| 2469 | - * | |
| 2470 | - * @return {boolean} Whether the list view is opened. | |
| 2471 | - */ | |
| 2472 | - | |
| 2473 | -function isListViewOpened(state) { | |
| 2474 | - return state.listViewPanel; | |
| 2475 | -} | |
| 2476 | -//# sourceMappingURL=selectors.js.map | |
| 2477 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/store/index.js | |
| 2478 | -/** | |
| 2479 | - * WordPress dependencies | |
| 2480 | - */ | |
| 2481 | - | |
| 2482 | - | |
| 2483 | -/** | |
| 2484 | - * Internal dependencies | |
| 2485 | - */ | |
| 2486 | - | |
| 2487 | - | |
| 2488 | - | |
| 2489 | - | |
| 2490 | - | |
| 2491 | - | |
| 2492 | -/** | |
| 2493 | - * Block editor data store configuration. | |
| 2494 | - * | |
| 2495 | - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore | |
| 2496 | - * | |
| 2497 | - * @type {Object} | |
| 2498 | - */ | |
| 2499 | - | |
| 2500 | -const storeConfig = { | |
| 2501 | - reducer: store_reducer, | |
| 2502 | - selectors: store_selectors_namespaceObject, | |
| 2503 | - resolvers: resolvers_namespaceObject, | |
| 2504 | - actions: store_actions_namespaceObject, | |
| 2505 | - __experimentalUseThunks: true | |
| 2506 | -}; | |
| 2507 | -/** | |
| 2508 | - * Store definition for the edit widgets namespace. | |
| 2509 | - * | |
| 2510 | - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore | |
| 2511 | - * | |
| 2512 | - * @type {Object} | |
| 2513 | - */ | |
| 2514 | - | |
| 2515 | -const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig); // Once we build a more generic persistence plugin that works across types of stores | |
| 2516 | -// we'd be able to replace this with a register call. | |
| 2517 | - | |
| 2518 | -(0,external_wp_data_namespaceObject.registerStore)(constants_STORE_NAME, storeConfig); // This package uses a few in-memory post types as wrappers for convenience. | |
| 2519 | -// This middleware prevents any network requests related to these types as they are | |
| 2520 | -// bound to fail anyway. | |
| 2521 | - | |
| 2522 | -external_wp_apiFetch_default().use(function (options, next) { | |
| 2523 | - var _options$path; | |
| 2524 | - | |
| 2525 | - if (((_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.indexOf('/wp/v2/types/widget-area')) === 0) { | |
| 2526 | - return Promise.resolve({}); | |
| 2527 | - } | |
| 2528 | - | |
| 2529 | - return next(options); | |
| 2530 | -}); | |
| 2531 | -//# sourceMappingURL=index.js.map | |
| 2532 | -;// CONCATENATED MODULE: external ["wp","hooks"] | |
| 2533 | -var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; | |
| 2534 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/filters/move-to-widget-area.js | |
| 2535 | - | |
| 2536 | - | |
| 2537 | -/** | |
| 2538 | - * WordPress dependencies | |
| 2539 | - */ | |
| 2540 | - | |
| 2541 | - | |
| 2542 | - | |
| 2543 | - | |
| 2544 | - | |
| 2545 | -/** | |
| 2546 | - * Internal dependencies | |
| 2547 | - */ | |
| 2548 | - | |
| 2549 | - | |
| 2550 | -const withMoveToWidgetAreaToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { | |
| 2551 | - const { | |
| 2552 | - clientId, | |
| 2553 | - name: blockName | |
| 2554 | - } = props; | |
| 2555 | - const { | |
| 2556 | - widgetAreas, | |
| 2557 | - currentWidgetAreaId, | |
| 2558 | - canInsertBlockInWidgetArea | |
| 2559 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 2560 | - var _widgetAreaBlock$attr; | |
| 2561 | - | |
| 2562 | - // Component won't display for a widget area, so don't run selectors. | |
| 2563 | - if (blockName === 'core/widget-area') { | |
| 2564 | - return {}; | |
| 2565 | - } | |
| 2566 | - | |
| 2567 | - const selectors = select(store_store); | |
| 2568 | - const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId); | |
| 2569 | - return { | |
| 2570 | - widgetAreas: selectors.getWidgetAreas(), | |
| 2571 | - currentWidgetAreaId: widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : (_widgetAreaBlock$attr = widgetAreaBlock.attributes) === null || _widgetAreaBlock$attr === void 0 ? void 0 : _widgetAreaBlock$attr.id, | |
| 2572 | - canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName) | |
| 2573 | - }; | |
| 2574 | - }, [clientId, blockName]); | |
| 2575 | - const { | |
| 2576 | - moveBlockToWidgetArea | |
| 2577 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 2578 | - const hasMultipleWidgetAreas = (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) > 1; | |
| 2579 | - const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea; | |
| 2580 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), isMoveToWidgetAreaVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, { | |
| 2581 | - widgetAreas: widgetAreas, | |
| 2582 | - currentWidgetAreaId: currentWidgetAreaId, | |
| 2583 | - onSelect: widgetAreaId => { | |
| 2584 | - moveBlockToWidgetArea(props.clientId, widgetAreaId); | |
| 2585 | - } | |
| 2586 | - }))); | |
| 2587 | -}, 'withMoveToWidgetAreaToolbarItem'); | |
| 2588 | -(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-widgets/block-edit', withMoveToWidgetAreaToolbarItem); | |
| 2589 | -//# sourceMappingURL=move-to-widget-area.js.map | |
| 2590 | -;// CONCATENATED MODULE: external ["wp","mediaUtils"] | |
| 2591 | -var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; | |
| 2592 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/filters/replace-media-upload.js | |
| 2593 | -/** | |
| 2594 | - * WordPress dependencies | |
| 2595 | - */ | |
| 2596 | - | |
| 2597 | - | |
| 2598 | - | |
| 2599 | -const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; | |
| 2600 | - | |
| 2601 | -(0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload); | |
| 2602 | -//# sourceMappingURL=replace-media-upload.js.map | |
| 2603 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/filters/index.js | |
| 2604 | -/** | |
| 2605 | - * Internal dependencies | |
| 2606 | - */ | |
| 2607 | - | |
| 2608 | - | |
| 2609 | -//# sourceMappingURL=index.js.map | |
| 2610 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js | |
| 2611 | -/** | |
| 2612 | - * WordPress dependencies | |
| 2613 | - */ | |
| 2614 | - | |
| 2615 | -/** @typedef {import('@wordpress/element').RefObject} RefObject */ | |
| 2616 | - | |
| 2617 | -/** | |
| 2618 | - * A React hook to determine if it's dragging within the target element. | |
| 2619 | - * | |
| 2620 | - * @param {RefObject<HTMLElement>} elementRef The target elementRef object. | |
| 2621 | - * | |
| 2622 | - * @return {boolean} Is dragging within the target element. | |
| 2623 | - */ | |
| 2624 | - | |
| 2625 | -const useIsDraggingWithin = elementRef => { | |
| 2626 | - const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false); | |
| 2627 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 2628 | - const { | |
| 2629 | - ownerDocument | |
| 2630 | - } = elementRef.current; | |
| 2631 | - | |
| 2632 | - function handleDragStart(event) { | |
| 2633 | - // Check the first time when the dragging starts. | |
| 2634 | - handleDragEnter(event); | |
| 2635 | - } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape. | |
| 2636 | - | |
| 2637 | - | |
| 2638 | - function handleDragEnd() { | |
| 2639 | - setIsDraggingWithin(false); | |
| 2640 | - } | |
| 2641 | - | |
| 2642 | - function handleDragEnter(event) { | |
| 2643 | - // Check if the current target is inside the item element. | |
| 2644 | - if (elementRef.current.contains(event.target)) { | |
| 2645 | - setIsDraggingWithin(true); | |
| 2646 | - } else { | |
| 2647 | - setIsDraggingWithin(false); | |
| 2648 | - } | |
| 2649 | - } // Bind these events to the document to catch all drag events. | |
| 2650 | - // Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari. | |
| 2651 | - | |
| 2652 | - | |
| 2653 | - ownerDocument.addEventListener('dragstart', handleDragStart); | |
| 2654 | - ownerDocument.addEventListener('dragend', handleDragEnd); | |
| 2655 | - ownerDocument.addEventListener('dragenter', handleDragEnter); | |
| 2656 | - return () => { | |
| 2657 | - ownerDocument.removeEventListener('dragstart', handleDragStart); | |
| 2658 | - ownerDocument.removeEventListener('dragend', handleDragEnd); | |
| 2659 | - ownerDocument.removeEventListener('dragenter', handleDragEnter); | |
| 2660 | - }; | |
| 2661 | - }, []); | |
| 2662 | - return isDraggingWithin; | |
| 2663 | -}; | |
| 2664 | - | |
| 2665 | -/* harmony default export */ var use_is_dragging_within = (useIsDraggingWithin); | |
| 2666 | -//# sourceMappingURL=use-is-dragging-within.js.map | |
| 2667 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js | |
| 2668 | - | |
| 2669 | - | |
| 2670 | -/** | |
| 2671 | - * External dependencies | |
| 2672 | - */ | |
| 2673 | - | |
| 2674 | -/** | |
| 2675 | - * WordPress dependencies | |
| 2676 | - */ | |
| 2677 | - | |
| 2678 | - | |
| 2679 | - | |
| 2680 | - | |
| 2681 | -/** | |
| 2682 | - * Internal dependencies | |
| 2683 | - */ | |
| 2684 | - | |
| 2685 | - | |
| 2686 | -function WidgetAreaInnerBlocks(_ref) { | |
| 2687 | - let { | |
| 2688 | - id | |
| 2689 | - } = _ref; | |
| 2690 | - const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('root', 'postType'); | |
| 2691 | - const innerBlocksRef = (0,external_wp_element_namespaceObject.useRef)(); | |
| 2692 | - const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef); | |
| 2693 | - const shouldHighlightDropZone = isDraggingWithinInnerBlocks; // Using the experimental hook so that we can control the className of the element. | |
| 2694 | - | |
| 2695 | - const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ | |
| 2696 | - ref: innerBlocksRef | |
| 2697 | - }, { | |
| 2698 | - value: blocks, | |
| 2699 | - onInput, | |
| 2700 | - onChange, | |
| 2701 | - templateLock: false, | |
| 2702 | - renderAppender: external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender | |
| 2703 | - }); | |
| 2704 | - return (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 2705 | - "data-widget-area-id": id, | |
| 2706 | - className: classnames_default()('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', { | |
| 2707 | - 'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone | |
| 2708 | - }) | |
| 2709 | - }, (0,external_wp_element_namespaceObject.createElement)("div", innerBlocksProps)); | |
| 2710 | -} | |
| 2711 | -//# sourceMappingURL=inner-blocks.js.map | |
| 2712 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/blocks/widget-area/edit/index.js | |
| 2713 | - | |
| 2714 | - | |
| 2715 | -/** | |
| 2716 | - * WordPress dependencies | |
| 2717 | - */ | |
| 2718 | - | |
| 2719 | - | |
| 2720 | - | |
| 2721 | - | |
| 2722 | -/** | |
| 2723 | - * Internal dependencies | |
| 2724 | - */ | |
| 2725 | - | |
| 2726 | - | |
| 2727 | - | |
| 2728 | - | |
| 2729 | -/** @typedef {import('@wordpress/element').RefObject} RefObject */ | |
| 2730 | - | |
| 2731 | -function WidgetAreaEdit(_ref) { | |
| 2732 | - let { | |
| 2733 | - clientId, | |
| 2734 | - className, | |
| 2735 | - attributes: { | |
| 2736 | - id, | |
| 2737 | - name | |
| 2738 | - } | |
| 2739 | - } = _ref; | |
| 2740 | - const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(clientId), [clientId]); | |
| 2741 | - const { | |
| 2742 | - setIsWidgetAreaOpen | |
| 2743 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 2744 | - const wrapper = (0,external_wp_element_namespaceObject.useRef)(); | |
| 2745 | - const setOpen = (0,external_wp_element_namespaceObject.useCallback)(openState => setIsWidgetAreaOpen(clientId, openState), [clientId]); | |
| 2746 | - const isDragging = useIsDragging(wrapper); | |
| 2747 | - const isDraggingWithin = use_is_dragging_within(wrapper); | |
| 2748 | - const [openedWhileDragging, setOpenedWhileDragging] = (0,external_wp_element_namespaceObject.useState)(false); | |
| 2749 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 2750 | - if (!isDragging) { | |
| 2751 | - setOpenedWhileDragging(false); | |
| 2752 | - return; | |
| 2753 | - } | |
| 2754 | - | |
| 2755 | - if (isDraggingWithin && !isOpen) { | |
| 2756 | - setOpen(true); | |
| 2757 | - setOpenedWhileDragging(true); | |
| 2758 | - } else if (!isDraggingWithin && isOpen && openedWhileDragging) { | |
| 2759 | - setOpen(false); | |
| 2760 | - } | |
| 2761 | - }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); | |
| 2762 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { | |
| 2763 | - className: className, | |
| 2764 | - ref: wrapper | |
| 2765 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { | |
| 2766 | - title: name, | |
| 2767 | - opened: isOpen, | |
| 2768 | - onToggle: () => { | |
| 2769 | - setIsWidgetAreaOpen(clientId, !isOpen); | |
| 2770 | - }, | |
| 2771 | - scrollAfterOpen: !isDragging | |
| 2772 | - }, _ref2 => { | |
| 2773 | - let { | |
| 2774 | - opened | |
| 2775 | - } = _ref2; | |
| 2776 | - return (// This is required to ensure LegacyWidget blocks are not | |
| 2777 | - // unmounted when the panel is collapsed. Unmounting legacy | |
| 2778 | - // widgets may have unintended consequences (e.g. TinyMCE | |
| 2779 | - // not being properly reinitialized) | |
| 2780 | - (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableDisclosureContent, { | |
| 2781 | - className: "wp-block-widget-area__panel-body-content", | |
| 2782 | - visible: opened | |
| 2783 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { | |
| 2784 | - kind: "root", | |
| 2785 | - type: "postType", | |
| 2786 | - id: `widget-area-${id}` | |
| 2787 | - }, (0,external_wp_element_namespaceObject.createElement)(WidgetAreaInnerBlocks, { | |
| 2788 | - id: id | |
| 2789 | - }))) | |
| 2790 | - ); | |
| 2791 | - })); | |
| 2792 | -} | |
| 2793 | -/** | |
| 2794 | - * A React hook to determine if dragging is active. | |
| 2795 | - * | |
| 2796 | - * @param {RefObject<HTMLElement>} elementRef The target elementRef object. | |
| 2797 | - * | |
| 2798 | - * @return {boolean} Is dragging within the entire document. | |
| 2799 | - */ | |
| 2800 | - | |
| 2801 | -const useIsDragging = elementRef => { | |
| 2802 | - const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); | |
| 2803 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 2804 | - const { | |
| 2805 | - ownerDocument | |
| 2806 | - } = elementRef.current; | |
| 2807 | - | |
| 2808 | - function handleDragStart() { | |
| 2809 | - setIsDragging(true); | |
| 2810 | - } | |
| 2811 | - | |
| 2812 | - function handleDragEnd() { | |
| 2813 | - setIsDragging(false); | |
| 2814 | - } | |
| 2815 | - | |
| 2816 | - ownerDocument.addEventListener('dragstart', handleDragStart); | |
| 2817 | - ownerDocument.addEventListener('dragend', handleDragEnd); | |
| 2818 | - return () => { | |
| 2819 | - ownerDocument.removeEventListener('dragstart', handleDragStart); | |
| 2820 | - ownerDocument.removeEventListener('dragend', handleDragEnd); | |
| 2821 | - }; | |
| 2822 | - }, []); | |
| 2823 | - return isDragging; | |
| 2824 | -}; | |
| 2825 | -//# sourceMappingURL=index.js.map | |
| 2826 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/blocks/widget-area/index.js | |
| 2827 | -/** | |
| 2828 | - * WordPress dependencies | |
| 2829 | - */ | |
| 2830 | - | |
| 2831 | -/** | |
| 2832 | - * Internal dependencies | |
| 2833 | - */ | |
| 2834 | - | |
| 2835 | -const metadata = { | |
| 2836 | - name: "core/widget-area", | |
| 2837 | - category: "widgets", | |
| 2838 | - attributes: { | |
| 2839 | - id: { | |
| 2840 | - type: "string" | |
| 2841 | - }, | |
| 2842 | - name: { | |
| 2843 | - type: "string" | |
| 2844 | - } | |
| 2845 | - }, | |
| 2846 | - supports: { | |
| 2847 | - html: false, | |
| 2848 | - inserter: false, | |
| 2849 | - customClassName: false, | |
| 2850 | - reusable: false, | |
| 2851 | - __experimentalToolbar: false, | |
| 2852 | - __experimentalParentSelector: false | |
| 2853 | - }, | |
| 2854 | - editorStyle: "wp-block-widget-area-editor", | |
| 2855 | - style: "wp-block-widget-area" | |
| 2856 | -}; | |
| 2857 | - | |
| 2858 | -const { | |
| 2859 | - name: widget_area_name | |
| 2860 | -} = metadata; | |
| 2861 | - | |
| 2862 | -const settings = { | |
| 2863 | - title: (0,external_wp_i18n_namespaceObject.__)('Widget Area'), | |
| 2864 | - description: (0,external_wp_i18n_namespaceObject.__)('A widget area container.'), | |
| 2865 | - __experimentalLabel: _ref => { | |
| 2866 | - let { | |
| 2867 | - name: label | |
| 2868 | - } = _ref; | |
| 2869 | - return label; | |
| 2870 | - }, | |
| 2871 | - edit: WidgetAreaEdit | |
| 2872 | -}; | |
| 2873 | -//# sourceMappingURL=index.js.map | |
| 2874 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/error-boundary/index.js | |
| 2875 | - | |
| 2876 | - | |
| 2877 | -/** | |
| 2878 | - * WordPress dependencies | |
| 2879 | - */ | |
| 2880 | - | |
| 2881 | - | |
| 2882 | - | |
| 2883 | - | |
| 2884 | - | |
| 2885 | - | |
| 2886 | -function CopyButton(_ref) { | |
| 2887 | - let { | |
| 2888 | - text, | |
| 2889 | - children | |
| 2890 | - } = _ref; | |
| 2891 | - const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); | |
| 2892 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 2893 | - variant: "secondary", | |
| 2894 | - ref: ref | |
| 2895 | - }, children); | |
| 2896 | -} | |
| 2897 | - | |
| 2898 | -class ErrorBoundary extends external_wp_element_namespaceObject.Component { | |
| 2899 | - constructor() { | |
| 2900 | - super(...arguments); | |
| 2901 | - this.reboot = this.reboot.bind(this); | |
| 2902 | - this.state = { | |
| 2903 | - error: null | |
| 2904 | - }; | |
| 2905 | - } | |
| 2906 | - | |
| 2907 | - componentDidCatch(error) { | |
| 2908 | - this.setState({ | |
| 2909 | - error | |
| 2910 | - }); | |
| 2911 | - } | |
| 2912 | - | |
| 2913 | - reboot() { | |
| 2914 | - this.props.onError(); | |
| 2915 | - } | |
| 2916 | - | |
| 2917 | - render() { | |
| 2918 | - const { | |
| 2919 | - error | |
| 2920 | - } = this.state; | |
| 2921 | - | |
| 2922 | - if (!error) { | |
| 2923 | - return this.props.children; | |
| 2924 | - } | |
| 2925 | - | |
| 2926 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { | |
| 2927 | - className: "edit-widgets-error-boundary", | |
| 2928 | - actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 2929 | - key: "recovery", | |
| 2930 | - onClick: this.reboot, | |
| 2931 | - variant: "secondary" | |
| 2932 | - }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { | |
| 2933 | - key: "copy-error", | |
| 2934 | - text: error.stack | |
| 2935 | - }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))] | |
| 2936 | - }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')); | |
| 2937 | - } | |
| 2938 | - | |
| 2939 | -} | |
| 2940 | -//# sourceMappingURL=index.js.map | |
| 2941 | -;// CONCATENATED MODULE: external ["wp","reusableBlocks"] | |
| 2942 | -var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; | |
| 2943 | -;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] | |
| 2944 | -var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; | |
| 2945 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/keyboard-shortcuts/index.js | |
| 2946 | -/** | |
| 2947 | - * WordPress dependencies | |
| 2948 | - */ | |
| 2949 | - | |
| 2950 | - | |
| 2951 | - | |
| 2952 | - | |
| 2953 | - | |
| 2954 | -/** | |
| 2955 | - * Internal dependencies | |
| 2956 | - */ | |
| 2957 | - | |
| 2958 | - | |
| 2959 | - | |
| 2960 | -function KeyboardShortcuts() { | |
| 2961 | - const { | |
| 2962 | - redo, | |
| 2963 | - undo | |
| 2964 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); | |
| 2965 | - const { | |
| 2966 | - saveEditedWidgetAreas | |
| 2967 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 2968 | - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/undo', event => { | |
| 2969 | - undo(); | |
| 2970 | - event.preventDefault(); | |
| 2971 | - }); | |
| 2972 | - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/redo', event => { | |
| 2973 | - redo(); | |
| 2974 | - event.preventDefault(); | |
| 2975 | - }); | |
| 2976 | - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/save', event => { | |
| 2977 | - event.preventDefault(); | |
| 2978 | - saveEditedWidgetAreas(); | |
| 2979 | - }); | |
| 2980 | - return null; | |
| 2981 | -} | |
| 2982 | - | |
| 2983 | -function KeyboardShortcutsRegister() { | |
| 2984 | - // Registering the shortcuts | |
| 2985 | - const { | |
| 2986 | - registerShortcut | |
| 2987 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); | |
| 2988 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 2989 | - registerShortcut({ | |
| 2990 | - name: 'core/edit-widgets/undo', | |
| 2991 | - category: 'global', | |
| 2992 | - description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), | |
| 2993 | - keyCombination: { | |
| 2994 | - modifier: 'primary', | |
| 2995 | - character: 'z' | |
| 2996 | - } | |
| 2997 | - }); | |
| 2998 | - registerShortcut({ | |
| 2999 | - name: 'core/edit-widgets/redo', | |
| 3000 | - category: 'global', | |
| 3001 | - description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), | |
| 3002 | - keyCombination: { | |
| 3003 | - modifier: 'primaryShift', | |
| 3004 | - character: 'z' | |
| 3005 | - } | |
| 3006 | - }); | |
| 3007 | - registerShortcut({ | |
| 3008 | - name: 'core/edit-widgets/save', | |
| 3009 | - category: 'global', | |
| 3010 | - description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), | |
| 3011 | - keyCombination: { | |
| 3012 | - modifier: 'primary', | |
| 3013 | - character: 's' | |
| 3014 | - } | |
| 3015 | - }); | |
| 3016 | - registerShortcut({ | |
| 3017 | - name: 'core/edit-widgets/keyboard-shortcuts', | |
| 3018 | - category: 'main', | |
| 3019 | - description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), | |
| 3020 | - keyCombination: { | |
| 3021 | - modifier: 'access', | |
| 3022 | - character: 'h' | |
| 3023 | - } | |
| 3024 | - }); | |
| 3025 | - registerShortcut({ | |
| 3026 | - name: 'core/edit-widgets/next-region', | |
| 3027 | - category: 'global', | |
| 3028 | - description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), | |
| 3029 | - keyCombination: { | |
| 3030 | - modifier: 'ctrl', | |
| 3031 | - character: '`' | |
| 3032 | - }, | |
| 3033 | - aliases: [{ | |
| 3034 | - modifier: 'access', | |
| 3035 | - character: 'n' | |
| 3036 | - }] | |
| 3037 | - }); | |
| 3038 | - registerShortcut({ | |
| 3039 | - name: 'core/edit-widgets/previous-region', | |
| 3040 | - category: 'global', | |
| 3041 | - description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), | |
| 3042 | - keyCombination: { | |
| 3043 | - modifier: 'ctrlShift', | |
| 3044 | - character: '`' | |
| 3045 | - }, | |
| 3046 | - aliases: [{ | |
| 3047 | - modifier: 'access', | |
| 3048 | - character: 'p' | |
| 3049 | - }] | |
| 3050 | - }); | |
| 3051 | - }, [registerShortcut]); | |
| 3052 | - return null; | |
| 3053 | -} | |
| 3054 | - | |
| 3055 | -KeyboardShortcuts.Register = KeyboardShortcutsRegister; | |
| 3056 | -/* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); | |
| 3057 | -//# sourceMappingURL=index.js.map | |
| 3058 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/hooks/use-last-selected-widget-area.js | |
| 3059 | -/** | |
| 3060 | - * WordPress dependencies | |
| 3061 | - */ | |
| 3062 | - | |
| 3063 | - | |
| 3064 | - | |
| 3065 | -/** | |
| 3066 | - * Internal dependencies | |
| 3067 | - */ | |
| 3068 | - | |
| 3069 | - | |
| 3070 | - | |
| 3071 | -/** | |
| 3072 | - * A react hook that returns the client id of the last widget area to have | |
| 3073 | - * been selected, or to have a selected block within it. | |
| 3074 | - * | |
| 3075 | - * @return {string} clientId of the widget area last selected. | |
| 3076 | - */ | |
| 3077 | - | |
| 3078 | -const useLastSelectedWidgetArea = () => (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 3079 | - var _widgetAreasPost$bloc; | |
| 3080 | - | |
| 3081 | - const { | |
| 3082 | - getBlockSelectionEnd, | |
| 3083 | - getBlockName | |
| 3084 | - } = select(external_wp_blockEditor_namespaceObject.store); | |
| 3085 | - const selectionEndClientId = getBlockSelectionEnd(); // If the selected block is a widget area, return its clientId. | |
| 3086 | - | |
| 3087 | - if (getBlockName(selectionEndClientId) === 'core/widget-area') { | |
| 3088 | - return selectionEndClientId; | |
| 3089 | - } | |
| 3090 | - | |
| 3091 | - const { | |
| 3092 | - getParentWidgetAreaBlock | |
| 3093 | - } = select(store_store); | |
| 3094 | - const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId); | |
| 3095 | - const widgetAreaBlockClientId = widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : widgetAreaBlock.clientId; | |
| 3096 | - | |
| 3097 | - if (widgetAreaBlockClientId) { | |
| 3098 | - return widgetAreaBlockClientId; | |
| 3099 | - } // If no widget area has been selected, return the clientId of the first | |
| 3100 | - // area. | |
| 3101 | - | |
| 3102 | - | |
| 3103 | - const { | |
| 3104 | - getEntityRecord | |
| 3105 | - } = select(external_wp_coreData_namespaceObject.store); | |
| 3106 | - const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); | |
| 3107 | - return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId; | |
| 3108 | -}, []); | |
| 3109 | - | |
| 3110 | -/* harmony default export */ var use_last_selected_widget_area = (useLastSelectedWidgetArea); | |
| 3111 | -//# sourceMappingURL=use-last-selected-widget-area.js.map | |
| 3112 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/constants.js | |
| 3113 | -const ALLOW_REUSABLE_BLOCKS = false; | |
| 3114 | -const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; | |
| 3115 | -//# sourceMappingURL=constants.js.map | |
| 3116 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js | |
| 3117 | - | |
| 3118 | - | |
| 3119 | - | |
| 3120 | -/** | |
| 3121 | - * External dependencies | |
| 3122 | - */ | |
| 3123 | - | |
| 3124 | -/** | |
| 3125 | - * WordPress dependencies | |
| 3126 | - */ | |
| 3127 | - | |
| 3128 | - | |
| 3129 | - | |
| 3130 | - | |
| 3131 | - | |
| 3132 | - | |
| 3133 | - | |
| 3134 | - | |
| 3135 | - | |
| 3136 | -/** | |
| 3137 | - * Internal dependencies | |
| 3138 | - */ | |
| 3139 | - | |
| 3140 | - | |
| 3141 | - | |
| 3142 | - | |
| 3143 | - | |
| 3144 | - | |
| 3145 | - | |
| 3146 | -function WidgetAreasBlockEditorProvider(_ref) { | |
| 3147 | - let { | |
| 3148 | - blockEditorSettings, | |
| 3149 | - children, | |
| 3150 | - ...props | |
| 3151 | - } = _ref; | |
| 3152 | - const { | |
| 3153 | - hasUploadPermissions, | |
| 3154 | - reusableBlocks, | |
| 3155 | - isFixedToolbarActive, | |
| 3156 | - keepCaretInsideBlock | |
| 3157 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ | |
| 3158 | - hasUploadPermissions: (0,external_lodash_namespaceObject.defaultTo)(select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'), true), | |
| 3159 | - widgetAreas: select(store_store).getWidgetAreas(), | |
| 3160 | - widgets: select(store_store).getWidgets(), | |
| 3161 | - reusableBlocks: ALLOW_REUSABLE_BLOCKS ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block') : [], | |
| 3162 | - isFixedToolbarActive: select(store).isFeatureActive('core/edit-widgets', 'fixedToolbar'), | |
| 3163 | - keepCaretInsideBlock: select(store).isFeatureActive('core/edit-widgets', 'keepCaretInsideBlock') | |
| 3164 | - }), []); | |
| 3165 | - const { | |
| 3166 | - setIsInserterOpened | |
| 3167 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 3168 | - const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { | |
| 3169 | - let mediaUploadBlockEditor; | |
| 3170 | - | |
| 3171 | - if (hasUploadPermissions) { | |
| 3172 | - mediaUploadBlockEditor = _ref2 => { | |
| 3173 | - let { | |
| 3174 | - onError, | |
| 3175 | - ...argumentsObject | |
| 3176 | - } = _ref2; | |
| 3177 | - (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ | |
| 3178 | - wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, | |
| 3179 | - onError: _ref3 => { | |
| 3180 | - let { | |
| 3181 | - message | |
| 3182 | - } = _ref3; | |
| 3183 | - return onError(message); | |
| 3184 | - }, | |
| 3185 | - ...argumentsObject | |
| 3186 | - }); | |
| 3187 | - }; | |
| 3188 | - } | |
| 3189 | - | |
| 3190 | - return { ...blockEditorSettings, | |
| 3191 | - __experimentalReusableBlocks: reusableBlocks, | |
| 3192 | - hasFixedToolbar: isFixedToolbarActive, | |
| 3193 | - keepCaretInsideBlock, | |
| 3194 | - mediaUpload: mediaUploadBlockEditor, | |
| 3195 | - templateLock: 'all', | |
| 3196 | - __experimentalSetIsInserterOpened: setIsInserterOpened | |
| 3197 | - }; | |
| 3198 | - }, [blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, hasUploadPermissions, reusableBlocks, setIsInserterOpened]); | |
| 3199 | - const widgetAreaId = use_last_selected_widget_area(); | |
| 3200 | - const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)(KIND, POST_TYPE, { | |
| 3201 | - id: buildWidgetAreasPostId() | |
| 3202 | - }); | |
| 3203 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, _extends({ | |
| 3204 | - value: blocks, | |
| 3205 | - onInput: onInput, | |
| 3206 | - onChange: onChange, | |
| 3207 | - settings: settings, | |
| 3208 | - useSubRegistry: false | |
| 3209 | - }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.CopyHandler, null, children), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, { | |
| 3210 | - rootClientId: widgetAreaId | |
| 3211 | - })))); | |
| 3212 | -} | |
| 3213 | -//# sourceMappingURL=index.js.map | |
| 3214 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/cog.js | |
| 3215 | - | |
| 3216 | - | |
| 3217 | -/** | |
| 3218 | - * WordPress dependencies | |
| 3219 | - */ | |
| 3220 | - | |
| 3221 | -const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3222 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3223 | - viewBox: "0 0 24 24" | |
| 3224 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3225 | - fillRule: "evenodd", | |
| 3226 | - d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", | |
| 3227 | - clipRule: "evenodd" | |
| 3228 | -})); | |
| 3229 | -/* harmony default export */ var library_cog = (cog); | |
| 3230 | -//# sourceMappingURL=cog.js.map | |
| 3231 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/block-default.js | |
| 3232 | - | |
| 3233 | - | |
| 3234 | -/** | |
| 3235 | - * WordPress dependencies | |
| 3236 | - */ | |
| 3237 | - | |
| 3238 | -const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3239 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3240 | - viewBox: "0 0 24 24" | |
| 3241 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3242 | - 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" | |
| 3243 | -})); | |
| 3244 | -/* harmony default export */ var block_default = (blockDefault); | |
| 3245 | -//# sourceMappingURL=block-default.js.map | |
| 3246 | -;// CONCATENATED MODULE: external ["wp","url"] | |
| 3247 | -var external_wp_url_namespaceObject = window["wp"]["url"]; | |
| 3248 | -;// CONCATENATED MODULE: external ["wp","dom"] | |
| 3249 | -var external_wp_dom_namespaceObject = window["wp"]["dom"]; | |
| 3250 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/sidebar/widget-areas.js | |
| 3251 | - | |
| 3252 | - | |
| 3253 | -/** | |
| 3254 | - * WordPress dependencies | |
| 3255 | - */ | |
| 3256 | - | |
| 3257 | - | |
| 3258 | - | |
| 3259 | - | |
| 3260 | - | |
| 3261 | - | |
| 3262 | - | |
| 3263 | - | |
| 3264 | -/** | |
| 3265 | - * Internal dependencies | |
| 3266 | - */ | |
| 3267 | - | |
| 3268 | - | |
| 3269 | -function WidgetAreas(_ref) { | |
| 3270 | - let { | |
| 3271 | - selectedWidgetAreaId | |
| 3272 | - } = _ref; | |
| 3273 | - const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas(), []); | |
| 3274 | - const selectedWidgetArea = (0,external_wp_element_namespaceObject.useMemo)(() => selectedWidgetAreaId && (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.find(widgetArea => widgetArea.id === selectedWidgetAreaId)), [selectedWidgetAreaId, widgetAreas]); | |
| 3275 | - let description; | |
| 3276 | - | |
| 3277 | - if (!selectedWidgetArea) { | |
| 3278 | - description = (0,external_wp_i18n_namespaceObject.__)('Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'); | |
| 3279 | - } else if (selectedWidgetAreaId === 'wp_inactive_widgets') { | |
| 3280 | - description = (0,external_wp_i18n_namespaceObject.__)('Blocks in this Widget Area will not be displayed in your site.'); | |
| 3281 | - } else { | |
| 3282 | - description = selectedWidgetArea.description; | |
| 3283 | - } | |
| 3284 | - | |
| 3285 | - return (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 3286 | - className: "edit-widgets-widget-areas" | |
| 3287 | - }, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 3288 | - className: "edit-widgets-widget-areas__top-container" | |
| 3289 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { | |
| 3290 | - icon: block_default | |
| 3291 | - }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 3292 | - // Use `dangerouslySetInnerHTML` to keep backwards | |
| 3293 | - // compatibility. Basic markup in the description is an | |
| 3294 | - // established feature of WordPress. | |
| 3295 | - // @see https://github.com/WordPress/gutenberg/issues/33106 | |
| 3296 | - dangerouslySetInnerHTML: { | |
| 3297 | - __html: (0,external_wp_dom_namespaceObject.safeHTML)(description) | |
| 3298 | - } | |
| 3299 | - }), (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) === 0 && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 3300 | - href: (0,external_wp_url_namespaceObject.addQueryArgs)('customize.php', { | |
| 3301 | - 'autofocus[panel]': 'widgets', | |
| 3302 | - return: window.location.pathname | |
| 3303 | - }), | |
| 3304 | - variant: "tertiary" | |
| 3305 | - }, (0,external_wp_i18n_namespaceObject.__)('Manage with live preview'))))); | |
| 3306 | -} | |
| 3307 | -//# sourceMappingURL=widget-areas.js.map | |
| 3308 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/sidebar/index.js | |
| 3309 | - | |
| 3310 | - | |
| 3311 | -/** | |
| 3312 | - * External dependencies | |
| 3313 | - */ | |
| 3314 | - | |
| 3315 | -/** | |
| 3316 | - * WordPress dependencies | |
| 3317 | - */ | |
| 3318 | - | |
| 3319 | - | |
| 3320 | - | |
| 3321 | - | |
| 3322 | - | |
| 3323 | - | |
| 3324 | - | |
| 3325 | - | |
| 3326 | -const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ | |
| 3327 | - web: true, | |
| 3328 | - native: false | |
| 3329 | -}); | |
| 3330 | -const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector'; // Widget areas were one called block areas, so use 'edit-widgets/block-areas' | |
| 3331 | -// for backwards compatibility. | |
| 3332 | - | |
| 3333 | -const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas'; | |
| 3334 | -/** | |
| 3335 | - * Internal dependencies | |
| 3336 | - */ | |
| 3337 | - | |
| 3338 | - | |
| 3339 | - | |
| 3340 | - | |
| 3341 | -function ComplementaryAreaTab(_ref) { | |
| 3342 | - let { | |
| 3343 | - identifier, | |
| 3344 | - label, | |
| 3345 | - isActive | |
| 3346 | - } = _ref; | |
| 3347 | - const { | |
| 3348 | - enableComplementaryArea | |
| 3349 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 3350 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 3351 | - onClick: () => enableComplementaryArea(store_store.name, identifier), | |
| 3352 | - className: classnames_default()('edit-widgets-sidebar__panel-tab', { | |
| 3353 | - 'is-active': isActive | |
| 3354 | - }), | |
| 3355 | - "aria-label": isActive ? // translators: %s: sidebar label e.g: "Widget Areas". | |
| 3356 | - (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), label) : label, | |
| 3357 | - "data-label": label | |
| 3358 | - }, label); | |
| 3359 | -} | |
| 3360 | - | |
| 3361 | -function Sidebar() { | |
| 3362 | - const { | |
| 3363 | - enableComplementaryArea | |
| 3364 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 3365 | - const { | |
| 3366 | - currentArea, | |
| 3367 | - hasSelectedNonAreaBlock, | |
| 3368 | - isGeneralSidebarOpen, | |
| 3369 | - selectedWidgetAreaBlock | |
| 3370 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 3371 | - const { | |
| 3372 | - getSelectedBlock, | |
| 3373 | - getBlock, | |
| 3374 | - getBlockParentsByBlockName | |
| 3375 | - } = select(external_wp_blockEditor_namespaceObject.store); | |
| 3376 | - const { | |
| 3377 | - getActiveComplementaryArea | |
| 3378 | - } = select(store); | |
| 3379 | - const selectedBlock = getSelectedBlock(); | |
| 3380 | - const activeArea = getActiveComplementaryArea(store_store.name); | |
| 3381 | - let currentSelection = activeArea; | |
| 3382 | - | |
| 3383 | - if (!currentSelection) { | |
| 3384 | - if (selectedBlock) { | |
| 3385 | - currentSelection = BLOCK_INSPECTOR_IDENTIFIER; | |
| 3386 | - } else { | |
| 3387 | - currentSelection = WIDGET_AREAS_IDENTIFIER; | |
| 3388 | - } | |
| 3389 | - } | |
| 3390 | - | |
| 3391 | - let widgetAreaBlock; | |
| 3392 | - | |
| 3393 | - if (selectedBlock) { | |
| 3394 | - if (selectedBlock.name === 'core/widget-area') { | |
| 3395 | - widgetAreaBlock = selectedBlock; | |
| 3396 | - } else { | |
| 3397 | - widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]); | |
| 3398 | - } | |
| 3399 | - } | |
| 3400 | - | |
| 3401 | - return { | |
| 3402 | - currentArea: currentSelection, | |
| 3403 | - hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'), | |
| 3404 | - isGeneralSidebarOpen: !!activeArea, | |
| 3405 | - selectedWidgetAreaBlock: widgetAreaBlock | |
| 3406 | - }; | |
| 3407 | - }, []); // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies, | |
| 3408 | - // because we want to run the effect when a block is selected/unselected and not when the sidebar state changes. | |
| 3409 | - | |
| 3410 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 3411 | - if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { | |
| 3412 | - enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER); | |
| 3413 | - } | |
| 3414 | - | |
| 3415 | - if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { | |
| 3416 | - enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER); | |
| 3417 | - } | |
| 3418 | - }, [hasSelectedNonAreaBlock, enableComplementaryArea]); | |
| 3419 | - return (0,external_wp_element_namespaceObject.createElement)(complementary_area, { | |
| 3420 | - className: "edit-widgets-sidebar", | |
| 3421 | - header: (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, { | |
| 3422 | - identifier: WIDGET_AREAS_IDENTIFIER, | |
| 3423 | - label: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0,external_wp_i18n_namespaceObject.__)('Widget Areas'), | |
| 3424 | - isActive: currentArea === WIDGET_AREAS_IDENTIFIER | |
| 3425 | - })), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, { | |
| 3426 | - identifier: BLOCK_INSPECTOR_IDENTIFIER, | |
| 3427 | - label: (0,external_wp_i18n_namespaceObject.__)('Block'), | |
| 3428 | - isActive: currentArea === BLOCK_INSPECTOR_IDENTIFIER | |
| 3429 | - }))), | |
| 3430 | - headerClassName: "edit-widgets-sidebar__panel-tabs" | |
| 3431 | - /* translators: button label text should, if possible, be under 16 characters. */ | |
| 3432 | - , | |
| 3433 | - title: (0,external_wp_i18n_namespaceObject.__)('Settings'), | |
| 3434 | - closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'), | |
| 3435 | - scope: "core/edit-widgets", | |
| 3436 | - identifier: currentArea, | |
| 3437 | - icon: library_cog, | |
| 3438 | - isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT | |
| 3439 | - }, currentArea === WIDGET_AREAS_IDENTIFIER && (0,external_wp_element_namespaceObject.createElement)(WidgetAreas, { | |
| 3440 | - selectedWidgetAreaId: selectedWidgetAreaBlock === null || selectedWidgetAreaBlock === void 0 ? void 0 : selectedWidgetAreaBlock.attributes.id | |
| 3441 | - }), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null) : // Pretend that Widget Areas are part of the UI by not | |
| 3442 | - // showing the Block Inspector when one is selected. | |
| 3443 | - (0,external_wp_element_namespaceObject.createElement)("span", { | |
| 3444 | - className: "block-editor-block-inspector__no-blocks" | |
| 3445 | - }, (0,external_wp_i18n_namespaceObject.__)('No block selected.')))); | |
| 3446 | -} | |
| 3447 | -//# sourceMappingURL=index.js.map | |
| 3448 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js | |
| 3449 | - | |
| 3450 | - | |
| 3451 | -/** | |
| 3452 | - * WordPress dependencies | |
| 3453 | - */ | |
| 3454 | - | |
| 3455 | -const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3456 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3457 | - viewBox: "0 0 24 24" | |
| 3458 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3459 | - d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" | |
| 3460 | -})); | |
| 3461 | -/* harmony default export */ var library_plus = (plus); | |
| 3462 | -//# sourceMappingURL=plus.js.map | |
| 3463 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/list-view.js | |
| 3464 | - | |
| 3465 | - | |
| 3466 | -/** | |
| 3467 | - * WordPress dependencies | |
| 3468 | - */ | |
| 3469 | - | |
| 3470 | -const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3471 | - viewBox: "0 0 24 24", | |
| 3472 | - xmlns: "http://www.w3.org/2000/svg" | |
| 3473 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3474 | - d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" | |
| 3475 | -})); | |
| 3476 | -/* harmony default export */ var list_view = (listView); | |
| 3477 | -//# sourceMappingURL=list-view.js.map | |
| 3478 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/save-button/index.js | |
| 3479 | - | |
| 3480 | - | |
| 3481 | -/** | |
| 3482 | - * WordPress dependencies | |
| 3483 | - */ | |
| 3484 | - | |
| 3485 | - | |
| 3486 | - | |
| 3487 | -/** | |
| 3488 | - * Internal dependencies | |
| 3489 | - */ | |
| 3490 | - | |
| 3491 | - | |
| 3492 | - | |
| 3493 | -function SaveButton() { | |
| 3494 | - const { | |
| 3495 | - hasEditedWidgetAreaIds, | |
| 3496 | - isSaving | |
| 3497 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 3498 | - var _getEditedWidgetAreas; | |
| 3499 | - | |
| 3500 | - const { | |
| 3501 | - getEditedWidgetAreas, | |
| 3502 | - isSavingWidgetAreas | |
| 3503 | - } = select(store_store); | |
| 3504 | - return { | |
| 3505 | - hasEditedWidgetAreaIds: ((_getEditedWidgetAreas = getEditedWidgetAreas()) === null || _getEditedWidgetAreas === void 0 ? void 0 : _getEditedWidgetAreas.length) > 0, | |
| 3506 | - isSaving: isSavingWidgetAreas() | |
| 3507 | - }; | |
| 3508 | - }, []); | |
| 3509 | - const { | |
| 3510 | - saveEditedWidgetAreas | |
| 3511 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 3512 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 3513 | - variant: "primary", | |
| 3514 | - isBusy: isSaving, | |
| 3515 | - "aria-disabled": isSaving, | |
| 3516 | - onClick: isSaving ? undefined : saveEditedWidgetAreas, | |
| 3517 | - disabled: !hasEditedWidgetAreaIds | |
| 3518 | - }, isSaving ? (0,external_wp_i18n_namespaceObject.__)('Saving…') : (0,external_wp_i18n_namespaceObject.__)('Update')); | |
| 3519 | -} | |
| 3520 | - | |
| 3521 | -/* harmony default export */ var save_button = (SaveButton); | |
| 3522 | -//# sourceMappingURL=index.js.map | |
| 3523 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/undo.js | |
| 3524 | - | |
| 3525 | - | |
| 3526 | -/** | |
| 3527 | - * WordPress dependencies | |
| 3528 | - */ | |
| 3529 | - | |
| 3530 | -const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3531 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3532 | - viewBox: "0 0 24 24" | |
| 3533 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3534 | - d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" | |
| 3535 | -})); | |
| 3536 | -/* harmony default export */ var library_undo = (undo); | |
| 3537 | -//# sourceMappingURL=undo.js.map | |
| 3538 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/redo.js | |
| 3539 | - | |
| 3540 | - | |
| 3541 | -/** | |
| 3542 | - * WordPress dependencies | |
| 3543 | - */ | |
| 3544 | - | |
| 3545 | -const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3546 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3547 | - viewBox: "0 0 24 24" | |
| 3548 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3549 | - d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" | |
| 3550 | -})); | |
| 3551 | -/* harmony default export */ var library_redo = (redo); | |
| 3552 | -//# sourceMappingURL=redo.js.map | |
| 3553 | -;// CONCATENATED MODULE: external ["wp","keycodes"] | |
| 3554 | -var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; | |
| 3555 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/header/undo-redo/undo.js | |
| 3556 | - | |
| 3557 | - | |
| 3558 | -/** | |
| 3559 | - * WordPress dependencies | |
| 3560 | - */ | |
| 3561 | - | |
| 3562 | - | |
| 3563 | - | |
| 3564 | - | |
| 3565 | - | |
| 3566 | - | |
| 3567 | -function UndoButton() { | |
| 3568 | - const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []); | |
| 3569 | - const { | |
| 3570 | - undo | |
| 3571 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); | |
| 3572 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { | |
| 3573 | - icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo, | |
| 3574 | - label: (0,external_wp_i18n_namespaceObject.__)('Undo'), | |
| 3575 | - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this | |
| 3576 | - // button, because it will remove focus for keyboard users. | |
| 3577 | - // See: https://github.com/WordPress/gutenberg/issues/3486 | |
| 3578 | - , | |
| 3579 | - "aria-disabled": !hasUndo, | |
| 3580 | - onClick: hasUndo ? undo : undefined | |
| 3581 | - }); | |
| 3582 | -} | |
| 3583 | -//# sourceMappingURL=undo.js.map | |
| 3584 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/header/undo-redo/redo.js | |
| 3585 | - | |
| 3586 | - | |
| 3587 | -/** | |
| 3588 | - * WordPress dependencies | |
| 3589 | - */ | |
| 3590 | - | |
| 3591 | - | |
| 3592 | - | |
| 3593 | - | |
| 3594 | - | |
| 3595 | - | |
| 3596 | -function RedoButton() { | |
| 3597 | - const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []); | |
| 3598 | - const { | |
| 3599 | - redo | |
| 3600 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); | |
| 3601 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { | |
| 3602 | - icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo, | |
| 3603 | - label: (0,external_wp_i18n_namespaceObject.__)('Redo'), | |
| 3604 | - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this | |
| 3605 | - // button, because it will remove focus for keyboard users. | |
| 3606 | - // See: https://github.com/WordPress/gutenberg/issues/3486 | |
| 3607 | - , | |
| 3608 | - "aria-disabled": !hasRedo, | |
| 3609 | - onClick: hasRedo ? redo : undefined | |
| 3610 | - }); | |
| 3611 | -} | |
| 3612 | -//# sourceMappingURL=redo.js.map | |
| 3613 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/external.js | |
| 3614 | - | |
| 3615 | - | |
| 3616 | -/** | |
| 3617 | - * WordPress dependencies | |
| 3618 | - */ | |
| 3619 | - | |
| 3620 | -const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 3621 | - xmlns: "http://www.w3.org/2000/svg", | |
| 3622 | - viewBox: "0 0 24 24" | |
| 3623 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 3624 | - d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z" | |
| 3625 | -})); | |
| 3626 | -/* harmony default export */ var library_external = (external); | |
| 3627 | -//# sourceMappingURL=external.js.map | |
| 3628 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js | |
| 3629 | -/** | |
| 3630 | - * WordPress dependencies | |
| 3631 | - */ | |
| 3632 | - | |
| 3633 | -const textFormattingShortcuts = [{ | |
| 3634 | - keyCombination: { | |
| 3635 | - modifier: 'primary', | |
| 3636 | - character: 'b' | |
| 3637 | - }, | |
| 3638 | - description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') | |
| 3639 | -}, { | |
| 3640 | - keyCombination: { | |
| 3641 | - modifier: 'primary', | |
| 3642 | - character: 'i' | |
| 3643 | - }, | |
| 3644 | - description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') | |
| 3645 | -}, { | |
| 3646 | - keyCombination: { | |
| 3647 | - modifier: 'primary', | |
| 3648 | - character: 'k' | |
| 3649 | - }, | |
| 3650 | - description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') | |
| 3651 | -}, { | |
| 3652 | - keyCombination: { | |
| 3653 | - modifier: 'primaryShift', | |
| 3654 | - character: 'k' | |
| 3655 | - }, | |
| 3656 | - description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') | |
| 3657 | -}, { | |
| 3658 | - keyCombination: { | |
| 3659 | - modifier: 'primary', | |
| 3660 | - character: 'u' | |
| 3661 | - }, | |
| 3662 | - description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') | |
| 3663 | -}]; | |
| 3664 | -//# sourceMappingURL=config.js.map | |
| 3665 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js | |
| 3666 | - | |
| 3667 | - | |
| 3668 | -/** | |
| 3669 | - * External dependencies | |
| 3670 | - */ | |
| 3671 | - | |
| 3672 | -/** | |
| 3673 | - * WordPress dependencies | |
| 3674 | - */ | |
| 3675 | - | |
| 3676 | - | |
| 3677 | - | |
| 3678 | - | |
| 3679 | -function KeyCombination(_ref) { | |
| 3680 | - let { | |
| 3681 | - keyCombination, | |
| 3682 | - forceAriaLabel | |
| 3683 | - } = _ref; | |
| 3684 | - const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; | |
| 3685 | - const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; | |
| 3686 | - return (0,external_wp_element_namespaceObject.createElement)("kbd", { | |
| 3687 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", | |
| 3688 | - "aria-label": forceAriaLabel || ariaLabel | |
| 3689 | - }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => { | |
| 3690 | - if (character === '+') { | |
| 3691 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { | |
| 3692 | - key: index | |
| 3693 | - }, character); | |
| 3694 | - } | |
| 3695 | - | |
| 3696 | - return (0,external_wp_element_namespaceObject.createElement)("kbd", { | |
| 3697 | - key: index, | |
| 3698 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key" | |
| 3699 | - }, character); | |
| 3700 | - })); | |
| 3701 | -} | |
| 3702 | - | |
| 3703 | -function Shortcut(_ref2) { | |
| 3704 | - let { | |
| 3705 | - description, | |
| 3706 | - keyCombination, | |
| 3707 | - aliases = [], | |
| 3708 | - ariaLabel | |
| 3709 | - } = _ref2; | |
| 3710 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 3711 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description" | |
| 3712 | - }, description), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 3713 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term" | |
| 3714 | - }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { | |
| 3715 | - keyCombination: keyCombination, | |
| 3716 | - forceAriaLabel: ariaLabel | |
| 3717 | - }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { | |
| 3718 | - keyCombination: alias, | |
| 3719 | - forceAriaLabel: ariaLabel, | |
| 3720 | - key: index | |
| 3721 | - })))); | |
| 3722 | -} | |
| 3723 | - | |
| 3724 | -/* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut); | |
| 3725 | -//# sourceMappingURL=shortcut.js.map | |
| 3726 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js | |
| 3727 | - | |
| 3728 | - | |
| 3729 | -/** | |
| 3730 | - * WordPress dependencies | |
| 3731 | - */ | |
| 3732 | - | |
| 3733 | - | |
| 3734 | -/** | |
| 3735 | - * Internal dependencies | |
| 3736 | - */ | |
| 3737 | - | |
| 3738 | - | |
| 3739 | - | |
| 3740 | -function DynamicShortcut(_ref) { | |
| 3741 | - let { | |
| 3742 | - name | |
| 3743 | - } = _ref; | |
| 3744 | - const { | |
| 3745 | - keyCombination, | |
| 3746 | - description, | |
| 3747 | - aliases | |
| 3748 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 3749 | - const { | |
| 3750 | - getShortcutKeyCombination, | |
| 3751 | - getShortcutDescription, | |
| 3752 | - getShortcutAliases | |
| 3753 | - } = select(external_wp_keyboardShortcuts_namespaceObject.store); | |
| 3754 | - return { | |
| 3755 | - keyCombination: getShortcutKeyCombination(name), | |
| 3756 | - aliases: getShortcutAliases(name), | |
| 3757 | - description: getShortcutDescription(name) | |
| 3758 | - }; | |
| 3759 | - }, [name]); | |
| 3760 | - | |
| 3761 | - if (!keyCombination) { | |
| 3762 | - return null; | |
| 3763 | - } | |
| 3764 | - | |
| 3765 | - return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { | |
| 3766 | - keyCombination: keyCombination, | |
| 3767 | - description: description, | |
| 3768 | - aliases: aliases | |
| 3769 | - }); | |
| 3770 | -} | |
| 3771 | - | |
| 3772 | -/* harmony default export */ var dynamic_shortcut = (DynamicShortcut); | |
| 3773 | -//# sourceMappingURL=dynamic-shortcut.js.map | |
| 3774 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js | |
| 3775 | - | |
| 3776 | - | |
| 3777 | -/** | |
| 3778 | - * External dependencies | |
| 3779 | - */ | |
| 3780 | - | |
| 3781 | - | |
| 3782 | -/** | |
| 3783 | - * WordPress dependencies | |
| 3784 | - */ | |
| 3785 | - | |
| 3786 | - | |
| 3787 | - | |
| 3788 | - | |
| 3789 | - | |
| 3790 | -/** | |
| 3791 | - * Internal dependencies | |
| 3792 | - */ | |
| 3793 | - | |
| 3794 | - | |
| 3795 | - | |
| 3796 | - | |
| 3797 | - | |
| 3798 | -const ShortcutList = _ref => { | |
| 3799 | - let { | |
| 3800 | - shortcuts | |
| 3801 | - } = _ref; | |
| 3802 | - return ( | |
| 3803 | - /* | |
| 3804 | - * Disable reason: The `list` ARIA role is redundant but | |
| 3805 | - * Safari+VoiceOver won't announce the list otherwise. | |
| 3806 | - */ | |
| 3807 | - | |
| 3808 | - /* eslint-disable jsx-a11y/no-redundant-roles */ | |
| 3809 | - (0,external_wp_element_namespaceObject.createElement)("ul", { | |
| 3810 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", | |
| 3811 | - role: "list" | |
| 3812 | - }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { | |
| 3813 | - className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", | |
| 3814 | - key: index | |
| 3815 | - }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, { | |
| 3816 | - name: shortcut | |
| 3817 | - }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut)))) | |
| 3818 | - /* eslint-enable jsx-a11y/no-redundant-roles */ | |
| 3819 | - | |
| 3820 | - ); | |
| 3821 | -}; | |
| 3822 | - | |
| 3823 | -const ShortcutSection = _ref2 => { | |
| 3824 | - let { | |
| 3825 | - title, | |
| 3826 | - shortcuts, | |
| 3827 | - className | |
| 3828 | - } = _ref2; | |
| 3829 | - return (0,external_wp_element_namespaceObject.createElement)("section", { | |
| 3830 | - className: classnames_default()('edit-widgets-keyboard-shortcut-help-modal__section', className) | |
| 3831 | - }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { | |
| 3832 | - className: "edit-widgets-keyboard-shortcut-help-modal__section-title" | |
| 3833 | - }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { | |
| 3834 | - shortcuts: shortcuts | |
| 3835 | - })); | |
| 3836 | -}; | |
| 3837 | - | |
| 3838 | -const ShortcutCategorySection = _ref3 => { | |
| 3839 | - let { | |
| 3840 | - title, | |
| 3841 | - categoryName, | |
| 3842 | - additionalShortcuts = [] | |
| 3843 | - } = _ref3; | |
| 3844 | - const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 3845 | - return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); | |
| 3846 | - }, [categoryName]); | |
| 3847 | - return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { | |
| 3848 | - title: title, | |
| 3849 | - shortcuts: categoryShortcuts.concat(additionalShortcuts) | |
| 3850 | - }); | |
| 3851 | -}; | |
| 3852 | - | |
| 3853 | -function KeyboardShortcutHelpModal(_ref4) { | |
| 3854 | - let { | |
| 3855 | - isModalActive, | |
| 3856 | - toggleModal | |
| 3857 | - } = _ref4; | |
| 3858 | - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleModal, { | |
| 3859 | - bindGlobal: true | |
| 3860 | - }); | |
| 3861 | - | |
| 3862 | - if (!isModalActive) { | |
| 3863 | - return null; | |
| 3864 | - } | |
| 3865 | - | |
| 3866 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { | |
| 3867 | - className: "edit-widgets-keyboard-shortcut-help-modal", | |
| 3868 | - title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), | |
| 3869 | - closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), | |
| 3870 | - onRequestClose: toggleModal | |
| 3871 | - }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { | |
| 3872 | - className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", | |
| 3873 | - shortcuts: ['core/edit-widgets/keyboard-shortcuts'] | |
| 3874 | - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { | |
| 3875 | - title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), | |
| 3876 | - categoryName: "global" | |
| 3877 | - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { | |
| 3878 | - title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), | |
| 3879 | - categoryName: "selection" | |
| 3880 | - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { | |
| 3881 | - title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), | |
| 3882 | - categoryName: "block", | |
| 3883 | - additionalShortcuts: [{ | |
| 3884 | - keyCombination: { | |
| 3885 | - character: '/' | |
| 3886 | - }, | |
| 3887 | - description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), | |
| 3888 | - | |
| 3889 | - /* translators: The forward-slash character. e.g. '/'. */ | |
| 3890 | - ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') | |
| 3891 | - }] | |
| 3892 | - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { | |
| 3893 | - title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), | |
| 3894 | - shortcuts: textFormattingShortcuts | |
| 3895 | - })); | |
| 3896 | -} | |
| 3897 | -//# sourceMappingURL=index.js.map | |
| 3898 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/more-menu/tools-more-menu-group.js | |
| 3899 | - | |
| 3900 | - | |
| 3901 | -/** | |
| 3902 | - * External dependencies | |
| 3903 | - */ | |
| 3904 | - | |
| 3905 | -/** | |
| 3906 | - * WordPress dependencies | |
| 3907 | - */ | |
| 3908 | - | |
| 3909 | - | |
| 3910 | -const { | |
| 3911 | - Fill: ToolsMoreMenuGroup, | |
| 3912 | - Slot | |
| 3913 | -} = (0,external_wp_components_namespaceObject.createSlotFill)('EditWidgetsToolsMoreMenuGroup'); | |
| 3914 | - | |
| 3915 | -ToolsMoreMenuGroup.Slot = _ref => { | |
| 3916 | - let { | |
| 3917 | - fillProps | |
| 3918 | - } = _ref; | |
| 3919 | - return (0,external_wp_element_namespaceObject.createElement)(Slot, { | |
| 3920 | - fillProps: fillProps | |
| 3921 | - }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills); | |
| 3922 | -}; | |
| 3923 | - | |
| 3924 | -/* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); | |
| 3925 | -//# sourceMappingURL=tools-more-menu-group.js.map | |
| 3926 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/more-menu/index.js | |
| 3927 | - | |
| 3928 | - | |
| 3929 | -/** | |
| 3930 | - * WordPress dependencies | |
| 3931 | - */ | |
| 3932 | - | |
| 3933 | - | |
| 3934 | - | |
| 3935 | - | |
| 3936 | - | |
| 3937 | - | |
| 3938 | - | |
| 3939 | - | |
| 3940 | -/** | |
| 3941 | - * Internal dependencies | |
| 3942 | - */ | |
| 3943 | - | |
| 3944 | - | |
| 3945 | - | |
| 3946 | -function MoreMenu() { | |
| 3947 | - const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); | |
| 3948 | - | |
| 3949 | - const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); | |
| 3950 | - | |
| 3951 | - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal); | |
| 3952 | - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); | |
| 3953 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, onClose => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { | |
| 3954 | - label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') | |
| 3955 | - }, (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, { | |
| 3956 | - scope: "core/edit-widgets", | |
| 3957 | - feature: "fixedToolbar", | |
| 3958 | - label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), | |
| 3959 | - info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), | |
| 3960 | - messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), | |
| 3961 | - messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') | |
| 3962 | - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { | |
| 3963 | - label: (0,external_wp_i18n_namespaceObject.__)('Tools') | |
| 3964 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { | |
| 3965 | - onClick: () => { | |
| 3966 | - setIsKeyboardShortcutsModalVisible(true); | |
| 3967 | - }, | |
| 3968 | - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') | |
| 3969 | - }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, { | |
| 3970 | - scope: "core/edit-widgets", | |
| 3971 | - feature: "welcomeGuide", | |
| 3972 | - label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') | |
| 3973 | - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { | |
| 3974 | - role: "menuitem", | |
| 3975 | - icon: library_external, | |
| 3976 | - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/block-based-widgets-editor/'), | |
| 3977 | - target: "_blank", | |
| 3978 | - rel: "noopener noreferrer" | |
| 3979 | - }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { | |
| 3980 | - as: "span" | |
| 3981 | - }, | |
| 3982 | - /* translators: accessibility text */ | |
| 3983 | - (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { | |
| 3984 | - fillProps: { | |
| 3985 | - onClose | |
| 3986 | - } | |
| 3987 | - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { | |
| 3988 | - label: (0,external_wp_i18n_namespaceObject.__)('Preferences') | |
| 3989 | - }, (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, { | |
| 3990 | - scope: "core/edit-widgets", | |
| 3991 | - feature: "keepCaretInsideBlock", | |
| 3992 | - label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'), | |
| 3993 | - info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), | |
| 3994 | - messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'), | |
| 3995 | - messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated') | |
| 3996 | - }), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, { | |
| 3997 | - scope: "core/edit-widgets", | |
| 3998 | - feature: "themeStyles", | |
| 3999 | - info: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), | |
| 4000 | - label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') | |
| 4001 | - }), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, { | |
| 4002 | - scope: "core/edit-widgets", | |
| 4003 | - feature: "showBlockBreadcrumbs", | |
| 4004 | - label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs'), | |
| 4005 | - info: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'), | |
| 4006 | - messageActivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs activated'), | |
| 4007 | - messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs deactivated') | |
| 4008 | - })))), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, { | |
| 4009 | - isModalActive: isKeyboardShortcutsModalActive, | |
| 4010 | - toggleModal: toggleKeyboardShortcutsModal | |
| 4011 | - })); | |
| 4012 | -} | |
| 4013 | -//# sourceMappingURL=index.js.map | |
| 4014 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/header/index.js | |
| 4015 | - | |
| 4016 | - | |
| 4017 | -/** | |
| 4018 | - * WordPress dependencies | |
| 4019 | - */ | |
| 4020 | - | |
| 4021 | - | |
| 4022 | - | |
| 4023 | - | |
| 4024 | - | |
| 4025 | - | |
| 4026 | - | |
| 4027 | - | |
| 4028 | -/** | |
| 4029 | - * Internal dependencies | |
| 4030 | - */ | |
| 4031 | - | |
| 4032 | - | |
| 4033 | - | |
| 4034 | - | |
| 4035 | - | |
| 4036 | - | |
| 4037 | - | |
| 4038 | - | |
| 4039 | -function Header() { | |
| 4040 | - const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); | |
| 4041 | - const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); | |
| 4042 | - const widgetAreaClientId = use_last_selected_widget_area(); | |
| 4043 | - const isLastSelectedWidgetAreaOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]); | |
| 4044 | - const { | |
| 4045 | - isInserterOpen, | |
| 4046 | - isListViewOpen | |
| 4047 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4048 | - const { | |
| 4049 | - isInserterOpened, | |
| 4050 | - isListViewOpened | |
| 4051 | - } = select(store_store); | |
| 4052 | - return { | |
| 4053 | - isInserterOpen: isInserterOpened(), | |
| 4054 | - isListViewOpen: isListViewOpened() | |
| 4055 | - }; | |
| 4056 | - }, []); | |
| 4057 | - const { | |
| 4058 | - setIsWidgetAreaOpen, | |
| 4059 | - setIsInserterOpened, | |
| 4060 | - setIsListViewOpened | |
| 4061 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 4062 | - const { | |
| 4063 | - selectBlock | |
| 4064 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); | |
| 4065 | - | |
| 4066 | - const handleClick = () => { | |
| 4067 | - if (isInserterOpen) { | |
| 4068 | - // Focusing the inserter button closes the inserter popover | |
| 4069 | - setIsInserterOpened(false); | |
| 4070 | - } else { | |
| 4071 | - if (!isLastSelectedWidgetAreaOpen) { | |
| 4072 | - // Select the last selected block if hasn't already. | |
| 4073 | - selectBlock(widgetAreaClientId); // Open the last selected widget area when opening the inserter. | |
| 4074 | - | |
| 4075 | - setIsWidgetAreaOpen(widgetAreaClientId, true); | |
| 4076 | - } // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the | |
| 4077 | - // same tick and pretty much in a random order. The inserter is closed if any other part of the | |
| 4078 | - // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then | |
| 4079 | - // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to | |
| 4080 | - // the selected block. | |
| 4081 | - | |
| 4082 | - | |
| 4083 | - window.requestAnimationFrame(() => setIsInserterOpened(true)); | |
| 4084 | - } | |
| 4085 | - }; | |
| 4086 | - | |
| 4087 | - const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); | |
| 4088 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4089 | - className: "edit-widgets-header" | |
| 4090 | - }, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4091 | - className: "edit-widgets-header__navigable-toolbar-wrapper" | |
| 4092 | - }, isMediumViewport && (0,external_wp_element_namespaceObject.createElement)("h1", { | |
| 4093 | - className: "edit-widgets-header__title" | |
| 4094 | - }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), !isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { | |
| 4095 | - as: "h1", | |
| 4096 | - className: "edit-widgets-header__title" | |
| 4097 | - }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { | |
| 4098 | - className: "edit-widgets-header-toolbar", | |
| 4099 | - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools') | |
| 4100 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { | |
| 4101 | - ref: inserterButton, | |
| 4102 | - as: external_wp_components_namespaceObject.Button, | |
| 4103 | - className: "edit-widgets-header-toolbar__inserter-toggle", | |
| 4104 | - variant: "primary", | |
| 4105 | - isPressed: isInserterOpen, | |
| 4106 | - onMouseDown: event => { | |
| 4107 | - event.preventDefault(); | |
| 4108 | - }, | |
| 4109 | - onClick: handleClick, | |
| 4110 | - icon: library_plus | |
| 4111 | - /* translators: button label text should, if possible, be under 16 | |
| 4112 | - characters. */ | |
| 4113 | - , | |
| 4114 | - label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button') | |
| 4115 | - }), isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(UndoButton, null), (0,external_wp_element_namespaceObject.createElement)(RedoButton, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { | |
| 4116 | - as: external_wp_components_namespaceObject.Button, | |
| 4117 | - className: "edit-widgets-header-toolbar__list-view-toggle", | |
| 4118 | - icon: list_view, | |
| 4119 | - isPressed: isListViewOpen | |
| 4120 | - /* translators: button label text should, if possible, be under 16 characters. */ | |
| 4121 | - , | |
| 4122 | - label: (0,external_wp_i18n_namespaceObject.__)('List View'), | |
| 4123 | - onClick: toggleListView | |
| 4124 | - })))), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4125 | - className: "edit-widgets-header__actions" | |
| 4126 | - }, (0,external_wp_element_namespaceObject.createElement)(save_button, null), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { | |
| 4127 | - scope: "core/edit-widgets" | |
| 4128 | - }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null)))); | |
| 4129 | -} | |
| 4130 | - | |
| 4131 | -/* harmony default export */ var header = (Header); | |
| 4132 | -//# sourceMappingURL=index.js.map | |
| 4133 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/notices/index.js | |
| 4134 | - | |
| 4135 | - | |
| 4136 | -/** | |
| 4137 | - * External dependencies | |
| 4138 | - */ | |
| 4139 | - | |
| 4140 | -/** | |
| 4141 | - * WordPress dependencies | |
| 4142 | - */ | |
| 4143 | - | |
| 4144 | - | |
| 4145 | - | |
| 4146 | - | |
| 4147 | - | |
| 4148 | -function Notices() { | |
| 4149 | - const { | |
| 4150 | - removeNotice | |
| 4151 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); | |
| 4152 | - const { | |
| 4153 | - notices | |
| 4154 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4155 | - return { | |
| 4156 | - notices: select(external_wp_notices_namespaceObject.store).getNotices() | |
| 4157 | - }; | |
| 4158 | - }, []); | |
| 4159 | - const dismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { | |
| 4160 | - isDismissible: true, | |
| 4161 | - type: 'default' | |
| 4162 | - }); | |
| 4163 | - const nonDismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { | |
| 4164 | - isDismissible: false, | |
| 4165 | - type: 'default' | |
| 4166 | - }); | |
| 4167 | - const snackbarNotices = (0,external_lodash_namespaceObject.filter)(notices, { | |
| 4168 | - type: 'snackbar' | |
| 4169 | - }); | |
| 4170 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { | |
| 4171 | - notices: nonDismissibleNotices, | |
| 4172 | - className: "edit-widgets-notices__pinned" | |
| 4173 | - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { | |
| 4174 | - notices: dismissibleNotices, | |
| 4175 | - className: "edit-widgets-notices__dismissible", | |
| 4176 | - onRemove: removeNotice | |
| 4177 | - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, { | |
| 4178 | - notices: snackbarNotices, | |
| 4179 | - className: "edit-widgets-notices__snackbar", | |
| 4180 | - onRemove: removeNotice | |
| 4181 | - })); | |
| 4182 | -} | |
| 4183 | - | |
| 4184 | -/* harmony default export */ var notices = (Notices); | |
| 4185 | -//# sourceMappingURL=index.js.map | |
| 4186 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js | |
| 4187 | - | |
| 4188 | - | |
| 4189 | -/** | |
| 4190 | - * WordPress dependencies | |
| 4191 | - */ | |
| 4192 | - | |
| 4193 | - | |
| 4194 | - | |
| 4195 | - | |
| 4196 | -/** | |
| 4197 | - * Internal dependencies | |
| 4198 | - */ | |
| 4199 | - | |
| 4200 | - | |
| 4201 | - | |
| 4202 | -function WidgetAreasBlockEditorContent(_ref) { | |
| 4203 | - let { | |
| 4204 | - blockEditorSettings | |
| 4205 | - } = _ref; | |
| 4206 | - const hasThemeStyles = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isFeatureActive('core/edit-widgets', 'themeStyles'), []); | |
| 4207 | - const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { | |
| 4208 | - return hasThemeStyles ? blockEditorSettings.styles : []; | |
| 4209 | - }, [blockEditorSettings, hasThemeStyles]); | |
| 4210 | - return (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4211 | - className: "edit-widgets-block-editor" | |
| 4212 | - }, (0,external_wp_element_namespaceObject.createElement)(notices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { | |
| 4213 | - styles: styles | |
| 4214 | - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ObserveTyping, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { | |
| 4215 | - className: "edit-widgets-main-block-list" | |
| 4216 | - })))))); | |
| 4217 | -} | |
| 4218 | -//# sourceMappingURL=index.js.map | |
| 4219 | -;// CONCATENATED MODULE: ./packages/icons/build-module/library/close.js | |
| 4220 | - | |
| 4221 | - | |
| 4222 | -/** | |
| 4223 | - * WordPress dependencies | |
| 4224 | - */ | |
| 4225 | - | |
| 4226 | -const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { | |
| 4227 | - xmlns: "http://www.w3.org/2000/svg", | |
| 4228 | - viewBox: "0 0 24 24" | |
| 4229 | -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { | |
| 4230 | - 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" | |
| 4231 | -})); | |
| 4232 | -/* harmony default export */ var library_close = (close_close); | |
| 4233 | -//# sourceMappingURL=close.js.map | |
| 4234 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js | |
| 4235 | -/** | |
| 4236 | - * WordPress dependencies | |
| 4237 | - */ | |
| 4238 | - | |
| 4239 | - | |
| 4240 | - | |
| 4241 | -/** | |
| 4242 | - * Internal dependencies | |
| 4243 | - */ | |
| 4244 | - | |
| 4245 | - | |
| 4246 | - | |
| 4247 | - | |
| 4248 | -const useWidgetLibraryInsertionPoint = () => { | |
| 4249 | - const firstRootId = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4250 | - var _widgetAreasPost$bloc; | |
| 4251 | - | |
| 4252 | - // Default to the first widget area | |
| 4253 | - const { | |
| 4254 | - getEntityRecord | |
| 4255 | - } = select(external_wp_coreData_namespaceObject.store); | |
| 4256 | - const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); | |
| 4257 | - return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId; | |
| 4258 | - }, []); | |
| 4259 | - return (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4260 | - const { | |
| 4261 | - getBlockRootClientId, | |
| 4262 | - getBlockSelectionEnd, | |
| 4263 | - getBlockOrder, | |
| 4264 | - getBlockIndex | |
| 4265 | - } = select(external_wp_blockEditor_namespaceObject.store); | |
| 4266 | - | |
| 4267 | - const insertionPoint = select(store_store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block. | |
| 4268 | - // Otherwise, it will just be undefined, and we'll have to handle it differently below. | |
| 4269 | - | |
| 4270 | - | |
| 4271 | - if (insertionPoint.rootClientId) { | |
| 4272 | - return insertionPoint; | |
| 4273 | - } | |
| 4274 | - | |
| 4275 | - const clientId = getBlockSelectionEnd() || firstRootId; | |
| 4276 | - const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and | |
| 4277 | - // blocks can't be inserted here. Return this block as the root and the | |
| 4278 | - // last child clientId indicating insertion at the end. | |
| 4279 | - | |
| 4280 | - if (clientId && rootClientId === '') { | |
| 4281 | - return { | |
| 4282 | - rootClientId: clientId, | |
| 4283 | - insertionIndex: getBlockOrder(clientId).length | |
| 4284 | - }; | |
| 4285 | - } | |
| 4286 | - | |
| 4287 | - return { | |
| 4288 | - rootClientId, | |
| 4289 | - insertionIndex: getBlockIndex(clientId) + 1 | |
| 4290 | - }; | |
| 4291 | - }, [firstRootId]); | |
| 4292 | -}; | |
| 4293 | - | |
| 4294 | -/* harmony default export */ var use_widget_library_insertion_point = (useWidgetLibraryInsertionPoint); | |
| 4295 | -//# sourceMappingURL=use-widget-library-insertion-point.js.map | |
| 4296 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.js | |
| 4297 | - | |
| 4298 | - | |
| 4299 | - | |
| 4300 | -/** | |
| 4301 | - * WordPress dependencies | |
| 4302 | - */ | |
| 4303 | - | |
| 4304 | - | |
| 4305 | - | |
| 4306 | - | |
| 4307 | - | |
| 4308 | - | |
| 4309 | - | |
| 4310 | -/** | |
| 4311 | - * Internal dependencies | |
| 4312 | - */ | |
| 4313 | - | |
| 4314 | - | |
| 4315 | - | |
| 4316 | -function InserterSidebar() { | |
| 4317 | - const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); | |
| 4318 | - const { | |
| 4319 | - rootClientId, | |
| 4320 | - insertionIndex | |
| 4321 | - } = use_widget_library_insertion_point(); | |
| 4322 | - const { | |
| 4323 | - setIsInserterOpened | |
| 4324 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 4325 | - const closeInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { | |
| 4326 | - return setIsInserterOpened(false); | |
| 4327 | - }, [setIsInserterOpened]); | |
| 4328 | - const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; | |
| 4329 | - const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ | |
| 4330 | - onClose: closeInserter, | |
| 4331 | - focusOnMount: null | |
| 4332 | - }); | |
| 4333 | - const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); | |
| 4334 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4335 | - libraryRef.current.focusSearch(); | |
| 4336 | - }, []); | |
| 4337 | - return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ | |
| 4338 | - ref: inserterDialogRef | |
| 4339 | - }, inserterDialogProps, { | |
| 4340 | - className: "edit-widgets-layout__inserter-panel" | |
| 4341 | - }), (0,external_wp_element_namespaceObject.createElement)(TagName, { | |
| 4342 | - className: "edit-widgets-layout__inserter-panel-header" | |
| 4343 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 4344 | - icon: library_close, | |
| 4345 | - onClick: closeInserter, | |
| 4346 | - label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter') | |
| 4347 | - })), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4348 | - className: "edit-widgets-layout__inserter-panel-content" | |
| 4349 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { | |
| 4350 | - showInserterHelpPanel: true, | |
| 4351 | - shouldFocusBlock: isMobileViewport, | |
| 4352 | - rootClientId: rootClientId, | |
| 4353 | - __experimentalInsertionIndex: insertionIndex, | |
| 4354 | - ref: libraryRef | |
| 4355 | - }))); | |
| 4356 | -} | |
| 4357 | -//# sourceMappingURL=inserter-sidebar.js.map | |
| 4358 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.js | |
| 4359 | - | |
| 4360 | - | |
| 4361 | -/** | |
| 4362 | - * WordPress dependencies | |
| 4363 | - */ | |
| 4364 | - | |
| 4365 | - | |
| 4366 | - | |
| 4367 | - | |
| 4368 | - | |
| 4369 | - | |
| 4370 | - | |
| 4371 | -/** | |
| 4372 | - * Internal dependencies | |
| 4373 | - */ | |
| 4374 | - | |
| 4375 | - | |
| 4376 | -function ListViewSidebar() { | |
| 4377 | - const { | |
| 4378 | - setIsListViewOpened | |
| 4379 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 4380 | - const { | |
| 4381 | - clearSelectedBlock, | |
| 4382 | - selectBlock | |
| 4383 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); | |
| 4384 | - | |
| 4385 | - async function selectEditorBlock(clientId) { | |
| 4386 | - await clearSelectedBlock(); | |
| 4387 | - selectBlock(clientId, -1); | |
| 4388 | - } | |
| 4389 | - | |
| 4390 | - const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); | |
| 4391 | - const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); | |
| 4392 | - const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); | |
| 4393 | - | |
| 4394 | - function closeOnEscape(event) { | |
| 4395 | - if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { | |
| 4396 | - event.preventDefault(); | |
| 4397 | - setIsListViewOpened(false); | |
| 4398 | - } | |
| 4399 | - } | |
| 4400 | - | |
| 4401 | - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar); | |
| 4402 | - const labelId = `edit-widgets-editor__list-view-panel-label-${instanceId}`; | |
| 4403 | - return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions | |
| 4404 | - (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4405 | - "aria-labelledby": labelId, | |
| 4406 | - className: "edit-widgets-editor__list-view-panel", | |
| 4407 | - onKeyDown: closeOnEscape | |
| 4408 | - }, (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4409 | - className: "edit-widgets-editor__list-view-panel-header", | |
| 4410 | - ref: headerFocusReturnRef | |
| 4411 | - }, (0,external_wp_element_namespaceObject.createElement)("strong", { | |
| 4412 | - id: labelId | |
| 4413 | - }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { | |
| 4414 | - icon: close_small, | |
| 4415 | - label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'), | |
| 4416 | - onClick: () => setIsListViewOpened(false) | |
| 4417 | - })), (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4418 | - className: "edit-widgets-editor__list-view-panel-content", | |
| 4419 | - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef]) | |
| 4420 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { | |
| 4421 | - onSelect: selectEditorBlock, | |
| 4422 | - showNestedBlocks: true, | |
| 4423 | - __experimentalHideContainerBlockActions: true, | |
| 4424 | - __experimentalFeatures: true, | |
| 4425 | - __experimentalPersistentListViewFeatures: true | |
| 4426 | - }))) | |
| 4427 | - ); | |
| 4428 | -} | |
| 4429 | -//# sourceMappingURL=list-view-sidebar.js.map | |
| 4430 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/secondary-sidebar/index.js | |
| 4431 | - | |
| 4432 | - | |
| 4433 | -/** | |
| 4434 | - * WordPress dependencies | |
| 4435 | - */ | |
| 4436 | - | |
| 4437 | -/** | |
| 4438 | - * Internal dependencies | |
| 4439 | - */ | |
| 4440 | - | |
| 4441 | - | |
| 4442 | -/** | |
| 4443 | - * Internal dependencies | |
| 4444 | - */ | |
| 4445 | - | |
| 4446 | - | |
| 4447 | - | |
| 4448 | -function SecondarySidebar() { | |
| 4449 | - const { | |
| 4450 | - isInserterOpen, | |
| 4451 | - isListViewOpen | |
| 4452 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4453 | - const { | |
| 4454 | - isInserterOpened, | |
| 4455 | - isListViewOpened | |
| 4456 | - } = select(store_store); | |
| 4457 | - return { | |
| 4458 | - isInserterOpen: isInserterOpened(), | |
| 4459 | - isListViewOpen: isListViewOpened() | |
| 4460 | - }; | |
| 4461 | - }, []); | |
| 4462 | - | |
| 4463 | - if (isInserterOpen) { | |
| 4464 | - return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); | |
| 4465 | - } | |
| 4466 | - | |
| 4467 | - if (isListViewOpen) { | |
| 4468 | - return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null); | |
| 4469 | - } | |
| 4470 | - | |
| 4471 | - return null; | |
| 4472 | -} | |
| 4473 | -//# sourceMappingURL=index.js.map | |
| 4474 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/layout/interface.js | |
| 4475 | - | |
| 4476 | - | |
| 4477 | -/** | |
| 4478 | - * WordPress dependencies | |
| 4479 | - */ | |
| 4480 | - | |
| 4481 | - | |
| 4482 | - | |
| 4483 | - | |
| 4484 | - | |
| 4485 | - | |
| 4486 | - | |
| 4487 | -/** | |
| 4488 | - * Internal dependencies | |
| 4489 | - */ | |
| 4490 | - | |
| 4491 | - | |
| 4492 | - | |
| 4493 | - | |
| 4494 | - | |
| 4495 | -const interfaceLabels = { | |
| 4496 | - /* translators: accessibility text for the widgets screen top bar landmark region. */ | |
| 4497 | - header: (0,external_wp_i18n_namespaceObject.__)('Widgets top bar'), | |
| 4498 | - | |
| 4499 | - /* translators: accessibility text for the widgets screen content landmark region. */ | |
| 4500 | - body: (0,external_wp_i18n_namespaceObject.__)('Widgets and blocks'), | |
| 4501 | - | |
| 4502 | - /* translators: accessibility text for the widgets screen settings landmark region. */ | |
| 4503 | - sidebar: (0,external_wp_i18n_namespaceObject.__)('Widgets settings'), | |
| 4504 | - | |
| 4505 | - /* translators: accessibility text for the widgets screen footer landmark region. */ | |
| 4506 | - footer: (0,external_wp_i18n_namespaceObject.__)('Widgets footer') | |
| 4507 | -}; | |
| 4508 | - | |
| 4509 | -function Interface(_ref) { | |
| 4510 | - let { | |
| 4511 | - blockEditorSettings | |
| 4512 | - } = _ref; | |
| 4513 | - const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); | |
| 4514 | - const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); | |
| 4515 | - const { | |
| 4516 | - setIsInserterOpened, | |
| 4517 | - setIsListViewOpened, | |
| 4518 | - closeGeneralSidebar | |
| 4519 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); | |
| 4520 | - const { | |
| 4521 | - hasBlockBreadCrumbsEnabled, | |
| 4522 | - hasSidebarEnabled, | |
| 4523 | - isInserterOpened, | |
| 4524 | - isListViewOpened, | |
| 4525 | - previousShortcut, | |
| 4526 | - nextShortcut | |
| 4527 | - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ | |
| 4528 | - hasSidebarEnabled: !!select(store).getActiveComplementaryArea(store_store.name), | |
| 4529 | - isInserterOpened: !!select(store_store).isInserterOpened(), | |
| 4530 | - isListViewOpened: !!select(store_store).isListViewOpened(), | |
| 4531 | - hasBlockBreadCrumbsEnabled: select(store).isFeatureActive('core/edit-widgets', 'showBlockBreadcrumbs'), | |
| 4532 | - previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'), | |
| 4533 | - nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region') | |
| 4534 | - }), []); // Inserter and Sidebars are mutually exclusive | |
| 4535 | - | |
| 4536 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4537 | - if (hasSidebarEnabled && !isHugeViewport) { | |
| 4538 | - setIsInserterOpened(false); | |
| 4539 | - setIsListViewOpened(false); | |
| 4540 | - } | |
| 4541 | - }, [hasSidebarEnabled, isHugeViewport]); | |
| 4542 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4543 | - if ((isInserterOpened || isListViewOpened) && !isHugeViewport) { | |
| 4544 | - closeGeneralSidebar(); | |
| 4545 | - } | |
| 4546 | - }, [isInserterOpened, isListViewOpened, isHugeViewport]); | |
| 4547 | - const hasSecondarySidebar = isListViewOpened || isInserterOpened; | |
| 4548 | - return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { | |
| 4549 | - labels: interfaceLabels, | |
| 4550 | - header: (0,external_wp_element_namespaceObject.createElement)(header, null), | |
| 4551 | - secondarySidebar: hasSecondarySidebar && (0,external_wp_element_namespaceObject.createElement)(SecondarySidebar, null), | |
| 4552 | - sidebar: hasSidebarEnabled && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { | |
| 4553 | - scope: "core/edit-widgets" | |
| 4554 | - }), | |
| 4555 | - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorContent, { | |
| 4556 | - blockEditorSettings: blockEditorSettings | |
| 4557 | - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, { | |
| 4558 | - scope: "core/block-inspector" | |
| 4559 | - })), | |
| 4560 | - footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4561 | - className: "edit-widgets-layout__footer" | |
| 4562 | - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { | |
| 4563 | - rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Widgets') | |
| 4564 | - })), | |
| 4565 | - shortcuts: { | |
| 4566 | - previous: previousShortcut, | |
| 4567 | - next: nextShortcut | |
| 4568 | - } | |
| 4569 | - }); | |
| 4570 | -} | |
| 4571 | - | |
| 4572 | -/* harmony default export */ var layout_interface = (Interface); | |
| 4573 | -//# sourceMappingURL=interface.js.map | |
| 4574 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/layout/unsaved-changes-warning.js | |
| 4575 | -/** | |
| 4576 | - * WordPress dependencies | |
| 4577 | - */ | |
| 4578 | - | |
| 4579 | - | |
| 4580 | - | |
| 4581 | -/** | |
| 4582 | - * Internal dependencies | |
| 4583 | - */ | |
| 4584 | - | |
| 4585 | - | |
| 4586 | -/** | |
| 4587 | - * Warns the user if there are unsaved changes before leaving the editor. | |
| 4588 | - * | |
| 4589 | - * This is a duplicate of the component implemented in the editor package. | |
| 4590 | - * Duplicated here as edit-widgets doesn't depend on editor. | |
| 4591 | - * | |
| 4592 | - * @return {WPComponent} The component. | |
| 4593 | - */ | |
| 4594 | - | |
| 4595 | -function UnsavedChangesWarning() { | |
| 4596 | - const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => { | |
| 4597 | - const { | |
| 4598 | - getEditedWidgetAreas | |
| 4599 | - } = select(store_store); | |
| 4600 | - const editedWidgetAreas = getEditedWidgetAreas(); | |
| 4601 | - return (editedWidgetAreas === null || editedWidgetAreas === void 0 ? void 0 : editedWidgetAreas.length) > 0; | |
| 4602 | - }, []); | |
| 4603 | - (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4604 | - /** | |
| 4605 | - * Warns the user if there are unsaved changes before leaving the editor. | |
| 4606 | - * | |
| 4607 | - * @param {Event} event `beforeunload` event. | |
| 4608 | - * | |
| 4609 | - * @return {?string} Warning prompt message, if unsaved changes exist. | |
| 4610 | - */ | |
| 4611 | - const warnIfUnsavedChanges = event => { | |
| 4612 | - if (isDirty) { | |
| 4613 | - event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); | |
| 4614 | - return event.returnValue; | |
| 4615 | - } | |
| 4616 | - }; | |
| 4617 | - | |
| 4618 | - window.addEventListener('beforeunload', warnIfUnsavedChanges); | |
| 4619 | - return () => { | |
| 4620 | - window.removeEventListener('beforeunload', warnIfUnsavedChanges); | |
| 4621 | - }; | |
| 4622 | - }, [isDirty]); | |
| 4623 | - return null; | |
| 4624 | -} | |
| 4625 | -//# sourceMappingURL=unsaved-changes-warning.js.map | |
| 4626 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/welcome-guide/index.js | |
| 4627 | - | |
| 4628 | - | |
| 4629 | -/** | |
| 4630 | - * WordPress dependencies | |
| 4631 | - */ | |
| 4632 | - | |
| 4633 | - | |
| 4634 | - | |
| 4635 | - | |
| 4636 | - | |
| 4637 | -/** | |
| 4638 | - * Internal dependencies | |
| 4639 | - */ | |
| 4640 | - | |
| 4641 | - | |
| 4642 | -function WelcomeGuide() { | |
| 4643 | - var _widgetAreas$filter$l; | |
| 4644 | - | |
| 4645 | - const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isFeatureActive('core/edit-widgets', 'welcomeGuide'), []); | |
| 4646 | - const { | |
| 4647 | - toggleFeature | |
| 4648 | - } = (0,external_wp_data_namespaceObject.useDispatch)(store); | |
| 4649 | - const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas({ | |
| 4650 | - per_page: -1 | |
| 4651 | - }), []); | |
| 4652 | - | |
| 4653 | - if (!isActive) { | |
| 4654 | - return null; | |
| 4655 | - } | |
| 4656 | - | |
| 4657 | - const isEntirelyBlockWidgets = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-'))); | |
| 4658 | - const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0; | |
| 4659 | - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { | |
| 4660 | - className: "edit-widgets-welcome-guide", | |
| 4661 | - contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets'), | |
| 4662 | - finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), | |
| 4663 | - onFinish: () => toggleFeature('core/edit-widgets', 'welcomeGuide'), | |
| 4664 | - pages: [{ | |
| 4665 | - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { | |
| 4666 | - nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", | |
| 4667 | - animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" | |
| 4668 | - }), | |
| 4669 | - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { | |
| 4670 | - className: "edit-widgets-welcome-guide__heading" | |
| 4671 | - }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), isEntirelyBlockWidgets ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4672 | - className: "edit-widgets-welcome-guide__text" | |
| 4673 | - }, (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Number of block areas in the current theme. | |
| 4674 | - (0,external_wp_i18n_namespaceObject._n)('Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', 'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', numWidgetAreas), numWidgetAreas))) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4675 | - className: "edit-widgets-welcome-guide__text" | |
| 4676 | - }, (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4677 | - className: "edit-widgets-welcome-guide__text" | |
| 4678 | - }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?')), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { | |
| 4679 | - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/') | |
| 4680 | - }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.'))))) | |
| 4681 | - }, { | |
| 4682 | - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { | |
| 4683 | - nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", | |
| 4684 | - animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" | |
| 4685 | - }), | |
| 4686 | - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { | |
| 4687 | - className: "edit-widgets-welcome-guide__heading" | |
| 4688 | - }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4689 | - className: "edit-widgets-welcome-guide__text" | |
| 4690 | - }, (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'))) | |
| 4691 | - }, { | |
| 4692 | - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { | |
| 4693 | - nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", | |
| 4694 | - animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" | |
| 4695 | - }), | |
| 4696 | - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { | |
| 4697 | - className: "edit-widgets-welcome-guide__heading" | |
| 4698 | - }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4699 | - className: "edit-widgets-welcome-guide__text" | |
| 4700 | - }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), { | |
| 4701 | - InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { | |
| 4702 | - className: "edit-widgets-welcome-guide__inserter-icon", | |
| 4703 | - alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), | |
| 4704 | - src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" | |
| 4705 | - }) | |
| 4706 | - }))) | |
| 4707 | - }, { | |
| 4708 | - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { | |
| 4709 | - nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", | |
| 4710 | - animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" | |
| 4711 | - }), | |
| 4712 | - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { | |
| 4713 | - className: "edit-widgets-welcome-guide__heading" | |
| 4714 | - }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", { | |
| 4715 | - className: "edit-widgets-welcome-guide__text" | |
| 4716 | - }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { | |
| 4717 | - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/') | |
| 4718 | - }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.")))) | |
| 4719 | - }] | |
| 4720 | - }); | |
| 4721 | -} | |
| 4722 | - | |
| 4723 | -function WelcomeGuideImage(_ref) { | |
| 4724 | - let { | |
| 4725 | - nonAnimatedSrc, | |
| 4726 | - animatedSrc | |
| 4727 | - } = _ref; | |
| 4728 | - return (0,external_wp_element_namespaceObject.createElement)("picture", { | |
| 4729 | - className: "edit-widgets-welcome-guide__image" | |
| 4730 | - }, (0,external_wp_element_namespaceObject.createElement)("source", { | |
| 4731 | - srcSet: nonAnimatedSrc, | |
| 4732 | - media: "(prefers-reduced-motion: reduce)" | |
| 4733 | - }), (0,external_wp_element_namespaceObject.createElement)("img", { | |
| 4734 | - src: animatedSrc, | |
| 4735 | - width: "312", | |
| 4736 | - height: "240", | |
| 4737 | - alt: "" | |
| 4738 | - })); | |
| 4739 | -} | |
| 4740 | -//# sourceMappingURL=index.js.map | |
| 4741 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/components/layout/index.js | |
| 4742 | - | |
| 4743 | - | |
| 4744 | -/** | |
| 4745 | - * WordPress dependencies | |
| 4746 | - */ | |
| 4747 | - | |
| 4748 | - | |
| 4749 | - | |
| 4750 | - | |
| 4751 | - | |
| 4752 | -/** | |
| 4753 | - * Internal dependencies | |
| 4754 | - */ | |
| 4755 | - | |
| 4756 | - | |
| 4757 | - | |
| 4758 | - | |
| 4759 | - | |
| 4760 | - | |
| 4761 | - | |
| 4762 | - | |
| 4763 | -function Layout(_ref) { | |
| 4764 | - let { | |
| 4765 | - blockEditorSettings, | |
| 4766 | - onError | |
| 4767 | - } = _ref; | |
| 4768 | - const { | |
| 4769 | - createErrorNotice | |
| 4770 | - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); | |
| 4771 | - | |
| 4772 | - function onPluginAreaError(name) { | |
| 4773 | - createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( | |
| 4774 | - /* translators: %s: plugin name */ | |
| 4775 | - (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); | |
| 4776 | - } | |
| 4777 | - | |
| 4778 | - return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, { | |
| 4779 | - onError: onError | |
| 4780 | - }, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorProvider, { | |
| 4781 | - blockEditorSettings: blockEditorSettings | |
| 4782 | - }, (0,external_wp_element_namespaceObject.createElement)(layout_interface, { | |
| 4783 | - blockEditorSettings: blockEditorSettings | |
| 4784 | - }), (0,external_wp_element_namespaceObject.createElement)(Sidebar, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { | |
| 4785 | - onError: onPluginAreaError | |
| 4786 | - }), (0,external_wp_element_namespaceObject.createElement)(UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null))); | |
| 4787 | -} | |
| 4788 | - | |
| 4789 | -/* harmony default export */ var layout = (Layout); | |
| 4790 | -//# sourceMappingURL=index.js.map | |
| 4791 | -;// CONCATENATED MODULE: ./packages/edit-widgets/build-module/index.js | |
| 4792 | - | |
| 4793 | - | |
| 4794 | -/** | |
| 4795 | - * WordPress dependencies | |
| 4796 | - */ | |
| 4797 | - | |
| 4798 | - | |
| 4799 | - | |
| 4800 | - | |
| 4801 | - | |
| 4802 | - | |
| 4803 | - | |
| 4804 | -/** | |
| 4805 | - * Internal dependencies | |
| 4806 | - */ | |
| 4807 | - | |
| 4808 | - | |
| 4809 | - | |
| 4810 | - | |
| 4811 | - | |
| 4812 | - | |
| 4813 | -const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])]; | |
| 4814 | -/** | |
| 4815 | - * Reinitializes the editor after the user chooses to reboot the editor after | |
| 4816 | - * an unhandled error occurs, replacing previously mounted editor element using | |
| 4817 | - * an initial state from prior to the crash. | |
| 4818 | - * | |
| 4819 | - * @param {Element} target DOM node in which editor is rendered. | |
| 4820 | - * @param {?Object} settings Editor settings object. | |
| 4821 | - */ | |
| 4822 | - | |
| 4823 | -function reinitializeEditor(target, settings) { | |
| 4824 | - (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target); | |
| 4825 | - const reboot = reinitializeEditor.bind(null, target, settings); | |
| 4826 | - (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(layout, { | |
| 4827 | - blockEditorSettings: settings, | |
| 4828 | - onError: reboot | |
| 4829 | - }), target); | |
| 4830 | -} | |
| 4831 | -/** | |
| 4832 | - * Initializes the block editor in the widgets screen. | |
| 4833 | - * | |
| 4834 | - * @param {string} id ID of the root element to render the screen in. | |
| 4835 | - * @param {Object} settings Block editor settings. | |
| 4836 | - */ | |
| 4837 | - | |
| 4838 | -function initialize(id, settings) { | |
| 4839 | - const target = document.getElementById(id); | |
| 4840 | - const reboot = reinitializeEditor.bind(null, target, settings); | |
| 4841 | - | |
| 4842 | - const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => { | |
| 4843 | - return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation')); | |
| 4844 | - }); | |
| 4845 | - | |
| 4846 | - (0,external_wp_data_namespaceObject.dispatch)(store).setFeatureDefaults('core/edit-widgets', { | |
| 4847 | - fixedToolbar: false, | |
| 4848 | - welcomeGuide: true, | |
| 4849 | - showBlockBreadcrumbs: true, | |
| 4850 | - themeStyles: true | |
| 4851 | - }); | |
| 4852 | - | |
| 4853 | - (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); | |
| 4854 | - | |
| 4855 | - (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); | |
| 4856 | - (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)(); | |
| 4857 | - | |
| 4858 | - if (true) { | |
| 4859 | - (0,external_wp_blockLibrary_namespaceObject.__experimentalRegisterExperimentalCoreBlocks)({ | |
| 4860 | - enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS | |
| 4861 | - }); | |
| 4862 | - } | |
| 4863 | - | |
| 4864 | - (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(settings); | |
| 4865 | - registerBlock(widget_area_namespaceObject); | |
| 4866 | - (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); | |
| 4867 | - | |
| 4868 | - settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); // As we are unregistering `core/freeform` to avoid the Classic block, we must | |
| 4869 | - // replace it with something as the default freeform content handler. Failure to | |
| 4870 | - // do this will result in errors in the default block parser. | |
| 4871 | - // see: https://github.com/WordPress/gutenberg/issues/33097 | |
| 4872 | - | |
| 4873 | - | |
| 4874 | - (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html'); | |
| 4875 | - (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(layout, { | |
| 4876 | - blockEditorSettings: settings, | |
| 4877 | - onError: reboot | |
| 4878 | - }), target); | |
| 4879 | -} | |
| 4880 | -/** | |
| 4881 | - * Function to register an individual block. | |
| 4882 | - * | |
| 4883 | - * @param {Object} block The block to be registered. | |
| 4884 | - * | |
| 4885 | - */ | |
| 4886 | - | |
| 4887 | -const registerBlock = block => { | |
| 4888 | - if (!block) { | |
| 4889 | - return; | |
| 4890 | - } | |
| 4891 | - | |
| 4892 | - const { | |
| 4893 | - metadata, | |
| 4894 | - settings, | |
| 4895 | - name | |
| 4896 | - } = block; | |
| 4897 | - | |
| 4898 | - if (metadata) { | |
| 4899 | - (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ | |
| 4900 | - [name]: metadata | |
| 4901 | - }); | |
| 4902 | - } | |
| 4903 | - | |
| 4904 | - (0,external_wp_blocks_namespaceObject.registerBlockType)(name, settings); | |
| 4905 | -}; | |
| 4906 | -//# sourceMappingURL=index.js.map | |
| 4907 | -}(); | |
| 4908 | -(window.wp = window.wp || {}).editWidgets = __webpack_exports__; | |
| 4909 | -/******/ })() | |
| 4910 | -; | |
| 1 | +window.wp=window.wp||{},window.wp.editWidgets=function(e){var t={};function n(r){if(t[r])return t[r].exports;var c=t[r]={i:r,l:!1,exports:{}};return e[r].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(r,c,function(t){return e[t]}.bind(null,c));return r},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=525)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},11:function(e,t){e.exports=window.wp.blocks},12:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r))e.push(c.apply(null,r));else if("object"===i)for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?e.exports=c:void 0===(r=function(){return c}.apply(t,[]))||(e.exports=r)}()},13:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(48);function c(e,t){if(null==e)return{};var n,c,i=Object(r.a)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(c=0;c<a.length;c++)n=a[c],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},132:function(e,t){e.exports=window.wp.reusableBlocks},14:function(e,t){e.exports=window.wp.compose},15:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(24),c=n(42),i=n(30);function a(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||Object(c.a)(e)||Object(i.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},157:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));t.a=i},158:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{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"}));t.a=i},159:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"}));t.a=i},16:function(e,t){e.exports=window.regeneratorRuntime},17:function(e,t){e.exports=window.wp.keycodes},19:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},194:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.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=i},196:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));t.a=i},2:function(e,t){e.exports=window.lodash},219:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.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=i},22:function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return r}))},220:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.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=i},24:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},27:function(e,t){e.exports=window.wp.coreData},28:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},29:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",(function(){return c}))},3:function(e,t){e.exports=window.wp.components},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(24);function c(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(e,t):void 0}}},31:function(e,t){e.exports=window.wp.url},32:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(58);function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Object(r.a)(e,t)}},33:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(43),c=n(19);function i(e,t){return!t||"object"!==Object(r.a)(t)&&"function"!=typeof t?Object(c.a)(e):t}},334:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"}));t.a=i},335:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));t.a=i},336:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(c.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));t.a=i},35:function(e,t){e.exports=window.wp.hooks},384:function(e,t,n){"use strict";var r=n(0),c=n(7),i=Object(r.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(c.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"}));t.a=i},39:function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}n.d(t,"a",(function(){return r}))},4:function(e,t){e.exports=window.wp.data},40:function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(t,"a",(function(){return r}))},42:function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}n.d(t,"a",(function(){return r}))},43:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return r}))},46:function(e,t){e.exports=window.wp.keyboardShortcuts},47:function(e,t){e.exports=window.wp.apiFetch},48:function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,c={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(c[n]=e[n]);return c}n.d(t,"a",(function(){return r}))},5:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},51:function(e,t){e.exports=window.wp.notices},525:function(e,t,n){"use strict";n.r(t),n.d(t,"initialize",(function(){return Xt}));var r={};n.r(r),n.d(r,"persistStubPost",(function(){return K})),n.d(r,"saveEditedWidgetAreas",(function(){return X})),n.d(r,"saveWidgetAreas",(function(){return Z})),n.d(r,"saveWidgetArea",(function(){return J})),n.d(r,"setWidgetIdForClientId",(function(){return te})),n.d(r,"setWidgetAreasOpenState",(function(){return ne})),n.d(r,"setIsWidgetAreaOpen",(function(){return re})),n.d(r,"setIsInserterOpened",(function(){return ce})),n.d(r,"closeGeneralSidebar",(function(){return ie}));var c={};n.r(c),n.d(c,"getWidgetAreas",(function(){return ue})),n.d(c,"getWidgets",(function(){return de}));var i={};n.r(i),n.d(i,"getWidgets",(function(){return me})),n.d(i,"getWidget",(function(){return ge})),n.d(i,"getWidgetAreas",(function(){return Oe})),n.d(i,"getWidgetAreaForWidgetId",(function(){return ve})),n.d(i,"getEditedWidgetAreas",(function(){return je})),n.d(i,"getReferenceWidgetBlocks",(function(){return ye})),n.d(i,"isSavingWidgetAreas",(function(){return we})),n.d(i,"getIsWidgetAreaOpen",(function(){return he})),n.d(i,"isInserterOpened",(function(){return Ee}));var a={};n.r(a),n.d(a,"metadata",(function(){return gt})),n.d(a,"name",(function(){return Ot})),n.d(a,"settings",(function(){return vt}));var o=n(5),s=n(0),l=n(11),u=n(77),d=n(47),b=n.n(d),f=n(4);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=Object(f.combineReducers)({isInserterOpened:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_INSERTER_OPENED":return t.value}return e},widgetAreasOpenState:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=t.type;switch(n){case"SET_WIDGET_AREAS_OPEN_STATE":return t.widgetAreasOpenState;case"SET_IS_WIDGET_AREA_OPEN":var r=t.clientId,c=t.isOpen;return m(m({},e),{},Object(o.a)({},r,c));default:return e}}}),O=n(16),v=n.n(O),j=n(15),y="root",w=function(e){return"widget-area-".concat(e)},h=function(e,t){return{id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}},E="core/edit-widgets";function _(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{per_page:-1};return{type:"RESOLVE_WIDGET_AREAS",query:e}}function S(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{per_page:-1};return{type:"RESOLVE_WIDGETS",query:e}}function k(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),c=2;c<n;c++)r[c-2]=arguments[c];return{type:"SELECT",registryName:e,selectorName:t,args:r}}function I(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),c=2;c<n;c++)r[c-2]=arguments[c];return{type:"DISPATCH",registryName:e,actionName:t,args:r}}var P={AWAIT_PROMISE:function(e){return e.promise},SELECT:Object(f.createRegistryControl)((function(e){return function(t){var n,r=t.registryName,c=t.selectorName,i=t.args;return(n=e.select(r))[c].apply(n,Object(j.a)(i))}})),GET_PENDING_ACTIONS:Object(f.createRegistryControl)((function(e){return function(t){var n,r=t.postId;return(null===(n=A(e).processingQueue[r])||void 0===n?void 0:n.pendingActions)||[]}})),IS_PROCESSING_POST:Object(f.createRegistryControl)((function(e){return function(t){var n,r=t.postId;return null===(n=A(e).processingQueue[r])||void 0===n?void 0:n.inProgress}})),DISPATCH:Object(f.createRegistryControl)((function(e){return function(t){var n,r=t.registryName,c=t.actionName,i=t.args;return(n=e.dispatch(r))[c].apply(n,Object(j.a)(i))}})),RESOLVE_WIDGET_AREAS:Object(f.createRegistryControl)((function(e){return function(t){var n=t.query;return e.resolveSelect("core").getEntityRecords(y,"sidebar",n)}})),RESOLVE_WIDGETS:Object(f.createRegistryControl)((function(e){return function(t){var n=t.query;return e.resolveSelect("core").getEntityRecords("root","widget",n)}}))},A=function(e){return e.stores[E].store.getState()},x=P,W=n(1),R=n(51),C=n(53);function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function B(e,t){return D(D({},e),{},{attributes:D(D({},e.attributes||{}),{},{__internalWidgetId:t})})}function T(e){if("WP_Widget_Block"===e.widget_class){var t=Object(l.parse)(e.settings.content);return t.length?B(t[0],e.id):B(Object(l.createBlock)("core/paragraph",{},[]),e.id)}var n={name:e.name,form:e.form,instance:e.settings,idBase:e.id_base,number:e.number};return e.widget_class?n.widgetClass=e.widget_class:n.referenceWidgetName=e.id,B(Object(l.createBlock)("core/legacy-widget",n,[]),e.id)}function L(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.name;return"core/legacy-widget"===r?(delete(t=e.attributes.referenceWidgetName?F(e,n):M(e,n)).form,delete t.rendered,t):D(D({},n),{},{id_base:"block",widget_class:"WP_Widget_Block",settings:{content:Object(l.serialize)(e)}})}function M(e,t){var n=e.attributes;return D(D({},t),{},{widget_class:n.widgetClass,id_base:n.idBase,settings:n.instance})}function F(e,t){var n=e.attributes;return D(D({},t),{},{id:n.referenceWidgetName,settings:n.instance})}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function z(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return U(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,c=function(){};return{s:c,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=v.a.mark(X),q=v.a.mark(Z),Q=v.a.mark(J),Y=v.a.mark(ee),$=v.a.mark(ie),K=v.a.mark((function e(t,n){var r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h(t,n),e.next=3,I("core","receiveEntityRecords",y,"postType",r,{id:r.id},!1);case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)}));function X(){var e;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,k(E,"getEditedWidgetAreas");case 2:if(null!=(e=t.sent)&&e.length){t.next=5;break}return t.abrupt("return");case 5:return t.prev=5,t.delegateYield(Z(e),"t0",7);case 7:return t.next=9,I(R.store,"createSuccessNotice",Object(W.__)("Widgets saved."),{type:"snackbar"});case 9:t.next=15;break;case 11:return t.prev=11,t.t1=t.catch(5),t.next=15,I(R.store,"createErrorNotice", | |
| 2 | +/* translators: %s: The error message. */ | |
| 3 | +Object(W.sprintf)(Object(W.__)("There was an error. %s"),t.t1.message),{type:"snackbar"});case 15:case"end":return t.stop()}}),H,null,[[5,11]])}function Z(e){var t,n,r;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:c.prev=0,t=z(e),c.prev=2,t.s();case 4:if((n=t.n()).done){c.next=9;break}return r=n.value,c.delegateYield(J(r.id),"t0",7);case 7:c.next=4;break;case 9:c.next=14;break;case 11:c.prev=11,c.t1=c.catch(2),t.e(c.t1);case 14:return c.prev=14,t.f(),c.finish(14);case 17:return c.prev=17,c.next=20,I("core","finishResolution","getEntityRecord",y,"sidebar",{per_page:-1});case 20:return c.finish(17);case 21:case"end":return c.stop()}}),q,null,[[0,,17,21],[2,11,14,17]])}function J(e){var t,n,r,c,i,a,o,s,l,u,d,b,f,p,m,g,O;return v.a.wrap((function(j){for(;;)switch(j.prev=j.next){case 0:return j.next=2,k(E,"getWidgets");case 2:return t=j.sent,j.next=5,k("core","getEditedEntityRecord",y,"postType",w(e));case 5:n=j.sent,r=[],c=n.blocks.filter((function(e){var t=e.attributes.referenceWidgetName;if(t){if(r.includes(t))return!1;r.push(t)}return!0})),i=[],a=[],o=[],s=v.a.mark((function n(r){var s,l,u,d;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=c[r],l=s.attributes.__internalWidgetId,u=t[l],d=L(s,u),o.push(l),!l){n.next=16;break}return n.next=8,I("core","editEntityRecord","root","widget",l,V(V({},d),{},{sidebar:e}));case 8:return n.next=10,k("core","hasEditsForEntityRecord","root","widget",l);case 10:if(n.sent){n.next=13;break}return n.abrupt("return","continue");case 13:a.push((function(e){return(0,e.saveEditedEntityRecord)("root","widget",l)})),n.next=17;break;case 16:a.push((function(t){return(0,t.saveEntityRecord)("root","widget",V(V({},d),{},{sidebar:e}))}));case 17:i.push({block:s,position:r,clientId:s.clientId});case 18:case"end":return n.stop()}}),n)})),l=0;case 13:if(!(l<c.length)){j.next=21;break}return j.delegateYield(s(l),"t0",15);case 15:if("continue"!==j.t0){j.next=18;break}return j.abrupt("continue",18);case 18:l++,j.next=13;break;case 21:return j.next=23,I("core","__experimentalBatch",a);case 23:u=j.sent,d=[],b=0;case 26:if(!(b<u.length)){j.next=37;break}return f=u[b],p=i[b],m=p.block,g=p.position,j.next=31,k("core","getLastEntitySaveError","root","widget",f.id);case 31:j.sent&&d.push((null===(O=m.attributes)||void 0===O?void 0:O.name)||(null==m?void 0:m.name)),o[g]||(o[g]=f.id);case 34:b++,j.next=26;break;case 37:if(!d.length){j.next=39;break}throw new Error(Object(W.sprintf)( | |
| 4 | +/* translators: %s: List of widget names */ | |
| 5 | +Object(W.__)("Could not save the following widgets: %s."),d.join(", ")));case 39:return j.next=41,I("core","editEntityRecord",y,"sidebar",e,{widgets:o});case 41:return j.delegateYield(ee(e),"t1",42);case 42:return j.next=44,I("core","receiveEntityRecords",y,"postType",n,void 0);case 44:case"end":return j.stop()}}),Q)}function ee(e){var t,n;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,k("core","getLastEntitySaveError",y,"sidebar",e);case 2:return t=r.sent,r.next=5,I("core","saveEditedEntityRecord",y,"sidebar",e);case 5:return r.next=7,k("core","getLastEntitySaveError",y,"sidebar",e);case 7:if(!(n=r.sent)||t===n){r.next=10;break}throw new Error(n);case 10:case"end":return r.stop()}}),Y)}function te(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function ne(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function re(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function ce(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function ie(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(C.g.name,"disableComplementaryArea",E);case 2:case"end":return e.stop()}}),$)}var ae=v.a.mark(ue),oe=v.a.mark(de);function se(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return le(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,c=function(){};return{s:c,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ue(){var e,t,n,r,c,i,a,o;return v.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return e={per_page:-1},s.next=3,_(e);case 3:return s.next=5,k("core","getEntityRecords",y,"sidebar",e);case 5:t=s.sent,n=[],r=t.sort((function(e,t){return"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0})),c=se(r),s.prev=9,c.s();case 11:if((i=c.n()).done){s.next=19;break}if(a=i.value,n.push(Object(l.createBlock)("core/widget-area",{id:a.id,name:a.name})),a.widgets.length){s.next=17;break}return s.next=17,K(w(a.id),[]);case 17:s.next=11;break;case 19:s.next=24;break;case 21:s.prev=21,s.t0=s.catch(9),c.e(s.t0);case 24:return s.prev=24,c.f(),s.finish(24);case 27:return o={},n.forEach((function(e,t){o[e.clientId]=0===t})),s.next=31,ne(o);case 31:return s.next=33,K("widget-areas",n);case 33:case"end":return s.stop()}}),ae,null,[[9,21,24,27]])}function de(){var e,t,n,r,c,i,a,o;return v.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return e={per_page:-1},s.next=3,S(e);case 3:return s.next=5,k("core","getEntityRecords","root","widget",e);case 5:t=s.sent,n={},r=se(t);try{for(r.s();!(c=r.n()).done;)i=c.value,a=T(i),n[i.sidebar]=n[i.sidebar]||[],n[i.sidebar].push(a)}catch(e){r.e(e)}finally{r.f()}s.t0=v.a.keys(n);case 10:if((s.t1=s.t0()).done){s.next=17;break}if(o=s.t1.value,!n.hasOwnProperty(o)){s.next=15;break}return s.next=15,K(w(o),n[o]);case 15:s.next=10;break;case 17:case"end":return s.stop()}}),oe)}var be=n(2);function fe(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return pe(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pe(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,c=function(){};return{s:c,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=Object(f.createRegistrySelector)((function(e){return function(){var t=e("core").getEntityRecords("root","widget",{per_page:-1});return Object(be.keyBy)(t,"id")}})),ge=Object(f.createRegistrySelector)((function(e){return function(t,n){return e(E).getWidgets()[n]}})),Oe=Object(f.createRegistrySelector)((function(e){return function(){return e("core").getEntityRecords(y,"sidebar",{per_page:-1})}})),ve=Object(f.createRegistrySelector)((function(e){return function(t,n){return e(E).getWidgetAreas().find((function(t){return e("core").getEditedEntityRecord(y,"postType",w(t.id)).blocks.map((function(e){return e.attributes.__internalWidgetId})).includes(n)}))}})),je=Object(f.createRegistrySelector)((function(e){return function(t,n){var r=e(E).getWidgetAreas();return r?(n&&(r=r.filter((function(e){var t=e.id;return n.includes(t)}))),r.filter((function(t){var n=t.id;return e("core").hasEditsForEntityRecord(y,"postType",w(n))})).map((function(t){var n=t.id;return e("core").getEditedEntityRecord(y,"sidebar",n)}))):[]}})),ye=Object(f.createRegistrySelector)((function(e){return function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,c=[],i=e(E).getWidgetAreas(),a=fe(i);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=e("core").getEditedEntityRecord(y,"postType",w(s.id)),u=fe(l.blocks);try{for(u.s();!(o=u.n()).done;){var d,b=o.value;"core/legacy-widget"!==b.name||r&&(null===(d=b.attributes)||void 0===d?void 0:d.referenceWidgetName)!==r||c.push(b)}}catch(e){u.e(e)}finally{u.f()}}}catch(e){a.e(e)}finally{a.f()}return c}})),we=Object(f.createRegistrySelector)((function(e){return function(){var t,n=null===(t=e(E).getWidgetAreas())||void 0===t?void 0:t.map((function(e){return e.id}));if(!n)return!1;var r,c=fe(n);try{for(c.s();!(r=c.n()).done;){var i=r.value;if(e("core").isSavingEntityRecord(y,"sidebar",i))return!0}}catch(e){c.e(e)}finally{c.f()}var a,o=fe([].concat(Object(j.a)(Object.keys(e(E).getWidgets())),[void 0]));try{for(o.s();!(a=o.n()).done;){var s=a.value;if(e("core").isSavingEntityRecord("root","widget",s))return!0}}catch(e){o.e(e)}finally{o.f()}return!1}})),he=function(e,t){return!!e.widgetAreasOpenState[t]};function Ee(e){return e.isInserterOpened}var _e={reducer:g,controls:x,selectors:i,resolvers:c,actions:r},Se=Object(f.createReduxStore)(E,_e);Object(f.register)(Se),b.a.use((function(e,t){var n;return 0===(null===(n=e.path)||void 0===n?void 0:n.indexOf("/wp/v2/types/widget-area"))?Promise.resolve({}):t(e)}));var ke=n(35),Ie=n(90);Object(ke.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(function(){return Ie.MediaUpload}));var Pe=n(7),Ae=Object(s.createElement)(Pe.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(s.createElement)(Pe.Path,{d:"M7 11h2v2H7v-2zm14-5v14l-2 2H5l-2-2V6l2-2h1V2h2v2h8V2h2v2h1l2 2zM5 8h14V6H5v2zm14 12V10H5v10h14zm-4-7h2v-2h-2v2zm-4 0h2v-2h-2v2z"})),xe=n(8),We=n(3),Re=n(6),Ce=Object(s.createElement)(Pe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(s.createElement)(Pe.Path,{d:"M18.33 3.57s.27-.8-.31-1.36c-.53-.52-1.22-.24-1.22-.24-.61.3-5.76 3.47-7.67 5.57-.86.96-2.06 3.79-1.09 4.82.92.98 3.96-.17 4.79-1 2.06-2.06 5.21-7.17 5.5-7.79zM1.4 17.65c2.37-1.56 1.46-3.41 3.23-4.64.93-.65 2.22-.62 3.08.29.63.67.8 2.57-.16 3.46-1.57 1.45-4 1.55-6.15.89z"})),Ne=n(384),De=n(10),Be=n(28),Te=n(29),Le=n(19),Me=n(32),Fe=n(33),Ge=n(22),Ve=n(14);function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ue=function(e){Object(Me.a)(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Object(Ge.a)(t);if(n){var c=Object(Ge.a)(this).constructor;e=Reflect.construct(r,arguments,c)}else e=r.apply(this,arguments);return Object(Fe.a)(this,e)});function c(){var e;return Object(Be.a)(this,c),(e=r.apply(this,arguments)).containerRef=Object(s.createRef)(),e.formRef=Object(s.createRef)(),e.widgetContentRef=Object(s.createRef)(),e.idBaseInputRef=Object(s.createRef)(),e.widgetNumberInputRef=Object(s.createRef)(),e.triggerWidgetEvent=e.triggerWidgetEvent.bind(Object(Le.a)(e)),e.handleChange=e.handleChange.bind(Object(Le.a)(e)),e}return Object(Te.a)(c,[{key:"componentDidMount",value:function(){this.triggerWidgetEvent("widget-added"),this.props.onMount&&this.props.onMount(this.getFormData());var e=this.formRef.current;e&&(e.addEventListener("change",this.handleChange),e.addEventListener("input",this.handleChange))}},{key:"componentWillUnmount",value:function(){var e=this.formRef.current;e&&(e.removeEventListener("change",this.handleChange),e.removeEventListener("input",this.handleChange)),window.cancelAnimationFrame(this.rafId)}},{key:"shouldComponentUpdate",value:function(e){var t=!1;return e.idBase!==this.props.idBase&&this.idBaseInputRef.current&&(this.idBaseInputRef.current.value=e.idBase,t=!0),e.number!==this.props.number&&this.widgetNumberInputRef.current&&(this.widgetNumberInputRef.current.value=e.number),e.form!==this.props.form&&this.widgetContentRef.current&&(this.widgetContentRef.current.innerHTML=e.form,t=!0),t&&this.triggerWidgetEvent("widget-updated"),!1}},{key:"handleChange",value:function(){var e=this;this.rafId||(this.rafId=window.requestAnimationFrame((function(){e.props.onInstanceChange(e.getFormData()),e.rafId=null})))}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.idBase,r=e.number,c=e.form;return Object(s.createElement)("div",{className:"widget open",ref:this.containerRef},Object(s.createElement)("div",{className:"widget-inside"},Object(s.createElement)("form",{className:"form",ref:this.formRef,method:"post"},Object(s.createElement)("div",{ref:this.widgetContentRef,className:"widget-content",dangerouslySetInnerHTML:{__html:c}}),Object(s.createElement)("input",{type:"hidden",name:"widget-id",className:"widget-id",value:t||n+r}),Object(s.createElement)("input",{ref:this.idBaseInputRef,type:"hidden",name:"id_base",className:"id_base",value:n}),Object(s.createElement)("input",{ref:this.widgetNumberInputRef,type:"hidden",name:"widget_number",className:"widget_number",value:r}),Object(s.createElement)("input",{type:"hidden",name:"multi_number",className:"multi_number",value:""}),Object(s.createElement)("input",{type:"hidden",name:"add_new",className:"add_new",value:""}))))}},{key:"triggerWidgetEvent",value:function(e){window.jQuery(window.document).trigger(e,[window.jQuery(this.containerRef.current)])}},{key:"getFormData",value:function(){if(this.formRef.current){var e,t=this.formRef.current,n=new window.FormData(t),r={},c=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ze(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ze(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,c=function(){};return{s:c,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}(n.keys());try{for(c.s();!(e=c.n()).done;){var i=e.value;if(!Object(be.includes)(["widget-id","id_base","widget_number","multi_number","add_new"],i)){var a=i.match(/[^\[]*\[[-\d]*\]\[([^\]]*)\]/),o=a&&a[1]?a[1]:i,s=n.getAll(i);s.length>1?r[o]=s:r[o]=s[0]}}}catch(e){c.e(e)}finally{c.f()}return r}}}]),c}(s.Component);function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qe=window,Ye=Qe.XMLHttpRequest,$e=Qe.FormData,Ke=function(e){Object(Me.a)(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Object(Ge.a)(t);if(n){var c=Object(Ge.a)(this).constructor;e=Reflect.construct(r,arguments,c)}else e=r.apply(this,arguments);return Object(Fe.a)(this,e)});function c(e){var t;return Object(Be.a)(this,c),(t=r.apply(this,arguments)).state={form:e.prerenderedEditForm},t.widgetNonce=null,t.instanceUpdating=null,t.onInstanceChange=t.onInstanceChange.bind(Object(Le.a)(t)),t.requestWidgetForm=t.requestWidgetForm.bind(Object(Le.a)(t)),t}return Object(Te.a)(c,[{key:"componentDidMount",value:function(){var e=this;this.isStillMounted=!0,this.trySetNonce(),this.props.prerenderedEditForm||this.requestWidgetForm(void 0,(function(t){e.props.onInstanceChange(null,!!t.form)}))}},{key:"componentDidUpdate",value:function(e){var t=this;this.widgetNonce||this.trySetNonce(),e.widgetClass!==this.props.widgetClass&&this.requestWidgetForm(void 0,(function(e){t.props.onInstanceChange(null,!!e.form)})),this.instanceUpdating===this.props.instance&&(this.instanceUpdating=null)}},{key:"componentWillUnmount",value:function(){this.isStillMounted=!1}},{key:"render",value:function(){var e=this,t=this.props,n=t.instanceId,r=t.id,c=t.number,i=t.idBase,a=t.instance,o=t.isVisible,l=t.widgetName,u=this.state.form;if(!u)return null;var d=Object(be.get)(a,["title"]),b=null;d&&l?b="".concat(l,": ").concat(d):!d&&l?b=l:d&&!l&&(b=d);var f=o?{}:{style:{display:"none"},hidden:!0,"aria-hidden":"true"};return Object(s.createElement)("div",Object(De.a)({className:"wp-block-legacy-widget__edit-handler"},f),b&&Object(s.createElement)("h3",{className:"wp-block-legacy-widget__edit-widget-title"},b),Object(s.createElement)("div",{className:"wp-block-legacy-widget__edit-container",style:{display:this.props.isVisible?"block":"none"}},Object(s.createElement)(Ue,{isReferenceWidget:!!r,ref:function(t){e.widgetEditDomManagerRef=t},onInstanceChange:this.onInstanceChange,onMount:this.props.onFormMount,number:c||-1*n,id:r,idBase:i,form:u})))}},{key:"trySetNonce",value:function(){var e=document.getElementById("_wpnonce_widgets");e&&e.value&&(this.widgetNonce=e.value)}},{key:"onInstanceChange",value:function(e){this.props.onInstanceChange(e,!0)}},{key:"requestWidgetForm",value:function(e,t){var n=this,r=this.props,c=r.id,i=r.idBase,a=r.instance,o=r.widgetClass,s=this.isStillMounted;if(c||o){if(c){var l=new Ye,u=new $e;return u.append("action","save-widget"),u.append("id_base",i),u.append("widget-id",c),u.append("widget-width","250"),u.append("widget-height","200"),u.append("savewidgets",this.widgetNonce),l.open("POST",window.ajaxurl),l.addEventListener("load",(function(){if(s){var e=l.responseText;n.setState({form:e}),t&&t({form:e})}})),void l.send(u)}o&&b()({path:"/wp/v2/widget-types/".concat(encodeURIComponent(i),"/form-renderer/"),data:{instance:qe(qe({},a),e)},method:"POST"}).then((function(e){s&&(n.setState({form:e.form}),t&&t(e))}))}}}]),c}(s.Component),Xe=Object(Ve.withInstanceId)(Ke);function Ze(e){var t=e.availableLegacyWidgets,n=e.currentWidget,r=e.onChange,c=e.label,i=void 0===c?Object(W.__)("Select a legacy widget to display:"):c,a=e.emptyLabel,o=void 0===a?Object(W.__)("There are no widgets available."):a,l=Object(f.useSelect)((function(e){return e(Se).getReferenceWidgetBlocks().map((function(e){var t=e.attributes;return null==t?void 0:t.referenceWidgetName}))})),u=Object(s.useMemo)((function(){return Object(be.pickBy)(t,(function(e,t){return!(e.isHidden||t&&l.includes(t))}))}),[t,l]);return Object(be.isEmpty)(u)?o:Object(s.createElement)(We.SelectControl,{label:i,value:n||"none",onChange:function(e){var n=t[e],c=n.isReferenceWidget,i=n.id_base;r(c?{instance:{},idBase:i,referenceWidgetName:e,widgetClass:void 0}:{instance:{},idBase:i,referenceWidgetName:void 0,widgetClass:e})},options:[{value:"none",label:"Select widget"}].concat(Object(be.map)(u,(function(e,t){return{value:t,label:e.name}})))})}var Je=n(13),et=n(31);function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var rt=function(e){var t=e.widgetAreaId,n=e.attributes,r=e.hidden,c=Object(Je.a)(e,["widgetAreaId","attributes","hidden"]),i=Object(s.useState)(300),a=Object(xe.a)(i,2),o=a[0],l=a[1],u=Object(s.useRef)(),d=Object(et.addQueryArgs)("themes.php",{page:"gutenberg-widgets"}),b=Object(et.addQueryArgs)(d,{"widget-preview":nt(nt({},n),{},{sidebarId:t})}),f=Object(s.useCallback)((function(){l(Object(be.get)(u.current,["contentDocument","body","scrollHeight"]))}),[]);return Object(s.useEffect)((function(){r||f()}),[r,f]),Object(s.createElement)(We.Disabled,{hidden:r},Object(s.createElement)(We.FocusableIframe,Object(De.a)({onLoad:function(){f()},src:b,height:o+20,iframeRef:u},c)))};function ct(e){var t=e.name,n=e.description;return Object(s.createElement)("div",{className:"wp-block-legacy-widget-inspector-card"},Object(s.createElement)("h3",{className:"wp-block-legacy-widget-inspector-card__name"}, | |
| 6 | +/* translators: %s: the name of the widget being viewed. */ | |
| 7 | +Object(W.sprintf)(Object(W.__)("Widget: %s"),t)),Object(s.createElement)("span",null,n))}var it=Object(f.withSelect)((function(e,t){var n,r=t.clientId,c=t.attributes,i=c.widgetClass,a=c.referenceWidgetName,o=c.__internalWidgetId,s=e(Se).getWidget(o),l=e(Se).getWidgetAreaForWidgetId(o),u=e("core/block-editor").getSettings().availableLegacyWidgets;o&&u[o]?n=u[o]:i&&u[i]?n=u[i]:a&&(n=u[a],o=a);var d=!1;return a&&r!==e(Se).getReferenceWidgetBlocks(a)[0].clientId&&(d=!0),{isDuplicateReferenceWidget:d,availableLegacyWidgets:u,widgetId:o,widgetAreaId:null==l?void 0:l.id,WPWidget:n,prerenderedEditForm:s?s.rendered_form:""}}))((function(e){var t=e.attributes,n=e.availableLegacyWidgets,r=e.isDuplicateReferenceWidget,c=e.prerenderedEditForm,i=e.setAttributes,a=e.widgetId,o=e.WPWidget,l=e.widgetAreaId,u=Object(s.useState)(!0),d=Object(xe.a)(u,2),b=d[0],f=d[1],p=Object(s.useState)(!1),m=Object(xe.a)(p,2),g=m[0],O=m[1],v=!g&&b,j=Object(s.useCallback)((function(){O(!1),i({instance:{},id:void 0,referenceWidgetName:void 0,widgetClass:void 0}),f(!0)})),y=Object(s.useMemo)((function(){return Object(be.pickBy)(n,(function(e){return!e.isHidden}))}),[n]);return o?r?Object(s.createElement)(We.Placeholder,{icon:Object(s.createElement)(Re.BlockIcon,{icon:Ce}),label:Object(W.__)("Duplicate Widget"),instructions:Object(W.sprintf)(// translators: %s: widget name e.g: "Calendar". | |
| 8 | +Object(W.__)('Only one instance of the "%s" widget may exist.'),n[t.referenceWidgetName].name)},Object(s.createElement)(Ze,{availableLegacyWidgets:n,onChange:i,emptyLabel:"",label:Object(W.__)("Select a different widget to display:")})):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(Re.BlockControls,null,Object(s.createElement)(We.ToolbarGroup,null,o&&!o.isHidden&&Object(s.createElement)(We.ToolbarButton,{onClick:j,label:Object(W.__)("Change widget"),icon:Ne.a}),b&&Object(s.createElement)(s.Fragment,null,Object(s.createElement)(We.ToolbarButton,{className:"components-tab-button",isPressed:!g,onClick:function(){return O(!1)}},Object(s.createElement)("span",null,Object(W.__)("Edit"))),Object(s.createElement)(We.ToolbarButton,{className:"components-tab-button",isPressed:g,onClick:function(){return O(!0)}},Object(s.createElement)("span",null,Object(W.__)("Preview")))))),Object(s.createElement)(Re.InspectorControls,null,Object(s.createElement)(ct,{name:o.name,description:o.description})),b&&Object(s.createElement)(Xe,{isVisible:!g,id:a,idBase:t.idBase||a,number:t.number,prerenderedEditForm:c,widgetName:Object(be.get)(o,["name"]),widgetClass:t.widgetClass,instance:t.instance,onFormMount:function(e){t.widgetClass||i({instance:e})},onInstanceChange:function(e,t){e&&i({instance:e}),f(t)}}),null!=o&&o.isReferenceWidget?Object(s.createElement)("p",{hidden:v},Object(W.__)("Reference widgets cannot be previewed.")):Object(s.createElement)(rt,{hidden:v,className:"wp-block-legacy-widget__preview",widgetAreaId:l,attributes:Object(be.omit)(t,"widgetId")})):Object(be.isEmpty)(y)?Object(s.createElement)(We.Placeholder,{label:Object(W.__)("Legacy Widget")},Object(W.__)("There are no widgets available.")):Object(s.createElement)(We.Placeholder,{icon:Object(s.createElement)(Re.BlockIcon,{icon:Ce}),label:Object(W.__)("Legacy Widget")},Object(s.createElement)(Ze,{availableLegacyWidgets:n,onChange:i}))})),at={to:[{block:"core/calendar",widget:"WP_Widget_Calendar"},{block:"core/search",widget:"WP_Widget_Search"},{block:"core/html",widget:"WP_Widget_Custom_HTML",transform:function(e){return{content:e.content}}},{block:"core/archives",widget:"WP_Widget_Archives",transform:function(e){var t=e.count;return{displayAsDropdown:!!e.dropdown,showPostCounts:!!t}}},{block:"core/latest-posts",widget:"WP_Widget_Recent_Posts",transform:function(e){return{displayPostDate:!!e.show_date,postsToShow:e.number}}},{block:"core/latest-comments",widget:"WP_Widget_Recent_Comments",transform:function(e){return{commentsToShow:e.number}}},{block:"core/tag-cloud",widget:"WP_Widget_Tag_Cloud",transform:function(e){var t=e.taxonomy;return{showTagCounts:!!e.count,taxonomy:t}}},{block:"core/categories",widget:"WP_Widget_Categories",transform:function(e){var t=e.count;return{displayAsDropdown:!!e.dropdown,showPostCounts:!!t,showHierarchy:!!e.hierarchical}}},{block:"core/audio",widget:"WP_Widget_Media_Audio",transform:function(e){var t=e.url,n=e.preload,r=e.loop;return{src:t,id:e.attachment_id,preload:n,loop:r}}},{block:"core/video",widget:"WP_Widget_Media_Video",transform:function(e){var t=e.url,n=e.preload,r=e.loop;return{src:t,id:e.attachment_id,preload:n,loop:r}}},{block:"core/image",widget:"WP_Widget_Media_Image",transform:function(e){var t=e.alt,n=e.attachment_id,r=e.caption,c=e.height,i=e.link_classes,a=e.link_rel,o=e.link_target_blank,s=e.link_type;return{alt:t,caption:r,height:c,id:n,link:e.link_url,linkClass:i,linkDestination:s,linkTarget:o?"_blank":void 0,rel:a,sizeSlug:e.size,url:e.url,width:e.width}}},{block:"core/gallery",widget:"WP_Widget_Media_Gallery",transform:function(e){var t=e.ids,n=e.link_type,r=e.size;return{ids:t,columns:e.number,linkTo:n,sizeSlug:r,images:t.map((function(e){return{id:e}}))}}},{block:"core/rss",widget:"WP_Widget_RSS",transform:function(e){return{feedURL:e.url,displayAuthor:!!e.show_author,displayDate:!!e.show_date,displayExcerpt:!!e.show_summary,itemsToShow:e.items}}}].map((function(e){var t=e.block,n=e.widget,r=e.transform;return{type:"block",blocks:[t],isMatch:function(e){return e.widgetClass===n},transform:function(e){var n=e.instance,c=Object(l.createBlock)(t,r?r(n):void 0);return n&&n.title?[Object(l.createBlock)("core/heading",{content:n.title}),c]:c}}}))};function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function st(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var lt={name:"core/legacy-widget",category:"widgets",attributes:{widgetClass:{type:"string"},referenceWidgetName:{type:"string"},name:{type:"string"},idBase:{type:"string"},number:{type:"number"},instance:{type:"object"}},supports:{html:!1,customClassName:!1,reusable:!1},parent:["core/widget-area"],editorStyle:"wp-block-legacy-widget-editor"},ut=lt.name,dt={title:Object(W.__)("Legacy Widget (Experimental)"),description:Object(W.__)("Display a legacy widget."),icon:Ae,edit:it,transforms:at};function bt(e){var t=[];for(var n in e){var r=e[n];r.isHidden||t.push(ft(n,r))}return t}function ft(e,t){var n={attributes:{},category:"widgets",description:t.description,icon:dt.icon,name:e,title:t.name};return t.isReferenceWidget?n.attributes={name:t.name,referenceWidgetName:e,instance:{}}:n.attributes={name:t.name,idBase:t.id_base,widgetClass:e,instance:{}},n}var pt=n(27);function mt(){var e=Object(pt.useEntityBlockEditor)("root","postType"),t=Object(xe.a)(e,3),n=t[0],r=t[1],c=t[2];return Object(s.createElement)(Re.InnerBlocks,{value:n,onInput:r,onChange:c,templateLock:!1,renderAppender:Re.InnerBlocks.DefaultBlockAppender})}var gt={name:"core/widget-area",category:"widgets",attributes:{id:{type:"string"},name:{type:"string"}},supports:{html:!1,inserter:!1,customClassName:!1,reusable:!1,__experimentalToolbar:!1},editorStyle:"wp-block-widget-area-editor",style:"wp-block-widget-area"},Ot=gt.name,vt={title:Object(W.__)("Widget Area"),description:Object(W.__)("A widget area container."),__experimentalLabel:function(e){return e.name},supports:{__experimentalParentSelector:!1},edit:function(e){var t=e.clientId,n=e.className,r=e.attributes,c=r.id,i=r.name,a=Object(f.useSelect)((function(e){return e(Se).getIsWidgetAreaOpen(t)}),[t]),o=Object(f.useDispatch)(Se).setIsWidgetAreaOpen,l=Object(s.useRef)(),u=Object(s.useCallback)((function(e){return o(t,e)}),[t]),d=function(e){var t=Object(s.useState)(!1),n=Object(xe.a)(t,2),r=n[0],c=n[1];return Object(s.useEffect)((function(){var t=e.current.ownerDocument;function n(){c(!0)}function r(){c(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",r),function(){t.removeEventListener("dragstart",n),t.removeEventListener("dragend",r)}}),[]),r}(l),b=function(e){var t=Object(s.useState)(!1),n=Object(xe.a)(t,2),r=n[0],c=n[1];return Object(s.useEffect)((function(){var t=e.current.ownerDocument;function n(e){i(e)}function r(){c(!1)}function i(t){e.current.contains(t.target)?c(!0):c(!1)}return t.addEventListener("dragstart",n),t.addEventListener("dragend",r),t.addEventListener("dragenter",i),function(){t.removeEventListener("dragstart",n),t.removeEventListener("dragend",r),t.removeEventListener("dragenter",i)}}),[]),r}(l),p=Object(s.useState)(!1),m=Object(xe.a)(p,2),g=m[0],O=m[1];return Object(s.useEffect)((function(){d?b&&!a?(u(!0),O(!0)):!b&&a&&g&&u(!1):O(!1)}),[a,d,b,g]),Object(s.createElement)(We.Panel,{className:n,ref:l},Object(s.createElement)(We.PanelBody,{title:i,opened:a,onToggle:function(){o(t,!a)},scrollAfterOpen:!d},(function(e){var t=e.opened;return Object(s.createElement)(We.__unstableDisclosureContent,{visible:t},Object(s.createElement)(pt.EntityProvider,{kind:"root",type:"postType",id:"widget-area-".concat(c)},Object(s.createElement)(mt,null)))})))}},jt=n(67),yt=n(132),wt=n(46);function ht(){var e=Object(f.useDispatch)("core"),t=e.redo,n=e.undo,r=Object(f.useDispatch)(Se).saveEditedWidgetAreas;return Object(wt.useShortcut)("core/edit-widgets/undo",(function(e){n(),e.preventDefault()}),{bindGlobal:!0}),Object(wt.useShortcut)("core/edit-widgets/redo",(function(e){t(),e.preventDefault()}),{bindGlobal:!0}),Object(wt.useShortcut)("core/edit-widgets/save",(function(e){e.preventDefault(),r()}),{bindGlobal:!0}),null}ht.Register=function(){var e=Object(f.useDispatch)(wt.store).registerShortcut;return Object(s.useEffect)((function(){e({name:"core/edit-widgets/undo",category:"global",description:Object(W.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:Object(W.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/edit-widgets/save",category:"global",description:Object(W.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}})}),[e]),null};var Et=ht,_t=function(){return Object(f.useSelect)((function(e){var t,n=e("core/block-editor"),r=n.getBlockSelectionEnd,c=n.getBlockParents,i=n.getBlockName,a=r();if("core/widget-area"===i(a))return a;var o=c(a).find((function(e){return"core/widget-area"===i(e)}));if(o)return o;var s=(0,e("core").getEntityRecord)(y,"postType","widget-areas");return null==s||null===(t=s.blocks[0])||void 0===t?void 0:t.clientId}),[])};function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){Object(o.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function It(e){var t=e.blockEditorSettings,n=e.children,r=Object(Je.a)(e,["blockEditorSettings","children"]),c=Object(f.useSelect)((function(e){return{hasUploadPermissions:Object(be.defaultTo)(e("core").canUser("create","media"),!0),widgetAreas:e(Se).getWidgetAreas(),widgets:e(Se).getWidgets(),reusableBlocks:e("core").getEntityRecords("postType","wp_block")}}),[]),i=c.hasUploadPermissions,a=c.reusableBlocks,o=Object(f.useDispatch)(Se).setIsInserterOpened,l=Object(s.useMemo)((function(){var e;return i&&(e=function(e){var n=e.onError,r=Object(Je.a)(e,["onError"]);Object(Ie.uploadMedia)(kt({wpAllowedMimeTypes:t.allowedMimeTypes,onError:function(e){var t=e.message;return n(t)}},r))}),kt(kt({},t),{},{__experimentalReusableBlocks:a,mediaUpload:e,templateLock:"all",__experimentalSetIsInserterOpened:o})}),[t,i,a,o]),u=_t(),d=Object(pt.useEntityBlockEditor)(y,"postType",{id:"widget-areas"}),b=Object(xe.a)(d,3),p=b[0],m=b[1],g=b[2];return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(Re.BlockEditorKeyboardShortcuts.Register,null),Object(s.createElement)(Et.Register,null),Object(s.createElement)(We.SlotFillProvider,null,Object(s.createElement)(We.DropZoneProvider,null,Object(s.createElement)(Re.BlockEditorProvider,Object(De.a)({value:p,onInput:m,onChange:g,settings:l,useSubRegistry:!1},r),n,Object(s.createElement)(yt.ReusableBlocksMenuItems,{rootClientId:u})))))}var Pt=n(12),At=n.n(Pt),xt=n(334),Wt=n(194);function Rt(e){var t,n=e.selectedWidgetAreaId,r=Object(f.useSelect)((function(e){return e(Se).getWidgetAreas()}),[]),c=Object(s.useMemo)((function(){return n&&(null==r?void 0:r.find((function(e){return e.id===n})))}),[n,r]);return t=c?"wp_inactive_widgets"===n?Object(W.__)("Blocks in this Widget Area will not be displayed in your site."):c.description:Object(W.__)("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."),Object(s.createElement)("div",{className:"edit-widgets-widget-areas"},Object(s.createElement)("div",{className:"edit-widgets-widget-areas__top-container"},Object(s.createElement)(Re.BlockIcon,{icon:Wt.a}),Object(s.createElement)("div",null,Object(s.createElement)("p",null,t),0===(null==r?void 0:r.length)&&Object(s.createElement)("p",null,Object(W.__)("Your theme does not contain any Widget Areas.")))))}var Ct=s.Platform.select({web:!0,native:!1});function Nt(e){var t=e.identifier,n=e.label,r=e.isActive,c=Object(f.useDispatch)(C.g).enableComplementaryArea;return Object(s.createElement)(We.Button,{onClick:function(){return c(Se.name,t)},className:At()("edit-widgets-sidebar__panel-tab",{"is-active":r}),"aria-label":r?// translators: %s: sidebar label e.g: "Widget Areas". | |
| 9 | +Object(W.sprintf)(Object(W.__)("%s (selected)"),n):n,"data-label":n},n)}function Dt(){var e=Object(f.useDispatch)(C.g).enableComplementaryArea,t=Object(f.useSelect)((function(e){var t=e("core/block-editor"),n=t.getSelectedBlock,r=t.getBlock,c=t.getBlockParentsByBlockName,i=e(C.g).getActiveComplementaryArea,a=n(),o=i(Se.name);o||(o=a?"edit-widgets/block-inspector":"edit-widgets/block-areas");var s,l=!!o;return a&&(s="core/widget-area"===a.name?a:r(c(a.clientId,"core/widget-area")[0])),{currentArea:o,hasSelectedNonAreaBlock:!(!a||"core/widget-area"===a.name),isGeneralSidebarOpen:l,selectedWidgetAreaBlock:s}}),[]),n=t.currentArea,r=t.hasSelectedNonAreaBlock,c=t.isGeneralSidebarOpen,i=t.selectedWidgetAreaBlock;return Object(s.useEffect)((function(){r&&"edit-widgets/block-areas"===n&&c&&e(Se,"edit-widgets/block-inspector"),!r&&"edit-widgets/block-inspector"===n&&c&&e(Se,"edit-widgets/block-areas")}),[r,e]),Object(s.createElement)(C.b,{className:"edit-widgets-sidebar",header:Object(s.createElement)("ul",null,Object(s.createElement)("li",null,Object(s.createElement)(Nt,{identifier:"edit-widgets/block-areas",label:i?i.attributes.name:Object(W.__)("Widget Areas"),isActive:"edit-widgets/block-areas"===n})),Object(s.createElement)("li",null,Object(s.createElement)(Nt,{identifier:"edit-widgets/block-inspector",label:Object(W.__)("Block"),isActive:"edit-widgets/block-inspector"===n}))),headerClassName:"edit-widgets-sidebar__panel-tabs" | |
| 10 | +/* translators: button label text should, if possible, be under 16 characters. */,title:Object(W.__)("Settings"),closeLabel:Object(W.__)("Close settings"),scope:"core/edit-widgets",identifier:n,icon:xt.a,isActiveByDefault:Ct},"edit-widgets/block-areas"===n&&Object(s.createElement)(Rt,{selectedWidgetAreaId:null==i?void 0:i.attributes.id}),"edit-widgets/block-inspector"===n&&(r?Object(s.createElement)(Re.BlockInspector,null):Object(s.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},Object(W.__)("No block selected."))))}var Bt=n(158),Tt=n(196),Lt=function(){var e=Object(f.useSelect)((function(e){var t,n=e(Se),r=n.getEditedWidgetAreas,c=n.isSavingWidgetAreas;return{hasEditedWidgetAreaIds:(null===(t=r())||void 0===t?void 0:t.length)>0,isSaving:c()}}),[]),t=e.hasEditedWidgetAreaIds,n=e.isSaving,r=Object(f.useDispatch)(Se).saveEditedWidgetAreas;return Object(s.createElement)(We.Button,{isPrimary:!0,isBusy:n,"aria-disabled":n,onClick:n?void 0:r,disabled:!t},n?Object(W.__)("Saving…"):Object(W.__)("Update"))},Mt=n(335),Ft=n(17),Gt=Object(s.forwardRef)((function(e,t){var n=Object(f.useSelect)((function(e){return e("core").hasUndo()})),r=Object(f.useDispatch)("core").undo;return Object(s.createElement)(We.Button,Object(De.a)({icon:Mt.a,label:Object(W.__)("Undo"),shortcut:Ft.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?r:void 0,ref:t},e))})),Vt=n(336),zt=Object(s.forwardRef)((function(e,t){var n=Object(f.useSelect)((function(e){return e("core").hasRedo()})),r=Object(f.useDispatch)("core").redo;return Object(s.createElement)(We.Button,Object(De.a)({icon:Vt.a,label:Object(W.__)("Redo"),shortcut:Ft.displayShortcut.primaryShift("z"),"aria-disabled":!n,onClick:n?r:void 0,ref:t},e))})),Ut=function(){var e=Object(s.useRef)(),t=Object(Ve.useViewportMatch)("medium"),n=_t(),r=Object(f.useSelect)((function(e){return e(Se).getIsWidgetAreaOpen(n)}),[n]),c=Object(f.useSelect)((function(e){return e(Se).isInserterOpened()})),i=Object(f.useDispatch)(Se),a=i.setIsWidgetAreaOpen,o=i.setIsInserterOpened,l=Object(f.useDispatch)("core/block-editor").selectBlock;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)("div",{className:"edit-widgets-header"},Object(s.createElement)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper"},Object(s.createElement)("h1",{className:"edit-widgets-header__title"},Object(W.__)("Widgets")),Object(s.createElement)(Re.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":Object(W.__)("Document tools")},Object(s.createElement)(We.ToolbarItem,{ref:e,as:We.Button,className:"edit-widgets-header-toolbar__inserter-toggle",isPrimary:!0,isPressed:c,onMouseDown:function(e){e.preventDefault()},onClick:function(){c?e.current.focus():(r||(l(n),a(n,!0)),window.requestAnimationFrame((function(){return o(!0)})))},icon:Tt.a | |
| 11 | +/* translators: button label text should, if possible, be under 16 | |
| 12 | + characters. */,label:Object(W._x)("Add block","Generic label for block inserter button")}),Object(s.createElement)(We.ToolbarItem,{as:Gt}),Object(s.createElement)(We.ToolbarItem,{as:zt}),Object(s.createElement)(We.ToolbarItem,{as:Re.BlockNavigationDropdown}))),Object(s.createElement)("div",{className:"edit-widgets-header__actions"},Object(s.createElement)(Lt,null),Object(s.createElement)(C.f.Slot,{scope:"core/edit-widgets"}))),!t&&Object(s.createElement)("div",{className:"edit-widgets-header__block-toolbar"},Object(s.createElement)(Re.BlockToolbar,{hideDragHandle:!0})))},Ht=function(){var e=Object(f.useSelect)((function(e){return{notices:e(R.store).getNotices()}}),[]).notices,t=Object(be.filter)(e,{type:"snackbar"}),n=Object(f.useDispatch)(R.store).removeNotice;return Object(s.createElement)(We.SnackbarList,{notices:t,className:"edit-widgets-notices__snackbar",onRemove:n})};function qt(e){var t=e.blockEditorSettings;return Object(s.createElement)("div",{className:"edit-widgets-block-editor editor-styles-wrapper"},Object(s.createElement)(Re.__unstableEditorStyles,{styles:t.styles}),Object(s.createElement)(Et,null),Object(s.createElement)(Re.BlockEditorKeyboardShortcuts,null),Object(s.createElement)(Ht,null),Object(s.createElement)(We.Popover.Slot,{name:"block-toolbar"}),Object(s.createElement)(Re.BlockSelectionClearer,null,Object(s.createElement)(Re.WritingFlow,null,Object(s.createElement)(Re.ObserveTyping,null,Object(s.createElement)(Re.BlockList,{className:"edit-widgets-main-block-list"})))))}var Qt={ | |
| 13 | +/* translators: accessibility text for the widgets screen top bar landmark region. */ | |
| 14 | +header:Object(W.__)("Widgets top bar"), | |
| 15 | +/* translators: accessibility text for the widgets screen content landmark region. */ | |
| 16 | +body:Object(W.__)("Widgets and blocks"), | |
| 17 | +/* translators: accessibility text for the widgets screen settings landmark region. */ | |
| 18 | +sidebar:Object(W.__)("Widgets settings")},Yt=function(e){var t,n=e.blockEditorSettings,r=Object(Ve.useViewportMatch)("medium","<"),c=Object(Ve.useViewportMatch)("huge",">="),i=Object(f.useDispatch)(Se),a=i.setIsInserterOpened,o=i.closeGeneralSidebar,l=(t=Object(f.useSelect)((function(e){var t,n=(0,e("core").getEntityRecord)(y,"postType","widget-areas");return null==n||null===(t=n.blocks[0])||void 0===t?void 0:t.clientId}),[]),Object(f.useSelect)((function(e){var n=e("core/block-editor"),r=n.getBlockRootClientId,c=n.getBlockSelectionEnd,i=n.getBlockOrder,a=n.getBlockIndex,o=c()||t,s=r(o);return o&&""===s?{rootClientId:o,insertionIndex:i(o).length}:{rootClientId:s,insertionIndex:a(o,s)+1}}),[t])),u=l.rootClientId,d=l.insertionIndex,b=Object(f.useSelect)((function(e){return{hasSidebarEnabled:!!e(C.g).getActiveComplementaryArea(Se.name),isInserterOpened:!!e(Se).isInserterOpened()}}),[]),p=b.hasSidebarEnabled,m=b.isInserterOpened;Object(s.useEffect)((function(){p&&!c&&a(!1)}),[p,c]),Object(s.useEffect)((function(){m&&!c&&o()}),[m,c]);var g=Object(Ve.__experimentalUseDialog)({onClose:function(){return a(!1)}}),O=Object(xe.a)(g,2),v=O[0],j=O[1];return Object(s.createElement)(C.e,{labels:Qt,header:Object(s.createElement)(Ut,null),secondarySidebar:m&&Object(s.createElement)("div",Object(De.a)({ref:v},j,{className:"edit-widgets-layout__inserter-panel"}),Object(s.createElement)("div",{className:"edit-widgets-layout__inserter-panel-header"},Object(s.createElement)(We.Button,{icon:Bt.a,onClick:function(){return a(!1)}})),Object(s.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},Object(s.createElement)(Re.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:r,rootClientId:u,__experimentalInsertionIndex:d}))),sidebar:p&&Object(s.createElement)(C.b.Slot,{scope:"core/edit-widgets"}),content:Object(s.createElement)(qt,{blockEditorSettings:n})})};function $t(){var e=Object(f.useSelect)((function(e){return function(){return(0,e("core").__experimentalGetDirtyEntityRecords)().length>0}}),[]);return Object(s.useEffect)((function(){var t=function(t){if(e())return t.returnValue=Object(W.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),function(){window.removeEventListener("beforeunload",t)}}),[e]),null}var Kt=function(e){var t=e.blockEditorSettings;return Object(s.createElement)(It,{blockEditorSettings:t},Object(s.createElement)(Yt,{blockEditorSettings:t}),Object(s.createElement)(Dt,null),Object(s.createElement)(We.Popover.Slot,null),Object(s.createElement)(jt.PluginArea,null),Object(s.createElement)($t,null))};function Xt(e,t){var n,r,c,i=Object(u.__experimentalGetCoreBlocks)().filter((function(e){return!["core/more"].includes(e.name)}));Object(u.registerCoreBlocks)(i),Object(u.__experimentalRegisterExperimentalCoreBlocks)(),Zt((c=null!==(r=null==(n=t)?void 0:n.availableLegacyWidgets)&&void 0!==r?r:{},{metadata:lt,name:ut,settings:st(st({},dt),{},{__experimentalLabel:function(e){return e.name},variations:bt(c)})})),Zt(a),Object(s.render)(Object(s.createElement)(Kt,{blockEditorSettings:t}),document.getElementById(e))}var Zt=function(e){if(e){var t=e.metadata,n=e.settings,r=e.name;t&&Object(l.unstable__bootstrapServerSideBlockDefinitions)(Object(o.a)({},r,t)),Object(l.registerBlockType)(r,n)}}},53:function(e,t,n){"use strict";n.d(t,"g",(function(){return y})),n.d(t,"b",(function(){return Q})),n.d(t,"c",(function(){return V})),n.d(t,"d",(function(){return J})),n.d(t,"e",(function(){return re})),n.d(t,"f",(function(){return U})),n.d(t,"a",(function(){return G}));var r={};n.r(r),n.d(r,"enableComplementaryArea",(function(){return f})),n.d(r,"disableComplementaryArea",(function(){return p})),n.d(r,"pinItem",(function(){return g})),n.d(r,"unpinItem",(function(){return O}));var c={};n.r(c),n.d(c,"getActiveComplementaryArea",(function(){return v})),n.d(c,"isItemPinned",(function(){return j}));var i=n(4),a=n(5),o=n(2);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){Object(a.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=Object(i.combineReducers)({singleEnableItems:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=t.type,r=t.itemType,c=t.scope,i=t.item;return"SET_SINGLE_ENABLE_ITEM"===n&&r&&c?l(l({},e),{},Object(a.a)({},r,l(l({},e[r]),{},Object(a.a)({},c,i||null)))):e},multipleEnableItems:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=t.type,r=t.itemType,c=t.scope,i=t.item,s=t.isEnable;if("SET_MULTIPLE_ENABLE_ITEM"!==n||!r||!c||!i||Object(o.get)(e,[r,c,i])===s)return e;var u=e[r]||{},d=u[c]||{};return l(l({},e),{},Object(a.a)({},r,l(l({},u),{},Object(a.a)({},c,l(l({},d),{},Object(a.a)({},i,s||!1))))))}}),d=Object(i.combineReducers)({enableItems:u});function b(e,t,n){return{type:"SET_SINGLE_ENABLE_ITEM",itemType:e,scope:t,item:n}}function f(e,t){return b("complementaryArea",e,t)}function p(e){return b("complementaryArea",e,void 0)}function m(e,t,n,r){return{type:"SET_MULTIPLE_ENABLE_ITEM",itemType:e,scope:t,item:n,isEnable:r}}function g(e,t){return m("pinnedItems",e,t,!0)}function O(e,t){return m("pinnedItems",e,t,!1)}function v(e,t){return function(e,t,n){return Object(o.get)(e.enableItems.singleEnableItems,["complementaryArea",n])}(e,0,t)}function j(e,t,n){return!1!==function(e,t,n,r){return Object(o.get)(e.enableItems.multipleEnableItems,["pinnedItems",n,r])}(e,0,t,n)}var y=Object(i.createReduxStore)("core/interface",{reducer:d,actions:r,selectors:c,persist:["enableItems"]});Object(i.registerStore)("core/interface",{reducer:d,actions:r,selectors:c,persist:["enableItems"]});var w=n(10),h=n(13),E=n(0),_=n(12),S=n.n(_),k=n(3),I=n(1),P=n(159),A=n(219),x=n(220),W=n(86),R=n(157),C=n(67),N=Object(C.withPluginContext)((function(e,t){return{icon:t.icon||e.icon,identifier:t.identifier||"".concat(e.name,"/").concat(t.name)}})),D=N((function(e){var t=e.as,n=void 0===t?k.Button:t,r=e.scope,c=e.identifier,a=e.icon,s=e.selectedIcon,l=Object(h.a)(e,["as","scope","identifier","icon","selectedIcon"]),u=n,d=Object(i.useSelect)((function(e){return e(y).getActiveComplementaryArea(r)===c}),[c]),b=Object(i.useDispatch)(y),f=b.enableComplementaryArea,p=b.disableComplementaryArea;return Object(E.createElement)(u,Object(w.a)({icon:s&&d?s:a,onClick:function(){d?p(r):f(r,c)}},Object(o.omit)(l,["name"])))})),B=function(e){var t=e.smallScreenTitle,n=e.children,r=e.className,c=e.toggleButtonProps,i=Object(E.createElement)(D,Object(w.a)({icon:R.a},c));return Object(E.createElement)(E.Fragment,null,Object(E.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},t&&Object(E.createElement)("span",{className:"interface-complementary-area-header__small-title"},t),i),Object(E.createElement)("div",{className:S()("components-panel__header","interface-complementary-area-header",r),tabIndex:-1},n,i))},T=n(8);function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){Object(a.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function F(e){var t=e.name,n=e.as,r=e.onClick,c=Object(h.a)(e,["name","as","onClick"]);return Object(E.createElement)(k.Fill,{name:t},(function(e){var t=e.onClick,i=e.as,a=n||i||k.Button;return Object(E.createElement)(a,Object(w.a)({onClick:r||t?function(){(r||o.noop).apply(void 0,arguments),(t||o.noop).apply(void 0,arguments)}:void 0},c))}))}F.Slot=function(e){var t=e.name,n=e.as,r=void 0===n?[k.ButtonGroup,k.Button]:n,c=e.fillProps,i=void 0===c?{}:c,a=e.bubblesVirtually,s=Object(h.a)(e,["name","as","fillProps","bubblesVirtually"]),l=Object(T.a)(r,2),u=l[0],d=l[1];return Object(E.createElement)(k.Slot,{name:t,bubblesVirtually:a,fillProps:M({as:d},i)},(function(e){if(Object(o.isEmpty)(E.Children.toArray(e)))return null;var t=[];E.Children.forEach(e,(function(e){var n=e.props,r=n.__unstableExplicitMenuItem,c=n.__unstableTarget;c&&r&&t.push(c)}));var n=E.Children.map(e,(function(e){return!e.props.__unstableExplicitMenuItem&&t.includes(e.props.__unstableTarget)?null:e}));return Object(E.createElement)(u,s,n)}))};var G=F;function V(e){var t=e.scope,n=e.target,r=e.__unstableExplicitMenuItem,c=Object(h.a)(e,["scope","target","__unstableExplicitMenuItem"]);return Object(E.createElement)(D,Object(w.a)({as:function(e){return Object(E.createElement)(G,Object(w.a)({__unstableExplicitMenuItem:r,__unstableTarget:"".concat(t,"/").concat(n),name:"".concat(t,"/plugin-more-menu")},e))},role:"menuitemcheckbox",selectedIcon:P.a,name:n,scope:t},c))}function z(e){var t=e.scope,n=Object(h.a)(e,["scope"]);return Object(E.createElement)(k.Fill,Object(w.a)({name:"PinnedItems/".concat(t)},n))}z.Slot=function(e){var t=e.scope,n=e.className,r=Object(h.a)(e,["scope","className"]);return Object(E.createElement)(k.Slot,Object(w.a)({name:"PinnedItems/".concat(t)},r),(function(e){return!Object(o.isEmpty)(e)&&Object(E.createElement)("div",{className:S()(n,"interface-pinned-items")},e)}))};var U=z;function H(e){var t=e.scope,n=e.children,r=e.className;return Object(E.createElement)(k.Fill,{name:"ComplementaryArea/".concat(t)},Object(E.createElement)("div",{className:r},n))}var q=N((function(e){var t=e.children,n=e.className,r=e.closeLabel,c=void 0===r?Object(I.__)("Close plugin"):r,a=e.identifier,o=e.header,s=e.headerClassName,l=e.icon,u=e.isPinnable,d=void 0===u||u,b=e.panelClassName,f=e.scope,p=e.name,m=e.smallScreenTitle,g=e.title,O=e.toggleShortcut,v=e.isActiveByDefault,j=e.showIconLabels,w=void 0!==j&&j,h=Object(i.useSelect)((function(e){var t=e(y),n=t.getActiveComplementaryArea,r=t.isItemPinned,c=n(f);return{isActive:c===a,isPinned:r(f,a),activeArea:c,isSmall:e(W.store).isViewportMatch("< medium"),isLarge:e(W.store).isViewportMatch("large")}}),[a,f]),_=h.isActive,R=h.isPinned,C=h.activeArea,N=h.isSmall,T=h.isLarge;!function(e,t,n,r,c){var a=Object(E.useRef)(!1),o=Object(E.useRef)(!1),s=Object(i.useDispatch)(y),l=s.enableComplementaryArea,u=s.disableComplementaryArea;Object(E.useEffect)((function(){r&&c&&!a.current?(u(e),o.current=!0):o.current&&!c&&a.current?(o.current=!1,l(e,t)):o.current&&n&&n!==t&&(o.current=!1),c!==a.current&&(a.current=c)}),[r,c,e,t,n])}(f,a,C,_,N);var L=Object(i.useDispatch)(y),M=L.enableComplementaryArea,F=L.disableComplementaryArea,G=L.pinItem,z=L.unpinItem;return Object(E.useEffect)((function(){v&&void 0===C&&!N&&M(f,a)}),[C,v,f,a,N]),Object(E.createElement)(E.Fragment,null,d&&Object(E.createElement)(U,{scope:f},R&&Object(E.createElement)(D,{scope:f,identifier:a,isPressed:_&&(!w||T),"aria-expanded":_,label:g,icon:w?P.a:l,showTooltip:!w,isTertiary:w})),p&&d&&Object(E.createElement)(V,{target:p,scope:f,icon:l},g),_&&Object(E.createElement)(H,{className:S()("interface-complementary-area",n),scope:f},Object(E.createElement)(B,{className:s,closeLabel:c,onClose:function(){return F(f)},smallScreenTitle:m,toggleButtonProps:{label:c,shortcut:O,scope:f,identifier:a}},o||Object(E.createElement)(E.Fragment,null,Object(E.createElement)("strong",null,g),d&&Object(E.createElement)(k.Button,{className:"interface-complementary-area__pin-unpin-item",icon:R?A.a:x.a,label:R?Object(I.__)("Unpin from toolbar"):Object(I.__)("Pin to toolbar"),onClick:function(){return(R?z:G)(f,a)},isPressed:R,"aria-expanded":R}))),Object(E.createElement)(k.Panel,{className:b},t)))}));q.Slot=function(e){var t=e.scope,n=Object(h.a)(e,["scope"]);return Object(E.createElement)(k.Slot,Object(w.a)({name:"ComplementaryArea/".concat(t)},n))};var Q=q,Y=n(28),$=n(29),K=n(32),X=n(33),Z=n(22);var J=function(e){Object(K.a)(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Object(Z.a)(t);if(n){var c=Object(Z.a)(this).constructor;e=Reflect.construct(r,arguments,c)}else e=r.apply(this,arguments);return Object(X.a)(this,e)});function c(){return Object(Y.a)(this,c),r.apply(this,arguments)}return Object($.a)(c,[{key:"componentDidMount",value:function(){this.isSticky=!1,this.sync(),document.body.classList.contains("sticky-menu")&&(this.isSticky=!0,document.body.classList.remove("sticky-menu"))}},{key:"componentWillUnmount",value:function(){this.isSticky&&document.body.classList.add("sticky-menu"),this.props.isActive&&document.body.classList.remove("is-fullscreen-mode")}},{key:"componentDidUpdate",value:function(e){this.props.isActive!==e.isActive&&this.sync()}},{key:"sync",value:function(){this.props.isActive?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode")}},{key:"render",value:function(){return null}}]),c}(E.Component),ee=n(14);function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){Object(a.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var re=Object(E.forwardRef)((function(e,t){var n=e.footer,r=e.header,c=e.sidebar,i=e.secondarySidebar,a=e.content,o=e.drawer,s=e.actions,l=e.labels,u=e.className,d=e.shortcuts,b=Object(E.useRef)(),f=Object(k.__unstableUseNavigateRegions)(b,d);!function(e){Object(E.useEffect)((function(){var t=document&&document.querySelector("html:not(.".concat(e,")"));if(t)return t.classList.toggle(e),function(){t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");var p=ne(ne({},{ | |
| 19 | +/* translators: accessibility text for the nav bar landmark region. */ | |
| 20 | +drawer:Object(I.__)("Drawer"), | |
| 21 | +/* translators: accessibility text for the top bar landmark region. */ | |
| 22 | +header:Object(I.__)("Header"), | |
| 23 | +/* translators: accessibility text for the content landmark region. */ | |
| 24 | +body:Object(I.__)("Content"), | |
| 25 | +/* translators: accessibility text for the secondary sidebar landmark region. */ | |
| 26 | +secondarySidebar:Object(I.__)("Block Library"), | |
| 27 | +/* translators: accessibility text for the settings landmark region. */ | |
| 28 | +sidebar:Object(I.__)("Settings"), | |
| 29 | +/* translators: accessibility text for the publish landmark region. */ | |
| 30 | +actions:Object(I.__)("Publish"), | |
| 31 | +/* translators: accessibility text for the footer landmark region. */ | |
| 32 | +footer:Object(I.__)("Footer")}),l);return Object(E.createElement)("div",{ref:Object(ee.useMergeRefs)([t,b]),className:S()(u,"interface-interface-skeleton",f,!!n&&"has-footer")},!!o&&Object(E.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":p.drawer},o),Object(E.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&Object(E.createElement)("div",{className:"interface-interface-skeleton__header",role:"region","aria-label":p.header,tabIndex:"-1"},r),Object(E.createElement)("div",{className:"interface-interface-skeleton__body"},!!i&&Object(E.createElement)("div",{className:"interface-interface-skeleton__secondary-sidebar",role:"region","aria-label":p.secondarySidebar,tabIndex:"-1"},i),Object(E.createElement)("div",{className:"interface-interface-skeleton__content",role:"region","aria-label":p.body,tabIndex:"-1"},a),!!c&&Object(E.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":p.sidebar,tabIndex:"-1"},c),!!s&&Object(E.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":p.actions,tabIndex:"-1"},s))),!!n&&Object(E.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":p.footer,tabIndex:"-1"},n))}))},58:function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",(function(){return r}))},6:function(e,t){e.exports=window.wp.blockEditor},67:function(e,t){e.exports=window.wp.plugins},7:function(e,t){e.exports=window.wp.primitives},77:function(e,t){e.exports=window.wp.blockLibrary},8:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(39),c=n(30),i=n(40);function a(e,t){return Object(r.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(_n=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,c=e}finally{try{_n||null==a.return||a.return()}finally{if(r)throw c}}return n}}(e,t)||Object(c.a)(e,t)||Object(i.a)()}},86:function(e,t){e.exports=window.wp.viewport},90:function(e,t){e.exports=window.wp.mediaUtils}}); | |