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