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