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