[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 5755: 5 /***/ ((module, exports) => { 6 7 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8 Copyright (c) 2018 Jed Watson. 9 Licensed under the MIT License (MIT), see 10 http://jedwatson.github.io/classnames 11 */ 12 /* global define */ 13 14 (function () { 15 'use strict'; 16 17 var hasOwn = {}.hasOwnProperty; 18 var nativeCodeString = '[native code]'; 19 20 function classNames() { 21 var classes = []; 22 23 for (var i = 0; i < arguments.length; i++) { 24 var arg = arguments[i]; 25 if (!arg) continue; 26 27 var argType = typeof arg; 28 29 if (argType === 'string' || argType === 'number') { 30 classes.push(arg); 31 } else if (Array.isArray(arg)) { 32 if (arg.length) { 33 var inner = classNames.apply(null, arg); 34 if (inner) { 35 classes.push(inner); 36 } 37 } 38 } else if (argType === 'object') { 39 if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { 40 classes.push(arg.toString()); 41 continue; 42 } 43 44 for (var key in arg) { 45 if (hasOwn.call(arg, key) && arg[key]) { 46 classes.push(key); 47 } 48 } 49 } 50 } 51 52 return classes.join(' '); 53 } 54 55 if ( true && module.exports) { 56 classNames.default = classNames; 57 module.exports = classNames; 58 } else if (true) { 59 // register as 'classnames', consistent with npm package name 60 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 61 return classNames; 62 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 63 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 64 } else {} 65 }()); 66 67 68 /***/ }), 69 70 /***/ 7734: 71 /***/ ((module) => { 72 73 "use strict"; 74 75 76 // do not edit .js files directly - edit src/index.jst 77 78 79 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; 80 81 82 module.exports = function equal(a, b) { 83 if (a === b) return true; 84 85 if (a && b && typeof a == 'object' && typeof b == 'object') { 86 if (a.constructor !== b.constructor) return false; 87 88 var length, i, keys; 89 if (Array.isArray(a)) { 90 length = a.length; 91 if (length != b.length) return false; 92 for (i = length; i-- !== 0;) 93 if (!equal(a[i], b[i])) return false; 94 return true; 95 } 96 97 98 if ((a instanceof Map) && (b instanceof Map)) { 99 if (a.size !== b.size) return false; 100 for (i of a.entries()) 101 if (!b.has(i[0])) return false; 102 for (i of a.entries()) 103 if (!equal(i[1], b.get(i[0]))) return false; 104 return true; 105 } 106 107 if ((a instanceof Set) && (b instanceof Set)) { 108 if (a.size !== b.size) return false; 109 for (i of a.entries()) 110 if (!b.has(i[0])) return false; 111 return true; 112 } 113 114 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { 115 length = a.length; 116 if (length != b.length) return false; 117 for (i = length; i-- !== 0;) 118 if (a[i] !== b[i]) return false; 119 return true; 120 } 121 122 123 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 124 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 125 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 126 127 keys = Object.keys(a); 128 length = keys.length; 129 if (length !== Object.keys(b).length) return false; 130 131 for (i = length; i-- !== 0;) 132 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 133 134 for (i = length; i-- !== 0;) { 135 var key = keys[i]; 136 137 if (!equal(a[key], b[key])) return false; 138 } 139 140 return true; 141 } 142 143 // true if both NaN, false otherwise 144 return a!==a && b!==b; 145 }; 146 147 148 /***/ }) 149 150 /******/ }); 151 /************************************************************************/ 152 /******/ // The module cache 153 /******/ var __webpack_module_cache__ = {}; 154 /******/ 155 /******/ // The require function 156 /******/ function __webpack_require__(moduleId) { 157 /******/ // Check if module is in cache 158 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 159 /******/ if (cachedModule !== undefined) { 160 /******/ return cachedModule.exports; 161 /******/ } 162 /******/ // Create a new module (and put it into the cache) 163 /******/ var module = __webpack_module_cache__[moduleId] = { 164 /******/ // no module.id needed 165 /******/ // no module.loaded needed 166 /******/ exports: {} 167 /******/ }; 168 /******/ 169 /******/ // Execute the module function 170 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 171 /******/ 172 /******/ // Return the exports of the module 173 /******/ return module.exports; 174 /******/ } 175 /******/ 176 /************************************************************************/ 177 /******/ /* webpack/runtime/compat get default export */ 178 /******/ (() => { 179 /******/ // getDefaultExport function for compatibility with non-harmony modules 180 /******/ __webpack_require__.n = (module) => { 181 /******/ var getter = module && module.__esModule ? 182 /******/ () => (module['default']) : 183 /******/ () => (module); 184 /******/ __webpack_require__.d(getter, { a: getter }); 185 /******/ return getter; 186 /******/ }; 187 /******/ })(); 188 /******/ 189 /******/ /* webpack/runtime/define property getters */ 190 /******/ (() => { 191 /******/ // define getter functions for harmony exports 192 /******/ __webpack_require__.d = (exports, definition) => { 193 /******/ for(var key in definition) { 194 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 195 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 196 /******/ } 197 /******/ } 198 /******/ }; 199 /******/ })(); 200 /******/ 201 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 202 /******/ (() => { 203 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 204 /******/ })(); 205 /******/ 206 /******/ /* webpack/runtime/make namespace object */ 207 /******/ (() => { 208 /******/ // define __esModule on exports 209 /******/ __webpack_require__.r = (exports) => { 210 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 211 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 212 /******/ } 213 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 214 /******/ }; 215 /******/ })(); 216 /******/ 217 /************************************************************************/ 218 var __webpack_exports__ = {}; 219 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 220 (() => { 221 "use strict"; 222 // ESM COMPAT FLAG 223 __webpack_require__.r(__webpack_exports__); 224 225 // EXPORTS 226 __webpack_require__.d(__webpack_exports__, { 227 initialize: () => (/* binding */ initialize), 228 store: () => (/* reexport */ store) 229 }); 230 231 // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js 232 var selectors_namespaceObject = {}; 233 __webpack_require__.r(selectors_namespaceObject); 234 __webpack_require__.d(selectors_namespaceObject, { 235 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 236 isInserterOpened: () => (isInserterOpened) 237 }); 238 239 // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js 240 var actions_namespaceObject = {}; 241 __webpack_require__.r(actions_namespaceObject); 242 __webpack_require__.d(actions_namespaceObject, { 243 setIsInserterOpened: () => (setIsInserterOpened) 244 }); 245 246 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 247 var store_actions_namespaceObject = {}; 248 __webpack_require__.r(store_actions_namespaceObject); 249 __webpack_require__.d(store_actions_namespaceObject, { 250 closeModal: () => (closeModal), 251 disableComplementaryArea: () => (disableComplementaryArea), 252 enableComplementaryArea: () => (enableComplementaryArea), 253 openModal: () => (openModal), 254 pinItem: () => (pinItem), 255 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 256 setFeatureDefaults: () => (setFeatureDefaults), 257 setFeatureValue: () => (setFeatureValue), 258 toggleFeature: () => (toggleFeature), 259 unpinItem: () => (unpinItem) 260 }); 261 262 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 263 var store_selectors_namespaceObject = {}; 264 __webpack_require__.r(store_selectors_namespaceObject); 265 __webpack_require__.d(store_selectors_namespaceObject, { 266 getActiveComplementaryArea: () => (getActiveComplementaryArea), 267 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 268 isFeatureActive: () => (isFeatureActive), 269 isItemPinned: () => (isItemPinned), 270 isModalActive: () => (isModalActive) 271 }); 272 273 ;// CONCATENATED MODULE: external "React" 274 const external_React_namespaceObject = window["React"]; 275 ;// CONCATENATED MODULE: external ["wp","element"] 276 const external_wp_element_namespaceObject = window["wp"]["element"]; 277 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] 278 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 279 ;// CONCATENATED MODULE: external ["wp","widgets"] 280 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 281 ;// CONCATENATED MODULE: external ["wp","blocks"] 282 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 283 ;// CONCATENATED MODULE: external ["wp","data"] 284 const external_wp_data_namespaceObject = window["wp"]["data"]; 285 ;// CONCATENATED MODULE: external ["wp","preferences"] 286 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 287 ;// CONCATENATED MODULE: external ["wp","components"] 288 const external_wp_components_namespaceObject = window["wp"]["components"]; 289 ;// CONCATENATED MODULE: external ["wp","i18n"] 290 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 291 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 292 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 293 ;// CONCATENATED MODULE: external ["wp","compose"] 294 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 295 ;// CONCATENATED MODULE: external ["wp","hooks"] 296 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 297 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/error-boundary/index.js 298 299 /** 300 * WordPress dependencies 301 */ 302 303 304 305 306 307 308 function CopyButton({ 309 text, 310 children 311 }) { 312 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 313 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 314 variant: "secondary", 315 ref: ref 316 }, children); 317 } 318 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 319 constructor() { 320 super(...arguments); 321 this.state = { 322 error: null 323 }; 324 } 325 componentDidCatch(error) { 326 this.setState({ 327 error 328 }); 329 (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); 330 } 331 render() { 332 const { 333 error 334 } = this.state; 335 if (!error) { 336 return this.props.children; 337 } 338 return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { 339 className: "customize-widgets-error-boundary", 340 actions: [(0,external_React_namespaceObject.createElement)(CopyButton, { 341 key: "copy-error", 342 text: error.stack 343 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))] 344 }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')); 345 } 346 } 347 348 ;// CONCATENATED MODULE: external ["wp","coreData"] 349 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 350 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] 351 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 352 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-inspector-button/index.js 353 354 /** 355 * WordPress dependencies 356 */ 357 358 359 360 361 362 function BlockInspectorButton({ 363 inspector, 364 closeMenu, 365 ...props 366 }) { 367 const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(), []); 368 const selectedBlock = (0,external_wp_element_namespaceObject.useMemo)(() => document.getElementById(`block-$selectedBlockClientId}`), [selectedBlockClientId]); 369 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 370 onClick: () => { 371 // Open the inspector. 372 inspector.open({ 373 returnFocusWhenClose: selectedBlock 374 }); 375 // Then close the dropdown menu. 376 closeMenu(); 377 }, 378 ...props 379 }, (0,external_wp_i18n_namespaceObject.__)('Show more settings')); 380 } 381 /* harmony default export */ const block_inspector_button = (BlockInspectorButton); 382 383 // EXTERNAL MODULE: ./node_modules/classnames/index.js 384 var classnames = __webpack_require__(5755); 385 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 386 ;// CONCATENATED MODULE: external ["wp","keycodes"] 387 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 388 ;// CONCATENATED MODULE: external ["wp","primitives"] 389 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 390 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js 391 392 /** 393 * WordPress dependencies 394 */ 395 396 const undo = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 397 xmlns: "http://www.w3.org/2000/svg", 398 viewBox: "0 0 24 24" 399 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 400 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" 401 })); 402 /* harmony default export */ const library_undo = (undo); 403 404 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js 405 406 /** 407 * WordPress dependencies 408 */ 409 410 const redo = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 411 xmlns: "http://www.w3.org/2000/svg", 412 viewBox: "0 0 24 24" 413 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 414 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" 415 })); 416 /* harmony default export */ const library_redo = (redo); 417 418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js 419 420 /** 421 * WordPress dependencies 422 */ 423 424 const plus = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 425 xmlns: "http://www.w3.org/2000/svg", 426 viewBox: "0 0 24 24" 427 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 428 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 429 })); 430 /* harmony default export */ const library_plus = (plus); 431 432 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 433 434 /** 435 * WordPress dependencies 436 */ 437 438 const closeSmall = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 439 xmlns: "http://www.w3.org/2000/svg", 440 viewBox: "0 0 24 24" 441 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 442 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" 443 })); 444 /* harmony default export */ const close_small = (closeSmall); 445 446 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/reducer.js 447 /** 448 * WordPress dependencies 449 */ 450 451 452 /** 453 * Reducer tracking whether the inserter is open. 454 * 455 * @param {boolean|Object} state 456 * @param {Object} action 457 */ 458 function blockInserterPanel(state = false, action) { 459 switch (action.type) { 460 case 'SET_IS_INSERTER_OPENED': 461 return action.value; 462 } 463 return state; 464 } 465 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 466 blockInserterPanel 467 })); 468 469 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/selectors.js 470 const EMPTY_INSERTION_POINT = { 471 rootClientId: undefined, 472 insertionIndex: undefined 473 }; 474 475 /** 476 * Returns true if the inserter is opened. 477 * 478 * @param {Object} state Global application state. 479 * 480 * @example 481 * ```js 482 * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets'; 483 * import { __ } from '@wordpress/i18n'; 484 * import { useSelect } from '@wordpress/data'; 485 * 486 * const ExampleComponent = () => { 487 * const { isInserterOpened } = useSelect( 488 * ( select ) => select( customizeWidgetsStore ), 489 * [] 490 * ); 491 * 492 * return isInserterOpened() 493 * ? __( 'Inserter is open' ) 494 * : __( 'Inserter is closed.' ); 495 * }; 496 * ``` 497 * 498 * @return {boolean} Whether the inserter is opened. 499 */ 500 function isInserterOpened(state) { 501 return !!state.blockInserterPanel; 502 } 503 504 /** 505 * Get the insertion point for the inserter. 506 * 507 * @param {Object} state Global application state. 508 * 509 * @return {Object} The root client ID and index to insert at. 510 */ 511 function __experimentalGetInsertionPoint(state) { 512 if (typeof state.blockInserterPanel === 'boolean') { 513 return EMPTY_INSERTION_POINT; 514 } 515 return state.blockInserterPanel; 516 } 517 518 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js 519 /** 520 * Returns an action object used to open/close the inserter. 521 * 522 * @param {boolean|Object} value Whether the inserter should be 523 * opened (true) or closed (false). 524 * To specify an insertion point, 525 * use an object. 526 * @param {string} value.rootClientId The root client ID to insert at. 527 * @param {number} value.insertionIndex The index to insert at. 528 * 529 * @example 530 * ```js 531 * import { useState } from 'react'; 532 * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets'; 533 * import { __ } from '@wordpress/i18n'; 534 * import { useDispatch } from '@wordpress/data'; 535 * import { Button } from '@wordpress/components'; 536 * 537 * const ExampleComponent = () => { 538 * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore ); 539 * const [ isOpen, setIsOpen ] = useState( false ); 540 * 541 * return ( 542 * <Button 543 * onClick={ () => { 544 * setIsInserterOpened( ! isOpen ); 545 * setIsOpen( ! isOpen ); 546 * } } 547 * > 548 * { __( 'Open/close inserter' ) } 549 * </Button> 550 * ); 551 * }; 552 * ``` 553 * 554 * @return {Object} Action object. 555 */ 556 function setIsInserterOpened(value) { 557 return { 558 type: 'SET_IS_INSERTER_OPENED', 559 value 560 }; 561 } 562 563 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/constants.js 564 /** 565 * Module Constants 566 */ 567 const STORE_NAME = 'core/customize-widgets'; 568 569 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/index.js 570 /** 571 * WordPress dependencies 572 */ 573 574 575 /** 576 * Internal dependencies 577 */ 578 579 580 581 582 583 /** 584 * Block editor data store configuration. 585 * 586 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store 587 * 588 * @type {Object} 589 */ 590 const storeConfig = { 591 reducer: reducer, 592 selectors: selectors_namespaceObject, 593 actions: actions_namespaceObject 594 }; 595 596 /** 597 * Store definition for the edit widgets namespace. 598 * 599 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 600 * 601 * @type {Object} 602 */ 603 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); 604 (0,external_wp_data_namespaceObject.register)(store); 605 606 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/index.js 607 608 /** 609 * WordPress dependencies 610 */ 611 612 613 614 615 616 617 618 /** 619 * Internal dependencies 620 */ 621 622 function Inserter({ 623 setIsOpened 624 }) { 625 const inserterTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title'); 626 const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetInsertionPoint(), []); 627 return (0,external_React_namespaceObject.createElement)("div", { 628 className: "customize-widgets-layout__inserter-panel", 629 "aria-labelledby": inserterTitleId 630 }, (0,external_React_namespaceObject.createElement)("div", { 631 className: "customize-widgets-layout__inserter-panel-header" 632 }, (0,external_React_namespaceObject.createElement)("h2", { 633 id: inserterTitleId, 634 className: "customize-widgets-layout__inserter-panel-header-title" 635 }, (0,external_wp_i18n_namespaceObject.__)('Add a block')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 636 className: "customize-widgets-layout__inserter-panel-header-close-button", 637 icon: close_small, 638 onClick: () => setIsOpened(false), 639 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Close inserter') 640 })), (0,external_React_namespaceObject.createElement)("div", { 641 className: "customize-widgets-layout__inserter-panel-content" 642 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { 643 rootClientId: insertionPoint.rootClientId, 644 __experimentalInsertionIndex: insertionPoint.insertionIndex, 645 showInserterHelpPanel: true, 646 onSelect: () => setIsOpened(false) 647 }))); 648 } 649 /* harmony default export */ const components_inserter = (Inserter); 650 651 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js 652 653 /** 654 * WordPress dependencies 655 */ 656 657 const external = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 658 xmlns: "http://www.w3.org/2000/svg", 659 viewBox: "0 0 24 24" 660 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 661 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" 662 })); 663 /* harmony default export */ const library_external = (external); 664 665 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 666 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 668 669 /** 670 * WordPress dependencies 671 */ 672 673 const moreVertical = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 674 xmlns: "http://www.w3.org/2000/svg", 675 viewBox: "0 0 24 24" 676 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 677 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 678 })); 679 /* harmony default export */ const more_vertical = (moreVertical); 680 681 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js 682 683 /** 684 * External dependencies 685 */ 686 687 688 /** 689 * WordPress dependencies 690 */ 691 692 693 694 function MoreMenuDropdown({ 695 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, 696 className, 697 /* translators: button label text should, if possible, be under 16 characters. */ 698 label = (0,external_wp_i18n_namespaceObject.__)('Options'), 699 popoverProps, 700 toggleProps, 701 children 702 }) { 703 return (0,external_React_namespaceObject.createElement)(DropdownComponent, { 704 className: classnames_default()('interface-more-menu-dropdown', className), 705 icon: more_vertical, 706 label: label, 707 popoverProps: { 708 placement: 'bottom-end', 709 ...popoverProps, 710 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps?.className) 711 }, 712 toggleProps: { 713 tooltipPosition: 'bottom', 714 ...toggleProps, 715 size: 'compact' 716 } 717 }, onClose => children(onClose)); 718 } 719 720 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js 721 722 723 724 725 726 727 728 729 730 731 ;// CONCATENATED MODULE: external ["wp","deprecated"] 732 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 733 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 734 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js 735 /** 736 * WordPress dependencies 737 */ 738 739 740 741 /** 742 * Set a default complementary area. 743 * 744 * @param {string} scope Complementary area scope. 745 * @param {string} area Area identifier. 746 * 747 * @return {Object} Action object. 748 */ 749 const setDefaultComplementaryArea = (scope, area) => ({ 750 type: 'SET_DEFAULT_COMPLEMENTARY_AREA', 751 scope, 752 area 753 }); 754 755 /** 756 * Enable the complementary area. 757 * 758 * @param {string} scope Complementary area scope. 759 * @param {string} area Area identifier. 760 */ 761 const enableComplementaryArea = (scope, area) => ({ 762 registry, 763 dispatch 764 }) => { 765 // Return early if there's no area. 766 if (!area) { 767 return; 768 } 769 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 770 if (!isComplementaryAreaVisible) { 771 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); 772 } 773 dispatch({ 774 type: 'ENABLE_COMPLEMENTARY_AREA', 775 scope, 776 area 777 }); 778 }; 779 780 /** 781 * Disable the complementary area. 782 * 783 * @param {string} scope Complementary area scope. 784 */ 785 const disableComplementaryArea = scope => ({ 786 registry 787 }) => { 788 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 789 if (isComplementaryAreaVisible) { 790 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); 791 } 792 }; 793 794 /** 795 * Pins an item. 796 * 797 * @param {string} scope Item scope. 798 * @param {string} item Item identifier. 799 * 800 * @return {Object} Action object. 801 */ 802 const pinItem = (scope, item) => ({ 803 registry 804 }) => { 805 // Return early if there's no item. 806 if (!item) { 807 return; 808 } 809 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 810 811 // The item is already pinned, there's nothing to do. 812 if (pinnedItems?.[item] === true) { 813 return; 814 } 815 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 816 ...pinnedItems, 817 [item]: true 818 }); 819 }; 820 821 /** 822 * Unpins an item. 823 * 824 * @param {string} scope Item scope. 825 * @param {string} item Item identifier. 826 */ 827 const unpinItem = (scope, item) => ({ 828 registry 829 }) => { 830 // Return early if there's no item. 831 if (!item) { 832 return; 833 } 834 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 835 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 836 ...pinnedItems, 837 [item]: false 838 }); 839 }; 840 841 /** 842 * Returns an action object used in signalling that a feature should be toggled. 843 * 844 * @param {string} scope The feature scope (e.g. core/edit-post). 845 * @param {string} featureName The feature name. 846 */ 847 function toggleFeature(scope, featureName) { 848 return function ({ 849 registry 850 }) { 851 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 852 since: '6.0', 853 alternative: `dispatch( 'core/preferences' ).toggle` 854 }); 855 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 856 }; 857 } 858 859 /** 860 * Returns an action object used in signalling that a feature should be set to 861 * a true or false value 862 * 863 * @param {string} scope The feature scope (e.g. core/edit-post). 864 * @param {string} featureName The feature name. 865 * @param {boolean} value The value to set. 866 * 867 * @return {Object} Action object. 868 */ 869 function setFeatureValue(scope, featureName, value) { 870 return function ({ 871 registry 872 }) { 873 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 874 since: '6.0', 875 alternative: `dispatch( 'core/preferences' ).set` 876 }); 877 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 878 }; 879 } 880 881 /** 882 * Returns an action object used in signalling that defaults should be set for features. 883 * 884 * @param {string} scope The feature scope (e.g. core/edit-post). 885 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 886 * 887 * @return {Object} Action object. 888 */ 889 function setFeatureDefaults(scope, defaults) { 890 return function ({ 891 registry 892 }) { 893 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 894 since: '6.0', 895 alternative: `dispatch( 'core/preferences' ).setDefaults` 896 }); 897 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 898 }; 899 } 900 901 /** 902 * Returns an action object used in signalling that the user opened a modal. 903 * 904 * @param {string} name A string that uniquely identifies the modal. 905 * 906 * @return {Object} Action object. 907 */ 908 function openModal(name) { 909 return { 910 type: 'OPEN_MODAL', 911 name 912 }; 913 } 914 915 /** 916 * Returns an action object signalling that the user closed a modal. 917 * 918 * @return {Object} Action object. 919 */ 920 function closeModal() { 921 return { 922 type: 'CLOSE_MODAL' 923 }; 924 } 925 926 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js 927 /** 928 * WordPress dependencies 929 */ 930 931 932 933 934 /** 935 * Returns the complementary area that is active in a given scope. 936 * 937 * @param {Object} state Global application state. 938 * @param {string} scope Item scope. 939 * 940 * @return {string | null | undefined} The complementary area that is active in the given scope. 941 */ 942 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 943 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 944 945 // Return `undefined` to indicate that the user has never toggled 946 // visibility, this is the vanilla default. Other code relies on this 947 // nuance in the return value. 948 if (isComplementaryAreaVisible === undefined) { 949 return undefined; 950 } 951 952 // Return `null` to indicate the user hid the complementary area. 953 if (isComplementaryAreaVisible === false) { 954 return null; 955 } 956 return state?.complementaryAreas?.[scope]; 957 }); 958 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 959 const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 960 const identifier = state?.complementaryAreas?.[scope]; 961 return isVisible && identifier === undefined; 962 }); 963 964 /** 965 * Returns a boolean indicating if an item is pinned or not. 966 * 967 * @param {Object} state Global application state. 968 * @param {string} scope Scope. 969 * @param {string} item Item to check. 970 * 971 * @return {boolean} True if the item is pinned and false otherwise. 972 */ 973 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 974 var _pinnedItems$item; 975 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 976 return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 977 }); 978 979 /** 980 * Returns a boolean indicating whether a feature is active for a particular 981 * scope. 982 * 983 * @param {Object} state The store state. 984 * @param {string} scope The scope of the feature (e.g. core/edit-post). 985 * @param {string} featureName The name of the feature. 986 * 987 * @return {boolean} Is the feature enabled? 988 */ 989 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 990 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 991 since: '6.0', 992 alternative: `select( 'core/preferences' ).get( scope, featureName )` 993 }); 994 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 995 }); 996 997 /** 998 * Returns true if a modal is active, or false otherwise. 999 * 1000 * @param {Object} state Global application state. 1001 * @param {string} modalName A string that uniquely identifies the modal. 1002 * 1003 * @return {boolean} Whether the modal is active. 1004 */ 1005 function isModalActive(state, modalName) { 1006 return state.activeModal === modalName; 1007 } 1008 1009 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js 1010 /** 1011 * WordPress dependencies 1012 */ 1013 1014 function complementaryAreas(state = {}, action) { 1015 switch (action.type) { 1016 case 'SET_DEFAULT_COMPLEMENTARY_AREA': 1017 { 1018 const { 1019 scope, 1020 area 1021 } = action; 1022 1023 // If there's already an area, don't overwrite it. 1024 if (state[scope]) { 1025 return state; 1026 } 1027 return { 1028 ...state, 1029 [scope]: area 1030 }; 1031 } 1032 case 'ENABLE_COMPLEMENTARY_AREA': 1033 { 1034 const { 1035 scope, 1036 area 1037 } = action; 1038 return { 1039 ...state, 1040 [scope]: area 1041 }; 1042 } 1043 } 1044 return state; 1045 } 1046 1047 /** 1048 * Reducer for storing the name of the open modal, or null if no modal is open. 1049 * 1050 * @param {Object} state Previous state. 1051 * @param {Object} action Action object containing the `name` of the modal 1052 * 1053 * @return {Object} Updated state 1054 */ 1055 function activeModal(state = null, action) { 1056 switch (action.type) { 1057 case 'OPEN_MODAL': 1058 return action.name; 1059 case 'CLOSE_MODAL': 1060 return null; 1061 } 1062 return state; 1063 } 1064 /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 1065 complementaryAreas, 1066 activeModal 1067 })); 1068 1069 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js 1070 /** 1071 * The identifier for the data store. 1072 * 1073 * @type {string} 1074 */ 1075 const constants_STORE_NAME = 'core/interface'; 1076 1077 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js 1078 /** 1079 * WordPress dependencies 1080 */ 1081 1082 1083 /** 1084 * Internal dependencies 1085 */ 1086 1087 1088 1089 1090 1091 /** 1092 * Store definition for the interface namespace. 1093 * 1094 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 1095 * 1096 * @type {Object} 1097 */ 1098 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 1099 reducer: store_reducer, 1100 actions: store_actions_namespaceObject, 1101 selectors: store_selectors_namespaceObject 1102 }); 1103 1104 // Once we build a more generic persistence plugin that works across types of stores 1105 // we'd be able to replace this with a register call. 1106 (0,external_wp_data_namespaceObject.register)(store_store); 1107 1108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js 1109 1110 1111 1112 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.js 1113 /** 1114 * WordPress dependencies 1115 */ 1116 1117 const textFormattingShortcuts = [{ 1118 keyCombination: { 1119 modifier: 'primary', 1120 character: 'b' 1121 }, 1122 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') 1123 }, { 1124 keyCombination: { 1125 modifier: 'primary', 1126 character: 'i' 1127 }, 1128 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') 1129 }, { 1130 keyCombination: { 1131 modifier: 'primary', 1132 character: 'k' 1133 }, 1134 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') 1135 }, { 1136 keyCombination: { 1137 modifier: 'primaryShift', 1138 character: 'k' 1139 }, 1140 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') 1141 }, { 1142 keyCombination: { 1143 character: '[[' 1144 }, 1145 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') 1146 }, { 1147 keyCombination: { 1148 modifier: 'primary', 1149 character: 'u' 1150 }, 1151 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') 1152 }, { 1153 keyCombination: { 1154 modifier: 'access', 1155 character: 'd' 1156 }, 1157 description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') 1158 }, { 1159 keyCombination: { 1160 modifier: 'access', 1161 character: 'x' 1162 }, 1163 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') 1164 }, { 1165 keyCombination: { 1166 modifier: 'access', 1167 character: '0' 1168 }, 1169 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') 1170 }, { 1171 keyCombination: { 1172 modifier: 'access', 1173 character: '1-6' 1174 }, 1175 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') 1176 }]; 1177 1178 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js 1179 1180 /** 1181 * WordPress dependencies 1182 */ 1183 1184 1185 function KeyCombination({ 1186 keyCombination, 1187 forceAriaLabel 1188 }) { 1189 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; 1190 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; 1191 return (0,external_React_namespaceObject.createElement)("kbd", { 1192 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", 1193 "aria-label": forceAriaLabel || ariaLabel 1194 }, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { 1195 if (character === '+') { 1196 return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { 1197 key: index 1198 }, character); 1199 } 1200 return (0,external_React_namespaceObject.createElement)("kbd", { 1201 key: index, 1202 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key" 1203 }, character); 1204 })); 1205 } 1206 function Shortcut({ 1207 description, 1208 keyCombination, 1209 aliases = [], 1210 ariaLabel 1211 }) { 1212 return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { 1213 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description" 1214 }, description), (0,external_React_namespaceObject.createElement)("div", { 1215 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term" 1216 }, (0,external_React_namespaceObject.createElement)(KeyCombination, { 1217 keyCombination: keyCombination, 1218 forceAriaLabel: ariaLabel 1219 }), aliases.map((alias, index) => (0,external_React_namespaceObject.createElement)(KeyCombination, { 1220 keyCombination: alias, 1221 forceAriaLabel: ariaLabel, 1222 key: index 1223 })))); 1224 } 1225 /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); 1226 1227 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 1228 1229 /** 1230 * WordPress dependencies 1231 */ 1232 1233 1234 1235 /** 1236 * Internal dependencies 1237 */ 1238 1239 function DynamicShortcut({ 1240 name 1241 }) { 1242 const { 1243 keyCombination, 1244 description, 1245 aliases 1246 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 1247 const { 1248 getShortcutKeyCombination, 1249 getShortcutDescription, 1250 getShortcutAliases 1251 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 1252 return { 1253 keyCombination: getShortcutKeyCombination(name), 1254 aliases: getShortcutAliases(name), 1255 description: getShortcutDescription(name) 1256 }; 1257 }, [name]); 1258 if (!keyCombination) { 1259 return null; 1260 } 1261 return (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { 1262 keyCombination: keyCombination, 1263 description: description, 1264 aliases: aliases 1265 }); 1266 } 1267 /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); 1268 1269 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.js 1270 1271 /** 1272 * External dependencies 1273 */ 1274 1275 1276 /** 1277 * WordPress dependencies 1278 */ 1279 1280 1281 1282 1283 1284 /** 1285 * Internal dependencies 1286 */ 1287 1288 1289 1290 const ShortcutList = ({ 1291 shortcuts 1292 }) => 1293 /* 1294 * Disable reason: The `list` ARIA role is redundant but 1295 * Safari+VoiceOver won't announce the list otherwise. 1296 */ 1297 /* eslint-disable jsx-a11y/no-redundant-roles */ 1298 (0,external_React_namespaceObject.createElement)("ul", { 1299 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list", 1300 role: "list" 1301 }, shortcuts.map((shortcut, index) => (0,external_React_namespaceObject.createElement)("li", { 1302 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut", 1303 key: index 1304 }, typeof shortcut === 'string' ? (0,external_React_namespaceObject.createElement)(dynamic_shortcut, { 1305 name: shortcut 1306 }) : (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { 1307 ...shortcut 1308 })))) 1309 /* eslint-enable jsx-a11y/no-redundant-roles */; 1310 const ShortcutSection = ({ 1311 title, 1312 shortcuts, 1313 className 1314 }) => (0,external_React_namespaceObject.createElement)("section", { 1315 className: classnames_default()('customize-widgets-keyboard-shortcut-help-modal__section', className) 1316 }, !!title && (0,external_React_namespaceObject.createElement)("h2", { 1317 className: "customize-widgets-keyboard-shortcut-help-modal__section-title" 1318 }, title), (0,external_React_namespaceObject.createElement)(ShortcutList, { 1319 shortcuts: shortcuts 1320 })); 1321 const ShortcutCategorySection = ({ 1322 title, 1323 categoryName, 1324 additionalShortcuts = [] 1325 }) => { 1326 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { 1327 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); 1328 }, [categoryName]); 1329 return (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1330 title: title, 1331 shortcuts: categoryShortcuts.concat(additionalShortcuts) 1332 }); 1333 }; 1334 function KeyboardShortcutHelpModal({ 1335 isModalActive, 1336 toggleModal 1337 }) { 1338 const { 1339 registerShortcut 1340 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 1341 registerShortcut({ 1342 name: 'core/customize-widgets/keyboard-shortcuts', 1343 category: 'main', 1344 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 1345 keyCombination: { 1346 modifier: 'access', 1347 character: 'h' 1348 } 1349 }); 1350 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal); 1351 if (!isModalActive) { 1352 return null; 1353 } 1354 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 1355 className: "customize-widgets-keyboard-shortcut-help-modal", 1356 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 1357 onRequestClose: toggleModal 1358 }, (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1359 className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts", 1360 shortcuts: ['core/customize-widgets/keyboard-shortcuts'] 1361 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1362 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), 1363 categoryName: "global" 1364 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1365 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), 1366 categoryName: "selection" 1367 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1368 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), 1369 categoryName: "block", 1370 additionalShortcuts: [{ 1371 keyCombination: { 1372 character: '/' 1373 }, 1374 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), 1375 /* translators: The forward-slash character. e.g. '/'. */ 1376 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') 1377 }] 1378 }), (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1379 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), 1380 shortcuts: textFormattingShortcuts 1381 })); 1382 } 1383 1384 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/more-menu/index.js 1385 1386 /** 1387 * WordPress dependencies 1388 */ 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 /** 1399 * Internal dependencies 1400 */ 1401 1402 function MoreMenu() { 1403 const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); 1404 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); 1405 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal); 1406 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(MoreMenuDropdown, { 1407 as: external_wp_components_namespaceObject.ToolbarDropdownMenu 1408 }, () => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 1409 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') 1410 }, (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 1411 scope: "core/customize-widgets", 1412 name: "fixedToolbar", 1413 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 1414 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), 1415 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), 1416 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') 1417 })), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 1418 label: (0,external_wp_i18n_namespaceObject.__)('Tools') 1419 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 1420 onClick: () => { 1421 setIsKeyboardShortcutsModalVisible(true); 1422 }, 1423 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') 1424 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 1425 scope: "core/customize-widgets", 1426 name: "welcomeGuide", 1427 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 1428 }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 1429 role: "menuitem", 1430 icon: library_external, 1431 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/block-based-widgets-editor/'), 1432 target: "_blank", 1433 rel: "noopener noreferrer" 1434 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 1435 as: "span" 1436 }, /* translators: accessibility text */ 1437 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 1438 label: (0,external_wp_i18n_namespaceObject.__)('Preferences') 1439 }, (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 1440 scope: "core/customize-widgets", 1441 name: "keepCaretInsideBlock", 1442 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'), 1443 info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), 1444 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'), 1445 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated') 1446 })))), (0,external_React_namespaceObject.createElement)(KeyboardShortcutHelpModal, { 1447 isModalActive: isKeyboardShortcutsModalActive, 1448 toggleModal: toggleKeyboardShortcutsModal 1449 })); 1450 } 1451 1452 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/header/index.js 1453 1454 /** 1455 * External dependencies 1456 */ 1457 1458 1459 /** 1460 * WordPress dependencies 1461 */ 1462 1463 1464 1465 1466 1467 1468 1469 /** 1470 * Internal dependencies 1471 */ 1472 1473 1474 function Header({ 1475 sidebar, 1476 inserter, 1477 isInserterOpened, 1478 setIsInserterOpened, 1479 isFixedToolbarActive 1480 }) { 1481 const [[hasUndo, hasRedo], setUndoRedo] = (0,external_wp_element_namespaceObject.useState)([sidebar.hasUndo(), sidebar.hasRedo()]); 1482 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); 1483 (0,external_wp_element_namespaceObject.useEffect)(() => { 1484 return sidebar.subscribeHistory(() => { 1485 setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]); 1486 }); 1487 }, [sidebar]); 1488 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { 1489 className: classnames_default()('customize-widgets-header', { 1490 'is-fixed-toolbar-active': isFixedToolbarActive 1491 }) 1492 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { 1493 className: "customize-widgets-header-toolbar", 1494 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools') 1495 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { 1496 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo 1497 /* translators: button label text should, if possible, be under 16 characters. */, 1498 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 1499 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') 1500 // If there are no undo levels we don't want to actually disable this 1501 // button, because it will remove focus for keyboard users. 1502 // See: https://github.com/WordPress/gutenberg/issues/3486 1503 , 1504 "aria-disabled": !hasUndo, 1505 onClick: sidebar.undo, 1506 className: "customize-widgets-editor-history-button undo-button" 1507 }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { 1508 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo 1509 /* translators: button label text should, if possible, be under 16 characters. */, 1510 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 1511 shortcut: shortcut 1512 // If there are no undo levels we don't want to actually disable this 1513 // button, because it will remove focus for keyboard users. 1514 // See: https://github.com/WordPress/gutenberg/issues/3486 1515 , 1516 "aria-disabled": !hasRedo, 1517 onClick: sidebar.redo, 1518 className: "customize-widgets-editor-history-button redo-button" 1519 }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { 1520 className: "customize-widgets-header-toolbar__inserter-toggle", 1521 isPressed: isInserterOpened, 1522 variant: "primary", 1523 icon: library_plus, 1524 label: (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'), 1525 onClick: () => { 1526 setIsInserterOpened(isOpen => !isOpen); 1527 } 1528 }), (0,external_React_namespaceObject.createElement)(MoreMenu, null))), (0,external_wp_element_namespaceObject.createPortal)((0,external_React_namespaceObject.createElement)(components_inserter, { 1529 setIsOpened: setIsInserterOpened 1530 }), inserter.contentContainer[0])); 1531 } 1532 /* harmony default export */ const header = (Header); 1533 1534 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/use-inserter.js 1535 /** 1536 * WordPress dependencies 1537 */ 1538 1539 1540 1541 /** 1542 * Internal dependencies 1543 */ 1544 1545 function useInserter(inserter) { 1546 const isInserterOpened = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInserterOpened(), []); 1547 const { 1548 setIsInserterOpened 1549 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 1550 (0,external_wp_element_namespaceObject.useEffect)(() => { 1551 if (isInserterOpened) { 1552 inserter.open(); 1553 } else { 1554 inserter.close(); 1555 } 1556 }, [inserter, isInserterOpened]); 1557 return [isInserterOpened, (0,external_wp_element_namespaceObject.useCallback)(updater => { 1558 let isOpen = updater; 1559 if (typeof updater === 'function') { 1560 isOpen = updater((0,external_wp_data_namespaceObject.select)(store).isInserterOpened()); 1561 } 1562 setIsInserterOpened(isOpen); 1563 }, [setIsInserterOpened])]; 1564 } 1565 1566 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js 1567 var es6 = __webpack_require__(7734); 1568 var es6_default = /*#__PURE__*/__webpack_require__.n(es6); 1569 ;// CONCATENATED MODULE: external ["wp","isShallowEqual"] 1570 const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; 1571 var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); 1572 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/utils.js 1573 // @ts-check 1574 /** 1575 * WordPress dependencies 1576 */ 1577 1578 1579 1580 /** 1581 * Convert settingId to widgetId. 1582 * 1583 * @param {string} settingId The setting id. 1584 * @return {string} The widget id. 1585 */ 1586 function settingIdToWidgetId(settingId) { 1587 const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/); 1588 if (matches) { 1589 const idBase = matches[1]; 1590 const number = parseInt(matches[2], 10); 1591 return `$idBase}-$number}`; 1592 } 1593 return settingId; 1594 } 1595 1596 /** 1597 * Transform a block to a customizable widget. 1598 * 1599 * @param {WPBlock} block The block to be transformed from. 1600 * @param {Object} existingWidget The widget to be extended from. 1601 * @return {Object} The transformed widget. 1602 */ 1603 function blockToWidget(block, existingWidget = null) { 1604 let widget; 1605 const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance); 1606 if (isValidLegacyWidgetBlock) { 1607 if (block.attributes.id) { 1608 // Widget that does not extend WP_Widget. 1609 widget = { 1610 id: block.attributes.id 1611 }; 1612 } else { 1613 const { 1614 encoded, 1615 hash, 1616 raw, 1617 ...rest 1618 } = block.attributes.instance; 1619 1620 // Widget that extends WP_Widget. 1621 widget = { 1622 idBase: block.attributes.idBase, 1623 instance: { 1624 ...existingWidget?.instance, 1625 // Required only for the customizer. 1626 is_widget_customizer_js_value: true, 1627 encoded_serialized_instance: encoded, 1628 instance_hash_key: hash, 1629 raw_instance: raw, 1630 ...rest 1631 } 1632 }; 1633 } 1634 } else { 1635 const instance = { 1636 content: (0,external_wp_blocks_namespaceObject.serialize)(block) 1637 }; 1638 widget = { 1639 idBase: 'block', 1640 widgetClass: 'WP_Widget_Block', 1641 instance: { 1642 raw_instance: instance 1643 } 1644 }; 1645 } 1646 const { 1647 form, 1648 rendered, 1649 ...restExistingWidget 1650 } = existingWidget || {}; 1651 return { 1652 ...restExistingWidget, 1653 ...widget 1654 }; 1655 } 1656 1657 /** 1658 * Transform a widget to a block. 1659 * 1660 * @param {Object} widget The widget to be transformed from. 1661 * @param {string} widget.id The widget id. 1662 * @param {string} widget.idBase The id base of the widget. 1663 * @param {number} widget.number The number/index of the widget. 1664 * @param {Object} widget.instance The instance of the widget. 1665 * @return {WPBlock} The transformed block. 1666 */ 1667 function widgetToBlock({ 1668 id, 1669 idBase, 1670 number, 1671 instance 1672 }) { 1673 let block; 1674 const { 1675 encoded_serialized_instance: encoded, 1676 instance_hash_key: hash, 1677 raw_instance: raw, 1678 ...rest 1679 } = instance; 1680 if (idBase === 'block') { 1681 var _raw$content; 1682 const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)((_raw$content = raw.content) !== null && _raw$content !== void 0 ? _raw$content : '', { 1683 __unstableSkipAutop: true 1684 }); 1685 block = parsedBlocks.length ? parsedBlocks[0] : (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}); 1686 } else if (number) { 1687 // Widget that extends WP_Widget. 1688 block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', { 1689 idBase, 1690 instance: { 1691 encoded, 1692 hash, 1693 raw, 1694 ...rest 1695 } 1696 }); 1697 } else { 1698 // Widget that does not extend WP_Widget. 1699 block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', { 1700 id 1701 }); 1702 } 1703 return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(block, id); 1704 } 1705 1706 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js 1707 /** 1708 * External dependencies 1709 */ 1710 1711 1712 /** 1713 * WordPress dependencies 1714 */ 1715 1716 1717 1718 1719 /** 1720 * Internal dependencies 1721 */ 1722 1723 function widgetsToBlocks(widgets) { 1724 return widgets.map(widget => widgetToBlock(widget)); 1725 } 1726 function useSidebarBlockEditor(sidebar) { 1727 const [blocks, setBlocks] = (0,external_wp_element_namespaceObject.useState)(() => widgetsToBlocks(sidebar.getWidgets())); 1728 (0,external_wp_element_namespaceObject.useEffect)(() => { 1729 return sidebar.subscribe((prevWidgets, nextWidgets) => { 1730 setBlocks(prevBlocks => { 1731 const prevWidgetsMap = new Map(prevWidgets.map(widget => [widget.id, widget])); 1732 const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block])); 1733 const nextBlocks = nextWidgets.map(nextWidget => { 1734 const prevWidget = prevWidgetsMap.get(nextWidget.id); 1735 1736 // Bail out updates. 1737 if (prevWidget && prevWidget === nextWidget) { 1738 return prevBlocksMap.get(nextWidget.id); 1739 } 1740 return widgetToBlock(nextWidget); 1741 }); 1742 1743 // Bail out updates. 1744 if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) { 1745 return prevBlocks; 1746 } 1747 return nextBlocks; 1748 }); 1749 }); 1750 }, [sidebar]); 1751 const onChangeBlocks = (0,external_wp_element_namespaceObject.useCallback)(nextBlocks => { 1752 setBlocks(prevBlocks => { 1753 if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) { 1754 return prevBlocks; 1755 } 1756 const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block])); 1757 const nextWidgets = nextBlocks.map(nextBlock => { 1758 const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(nextBlock); 1759 1760 // Update existing widgets. 1761 if (widgetId && prevBlocksMap.has(widgetId)) { 1762 const prevBlock = prevBlocksMap.get(widgetId); 1763 const prevWidget = sidebar.getWidget(widgetId); 1764 1765 // Bail out updates by returning the previous widgets. 1766 // Deep equality is necessary until the block editor's internals changes. 1767 if (es6_default()(nextBlock, prevBlock) && prevWidget) { 1768 return prevWidget; 1769 } 1770 return blockToWidget(nextBlock, prevWidget); 1771 } 1772 1773 // Add a new widget. 1774 return blockToWidget(nextBlock); 1775 }); 1776 1777 // Bail out updates if the updated widgets are the same. 1778 if (external_wp_isShallowEqual_default()(sidebar.getWidgets(), nextWidgets)) { 1779 return prevBlocks; 1780 } 1781 const addedWidgetIds = sidebar.setWidgets(nextWidgets); 1782 return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => { 1783 const addedWidgetId = addedWidgetIds[index]; 1784 if (addedWidgetId !== null) { 1785 // Only create a new instance if necessary to prevent 1786 // the whole editor from re-rendering on every edit. 1787 if (updatedNextBlocks === nextBlocks) { 1788 updatedNextBlocks = nextBlocks.slice(); 1789 } 1790 updatedNextBlocks[index] = (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(nextBlock, addedWidgetId); 1791 } 1792 return updatedNextBlocks; 1793 }, nextBlocks); 1794 }); 1795 }, [sidebar]); 1796 return [blocks, onChangeBlocks, onChangeBlocks]; 1797 } 1798 1799 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/index.js 1800 1801 /** 1802 * WordPress dependencies 1803 */ 1804 1805 1806 /** 1807 * Internal dependencies 1808 */ 1809 1810 const FocusControlContext = (0,external_wp_element_namespaceObject.createContext)(); 1811 function FocusControl({ 1812 api, 1813 sidebarControls, 1814 children 1815 }) { 1816 const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0,external_wp_element_namespaceObject.useState)({ 1817 current: null 1818 }); 1819 const focusWidget = (0,external_wp_element_namespaceObject.useCallback)(widgetId => { 1820 for (const sidebarControl of sidebarControls) { 1821 const widgets = sidebarControl.setting.get(); 1822 if (widgets.includes(widgetId)) { 1823 sidebarControl.sectionInstance.expand({ 1824 // Schedule it after the complete callback so that 1825 // it won't be overridden by the "Back" button focus. 1826 completeCallback() { 1827 // Create a "ref-like" object every time to ensure 1828 // the same widget id can also triggers the focus control. 1829 setFocusedWidgetIdRef({ 1830 current: widgetId 1831 }); 1832 } 1833 }); 1834 break; 1835 } 1836 } 1837 }, [sidebarControls]); 1838 (0,external_wp_element_namespaceObject.useEffect)(() => { 1839 function handleFocus(settingId) { 1840 const widgetId = settingIdToWidgetId(settingId); 1841 focusWidget(widgetId); 1842 } 1843 let previewBound = false; 1844 function handleReady() { 1845 api.previewer.preview.bind('focus-control-for-setting', handleFocus); 1846 previewBound = true; 1847 } 1848 api.previewer.bind('ready', handleReady); 1849 return () => { 1850 api.previewer.unbind('ready', handleReady); 1851 if (previewBound) { 1852 api.previewer.preview.unbind('focus-control-for-setting', handleFocus); 1853 } 1854 }; 1855 }, [api, focusWidget]); 1856 const context = (0,external_wp_element_namespaceObject.useMemo)(() => [focusedWidgetIdRef, focusWidget], [focusedWidgetIdRef, focusWidget]); 1857 return (0,external_React_namespaceObject.createElement)(FocusControlContext.Provider, { 1858 value: context 1859 }, children); 1860 } 1861 const useFocusControl = () => (0,external_wp_element_namespaceObject.useContext)(FocusControlContext); 1862 1863 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.js 1864 /** 1865 * WordPress dependencies 1866 */ 1867 1868 1869 1870 1871 1872 /** 1873 * Internal dependencies 1874 */ 1875 1876 function useBlocksFocusControl(blocks) { 1877 const { 1878 selectBlock 1879 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 1880 const [focusedWidgetIdRef] = useFocusControl(); 1881 const blocksRef = (0,external_wp_element_namespaceObject.useRef)(blocks); 1882 (0,external_wp_element_namespaceObject.useEffect)(() => { 1883 blocksRef.current = blocks; 1884 }, [blocks]); 1885 (0,external_wp_element_namespaceObject.useEffect)(() => { 1886 if (focusedWidgetIdRef.current) { 1887 const focusedBlock = blocksRef.current.find(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current); 1888 if (focusedBlock) { 1889 selectBlock(focusedBlock.clientId); 1890 // If the block is already being selected, the DOM node won't 1891 // get focused again automatically. 1892 // We select the DOM and focus it manually here. 1893 const blockNode = document.querySelector(`[data-block="$focusedBlock.clientId}"]`); 1894 blockNode?.focus(); 1895 } 1896 } 1897 }, [focusedWidgetIdRef, selectBlock]); 1898 } 1899 1900 ;// CONCATENATED MODULE: external ["wp","privateApis"] 1901 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 1902 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/lock-unlock.js 1903 /** 1904 * WordPress dependencies 1905 */ 1906 1907 const { 1908 lock, 1909 unlock 1910 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/customize-widgets'); 1911 1912 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.js 1913 1914 /** 1915 * WordPress dependencies 1916 */ 1917 1918 1919 /** 1920 * Internal dependencies 1921 */ 1922 1923 1924 1925 const { 1926 ExperimentalBlockEditorProvider 1927 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 1928 function SidebarEditorProvider({ 1929 sidebar, 1930 settings, 1931 children 1932 }) { 1933 const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar); 1934 useBlocksFocusControl(blocks); 1935 return (0,external_React_namespaceObject.createElement)(ExperimentalBlockEditorProvider, { 1936 value: blocks, 1937 onInput: onInput, 1938 onChange: onChange, 1939 settings: settings, 1940 useSubRegistry: false 1941 }, children); 1942 } 1943 1944 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/welcome-guide/index.js 1945 1946 /** 1947 * WordPress dependencies 1948 */ 1949 1950 1951 1952 1953 function WelcomeGuide({ 1954 sidebar 1955 }) { 1956 const { 1957 toggle 1958 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 1959 const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-')); 1960 return (0,external_React_namespaceObject.createElement)("div", { 1961 className: "customize-widgets-welcome-guide" 1962 }, (0,external_React_namespaceObject.createElement)("div", { 1963 className: "customize-widgets-welcome-guide__image__wrapper" 1964 }, (0,external_React_namespaceObject.createElement)("picture", null, (0,external_React_namespaceObject.createElement)("source", { 1965 srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg", 1966 media: "(prefers-reduced-motion: reduce)" 1967 }), (0,external_React_namespaceObject.createElement)("img", { 1968 className: "customize-widgets-welcome-guide__image", 1969 src: "https://s.w.org/images/block-editor/welcome-editor.gif", 1970 width: "312", 1971 height: "240", 1972 alt: "" 1973 }))), (0,external_React_namespaceObject.createElement)("h1", { 1974 className: "customize-widgets-welcome-guide__heading" 1975 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), (0,external_React_namespaceObject.createElement)("p", { 1976 className: "customize-widgets-welcome-guide__text" 1977 }, isEntirelyBlockWidgets ? (0,external_wp_i18n_namespaceObject.__)('Your theme provides 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.') : (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 1978 className: "customize-widgets-welcome-guide__button", 1979 variant: "primary", 1980 onClick: () => toggle('core/customize-widgets', 'welcomeGuide') 1981 }, (0,external_wp_i18n_namespaceObject.__)('Got it')), (0,external_React_namespaceObject.createElement)("hr", { 1982 className: "customize-widgets-welcome-guide__separator" 1983 }), !isEntirelyBlockWidgets && (0,external_React_namespaceObject.createElement)("p", { 1984 className: "customize-widgets-welcome-guide__more-info" 1985 }, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 1986 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/') 1987 }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.'))), (0,external_React_namespaceObject.createElement)("p", { 1988 className: "customize-widgets-welcome-guide__more-info" 1989 }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor?'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 1990 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/') 1991 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.")))); 1992 } 1993 1994 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/keyboard-shortcuts/index.js 1995 /** 1996 * WordPress dependencies 1997 */ 1998 1999 2000 2001 2002 2003 2004 2005 function KeyboardShortcuts({ 2006 undo, 2007 redo, 2008 save 2009 }) { 2010 const { 2011 replaceBlocks 2012 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 2013 const { 2014 getBlockName, 2015 getSelectedBlockClientId, 2016 getBlockAttributes 2017 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 2018 const handleTextLevelShortcut = (event, level) => { 2019 event.preventDefault(); 2020 const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading'; 2021 const currentClientId = getSelectedBlockClientId(); 2022 if (currentClientId === null) { 2023 return; 2024 } 2025 const blockName = getBlockName(currentClientId); 2026 if (blockName !== 'core/paragraph' && blockName !== 'core/heading') { 2027 return; 2028 } 2029 const attributes = getBlockAttributes(currentClientId); 2030 const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign'; 2031 const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign'; 2032 replaceBlocks(currentClientId, (0,external_wp_blocks_namespaceObject.createBlock)(destinationBlockName, { 2033 level, 2034 content: attributes.content, 2035 ...{ 2036 [destinationTextAlign]: attributes[textAlign] 2037 } 2038 })); 2039 }; 2040 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/undo', event => { 2041 undo(); 2042 event.preventDefault(); 2043 }); 2044 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/redo', event => { 2045 redo(); 2046 event.preventDefault(); 2047 }); 2048 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/save', event => { 2049 event.preventDefault(); 2050 save(); 2051 }); 2052 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0)); 2053 [1, 2, 3, 4, 5, 6].forEach(level => { 2054 //the loop is based off on a constant therefore 2055 //the hook will execute the same way every time 2056 //eslint-disable-next-line react-hooks/rules-of-hooks 2057 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)(`core/customize-widgets/transform-paragraph-to-heading-$level}`, event => handleTextLevelShortcut(event, level)); 2058 }); 2059 return null; 2060 } 2061 function KeyboardShortcutsRegister() { 2062 const { 2063 registerShortcut, 2064 unregisterShortcut 2065 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 2066 (0,external_wp_element_namespaceObject.useEffect)(() => { 2067 registerShortcut({ 2068 name: 'core/customize-widgets/undo', 2069 category: 'global', 2070 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 2071 keyCombination: { 2072 modifier: 'primary', 2073 character: 'z' 2074 } 2075 }); 2076 registerShortcut({ 2077 name: 'core/customize-widgets/redo', 2078 category: 'global', 2079 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 2080 keyCombination: { 2081 modifier: 'primaryShift', 2082 character: 'z' 2083 }, 2084 // Disable on Apple OS because it conflicts with the browser's 2085 // history shortcut. It's a fine alias for both Windows and Linux. 2086 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 2087 // Linux, we keep it as the default for consistency. 2088 aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ 2089 modifier: 'primary', 2090 character: 'y' 2091 }] 2092 }); 2093 registerShortcut({ 2094 name: 'core/customize-widgets/save', 2095 category: 'global', 2096 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 2097 keyCombination: { 2098 modifier: 'primary', 2099 character: 's' 2100 } 2101 }); 2102 registerShortcut({ 2103 name: 'core/customize-widgets/transform-heading-to-paragraph', 2104 category: 'block-library', 2105 description: (0,external_wp_i18n_namespaceObject.__)('Transform heading to paragraph.'), 2106 keyCombination: { 2107 modifier: 'access', 2108 character: `0` 2109 } 2110 }); 2111 [1, 2, 3, 4, 5, 6].forEach(level => { 2112 registerShortcut({ 2113 name: `core/customize-widgets/transform-paragraph-to-heading-$level}`, 2114 category: 'block-library', 2115 description: (0,external_wp_i18n_namespaceObject.__)('Transform paragraph to heading.'), 2116 keyCombination: { 2117 modifier: 'access', 2118 character: `$level}` 2119 } 2120 }); 2121 }); 2122 return () => { 2123 unregisterShortcut('core/customize-widgets/undo'); 2124 unregisterShortcut('core/customize-widgets/redo'); 2125 unregisterShortcut('core/customize-widgets/save'); 2126 }; 2127 }, [registerShortcut]); 2128 return null; 2129 } 2130 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 2131 /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); 2132 2133 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-appender/index.js 2134 2135 /** 2136 * WordPress dependencies 2137 */ 2138 2139 2140 2141 function BlockAppender(props) { 2142 const ref = (0,external_wp_element_namespaceObject.useRef)(); 2143 const isBlocksListEmpty = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockCount() === 0); 2144 2145 // Move the focus to the block appender to prevent focus from 2146 // being lost when emptying the widget area. 2147 (0,external_wp_element_namespaceObject.useEffect)(() => { 2148 if (isBlocksListEmpty && ref.current) { 2149 const { 2150 ownerDocument 2151 } = ref.current; 2152 if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) { 2153 ref.current.focus(); 2154 } 2155 } 2156 }, [isBlocksListEmpty]); 2157 return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { 2158 ...props, 2159 ref: ref 2160 }); 2161 } 2162 2163 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/index.js 2164 2165 /** 2166 * WordPress dependencies 2167 */ 2168 2169 2170 2171 2172 2173 2174 2175 2176 /** 2177 * Internal dependencies 2178 */ 2179 2180 2181 2182 2183 2184 2185 2186 2187 const { 2188 ExperimentalBlockCanvas: BlockCanvas 2189 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 2190 function SidebarBlockEditor({ 2191 blockEditorSettings, 2192 sidebar, 2193 inserter, 2194 inspector 2195 }) { 2196 const [isInserterOpened, setIsInserterOpened] = useInserter(inserter); 2197 const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); 2198 const { 2199 hasUploadPermissions, 2200 isFixedToolbarActive, 2201 keepCaretInsideBlock, 2202 isWelcomeGuideActive 2203 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2204 var _select$canUser; 2205 const { 2206 get 2207 } = select(external_wp_preferences_namespaceObject.store); 2208 return { 2209 hasUploadPermissions: (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'media')) !== null && _select$canUser !== void 0 ? _select$canUser : true, 2210 isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'), 2211 keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'), 2212 isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide') 2213 }; 2214 }, []); 2215 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 2216 let mediaUploadBlockEditor; 2217 if (hasUploadPermissions) { 2218 mediaUploadBlockEditor = ({ 2219 onError, 2220 ...argumentsObject 2221 }) => { 2222 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 2223 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, 2224 onError: ({ 2225 message 2226 }) => onError(message), 2227 ...argumentsObject 2228 }); 2229 }; 2230 } 2231 return { 2232 ...blockEditorSettings, 2233 __experimentalSetIsInserterOpened: setIsInserterOpened, 2234 mediaUpload: mediaUploadBlockEditor, 2235 hasFixedToolbar: isFixedToolbarActive || !isMediumViewport, 2236 keepCaretInsideBlock, 2237 __unstableHasCustomAppender: true 2238 }; 2239 }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, isMediumViewport, keepCaretInsideBlock, setIsInserterOpened]); 2240 if (isWelcomeGuideActive) { 2241 return (0,external_React_namespaceObject.createElement)(WelcomeGuide, { 2242 sidebar: sidebar 2243 }); 2244 } 2245 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_React_namespaceObject.createElement)(SidebarEditorProvider, { 2246 sidebar: sidebar, 2247 settings: settings 2248 }, (0,external_React_namespaceObject.createElement)(keyboard_shortcuts, { 2249 undo: sidebar.undo, 2250 redo: sidebar.redo, 2251 save: sidebar.save 2252 }), (0,external_React_namespaceObject.createElement)(header, { 2253 sidebar: sidebar, 2254 inserter: inserter, 2255 isInserterOpened: isInserterOpened, 2256 setIsInserterOpened: setIsInserterOpened, 2257 isFixedToolbarActive: isFixedToolbarActive || !isMediumViewport 2258 }), (isFixedToolbarActive || !isMediumViewport) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 2259 hideDragHandle: true 2260 }), (0,external_React_namespaceObject.createElement)(BlockCanvas, { 2261 shouldIframe: false, 2262 styles: settings.defaultEditorStyles, 2263 height: "100%" 2264 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { 2265 renderAppender: BlockAppender 2266 })), (0,external_wp_element_namespaceObject.createPortal)( 2267 // This is a temporary hack to prevent button component inside <BlockInspector> 2268 // from submitting form when type="button" is not specified. 2269 (0,external_React_namespaceObject.createElement)("form", { 2270 onSubmit: event => event.preventDefault() 2271 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), inspector.contentContainer[0])), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, ({ 2272 onClose 2273 }) => (0,external_React_namespaceObject.createElement)(block_inspector_button, { 2274 inspector: inspector, 2275 closeMenu: onClose 2276 }))); 2277 } 2278 2279 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-controls/index.js 2280 2281 /** 2282 * WordPress dependencies 2283 */ 2284 2285 const SidebarControlsContext = (0,external_wp_element_namespaceObject.createContext)(); 2286 function SidebarControls({ 2287 sidebarControls, 2288 activeSidebarControl, 2289 children 2290 }) { 2291 const context = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 2292 sidebarControls, 2293 activeSidebarControl 2294 }), [sidebarControls, activeSidebarControl]); 2295 return (0,external_React_namespaceObject.createElement)(SidebarControlsContext.Provider, { 2296 value: context 2297 }, children); 2298 } 2299 function useSidebarControls() { 2300 const { 2301 sidebarControls 2302 } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext); 2303 return sidebarControls; 2304 } 2305 function useActiveSidebarControl() { 2306 const { 2307 activeSidebarControl 2308 } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext); 2309 return activeSidebarControl; 2310 } 2311 2312 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.js 2313 /** 2314 * WordPress dependencies 2315 */ 2316 2317 2318 2319 2320 /** 2321 * We can't just use <BlockSelectionClearer> because the customizer has 2322 * many root nodes rather than just one in the post editor. 2323 * We need to listen to the focus events in all those roots, and also in 2324 * the preview iframe. 2325 * This hook will clear the selected block when focusing outside the editor, 2326 * with a few exceptions: 2327 * 1. Focusing on popovers. 2328 * 2. Focusing on the inspector. 2329 * 3. Focusing on any modals/dialogs. 2330 * These cases are normally triggered by user interactions from the editor, 2331 * not by explicitly focusing outside the editor, hence no need for clearing. 2332 * 2333 * @param {Object} sidebarControl The sidebar control instance. 2334 * @param {Object} popoverRef The ref object of the popover node container. 2335 */ 2336 function useClearSelectedBlock(sidebarControl, popoverRef) { 2337 const { 2338 hasSelectedBlock, 2339 hasMultiSelection 2340 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 2341 const { 2342 clearSelectedBlock 2343 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 2344 (0,external_wp_element_namespaceObject.useEffect)(() => { 2345 if (popoverRef.current && sidebarControl) { 2346 const inspector = sidebarControl.inspector; 2347 const container = sidebarControl.container[0]; 2348 const ownerDocument = container.ownerDocument; 2349 const ownerWindow = ownerDocument.defaultView; 2350 function handleClearSelectedBlock(element) { 2351 if ( 2352 // 1. Make sure there are blocks being selected. 2353 (hasSelectedBlock() || hasMultiSelection()) && 2354 // 2. The element should exist in the DOM (not deleted). 2355 element && ownerDocument.contains(element) && 2356 // 3. It should also not exist in the container, the popover, nor the dialog. 2357 !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && 2358 // 4. The inspector should not be opened. 2359 !inspector.expanded()) { 2360 clearSelectedBlock(); 2361 } 2362 } 2363 2364 // Handle mouse down in the same document. 2365 function handleMouseDown(event) { 2366 handleClearSelectedBlock(event.target); 2367 } 2368 // Handle focusing outside the current document, like to iframes. 2369 function handleBlur() { 2370 handleClearSelectedBlock(ownerDocument.activeElement); 2371 } 2372 ownerDocument.addEventListener('mousedown', handleMouseDown); 2373 ownerWindow.addEventListener('blur', handleBlur); 2374 return () => { 2375 ownerDocument.removeEventListener('mousedown', handleMouseDown); 2376 ownerWindow.removeEventListener('blur', handleBlur); 2377 }; 2378 } 2379 }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]); 2380 } 2381 2382 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/customize-widgets/index.js 2383 2384 /** 2385 * WordPress dependencies 2386 */ 2387 2388 2389 2390 /** 2391 * Internal dependencies 2392 */ 2393 2394 2395 2396 2397 2398 function CustomizeWidgets({ 2399 api, 2400 sidebarControls, 2401 blockEditorSettings 2402 }) { 2403 const [activeSidebarControl, setActiveSidebarControl] = (0,external_wp_element_namespaceObject.useState)(null); 2404 const parentContainer = document.getElementById('customize-theme-controls'); 2405 const popoverRef = (0,external_wp_element_namespaceObject.useRef)(); 2406 useClearSelectedBlock(activeSidebarControl, popoverRef); 2407 (0,external_wp_element_namespaceObject.useEffect)(() => { 2408 const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => { 2409 if (expanded) { 2410 setActiveSidebarControl(sidebarControl); 2411 } 2412 })); 2413 return () => { 2414 unsubscribers.forEach(unsubscriber => unsubscriber()); 2415 }; 2416 }, [sidebarControls]); 2417 const activeSidebar = activeSidebarControl && (0,external_wp_element_namespaceObject.createPortal)((0,external_React_namespaceObject.createElement)(ErrorBoundary, null, (0,external_React_namespaceObject.createElement)(SidebarBlockEditor, { 2418 key: activeSidebarControl.id, 2419 blockEditorSettings: blockEditorSettings, 2420 sidebar: activeSidebarControl.sidebarAdapter, 2421 inserter: activeSidebarControl.inserter, 2422 inspector: activeSidebarControl.inspector 2423 })), activeSidebarControl.container[0]); 2424 2425 // We have to portal this to the parent of both the editor and the inspector, 2426 // so that the popovers will appear above both of them. 2427 const popover = parentContainer && (0,external_wp_element_namespaceObject.createPortal)((0,external_React_namespaceObject.createElement)("div", { 2428 className: "customize-widgets-popover", 2429 ref: popoverRef 2430 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null)), parentContainer); 2431 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_React_namespaceObject.createElement)(SidebarControls, { 2432 sidebarControls: sidebarControls, 2433 activeSidebarControl: activeSidebarControl 2434 }, (0,external_React_namespaceObject.createElement)(FocusControl, { 2435 api: api, 2436 sidebarControls: sidebarControls 2437 }, activeSidebar, popover))); 2438 } 2439 2440 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/inspector-section.js 2441 function getInspectorSection() { 2442 const { 2443 wp: { 2444 customize 2445 } 2446 } = window; 2447 return class InspectorSection extends customize.Section { 2448 constructor(id, options) { 2449 super(id, options); 2450 this.parentSection = options.parentSection; 2451 this.returnFocusWhenClose = null; 2452 this._isOpen = false; 2453 } 2454 get isOpen() { 2455 return this._isOpen; 2456 } 2457 set isOpen(value) { 2458 this._isOpen = value; 2459 this.triggerActiveCallbacks(); 2460 } 2461 ready() { 2462 this.contentContainer[0].classList.add('customize-widgets-layout__inspector'); 2463 } 2464 isContextuallyActive() { 2465 return this.isOpen; 2466 } 2467 onChangeExpanded(expanded, args) { 2468 super.onChangeExpanded(expanded, args); 2469 if (this.parentSection && !args.unchanged) { 2470 if (expanded) { 2471 this.parentSection.collapse({ 2472 manualTransition: true 2473 }); 2474 } else { 2475 this.parentSection.expand({ 2476 manualTransition: true, 2477 completeCallback: () => { 2478 // Return focus after finishing the transition. 2479 if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) { 2480 this.returnFocusWhenClose.focus(); 2481 } 2482 } 2483 }); 2484 } 2485 } 2486 } 2487 open({ 2488 returnFocusWhenClose 2489 } = {}) { 2490 this.isOpen = true; 2491 this.returnFocusWhenClose = returnFocusWhenClose; 2492 this.expand({ 2493 allowMultiple: true 2494 }); 2495 } 2496 close() { 2497 this.collapse({ 2498 allowMultiple: true 2499 }); 2500 } 2501 collapse(options) { 2502 // Overridden collapse() function. Mostly call the parent collapse(), but also 2503 // move our .isOpen to false. 2504 // Initially, I tried tracking this with onChangeExpanded(), but it doesn't work 2505 // because the block settings sidebar is a layer "on top of" the G editor sidebar. 2506 // 2507 // For example, when closing the block settings sidebar, the G 2508 // editor sidebar would display, and onChangeExpanded in 2509 // inspector-section would run with expanded=true, but I want 2510 // isOpen to be false when the block settings is closed. 2511 this.isOpen = false; 2512 super.collapse(options); 2513 } 2514 triggerActiveCallbacks() { 2515 // Manually fire the callbacks associated with moving this.active 2516 // from false to true. "active" is always true for this section, 2517 // and "isContextuallyActive" reflects if the block settings 2518 // sidebar is currently visible, that is, it has replaced the main 2519 // Gutenberg view. 2520 // The WP customizer only checks ".isContextuallyActive()" when 2521 // ".active" changes values. But our ".active" never changes value. 2522 // The WP customizer never foresaw a section being used a way we 2523 // fit the block settings sidebar into a section. By manually 2524 // triggering the "this.active" callbacks, we force the WP 2525 // customizer to query our .isContextuallyActive() function and 2526 // update its view of our status. 2527 this.active.callbacks.fireWith(this.active, [false, true]); 2528 } 2529 }; 2530 } 2531 2532 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-section.js 2533 /** 2534 * WordPress dependencies 2535 */ 2536 2537 2538 /** 2539 * Internal dependencies 2540 */ 2541 2542 const getInspectorSectionId = sidebarId => `widgets-inspector-$sidebarId}`; 2543 function getSidebarSection() { 2544 const { 2545 wp: { 2546 customize 2547 } 2548 } = window; 2549 const reduceMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)'); 2550 let isReducedMotion = reduceMotionMediaQuery.matches; 2551 reduceMotionMediaQuery.addEventListener('change', event => { 2552 isReducedMotion = event.matches; 2553 }); 2554 return class SidebarSection extends customize.Section { 2555 ready() { 2556 const InspectorSection = getInspectorSection(); 2557 this.inspector = new InspectorSection(getInspectorSectionId(this.id), { 2558 title: (0,external_wp_i18n_namespaceObject.__)('Block Settings'), 2559 parentSection: this, 2560 customizeAction: [(0,external_wp_i18n_namespaceObject.__)('Customizing'), (0,external_wp_i18n_namespaceObject.__)('Widgets'), this.params.title].join(' ▸ ') 2561 }); 2562 customize.section.add(this.inspector); 2563 this.contentContainer[0].classList.add('customize-widgets__sidebar-section'); 2564 } 2565 hasSubSectionOpened() { 2566 return this.inspector.expanded(); 2567 } 2568 onChangeExpanded(expanded, _args) { 2569 const controls = this.controls(); 2570 const args = { 2571 ..._args, 2572 completeCallback() { 2573 controls.forEach(control => { 2574 control.onChangeSectionExpanded?.(expanded, args); 2575 }); 2576 _args.completeCallback?.(); 2577 } 2578 }; 2579 if (args.manualTransition) { 2580 if (expanded) { 2581 this.contentContainer.addClass(['busy', 'open']); 2582 this.contentContainer.removeClass('is-sub-section-open'); 2583 this.contentContainer.closest('.wp-full-overlay').addClass('section-open'); 2584 } else { 2585 this.contentContainer.addClass(['busy', 'is-sub-section-open']); 2586 this.contentContainer.closest('.wp-full-overlay').addClass('section-open'); 2587 this.contentContainer.removeClass('open'); 2588 } 2589 const handleTransitionEnd = () => { 2590 this.contentContainer.removeClass('busy'); 2591 args.completeCallback(); 2592 }; 2593 if (isReducedMotion) { 2594 handleTransitionEnd(); 2595 } else { 2596 this.contentContainer.one('transitionend', handleTransitionEnd); 2597 } 2598 } else { 2599 super.onChangeExpanded(expanded, args); 2600 } 2601 } 2602 }; 2603 } 2604 2605 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.js 2606 /** 2607 * Internal dependencies 2608 */ 2609 2610 const { 2611 wp 2612 } = window; 2613 function parseWidgetId(widgetId) { 2614 const matches = widgetId.match(/^(.+)-(\d+)$/); 2615 if (matches) { 2616 return { 2617 idBase: matches[1], 2618 number: parseInt(matches[2], 10) 2619 }; 2620 } 2621 2622 // Likely an old single widget. 2623 return { 2624 idBase: widgetId 2625 }; 2626 } 2627 function widgetIdToSettingId(widgetId) { 2628 const { 2629 idBase, 2630 number 2631 } = parseWidgetId(widgetId); 2632 if (number) { 2633 return `widget_$idBase}[$number}]`; 2634 } 2635 return `widget_$idBase}`; 2636 } 2637 2638 /** 2639 * This is a custom debounce function to call different callbacks depending on 2640 * whether it's the _leading_ call or not. 2641 * 2642 * @param {Function} leading The callback that gets called first. 2643 * @param {Function} callback The callback that gets called after the first time. 2644 * @param {number} timeout The debounced time in milliseconds. 2645 * @return {Function} The debounced function. 2646 */ 2647 function debounce(leading, callback, timeout) { 2648 let isLeading = false; 2649 let timerID; 2650 function debounced(...args) { 2651 const result = (isLeading ? callback : leading).apply(this, args); 2652 isLeading = true; 2653 clearTimeout(timerID); 2654 timerID = setTimeout(() => { 2655 isLeading = false; 2656 }, timeout); 2657 return result; 2658 } 2659 debounced.cancel = () => { 2660 isLeading = false; 2661 clearTimeout(timerID); 2662 }; 2663 return debounced; 2664 } 2665 class SidebarAdapter { 2666 constructor(setting, api) { 2667 this.setting = setting; 2668 this.api = api; 2669 this.locked = false; 2670 this.widgetsCache = new WeakMap(); 2671 this.subscribers = new Set(); 2672 this.history = [this._getWidgetIds().map(widgetId => this.getWidget(widgetId))]; 2673 this.historyIndex = 0; 2674 this.historySubscribers = new Set(); 2675 // Debounce the input for 1 second. 2676 this._debounceSetHistory = debounce(this._pushHistory, this._replaceHistory, 1000); 2677 this.setting.bind(this._handleSettingChange.bind(this)); 2678 this.api.bind('change', this._handleAllSettingsChange.bind(this)); 2679 this.undo = this.undo.bind(this); 2680 this.redo = this.redo.bind(this); 2681 this.save = this.save.bind(this); 2682 } 2683 subscribe(callback) { 2684 this.subscribers.add(callback); 2685 return () => { 2686 this.subscribers.delete(callback); 2687 }; 2688 } 2689 getWidgets() { 2690 return this.history[this.historyIndex]; 2691 } 2692 _emit(...args) { 2693 for (const callback of this.subscribers) { 2694 callback(...args); 2695 } 2696 } 2697 _getWidgetIds() { 2698 return this.setting.get(); 2699 } 2700 _pushHistory() { 2701 this.history = [...this.history.slice(0, this.historyIndex + 1), this._getWidgetIds().map(widgetId => this.getWidget(widgetId))]; 2702 this.historyIndex += 1; 2703 this.historySubscribers.forEach(listener => listener()); 2704 } 2705 _replaceHistory() { 2706 this.history[this.historyIndex] = this._getWidgetIds().map(widgetId => this.getWidget(widgetId)); 2707 } 2708 _handleSettingChange() { 2709 if (this.locked) { 2710 return; 2711 } 2712 const prevWidgets = this.getWidgets(); 2713 this._pushHistory(); 2714 this._emit(prevWidgets, this.getWidgets()); 2715 } 2716 _handleAllSettingsChange(setting) { 2717 if (this.locked) { 2718 return; 2719 } 2720 if (!setting.id.startsWith('widget_')) { 2721 return; 2722 } 2723 const widgetId = settingIdToWidgetId(setting.id); 2724 if (!this.setting.get().includes(widgetId)) { 2725 return; 2726 } 2727 const prevWidgets = this.getWidgets(); 2728 this._pushHistory(); 2729 this._emit(prevWidgets, this.getWidgets()); 2730 } 2731 _createWidget(widget) { 2732 const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({ 2733 id_base: widget.idBase 2734 }); 2735 let number = widget.number; 2736 if (widgetModel.get('is_multi') && !number) { 2737 widgetModel.set('multi_number', widgetModel.get('multi_number') + 1); 2738 number = widgetModel.get('multi_number'); 2739 } 2740 const settingId = number ? `widget_$widget.idBase}[$number}]` : `widget_$widget.idBase}`; 2741 const settingArgs = { 2742 transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get('id_base')] ? 'postMessage' : 'refresh', 2743 previewer: this.setting.previewer 2744 }; 2745 const setting = this.api.create(settingId, settingId, '', settingArgs); 2746 setting.set(widget.instance); 2747 const widgetId = settingIdToWidgetId(settingId); 2748 return widgetId; 2749 } 2750 _removeWidget(widget) { 2751 const settingId = widgetIdToSettingId(widget.id); 2752 const setting = this.api(settingId); 2753 if (setting) { 2754 const instance = setting.get(); 2755 this.widgetsCache.delete(instance); 2756 } 2757 this.api.remove(settingId); 2758 } 2759 _updateWidget(widget) { 2760 const prevWidget = this.getWidget(widget.id); 2761 2762 // Bail out update if nothing changed. 2763 if (prevWidget === widget) { 2764 return widget.id; 2765 } 2766 2767 // Update existing setting if only the widget's instance changed. 2768 if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) { 2769 const settingId = widgetIdToSettingId(widget.id); 2770 this.api(settingId).set(widget.instance); 2771 return widget.id; 2772 } 2773 2774 // Otherwise delete and re-create. 2775 this._removeWidget(widget); 2776 return this._createWidget(widget); 2777 } 2778 getWidget(widgetId) { 2779 if (!widgetId) { 2780 return null; 2781 } 2782 const { 2783 idBase, 2784 number 2785 } = parseWidgetId(widgetId); 2786 const settingId = widgetIdToSettingId(widgetId); 2787 const setting = this.api(settingId); 2788 if (!setting) { 2789 return null; 2790 } 2791 const instance = setting.get(); 2792 if (this.widgetsCache.has(instance)) { 2793 return this.widgetsCache.get(instance); 2794 } 2795 const widget = { 2796 id: widgetId, 2797 idBase, 2798 number, 2799 instance 2800 }; 2801 this.widgetsCache.set(instance, widget); 2802 return widget; 2803 } 2804 _updateWidgets(nextWidgets) { 2805 this.locked = true; 2806 const addedWidgetIds = []; 2807 const nextWidgetIds = nextWidgets.map(nextWidget => { 2808 if (nextWidget.id && this.getWidget(nextWidget.id)) { 2809 addedWidgetIds.push(null); 2810 return this._updateWidget(nextWidget); 2811 } 2812 const widgetId = this._createWidget(nextWidget); 2813 addedWidgetIds.push(widgetId); 2814 return widgetId; 2815 }); 2816 const deletedWidgets = this.getWidgets().filter(widget => !nextWidgetIds.includes(widget.id)); 2817 deletedWidgets.forEach(widget => this._removeWidget(widget)); 2818 this.setting.set(nextWidgetIds); 2819 this.locked = false; 2820 return addedWidgetIds; 2821 } 2822 setWidgets(nextWidgets) { 2823 const addedWidgetIds = this._updateWidgets(nextWidgets); 2824 this._debounceSetHistory(); 2825 return addedWidgetIds; 2826 } 2827 2828 /** 2829 * Undo/Redo related features 2830 */ 2831 hasUndo() { 2832 return this.historyIndex > 0; 2833 } 2834 hasRedo() { 2835 return this.historyIndex < this.history.length - 1; 2836 } 2837 _seek(historyIndex) { 2838 const currentWidgets = this.getWidgets(); 2839 this.historyIndex = historyIndex; 2840 const widgets = this.history[this.historyIndex]; 2841 this._updateWidgets(widgets); 2842 this._emit(currentWidgets, this.getWidgets()); 2843 this.historySubscribers.forEach(listener => listener()); 2844 this._debounceSetHistory.cancel(); 2845 } 2846 undo() { 2847 if (!this.hasUndo()) { 2848 return; 2849 } 2850 this._seek(this.historyIndex - 1); 2851 } 2852 redo() { 2853 if (!this.hasRedo()) { 2854 return; 2855 } 2856 this._seek(this.historyIndex + 1); 2857 } 2858 subscribeHistory(listener) { 2859 this.historySubscribers.add(listener); 2860 return () => { 2861 this.historySubscribers.delete(listener); 2862 }; 2863 } 2864 save() { 2865 this.api.previewer.save(); 2866 } 2867 } 2868 2869 ;// CONCATENATED MODULE: external ["wp","dom"] 2870 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 2871 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/inserter-outer-section.js 2872 /** 2873 * WordPress dependencies 2874 */ 2875 2876 2877 2878 2879 /** 2880 * Internal dependencies 2881 */ 2882 2883 function getInserterOuterSection() { 2884 const { 2885 wp: { 2886 customize 2887 } 2888 } = window; 2889 const OuterSection = customize.OuterSection; 2890 // Override the OuterSection class to handle multiple outer sections. 2891 // It closes all the other outer sections whenever one is opened. 2892 // The result is that at most one outer section can be opened at the same time. 2893 customize.OuterSection = class extends OuterSection { 2894 onChangeExpanded(expanded, args) { 2895 if (expanded) { 2896 customize.section.each(section => { 2897 if (section.params.type === 'outer' && section.id !== this.id) { 2898 if (section.expanded()) { 2899 section.collapse(); 2900 } 2901 } 2902 }); 2903 } 2904 return super.onChangeExpanded(expanded, args); 2905 } 2906 }; 2907 // Handle constructor so that "params.type" can be correctly pointed to "outer". 2908 customize.sectionConstructor.outer = customize.OuterSection; 2909 return class InserterOuterSection extends customize.OuterSection { 2910 constructor(...args) { 2911 super(...args); 2912 2913 // This is necessary since we're creating a new class which is not identical to the original OuterSection. 2914 // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436 2915 this.params.type = 'outer'; 2916 this.activeElementBeforeExpanded = null; 2917 const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; 2918 2919 // Handle closing the inserter when pressing the Escape key. 2920 ownerWindow.addEventListener('keydown', event => { 2921 if (this.expanded() && (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE || event.code === 'Escape') && !event.defaultPrevented) { 2922 event.preventDefault(); 2923 event.stopPropagation(); 2924 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false); 2925 } 2926 }, 2927 // Use capture mode to make this run before other event listeners. 2928 true); 2929 this.contentContainer.addClass('widgets-inserter'); 2930 2931 // Set a flag if the state is being changed from open() or close(). 2932 // Don't propagate the event if it's an internal action to prevent infinite loop. 2933 this.isFromInternalAction = false; 2934 this.expanded.bind(() => { 2935 if (!this.isFromInternalAction) { 2936 // Propagate the event to React to sync the state. 2937 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(this.expanded()); 2938 } 2939 this.isFromInternalAction = false; 2940 }); 2941 } 2942 open() { 2943 if (!this.expanded()) { 2944 const contentContainer = this.contentContainer[0]; 2945 this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement; 2946 this.isFromInternalAction = true; 2947 this.expand({ 2948 completeCallback() { 2949 // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable. 2950 // The first one should be the close button, 2951 // we want to skip it and choose the second one instead, which is the search box. 2952 const searchBox = external_wp_dom_namespaceObject.focus.tabbable.find(contentContainer)[1]; 2953 if (searchBox) { 2954 searchBox.focus(); 2955 } 2956 } 2957 }); 2958 } 2959 } 2960 close() { 2961 if (this.expanded()) { 2962 const contentContainer = this.contentContainer[0]; 2963 const activeElement = contentContainer.ownerDocument.activeElement; 2964 this.isFromInternalAction = true; 2965 this.collapse({ 2966 completeCallback() { 2967 // Return back the focus when closing the inserter. 2968 // Only do this if the active element which triggers the action is inside the inserter, 2969 // (the close button for instance). In that case the focus will be lost. 2970 // Otherwise, we don't hijack the focus when the user is focusing on other elements 2971 // (like the quick inserter). 2972 if (contentContainer.contains(activeElement)) { 2973 // Return back the focus when closing the inserter. 2974 if (this.activeElementBeforeExpanded) { 2975 this.activeElementBeforeExpanded.focus(); 2976 } 2977 } 2978 } 2979 }); 2980 } 2981 } 2982 }; 2983 } 2984 2985 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-control.js 2986 /** 2987 * WordPress dependencies 2988 */ 2989 2990 2991 /** 2992 * Internal dependencies 2993 */ 2994 2995 2996 2997 const getInserterId = controlId => `widgets-inserter-$controlId}`; 2998 function getSidebarControl() { 2999 const { 3000 wp: { 3001 customize 3002 } 3003 } = window; 3004 return class SidebarControl extends customize.Control { 3005 constructor(...args) { 3006 super(...args); 3007 this.subscribers = new Set(); 3008 } 3009 ready() { 3010 const InserterOuterSection = getInserterOuterSection(); 3011 this.inserter = new InserterOuterSection(getInserterId(this.id), {}); 3012 customize.section.add(this.inserter); 3013 this.sectionInstance = customize.section(this.section()); 3014 this.inspector = this.sectionInstance.inspector; 3015 this.sidebarAdapter = new SidebarAdapter(this.setting, customize); 3016 } 3017 subscribe(callback) { 3018 this.subscribers.add(callback); 3019 return () => { 3020 this.subscribers.delete(callback); 3021 }; 3022 } 3023 onChangeSectionExpanded(expanded, args) { 3024 if (!args.unchanged) { 3025 // Close the inserter when the section collapses. 3026 if (!expanded) { 3027 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false); 3028 } 3029 this.subscribers.forEach(subscriber => subscriber(expanded, args)); 3030 } 3031 } 3032 }; 3033 } 3034 3035 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/move-to-sidebar.js 3036 3037 /** 3038 * WordPress dependencies 3039 */ 3040 3041 3042 3043 3044 3045 3046 /** 3047 * Internal dependencies 3048 */ 3049 3050 3051 3052 const withMoveToSidebarToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { 3053 let widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(props); 3054 const sidebarControls = useSidebarControls(); 3055 const activeSidebarControl = useActiveSidebarControl(); 3056 const hasMultipleSidebars = sidebarControls?.length > 1; 3057 const blockName = props.name; 3058 const clientId = props.clientId; 3059 const canInsertBlockInSidebar = (0,external_wp_data_namespaceObject.useSelect)(select => { 3060 // Use an empty string to represent the root block list, which 3061 // in the customizer editor represents a sidebar/widget area. 3062 return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, ''); 3063 }, [blockName]); 3064 const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); 3065 const { 3066 removeBlock 3067 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 3068 const [, focusWidget] = useFocusControl(); 3069 function moveToSidebar(sidebarControlId) { 3070 const newSidebarControl = sidebarControls.find(sidebarControl => sidebarControl.id === sidebarControlId); 3071 if (widgetId) { 3072 /** 3073 * If there's a widgetId, move it to the other sidebar. 3074 */ 3075 const oldSetting = activeSidebarControl.setting; 3076 const newSetting = newSidebarControl.setting; 3077 oldSetting(oldSetting().filter(id => id !== widgetId)); 3078 newSetting([...newSetting(), widgetId]); 3079 } else { 3080 /** 3081 * If there isn't a widgetId, it's most likely a inner block. 3082 * First, remove the block in the original sidebar, 3083 * then, create a new widget in the new sidebar and get back its widgetId. 3084 */ 3085 const sidebarAdapter = newSidebarControl.sidebarAdapter; 3086 removeBlock(clientId); 3087 const addedWidgetIds = sidebarAdapter.setWidgets([...sidebarAdapter.getWidgets(), blockToWidget(block)]); 3088 // The last non-null id is the added widget's id. 3089 widgetId = addedWidgetIds.reverse().find(id => !!id); 3090 } 3091 3092 // Move focus to the moved widget and expand the sidebar. 3093 focusWidget(widgetId); 3094 } 3095 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(BlockEdit, { 3096 ...props 3097 }), hasMultipleSidebars && canInsertBlockInSidebar && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, { 3098 widgetAreas: sidebarControls.map(sidebarControl => ({ 3099 id: sidebarControl.id, 3100 name: sidebarControl.params.label, 3101 description: sidebarControl.params.description 3102 })), 3103 currentWidgetAreaId: activeSidebarControl?.id, 3104 onSelect: moveToSidebar 3105 }))); 3106 }, 'withMoveToSidebarToolbarItem'); 3107 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/block-edit', withMoveToSidebarToolbarItem); 3108 3109 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/replace-media-upload.js 3110 /** 3111 * WordPress dependencies 3112 */ 3113 3114 3115 const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; 3116 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload); 3117 3118 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/wide-widget-display.js 3119 3120 /** 3121 * WordPress dependencies 3122 */ 3123 3124 3125 const { 3126 wp: wide_widget_display_wp 3127 } = window; 3128 const withWideWidgetDisplay = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { 3129 var _wp$customize$Widgets; 3130 const { 3131 idBase 3132 } = props.attributes; 3133 const isWide = (_wp$customize$Widgets = wide_widget_display_wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false; 3134 return (0,external_React_namespaceObject.createElement)(BlockEdit, { 3135 ...props, 3136 isWide: isWide 3137 }); 3138 }, 'withWideWidgetDisplay'); 3139 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay); 3140 3141 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/filters/index.js 3142 /** 3143 * Internal dependencies 3144 */ 3145 3146 3147 3148 3149 ;// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/index.js 3150 3151 /** 3152 * WordPress dependencies 3153 */ 3154 3155 3156 3157 3158 3159 3160 3161 /** 3162 * Internal dependencies 3163 */ 3164 3165 3166 3167 3168 const { 3169 wp: build_module_wp 3170 } = window; 3171 const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part']; 3172 const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; 3173 3174 /** 3175 * Initializes the widgets block editor in the customizer. 3176 * 3177 * @param {string} editorName The editor name. 3178 * @param {Object} blockEditorSettings Block editor settings. 3179 */ 3180 function initialize(editorName, blockEditorSettings) { 3181 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/customize-widgets', { 3182 fixedToolbar: false, 3183 welcomeGuide: true 3184 }); 3185 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 3186 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => { 3187 return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation')); 3188 }); 3189 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 3190 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)(); 3191 if (false) {} 3192 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(blockEditorSettings); 3193 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); 3194 3195 // As we are unregistering `core/freeform` to avoid the Classic block, we must 3196 // replace it with something as the default freeform content handler. Failure to 3197 // do this will result in errors in the default block parser. 3198 // see: https://github.com/WordPress/gutenberg/issues/33097 3199 (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html'); 3200 const SidebarControl = getSidebarControl(blockEditorSettings); 3201 build_module_wp.customize.sectionConstructor.sidebar = getSidebarSection(); 3202 build_module_wp.customize.controlConstructor.sidebar_block_editor = SidebarControl; 3203 const container = document.createElement('div'); 3204 document.body.appendChild(container); 3205 build_module_wp.customize.bind('ready', () => { 3206 const sidebarControls = []; 3207 build_module_wp.customize.control.each(control => { 3208 if (control instanceof SidebarControl) { 3209 sidebarControls.push(control); 3210 } 3211 }); 3212 (0,external_wp_element_namespaceObject.createRoot)(container).render((0,external_React_namespaceObject.createElement)(CustomizeWidgets, { 3213 api: build_module_wp.customize, 3214 sidebarControls: sidebarControls, 3215 blockEditorSettings: blockEditorSettings 3216 })); 3217 }); 3218 } 3219 3220 3221 })(); 3222 3223 (window.wp = window.wp || {}).customizeWidgets = __webpack_exports__; 3224 /******/ })() 3225 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Apr 26 08:20:02 2024 | Cross-referenced by PHPXref |