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