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