[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /******/ (function() { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 6411: 5 /***/ (function(module, exports) { 6 7 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8 autosize 4.0.4 9 license: MIT 10 http://www.jacklmoore.com/autosize 11 */ 12 (function (global, factory) { 13 if (true) { 14 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 15 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 16 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 17 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 18 } else { var mod; } 19 })(this, function (module, exports) { 20 'use strict'; 21 22 var map = typeof Map === "function" ? new Map() : function () { 23 var keys = []; 24 var values = []; 25 26 return { 27 has: function has(key) { 28 return keys.indexOf(key) > -1; 29 }, 30 get: function get(key) { 31 return values[keys.indexOf(key)]; 32 }, 33 set: function set(key, value) { 34 if (keys.indexOf(key) === -1) { 35 keys.push(key); 36 values.push(value); 37 } 38 }, 39 delete: function _delete(key) { 40 var index = keys.indexOf(key); 41 if (index > -1) { 42 keys.splice(index, 1); 43 values.splice(index, 1); 44 } 45 } 46 }; 47 }(); 48 49 var createEvent = function createEvent(name) { 50 return new Event(name, { bubbles: true }); 51 }; 52 try { 53 new Event('test'); 54 } catch (e) { 55 // IE does not support `new Event()` 56 createEvent = function createEvent(name) { 57 var evt = document.createEvent('Event'); 58 evt.initEvent(name, true, false); 59 return evt; 60 }; 61 } 62 63 function assign(ta) { 64 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 65 66 var heightOffset = null; 67 var clientWidth = null; 68 var cachedHeight = null; 69 70 function init() { 71 var style = window.getComputedStyle(ta, null); 72 73 if (style.resize === 'vertical') { 74 ta.style.resize = 'none'; 75 } else if (style.resize === 'both') { 76 ta.style.resize = 'horizontal'; 77 } 78 79 if (style.boxSizing === 'content-box') { 80 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 81 } else { 82 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 83 } 84 // Fix when a textarea is not on document body and heightOffset is Not a Number 85 if (isNaN(heightOffset)) { 86 heightOffset = 0; 87 } 88 89 update(); 90 } 91 92 function changeOverflow(value) { 93 { 94 // Chrome/Safari-specific fix: 95 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 96 // made available by removing the scrollbar. The following forces the necessary text reflow. 97 var width = ta.style.width; 98 ta.style.width = '0px'; 99 // Force reflow: 100 /* jshint ignore:start */ 101 ta.offsetWidth; 102 /* jshint ignore:end */ 103 ta.style.width = width; 104 } 105 106 ta.style.overflowY = value; 107 } 108 109 function getParentOverflows(el) { 110 var arr = []; 111 112 while (el && el.parentNode && el.parentNode instanceof Element) { 113 if (el.parentNode.scrollTop) { 114 arr.push({ 115 node: el.parentNode, 116 scrollTop: el.parentNode.scrollTop 117 }); 118 } 119 el = el.parentNode; 120 } 121 122 return arr; 123 } 124 125 function resize() { 126 if (ta.scrollHeight === 0) { 127 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 128 return; 129 } 130 131 var overflows = getParentOverflows(ta); 132 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 133 134 ta.style.height = ''; 135 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 136 137 // used to check if an update is actually necessary on window.resize 138 clientWidth = ta.clientWidth; 139 140 // prevents scroll-position jumping 141 overflows.forEach(function (el) { 142 el.node.scrollTop = el.scrollTop; 143 }); 144 145 if (docTop) { 146 document.documentElement.scrollTop = docTop; 147 } 148 } 149 150 function update() { 151 resize(); 152 153 var styleHeight = Math.round(parseFloat(ta.style.height)); 154 var computed = window.getComputedStyle(ta, null); 155 156 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 157 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 158 159 // The actual height not matching the style height (set via the resize method) indicates that 160 // the max-height has been exceeded, in which case the overflow should be allowed. 161 if (actualHeight < styleHeight) { 162 if (computed.overflowY === 'hidden') { 163 changeOverflow('scroll'); 164 resize(); 165 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 166 } 167 } else { 168 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 169 if (computed.overflowY !== 'hidden') { 170 changeOverflow('hidden'); 171 resize(); 172 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 173 } 174 } 175 176 if (cachedHeight !== actualHeight) { 177 cachedHeight = actualHeight; 178 var evt = createEvent('autosize:resized'); 179 try { 180 ta.dispatchEvent(evt); 181 } catch (err) { 182 // Firefox will throw an error on dispatchEvent for a detached element 183 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 184 } 185 } 186 } 187 188 var pageResize = function pageResize() { 189 if (ta.clientWidth !== clientWidth) { 190 update(); 191 } 192 }; 193 194 var destroy = function (style) { 195 window.removeEventListener('resize', pageResize, false); 196 ta.removeEventListener('input', update, false); 197 ta.removeEventListener('keyup', update, false); 198 ta.removeEventListener('autosize:destroy', destroy, false); 199 ta.removeEventListener('autosize:update', update, false); 200 201 Object.keys(style).forEach(function (key) { 202 ta.style[key] = style[key]; 203 }); 204 205 map.delete(ta); 206 }.bind(ta, { 207 height: ta.style.height, 208 resize: ta.style.resize, 209 overflowY: ta.style.overflowY, 210 overflowX: ta.style.overflowX, 211 wordWrap: ta.style.wordWrap 212 }); 213 214 ta.addEventListener('autosize:destroy', destroy, false); 215 216 // IE9 does not fire onpropertychange or oninput for deletions, 217 // so binding to onkeyup to catch most of those events. 218 // There is no way that I know of to detect something like 'cut' in IE9. 219 if ('onpropertychange' in ta && 'oninput' in ta) { 220 ta.addEventListener('keyup', update, false); 221 } 222 223 window.addEventListener('resize', pageResize, false); 224 ta.addEventListener('input', update, false); 225 ta.addEventListener('autosize:update', update, false); 226 ta.style.overflowX = 'hidden'; 227 ta.style.wordWrap = 'break-word'; 228 229 map.set(ta, { 230 destroy: destroy, 231 update: update 232 }); 233 234 init(); 235 } 236 237 function destroy(ta) { 238 var methods = map.get(ta); 239 if (methods) { 240 methods.destroy(); 241 } 242 } 243 244 function update(ta) { 245 var methods = map.get(ta); 246 if (methods) { 247 methods.update(); 248 } 249 } 250 251 var autosize = null; 252 253 // Do nothing in Node.js environment and IE8 (or lower) 254 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 255 autosize = function autosize(el) { 256 return el; 257 }; 258 autosize.destroy = function (el) { 259 return el; 260 }; 261 autosize.update = function (el) { 262 return el; 263 }; 264 } else { 265 autosize = function autosize(el, options) { 266 if (el) { 267 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 268 return assign(x, options); 269 }); 270 } 271 return el; 272 }; 273 autosize.destroy = function (el) { 274 if (el) { 275 Array.prototype.forEach.call(el.length ? el : [el], destroy); 276 } 277 return el; 278 }; 279 autosize.update = function (el) { 280 if (el) { 281 Array.prototype.forEach.call(el.length ? el : [el], update); 282 } 283 return el; 284 }; 285 } 286 287 exports.default = autosize; 288 module.exports = exports['default']; 289 }); 290 291 /***/ }), 292 293 /***/ 4403: 294 /***/ (function(module, exports) { 295 296 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 297 Copyright (c) 2018 Jed Watson. 298 Licensed under the MIT License (MIT), see 299 http://jedwatson.github.io/classnames 300 */ 301 /* global define */ 302 303 (function () { 304 'use strict'; 305 306 var hasOwn = {}.hasOwnProperty; 307 308 function classNames() { 309 var classes = []; 310 311 for (var i = 0; i < arguments.length; i++) { 312 var arg = arguments[i]; 313 if (!arg) continue; 314 315 var argType = typeof arg; 316 317 if (argType === 'string' || argType === 'number') { 318 classes.push(arg); 319 } else if (Array.isArray(arg)) { 320 if (arg.length) { 321 var inner = classNames.apply(null, arg); 322 if (inner) { 323 classes.push(inner); 324 } 325 } 326 } else if (argType === 'object') { 327 if (arg.toString === Object.prototype.toString) { 328 for (var key in arg) { 329 if (hasOwn.call(arg, key) && arg[key]) { 330 classes.push(key); 331 } 332 } 333 } else { 334 classes.push(arg.toString()); 335 } 336 } 337 } 338 339 return classes.join(' '); 340 } 341 342 if ( true && module.exports) { 343 classNames.default = classNames; 344 module.exports = classNames; 345 } else if (true) { 346 // register as 'classnames', consistent with npm package name 347 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 348 return classNames; 349 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 350 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 351 } else {} 352 }()); 353 354 355 /***/ }), 356 357 /***/ 4827: 358 /***/ (function(module) { 359 360 // This code has been refactored for 140 bytes 361 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 362 var computedStyle = function (el, prop, getComputedStyle) { 363 getComputedStyle = window.getComputedStyle; 364 365 // In one fell swoop 366 return ( 367 // If we have getComputedStyle 368 getComputedStyle ? 369 // Query it 370 // TODO: From CSS-Query notes, we might need (node, null) for FF 371 getComputedStyle(el) : 372 373 // Otherwise, we are in IE and use currentStyle 374 el.currentStyle 375 )[ 376 // Switch to camelCase for CSSOM 377 // DEV: Grabbed from jQuery 378 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 379 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 380 prop.replace(/-(\w)/gi, function (word, letter) { 381 return letter.toUpperCase(); 382 }) 383 ]; 384 }; 385 386 module.exports = computedStyle; 387 388 389 /***/ }), 390 391 /***/ 8981: 392 /***/ (function(module, exports) { 393 394 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage 395 // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime 396 // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs 397 // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling. 398 // v4 adds AMD/UMD, commonJS, and plain browser support 399 // v4.1 adds url download capability via solo URL argument (same domain/CORS only) 400 // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors 401 // https://github.com/rndme/download 402 403 (function (root, factory) { 404 if (true) { 405 // AMD. Register as an anonymous module. 406 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 407 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 408 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 409 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 410 } else {} 411 }(this, function () { 412 413 return function download(data, strFileName, strMimeType) { 414 415 var self = window, // this script is only for browsers anyway... 416 defaultMime = "application/octet-stream", // this default mime also triggers iframe downloads 417 mimeType = strMimeType || defaultMime, 418 payload = data, 419 url = !strFileName && !strMimeType && payload, 420 anchor = document.createElement("a"), 421 toString = function(a){return String(a);}, 422 myBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString), 423 fileName = strFileName || "download", 424 blob, 425 reader; 426 myBlob= myBlob.call ? myBlob.bind(self) : Blob ; 427 428 if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback 429 payload=[payload, mimeType]; 430 mimeType=payload[0]; 431 payload=payload[1]; 432 } 433 434 435 if(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument 436 fileName = url.split("/").pop().split("?")[0]; 437 anchor.href = url; // assign href prop to temp anchor 438 if(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path: 439 var ajax=new XMLHttpRequest(); 440 ajax.open( "GET", url, true); 441 ajax.responseType = 'blob'; 442 ajax.onload= function(e){ 443 download(e.target.response, fileName, defaultMime); 444 }; 445 setTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return: 446 return ajax; 447 } // end if valid url? 448 } // end if url? 449 450 451 //go ahead and download dataURLs right away 452 if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){ 453 454 if(payload.length > (1024*1024*1.999) && myBlob !== toString ){ 455 payload=dataUrlToBlob(payload); 456 mimeType=payload.type || defaultMime; 457 }else{ 458 return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs: 459 navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : 460 saver(payload) ; // everyone else can save dataURLs un-processed 461 } 462 463 }else{//not data url, is it a string with special needs? 464 if(/([\x80-\xff])/.test(payload)){ 465 var i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length; 466 for(i;i<mx;++i) tempUiArr[i]= payload.charCodeAt(i); 467 payload=new myBlob([tempUiArr], {type: mimeType}); 468 } 469 } 470 blob = payload instanceof myBlob ? 471 payload : 472 new myBlob([payload], {type: mimeType}) ; 473 474 475 function dataUrlToBlob(strUrl) { 476 var parts= strUrl.split(/[:;,]/), 477 type= parts[1], 478 decoder= parts[2] == "base64" ? atob : decodeURIComponent, 479 binData= decoder( parts.pop() ), 480 mx= binData.length, 481 i= 0, 482 uiArr= new Uint8Array(mx); 483 484 for(i;i<mx;++i) uiArr[i]= binData.charCodeAt(i); 485 486 return new myBlob([uiArr], {type: type}); 487 } 488 489 function saver(url, winMode){ 490 491 if ('download' in anchor) { //html5 A[download] 492 anchor.href = url; 493 anchor.setAttribute("download", fileName); 494 anchor.className = "download-js-link"; 495 anchor.innerHTML = "downloading..."; 496 anchor.style.display = "none"; 497 document.body.appendChild(anchor); 498 setTimeout(function() { 499 anchor.click(); 500 document.body.removeChild(anchor); 501 if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(anchor.href);}, 250 );} 502 }, 66); 503 return true; 504 } 505 506 // handle non-a[download] safari as best we can: 507 if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) { 508 if(/^data:/.test(url)) url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); 509 if(!window.open(url)){ // popup blocked, offer direct download: 510 if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; } 511 } 512 return true; 513 } 514 515 //do iframe dataURL download (old ch+FF): 516 var f = document.createElement("iframe"); 517 document.body.appendChild(f); 518 519 if(!winMode && /^data:/.test(url)){ // force a mime that will download: 520 url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); 521 } 522 f.src=url; 523 setTimeout(function(){ document.body.removeChild(f); }, 333); 524 525 }//end saver 526 527 528 529 530 if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL) 531 return navigator.msSaveBlob(blob, fileName); 532 } 533 534 if(self.URL){ // simple fast and modern way using Blob and URL: 535 saver(self.URL.createObjectURL(blob), true); 536 }else{ 537 // handle non-Blob()+non-URL browsers: 538 if(typeof blob === "string" || blob.constructor===toString ){ 539 try{ 540 return saver( "data:" + mimeType + ";base64," + self.btoa(blob) ); 541 }catch(y){ 542 return saver( "data:" + mimeType + "," + encodeURIComponent(blob) ); 543 } 544 } 545 546 // Blob but not URL support: 547 reader=new FileReader(); 548 reader.onload=function(e){ 549 saver(this.result); 550 }; 551 reader.readAsDataURL(blob); 552 } 553 return true; 554 }; /* end download() */ 555 })); 556 557 558 /***/ }), 559 560 /***/ 9894: 561 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 562 563 // Load in dependencies 564 var computedStyle = __webpack_require__(4827); 565 566 /** 567 * Calculate the `line-height` of a given node 568 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 569 * @returns {Number} `line-height` of the element in pixels 570 */ 571 function lineHeight(node) { 572 // Grab the line-height via style 573 var lnHeightStr = computedStyle(node, 'line-height'); 574 var lnHeight = parseFloat(lnHeightStr, 10); 575 576 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 577 if (lnHeightStr === lnHeight + '') { 578 // Save the old lineHeight style and update the em unit to the element 579 var _lnHeightStyle = node.style.lineHeight; 580 node.style.lineHeight = lnHeightStr + 'em'; 581 582 // Calculate the em based height 583 lnHeightStr = computedStyle(node, 'line-height'); 584 lnHeight = parseFloat(lnHeightStr, 10); 585 586 // Revert the lineHeight style 587 if (_lnHeightStyle) { 588 node.style.lineHeight = _lnHeightStyle; 589 } else { 590 delete node.style.lineHeight; 591 } 592 } 593 594 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 595 // DEV: `em` units are converted to `pt` in IE6 596 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 597 if (lnHeightStr.indexOf('pt') !== -1) { 598 lnHeight *= 4; 599 lnHeight /= 3; 600 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 601 } else if (lnHeightStr.indexOf('mm') !== -1) { 602 lnHeight *= 96; 603 lnHeight /= 25.4; 604 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 605 } else if (lnHeightStr.indexOf('cm') !== -1) { 606 lnHeight *= 96; 607 lnHeight /= 2.54; 608 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 609 } else if (lnHeightStr.indexOf('in') !== -1) { 610 lnHeight *= 96; 611 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 612 } else if (lnHeightStr.indexOf('pc') !== -1) { 613 lnHeight *= 16; 614 } 615 616 // Continue our computation 617 lnHeight = Math.round(lnHeight); 618 619 // If the line-height is "normal", calculate by font-size 620 if (lnHeightStr === 'normal') { 621 // Create a temporary node 622 var nodeName = node.nodeName; 623 var _node = document.createElement(nodeName); 624 _node.innerHTML = ' '; 625 626 // If we have a text area, reset it to only 1 row 627 // https://github.com/twolfson/line-height/issues/4 628 if (nodeName.toUpperCase() === 'TEXTAREA') { 629 _node.setAttribute('rows', '1'); 630 } 631 632 // Set the font-size of the element 633 var fontSizeStr = computedStyle(node, 'font-size'); 634 _node.style.fontSize = fontSizeStr; 635 636 // Remove default padding/border which can affect offset height 637 // https://github.com/twolfson/line-height/issues/4 638 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 639 _node.style.padding = '0px'; 640 _node.style.border = '0px'; 641 642 // Append it to the body 643 var body = document.body; 644 body.appendChild(_node); 645 646 // Assume the line height of the element is the height 647 var height = _node.offsetHeight; 648 lnHeight = height; 649 650 // Remove our child from the DOM 651 body.removeChild(_node); 652 } 653 654 // Return the calculated height 655 return lnHeight; 656 } 657 658 // Export lineHeight 659 module.exports = lineHeight; 660 661 662 /***/ }), 663 664 /***/ 5372: 665 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 666 667 "use strict"; 668 /** 669 * Copyright (c) 2013-present, Facebook, Inc. 670 * 671 * This source code is licensed under the MIT license found in the 672 * LICENSE file in the root directory of this source tree. 673 */ 674 675 676 677 var ReactPropTypesSecret = __webpack_require__(9567); 678 679 function emptyFunction() {} 680 function emptyFunctionWithReset() {} 681 emptyFunctionWithReset.resetWarningCache = emptyFunction; 682 683 module.exports = function() { 684 function shim(props, propName, componentName, location, propFullName, secret) { 685 if (secret === ReactPropTypesSecret) { 686 // It is still safe when called from React. 687 return; 688 } 689 var err = new Error( 690 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 691 'Use PropTypes.checkPropTypes() to call them. ' + 692 'Read more at http://fb.me/use-check-prop-types' 693 ); 694 err.name = 'Invariant Violation'; 695 throw err; 696 }; 697 shim.isRequired = shim; 698 function getShim() { 699 return shim; 700 }; 701 // Important! 702 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 703 var ReactPropTypes = { 704 array: shim, 705 bigint: shim, 706 bool: shim, 707 func: shim, 708 number: shim, 709 object: shim, 710 string: shim, 711 symbol: shim, 712 713 any: shim, 714 arrayOf: getShim, 715 element: shim, 716 elementType: shim, 717 instanceOf: getShim, 718 node: shim, 719 objectOf: getShim, 720 oneOf: getShim, 721 oneOfType: getShim, 722 shape: getShim, 723 exact: getShim, 724 725 checkPropTypes: emptyFunctionWithReset, 726 resetWarningCache: emptyFunction 727 }; 728 729 ReactPropTypes.PropTypes = ReactPropTypes; 730 731 return ReactPropTypes; 732 }; 733 734 735 /***/ }), 736 737 /***/ 2652: 738 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 739 740 /** 741 * Copyright (c) 2013-present, Facebook, Inc. 742 * 743 * This source code is licensed under the MIT license found in the 744 * LICENSE file in the root directory of this source tree. 745 */ 746 747 if (false) { var throwOnDirectAccess, ReactIs; } else { 748 // By explicitly using `prop-types` you are opting into new production behavior. 749 // http://fb.me/prop-types-in-prod 750 module.exports = __webpack_require__(5372)(); 751 } 752 753 754 /***/ }), 755 756 /***/ 9567: 757 /***/ (function(module) { 758 759 "use strict"; 760 /** 761 * Copyright (c) 2013-present, Facebook, Inc. 762 * 763 * This source code is licensed under the MIT license found in the 764 * LICENSE file in the root directory of this source tree. 765 */ 766 767 768 769 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 770 771 module.exports = ReactPropTypesSecret; 772 773 774 /***/ }), 775 776 /***/ 5438: 777 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 778 779 "use strict"; 780 781 var __extends = (this && this.__extends) || (function () { 782 var extendStatics = Object.setPrototypeOf || 783 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 784 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 785 return function (d, b) { 786 extendStatics(d, b); 787 function __() { this.constructor = d; } 788 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 789 }; 790 })(); 791 var __assign = (this && this.__assign) || Object.assign || function(t) { 792 for (var s, i = 1, n = arguments.length; i < n; i++) { 793 s = arguments[i]; 794 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 795 t[p] = s[p]; 796 } 797 return t; 798 }; 799 var __rest = (this && this.__rest) || function (s, e) { 800 var t = {}; 801 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 802 t[p] = s[p]; 803 if (s != null && typeof Object.getOwnPropertySymbols === "function") 804 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 805 t[p[i]] = s[p[i]]; 806 return t; 807 }; 808 exports.__esModule = true; 809 var React = __webpack_require__(9196); 810 var PropTypes = __webpack_require__(2652); 811 var autosize = __webpack_require__(6411); 812 var _getLineHeight = __webpack_require__(9894); 813 var getLineHeight = _getLineHeight; 814 var RESIZED = "autosize:resized"; 815 /** 816 * A light replacement for built-in textarea component 817 * which automaticaly adjusts its height to match the content 818 */ 819 var TextareaAutosizeClass = /** @class */ (function (_super) { 820 __extends(TextareaAutosizeClass, _super); 821 function TextareaAutosizeClass() { 822 var _this = _super !== null && _super.apply(this, arguments) || this; 823 _this.state = { 824 lineHeight: null 825 }; 826 _this.textarea = null; 827 _this.onResize = function (e) { 828 if (_this.props.onResize) { 829 _this.props.onResize(e); 830 } 831 }; 832 _this.updateLineHeight = function () { 833 if (_this.textarea) { 834 _this.setState({ 835 lineHeight: getLineHeight(_this.textarea) 836 }); 837 } 838 }; 839 _this.onChange = function (e) { 840 var onChange = _this.props.onChange; 841 _this.currentValue = e.currentTarget.value; 842 onChange && onChange(e); 843 }; 844 return _this; 845 } 846 TextareaAutosizeClass.prototype.componentDidMount = function () { 847 var _this = this; 848 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 849 if (typeof maxRows === "number") { 850 this.updateLineHeight(); 851 } 852 if (typeof maxRows === "number" || async) { 853 /* 854 the defer is needed to: 855 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 856 - support StyledComponents (see #71) 857 */ 858 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 859 } 860 else { 861 this.textarea && autosize(this.textarea); 862 } 863 if (this.textarea) { 864 this.textarea.addEventListener(RESIZED, this.onResize); 865 } 866 }; 867 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 868 if (this.textarea) { 869 this.textarea.removeEventListener(RESIZED, this.onResize); 870 autosize.destroy(this.textarea); 871 } 872 }; 873 TextareaAutosizeClass.prototype.render = function () { 874 var _this = this; 875 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; 876 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 877 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 878 _this.textarea = element; 879 if (typeof _this.props.innerRef === 'function') { 880 _this.props.innerRef(element); 881 } 882 else if (_this.props.innerRef) { 883 _this.props.innerRef.current = element; 884 } 885 } }), children)); 886 }; 887 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 888 this.textarea && autosize.update(this.textarea); 889 }; 890 TextareaAutosizeClass.defaultProps = { 891 rows: 1, 892 async: false 893 }; 894 TextareaAutosizeClass.propTypes = { 895 rows: PropTypes.number, 896 maxRows: PropTypes.number, 897 onResize: PropTypes.func, 898 innerRef: PropTypes.any, 899 async: PropTypes.bool 900 }; 901 return TextareaAutosizeClass; 902 }(React.Component)); 903 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 904 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 905 }); 906 907 908 /***/ }), 909 910 /***/ 773: 911 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 912 913 "use strict"; 914 var __webpack_unused_export__; 915 916 __webpack_unused_export__ = true; 917 var TextareaAutosize_1 = __webpack_require__(5438); 918 exports.Z = TextareaAutosize_1.TextareaAutosize; 919 920 921 /***/ }), 922 923 /***/ 9196: 924 /***/ (function(module) { 925 926 "use strict"; 927 module.exports = window["React"]; 928 929 /***/ }) 930 931 /******/ }); 932 /************************************************************************/ 933 /******/ // The module cache 934 /******/ var __webpack_module_cache__ = {}; 935 /******/ 936 /******/ // The require function 937 /******/ function __webpack_require__(moduleId) { 938 /******/ // Check if module is in cache 939 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 940 /******/ if (cachedModule !== undefined) { 941 /******/ return cachedModule.exports; 942 /******/ } 943 /******/ // Create a new module (and put it into the cache) 944 /******/ var module = __webpack_module_cache__[moduleId] = { 945 /******/ // no module.id needed 946 /******/ // no module.loaded needed 947 /******/ exports: {} 948 /******/ }; 949 /******/ 950 /******/ // Execute the module function 951 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 952 /******/ 953 /******/ // Return the exports of the module 954 /******/ return module.exports; 955 /******/ } 956 /******/ 957 /************************************************************************/ 958 /******/ /* webpack/runtime/compat get default export */ 959 /******/ !function() { 960 /******/ // getDefaultExport function for compatibility with non-harmony modules 961 /******/ __webpack_require__.n = function(module) { 962 /******/ var getter = module && module.__esModule ? 963 /******/ function() { return module['default']; } : 964 /******/ function() { return module; }; 965 /******/ __webpack_require__.d(getter, { a: getter }); 966 /******/ return getter; 967 /******/ }; 968 /******/ }(); 969 /******/ 970 /******/ /* webpack/runtime/define property getters */ 971 /******/ !function() { 972 /******/ // define getter functions for harmony exports 973 /******/ __webpack_require__.d = function(exports, definition) { 974 /******/ for(var key in definition) { 975 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 976 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 977 /******/ } 978 /******/ } 979 /******/ }; 980 /******/ }(); 981 /******/ 982 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 983 /******/ !function() { 984 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 985 /******/ }(); 986 /******/ 987 /******/ /* webpack/runtime/make namespace object */ 988 /******/ !function() { 989 /******/ // define __esModule on exports 990 /******/ __webpack_require__.r = function(exports) { 991 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 992 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 993 /******/ } 994 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 995 /******/ }; 996 /******/ }(); 997 /******/ 998 /************************************************************************/ 999 var __webpack_exports__ = {}; 1000 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 1001 !function() { 1002 "use strict"; 1003 // ESM COMPAT FLAG 1004 __webpack_require__.r(__webpack_exports__); 1005 1006 // EXPORTS 1007 __webpack_require__.d(__webpack_exports__, { 1008 "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; }, 1009 "PluginSidebar": function() { return /* reexport */ PluginSidebarEditSite; }, 1010 "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; }, 1011 "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; }, 1012 "__experimentalNavigationToggle": function() { return /* reexport */ navigation_toggle; }, 1013 "initializeEditor": function() { return /* binding */ initializeEditor; }, 1014 "reinitializeEditor": function() { return /* binding */ reinitializeEditor; } 1015 }); 1016 1017 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 1018 var actions_namespaceObject = {}; 1019 __webpack_require__.r(actions_namespaceObject); 1020 __webpack_require__.d(actions_namespaceObject, { 1021 "disableComplementaryArea": function() { return disableComplementaryArea; }, 1022 "enableComplementaryArea": function() { return enableComplementaryArea; }, 1023 "pinItem": function() { return pinItem; }, 1024 "setFeatureDefaults": function() { return setFeatureDefaults; }, 1025 "setFeatureValue": function() { return setFeatureValue; }, 1026 "toggleFeature": function() { return toggleFeature; }, 1027 "unpinItem": function() { return unpinItem; } 1028 }); 1029 1030 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1031 var selectors_namespaceObject = {}; 1032 __webpack_require__.r(selectors_namespaceObject); 1033 __webpack_require__.d(selectors_namespaceObject, { 1034 "getActiveComplementaryArea": function() { return getActiveComplementaryArea; }, 1035 "isFeatureActive": function() { return isFeatureActive; }, 1036 "isItemPinned": function() { return isItemPinned; } 1037 }); 1038 1039 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 1040 var store_actions_namespaceObject = {}; 1041 __webpack_require__.r(store_actions_namespaceObject); 1042 __webpack_require__.d(store_actions_namespaceObject, { 1043 "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; }, 1044 "addTemplate": function() { return addTemplate; }, 1045 "closeGeneralSidebar": function() { return closeGeneralSidebar; }, 1046 "openGeneralSidebar": function() { return openGeneralSidebar; }, 1047 "openNavigationPanelToMenu": function() { return openNavigationPanelToMenu; }, 1048 "removeTemplate": function() { return removeTemplate; }, 1049 "revertTemplate": function() { return revertTemplate; }, 1050 "setHomeTemplateId": function() { return setHomeTemplateId; }, 1051 "setIsInserterOpened": function() { return setIsInserterOpened; }, 1052 "setIsListViewOpened": function() { return setIsListViewOpened; }, 1053 "setIsNavigationPanelOpened": function() { return setIsNavigationPanelOpened; }, 1054 "setNavigationPanelActiveMenu": function() { return setNavigationPanelActiveMenu; }, 1055 "setPage": function() { return setPage; }, 1056 "setTemplate": function() { return setTemplate; }, 1057 "setTemplatePart": function() { return setTemplatePart; }, 1058 "switchEditorMode": function() { return switchEditorMode; }, 1059 "toggleFeature": function() { return actions_toggleFeature; }, 1060 "updateSettings": function() { return updateSettings; } 1061 }); 1062 1063 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 1064 var store_selectors_namespaceObject = {}; 1065 __webpack_require__.r(store_selectors_namespaceObject); 1066 __webpack_require__.d(store_selectors_namespaceObject, { 1067 "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; }, 1068 "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; }, 1069 "__unstableGetPreference": function() { return __unstableGetPreference; }, 1070 "getCanUserCreateMedia": function() { return getCanUserCreateMedia; }, 1071 "getCurrentTemplateNavigationPanelSubMenu": function() { return getCurrentTemplateNavigationPanelSubMenu; }, 1072 "getCurrentTemplateTemplateParts": function() { return getCurrentTemplateTemplateParts; }, 1073 "getEditedPostId": function() { return getEditedPostId; }, 1074 "getEditedPostType": function() { return getEditedPostType; }, 1075 "getEditorMode": function() { return getEditorMode; }, 1076 "getHomeTemplateId": function() { return getHomeTemplateId; }, 1077 "getNavigationPanelActiveMenu": function() { return getNavigationPanelActiveMenu; }, 1078 "getPage": function() { return getPage; }, 1079 "getReusableBlocks": function() { return getReusableBlocks; }, 1080 "getSettings": function() { return getSettings; }, 1081 "isFeatureActive": function() { return selectors_isFeatureActive; }, 1082 "isInserterOpened": function() { return isInserterOpened; }, 1083 "isListViewOpened": function() { return isListViewOpened; }, 1084 "isNavigationOpened": function() { return isNavigationOpened; } 1085 }); 1086 1087 ;// CONCATENATED MODULE: external ["wp","element"] 1088 var external_wp_element_namespaceObject = window["wp"]["element"]; 1089 ;// CONCATENATED MODULE: external ["wp","blocks"] 1090 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 1091 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] 1092 var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 1093 ;// CONCATENATED MODULE: external ["wp","data"] 1094 var external_wp_data_namespaceObject = window["wp"]["data"]; 1095 ;// CONCATENATED MODULE: external ["wp","coreData"] 1096 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1097 ;// CONCATENATED MODULE: external ["wp","editor"] 1098 var external_wp_editor_namespaceObject = window["wp"]["editor"]; 1099 ;// CONCATENATED MODULE: external ["wp","preferences"] 1100 var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 1101 ;// CONCATENATED MODULE: external ["wp","i18n"] 1102 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 1103 ;// CONCATENATED MODULE: external ["wp","viewport"] 1104 var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 1105 ;// CONCATENATED MODULE: external ["wp","url"] 1106 var external_wp_url_namespaceObject = window["wp"]["url"]; 1107 ;// CONCATENATED MODULE: external ["wp","hooks"] 1108 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1109 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] 1110 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 1111 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/components.js 1112 /** 1113 * WordPress dependencies 1114 */ 1115 1116 1117 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); 1118 1119 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js 1120 /** 1121 * Internal dependencies 1122 */ 1123 1124 1125 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js 1126 /** 1127 * The identifier for the data store. 1128 * 1129 * @type {string} 1130 */ 1131 const STORE_NAME = 'core/edit-site'; 1132 const TEMPLATE_PART_AREA_HEADER = 'header'; 1133 const TEMPLATE_PART_AREA_FOOTER = 'footer'; 1134 const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar'; 1135 const TEMPLATE_PART_AREA_GENERAL = 'uncategorized'; 1136 1137 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/constants.js 1138 /** 1139 * WordPress dependencies 1140 */ 1141 1142 /** 1143 * Internal dependencies 1144 */ 1145 1146 1147 const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search']; 1148 const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single-post', 'front-page']; 1149 const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY]; 1150 const TEMPLATES_GENERAL = ['page-home']; 1151 const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-']; 1152 const TEMPLATES_PAGES_PREFIXES = ['page-']; 1153 const TEMPLATE_OVERRIDES = { 1154 singular: ['single', 'page'], 1155 index: ['archive', '404', 'search', 'singular', 'home'], 1156 home: ['front-page'] 1157 }; 1158 const MENU_ROOT = 'root'; 1159 const MENU_TEMPLATE_PARTS = 'template-parts'; 1160 const MENU_TEMPLATES = 'templates'; 1161 const MENU_TEMPLATES_GENERAL = 'templates-general'; 1162 const MENU_TEMPLATES_PAGES = 'templates-pages'; 1163 const MENU_TEMPLATES_POSTS = 'templates-posts'; 1164 const MENU_TEMPLATES_UNUSED = 'templates-unused'; 1165 const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers'; 1166 const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers'; 1167 const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars'; 1168 const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general'; 1169 const TEMPLATE_PARTS_SUB_MENUS = [{ 1170 area: TEMPLATE_PART_AREA_HEADER, 1171 menu: MENU_TEMPLATE_PARTS_HEADERS, 1172 title: (0,external_wp_i18n_namespaceObject.__)('headers') 1173 }, { 1174 area: TEMPLATE_PART_AREA_FOOTER, 1175 menu: MENU_TEMPLATE_PARTS_FOOTERS, 1176 title: (0,external_wp_i18n_namespaceObject.__)('footers') 1177 }, { 1178 area: TEMPLATE_PART_AREA_SIDEBAR, 1179 menu: MENU_TEMPLATE_PARTS_SIDEBARS, 1180 title: (0,external_wp_i18n_namespaceObject.__)('sidebars') 1181 }, { 1182 area: TEMPLATE_PART_AREA_GENERAL, 1183 menu: MENU_TEMPLATE_PARTS_GENERAL, 1184 title: (0,external_wp_i18n_namespaceObject.__)('general') 1185 }]; 1186 1187 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js 1188 /** 1189 * WordPress dependencies 1190 */ 1191 1192 /** 1193 * Internal dependencies 1194 */ 1195 1196 1197 /** 1198 * Reducer returning the editing canvas device type. 1199 * 1200 * @param {Object} state Current state. 1201 * @param {Object} action Dispatched action. 1202 * 1203 * @return {Object} Updated state. 1204 */ 1205 1206 function deviceType() { 1207 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop'; 1208 let action = arguments.length > 1 ? arguments[1] : undefined; 1209 1210 switch (action.type) { 1211 case 'SET_PREVIEW_DEVICE_TYPE': 1212 return action.deviceType; 1213 } 1214 1215 return state; 1216 } 1217 /** 1218 * Reducer returning the settings. 1219 * 1220 * @param {Object} state Current state. 1221 * @param {Object} action Dispatched action. 1222 * 1223 * @return {Object} Updated state. 1224 */ 1225 1226 function settings() { 1227 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1228 let action = arguments.length > 1 ? arguments[1] : undefined; 1229 1230 switch (action.type) { 1231 case 'UPDATE_SETTINGS': 1232 return { ...state, 1233 ...action.settings 1234 }; 1235 } 1236 1237 return state; 1238 } 1239 /** 1240 * Reducer keeping track of the currently edited Post Type, 1241 * Post Id and the context provided to fill the content of the block editor. 1242 * 1243 * @param {Object} state Current edited post. 1244 * @param {Object} action Dispatched action. 1245 * 1246 * @return {Object} Updated state. 1247 */ 1248 1249 function editedPost() { 1250 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1251 let action = arguments.length > 1 ? arguments[1] : undefined; 1252 1253 switch (action.type) { 1254 case 'SET_TEMPLATE': 1255 case 'SET_PAGE': 1256 return { 1257 type: 'wp_template', 1258 id: action.templateId, 1259 page: action.page 1260 }; 1261 1262 case 'SET_TEMPLATE_PART': 1263 return { 1264 type: 'wp_template_part', 1265 id: action.templatePartId 1266 }; 1267 } 1268 1269 return state; 1270 } 1271 /** 1272 * Reducer for information about the site's homepage. 1273 * 1274 * @param {Object} state Current state. 1275 * @param {Object} action Dispatched action. 1276 * 1277 * @return {Object} Updated state. 1278 */ 1279 1280 function homeTemplateId(state, action) { 1281 switch (action.type) { 1282 case 'SET_HOME_TEMPLATE': 1283 return action.homeTemplateId; 1284 } 1285 1286 return state; 1287 } 1288 /** 1289 * Reducer for information about the navigation panel, such as its active menu 1290 * and whether it should be opened or closed. 1291 * 1292 * Note: this reducer interacts with the inserter and list view panels reducers 1293 * to make sure that only one of the three panels is open at the same time. 1294 * 1295 * @param {Object} state Current state. 1296 * @param {Object} action Dispatched action. 1297 */ 1298 1299 function navigationPanel() { 1300 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 1301 menu: MENU_ROOT, 1302 isOpen: false 1303 }; 1304 let action = arguments.length > 1 ? arguments[1] : undefined; 1305 1306 switch (action.type) { 1307 case 'SET_NAVIGATION_PANEL_ACTIVE_MENU': 1308 return { ...state, 1309 menu: action.menu 1310 }; 1311 1312 case 'OPEN_NAVIGATION_PANEL_TO_MENU': 1313 return { ...state, 1314 isOpen: true, 1315 menu: action.menu 1316 }; 1317 1318 case 'SET_IS_NAVIGATION_PANEL_OPENED': 1319 return { ...state, 1320 menu: !action.isOpen ? MENU_ROOT : state.menu, 1321 // Set menu to root when closing panel. 1322 isOpen: action.isOpen 1323 }; 1324 1325 case 'SET_IS_LIST_VIEW_OPENED': 1326 return { ...state, 1327 menu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, 1328 // Set menu to root when closing panel. 1329 isOpen: action.isOpen ? false : state.isOpen 1330 }; 1331 1332 case 'SET_IS_INSERTER_OPENED': 1333 return { ...state, 1334 menu: state.isOpen && action.value ? MENU_ROOT : state.menu, 1335 // Set menu to root when closing panel. 1336 isOpen: action.value ? false : state.isOpen 1337 }; 1338 } 1339 1340 return state; 1341 } 1342 /** 1343 * Reducer to set the block inserter panel open or closed. 1344 * 1345 * Note: this reducer interacts with the navigation and list view panels reducers 1346 * to make sure that only one of the three panels is open at the same time. 1347 * 1348 * @param {boolean|Object} state Current state. 1349 * @param {Object} action Dispatched action. 1350 */ 1351 1352 function blockInserterPanel() { 1353 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 1354 let action = arguments.length > 1 ? arguments[1] : undefined; 1355 1356 switch (action.type) { 1357 case 'OPEN_NAVIGATION_PANEL_TO_MENU': 1358 return false; 1359 1360 case 'SET_IS_NAVIGATION_PANEL_OPENED': 1361 case 'SET_IS_LIST_VIEW_OPENED': 1362 return action.isOpen ? false : state; 1363 1364 case 'SET_IS_INSERTER_OPENED': 1365 return action.value; 1366 } 1367 1368 return state; 1369 } 1370 /** 1371 * Reducer to set the list view panel open or closed. 1372 * 1373 * Note: this reducer interacts with the navigation and inserter panels reducers 1374 * to make sure that only one of the three panels is open at the same time. 1375 * 1376 * @param {Object} state Current state. 1377 * @param {Object} action Dispatched action. 1378 */ 1379 1380 function listViewPanel() { 1381 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 1382 let action = arguments.length > 1 ? arguments[1] : undefined; 1383 1384 switch (action.type) { 1385 case 'OPEN_NAVIGATION_PANEL_TO_MENU': 1386 return false; 1387 1388 case 'SET_IS_NAVIGATION_PANEL_OPENED': 1389 return action.isOpen ? false : state; 1390 1391 case 'SET_IS_INSERTER_OPENED': 1392 return action.value ? false : state; 1393 1394 case 'SET_IS_LIST_VIEW_OPENED': 1395 return action.isOpen; 1396 } 1397 1398 return state; 1399 } 1400 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 1401 deviceType, 1402 settings, 1403 editedPost, 1404 homeTemplateId, 1405 navigationPanel, 1406 blockInserterPanel, 1407 listViewPanel 1408 })); 1409 1410 ;// CONCATENATED MODULE: external ["wp","apiFetch"] 1411 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 1412 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 1413 ;// CONCATENATED MODULE: external ["wp","deprecated"] 1414 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 1415 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 1416 ;// CONCATENATED MODULE: external ["wp","notices"] 1417 var external_wp_notices_namespaceObject = window["wp"]["notices"]; 1418 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 1419 function extends_extends() { 1420 extends_extends = Object.assign || function (target) { 1421 for (var i = 1; i < arguments.length; i++) { 1422 var source = arguments[i]; 1423 1424 for (var key in source) { 1425 if (Object.prototype.hasOwnProperty.call(source, key)) { 1426 target[key] = source[key]; 1427 } 1428 } 1429 } 1430 1431 return target; 1432 }; 1433 1434 return extends_extends.apply(this, arguments); 1435 } 1436 // EXTERNAL MODULE: ./node_modules/classnames/index.js 1437 var classnames = __webpack_require__(4403); 1438 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 1439 ;// CONCATENATED MODULE: external ["wp","components"] 1440 var external_wp_components_namespaceObject = window["wp"]["components"]; 1441 ;// CONCATENATED MODULE: external ["wp","primitives"] 1442 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 1443 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 1444 1445 1446 /** 1447 * WordPress dependencies 1448 */ 1449 1450 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1451 xmlns: "http://www.w3.org/2000/svg", 1452 viewBox: "0 0 24 24" 1453 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1454 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 1455 })); 1456 /* harmony default export */ var library_check = (check); 1457 1458 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js 1459 1460 1461 /** 1462 * WordPress dependencies 1463 */ 1464 1465 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1466 xmlns: "http://www.w3.org/2000/svg", 1467 viewBox: "0 0 24 24" 1468 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1469 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" 1470 })); 1471 /* harmony default export */ var star_filled = (starFilled); 1472 1473 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js 1474 1475 1476 /** 1477 * WordPress dependencies 1478 */ 1479 1480 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1481 xmlns: "http://www.w3.org/2000/svg", 1482 viewBox: "0 0 24 24" 1483 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1484 fillRule: "evenodd", 1485 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", 1486 clipRule: "evenodd" 1487 })); 1488 /* harmony default export */ var star_empty = (starEmpty); 1489 1490 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 1491 1492 1493 /** 1494 * WordPress dependencies 1495 */ 1496 1497 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1498 xmlns: "http://www.w3.org/2000/svg", 1499 viewBox: "0 0 24 24" 1500 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1501 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" 1502 })); 1503 /* harmony default export */ var close_small = (closeSmall); 1504 1505 ;// CONCATENATED MODULE: external "lodash" 1506 var external_lodash_namespaceObject = window["lodash"]; 1507 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js 1508 /** 1509 * WordPress dependencies 1510 */ 1511 1512 1513 /** 1514 * Enable the complementary area. 1515 * 1516 * @param {string} scope Complementary area scope. 1517 * @param {string} area Area identifier. 1518 */ 1519 1520 const enableComplementaryArea = (scope, area) => _ref => { 1521 let { 1522 registry 1523 } = _ref; 1524 1525 // Return early if there's no area. 1526 if (!area) { 1527 return; 1528 } 1529 1530 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area); 1531 }; 1532 /** 1533 * Disable the complementary area. 1534 * 1535 * @param {string} scope Complementary area scope. 1536 */ 1537 1538 const disableComplementaryArea = scope => _ref2 => { 1539 let { 1540 registry 1541 } = _ref2; 1542 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null); 1543 }; 1544 /** 1545 * Pins an item. 1546 * 1547 * @param {string} scope Item scope. 1548 * @param {string} item Item identifier. 1549 * 1550 * @return {Object} Action object. 1551 */ 1552 1553 const pinItem = (scope, item) => _ref3 => { 1554 let { 1555 registry 1556 } = _ref3; 1557 1558 // Return early if there's no item. 1559 if (!item) { 1560 return; 1561 } 1562 1563 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do. 1564 1565 if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) { 1566 return; 1567 } 1568 1569 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, 1570 [item]: true 1571 }); 1572 }; 1573 /** 1574 * Unpins an item. 1575 * 1576 * @param {string} scope Item scope. 1577 * @param {string} item Item identifier. 1578 */ 1579 1580 const unpinItem = (scope, item) => _ref4 => { 1581 let { 1582 registry 1583 } = _ref4; 1584 1585 // Return early if there's no item. 1586 if (!item) { 1587 return; 1588 } 1589 1590 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 1591 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, 1592 [item]: false 1593 }); 1594 }; 1595 /** 1596 * Returns an action object used in signalling that a feature should be toggled. 1597 * 1598 * @param {string} scope The feature scope (e.g. core/edit-post). 1599 * @param {string} featureName The feature name. 1600 */ 1601 1602 function toggleFeature(scope, featureName) { 1603 return function (_ref5) { 1604 let { 1605 registry 1606 } = _ref5; 1607 external_wp_deprecated_default()(`wp.dispatch( 'core/interface' ).toggleFeature`, { 1608 since: '6.0', 1609 alternative: `wp.dispatch( 'core/preferences' ).toggle` 1610 }); 1611 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 1612 }; 1613 } 1614 /** 1615 * Returns an action object used in signalling that a feature should be set to 1616 * a true or false value 1617 * 1618 * @param {string} scope The feature scope (e.g. core/edit-post). 1619 * @param {string} featureName The feature name. 1620 * @param {boolean} value The value to set. 1621 * 1622 * @return {Object} Action object. 1623 */ 1624 1625 function setFeatureValue(scope, featureName, value) { 1626 return function (_ref6) { 1627 let { 1628 registry 1629 } = _ref6; 1630 external_wp_deprecated_default()(`wp.dispatch( 'core/interface' ).setFeatureValue`, { 1631 since: '6.0', 1632 alternative: `wp.dispatch( 'core/preferences' ).set` 1633 }); 1634 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 1635 }; 1636 } 1637 /** 1638 * Returns an action object used in signalling that defaults should be set for features. 1639 * 1640 * @param {string} scope The feature scope (e.g. core/edit-post). 1641 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 1642 * 1643 * @return {Object} Action object. 1644 */ 1645 1646 function setFeatureDefaults(scope, defaults) { 1647 return function (_ref7) { 1648 let { 1649 registry 1650 } = _ref7; 1651 external_wp_deprecated_default()(`wp.dispatch( 'core/interface' ).setFeatureDefaults`, { 1652 since: '6.0', 1653 alternative: `wp.dispatch( 'core/preferences' ).setDefaults` 1654 }); 1655 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 1656 }; 1657 } 1658 1659 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1660 /** 1661 * WordPress dependencies 1662 */ 1663 1664 1665 1666 /** 1667 * Returns the complementary area that is active in a given scope. 1668 * 1669 * @param {Object} state Global application state. 1670 * @param {string} scope Item scope. 1671 * 1672 * @return {string} The complementary area that is active in the given scope. 1673 */ 1674 1675 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 1676 return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea'); 1677 }); 1678 /** 1679 * Returns a boolean indicating if an item is pinned or not. 1680 * 1681 * @param {Object} state Global application state. 1682 * @param {string} scope Scope. 1683 * @param {string} item Item to check. 1684 * 1685 * @return {boolean} True if the item is pinned and false otherwise. 1686 */ 1687 1688 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 1689 var _pinnedItems$item; 1690 1691 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 1692 return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 1693 }); 1694 /** 1695 * Returns a boolean indicating whether a feature is active for a particular 1696 * scope. 1697 * 1698 * @param {Object} state The store state. 1699 * @param {string} scope The scope of the feature (e.g. core/edit-post). 1700 * @param {string} featureName The name of the feature. 1701 * 1702 * @return {boolean} Is the feature enabled? 1703 */ 1704 1705 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 1706 external_wp_deprecated_default()(`wp.select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 1707 since: '6.0', 1708 alternative: `!! wp.select( 'core/preferences' ).isFeatureActive( scope, featureName )` 1709 }); 1710 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 1711 }); 1712 1713 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js 1714 /** 1715 * The identifier for the data store. 1716 * 1717 * @type {string} 1718 */ 1719 const constants_STORE_NAME = 'core/interface'; 1720 1721 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js 1722 /** 1723 * WordPress dependencies 1724 */ 1725 1726 /** 1727 * Internal dependencies 1728 */ 1729 1730 1731 1732 1733 /** 1734 * Store definition for the interface namespace. 1735 * 1736 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 1737 * 1738 * @type {Object} 1739 */ 1740 1741 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 1742 reducer: () => {}, 1743 actions: actions_namespaceObject, 1744 selectors: selectors_namespaceObject 1745 }); // Once we build a more generic persistence plugin that works across types of stores 1746 // we'd be able to replace this with a register call. 1747 1748 (0,external_wp_data_namespaceObject.register)(store); 1749 1750 ;// CONCATENATED MODULE: external ["wp","plugins"] 1751 var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 1752 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js 1753 /** 1754 * WordPress dependencies 1755 */ 1756 1757 /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 1758 return { 1759 icon: ownProps.icon || context.icon, 1760 identifier: ownProps.identifier || `$context.name}/$ownProps.name}` 1761 }; 1762 })); 1763 1764 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 1765 1766 1767 1768 /** 1769 * External dependencies 1770 */ 1771 1772 /** 1773 * WordPress dependencies 1774 */ 1775 1776 1777 1778 /** 1779 * Internal dependencies 1780 */ 1781 1782 1783 1784 1785 function ComplementaryAreaToggle(_ref) { 1786 let { 1787 as = external_wp_components_namespaceObject.Button, 1788 scope, 1789 identifier, 1790 icon, 1791 selectedIcon, 1792 ...props 1793 } = _ref; 1794 const ComponentToUse = as; 1795 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); 1796 const { 1797 enableComplementaryArea, 1798 disableComplementaryArea 1799 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 1800 return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, extends_extends({ 1801 icon: selectedIcon && isSelected ? selectedIcon : icon, 1802 onClick: () => { 1803 if (isSelected) { 1804 disableComplementaryArea(scope); 1805 } else { 1806 enableComplementaryArea(scope, identifier); 1807 } 1808 } 1809 }, (0,external_lodash_namespaceObject.omit)(props, ['name']))); 1810 } 1811 1812 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); 1813 1814 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 1815 1816 1817 1818 /** 1819 * External dependencies 1820 */ 1821 1822 /** 1823 * WordPress dependencies 1824 */ 1825 1826 1827 /** 1828 * Internal dependencies 1829 */ 1830 1831 1832 1833 const ComplementaryAreaHeader = _ref => { 1834 let { 1835 smallScreenTitle, 1836 children, 1837 className, 1838 toggleButtonProps 1839 } = _ref; 1840 const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ 1841 icon: close_small 1842 }, toggleButtonProps)); 1843 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { 1844 className: "components-panel__header interface-complementary-area-header__small" 1845 }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { 1846 className: "interface-complementary-area-header__small-title" 1847 }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { 1848 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), 1849 tabIndex: -1 1850 }, children, toggleButton)); 1851 }; 1852 1853 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); 1854 1855 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 1856 1857 1858 1859 /** 1860 * External dependencies 1861 */ 1862 1863 /** 1864 * WordPress dependencies 1865 */ 1866 1867 1868 1869 1870 function ActionItemSlot(_ref) { 1871 let { 1872 name, 1873 as: Component = external_wp_components_namespaceObject.ButtonGroup, 1874 fillProps = {}, 1875 bubblesVirtually, 1876 ...props 1877 } = _ref; 1878 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { 1879 name: name, 1880 bubblesVirtually: bubblesVirtually, 1881 fillProps: fillProps 1882 }, fills => { 1883 if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) { 1884 return null; 1885 } // Special handling exists for backward compatibility. 1886 // It ensures that menu items created by plugin authors aren't 1887 // duplicated with automatically injected menu items coming 1888 // from pinnable plugin sidebars. 1889 // @see https://github.com/WordPress/gutenberg/issues/14457 1890 1891 1892 const initializedByPlugins = []; 1893 external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => { 1894 let { 1895 props: { 1896 __unstableExplicitMenuItem, 1897 __unstableTarget 1898 } 1899 } = _ref2; 1900 1901 if (__unstableTarget && __unstableExplicitMenuItem) { 1902 initializedByPlugins.push(__unstableTarget); 1903 } 1904 }); 1905 const children = external_wp_element_namespaceObject.Children.map(fills, child => { 1906 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { 1907 return null; 1908 } 1909 1910 return child; 1911 }); 1912 return (0,external_wp_element_namespaceObject.createElement)(Component, props, children); 1913 }); 1914 } 1915 1916 function ActionItem(_ref3) { 1917 let { 1918 name, 1919 as: Component = external_wp_components_namespaceObject.Button, 1920 onClick, 1921 ...props 1922 } = _ref3; 1923 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { 1924 name: name 1925 }, _ref4 => { 1926 let { 1927 onClick: fpOnClick 1928 } = _ref4; 1929 return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({ 1930 onClick: onClick || fpOnClick ? function () { 1931 (onClick || external_lodash_namespaceObject.noop)(...arguments); 1932 (fpOnClick || external_lodash_namespaceObject.noop)(...arguments); 1933 } : undefined 1934 }, props)); 1935 }); 1936 } 1937 1938 ActionItem.Slot = ActionItemSlot; 1939 /* harmony default export */ var action_item = (ActionItem); 1940 1941 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 1942 1943 1944 1945 /** 1946 * External dependencies 1947 */ 1948 1949 /** 1950 * WordPress dependencies 1951 */ 1952 1953 1954 1955 /** 1956 * Internal dependencies 1957 */ 1958 1959 1960 1961 1962 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. 1963 // They are removed so they don't leak to DOM elements. 1964 // @see https://github.com/WordPress/gutenberg/issues/14457 1965 (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); 1966 1967 function ComplementaryAreaMoreMenuItem(_ref) { 1968 let { 1969 scope, 1970 target, 1971 __unstableExplicitMenuItem, 1972 ...props 1973 } = _ref; 1974 return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ 1975 as: toggleProps => { 1976 return (0,external_wp_element_namespaceObject.createElement)(action_item, extends_extends({ 1977 __unstableExplicitMenuItem: __unstableExplicitMenuItem, 1978 __unstableTarget: `$scope}/$target}`, 1979 as: PluginsMenuItem, 1980 name: `$scope}/plugin-more-menu` 1981 }, toggleProps)); 1982 }, 1983 role: "menuitemcheckbox", 1984 selectedIcon: library_check, 1985 name: target, 1986 scope: scope 1987 }, props)); 1988 } 1989 1990 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 1991 1992 1993 1994 /** 1995 * External dependencies 1996 */ 1997 1998 1999 /** 2000 * WordPress dependencies 2001 */ 2002 2003 2004 2005 function PinnedItems(_ref) { 2006 let { 2007 scope, 2008 ...props 2009 } = _ref; 2010 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, extends_extends({ 2011 name: `PinnedItems/$scope}` 2012 }, props)); 2013 } 2014 2015 function PinnedItemsSlot(_ref2) { 2016 let { 2017 scope, 2018 className, 2019 ...props 2020 } = _ref2; 2021 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ 2022 name: `PinnedItems/$scope}` 2023 }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", { 2024 className: classnames_default()(className, 'interface-pinned-items') 2025 }, fills)); 2026 } 2027 2028 PinnedItems.Slot = PinnedItemsSlot; 2029 /* harmony default export */ var pinned_items = (PinnedItems); 2030 2031 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 2032 2033 2034 2035 /** 2036 * External dependencies 2037 */ 2038 2039 /** 2040 * WordPress dependencies 2041 */ 2042 2043 2044 2045 2046 2047 2048 2049 /** 2050 * Internal dependencies 2051 */ 2052 2053 2054 2055 2056 2057 2058 2059 2060 function ComplementaryAreaSlot(_ref) { 2061 let { 2062 scope, 2063 ...props 2064 } = _ref; 2065 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ 2066 name: `ComplementaryArea/$scope}` 2067 }, props)); 2068 } 2069 2070 function ComplementaryAreaFill(_ref2) { 2071 let { 2072 scope, 2073 children, 2074 className 2075 } = _ref2; 2076 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { 2077 name: `ComplementaryArea/$scope}` 2078 }, (0,external_wp_element_namespaceObject.createElement)("div", { 2079 className: className 2080 }, children)); 2081 } 2082 2083 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 2084 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); 2085 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); 2086 const { 2087 enableComplementaryArea, 2088 disableComplementaryArea 2089 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 2090 (0,external_wp_element_namespaceObject.useEffect)(() => { 2091 // If the complementary area is active and the editor is switching from a big to a small window size. 2092 if (isActive && isSmall && !previousIsSmall.current) { 2093 // Disable the complementary area. 2094 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. 2095 2096 shouldOpenWhenNotSmall.current = true; 2097 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size 2098 // and we are going from a small to big window size. 2099 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { 2100 // Remove the flag indicating the complementary area should be enabled. 2101 shouldOpenWhenNotSmall.current = false; // Enable the complementary area. 2102 2103 enableComplementaryArea(scope, identifier); 2104 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, 2105 // remove the flag. 2106 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { 2107 shouldOpenWhenNotSmall.current = false; 2108 } 2109 2110 if (isSmall !== previousIsSmall.current) { 2111 previousIsSmall.current = isSmall; 2112 } 2113 }, [isActive, isSmall, scope, identifier, activeArea]); 2114 } 2115 2116 function ComplementaryArea(_ref3) { 2117 let { 2118 children, 2119 className, 2120 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), 2121 identifier, 2122 header, 2123 headerClassName, 2124 icon, 2125 isPinnable = true, 2126 panelClassName, 2127 scope, 2128 name, 2129 smallScreenTitle, 2130 title, 2131 toggleShortcut, 2132 isActiveByDefault, 2133 showIconLabels = false 2134 } = _ref3; 2135 const { 2136 isActive, 2137 isPinned, 2138 activeArea, 2139 isSmall, 2140 isLarge 2141 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2142 const { 2143 getActiveComplementaryArea, 2144 isItemPinned 2145 } = select(store); 2146 2147 const _activeArea = getActiveComplementaryArea(scope); 2148 2149 return { 2150 isActive: _activeArea === identifier, 2151 isPinned: isItemPinned(scope, identifier), 2152 activeArea: _activeArea, 2153 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), 2154 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') 2155 }; 2156 }, [identifier, scope]); 2157 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); 2158 const { 2159 enableComplementaryArea, 2160 disableComplementaryArea, 2161 pinItem, 2162 unpinItem 2163 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 2164 (0,external_wp_element_namespaceObject.useEffect)(() => { 2165 if (isActiveByDefault && activeArea === undefined && !isSmall) { 2166 enableComplementaryArea(scope, identifier); 2167 } 2168 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]); 2169 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { 2170 scope: scope 2171 }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { 2172 scope: scope, 2173 identifier: identifier, 2174 isPressed: isActive && (!showIconLabels || isLarge), 2175 "aria-expanded": isActive, 2176 label: title, 2177 icon: showIconLabels ? library_check : icon, 2178 showTooltip: !showIconLabels, 2179 variant: showIconLabels ? 'tertiary' : undefined 2180 })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { 2181 target: name, 2182 scope: scope, 2183 icon: icon 2184 }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { 2185 className: classnames_default()('interface-complementary-area', className), 2186 scope: scope 2187 }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { 2188 className: headerClassName, 2189 closeLabel: closeLabel, 2190 onClose: () => disableComplementaryArea(scope), 2191 smallScreenTitle: smallScreenTitle, 2192 toggleButtonProps: { 2193 label: closeLabel, 2194 shortcut: toggleShortcut, 2195 scope, 2196 identifier 2197 } 2198 }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 2199 className: "interface-complementary-area__pin-unpin-item", 2200 icon: isPinned ? star_filled : star_empty, 2201 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), 2202 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), 2203 isPressed: isPinned, 2204 "aria-expanded": isPinned 2205 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { 2206 className: panelClassName 2207 }, children))); 2208 } 2209 2210 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); 2211 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; 2212 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); 2213 2214 ;// CONCATENATED MODULE: external ["wp","compose"] 2215 var external_wp_compose_namespaceObject = window["wp"]["compose"]; 2216 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 2217 2218 2219 2220 /** 2221 * External dependencies 2222 */ 2223 2224 /** 2225 * WordPress dependencies 2226 */ 2227 2228 /** 2229 * WordPress dependencies 2230 */ 2231 2232 2233 2234 2235 2236 2237 function useHTMLClass(className) { 2238 (0,external_wp_element_namespaceObject.useEffect)(() => { 2239 const element = document && document.querySelector(`html:not(.$className})`); 2240 2241 if (!element) { 2242 return; 2243 } 2244 2245 element.classList.toggle(className); 2246 return () => { 2247 element.classList.toggle(className); 2248 }; 2249 }, [className]); 2250 } 2251 2252 function InterfaceSkeleton(_ref, ref) { 2253 let { 2254 footer, 2255 header, 2256 sidebar, 2257 secondarySidebar, 2258 notices, 2259 content, 2260 drawer, 2261 actions, 2262 labels, 2263 className, 2264 shortcuts 2265 } = _ref; 2266 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); 2267 useHTMLClass('interface-interface-skeleton__html-container'); 2268 const defaultLabels = { 2269 /* translators: accessibility text for the nav bar landmark region. */ 2270 drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'), 2271 2272 /* translators: accessibility text for the top bar landmark region. */ 2273 header: (0,external_wp_i18n_namespaceObject.__)('Header'), 2274 2275 /* translators: accessibility text for the content landmark region. */ 2276 body: (0,external_wp_i18n_namespaceObject.__)('Content'), 2277 2278 /* translators: accessibility text for the secondary sidebar landmark region. */ 2279 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), 2280 2281 /* translators: accessibility text for the settings landmark region. */ 2282 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), 2283 2284 /* translators: accessibility text for the publish landmark region. */ 2285 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), 2286 2287 /* translators: accessibility text for the footer landmark region. */ 2288 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') 2289 }; 2290 const mergedLabels = { ...defaultLabels, 2291 ...labels 2292 }; 2293 return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, navigateRegionsProps, { 2294 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]), 2295 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') 2296 }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", { 2297 className: "interface-interface-skeleton__drawer", 2298 role: "region", 2299 "aria-label": mergedLabels.drawer, 2300 tabIndex: "-1" 2301 }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", { 2302 className: "interface-interface-skeleton__editor" 2303 }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", { 2304 className: "interface-interface-skeleton__header", 2305 role: "region", 2306 "aria-label": mergedLabels.header, 2307 tabIndex: "-1" 2308 }, header), (0,external_wp_element_namespaceObject.createElement)("div", { 2309 className: "interface-interface-skeleton__body" 2310 }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", { 2311 className: "interface-interface-skeleton__secondary-sidebar", 2312 role: "region", 2313 "aria-label": mergedLabels.secondarySidebar, 2314 tabIndex: "-1" 2315 }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { 2316 className: "interface-interface-skeleton__notices" 2317 }, notices), (0,external_wp_element_namespaceObject.createElement)("div", { 2318 className: "interface-interface-skeleton__content", 2319 role: "region", 2320 "aria-label": mergedLabels.body, 2321 tabIndex: "-1" 2322 }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", { 2323 className: "interface-interface-skeleton__sidebar", 2324 role: "region", 2325 "aria-label": mergedLabels.sidebar, 2326 tabIndex: "-1" 2327 }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", { 2328 className: "interface-interface-skeleton__actions", 2329 role: "region", 2330 "aria-label": mergedLabels.actions, 2331 tabIndex: "-1" 2332 }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", { 2333 className: "interface-interface-skeleton__footer", 2334 role: "region", 2335 "aria-label": mergedLabels.footer, 2336 tabIndex: "-1" 2337 }, footer)); 2338 } 2339 2340 /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); 2341 2342 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 2343 2344 2345 /** 2346 * WordPress dependencies 2347 */ 2348 2349 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 2350 xmlns: "http://www.w3.org/2000/svg", 2351 viewBox: "0 0 24 24" 2352 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 2353 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 2354 })); 2355 /* harmony default export */ var more_vertical = (moreVertical); 2356 2357 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js 2358 2359 2360 /** 2361 * External dependencies 2362 */ 2363 2364 /** 2365 * WordPress dependencies 2366 */ 2367 2368 2369 2370 2371 function MoreMenuDropdown(_ref) { 2372 let { 2373 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, 2374 className, 2375 2376 /* translators: button label text should, if possible, be under 16 characters. */ 2377 label = (0,external_wp_i18n_namespaceObject.__)('Options'), 2378 popoverProps, 2379 toggleProps, 2380 children 2381 } = _ref; 2382 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, { 2383 className: classnames_default()('interface-more-menu-dropdown', className), 2384 icon: more_vertical, 2385 label: label, 2386 popoverProps: { 2387 position: 'bottom left', 2388 ...popoverProps, 2389 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className) 2390 }, 2391 toggleProps: { 2392 tooltipPosition: 'bottom', 2393 ...toggleProps 2394 } 2395 }, onClose => children(onClose)); 2396 } 2397 2398 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js 2399 2400 2401 /** 2402 * WordPress dependencies 2403 */ 2404 2405 2406 function PreferencesModal(_ref) { 2407 let { 2408 closeModal, 2409 children 2410 } = _ref; 2411 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 2412 className: "interface-preferences-modal", 2413 title: (0,external_wp_i18n_namespaceObject.__)('Preferences'), 2414 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 2415 onRequestClose: closeModal 2416 }, children); 2417 } 2418 2419 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 2420 /** 2421 * WordPress dependencies 2422 */ 2423 2424 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 2425 2426 /** 2427 * Return an SVG icon. 2428 * 2429 * @param {IconProps} props icon is the SVG component to render 2430 * size is a number specifiying the icon size in pixels 2431 * Other props will be passed to wrapped SVG component 2432 * 2433 * @return {JSX.Element} Icon component 2434 */ 2435 2436 function Icon(_ref) { 2437 let { 2438 icon, 2439 size = 24, 2440 ...props 2441 } = _ref; 2442 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 2443 width: size, 2444 height: size, 2445 ...props 2446 }); 2447 } 2448 2449 /* harmony default export */ var icon = (Icon); 2450 2451 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 2452 2453 2454 /** 2455 * WordPress dependencies 2456 */ 2457 2458 const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 2459 xmlns: "http://www.w3.org/2000/svg", 2460 viewBox: "0 0 24 24" 2461 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 2462 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" 2463 })); 2464 /* harmony default export */ var chevron_left = (chevronLeft); 2465 2466 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 2467 2468 2469 /** 2470 * WordPress dependencies 2471 */ 2472 2473 const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 2474 xmlns: "http://www.w3.org/2000/svg", 2475 viewBox: "0 0 24 24" 2476 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 2477 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" 2478 })); 2479 /* harmony default export */ var chevron_right = (chevronRight); 2480 2481 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js 2482 2483 2484 /** 2485 * WordPress dependencies 2486 */ 2487 2488 2489 2490 2491 2492 const PREFERENCES_MENU = 'preferences-menu'; 2493 function PreferencesModalTabs(_ref) { 2494 let { 2495 sections 2496 } = _ref; 2497 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components 2498 // between small and large viewports. 2499 2500 const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU); 2501 /** 2502 * Create helper objects from `sections` for easier data handling. 2503 * `tabs` is used for creating the `TabPanel` and `sectionsContentMap` 2504 * is used for easier access to active tab's content. 2505 */ 2506 2507 const { 2508 tabs, 2509 sectionsContentMap 2510 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 2511 let mappedTabs = { 2512 tabs: [], 2513 sectionsContentMap: {} 2514 }; 2515 2516 if (sections.length) { 2517 mappedTabs = sections.reduce((accumulator, _ref2) => { 2518 let { 2519 name, 2520 tabLabel: title, 2521 content 2522 } = _ref2; 2523 accumulator.tabs.push({ 2524 name, 2525 title 2526 }); 2527 accumulator.sectionsContentMap[name] = content; 2528 return accumulator; 2529 }, { 2530 tabs: [], 2531 sectionsContentMap: {} 2532 }); 2533 } 2534 2535 return mappedTabs; 2536 }, [sections]); 2537 const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]); 2538 let modalContent; // We render different components based on the viewport size. 2539 2540 if (isLargeViewport) { 2541 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { 2542 className: "interface-preferences__tabs", 2543 tabs: tabs, 2544 initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined, 2545 onSelect: setActiveMenu, 2546 orientation: "vertical" 2547 }, getCurrentTab); 2548 } else { 2549 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 2550 initialPath: "/", 2551 className: "interface-preferences__provider" 2552 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 2553 path: "/" 2554 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { 2555 isBorderless: true, 2556 size: "small" 2557 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => { 2558 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { 2559 key: tab.name, 2560 path: tab.name, 2561 as: external_wp_components_namespaceObject.__experimentalItem, 2562 isAction: true 2563 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 2564 justify: "space-between" 2565 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { 2566 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 2567 })))); 2568 }))))), sections.length && sections.map(section => { 2569 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { 2570 key: `$section.name}-menu`, 2571 path: section.name 2572 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { 2573 isBorderless: true, 2574 size: "large" 2575 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, { 2576 isBorderless: false, 2577 justify: "left", 2578 size: "small", 2579 gap: "6" 2580 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { 2581 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 2582 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') 2583 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { 2584 size: "16" 2585 }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content))); 2586 })); 2587 } 2588 2589 return modalContent; 2590 } 2591 2592 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js 2593 2594 2595 const Section = _ref => { 2596 let { 2597 description, 2598 title, 2599 children 2600 } = _ref; 2601 return (0,external_wp_element_namespaceObject.createElement)("fieldset", { 2602 className: "interface-preferences-modal__section" 2603 }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("h2", { 2604 className: "interface-preferences-modal__section-title" 2605 }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", { 2606 className: "interface-preferences-modal__section-description" 2607 }, description)), children); 2608 }; 2609 2610 /* harmony default export */ var preferences_modal_section = (Section); 2611 2612 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js 2613 2614 2615 /** 2616 * WordPress dependencies 2617 */ 2618 2619 2620 function BaseOption(_ref) { 2621 let { 2622 help, 2623 label, 2624 isChecked, 2625 onChange, 2626 children 2627 } = _ref; 2628 return (0,external_wp_element_namespaceObject.createElement)("div", { 2629 className: "interface-preferences-modal__option" 2630 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { 2631 help: help, 2632 label: label, 2633 checked: isChecked, 2634 onChange: onChange 2635 }), children); 2636 } 2637 2638 /* harmony default export */ var preferences_modal_base_option = (BaseOption); 2639 2640 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js 2655 2656 2657 2658 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 2659 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 2660 ;// CONCATENATED MODULE: external ["wp","a11y"] 2661 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 2662 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js 2663 /** 2664 * Check if a template is revertable to its original theme-provided template file. 2665 * 2666 * @param {Object} template The template entity to check. 2667 * @return {boolean} Whether the template is revertable. 2668 */ 2669 function isTemplateRevertable(template) { 2670 if (!template) { 2671 return false; 2672 } 2673 /* eslint-disable camelcase */ 2674 2675 2676 return (template === null || template === void 0 ? void 0 : template.source) === 'custom' && (template === null || template === void 0 ? void 0 : template.has_theme_file); 2677 /* eslint-enable camelcase */ 2678 } 2679 2680 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 2681 /** 2682 * WordPress dependencies 2683 */ 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 /** 2696 * Internal dependencies 2697 */ 2698 2699 2700 2701 /** 2702 * Dispatches an action that toggles a feature flag. 2703 * 2704 * @param {string} featureName Feature name. 2705 */ 2706 2707 function actions_toggleFeature(featureName) { 2708 return function (_ref) { 2709 let { 2710 registry 2711 } = _ref; 2712 external_wp_deprecated_default()("select( 'core/edit-site' ).toggleFeature( featureName )", { 2713 since: '6.0', 2714 alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )" 2715 }); 2716 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); 2717 }; 2718 } 2719 /** 2720 * Action that changes the width of the editing canvas. 2721 * 2722 * @param {string} deviceType 2723 * 2724 * @return {Object} Action object. 2725 */ 2726 2727 function __experimentalSetPreviewDeviceType(deviceType) { 2728 return { 2729 type: 'SET_PREVIEW_DEVICE_TYPE', 2730 deviceType 2731 }; 2732 } 2733 /** 2734 * Action that sets a template, optionally fetching it from REST API. 2735 * 2736 * @param {number} templateId The template ID. 2737 * @param {string} templateSlug The template slug. 2738 * @return {Object} Action object. 2739 */ 2740 2741 const setTemplate = (templateId, templateSlug) => async _ref2 => { 2742 let { 2743 dispatch, 2744 registry 2745 } = _ref2; 2746 2747 if (!templateSlug) { 2748 const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId); 2749 templateSlug = template === null || template === void 0 ? void 0 : template.slug; 2750 } 2751 2752 dispatch({ 2753 type: 'SET_TEMPLATE', 2754 templateId, 2755 page: { 2756 context: { 2757 templateSlug 2758 } 2759 } 2760 }); 2761 }; 2762 /** 2763 * Action that adds a new template and sets it as the current template. 2764 * 2765 * @param {Object} template The template. 2766 * 2767 * @return {Object} Action object used to set the current template. 2768 */ 2769 2770 const addTemplate = template => async _ref3 => { 2771 let { 2772 dispatch, 2773 registry 2774 } = _ref3; 2775 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); 2776 2777 if (template.content) { 2778 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', 'wp_template', newTemplate.id, { 2779 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) 2780 }, { 2781 undoIgnore: true 2782 }); 2783 } 2784 2785 dispatch({ 2786 type: 'SET_TEMPLATE', 2787 templateId: newTemplate.id, 2788 page: { 2789 context: { 2790 templateSlug: newTemplate.slug 2791 } 2792 } 2793 }); 2794 }; 2795 /** 2796 * Action that removes a template. 2797 * 2798 * @param {Object} template The template object. 2799 */ 2800 2801 const removeTemplate = template => async _ref4 => { 2802 let { 2803 registry 2804 } = _ref4; 2805 2806 try { 2807 await registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', template.type, template.id, { 2808 force: true 2809 }); 2810 const lastError = registry.select(external_wp_coreData_namespaceObject.store).getLastEntityDeleteError('postType', template.type, template.id); 2811 2812 if (lastError) { 2813 throw lastError; 2814 } 2815 2816 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 2817 /* translators: The template/part's name. */ 2818 (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), template.title.rendered), { 2819 type: 'snackbar' 2820 }); 2821 } catch (error) { 2822 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.'); 2823 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 2824 type: 'snackbar' 2825 }); 2826 } 2827 }; 2828 /** 2829 * Action that sets a template part. 2830 * 2831 * @param {string} templatePartId The template part ID. 2832 * 2833 * @return {Object} Action object. 2834 */ 2835 2836 function setTemplatePart(templatePartId) { 2837 return { 2838 type: 'SET_TEMPLATE_PART', 2839 templatePartId 2840 }; 2841 } 2842 /** 2843 * Action that sets the home template ID to the template ID of the page resolved 2844 * from a given path. 2845 * 2846 * @param {number} homeTemplateId The template ID for the homepage. 2847 */ 2848 2849 function setHomeTemplateId(homeTemplateId) { 2850 return { 2851 type: 'SET_HOME_TEMPLATE', 2852 homeTemplateId 2853 }; 2854 } 2855 /** 2856 * Resolves the template for a page and displays both. If no path is given, attempts 2857 * to use the postId to generate a path like `?p=${ postId }`. 2858 * 2859 * @param {Object} page The page object. 2860 * @param {string} page.type The page type. 2861 * @param {string} page.slug The page slug. 2862 * @param {string} page.path The page path. 2863 * @param {Object} page.context The page context. 2864 * 2865 * @return {number} The resolved template ID for the page route. 2866 */ 2867 2868 const setPage = page => async _ref5 => { 2869 var _page$context; 2870 2871 let { 2872 dispatch, 2873 registry 2874 } = _ref5; 2875 2876 if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) { 2877 const entity = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', page.context.postType || 'post', page.context.postId); // If the entity is undefined for some reason, path will resolve to "/" 2878 2879 page.path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link); 2880 } 2881 2882 const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(page.path); 2883 2884 if (!template) { 2885 return; 2886 } 2887 2888 dispatch({ 2889 type: 'SET_PAGE', 2890 page: template.slug ? { ...page, 2891 context: { ...page.context, 2892 templateSlug: template.slug 2893 } 2894 } : page, 2895 templateId: template.id 2896 }); 2897 return template.id; 2898 }; 2899 /** 2900 * Action that sets the active navigation panel menu. 2901 * 2902 * @param {string} menu Menu prop of active menu. 2903 * 2904 * @return {Object} Action object. 2905 */ 2906 2907 function setNavigationPanelActiveMenu(menu) { 2908 return { 2909 type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU', 2910 menu 2911 }; 2912 } 2913 /** 2914 * Opens the navigation panel and sets its active menu at the same time. 2915 * 2916 * @param {string} menu Identifies the menu to open. 2917 */ 2918 2919 function openNavigationPanelToMenu(menu) { 2920 return { 2921 type: 'OPEN_NAVIGATION_PANEL_TO_MENU', 2922 menu 2923 }; 2924 } 2925 /** 2926 * Sets whether the navigation panel should be open. 2927 * 2928 * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It 2929 * does not toggle the state, but sets it directly. 2930 */ 2931 2932 function setIsNavigationPanelOpened(isOpen) { 2933 return { 2934 type: 'SET_IS_NAVIGATION_PANEL_OPENED', 2935 isOpen 2936 }; 2937 } 2938 /** 2939 * Opens or closes the inserter. 2940 * 2941 * @param {boolean|Object} value Whether the inserter should be 2942 * opened (true) or closed (false). 2943 * To specify an insertion point, 2944 * use an object. 2945 * @param {string} value.rootClientId The root client ID to insert at. 2946 * @param {number} value.insertionIndex The index to insert at. 2947 * 2948 * @return {Object} Action object. 2949 */ 2950 2951 function setIsInserterOpened(value) { 2952 return { 2953 type: 'SET_IS_INSERTER_OPENED', 2954 value 2955 }; 2956 } 2957 /** 2958 * Returns an action object used to update the settings. 2959 * 2960 * @param {Object} settings New settings. 2961 * 2962 * @return {Object} Action object. 2963 */ 2964 2965 function updateSettings(settings) { 2966 return { 2967 type: 'UPDATE_SETTINGS', 2968 settings 2969 }; 2970 } 2971 /** 2972 * Sets whether the list view panel should be open. 2973 * 2974 * @param {boolean} isOpen If true, opens the list view. If false, closes it. 2975 * It does not toggle the state, but sets it directly. 2976 */ 2977 2978 function setIsListViewOpened(isOpen) { 2979 return { 2980 type: 'SET_IS_LIST_VIEW_OPENED', 2981 isOpen 2982 }; 2983 } 2984 /** 2985 * Reverts a template to its original theme-provided file. 2986 * 2987 * @param {Object} template The template to revert. 2988 * @param {Object} [options] 2989 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 2990 * reverting the template. Default true. 2991 */ 2992 2993 const revertTemplate = function (template) { 2994 let { 2995 allowUndo = true 2996 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2997 return async _ref6 => { 2998 let { 2999 registry 3000 } = _ref6; 3001 3002 if (!isTemplateRevertable(template)) { 3003 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { 3004 type: 'snackbar' 3005 }); 3006 return; 3007 } 3008 3009 try { 3010 var _fileTemplate$content; 3011 3012 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); 3013 3014 if (!templateEntityConfig) { 3015 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 3016 type: 'snackbar' 3017 }); 3018 return; 3019 } 3020 3021 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`$templateEntityConfig.baseURL}/$template.id}`, { 3022 context: 'edit', 3023 source: 'theme' 3024 }); 3025 const fileTemplate = await external_wp_apiFetch_default()({ 3026 path: fileTemplatePath 3027 }); 3028 3029 if (!fileTemplate) { 3030 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 3031 type: 'snackbar' 3032 }); 3033 return; 3034 } 3035 3036 const serializeBlocks = _ref7 => { 3037 let { 3038 blocks: blocksForSerialization = [] 3039 } = _ref7; 3040 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 3041 }; 3042 3043 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo 3044 // the revert in the header toolbar correctly. 3045 3046 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { 3047 content: serializeBlocks, 3048 // Required to make the `undo` behave correctly. 3049 blocks: edited.blocks, 3050 // Required to revert the blocks in the editor. 3051 source: 'custom' // required to avoid turning the editor into a dirty state 3052 3053 }, { 3054 undoIgnore: true // Required to merge this edit with the last undo level. 3055 3056 }); 3057 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate === null || fileTemplate === void 0 ? void 0 : (_fileTemplate$content = fileTemplate.content) === null || _fileTemplate$content === void 0 ? void 0 : _fileTemplate$content.raw); 3058 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { 3059 content: serializeBlocks, 3060 blocks, 3061 source: 'theme' 3062 }); 3063 3064 if (allowUndo) { 3065 const undoRevert = () => { 3066 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { 3067 content: serializeBlocks, 3068 blocks: edited.blocks, 3069 source: 'custom' 3070 }); 3071 }; 3072 3073 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'), { 3074 type: 'snackbar', 3075 actions: [{ 3076 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 3077 onClick: undoRevert 3078 }] 3079 }); 3080 } else { 3081 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.')); 3082 } 3083 } catch (error) { 3084 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); 3085 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 3086 type: 'snackbar' 3087 }); 3088 } 3089 }; 3090 }; 3091 /** 3092 * Action that opens an editor sidebar. 3093 * 3094 * @param {?string} name Sidebar name to be opened. 3095 */ 3096 3097 const openGeneralSidebar = name => _ref8 => { 3098 let { 3099 registry 3100 } = _ref8; 3101 registry.dispatch(store).enableComplementaryArea(STORE_NAME, name); 3102 }; 3103 /** 3104 * Action that closes the sidebar. 3105 */ 3106 3107 const closeGeneralSidebar = () => _ref9 => { 3108 let { 3109 registry 3110 } = _ref9; 3111 registry.dispatch(store).disableComplementaryArea(STORE_NAME); 3112 }; 3113 const switchEditorMode = mode => _ref10 => { 3114 let { 3115 registry 3116 } = _ref10; 3117 registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode); // Unselect blocks when we switch to a non visual mode. 3118 3119 if (mode !== 'visual') { 3120 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 3121 } 3122 3123 if (mode === 'visual') { 3124 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); 3125 } else if (mode === 'mosaic') { 3126 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Mosaic view selected'), 'assertive'); 3127 } 3128 }; 3129 3130 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js 3131 3132 3133 var LEAF_KEY, hasWeakMap; 3134 3135 /** 3136 * Arbitrary value used as key for referencing cache object in WeakMap tree. 3137 * 3138 * @type {Object} 3139 */ 3140 LEAF_KEY = {}; 3141 3142 /** 3143 * Whether environment supports WeakMap. 3144 * 3145 * @type {boolean} 3146 */ 3147 hasWeakMap = typeof WeakMap !== 'undefined'; 3148 3149 /** 3150 * Returns the first argument as the sole entry in an array. 3151 * 3152 * @param {*} value Value to return. 3153 * 3154 * @return {Array} Value returned as entry in array. 3155 */ 3156 function arrayOf( value ) { 3157 return [ value ]; 3158 } 3159 3160 /** 3161 * Returns true if the value passed is object-like, or false otherwise. A value 3162 * is object-like if it can support property assignment, e.g. object or array. 3163 * 3164 * @param {*} value Value to test. 3165 * 3166 * @return {boolean} Whether value is object-like. 3167 */ 3168 function isObjectLike( value ) { 3169 return !! value && 'object' === typeof value; 3170 } 3171 3172 /** 3173 * Creates and returns a new cache object. 3174 * 3175 * @return {Object} Cache object. 3176 */ 3177 function createCache() { 3178 var cache = { 3179 clear: function() { 3180 cache.head = null; 3181 }, 3182 }; 3183 3184 return cache; 3185 } 3186 3187 /** 3188 * Returns true if entries within the two arrays are strictly equal by 3189 * reference from a starting index. 3190 * 3191 * @param {Array} a First array. 3192 * @param {Array} b Second array. 3193 * @param {number} fromIndex Index from which to start comparison. 3194 * 3195 * @return {boolean} Whether arrays are shallowly equal. 3196 */ 3197 function isShallowEqual( a, b, fromIndex ) { 3198 var i; 3199 3200 if ( a.length !== b.length ) { 3201 return false; 3202 } 3203 3204 for ( i = fromIndex; i < a.length; i++ ) { 3205 if ( a[ i ] !== b[ i ] ) { 3206 return false; 3207 } 3208 } 3209 3210 return true; 3211 } 3212 3213 /** 3214 * Returns a memoized selector function. The getDependants function argument is 3215 * called before the memoized selector and is expected to return an immutable 3216 * reference or array of references on which the selector depends for computing 3217 * its own return value. The memoize cache is preserved only as long as those 3218 * dependant references remain the same. If getDependants returns a different 3219 * reference(s), the cache is cleared and the selector value regenerated. 3220 * 3221 * @param {Function} selector Selector function. 3222 * @param {Function} getDependants Dependant getter returning an immutable 3223 * reference or array of reference used in 3224 * cache bust consideration. 3225 * 3226 * @return {Function} Memoized selector. 3227 */ 3228 /* harmony default export */ function rememo(selector, getDependants ) { 3229 var rootCache, getCache; 3230 3231 // Use object source as dependant if getter not provided 3232 if ( ! getDependants ) { 3233 getDependants = arrayOf; 3234 } 3235 3236 /** 3237 * Returns the root cache. If WeakMap is supported, this is assigned to the 3238 * root WeakMap cache set, otherwise it is a shared instance of the default 3239 * cache object. 3240 * 3241 * @return {(WeakMap|Object)} Root cache object. 3242 */ 3243 function getRootCache() { 3244 return rootCache; 3245 } 3246 3247 /** 3248 * Returns the cache for a given dependants array. When possible, a WeakMap 3249 * will be used to create a unique cache for each set of dependants. This 3250 * is feasible due to the nature of WeakMap in allowing garbage collection 3251 * to occur on entries where the key object is no longer referenced. Since 3252 * WeakMap requires the key to be an object, this is only possible when the 3253 * dependant is object-like. The root cache is created as a hierarchy where 3254 * each top-level key is the first entry in a dependants set, the value a 3255 * WeakMap where each key is the next dependant, and so on. This continues 3256 * so long as the dependants are object-like. If no dependants are object- 3257 * like, then the cache is shared across all invocations. 3258 * 3259 * @see isObjectLike 3260 * 3261 * @param {Array} dependants Selector dependants. 3262 * 3263 * @return {Object} Cache object. 3264 */ 3265 function getWeakMapCache( dependants ) { 3266 var caches = rootCache, 3267 isUniqueByDependants = true, 3268 i, dependant, map, cache; 3269 3270 for ( i = 0; i < dependants.length; i++ ) { 3271 dependant = dependants[ i ]; 3272 3273 // Can only compose WeakMap from object-like key. 3274 if ( ! isObjectLike( dependant ) ) { 3275 isUniqueByDependants = false; 3276 break; 3277 } 3278 3279 // Does current segment of cache already have a WeakMap? 3280 if ( caches.has( dependant ) ) { 3281 // Traverse into nested WeakMap. 3282 caches = caches.get( dependant ); 3283 } else { 3284 // Create, set, and traverse into a new one. 3285 map = new WeakMap(); 3286 caches.set( dependant, map ); 3287 caches = map; 3288 } 3289 } 3290 3291 // We use an arbitrary (but consistent) object as key for the last item 3292 // in the WeakMap to serve as our running cache. 3293 if ( ! caches.has( LEAF_KEY ) ) { 3294 cache = createCache(); 3295 cache.isUniqueByDependants = isUniqueByDependants; 3296 caches.set( LEAF_KEY, cache ); 3297 } 3298 3299 return caches.get( LEAF_KEY ); 3300 } 3301 3302 // Assign cache handler by availability of WeakMap 3303 getCache = hasWeakMap ? getWeakMapCache : getRootCache; 3304 3305 /** 3306 * Resets root memoization cache. 3307 */ 3308 function clear() { 3309 rootCache = hasWeakMap ? new WeakMap() : createCache(); 3310 } 3311 3312 // eslint-disable-next-line jsdoc/check-param-names 3313 /** 3314 * The augmented selector call, considering first whether dependants have 3315 * changed before passing it to underlying memoize function. 3316 * 3317 * @param {Object} source Source object for derivation. 3318 * @param {...*} extraArgs Additional arguments to pass to selector. 3319 * 3320 * @return {*} Selector result. 3321 */ 3322 function callSelector( /* source, ...extraArgs */ ) { 3323 var len = arguments.length, 3324 cache, node, i, args, dependants; 3325 3326 // Create copy of arguments (avoid leaking deoptimization). 3327 args = new Array( len ); 3328 for ( i = 0; i < len; i++ ) { 3329 args[ i ] = arguments[ i ]; 3330 } 3331 3332 dependants = getDependants.apply( null, args ); 3333 cache = getCache( dependants ); 3334 3335 // If not guaranteed uniqueness by dependants (primitive type or lack 3336 // of WeakMap support), shallow compare against last dependants and, if 3337 // references have changed, destroy cache to recalculate result. 3338 if ( ! cache.isUniqueByDependants ) { 3339 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { 3340 cache.clear(); 3341 } 3342 3343 cache.lastDependants = dependants; 3344 } 3345 3346 node = cache.head; 3347 while ( node ) { 3348 // Check whether node arguments match arguments 3349 if ( ! isShallowEqual( node.args, args, 1 ) ) { 3350 node = node.next; 3351 continue; 3352 } 3353 3354 // At this point we can assume we've found a match 3355 3356 // Surface matched node to head if not already 3357 if ( node !== cache.head ) { 3358 // Adjust siblings to point to each other. 3359 node.prev.next = node.next; 3360 if ( node.next ) { 3361 node.next.prev = node.prev; 3362 } 3363 3364 node.next = cache.head; 3365 node.prev = null; 3366 cache.head.prev = node; 3367 cache.head = node; 3368 } 3369 3370 // Return immediately 3371 return node.val; 3372 } 3373 3374 // No cached value found. Continue to insertion phase: 3375 3376 node = { 3377 // Generate the result from original function 3378 val: selector.apply( null, args ), 3379 }; 3380 3381 // Avoid including the source object in the cache. 3382 args[ 0 ] = null; 3383 node.args = args; 3384 3385 // Don't need to check whether node is already head, since it would 3386 // have been returned above already if it was 3387 3388 // Shift existing head down list 3389 if ( cache.head ) { 3390 cache.head.prev = node; 3391 node.next = cache.head; 3392 } 3393 3394 cache.head = node; 3395 3396 return node.val; 3397 } 3398 3399 callSelector.getDependants = getDependants; 3400 callSelector.clear = clear; 3401 clear(); 3402 3403 return callSelector; 3404 } 3405 3406 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js 3407 /** 3408 * External dependencies 3409 */ 3410 3411 /** 3412 * Internal dependencies 3413 */ 3414 3415 3416 function isTemplateSuperseded(slug, existingSlugs, showOnFront) { 3417 if (!TEMPLATE_OVERRIDES[slug]) { 3418 return false; 3419 } // `home` template is unused if it is superseded by `front-page` 3420 // or "show on front" is set to show a page rather than blog posts. 3421 3422 3423 if (slug === 'home' && showOnFront !== 'posts') { 3424 return true; 3425 } 3426 3427 return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront)); 3428 } 3429 function getTemplateLocation(slug) { 3430 const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug); 3431 3432 if (isTopLevelTemplate) { 3433 return MENU_TEMPLATES; 3434 } 3435 3436 const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug); 3437 3438 if (isGeneralTemplate) { 3439 return MENU_TEMPLATES_GENERAL; 3440 } 3441 3442 const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix)); 3443 3444 if (isPostsTemplate) { 3445 return MENU_TEMPLATES_POSTS; 3446 } 3447 3448 const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix)); 3449 3450 if (isPagesTemplate) { 3451 return MENU_TEMPLATES_PAGES; 3452 } 3453 3454 return MENU_TEMPLATES_GENERAL; 3455 } 3456 function getUnusedTemplates(templates, showOnFront) { 3457 const templateSlugs = map(templates, 'slug'); 3458 const supersededTemplates = templates.filter(_ref => { 3459 let { 3460 slug 3461 } = _ref; 3462 return isTemplateSuperseded(slug, templateSlugs, showOnFront); 3463 }); 3464 return supersededTemplates; 3465 } 3466 function getTemplatesLocationMap(templates) { 3467 return templates.reduce((obj, template) => { 3468 obj[template.slug] = getTemplateLocation(template.slug); 3469 return obj; 3470 }, {}); 3471 } 3472 3473 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 3474 /** 3475 * External dependencies 3476 */ 3477 3478 3479 /** 3480 * WordPress dependencies 3481 */ 3482 3483 3484 3485 3486 3487 3488 3489 3490 /** 3491 * Internal dependencies 3492 */ 3493 3494 3495 3496 /** 3497 * @typedef {'template'|'template_type'} TemplateType Template type. 3498 */ 3499 3500 /** 3501 * Helper for getting a preference from the preferences store. 3502 * 3503 * This is only present so that `getSettings` doesn't need to be made a 3504 * registry selector. 3505 * 3506 * It's unstable because the selector needs to be exported and so part of the 3507 * public API to work. 3508 */ 3509 3510 const __unstableGetPreference = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, name) => select(external_wp_preferences_namespaceObject.store).get('core/edit-site', name)); 3511 /** 3512 * Returns whether the given feature is enabled or not. 3513 * 3514 * @param {Object} state Global application state. 3515 * @param {string} featureName Feature slug. 3516 * 3517 * @return {boolean} Is active. 3518 */ 3519 3520 function selectors_isFeatureActive(state, featureName) { 3521 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive`, { 3522 since: '6.0', 3523 alternative: `select( 'core/preferences' ).get` 3524 }); 3525 return !!__unstableGetPreference(state, featureName); 3526 } 3527 /** 3528 * Returns the current editing canvas device type. 3529 * 3530 * @param {Object} state Global application state. 3531 * 3532 * @return {string} Device type. 3533 */ 3534 3535 function __experimentalGetPreviewDeviceType(state) { 3536 return state.deviceType; 3537 } 3538 /** 3539 * Returns whether the current user can create media or not. 3540 * 3541 * @param {Object} state Global application state. 3542 * 3543 * @return {Object} Whether the current user can create media or not. 3544 */ 3545 3546 const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => select(external_wp_coreData_namespaceObject.store).canUser('create', 'media')); 3547 /** 3548 * Returns any available Reusable blocks. 3549 * 3550 * @param {Object} state Global application state. 3551 * 3552 * @return {Array} The available reusable blocks. 3553 */ 3554 3555 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3556 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; 3557 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { 3558 per_page: -1 3559 }) : []; 3560 }); 3561 /** 3562 * Returns the settings, taking into account active features and permissions. 3563 * 3564 * @param {Object} state Global application state. 3565 * @param {Function} setIsInserterOpen Setter for the open state of the global inserter. 3566 * 3567 * @return {Object} Settings. 3568 */ 3569 3570 const getSettings = rememo((state, setIsInserterOpen) => { 3571 const settings = { ...state.settings, 3572 outlineMode: true, 3573 focusMode: !!__unstableGetPreference(state, 'focusMode'), 3574 hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'), 3575 keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'), 3576 showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'), 3577 __experimentalSetIsInserterOpened: setIsInserterOpen, 3578 __experimentalReusableBlocks: getReusableBlocks(state), 3579 __experimentalPreferPatternsOnRoot: 'wp_template' === getEditedPostType(state) 3580 }; 3581 const canUserCreateMedia = getCanUserCreateMedia(state); 3582 3583 if (!canUserCreateMedia) { 3584 return settings; 3585 } 3586 3587 settings.mediaUpload = _ref => { 3588 let { 3589 onError, 3590 ...rest 3591 } = _ref; 3592 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 3593 wpAllowedMimeTypes: state.settings.allowedMimeTypes, 3594 onError: _ref2 => { 3595 let { 3596 message 3597 } = _ref2; 3598 return onError(message); 3599 }, 3600 ...rest 3601 }); 3602 }; 3603 3604 return settings; 3605 }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]); 3606 /** 3607 * Returns the current home template ID. 3608 * 3609 * @param {Object} state Global application state. 3610 * 3611 * @return {number?} Home template ID. 3612 */ 3613 3614 function getHomeTemplateId(state) { 3615 return state.homeTemplateId; 3616 } 3617 3618 function getCurrentEditedPost(state) { 3619 return state.editedPost; 3620 } 3621 /** 3622 * Returns the current edited post type (wp_template or wp_template_part). 3623 * 3624 * @param {Object} state Global application state. 3625 * 3626 * @return {TemplateType?} Template type. 3627 */ 3628 3629 3630 function getEditedPostType(state) { 3631 return getCurrentEditedPost(state).type; 3632 } 3633 /** 3634 * Returns the ID of the currently edited template or template part. 3635 * 3636 * @param {Object} state Global application state. 3637 * 3638 * @return {string?} Post ID. 3639 */ 3640 3641 function getEditedPostId(state) { 3642 return getCurrentEditedPost(state).id; 3643 } 3644 /** 3645 * Returns the current page object. 3646 * 3647 * @param {Object} state Global application state. 3648 * 3649 * @return {Object} Page. 3650 */ 3651 3652 function getPage(state) { 3653 return getCurrentEditedPost(state).page; 3654 } 3655 /** 3656 * Returns the active menu in the navigation panel. 3657 * 3658 * @param {Object} state Global application state. 3659 * 3660 * @return {string} Active menu. 3661 */ 3662 3663 function getNavigationPanelActiveMenu(state) { 3664 return state.navigationPanel.menu; 3665 } 3666 /** 3667 * Returns the current template or template part's corresponding 3668 * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`. 3669 * 3670 * @param {Object} state Global application state. 3671 * 3672 * @return {string} The current template or template part's sub menu. 3673 */ 3674 3675 const getCurrentTemplateNavigationPanelSubMenu = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3676 const templateType = getEditedPostType(state); 3677 const templateId = getEditedPostId(state); 3678 const template = templateId ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', templateType, templateId) : null; 3679 3680 if (!template) { 3681 return MENU_ROOT; 3682 } 3683 3684 if ('wp_template_part' === templateType) { 3685 var _TEMPLATE_PARTS_SUB_M; 3686 3687 return ((_TEMPLATE_PARTS_SUB_M = TEMPLATE_PARTS_SUB_MENUS.find(submenu => submenu.area === (template === null || template === void 0 ? void 0 : template.area))) === null || _TEMPLATE_PARTS_SUB_M === void 0 ? void 0 : _TEMPLATE_PARTS_SUB_M.menu) || MENU_TEMPLATE_PARTS; 3688 } 3689 3690 const templates = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template'); 3691 const showOnFront = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'site').show_on_front; 3692 3693 if (isTemplateSuperseded(template.slug, (0,external_lodash_namespaceObject.map)(templates, 'slug'), showOnFront)) { 3694 return MENU_TEMPLATES_UNUSED; 3695 } 3696 3697 return getTemplateLocation(template.slug); 3698 }); 3699 /** 3700 * Returns the current opened/closed state of the navigation panel. 3701 * 3702 * @param {Object} state Global application state. 3703 * 3704 * @return {boolean} True if the navigation panel should be open; false if closed. 3705 */ 3706 3707 function isNavigationOpened(state) { 3708 return state.navigationPanel.isOpen; 3709 } 3710 /** 3711 * Returns the current opened/closed state of the inserter panel. 3712 * 3713 * @param {Object} state Global application state. 3714 * 3715 * @return {boolean} True if the inserter panel should be open; false if closed. 3716 */ 3717 3718 function isInserterOpened(state) { 3719 return !!state.blockInserterPanel; 3720 } 3721 /** 3722 * Get the insertion point for the inserter. 3723 * 3724 * @param {Object} state Global application state. 3725 * 3726 * @return {Object} The root client ID, index to insert at and starting filter value. 3727 */ 3728 3729 function __experimentalGetInsertionPoint(state) { 3730 const { 3731 rootClientId, 3732 insertionIndex, 3733 filterValue 3734 } = state.blockInserterPanel; 3735 return { 3736 rootClientId, 3737 insertionIndex, 3738 filterValue 3739 }; 3740 } 3741 /** 3742 * Returns the current opened/closed state of the list view panel. 3743 * 3744 * @param {Object} state Global application state. 3745 * 3746 * @return {boolean} True if the list view panel should be open; false if closed. 3747 */ 3748 3749 function isListViewOpened(state) { 3750 return state.listViewPanel; 3751 } 3752 /** 3753 * Returns the template parts and their blocks for the current edited template. 3754 * 3755 * @param {Object} state Global application state. 3756 * @return {Array} Template parts and their blocks in an array. 3757 */ 3758 3759 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3760 var _template$blocks; 3761 3762 const templateType = getEditedPostType(state); 3763 const templateId = getEditedPostId(state); 3764 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', templateType, templateId); 3765 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', { 3766 per_page: -1 3767 }); 3768 const templatePartsById = (0,external_lodash_namespaceObject.keyBy)(templateParts, templatePart => templatePart.id); 3769 return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)).map(block => { 3770 const { 3771 attributes: { 3772 theme, 3773 slug 3774 } 3775 } = block; 3776 const templatePartId = `$theme}//${slug}`; 3777 const templatePart = templatePartsById[templatePartId]; 3778 return { 3779 templatePart, 3780 block 3781 }; 3782 }).filter(_ref3 => { 3783 let { 3784 templatePart 3785 } = _ref3; 3786 return !!templatePart; 3787 }); 3788 }); 3789 /** 3790 * Returns the current editing mode. 3791 * 3792 * @param {Object} state Global application state. 3793 * 3794 * @return {string} Editing mode. 3795 */ 3796 3797 function getEditorMode(state) { 3798 return __unstableGetPreference(state, 'editorMode'); 3799 } 3800 3801 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js 3802 /** 3803 * WordPress dependencies 3804 */ 3805 3806 /** 3807 * Internal dependencies 3808 */ 3809 3810 3811 3812 3813 3814 const storeConfig = { 3815 reducer: reducer, 3816 actions: store_actions_namespaceObject, 3817 selectors: store_selectors_namespaceObject 3818 }; 3819 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); 3820 (0,external_wp_data_namespaceObject.register)(store_store); 3821 3822 ;// CONCATENATED MODULE: ./node_modules/history/index.js 3823 3824 3825 /** 3826 * Actions represent the type of change to a location value. 3827 * 3828 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action 3829 */ 3830 var Action; 3831 3832 (function (Action) { 3833 /** 3834 * A POP indicates a change to an arbitrary index in the history stack, such 3835 * as a back or forward navigation. It does not describe the direction of the 3836 * navigation, only that the current index changed. 3837 * 3838 * Note: This is the default action for newly created history objects. 3839 */ 3840 Action["Pop"] = "POP"; 3841 /** 3842 * A PUSH indicates a new entry being added to the history stack, such as when 3843 * a link is clicked and a new page loads. When this happens, all subsequent 3844 * entries in the stack are lost. 3845 */ 3846 3847 Action["Push"] = "PUSH"; 3848 /** 3849 * A REPLACE indicates the entry at the current index in the history stack 3850 * being replaced by a new one. 3851 */ 3852 3853 Action["Replace"] = "REPLACE"; 3854 })(Action || (Action = {})); 3855 3856 var readOnly = false ? 0 : function (obj) { 3857 return obj; 3858 }; 3859 3860 function warning(cond, message) { 3861 if (!cond) { 3862 // eslint-disable-next-line no-console 3863 if (typeof console !== 'undefined') console.warn(message); 3864 3865 try { 3866 // Welcome to debugging history! 3867 // 3868 // This error is thrown as a convenience so you can more easily 3869 // find the source for a warning that appears in the console by 3870 // enabling "pause on exceptions" in your JavaScript debugger. 3871 throw new Error(message); // eslint-disable-next-line no-empty 3872 } catch (e) {} 3873 } 3874 } 3875 3876 var BeforeUnloadEventType = 'beforeunload'; 3877 var HashChangeEventType = 'hashchange'; 3878 var PopStateEventType = 'popstate'; 3879 /** 3880 * Browser history stores the location in regular URLs. This is the standard for 3881 * most web apps, but it requires some configuration on the server to ensure you 3882 * serve the same app at multiple URLs. 3883 * 3884 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory 3885 */ 3886 3887 function createBrowserHistory(options) { 3888 if (options === void 0) { 3889 options = {}; 3890 } 3891 3892 var _options = options, 3893 _options$window = _options.window, 3894 window = _options$window === void 0 ? document.defaultView : _options$window; 3895 var globalHistory = window.history; 3896 3897 function getIndexAndLocation() { 3898 var _window$location = window.location, 3899 pathname = _window$location.pathname, 3900 search = _window$location.search, 3901 hash = _window$location.hash; 3902 var state = globalHistory.state || {}; 3903 return [state.idx, readOnly({ 3904 pathname: pathname, 3905 search: search, 3906 hash: hash, 3907 state: state.usr || null, 3908 key: state.key || 'default' 3909 })]; 3910 } 3911 3912 var blockedPopTx = null; 3913 3914 function handlePop() { 3915 if (blockedPopTx) { 3916 blockers.call(blockedPopTx); 3917 blockedPopTx = null; 3918 } else { 3919 var nextAction = Action.Pop; 3920 3921 var _getIndexAndLocation = getIndexAndLocation(), 3922 nextIndex = _getIndexAndLocation[0], 3923 nextLocation = _getIndexAndLocation[1]; 3924 3925 if (blockers.length) { 3926 if (nextIndex != null) { 3927 var delta = index - nextIndex; 3928 3929 if (delta) { 3930 // Revert the POP 3931 blockedPopTx = { 3932 action: nextAction, 3933 location: nextLocation, 3934 retry: function retry() { 3935 go(delta * -1); 3936 } 3937 }; 3938 go(delta); 3939 } 3940 } else { 3941 // Trying to POP to a location with no index. We did not create 3942 // this location, so we can't effectively block the navigation. 3943 false ? 0 : void 0; 3944 } 3945 } else { 3946 applyTx(nextAction); 3947 } 3948 } 3949 } 3950 3951 window.addEventListener(PopStateEventType, handlePop); 3952 var action = Action.Pop; 3953 3954 var _getIndexAndLocation2 = getIndexAndLocation(), 3955 index = _getIndexAndLocation2[0], 3956 location = _getIndexAndLocation2[1]; 3957 3958 var listeners = createEvents(); 3959 var blockers = createEvents(); 3960 3961 if (index == null) { 3962 index = 0; 3963 globalHistory.replaceState(extends_extends({}, globalHistory.state, { 3964 idx: index 3965 }), ''); 3966 } 3967 3968 function createHref(to) { 3969 return typeof to === 'string' ? to : createPath(to); 3970 } // state defaults to `null` because `window.history.state` does 3971 3972 3973 function getNextLocation(to, state) { 3974 if (state === void 0) { 3975 state = null; 3976 } 3977 3978 return readOnly(extends_extends({ 3979 pathname: location.pathname, 3980 hash: '', 3981 search: '' 3982 }, typeof to === 'string' ? parsePath(to) : to, { 3983 state: state, 3984 key: createKey() 3985 })); 3986 } 3987 3988 function getHistoryStateAndUrl(nextLocation, index) { 3989 return [{ 3990 usr: nextLocation.state, 3991 key: nextLocation.key, 3992 idx: index 3993 }, createHref(nextLocation)]; 3994 } 3995 3996 function allowTx(action, location, retry) { 3997 return !blockers.length || (blockers.call({ 3998 action: action, 3999 location: location, 4000 retry: retry 4001 }), false); 4002 } 4003 4004 function applyTx(nextAction) { 4005 action = nextAction; 4006 4007 var _getIndexAndLocation3 = getIndexAndLocation(); 4008 4009 index = _getIndexAndLocation3[0]; 4010 location = _getIndexAndLocation3[1]; 4011 listeners.call({ 4012 action: action, 4013 location: location 4014 }); 4015 } 4016 4017 function push(to, state) { 4018 var nextAction = Action.Push; 4019 var nextLocation = getNextLocation(to, state); 4020 4021 function retry() { 4022 push(to, state); 4023 } 4024 4025 if (allowTx(nextAction, nextLocation, retry)) { 4026 var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), 4027 historyState = _getHistoryStateAndUr[0], 4028 url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading 4029 // try...catch because iOS limits us to 100 pushState calls :/ 4030 4031 4032 try { 4033 globalHistory.pushState(historyState, '', url); 4034 } catch (error) { 4035 // They are going to lose state here, but there is no real 4036 // way to warn them about it since the page will refresh... 4037 window.location.assign(url); 4038 } 4039 4040 applyTx(nextAction); 4041 } 4042 } 4043 4044 function replace(to, state) { 4045 var nextAction = Action.Replace; 4046 var nextLocation = getNextLocation(to, state); 4047 4048 function retry() { 4049 replace(to, state); 4050 } 4051 4052 if (allowTx(nextAction, nextLocation, retry)) { 4053 var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), 4054 historyState = _getHistoryStateAndUr2[0], 4055 url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading 4056 4057 4058 globalHistory.replaceState(historyState, '', url); 4059 applyTx(nextAction); 4060 } 4061 } 4062 4063 function go(delta) { 4064 globalHistory.go(delta); 4065 } 4066 4067 var history = { 4068 get action() { 4069 return action; 4070 }, 4071 4072 get location() { 4073 return location; 4074 }, 4075 4076 createHref: createHref, 4077 push: push, 4078 replace: replace, 4079 go: go, 4080 back: function back() { 4081 go(-1); 4082 }, 4083 forward: function forward() { 4084 go(1); 4085 }, 4086 listen: function listen(listener) { 4087 return listeners.push(listener); 4088 }, 4089 block: function block(blocker) { 4090 var unblock = blockers.push(blocker); 4091 4092 if (blockers.length === 1) { 4093 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); 4094 } 4095 4096 return function () { 4097 unblock(); // Remove the beforeunload listener so the document may 4098 // still be salvageable in the pagehide event. 4099 // See https://html.spec.whatwg.org/#unloading-documents 4100 4101 if (!blockers.length) { 4102 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); 4103 } 4104 }; 4105 } 4106 }; 4107 return history; 4108 } 4109 /** 4110 * Hash history stores the location in window.location.hash. This makes it ideal 4111 * for situations where you don't want to send the location to the server for 4112 * some reason, either because you do cannot configure it or the URL space is 4113 * reserved for something else. 4114 * 4115 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory 4116 */ 4117 4118 function createHashHistory(options) { 4119 if (options === void 0) { 4120 options = {}; 4121 } 4122 4123 var _options2 = options, 4124 _options2$window = _options2.window, 4125 window = _options2$window === void 0 ? document.defaultView : _options2$window; 4126 var globalHistory = window.history; 4127 4128 function getIndexAndLocation() { 4129 var _parsePath = parsePath(window.location.hash.substr(1)), 4130 _parsePath$pathname = _parsePath.pathname, 4131 pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname, 4132 _parsePath$search = _parsePath.search, 4133 search = _parsePath$search === void 0 ? '' : _parsePath$search, 4134 _parsePath$hash = _parsePath.hash, 4135 hash = _parsePath$hash === void 0 ? '' : _parsePath$hash; 4136 4137 var state = globalHistory.state || {}; 4138 return [state.idx, readOnly({ 4139 pathname: pathname, 4140 search: search, 4141 hash: hash, 4142 state: state.usr || null, 4143 key: state.key || 'default' 4144 })]; 4145 } 4146 4147 var blockedPopTx = null; 4148 4149 function handlePop() { 4150 if (blockedPopTx) { 4151 blockers.call(blockedPopTx); 4152 blockedPopTx = null; 4153 } else { 4154 var nextAction = Action.Pop; 4155 4156 var _getIndexAndLocation4 = getIndexAndLocation(), 4157 nextIndex = _getIndexAndLocation4[0], 4158 nextLocation = _getIndexAndLocation4[1]; 4159 4160 if (blockers.length) { 4161 if (nextIndex != null) { 4162 var delta = index - nextIndex; 4163 4164 if (delta) { 4165 // Revert the POP 4166 blockedPopTx = { 4167 action: nextAction, 4168 location: nextLocation, 4169 retry: function retry() { 4170 go(delta * -1); 4171 } 4172 }; 4173 go(delta); 4174 } 4175 } else { 4176 // Trying to POP to a location with no index. We did not create 4177 // this location, so we can't effectively block the navigation. 4178 false ? 0 : void 0; 4179 } 4180 } else { 4181 applyTx(nextAction); 4182 } 4183 } 4184 } 4185 4186 window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge 4187 // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event 4188 4189 window.addEventListener(HashChangeEventType, function () { 4190 var _getIndexAndLocation5 = getIndexAndLocation(), 4191 nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events. 4192 4193 4194 if (createPath(nextLocation) !== createPath(location)) { 4195 handlePop(); 4196 } 4197 }); 4198 var action = Action.Pop; 4199 4200 var _getIndexAndLocation6 = getIndexAndLocation(), 4201 index = _getIndexAndLocation6[0], 4202 location = _getIndexAndLocation6[1]; 4203 4204 var listeners = createEvents(); 4205 var blockers = createEvents(); 4206 4207 if (index == null) { 4208 index = 0; 4209 globalHistory.replaceState(_extends({}, globalHistory.state, { 4210 idx: index 4211 }), ''); 4212 } 4213 4214 function getBaseHref() { 4215 var base = document.querySelector('base'); 4216 var href = ''; 4217 4218 if (base && base.getAttribute('href')) { 4219 var url = window.location.href; 4220 var hashIndex = url.indexOf('#'); 4221 href = hashIndex === -1 ? url : url.slice(0, hashIndex); 4222 } 4223 4224 return href; 4225 } 4226 4227 function createHref(to) { 4228 return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to)); 4229 } 4230 4231 function getNextLocation(to, state) { 4232 if (state === void 0) { 4233 state = null; 4234 } 4235 4236 return readOnly(_extends({ 4237 pathname: location.pathname, 4238 hash: '', 4239 search: '' 4240 }, typeof to === 'string' ? parsePath(to) : to, { 4241 state: state, 4242 key: createKey() 4243 })); 4244 } 4245 4246 function getHistoryStateAndUrl(nextLocation, index) { 4247 return [{ 4248 usr: nextLocation.state, 4249 key: nextLocation.key, 4250 idx: index 4251 }, createHref(nextLocation)]; 4252 } 4253 4254 function allowTx(action, location, retry) { 4255 return !blockers.length || (blockers.call({ 4256 action: action, 4257 location: location, 4258 retry: retry 4259 }), false); 4260 } 4261 4262 function applyTx(nextAction) { 4263 action = nextAction; 4264 4265 var _getIndexAndLocation7 = getIndexAndLocation(); 4266 4267 index = _getIndexAndLocation7[0]; 4268 location = _getIndexAndLocation7[1]; 4269 listeners.call({ 4270 action: action, 4271 location: location 4272 }); 4273 } 4274 4275 function push(to, state) { 4276 var nextAction = Action.Push; 4277 var nextLocation = getNextLocation(to, state); 4278 4279 function retry() { 4280 push(to, state); 4281 } 4282 4283 false ? 0 : void 0; 4284 4285 if (allowTx(nextAction, nextLocation, retry)) { 4286 var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1), 4287 historyState = _getHistoryStateAndUr3[0], 4288 url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading 4289 // try...catch because iOS limits us to 100 pushState calls :/ 4290 4291 4292 try { 4293 globalHistory.pushState(historyState, '', url); 4294 } catch (error) { 4295 // They are going to lose state here, but there is no real 4296 // way to warn them about it since the page will refresh... 4297 window.location.assign(url); 4298 } 4299 4300 applyTx(nextAction); 4301 } 4302 } 4303 4304 function replace(to, state) { 4305 var nextAction = Action.Replace; 4306 var nextLocation = getNextLocation(to, state); 4307 4308 function retry() { 4309 replace(to, state); 4310 } 4311 4312 false ? 0 : void 0; 4313 4314 if (allowTx(nextAction, nextLocation, retry)) { 4315 var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index), 4316 historyState = _getHistoryStateAndUr4[0], 4317 url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading 4318 4319 4320 globalHistory.replaceState(historyState, '', url); 4321 applyTx(nextAction); 4322 } 4323 } 4324 4325 function go(delta) { 4326 globalHistory.go(delta); 4327 } 4328 4329 var history = { 4330 get action() { 4331 return action; 4332 }, 4333 4334 get location() { 4335 return location; 4336 }, 4337 4338 createHref: createHref, 4339 push: push, 4340 replace: replace, 4341 go: go, 4342 back: function back() { 4343 go(-1); 4344 }, 4345 forward: function forward() { 4346 go(1); 4347 }, 4348 listen: function listen(listener) { 4349 return listeners.push(listener); 4350 }, 4351 block: function block(blocker) { 4352 var unblock = blockers.push(blocker); 4353 4354 if (blockers.length === 1) { 4355 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); 4356 } 4357 4358 return function () { 4359 unblock(); // Remove the beforeunload listener so the document may 4360 // still be salvageable in the pagehide event. 4361 // See https://html.spec.whatwg.org/#unloading-documents 4362 4363 if (!blockers.length) { 4364 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); 4365 } 4366 }; 4367 } 4368 }; 4369 return history; 4370 } 4371 /** 4372 * Memory history stores the current location in memory. It is designed for use 4373 * in stateful non-browser environments like tests and React Native. 4374 * 4375 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory 4376 */ 4377 4378 function createMemoryHistory(options) { 4379 if (options === void 0) { 4380 options = {}; 4381 } 4382 4383 var _options3 = options, 4384 _options3$initialEntr = _options3.initialEntries, 4385 initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr, 4386 initialIndex = _options3.initialIndex; 4387 var entries = initialEntries.map(function (entry) { 4388 var location = readOnly(_extends({ 4389 pathname: '/', 4390 search: '', 4391 hash: '', 4392 state: null, 4393 key: createKey() 4394 }, typeof entry === 'string' ? parsePath(entry) : entry)); 4395 false ? 0 : void 0; 4396 return location; 4397 }); 4398 var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1); 4399 var action = Action.Pop; 4400 var location = entries[index]; 4401 var listeners = createEvents(); 4402 var blockers = createEvents(); 4403 4404 function createHref(to) { 4405 return typeof to === 'string' ? to : createPath(to); 4406 } 4407 4408 function getNextLocation(to, state) { 4409 if (state === void 0) { 4410 state = null; 4411 } 4412 4413 return readOnly(_extends({ 4414 pathname: location.pathname, 4415 search: '', 4416 hash: '' 4417 }, typeof to === 'string' ? parsePath(to) : to, { 4418 state: state, 4419 key: createKey() 4420 })); 4421 } 4422 4423 function allowTx(action, location, retry) { 4424 return !blockers.length || (blockers.call({ 4425 action: action, 4426 location: location, 4427 retry: retry 4428 }), false); 4429 } 4430 4431 function applyTx(nextAction, nextLocation) { 4432 action = nextAction; 4433 location = nextLocation; 4434 listeners.call({ 4435 action: action, 4436 location: location 4437 }); 4438 } 4439 4440 function push(to, state) { 4441 var nextAction = Action.Push; 4442 var nextLocation = getNextLocation(to, state); 4443 4444 function retry() { 4445 push(to, state); 4446 } 4447 4448 false ? 0 : void 0; 4449 4450 if (allowTx(nextAction, nextLocation, retry)) { 4451 index += 1; 4452 entries.splice(index, entries.length, nextLocation); 4453 applyTx(nextAction, nextLocation); 4454 } 4455 } 4456 4457 function replace(to, state) { 4458 var nextAction = Action.Replace; 4459 var nextLocation = getNextLocation(to, state); 4460 4461 function retry() { 4462 replace(to, state); 4463 } 4464 4465 false ? 0 : void 0; 4466 4467 if (allowTx(nextAction, nextLocation, retry)) { 4468 entries[index] = nextLocation; 4469 applyTx(nextAction, nextLocation); 4470 } 4471 } 4472 4473 function go(delta) { 4474 var nextIndex = clamp(index + delta, 0, entries.length - 1); 4475 var nextAction = Action.Pop; 4476 var nextLocation = entries[nextIndex]; 4477 4478 function retry() { 4479 go(delta); 4480 } 4481 4482 if (allowTx(nextAction, nextLocation, retry)) { 4483 index = nextIndex; 4484 applyTx(nextAction, nextLocation); 4485 } 4486 } 4487 4488 var history = { 4489 get index() { 4490 return index; 4491 }, 4492 4493 get action() { 4494 return action; 4495 }, 4496 4497 get location() { 4498 return location; 4499 }, 4500 4501 createHref: createHref, 4502 push: push, 4503 replace: replace, 4504 go: go, 4505 back: function back() { 4506 go(-1); 4507 }, 4508 forward: function forward() { 4509 go(1); 4510 }, 4511 listen: function listen(listener) { 4512 return listeners.push(listener); 4513 }, 4514 block: function block(blocker) { 4515 return blockers.push(blocker); 4516 } 4517 }; 4518 return history; 4519 } //////////////////////////////////////////////////////////////////////////////// 4520 // UTILS 4521 //////////////////////////////////////////////////////////////////////////////// 4522 4523 function clamp(n, lowerBound, upperBound) { 4524 return Math.min(Math.max(n, lowerBound), upperBound); 4525 } 4526 4527 function promptBeforeUnload(event) { 4528 // Cancel the event. 4529 event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set. 4530 4531 event.returnValue = ''; 4532 } 4533 4534 function createEvents() { 4535 var handlers = []; 4536 return { 4537 get length() { 4538 return handlers.length; 4539 }, 4540 4541 push: function push(fn) { 4542 handlers.push(fn); 4543 return function () { 4544 handlers = handlers.filter(function (handler) { 4545 return handler !== fn; 4546 }); 4547 }; 4548 }, 4549 call: function call(arg) { 4550 handlers.forEach(function (fn) { 4551 return fn && fn(arg); 4552 }); 4553 } 4554 }; 4555 } 4556 4557 function createKey() { 4558 return Math.random().toString(36).substr(2, 8); 4559 } 4560 /** 4561 * Creates a string URL path from the given pathname, search, and hash components. 4562 * 4563 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath 4564 */ 4565 4566 4567 function createPath(_ref) { 4568 var _ref$pathname = _ref.pathname, 4569 pathname = _ref$pathname === void 0 ? '/' : _ref$pathname, 4570 _ref$search = _ref.search, 4571 search = _ref$search === void 0 ? '' : _ref$search, 4572 _ref$hash = _ref.hash, 4573 hash = _ref$hash === void 0 ? '' : _ref$hash; 4574 if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search; 4575 if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash; 4576 return pathname; 4577 } 4578 /** 4579 * Parses a string URL path into its separate pathname, search, and hash components. 4580 * 4581 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath 4582 */ 4583 4584 function parsePath(path) { 4585 var parsedPath = {}; 4586 4587 if (path) { 4588 var hashIndex = path.indexOf('#'); 4589 4590 if (hashIndex >= 0) { 4591 parsedPath.hash = path.substr(hashIndex); 4592 path = path.substr(0, hashIndex); 4593 } 4594 4595 var searchIndex = path.indexOf('?'); 4596 4597 if (searchIndex >= 0) { 4598 parsedPath.search = path.substr(searchIndex); 4599 path = path.substr(0, searchIndex); 4600 } 4601 4602 if (path) { 4603 parsedPath.pathname = path; 4604 } 4605 } 4606 4607 return parsedPath; 4608 } 4609 4610 4611 4612 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/history.js 4613 /** 4614 * External dependencies 4615 */ 4616 4617 /** 4618 * WordPress dependencies 4619 */ 4620 4621 4622 const history_history = createBrowserHistory(); 4623 const originalHistoryPush = history_history.push; 4624 const originalHistoryReplace = history_history.replace; 4625 4626 function push(params, state) { 4627 return originalHistoryPush.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); 4628 } 4629 4630 function replace(params, state) { 4631 return originalHistoryReplace.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); 4632 } 4633 4634 history_history.push = push; 4635 history_history.replace = replace; 4636 /* harmony default export */ var utils_history = (history_history); 4637 4638 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/index.js 4639 4640 4641 /** 4642 * WordPress dependencies 4643 */ 4644 4645 /** 4646 * Internal dependencies 4647 */ 4648 4649 4650 const RoutesContext = (0,external_wp_element_namespaceObject.createContext)(); 4651 const HistoryContext = (0,external_wp_element_namespaceObject.createContext)(); 4652 function useLocation() { 4653 return (0,external_wp_element_namespaceObject.useContext)(RoutesContext); 4654 } 4655 function useHistory() { 4656 return (0,external_wp_element_namespaceObject.useContext)(HistoryContext); 4657 } 4658 4659 function getLocationWithParams(location) { 4660 const searchParams = new URLSearchParams(location.search); 4661 return { ...location, 4662 params: Object.fromEntries(searchParams.entries()) 4663 }; 4664 } 4665 4666 function Routes(_ref) { 4667 let { 4668 children 4669 } = _ref; 4670 const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(utils_history.location)); 4671 (0,external_wp_element_namespaceObject.useEffect)(() => { 4672 return utils_history.listen(_ref2 => { 4673 let { 4674 location: updatedLocation 4675 } = _ref2; 4676 setLocation(getLocationWithParams(updatedLocation)); 4677 }); 4678 }, []); 4679 return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, { 4680 value: utils_history 4681 }, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, { 4682 value: location 4683 }, children(location))); 4684 } 4685 4686 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 4687 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 4688 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js 4689 4690 4691 /** 4692 * WordPress dependencies 4693 */ 4694 4695 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4696 xmlns: "http://www.w3.org/2000/svg", 4697 viewBox: "0 0 24 24" 4698 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4699 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" 4700 })); 4701 /* harmony default export */ var library_plus = (plus); 4702 4703 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js 4704 4705 4706 /** 4707 * WordPress dependencies 4708 */ 4709 4710 const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4711 viewBox: "0 0 24 24", 4712 xmlns: "http://www.w3.org/2000/svg" 4713 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4714 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" 4715 })); 4716 /* harmony default export */ var list_view = (listView); 4717 4718 ;// CONCATENATED MODULE: external ["wp","keycodes"] 4719 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 4720 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js 4721 4722 4723 /** 4724 * WordPress dependencies 4725 */ 4726 4727 const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4728 xmlns: "http://www.w3.org/2000/svg", 4729 viewBox: "0 0 24 24" 4730 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4731 d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z" 4732 })); 4733 /* harmony default export */ var library_external = (external); 4734 4735 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js 4736 /** 4737 * WordPress dependencies 4738 */ 4739 4740 const textFormattingShortcuts = [{ 4741 keyCombination: { 4742 modifier: 'primary', 4743 character: 'b' 4744 }, 4745 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') 4746 }, { 4747 keyCombination: { 4748 modifier: 'primary', 4749 character: 'i' 4750 }, 4751 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') 4752 }, { 4753 keyCombination: { 4754 modifier: 'primary', 4755 character: 'k' 4756 }, 4757 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') 4758 }, { 4759 keyCombination: { 4760 modifier: 'primaryShift', 4761 character: 'k' 4762 }, 4763 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') 4764 }, { 4765 keyCombination: { 4766 modifier: 'primary', 4767 character: 'u' 4768 }, 4769 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') 4770 }]; 4771 4772 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js 4773 4774 4775 /** 4776 * External dependencies 4777 */ 4778 4779 /** 4780 * WordPress dependencies 4781 */ 4782 4783 4784 4785 4786 function KeyCombination(_ref) { 4787 let { 4788 keyCombination, 4789 forceAriaLabel 4790 } = _ref; 4791 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; 4792 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; 4793 return (0,external_wp_element_namespaceObject.createElement)("kbd", { 4794 className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination", 4795 "aria-label": forceAriaLabel || ariaLabel 4796 }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => { 4797 if (character === '+') { 4798 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { 4799 key: index 4800 }, character); 4801 } 4802 4803 return (0,external_wp_element_namespaceObject.createElement)("kbd", { 4804 key: index, 4805 className: "edit-site-keyboard-shortcut-help-modal__shortcut-key" 4806 }, character); 4807 })); 4808 } 4809 4810 function Shortcut(_ref2) { 4811 let { 4812 description, 4813 keyCombination, 4814 aliases = [], 4815 ariaLabel 4816 } = _ref2; 4817 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { 4818 className: "edit-site-keyboard-shortcut-help-modal__shortcut-description" 4819 }, description), (0,external_wp_element_namespaceObject.createElement)("div", { 4820 className: "edit-site-keyboard-shortcut-help-modal__shortcut-term" 4821 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { 4822 keyCombination: keyCombination, 4823 forceAriaLabel: ariaLabel 4824 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { 4825 keyCombination: alias, 4826 forceAriaLabel: ariaLabel, 4827 key: index 4828 })))); 4829 } 4830 4831 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 4832 4833 4834 /** 4835 * WordPress dependencies 4836 */ 4837 4838 4839 /** 4840 * Internal dependencies 4841 */ 4842 4843 4844 function DynamicShortcut(_ref) { 4845 let { 4846 name 4847 } = _ref; 4848 const { 4849 keyCombination, 4850 description, 4851 aliases 4852 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 4853 const { 4854 getShortcutKeyCombination, 4855 getShortcutDescription, 4856 getShortcutAliases 4857 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 4858 return { 4859 keyCombination: getShortcutKeyCombination(name), 4860 aliases: getShortcutAliases(name), 4861 description: getShortcutDescription(name) 4862 }; 4863 }, [name]); 4864 4865 if (!keyCombination) { 4866 return null; 4867 } 4868 4869 return (0,external_wp_element_namespaceObject.createElement)(Shortcut, { 4870 keyCombination: keyCombination, 4871 description: description, 4872 aliases: aliases 4873 }); 4874 } 4875 4876 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js 4877 4878 4879 /** 4880 * External dependencies 4881 */ 4882 4883 4884 /** 4885 * WordPress dependencies 4886 */ 4887 4888 4889 4890 4891 4892 /** 4893 * Internal dependencies 4894 */ 4895 4896 4897 4898 4899 4900 const ShortcutList = _ref => { 4901 let { 4902 shortcuts 4903 } = _ref; 4904 return ( 4905 /* 4906 * Disable reason: The `list` ARIA role is redundant but 4907 * Safari+VoiceOver won't announce the list otherwise. 4908 */ 4909 4910 /* eslint-disable jsx-a11y/no-redundant-roles */ 4911 (0,external_wp_element_namespaceObject.createElement)("ul", { 4912 className: "edit-site-keyboard-shortcut-help-modal__shortcut-list", 4913 role: "list" 4914 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { 4915 className: "edit-site-keyboard-shortcut-help-modal__shortcut", 4916 key: index 4917 }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(DynamicShortcut, { 4918 name: shortcut 4919 }) : (0,external_wp_element_namespaceObject.createElement)(Shortcut, shortcut)))) 4920 /* eslint-enable jsx-a11y/no-redundant-roles */ 4921 4922 ); 4923 }; 4924 4925 const ShortcutSection = _ref2 => { 4926 let { 4927 title, 4928 shortcuts, 4929 className 4930 } = _ref2; 4931 return (0,external_wp_element_namespaceObject.createElement)("section", { 4932 className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className) 4933 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { 4934 className: "edit-site-keyboard-shortcut-help-modal__section-title" 4935 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { 4936 shortcuts: shortcuts 4937 })); 4938 }; 4939 4940 const ShortcutCategorySection = _ref3 => { 4941 let { 4942 title, 4943 categoryName, 4944 additionalShortcuts = [] 4945 } = _ref3; 4946 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { 4947 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); 4948 }, [categoryName]); 4949 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { 4950 title: title, 4951 shortcuts: categoryShortcuts.concat(additionalShortcuts) 4952 }); 4953 }; 4954 4955 function KeyboardShortcutHelpModal(_ref4) { 4956 let { 4957 isModalActive, 4958 toggleModal 4959 } = _ref4; 4960 4961 if (!isModalActive) { 4962 return null; 4963 } 4964 4965 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 4966 className: "edit-site-keyboard-shortcut-help-modal", 4967 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 4968 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 4969 onRequestClose: toggleModal 4970 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { 4971 className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts", 4972 shortcuts: ['core/edit-site/keyboard-shortcuts'] 4973 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { 4974 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), 4975 categoryName: "global" 4976 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { 4977 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), 4978 categoryName: "selection" 4979 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { 4980 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), 4981 categoryName: "block", 4982 additionalShortcuts: [{ 4983 keyCombination: { 4984 character: '/' 4985 }, 4986 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), 4987 4988 /* translators: The forward-slash character. e.g. '/'. */ 4989 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') 4990 }] 4991 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { 4992 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), 4993 shortcuts: textFormattingShortcuts 4994 })); 4995 } 4996 4997 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/enable-feature.js 4998 4999 5000 5001 /** 5002 * WordPress dependencies 5003 */ 5004 5005 5006 5007 function EnableFeature(props) { 5008 const { 5009 featureName, 5010 ...remainingProps 5011 } = props; 5012 const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName), [featureName]); 5013 const { 5014 toggle 5015 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 5016 5017 const onChange = () => toggle('core/edit-site', featureName); 5018 5019 return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, extends_extends({ 5020 onChange: onChange, 5021 isChecked: isChecked 5022 }, remainingProps)); 5023 } 5024 5025 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/index.js 5026 5027 5028 /** 5029 * WordPress dependencies 5030 */ 5031 5032 5033 5034 /** 5035 * Internal dependencies 5036 */ 5037 5038 5039 function EditSitePreferencesModal(_ref) { 5040 let { 5041 isModalActive, 5042 toggleModal 5043 } = _ref; 5044 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ 5045 name: 'general', 5046 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), 5047 content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { 5048 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 5049 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.') 5050 }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { 5051 featureName: "focusMode", 5052 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), 5053 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') 5054 }), (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { 5055 featureName: "showIconLabels", 5056 label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), 5057 help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons') 5058 })) 5059 }, { 5060 name: 'blocks', 5061 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 5062 content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { 5063 title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'), 5064 description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.') 5065 }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { 5066 featureName: "keepCaretInsideBlock", 5067 help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), 5068 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') 5069 })) 5070 }]); 5071 5072 if (!isModalActive) { 5073 return null; 5074 } 5075 5076 return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, { 5077 closeModal: toggleModal 5078 }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, { 5079 sections: sections 5080 })); 5081 } 5082 5083 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/tools-more-menu-group/index.js 5084 5085 5086 /** 5087 * External dependencies 5088 */ 5089 5090 /** 5091 * WordPress dependencies 5092 */ 5093 5094 5095 const { 5096 Fill: ToolsMoreMenuGroup, 5097 Slot 5098 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup'); 5099 5100 ToolsMoreMenuGroup.Slot = _ref => { 5101 let { 5102 fillProps 5103 } = _ref; 5104 return (0,external_wp_element_namespaceObject.createElement)(Slot, { 5105 fillProps: fillProps 5106 }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills); 5107 }; 5108 5109 /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); 5110 5111 // EXTERNAL MODULE: ./node_modules/downloadjs/download.js 5112 var download = __webpack_require__(8981); 5113 var download_default = /*#__PURE__*/__webpack_require__.n(download); 5114 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js 5115 5116 5117 /** 5118 * WordPress dependencies 5119 */ 5120 5121 const download_download = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5122 xmlns: "http://www.w3.org/2000/svg", 5123 viewBox: "0 0 24 24" 5124 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5125 d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" 5126 })); 5127 /* harmony default export */ var library_download = (download_download); 5128 5129 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/site-export.js 5130 5131 5132 /** 5133 * External dependencies 5134 */ 5135 5136 /** 5137 * WordPress dependencies 5138 */ 5139 5140 5141 5142 5143 5144 5145 5146 function SiteExport() { 5147 const { 5148 createErrorNotice 5149 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5150 5151 async function handleExport() { 5152 try { 5153 const response = await external_wp_apiFetch_default()({ 5154 path: '/wp-block-editor/v1/export', 5155 parse: false 5156 }); 5157 const blob = await response.blob(); 5158 const contentDisposition = response.headers.get('content-disposition'); 5159 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 5160 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; 5161 download_default()(blob, fileName + '.zip', 'application/zip'); 5162 } catch (errorResponse) { 5163 let error = {}; 5164 5165 try { 5166 error = await errorResponse.json(); 5167 } catch (e) {} 5168 5169 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); 5170 createErrorNotice(errorMessage, { 5171 type: 'snackbar' 5172 }); 5173 } 5174 } 5175 5176 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5177 role: "menuitem", 5178 icon: library_download, 5179 onClick: handleExport, 5180 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.') 5181 }, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item')); 5182 } 5183 5184 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/welcome-guide-menu-item.js 5185 5186 5187 /** 5188 * WordPress dependencies 5189 */ 5190 5191 5192 5193 5194 function WelcomeGuideMenuItem() { 5195 const { 5196 toggle 5197 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 5198 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5199 onClick: () => toggle('core/edit-site', 'welcomeGuide') 5200 }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')); 5201 } 5202 5203 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/copy-content-menu-item.js 5204 5205 5206 /** 5207 * WordPress dependencies 5208 */ 5209 5210 5211 5212 5213 5214 5215 5216 /** 5217 * Internal dependencies 5218 */ 5219 5220 5221 function CopyContentMenuItem() { 5222 const { 5223 createNotice 5224 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5225 const getText = (0,external_wp_data_namespaceObject.useSelect)(select => { 5226 return () => { 5227 const { 5228 getEditedPostId, 5229 getEditedPostType 5230 } = select(store_store); 5231 const { 5232 getEditedEntityRecord 5233 } = select(external_wp_coreData_namespaceObject.store); 5234 const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId()); 5235 5236 if (record) { 5237 if (typeof record.content === 'function') { 5238 return record.content(record); 5239 } else if (record.blocks) { 5240 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 5241 } else if (record.content) { 5242 return record.content; 5243 } 5244 } 5245 5246 return ''; 5247 }; 5248 }, []); 5249 5250 function onSuccess() { 5251 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { 5252 isDismissible: true, 5253 type: 'snackbar' 5254 }); 5255 } 5256 5257 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); 5258 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5259 ref: ref 5260 }, (0,external_wp_i18n_namespaceObject.__)('Copy all content')); 5261 } 5262 5263 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/mode-switcher/index.js 5264 5265 5266 /** 5267 * WordPress dependencies 5268 */ 5269 5270 5271 5272 5273 /** 5274 * Internal dependencies 5275 */ 5276 5277 /** 5278 * Internal dependencies 5279 */ 5280 5281 5282 /** 5283 * Set of available mode options. 5284 * 5285 * @type {Array} 5286 */ 5287 5288 const MODES = [{ 5289 value: 'visual', 5290 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') 5291 }, { 5292 value: 'text', 5293 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') 5294 }]; 5295 5296 function ModeSwitcher() { 5297 const { 5298 shortcut, 5299 mode 5300 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 5301 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'), 5302 isRichEditingEnabled: select(store_store).getSettings().richEditingEnabled, 5303 isCodeEditingEnabled: select(store_store).getSettings().codeEditingEnabled, 5304 mode: select(store_store).getEditorMode() 5305 }), []); 5306 const { 5307 switchEditorMode 5308 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5309 const choices = MODES.map(choice => { 5310 if (choice.value !== mode) { 5311 return { ...choice, 5312 shortcut 5313 }; 5314 } 5315 5316 return choice; 5317 }); 5318 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 5319 label: (0,external_wp_i18n_namespaceObject.__)('Editor') 5320 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { 5321 choices: choices, 5322 value: mode, 5323 onSelect: switchEditorMode 5324 })); 5325 } 5326 5327 /* harmony default export */ var mode_switcher = (ModeSwitcher); 5328 5329 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/index.js 5330 5331 5332 /** 5333 * WordPress dependencies 5334 */ 5335 5336 5337 5338 5339 5340 5341 5342 5343 /** 5344 * Internal dependencies 5345 */ 5346 5347 5348 5349 5350 5351 5352 5353 5354 function MoreMenu() { 5355 const [isModalActive, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); 5356 const [isPreferencesModalActive, togglePreferencesModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); 5357 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal); 5358 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, _ref => { 5359 let { 5360 onClose 5361 } = _ref; 5362 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 5363 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') 5364 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 5365 scope: "core/edit-site", 5366 name: "fixedToolbar", 5367 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 5368 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), 5369 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), 5370 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') 5371 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 5372 scope: "core/edit-site", 5373 name: "focusMode", 5374 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), 5375 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), 5376 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), 5377 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') 5378 }), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, { 5379 name: "core/edit-site/plugin-more-menu", 5380 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), 5381 as: external_wp_components_namespaceObject.MenuGroup, 5382 fillProps: { 5383 onClick: onClose 5384 } 5385 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 5386 label: (0,external_wp_i18n_namespaceObject.__)('Tools') 5387 }, (0,external_wp_element_namespaceObject.createElement)(SiteExport, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5388 onClick: toggleModal, 5389 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') 5390 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5391 icon: library_external, 5392 role: "menuitem", 5393 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/site-editor/'), 5394 target: "_blank", 5395 rel: "noopener noreferrer" 5396 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 5397 as: "span" 5398 }, 5399 /* translators: accessibility text */ 5400 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { 5401 fillProps: { 5402 onClose 5403 } 5404 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5405 onClick: togglePreferencesModal 5406 }, (0,external_wp_i18n_namespaceObject.__)('Preferences')))); 5407 }), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, { 5408 isModalActive: isModalActive, 5409 toggleModal: toggleModal 5410 }), (0,external_wp_element_namespaceObject.createElement)(EditSitePreferencesModal, { 5411 isModalActive: isPreferencesModalActive, 5412 toggleModal: togglePreferencesModal 5413 })); 5414 } 5415 5416 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js 5417 5418 5419 /** 5420 * External dependencies 5421 */ 5422 5423 /** 5424 * WordPress dependencies 5425 */ 5426 5427 5428 5429 5430 5431 function SaveButton(_ref) { 5432 let { 5433 openEntitiesSavedStates, 5434 isEntitiesSavedStatesOpen 5435 } = _ref; 5436 const { 5437 isDirty, 5438 isSaving 5439 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5440 const { 5441 __experimentalGetDirtyEntityRecords, 5442 isSavingEntityRecord 5443 } = select(external_wp_coreData_namespaceObject.store); 5444 5445 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 5446 5447 return { 5448 isDirty: dirtyEntityRecords.length > 0, 5449 isSaving: (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key)) 5450 }; 5451 }, []); 5452 const disabled = !isDirty || isSaving; 5453 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5454 variant: "primary", 5455 className: "edit-site-save-button__button", 5456 "aria-disabled": disabled, 5457 "aria-expanded": isEntitiesSavedStatesOpen, 5458 disabled: disabled, 5459 isBusy: isSaving, 5460 onClick: disabled ? undefined : openEntitiesSavedStates 5461 }, (0,external_wp_i18n_namespaceObject.__)('Save'))); 5462 } 5463 5464 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js 5465 5466 5467 /** 5468 * WordPress dependencies 5469 */ 5470 5471 const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5472 xmlns: "http://www.w3.org/2000/svg", 5473 viewBox: "0 0 24 24" 5474 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5475 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" 5476 })); 5477 /* harmony default export */ var library_undo = (undo); 5478 5479 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js 5480 5481 5482 /** 5483 * WordPress dependencies 5484 */ 5485 5486 const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5487 xmlns: "http://www.w3.org/2000/svg", 5488 viewBox: "0 0 24 24" 5489 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5490 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" 5491 })); 5492 /* harmony default export */ var library_redo = (redo); 5493 5494 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/undo.js 5495 5496 5497 /** 5498 * WordPress dependencies 5499 */ 5500 5501 5502 5503 5504 5505 5506 function UndoButton() { 5507 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []); 5508 const { 5509 undo 5510 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5511 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5512 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo, 5513 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5514 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this 5515 // button, because it will remove focus for keyboard users. 5516 // See: https://github.com/WordPress/gutenberg/issues/3486 5517 , 5518 "aria-disabled": !hasUndo, 5519 onClick: hasUndo ? undo : undefined 5520 }); 5521 } 5522 5523 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/redo.js 5524 5525 5526 /** 5527 * WordPress dependencies 5528 */ 5529 5530 5531 5532 5533 5534 5535 function RedoButton() { 5536 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []); 5537 const { 5538 redo 5539 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5540 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5541 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo, 5542 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 5543 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this 5544 // button, because it will remove focus for keyboard users. 5545 // See: https://github.com/WordPress/gutenberg/issues/3486 5546 , 5547 "aria-disabled": !hasRedo, 5548 onClick: hasRedo ? redo : undefined 5549 }); 5550 } 5551 5552 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 5553 5554 5555 /** 5556 * WordPress dependencies 5557 */ 5558 5559 const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5560 viewBox: "0 0 24 24", 5561 xmlns: "http://www.w3.org/2000/svg" 5562 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5563 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 5564 })); 5565 /* harmony default export */ var chevron_down = (chevronDown); 5566 5567 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/document-actions/index.js 5568 5569 5570 /** 5571 * External dependencies 5572 */ 5573 5574 /** 5575 * WordPress dependencies 5576 */ 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 function getBlockDisplayText(block) { 5587 if (block) { 5588 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); 5589 return blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, block.attributes) : null; 5590 } 5591 5592 return null; 5593 } 5594 5595 function useSecondaryText() { 5596 const { 5597 getBlock 5598 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 5599 const activeEntityBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetActiveBlockIdByBlockNames(['core/template-part']), []); 5600 5601 if (activeEntityBlockId) { 5602 return { 5603 label: getBlockDisplayText(getBlock(activeEntityBlockId)), 5604 isActive: true 5605 }; 5606 } 5607 5608 return {}; 5609 } 5610 /** 5611 * @param {Object} props Props for the DocumentActions component. 5612 * @param {string} props.entityTitle The title to display. 5613 * @param {string} props.entityLabel A label to use for entity-related options. 5614 * E.g. "template" would be used for "edit 5615 * template" and "show template details". 5616 * @param {boolean} props.isLoaded Whether the data is available. 5617 * @param {Function} props.children React component to use for the 5618 * information dropdown area. Should be a 5619 * function which accepts dropdown props. 5620 * @param {boolean} props.showIconLabels Whether buttons display icons or text labels. 5621 */ 5622 5623 5624 function DocumentActions(_ref) { 5625 let { 5626 entityTitle, 5627 entityLabel, 5628 isLoaded, 5629 children: dropdownContent, 5630 showIconLabels 5631 } = _ref; 5632 const { 5633 label 5634 } = useSecondaryText(); // The title ref is passed to the popover as the anchorRef so that the 5635 // dropdown is centered over the whole title area rather than just one 5636 // part of it. 5637 5638 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); // Return a simple loading indicator until we have information to show. 5639 5640 if (!isLoaded) { 5641 return (0,external_wp_element_namespaceObject.createElement)("div", { 5642 className: "edit-site-document-actions" 5643 }, (0,external_wp_i18n_namespaceObject.__)('Loading…')); 5644 } // Return feedback that the template does not seem to exist. 5645 5646 5647 if (!entityTitle) { 5648 return (0,external_wp_element_namespaceObject.createElement)("div", { 5649 className: "edit-site-document-actions" 5650 }, (0,external_wp_i18n_namespaceObject.__)('Template not found')); 5651 } 5652 5653 return (0,external_wp_element_namespaceObject.createElement)("div", { 5654 className: classnames_default()('edit-site-document-actions', { 5655 'has-secondary-label': !!label 5656 }) 5657 }, (0,external_wp_element_namespaceObject.createElement)("div", { 5658 ref: titleRef, 5659 className: "edit-site-document-actions__title-wrapper" 5660 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { 5661 size: "body", 5662 className: "edit-site-document-actions__title", 5663 as: "h1" 5664 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 5665 as: "span" 5666 }, (0,external_wp_i18n_namespaceObject.sprintf)( 5667 /* translators: %s: the entity being edited, like "template"*/ 5668 (0,external_wp_i18n_namespaceObject.__)('Editing %s: '), entityLabel)), entityTitle), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { 5669 size: "body", 5670 className: "edit-site-document-actions__secondary-item" 5671 }, label !== null && label !== void 0 ? label : ''), dropdownContent && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { 5672 popoverProps: { 5673 anchorRef: titleRef.current 5674 }, 5675 position: "bottom center", 5676 renderToggle: _ref2 => { 5677 let { 5678 isOpen, 5679 onToggle 5680 } = _ref2; 5681 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5682 className: "edit-site-document-actions__get-info", 5683 icon: chevron_down, 5684 "aria-expanded": isOpen, 5685 "aria-haspopup": "true", 5686 onClick: onToggle, 5687 label: (0,external_wp_i18n_namespaceObject.sprintf)( 5688 /* translators: %s: the entity to see details about, like "template"*/ 5689 (0,external_wp_i18n_namespaceObject.__)('Show %s details'), entityLabel) 5690 }, showIconLabels && (0,external_wp_i18n_namespaceObject.__)('Details')); 5691 }, 5692 contentClassName: "edit-site-document-actions__info-dropdown", 5693 renderContent: dropdownContent 5694 }))); 5695 } 5696 5697 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js 5698 5699 5700 5701 /** 5702 * WordPress dependencies 5703 */ 5704 5705 /** 5706 * Internal dependencies 5707 */ 5708 5709 5710 function useLink() { 5711 let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 5712 let state = arguments.length > 1 ? arguments[1] : undefined; 5713 let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 5714 const history = useHistory(); 5715 5716 function onClick(event) { 5717 event.preventDefault(); 5718 5719 if (shouldReplace) { 5720 history.replace(params, state); 5721 } else { 5722 history.push(params, state); 5723 } 5724 } 5725 5726 return { 5727 href: (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), 5728 onClick 5729 }; 5730 } 5731 function Link(_ref) { 5732 let { 5733 params = {}, 5734 state, 5735 replace: shouldReplace = false, 5736 children, 5737 ...props 5738 } = _ref; 5739 const { 5740 href, 5741 onClick 5742 } = useLink(params, state, shouldReplace); 5743 return (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({ 5744 href: href, 5745 onClick: onClick 5746 }, props), children); 5747 } 5748 5749 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/template-areas.js 5750 5751 5752 5753 /** 5754 * WordPress dependencies 5755 */ 5756 5757 5758 5759 5760 5761 5762 /** 5763 * Internal dependencies 5764 */ 5765 5766 5767 5768 5769 5770 5771 function TemplatePartItemMore(_ref) { 5772 var _templatePart$title; 5773 5774 let { 5775 onClose, 5776 templatePart, 5777 closeTemplateDetailsDropdown 5778 } = _ref; 5779 const { 5780 revertTemplate 5781 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5782 const { 5783 params 5784 } = useLocation(); 5785 const editLinkProps = useLink({ 5786 postId: templatePart.id, 5787 postType: templatePart.type 5788 }, { 5789 fromTemplateId: params.postId 5790 }); 5791 5792 function editTemplatePart(event) { 5793 editLinkProps.onClick(event); 5794 onClose(); 5795 closeTemplateDetailsDropdown(); 5796 } 5797 5798 function clearCustomizations() { 5799 revertTemplate(templatePart); 5800 onClose(); 5801 closeTemplateDetailsDropdown(); 5802 } 5803 5804 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, editLinkProps, { 5805 onClick: editTemplatePart 5806 }), (0,external_wp_i18n_namespaceObject.sprintf)( 5807 /* translators: %s: template part title */ 5808 (0,external_wp_i18n_namespaceObject.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), isTemplateRevertable(templatePart) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5809 info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), 5810 onClick: clearCustomizations 5811 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')))); 5812 } 5813 5814 function TemplatePartItem(_ref2) { 5815 let { 5816 templatePart, 5817 clientId, 5818 closeTemplateDetailsDropdown 5819 } = _ref2; 5820 const { 5821 selectBlock, 5822 toggleBlockHighlight 5823 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 5824 const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { 5825 const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); 5826 5827 return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area); 5828 }, [templatePart.area]); 5829 5830 const highlightBlock = () => toggleBlockHighlight(clientId, true); 5831 5832 const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); 5833 5834 return (0,external_wp_element_namespaceObject.createElement)("div", { 5835 role: "menuitem", 5836 className: "edit-site-template-details__template-areas-item" 5837 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5838 role: "button", 5839 icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, 5840 iconPosition: "left", 5841 onClick: () => { 5842 selectBlock(clientId); 5843 }, 5844 onMouseOver: highlightBlock, 5845 onMouseLeave: cancelHighlightBlock, 5846 onFocus: highlightBlock, 5847 onBlur: cancelHighlightBlock 5848 }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { 5849 icon: more_vertical, 5850 label: (0,external_wp_i18n_namespaceObject.__)('More options'), 5851 className: "edit-site-template-details__template-areas-item-more" 5852 }, _ref3 => { 5853 let { 5854 onClose 5855 } = _ref3; 5856 return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItemMore, { 5857 onClose: onClose, 5858 templatePart: templatePart, 5859 closeTemplateDetailsDropdown: closeTemplateDetailsDropdown 5860 }); 5861 })); 5862 } 5863 5864 function TemplateAreas(_ref4) { 5865 let { 5866 closeTemplateDetailsDropdown 5867 } = _ref4; 5868 const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); 5869 5870 if (!templateParts.length) { 5871 return null; 5872 } 5873 5874 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 5875 label: (0,external_wp_i18n_namespaceObject.__)('Areas'), 5876 className: "edit-site-template-details__group edit-site-template-details__template-areas" 5877 }, templateParts.map(_ref5 => { 5878 let { 5879 templatePart, 5880 block 5881 } = _ref5; 5882 return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItem, { 5883 key: templatePart.slug, 5884 clientId: block.clientId, 5885 templatePart: templatePart, 5886 closeTemplateDetailsDropdown: closeTemplateDetailsDropdown 5887 }); 5888 })); 5889 } 5890 5891 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/edit-template-title.js 5892 5893 5894 /** 5895 * WordPress dependencies 5896 */ 5897 5898 5899 5900 function EditTemplateTitle(_ref) { 5901 let { 5902 template 5903 } = _ref; 5904 const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', template.type, 'title', template.id); 5905 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 5906 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 5907 value: title, 5908 help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'), 5909 onChange: newTitle => { 5910 setTitle(newTitle || template.slug); 5911 } 5912 }); 5913 } 5914 5915 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/index.js 5916 5917 5918 5919 /** 5920 * WordPress dependencies 5921 */ 5922 5923 5924 5925 5926 5927 /** 5928 * Internal dependencies 5929 */ 5930 5931 5932 5933 5934 5935 5936 5937 function TemplateDetails(_ref) { 5938 let { 5939 template, 5940 onClose 5941 } = _ref; 5942 const { 5943 title, 5944 description 5945 } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetTemplateInfo(template), []); 5946 const { 5947 revertTemplate 5948 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5949 const templateSubMenu = (0,external_wp_element_namespaceObject.useMemo)(() => { 5950 if ((template === null || template === void 0 ? void 0 : template.type) === 'wp_template') { 5951 return { 5952 title: (0,external_wp_i18n_namespaceObject.__)('templates'), 5953 menu: MENU_TEMPLATES 5954 }; 5955 } 5956 5957 return TEMPLATE_PARTS_SUB_MENUS.find(_ref2 => { 5958 let { 5959 area 5960 } = _ref2; 5961 return area === (template === null || template === void 0 ? void 0 : template.area); 5962 }); 5963 }, [template]); 5964 const browseAllLinkProps = useLink({ 5965 // TODO: We should update this to filter by template part's areas as well. 5966 postType: template.type, 5967 postId: undefined 5968 }); 5969 5970 if (!template) { 5971 return null; 5972 } 5973 5974 const revert = () => { 5975 revertTemplate(template); 5976 onClose(); 5977 }; 5978 5979 return (0,external_wp_element_namespaceObject.createElement)("div", { 5980 className: "edit-site-template-details" 5981 }, (0,external_wp_element_namespaceObject.createElement)("div", { 5982 className: "edit-site-template-details__group" 5983 }, template.is_custom ? (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, { 5984 template: template 5985 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 5986 level: 4, 5987 weight: 600, 5988 className: "edit-site-template-details__title" 5989 }, title), description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { 5990 size: "body", 5991 className: "edit-site-template-details__description", 5992 as: "p" 5993 }, description)), (0,external_wp_element_namespaceObject.createElement)(TemplateAreas, { 5994 closeTemplateDetailsDropdown: onClose 5995 }), isTemplateRevertable(template) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 5996 className: "edit-site-template-details__group edit-site-template-details__revert" 5997 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 5998 className: "edit-site-template-details__revert-button", 5999 info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), 6000 onClick: revert 6001 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({ 6002 className: "edit-site-template-details__show-all-button" 6003 }, browseAllLinkProps), (0,external_wp_i18n_namespaceObject.sprintf)( 6004 /* translators: the template part's area name ("Headers", "Sidebars") or "templates". */ 6005 (0,external_wp_i18n_namespaceObject.__)('Browse all %s'), templateSubMenu.title))); 6006 } 6007 6008 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/index.js 6009 6010 6011 /** 6012 * WordPress dependencies 6013 */ 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 /** 6026 * Internal dependencies 6027 */ 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 const preventDefault = event => { 6038 event.preventDefault(); 6039 }; 6040 6041 function Header(_ref) { 6042 let { 6043 openEntitiesSavedStates, 6044 isEntitiesSavedStatesOpen, 6045 showIconLabels 6046 } = _ref; 6047 const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); 6048 const { 6049 deviceType, 6050 entityTitle, 6051 template, 6052 templateType, 6053 isInserterOpen, 6054 isListViewOpen, 6055 listViewShortcut, 6056 isLoaded, 6057 isVisualMode 6058 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6059 const { 6060 __experimentalGetPreviewDeviceType, 6061 getEditedPostType, 6062 getEditedPostId, 6063 isInserterOpened, 6064 isListViewOpened, 6065 getEditorMode 6066 } = select(store_store); 6067 const { 6068 getEditedEntityRecord 6069 } = select(external_wp_coreData_namespaceObject.store); 6070 const { 6071 __experimentalGetTemplateInfo: getTemplateInfo 6072 } = select(external_wp_editor_namespaceObject.store); 6073 const { 6074 getShortcutRepresentation 6075 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 6076 const postType = getEditedPostType(); 6077 const postId = getEditedPostId(); 6078 const record = getEditedEntityRecord('postType', postType, postId); 6079 6080 const _isLoaded = !!postId; 6081 6082 return { 6083 deviceType: __experimentalGetPreviewDeviceType(), 6084 entityTitle: getTemplateInfo(record).title, 6085 isLoaded: _isLoaded, 6086 template: record, 6087 templateType: postType, 6088 isInserterOpen: isInserterOpened(), 6089 isListViewOpen: isListViewOpened(), 6090 listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'), 6091 isVisualMode: getEditorMode() === 'visual' 6092 }; 6093 }, []); 6094 const { 6095 __experimentalSetPreviewDeviceType: setPreviewDeviceType, 6096 setIsInserterOpened, 6097 setIsListViewOpened 6098 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6099 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 6100 const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { 6101 if (isInserterOpen) { 6102 // Focusing the inserter button closes the inserter popover. 6103 inserterButton.current.focus(); 6104 } else { 6105 setIsInserterOpened(true); 6106 } 6107 }, [isInserterOpen, setIsInserterOpened]); 6108 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); 6109 const isFocusMode = templateType === 'wp_template_part'; 6110 return (0,external_wp_element_namespaceObject.createElement)("div", { 6111 className: "edit-site-header" 6112 }, (0,external_wp_element_namespaceObject.createElement)("div", { 6113 className: "edit-site-header_start" 6114 }, (0,external_wp_element_namespaceObject.createElement)("div", { 6115 className: "edit-site-header__toolbar" 6116 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6117 ref: inserterButton, 6118 variant: "primary", 6119 isPressed: isInserterOpen, 6120 className: "edit-site-header-toolbar__inserter-toggle", 6121 disabled: !isVisualMode, 6122 onMouseDown: preventDefault, 6123 onClick: openInserter, 6124 icon: library_plus, 6125 label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button') 6126 }, showIconLabels && (!isInserterOpen ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { 6127 as: external_wp_blockEditor_namespaceObject.ToolSelector, 6128 disabled: !isVisualMode 6129 }), (0,external_wp_element_namespaceObject.createElement)(UndoButton, null), (0,external_wp_element_namespaceObject.createElement)(RedoButton, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6130 className: "edit-site-header-toolbar__list-view-toggle", 6131 disabled: !isVisualMode, 6132 icon: list_view, 6133 isPressed: isListViewOpen 6134 /* translators: button label text should, if possible, be under 16 characters. */ 6135 , 6136 label: (0,external_wp_i18n_namespaceObject.__)('List View'), 6137 onClick: toggleListView, 6138 shortcut: listViewShortcut 6139 })))), (0,external_wp_element_namespaceObject.createElement)("div", { 6140 className: "edit-site-header_center" 6141 }, (0,external_wp_element_namespaceObject.createElement)(DocumentActions, { 6142 entityTitle: entityTitle, 6143 entityLabel: templateType === 'wp_template_part' ? 'template part' : 'template', 6144 isLoaded: isLoaded, 6145 showIconLabels: showIconLabels 6146 }, _ref2 => { 6147 let { 6148 onClose 6149 } = _ref2; 6150 return (0,external_wp_element_namespaceObject.createElement)(TemplateDetails, { 6151 template: template, 6152 onClose: onClose 6153 }); 6154 })), (0,external_wp_element_namespaceObject.createElement)("div", { 6155 className: "edit-site-header_end" 6156 }, (0,external_wp_element_namespaceObject.createElement)("div", { 6157 className: "edit-site-header__actions" 6158 }, !isFocusMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, { 6159 deviceType: deviceType, 6160 setDeviceType: setPreviewDeviceType 6161 }), (0,external_wp_element_namespaceObject.createElement)(SaveButton, { 6162 openEntitiesSavedStates: openEntitiesSavedStates, 6163 isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen 6164 }), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { 6165 scope: "core/edit-site" 6166 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null)))); 6167 } 6168 6169 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js 6170 6171 6172 /** 6173 * WordPress dependencies 6174 */ 6175 6176 const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6177 xmlns: "http://www.w3.org/2000/svg", 6178 viewBox: "0 0 24 24" 6179 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6180 fillRule: "evenodd", 6181 d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", 6182 clipRule: "evenodd" 6183 })); 6184 /* harmony default export */ var library_cog = (cog); 6185 6186 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/default-sidebar.js 6187 6188 6189 /** 6190 * WordPress dependencies 6191 */ 6192 6193 function default_sidebar_DefaultSidebar(_ref) { 6194 let { 6195 className, 6196 identifier, 6197 title, 6198 icon, 6199 children, 6200 closeLabel, 6201 header, 6202 headerClassName, 6203 panelClassName 6204 } = _ref; 6205 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(complementary_area, { 6206 className: className, 6207 scope: "core/edit-site", 6208 identifier: identifier, 6209 title: title, 6210 icon: icon, 6211 closeLabel: closeLabel, 6212 header: header, 6213 headerClassName: headerClassName, 6214 panelClassName: panelClassName 6215 }, children), (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { 6216 scope: "core/edit-site", 6217 identifier: identifier, 6218 icon: icon 6219 }, title)); 6220 } 6221 6222 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js 6223 6224 6225 /** 6226 * WordPress dependencies 6227 */ 6228 6229 const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6230 viewBox: "0 0 24 24", 6231 xmlns: "http://www.w3.org/2000/svg" 6232 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6233 d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z" 6234 })); 6235 /* harmony default export */ var library_styles = (styles); 6236 6237 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js 6238 6239 6240 6241 /** 6242 * External dependencies 6243 */ 6244 6245 /** 6246 * WordPress dependencies 6247 */ 6248 6249 6250 function IconWithCurrentColor(_ref) { 6251 let { 6252 className, 6253 ...props 6254 } = _ref; 6255 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, extends_extends({ 6256 className: classnames_default()(className, 'edit-site-global-styles-icon-with-current-color') 6257 }, props)); 6258 } 6259 6260 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js 6261 6262 6263 6264 /** 6265 * WordPress dependencies 6266 */ 6267 6268 /** 6269 * Internal dependencies 6270 */ 6271 6272 6273 6274 function GenericNavigationButton(_ref) { 6275 let { 6276 icon, 6277 children, 6278 ...props 6279 } = _ref; 6280 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, props, icon && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 6281 justify: "flex-start" 6282 }, (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { 6283 icon: icon, 6284 size: 24 6285 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children); 6286 } 6287 6288 function NavigationButton(props) { 6289 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, extends_extends({ 6290 as: GenericNavigationButton 6291 }, props)); 6292 } 6293 6294 function NavigationBackButton(props) { 6295 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, extends_extends({ 6296 as: GenericNavigationButton 6297 }, props)); 6298 } 6299 6300 6301 6302 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js 6303 6304 6305 /** 6306 * WordPress dependencies 6307 */ 6308 6309 const typography = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6310 xmlns: "http://www.w3.org/2000/svg", 6311 viewBox: "0 0 24 24" 6312 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6313 d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z" 6314 })); 6315 /* harmony default export */ var library_typography = (typography); 6316 6317 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js 6318 6319 6320 /** 6321 * WordPress dependencies 6322 */ 6323 6324 const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6325 viewBox: "0 0 24 24", 6326 xmlns: "http://www.w3.org/2000/svg" 6327 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6328 d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" 6329 })); 6330 /* harmony default export */ var library_color = (color); 6331 6332 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 6333 6334 6335 /** 6336 * WordPress dependencies 6337 */ 6338 6339 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6340 xmlns: "http://www.w3.org/2000/svg", 6341 viewBox: "0 0 24 24" 6342 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6343 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 6344 })); 6345 /* harmony default export */ var library_layout = (layout); 6346 6347 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js 6348 /** 6349 * External dependencies 6350 */ 6351 6352 /* Supporting data. */ 6353 6354 const ROOT_BLOCK_NAME = 'root'; 6355 const ROOT_BLOCK_SELECTOR = 'body'; 6356 const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'])); 6357 const PRESET_METADATA = [{ 6358 path: ['color', 'palette'], 6359 valueKey: 'color', 6360 cssVarInfix: 'color', 6361 classes: [{ 6362 classSuffix: 'color', 6363 propertyName: 'color' 6364 }, { 6365 classSuffix: 'background-color', 6366 propertyName: 'background-color' 6367 }, { 6368 classSuffix: 'border-color', 6369 propertyName: 'border-color' 6370 }] 6371 }, { 6372 path: ['color', 'gradients'], 6373 valueKey: 'gradient', 6374 cssVarInfix: 'gradient', 6375 classes: [{ 6376 classSuffix: 'gradient-background', 6377 propertyName: 'background' 6378 }] 6379 }, { 6380 path: ['color', 'duotone'], 6381 cssVarInfix: 'duotone', 6382 valueFunc: _ref => { 6383 let { 6384 slug 6385 } = _ref; 6386 return `url( '#wp-duotone-$slug}' )`; 6387 }, 6388 classes: [] 6389 }, { 6390 path: ['typography', 'fontSizes'], 6391 valueKey: 'size', 6392 cssVarInfix: 'font-size', 6393 classes: [{ 6394 classSuffix: 'font-size', 6395 propertyName: 'font-size' 6396 }] 6397 }, { 6398 path: ['typography', 'fontFamilies'], 6399 valueKey: 'fontFamily', 6400 cssVarInfix: 'font-family', 6401 classes: [{ 6402 classSuffix: 'font-family', 6403 propertyName: 'font-family' 6404 }] 6405 }]; 6406 const STYLE_PATH_TO_CSS_VAR_INFIX = { 6407 'color.background': 'color', 6408 'color.text': 'color', 6409 'elements.link.color.text': 'color', 6410 'color.gradient': 'gradient', 6411 'typography.fontSize': 'font-size', 6412 'typography.fontFamily': 'font-family' 6413 }; 6414 6415 function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { 6416 // Block presets take priority above root level presets. 6417 const orderedPresetsByOrigin = [(0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, ...presetPath]), (0,external_lodash_namespaceObject.get)(features, presetPath)]; 6418 6419 for (const presetByOrigin of orderedPresetsByOrigin) { 6420 if (presetByOrigin) { 6421 // Preset origins ordered by priority. 6422 const origins = ['custom', 'theme', 'default']; 6423 6424 for (const origin of origins) { 6425 const presets = presetByOrigin[origin]; 6426 6427 if (presets) { 6428 const presetObject = (0,external_lodash_namespaceObject.find)(presets, preset => preset[presetProperty] === presetValueValue); 6429 6430 if (presetObject) { 6431 if (presetProperty === 'slug') { 6432 return presetObject; 6433 } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored. 6434 6435 6436 const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug); 6437 6438 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { 6439 return presetObject; 6440 } 6441 6442 return undefined; 6443 } 6444 } 6445 } 6446 } 6447 } 6448 } 6449 6450 function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { 6451 if (!presetPropertyValue) { 6452 return presetPropertyValue; 6453 } 6454 6455 const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; 6456 const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', cssVarInfix]); 6457 6458 if (!metadata) { 6459 // The property doesn't have preset data 6460 // so the value should be returned as it is. 6461 return presetPropertyValue; 6462 } 6463 6464 const { 6465 valueKey, 6466 path 6467 } = metadata; 6468 const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue); 6469 6470 if (!presetObject) { 6471 // Value wasn't found in the presets, 6472 // so it must be a custom value. 6473 return presetPropertyValue; 6474 } 6475 6476 return `var:preset|$cssVarInfix}|$presetObject.slug}`; 6477 } 6478 6479 function getValueFromPresetVariable(features, blockName, variable, _ref2) { 6480 let [presetType, slug] = _ref2; 6481 const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', presetType]); 6482 6483 if (!metadata) { 6484 return variable; 6485 } 6486 6487 const presetObject = findInPresetsBy(features, blockName, metadata.path, 'slug', slug); 6488 6489 if (presetObject) { 6490 const { 6491 valueKey 6492 } = metadata; 6493 const result = presetObject[valueKey]; 6494 return getValueFromVariable(features, blockName, result); 6495 } 6496 6497 return variable; 6498 } 6499 6500 function getValueFromCustomVariable(features, blockName, variable, path) { 6501 var _get; 6502 6503 const result = (_get = (0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(features, ['custom', ...path]); 6504 6505 if (!result) { 6506 return variable; 6507 } // A variable may reference another variable so we need recursion until we find the value. 6508 6509 6510 return getValueFromVariable(features, blockName, result); 6511 } 6512 6513 function getValueFromVariable(features, blockName, variable) { 6514 if (!variable || !(0,external_lodash_namespaceObject.isString)(variable)) { 6515 return variable; 6516 } 6517 6518 const USER_VALUE_PREFIX = 'var:'; 6519 const THEME_VALUE_PREFIX = 'var(--wp--'; 6520 const THEME_VALUE_SUFFIX = ')'; 6521 let parsedVar; 6522 6523 if (variable.startsWith(USER_VALUE_PREFIX)) { 6524 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|'); 6525 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { 6526 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--'); 6527 } else { 6528 // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )` 6529 return variable; 6530 } 6531 6532 const [type, ...path] = parsedVar; 6533 6534 if (type === 'preset') { 6535 return getValueFromPresetVariable(features, blockName, variable, path); 6536 } 6537 6538 if (type === 'custom') { 6539 return getValueFromCustomVariable(features, blockName, variable, path); 6540 } 6541 6542 return variable; 6543 } 6544 6545 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context.js 6546 /** 6547 * WordPress dependencies 6548 */ 6549 6550 const DEFAULT_GLOBAL_STYLES_CONTEXT = { 6551 user: {}, 6552 base: {}, 6553 merged: {}, 6554 setUserConfig: () => {} 6555 }; 6556 const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT); 6557 6558 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js 6559 /** 6560 * External dependencies 6561 */ 6562 6563 /** 6564 * WordPress dependencies 6565 */ 6566 6567 6568 6569 6570 /** 6571 * Internal dependencies 6572 */ 6573 6574 6575 6576 const EMPTY_CONFIG = { 6577 isGlobalStylesUserThemeJSON: true, 6578 version: 1 6579 }; 6580 const useGlobalStylesReset = () => { 6581 const { 6582 user: config, 6583 setUserConfig 6584 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6585 const canReset = !!config && !(0,external_lodash_namespaceObject.isEqual)(config, EMPTY_CONFIG); 6586 return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])]; 6587 }; 6588 function useSetting(path, blockName) { 6589 var _getSettingValueForCo; 6590 6591 let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; 6592 const { 6593 merged: mergedConfig, 6594 base: baseConfig, 6595 user: userConfig, 6596 setUserConfig 6597 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6598 const fullPath = !blockName ? `settings.$path}` : `settings.blocks.$blockName}.$path}`; 6599 6600 const setSetting = newValue => { 6601 setUserConfig(currentConfig => { 6602 const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); 6603 const pathToSet = external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path] ? fullPath + '.custom' : fullPath; 6604 (0,external_lodash_namespaceObject.set)(newUserConfig, pathToSet, newValue); 6605 return newUserConfig; 6606 }); 6607 }; 6608 6609 const getSettingValueForContext = name => { 6610 const currentPath = !name ? `settings.$path}` : `settings.blocks.$name}.$path}`; 6611 6612 const getSettingValue = configToUse => { 6613 const result = (0,external_lodash_namespaceObject.get)(configToUse, currentPath); 6614 6615 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path]) { 6616 var _ref, _result$custom; 6617 6618 return (_ref = (_result$custom = result === null || result === void 0 ? void 0 : result.custom) !== null && _result$custom !== void 0 ? _result$custom : result === null || result === void 0 ? void 0 : result.theme) !== null && _ref !== void 0 ? _ref : result === null || result === void 0 ? void 0 : result.default; 6619 } 6620 6621 return result; 6622 }; 6623 6624 let result; 6625 6626 switch (source) { 6627 case 'all': 6628 result = getSettingValue(mergedConfig); 6629 break; 6630 6631 case 'user': 6632 result = getSettingValue(userConfig); 6633 break; 6634 6635 case 'base': 6636 result = getSettingValue(baseConfig); 6637 break; 6638 6639 default: 6640 throw 'Unsupported source'; 6641 } 6642 6643 return result; 6644 }; // Unlike styles settings get inherited from top level settings. 6645 6646 6647 const resultWithFallback = (_getSettingValueForCo = getSettingValueForContext(blockName)) !== null && _getSettingValueForCo !== void 0 ? _getSettingValueForCo : getSettingValueForContext(); 6648 return [resultWithFallback, setSetting]; 6649 } 6650 function useStyle(path, blockName) { 6651 var _get; 6652 6653 let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; 6654 const { 6655 merged: mergedConfig, 6656 base: baseConfig, 6657 user: userConfig, 6658 setUserConfig 6659 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6660 const finalPath = !blockName ? `styles.$path}` : `styles.blocks.$blockName}.$path}`; 6661 6662 const setStyle = newValue => { 6663 setUserConfig(currentConfig => { 6664 const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); 6665 (0,external_lodash_namespaceObject.set)(newUserConfig, finalPath, getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue)); 6666 return newUserConfig; 6667 }); 6668 }; 6669 6670 let result; 6671 6672 switch (source) { 6673 case 'all': 6674 result = getValueFromVariable(mergedConfig.settings, blockName, (_get = (0,external_lodash_namespaceObject.get)(userConfig, finalPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(baseConfig, finalPath)); 6675 break; 6676 6677 case 'user': 6678 result = getValueFromVariable(mergedConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(userConfig, finalPath)); 6679 break; 6680 6681 case 'base': 6682 result = getValueFromVariable(baseConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(baseConfig, finalPath)); 6683 break; 6684 6685 default: 6686 throw 'Unsupported source'; 6687 } 6688 6689 return [result, setStyle]; 6690 } 6691 const hooks_ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']; 6692 function getSupportedGlobalStylesPanels(name) { 6693 if (!name) { 6694 return hooks_ROOT_BLOCK_SUPPORTS; 6695 } 6696 6697 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 6698 6699 if (!blockType) { 6700 return []; 6701 } 6702 6703 const supportKeys = []; 6704 Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => { 6705 if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { 6706 return; 6707 } // Opting out means that, for certain support keys like background color, 6708 // blocks have to explicitly set the support value false. If the key is 6709 // unset, we still enable it. 6710 6711 6712 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { 6713 if ((0,external_lodash_namespaceObject.has)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0]) && (0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) { 6714 return supportKeys.push(styleName); 6715 } 6716 } 6717 6718 if ((0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) { 6719 return supportKeys.push(styleName); 6720 } 6721 }); 6722 return supportKeys; 6723 } 6724 function useColorsPerOrigin(name) { 6725 const [customColors] = useSetting('color.palette.custom', name); 6726 const [themeColors] = useSetting('color.palette.theme', name); 6727 const [defaultColors] = useSetting('color.palette.default', name); 6728 const [shouldDisplayDefaultColors] = useSetting('color.defaultPalette'); 6729 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6730 const result = []; 6731 6732 if (themeColors && themeColors.length) { 6733 result.push({ 6734 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), 6735 colors: themeColors 6736 }); 6737 } 6738 6739 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { 6740 result.push({ 6741 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), 6742 colors: defaultColors 6743 }); 6744 } 6745 6746 if (customColors && customColors.length) { 6747 result.push({ 6748 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), 6749 colors: customColors 6750 }); 6751 } 6752 6753 return result; 6754 }, [customColors, themeColors, defaultColors]); 6755 } 6756 function useGradientsPerOrigin(name) { 6757 const [customGradients] = useSetting('color.gradients.custom', name); 6758 const [themeGradients] = useSetting('color.gradients.theme', name); 6759 const [defaultGradients] = useSetting('color.gradients.default', name); 6760 const [shouldDisplayDefaultGradients] = useSetting('color.defaultGradients'); 6761 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6762 const result = []; 6763 6764 if (themeGradients && themeGradients.length) { 6765 result.push({ 6766 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), 6767 gradients: themeGradients 6768 }); 6769 } 6770 6771 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { 6772 result.push({ 6773 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), 6774 gradients: defaultGradients 6775 }); 6776 } 6777 6778 if (customGradients && customGradients.length) { 6779 result.push({ 6780 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), 6781 gradients: customGradients 6782 }); 6783 } 6784 6785 return result; 6786 }, [customGradients, themeGradients, defaultGradients]); 6787 } 6788 6789 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/border-panel.js 6790 6791 6792 /** 6793 * WordPress dependencies 6794 */ 6795 6796 6797 6798 /** 6799 * Internal dependencies 6800 */ 6801 6802 6803 const MIN_BORDER_WIDTH = 0; 6804 function useHasBorderPanel(name) { 6805 const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)]; 6806 return controls.some(Boolean); 6807 } 6808 6809 function useHasBorderColorControl(name) { 6810 const supports = getSupportedGlobalStylesPanels(name); 6811 return useSetting('border.color', name)[0] && supports.includes('borderColor'); 6812 } 6813 6814 function useHasBorderRadiusControl(name) { 6815 const supports = getSupportedGlobalStylesPanels(name); 6816 return useSetting('border.radius', name)[0] && supports.includes('borderRadius'); 6817 } 6818 6819 function useHasBorderStyleControl(name) { 6820 const supports = getSupportedGlobalStylesPanels(name); 6821 return useSetting('border.style', name)[0] && supports.includes('borderStyle'); 6822 } 6823 6824 function useHasBorderWidthControl(name) { 6825 const supports = getSupportedGlobalStylesPanels(name); 6826 return useSetting('border.width', name)[0] && supports.includes('borderWidth'); 6827 } 6828 6829 function BorderPanel(_ref) { 6830 let { 6831 name 6832 } = _ref; 6833 // To better reflect if the user has customized a value we need to 6834 // ensure the style value being checked is from the `user` origin. 6835 const [userBorderStyles] = useStyle('border', name, 'user'); 6836 6837 const createHasValueCallback = feature => () => !!(userBorderStyles !== null && userBorderStyles !== void 0 && userBorderStyles[feature]); 6838 6839 const createResetCallback = setStyle => () => setStyle(undefined); 6840 6841 const handleOnChange = setStyle => value => { 6842 setStyle(value || undefined); 6843 }; 6844 6845 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 6846 availableUnits: useSetting('spacing.units')[0] || ['px', 'em', 'rem'] 6847 }); // Border width. 6848 6849 const showBorderWidth = useHasBorderWidthControl(name); 6850 const [borderWidthValue, setBorderWidth] = useStyle('border.width', name); // Border style. 6851 6852 const showBorderStyle = useHasBorderStyleControl(name); 6853 const [borderStyle, setBorderStyle] = useStyle('border.style', name); // When we set a border color or width ensure we have a style so the user 6854 // can see a visible border. 6855 6856 const handleOnChangeWithStyle = setStyle => value => { 6857 if (!!value && !borderStyle) { 6858 setBorderStyle('solid'); 6859 } 6860 6861 setStyle(value || undefined); 6862 }; // Border color. 6863 6864 6865 const showBorderColor = useHasBorderColorControl(name); 6866 const [borderColor, setBorderColor] = useStyle('border.color', name); 6867 const disableCustomColors = !useSetting('color.custom')[0]; 6868 const disableCustomGradients = !useSetting('color.customGradient')[0]; 6869 const borderColorSettings = [{ 6870 label: (0,external_wp_i18n_namespaceObject.__)('Color'), 6871 colors: useColorsPerOrigin(name), 6872 colorValue: borderColor, 6873 onColorChange: handleOnChangeWithStyle(setBorderColor), 6874 clearable: false 6875 }]; // Border radius. 6876 6877 const showBorderRadius = useHasBorderRadiusControl(name); 6878 const [borderRadiusValues, setBorderRadius] = useStyle('border.radius', name); 6879 6880 const hasBorderRadius = () => { 6881 const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius; 6882 6883 if (typeof borderValues === 'object') { 6884 return Object.entries(borderValues).some(Boolean); 6885 } 6886 6887 return !!borderValues; 6888 }; 6889 6890 const resetAll = () => { 6891 setBorderColor(undefined); 6892 setBorderRadius(undefined); 6893 setBorderStyle(undefined); 6894 setBorderWidth(undefined); 6895 }; 6896 6897 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { 6898 label: (0,external_wp_i18n_namespaceObject.__)('Border'), 6899 resetAll: resetAll 6900 }, showBorderWidth && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 6901 className: "single-column", 6902 hasValue: createHasValueCallback('width'), 6903 label: (0,external_wp_i18n_namespaceObject.__)('Width'), 6904 onDeselect: createResetCallback(setBorderWidth), 6905 isShownByDefault: true 6906 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { 6907 value: borderWidthValue, 6908 label: (0,external_wp_i18n_namespaceObject.__)('Width'), 6909 min: MIN_BORDER_WIDTH, 6910 onChange: handleOnChangeWithStyle(setBorderWidth), 6911 units: units 6912 })), showBorderStyle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 6913 className: "single-column", 6914 hasValue: createHasValueCallback('style'), 6915 label: (0,external_wp_i18n_namespaceObject.__)('Style'), 6916 onDeselect: createResetCallback(setBorderStyle), 6917 isShownByDefault: true 6918 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderStyleControl, { 6919 value: borderStyle, 6920 onChange: handleOnChange(setBorderStyle) 6921 })), showBorderColor && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 6922 hasValue: createHasValueCallback('color'), 6923 label: (0,external_wp_i18n_namespaceObject.__)('Color'), 6924 onDeselect: createResetCallback(setBorderColor), 6925 isShownByDefault: true 6926 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, { 6927 __experimentalHasMultipleOrigins: true, 6928 __experimentalIsRenderedInSidebar: true, 6929 disableCustomColors: disableCustomColors, 6930 disableCustomGradients: disableCustomGradients, 6931 enableAlpha: true, 6932 settings: borderColorSettings 6933 })), showBorderRadius && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 6934 hasValue: hasBorderRadius, 6935 label: (0,external_wp_i18n_namespaceObject.__)('Radius'), 6936 onDeselect: createResetCallback(setBorderRadius), 6937 isShownByDefault: true 6938 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderRadiusControl, { 6939 values: borderRadiusValues, 6940 onChange: handleOnChange(setBorderRadius) 6941 }))); 6942 } 6943 6944 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-utils.js 6945 /** 6946 * Internal dependencies 6947 */ 6948 6949 function useHasColorPanel(name) { 6950 const supports = getSupportedGlobalStylesPanels(name); 6951 return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor'); 6952 } 6953 6954 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js 6955 6956 6957 /** 6958 * WordPress dependencies 6959 */ 6960 6961 6962 6963 /** 6964 * Internal dependencies 6965 */ 6966 6967 6968 const AXIAL_SIDES = ['horizontal', 'vertical']; 6969 function useHasDimensionsPanel(name) { 6970 const hasPadding = useHasPadding(name); 6971 const hasMargin = useHasMargin(name); 6972 const hasGap = useHasGap(name); 6973 return hasPadding || hasMargin || hasGap; 6974 } 6975 6976 function useHasPadding(name) { 6977 const supports = getSupportedGlobalStylesPanels(name); 6978 const [settings] = useSetting('spacing.padding', name); 6979 return settings && supports.includes('padding'); 6980 } 6981 6982 function useHasMargin(name) { 6983 const supports = getSupportedGlobalStylesPanels(name); 6984 const [settings] = useSetting('spacing.margin', name); 6985 return settings && supports.includes('margin'); 6986 } 6987 6988 function useHasGap(name) { 6989 const supports = getSupportedGlobalStylesPanels(name); 6990 const [settings] = useSetting('spacing.blockGap', name); // Do not show the gap control panel for block-level global styles 6991 // as they do not work on the frontend. 6992 // See: https://github.com/WordPress/gutenberg/pull/39845. 6993 // We can revert this condition when they're working again. 6994 6995 return !!name ? false : settings && supports.includes('--wp--style--block-gap'); 6996 } 6997 6998 function filterValuesBySides(values, sides) { 6999 if (!sides) { 7000 // If no custom side configuration all sides are opted into by default. 7001 return values; 7002 } // Only include sides opted into within filtered values. 7003 7004 7005 const filteredValues = {}; 7006 sides.forEach(side => { 7007 if (side === 'vertical') { 7008 filteredValues.top = values.top; 7009 filteredValues.bottom = values.bottom; 7010 } 7011 7012 if (side === 'horizontal') { 7013 filteredValues.left = values.left; 7014 filteredValues.right = values.right; 7015 } 7016 7017 filteredValues[side] = values[side]; 7018 }); 7019 return filteredValues; 7020 } 7021 7022 function splitStyleValue(value) { 7023 // Check for shorthand value ( a string value ). 7024 if (value && typeof value === 'string') { 7025 // Convert to value for individual sides for BoxControl. 7026 return { 7027 top: value, 7028 right: value, 7029 bottom: value, 7030 left: value 7031 }; 7032 } 7033 7034 return value; 7035 } 7036 7037 function DimensionsPanel(_ref) { 7038 let { 7039 name 7040 } = _ref; 7041 const showPaddingControl = useHasPadding(name); 7042 const showMarginControl = useHasMargin(name); 7043 const showGapControl = useHasGap(name); 7044 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 7045 availableUnits: useSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw'] 7046 }); 7047 const [rawPadding, setRawPadding] = useStyle('spacing.padding', name); 7048 const paddingValues = splitStyleValue(rawPadding); 7049 const paddingSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'padding'); 7050 const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side)); 7051 7052 const setPaddingValues = newPaddingValues => { 7053 const padding = filterValuesBySides(newPaddingValues, paddingSides); 7054 setRawPadding(padding); 7055 }; 7056 7057 const resetPaddingValue = () => setPaddingValues({}); 7058 7059 const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length; 7060 7061 const [rawMargin, setRawMargin] = useStyle('spacing.margin', name); 7062 const marginValues = splitStyleValue(rawMargin); 7063 const marginSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'margin'); 7064 const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side)); 7065 7066 const setMarginValues = newMarginValues => { 7067 const margin = filterValuesBySides(newMarginValues, marginSides); 7068 setRawMargin(margin); 7069 }; 7070 7071 const resetMarginValue = () => setMarginValues({}); 7072 7073 const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length; 7074 7075 const [gapValue, setGapValue] = useStyle('spacing.blockGap', name); 7076 7077 const resetGapValue = () => setGapValue(undefined); 7078 7079 const hasGapValue = () => !!gapValue; 7080 7081 const resetAll = () => { 7082 resetPaddingValue(); 7083 resetMarginValue(); 7084 resetGapValue(); 7085 }; 7086 7087 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { 7088 label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'), 7089 resetAll: resetAll 7090 }, showPaddingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 7091 hasValue: hasPaddingValue, 7092 label: (0,external_wp_i18n_namespaceObject.__)('Padding'), 7093 onDeselect: resetPaddingValue, 7094 isShownByDefault: true 7095 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { 7096 values: paddingValues, 7097 onChange: setPaddingValues, 7098 label: (0,external_wp_i18n_namespaceObject.__)('Padding'), 7099 sides: paddingSides, 7100 units: units, 7101 allowReset: false, 7102 splitOnAxis: isAxialPadding 7103 })), showMarginControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 7104 hasValue: hasMarginValue, 7105 label: (0,external_wp_i18n_namespaceObject.__)('Margin'), 7106 onDeselect: resetMarginValue, 7107 isShownByDefault: true 7108 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { 7109 values: marginValues, 7110 onChange: setMarginValues, 7111 label: (0,external_wp_i18n_namespaceObject.__)('Margin'), 7112 sides: marginSides, 7113 units: units, 7114 allowReset: false, 7115 splitOnAxis: isAxialMargin 7116 })), showGapControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { 7117 hasValue: hasGapValue, 7118 label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), 7119 onDeselect: resetGapValue, 7120 isShownByDefault: true 7121 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { 7122 label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), 7123 __unstableInputWidth: "80px", 7124 min: 0, 7125 onChange: setGapValue, 7126 units: units, 7127 value: gapValue 7128 }))); 7129 } 7130 7131 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js 7132 7133 7134 /** 7135 * WordPress dependencies 7136 */ 7137 7138 7139 /** 7140 * Internal dependencies 7141 */ 7142 7143 7144 function useHasTypographyPanel(name) { 7145 const hasLineHeight = useHasLineHeightControl(name); 7146 const hasFontAppearance = useHasAppearanceControl(name); 7147 const hasLetterSpacing = useHasLetterSpacingControl(name); 7148 const supports = getSupportedGlobalStylesPanels(name); 7149 return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize'); 7150 } 7151 7152 function useHasLineHeightControl(name) { 7153 const supports = getSupportedGlobalStylesPanels(name); 7154 return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight'); 7155 } 7156 7157 function useHasAppearanceControl(name) { 7158 const supports = getSupportedGlobalStylesPanels(name); 7159 const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); 7160 const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); 7161 return hasFontStyles || hasFontWeights; 7162 } 7163 7164 function useHasLetterSpacingControl(name) { 7165 const supports = getSupportedGlobalStylesPanels(name); 7166 return useSetting('typography.letterSpacing', name)[0] && supports.includes('letterSpacing'); 7167 } 7168 7169 function TypographyPanel(_ref) { 7170 let { 7171 name, 7172 element 7173 } = _ref; 7174 const supports = getSupportedGlobalStylesPanels(name); 7175 const prefix = element === 'text' || !element ? '' : `elements.$element}.`; 7176 const [fontSizes] = useSetting('typography.fontSizes', name); 7177 const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0]; 7178 const [fontFamilies] = useSetting('typography.fontFamilies', name); 7179 const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); 7180 const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); 7181 const hasLineHeightEnabled = useHasLineHeightControl(name); 7182 const hasAppearanceControl = useHasAppearanceControl(name); 7183 const hasLetterSpacingControl = useHasLetterSpacingControl(name); 7184 const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name); 7185 const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name); 7186 const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name); 7187 const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name); 7188 const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name); 7189 const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); 7190 const [backgroundColor] = useStyle(prefix + 'color.background', name); 7191 const [gradientValue] = useStyle(prefix + 'color.gradient', name); 7192 const [color] = useStyle(prefix + 'color.text', name); 7193 const extraStyles = element === 'link' ? { 7194 textDecoration: 'underline' 7195 } : {}; 7196 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 7197 className: "edit-site-typography-panel", 7198 initialOpen: true 7199 }, (0,external_wp_element_namespaceObject.createElement)("div", { 7200 className: "edit-site-typography-panel__preview", 7201 style: { 7202 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 7203 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 7204 color, 7205 fontSize, 7206 fontStyle, 7207 fontWeight, 7208 letterSpacing, 7209 ...extraStyles 7210 } 7211 }, "Aa"), supports.includes('fontFamily') && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontFamilyControl, { 7212 fontFamilies: fontFamilies, 7213 value: fontFamily, 7214 onChange: setFontFamily 7215 }), supports.includes('fontSize') && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, { 7216 value: fontSize, 7217 onChange: setFontSize, 7218 fontSizes: fontSizes, 7219 disableCustomFontSizes: disableCustomFontSizes 7220 }), hasLineHeightEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { 7221 marginBottom: 6 7222 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.LineHeightControl, { 7223 __nextHasNoMarginBottom: true, 7224 value: lineHeight, 7225 onChange: setLineHeight 7226 })), hasAppearanceControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontAppearanceControl, { 7227 value: { 7228 fontStyle, 7229 fontWeight 7230 }, 7231 onChange: _ref2 => { 7232 let { 7233 fontStyle: newFontStyle, 7234 fontWeight: newFontWeight 7235 } = _ref2; 7236 setFontStyle(newFontStyle); 7237 setFontWeight(newFontWeight); 7238 }, 7239 hasFontStyles: hasFontStyles, 7240 hasFontWeights: hasFontWeights 7241 }), hasLetterSpacingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLetterSpacingControl, { 7242 value: letterSpacing, 7243 onChange: setLetterSpacing 7244 })); 7245 } 7246 7247 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context-menu.js 7248 7249 7250 /** 7251 * WordPress dependencies 7252 */ 7253 7254 7255 7256 /** 7257 * Internal dependencies 7258 */ 7259 7260 7261 7262 7263 7264 7265 7266 function ContextMenu(_ref) { 7267 let { 7268 name, 7269 parentMenu = '' 7270 } = _ref; 7271 const hasTypographyPanel = useHasTypographyPanel(name); 7272 const hasColorPanel = useHasColorPanel(name); 7273 const hasBorderPanel = useHasBorderPanel(name); 7274 const hasDimensionsPanel = useHasDimensionsPanel(name); 7275 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 7276 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 7277 icon: library_typography, 7278 path: parentMenu + '/typography' 7279 }, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 7280 icon: library_color, 7281 path: parentMenu + '/colors' 7282 }, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 7283 icon: library_layout, 7284 path: parentMenu + '/layout' 7285 }, (0,external_wp_i18n_namespaceObject.__)('Layout'))); 7286 } 7287 7288 /* harmony default export */ var context_menu = (ContextMenu); 7289 7290 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/utils.js 7291 /** 7292 * External dependencies 7293 */ 7294 7295 /** 7296 * Internal dependencies 7297 */ 7298 7299 function generateBoxRules(style, options, path, ruleKey) { 7300 const boxStyle = (0,external_lodash_namespaceObject.get)(style, path); 7301 7302 if (!boxStyle) { 7303 return []; 7304 } 7305 7306 const rules = []; 7307 7308 if (typeof boxStyle === 'string') { 7309 rules.push({ 7310 selector: options.selector, 7311 key: ruleKey, 7312 value: boxStyle 7313 }); 7314 } else { 7315 const sideRules = ['top', 'right', 'bottom', 'left'].reduce((acc, side) => { 7316 const value = (0,external_lodash_namespaceObject.get)(boxStyle, [side]); 7317 7318 if (value) { 7319 acc.push({ 7320 selector: options.selector, 7321 key: `$ruleKey}${(0,external_lodash_namespaceObject.upperFirst)(side)}`, 7322 value 7323 }); 7324 } 7325 7326 return acc; 7327 }, []); 7328 rules.push(...sideRules); 7329 } 7330 7331 return rules; 7332 } 7333 7334 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/padding.js 7335 /** 7336 * Internal dependencies 7337 */ 7338 7339 const padding = { 7340 name: 'padding', 7341 generate: (style, options) => { 7342 return generateBoxRules(style, options, ['spacing', 'padding'], 'padding'); 7343 } 7344 }; 7345 /* harmony default export */ var styles_padding = (padding); 7346 7347 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/margin.js 7348 /** 7349 * Internal dependencies 7350 */ 7351 7352 const margin = { 7353 name: 'margin', 7354 generate: (style, options) => { 7355 return generateBoxRules(style, options, ['spacing', 'margin'], 'margin'); 7356 } 7357 }; 7358 /* harmony default export */ var styles_margin = (margin); 7359 7360 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/index.js 7361 /** 7362 * Internal dependencies 7363 */ 7364 7365 7366 const styleDefinitions = [styles_margin, styles_padding]; 7367 7368 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/index.js 7369 /** 7370 * External dependencies 7371 */ 7372 7373 /** 7374 * Internal dependencies 7375 */ 7376 7377 7378 /** 7379 * Generates a stylesheet for a given style object and selector. 7380 * 7381 * @param style Style object. 7382 * @param options Options object with settings to adjust how the styles are generated. 7383 * 7384 * @return generated stylesheet. 7385 */ 7386 7387 function generate(style, options) { 7388 const rules = getCSSRules(style, options); 7389 const groupedRules = groupBy(rules, 'selector'); 7390 const selectorRules = Object.keys(groupedRules).reduce((acc, subSelector) => { 7391 acc.push(`$subSelector} { $groupedRules[subSelector].map(rule => `$kebabCase(rule.key)}: $rule.value};`).join(' ')} }`); 7392 return acc; 7393 }, []); 7394 return selectorRules.join('\n'); 7395 } 7396 /** 7397 * Returns a JSON representation of the generated CSS rules. 7398 * 7399 * @param style Style object. 7400 * @param options Options object with settings to adjust how the styles are generated. 7401 * 7402 * @return generated styles. 7403 */ 7404 7405 function getCSSRules(style, options) { 7406 const rules = []; 7407 styleDefinitions.forEach(definition => { 7408 rules.push(...definition.generate(style, options)); 7409 }); 7410 return rules; 7411 } 7412 7413 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/use-global-styles-output.js 7414 7415 7416 /** 7417 * External dependencies 7418 */ 7419 7420 /** 7421 * WordPress dependencies 7422 */ 7423 7424 7425 7426 7427 7428 /** 7429 * Internal dependencies 7430 */ 7431 7432 /** 7433 * Internal dependencies 7434 */ 7435 7436 7437 7438 7439 function compileStyleValue(uncompiledValue) { 7440 const VARIABLE_REFERENCE_PREFIX = 'var:'; 7441 const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; 7442 const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; 7443 7444 if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { 7445 const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); 7446 return `var(--wp--$variable})`; 7447 } 7448 7449 return uncompiledValue; 7450 } 7451 /** 7452 * Transform given preset tree into a set of style declarations. 7453 * 7454 * @param {Object} blockPresets 7455 * 7456 * @return {Array} An array of style declarations. 7457 */ 7458 7459 7460 function getPresetsDeclarations() { 7461 let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7462 return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref) => { 7463 let { 7464 path, 7465 valueKey, 7466 valueFunc, 7467 cssVarInfix 7468 } = _ref; 7469 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); 7470 ['default', 'theme', 'custom'].forEach(origin => { 7471 if (presetByOrigin[origin]) { 7472 presetByOrigin[origin].forEach(value => { 7473 if (valueKey) { 7474 declarations.push(`--wp--preset--$cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: $value[valueKey]}`); 7475 } else if (valueFunc && typeof valueFunc === 'function') { 7476 declarations.push(`--wp--preset--$cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: $valueFunc(value)}`); 7477 } 7478 }); 7479 } 7480 }); 7481 return declarations; 7482 }, []); 7483 } 7484 /** 7485 * Transform given preset tree into a set of preset class declarations. 7486 * 7487 * @param {string} blockSelector 7488 * @param {Object} blockPresets 7489 * @return {string} CSS declarations for the preset classes. 7490 */ 7491 7492 7493 function getPresetsClasses(blockSelector) { 7494 let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 7495 return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref2) => { 7496 let { 7497 path, 7498 cssVarInfix, 7499 classes 7500 } = _ref2; 7501 7502 if (!classes) { 7503 return declarations; 7504 } 7505 7506 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); 7507 ['default', 'theme', 'custom'].forEach(origin => { 7508 if (presetByOrigin[origin]) { 7509 presetByOrigin[origin].forEach(_ref3 => { 7510 let { 7511 slug 7512 } = _ref3; 7513 classes.forEach(_ref4 => { 7514 let { 7515 classSuffix, 7516 propertyName 7517 } = _ref4; 7518 const classSelectorToUse = `.has-${(0,external_lodash_namespaceObject.kebabCase)(slug)}-$classSuffix}`; 7519 const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" 7520 .map(selector => `$selector}$classSelectorToUse}`).join(','); 7521 const value = `var(--wp--preset--$cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(slug)})`; 7522 declarations += `$selectorToUse}{$propertyName}: $value} !important;}`; 7523 }); 7524 }); 7525 } 7526 }); 7527 return declarations; 7528 }, ''); 7529 } 7530 7531 function getPresetsSvgFilters() { 7532 let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7533 return PRESET_METADATA.filter( // Duotone are the only type of filters for now. 7534 metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => { 7535 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, metadata.path, {}); 7536 return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstablePresetDuotoneFilter, { 7537 preset: preset, 7538 key: preset.slug 7539 }))); 7540 }); 7541 } 7542 7543 function flattenTree() { 7544 let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7545 let prefix = arguments.length > 1 ? arguments[1] : undefined; 7546 let token = arguments.length > 2 ? arguments[2] : undefined; 7547 let result = []; 7548 Object.keys(input).forEach(key => { 7549 const newKey = prefix + (0,external_lodash_namespaceObject.kebabCase)(key.replace('/', '-')); 7550 const newLeaf = input[key]; 7551 7552 if (newLeaf instanceof Object) { 7553 const newPrefix = newKey + token; 7554 result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; 7555 } else { 7556 result.push(`$newKey}: $newLeaf}`); 7557 } 7558 }); 7559 return result; 7560 } 7561 /** 7562 * Transform given style tree into a set of style declarations. 7563 * 7564 * @param {Object} blockStyles Block styles. 7565 * 7566 * @return {Array} An array of style declarations. 7567 */ 7568 7569 7570 function getStylesDeclarations() { 7571 let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7572 const output = (0,external_lodash_namespaceObject.reduce)(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => { 7573 let { 7574 value, 7575 properties, 7576 useEngine 7577 } = _ref5; 7578 const pathToValue = value; 7579 7580 if ((0,external_lodash_namespaceObject.first)(pathToValue) === 'elements' || useEngine) { 7581 return declarations; 7582 } 7583 7584 const styleValue = (0,external_lodash_namespaceObject.get)(blockStyles, pathToValue); 7585 7586 if (!!properties && !(0,external_lodash_namespaceObject.isString)(styleValue)) { 7587 Object.entries(properties).forEach(entry => { 7588 const [name, prop] = entry; 7589 7590 if (!(0,external_lodash_namespaceObject.get)(styleValue, [prop], false)) { 7591 // Do not create a declaration 7592 // for sub-properties that don't have any value. 7593 return; 7594 } 7595 7596 const cssProperty = (0,external_lodash_namespaceObject.kebabCase)(name); 7597 declarations.push(`$cssProperty}: $compileStyleValue((0,external_lodash_namespaceObject.get)(styleValue, [prop]))}`); 7598 }); 7599 } else if ((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue, false)) { 7600 const cssProperty = key.startsWith('--') ? key : (0,external_lodash_namespaceObject.kebabCase)(key); 7601 declarations.push(`$cssProperty}: $compileStyleValue((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue))}`); 7602 } 7603 7604 return declarations; 7605 }, []); // The goal is to move everything to server side generated engine styles 7606 // This is temporary as we absorb more and more styles into the engine. 7607 7608 const extraRules = getCSSRules(blockStyles, { 7609 selector: 'self' 7610 }); 7611 extraRules.forEach(rule => { 7612 if (rule.selector !== 'self') { 7613 throw "This style can't be added as inline style"; 7614 } 7615 7616 const cssProperty = rule.key.startsWith('--') ? rule.key : (0,external_lodash_namespaceObject.kebabCase)(rule.key); 7617 output.push(`$cssProperty}: $compileStyleValue(rule.value)}`); 7618 }); 7619 return output; 7620 } 7621 7622 const getNodesWithStyles = (tree, blockSelectors) => { 7623 var _tree$styles, _tree$styles2; 7624 7625 const nodes = []; 7626 7627 if (!(tree !== null && tree !== void 0 && tree.styles)) { 7628 return nodes; 7629 } 7630 7631 const pickStyleKeys = treeToPickFrom => (0,external_lodash_namespaceObject.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter'].includes(key)); // Top-level. 7632 7633 7634 const styles = pickStyleKeys(tree.styles); 7635 7636 if (!!styles) { 7637 nodes.push({ 7638 styles, 7639 selector: ROOT_BLOCK_SELECTOR 7640 }); 7641 } 7642 7643 (0,external_lodash_namespaceObject.forEach)((_tree$styles = tree.styles) === null || _tree$styles === void 0 ? void 0 : _tree$styles.elements, (value, key) => { 7644 if (!!value && !!external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key]) { 7645 nodes.push({ 7646 styles: value, 7647 selector: external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key] 7648 }); 7649 } 7650 }); // Iterate over blocks: they can have styles & elements. 7651 7652 (0,external_lodash_namespaceObject.forEach)((_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.blocks, (node, blockName) => { 7653 var _blockSelectors$block; 7654 7655 const blockStyles = pickStyleKeys(node); 7656 7657 if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) { 7658 nodes.push({ 7659 styles: blockStyles, 7660 selector: blockSelectors[blockName].selector, 7661 duotoneSelector: blockSelectors[blockName].duotoneSelector 7662 }); 7663 } 7664 7665 (0,external_lodash_namespaceObject.forEach)(node === null || node === void 0 ? void 0 : node.elements, (value, elementName) => { 7666 if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== null && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== void 0 && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName])) { 7667 nodes.push({ 7668 styles: value, 7669 selector: blockSelectors[blockName].selector.split(',').map(sel => sel + ' ' + external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]).join(',') 7670 }); 7671 } 7672 }); 7673 }); 7674 return nodes; 7675 }; 7676 const getNodesWithSettings = (tree, blockSelectors) => { 7677 var _tree$settings, _tree$settings2; 7678 7679 const nodes = []; 7680 7681 if (!(tree !== null && tree !== void 0 && tree.settings)) { 7682 return nodes; 7683 } 7684 7685 const pickPresets = treeToPickFrom => { 7686 const presets = {}; 7687 PRESET_METADATA.forEach(_ref6 => { 7688 let { 7689 path 7690 } = _ref6; 7691 const value = (0,external_lodash_namespaceObject.get)(treeToPickFrom, path, false); 7692 7693 if (value !== false) { 7694 (0,external_lodash_namespaceObject.set)(presets, path, value); 7695 } 7696 }); 7697 return presets; 7698 }; // Top-level. 7699 7700 7701 const presets = pickPresets(tree.settings); 7702 const custom = (_tree$settings = tree.settings) === null || _tree$settings === void 0 ? void 0 : _tree$settings.custom; 7703 7704 if (!(0,external_lodash_namespaceObject.isEmpty)(presets) || !!custom) { 7705 nodes.push({ 7706 presets, 7707 custom, 7708 selector: ROOT_BLOCK_SELECTOR 7709 }); 7710 } // Blocks. 7711 7712 7713 (0,external_lodash_namespaceObject.forEach)((_tree$settings2 = tree.settings) === null || _tree$settings2 === void 0 ? void 0 : _tree$settings2.blocks, (node, blockName) => { 7714 const blockPresets = pickPresets(node); 7715 const blockCustom = node.custom; 7716 7717 if (!(0,external_lodash_namespaceObject.isEmpty)(blockPresets) || !!blockCustom) { 7718 nodes.push({ 7719 presets: blockPresets, 7720 custom: blockCustom, 7721 selector: blockSelectors[blockName].selector 7722 }); 7723 } 7724 }); 7725 return nodes; 7726 }; 7727 const toCustomProperties = (tree, blockSelectors) => { 7728 const settings = getNodesWithSettings(tree, blockSelectors); 7729 let ruleset = ''; 7730 settings.forEach(_ref7 => { 7731 let { 7732 presets, 7733 custom, 7734 selector 7735 } = _ref7; 7736 const declarations = getPresetsDeclarations(presets); 7737 const customProps = flattenTree(custom, '--wp--custom--', '--'); 7738 7739 if (customProps.length > 0) { 7740 declarations.push(...customProps); 7741 } 7742 7743 if (declarations.length > 0) { 7744 ruleset = ruleset + `$selector}{$declarations.join(';')};}`; 7745 } 7746 }); 7747 return ruleset; 7748 }; 7749 const toStyles = (tree, blockSelectors) => { 7750 const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); 7751 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 7752 /* 7753 * Reset default browser margin on the root body element. 7754 * This is set on the root selector **before** generating the ruleset 7755 * from the `theme.json`. This is to ensure that if the `theme.json` declares 7756 * `margin` in its `spacing` declaration for the `body` element then these 7757 * user-generated values take precedence in the CSS cascade. 7758 * @link https://github.com/WordPress/gutenberg/issues/36147. 7759 */ 7760 7761 let ruleset = 'body {margin: 0;}'; 7762 nodesWithStyles.forEach(_ref8 => { 7763 let { 7764 selector, 7765 duotoneSelector, 7766 styles 7767 } = _ref8; 7768 const duotoneStyles = {}; 7769 7770 if (styles !== null && styles !== void 0 && styles.filter) { 7771 duotoneStyles.filter = styles.filter; 7772 delete styles.filter; 7773 } // Process duotone styles (they use color.__experimentalDuotone selector). 7774 7775 7776 if (duotoneSelector) { 7777 const duotoneDeclarations = getStylesDeclarations(duotoneStyles); 7778 7779 if (duotoneDeclarations.length === 0) { 7780 return; 7781 } 7782 7783 ruleset = ruleset + `$duotoneSelector}{$duotoneDeclarations.join(';')};}`; 7784 } // Process the remaning block styles (they use either normal block class or __experimentalSelector). 7785 7786 7787 const declarations = getStylesDeclarations(styles); 7788 7789 if (declarations.length === 0) { 7790 return; 7791 } 7792 7793 ruleset = ruleset + `$selector}{$declarations.join(';')};}`; 7794 }); 7795 nodesWithSettings.forEach(_ref9 => { 7796 let { 7797 selector, 7798 presets 7799 } = _ref9; 7800 7801 if (ROOT_BLOCK_SELECTOR === selector) { 7802 // Do not add extra specificity for top-level classes. 7803 selector = ''; 7804 } 7805 7806 const classes = getPresetsClasses(selector, presets); 7807 7808 if (!(0,external_lodash_namespaceObject.isEmpty)(classes)) { 7809 ruleset = ruleset + classes; 7810 } 7811 }); 7812 return ruleset; 7813 }; 7814 function toSvgFilters(tree, blockSelectors) { 7815 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 7816 return nodesWithSettings.flatMap(_ref10 => { 7817 let { 7818 presets 7819 } = _ref10; 7820 return getPresetsSvgFilters(presets); 7821 }); 7822 } 7823 7824 const getBlockSelectors = blockTypes => { 7825 const result = {}; 7826 blockTypes.forEach(blockType => { 7827 var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$; 7828 7829 const name = blockType.name; 7830 const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-'); 7831 const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null; 7832 result[name] = { 7833 name, 7834 selector, 7835 duotoneSelector 7836 }; 7837 }); 7838 return result; 7839 }; 7840 7841 function useGlobalStylesOutput() { 7842 const [stylesheets, setStylesheets] = (0,external_wp_element_namespaceObject.useState)([]); 7843 const [settings, setSettings] = (0,external_wp_element_namespaceObject.useState)({}); 7844 const [svgFilters, setSvgFilters] = (0,external_wp_element_namespaceObject.useState)({}); 7845 const { 7846 merged: mergedConfig 7847 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 7848 (0,external_wp_element_namespaceObject.useEffect)(() => { 7849 if (!(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.styles) || !(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.settings)) { 7850 return; 7851 } 7852 7853 const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)()); 7854 const customProperties = toCustomProperties(mergedConfig, blockSelectors); 7855 const globalStyles = toStyles(mergedConfig, blockSelectors); 7856 const filters = toSvgFilters(mergedConfig, blockSelectors); 7857 setStylesheets([{ 7858 css: customProperties, 7859 isGlobalStyles: true 7860 }, { 7861 css: globalStyles, 7862 isGlobalStyles: true 7863 }]); 7864 setSettings(mergedConfig.settings); 7865 setSvgFilters(filters); 7866 }, [mergedConfig]); 7867 return [stylesheets, settings, svgFilters]; 7868 } 7869 7870 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview.js 7871 7872 7873 /** 7874 * WordPress dependencies 7875 */ 7876 7877 7878 7879 7880 /** 7881 * Internal dependencies 7882 */ 7883 7884 7885 7886 const firstFrame = { 7887 start: { 7888 opacity: 1, 7889 display: 'block' 7890 }, 7891 hover: { 7892 opacity: 0, 7893 display: 'none' 7894 } 7895 }; 7896 const secondFrame = { 7897 hover: { 7898 opacity: 1, 7899 display: 'block' 7900 }, 7901 start: { 7902 opacity: 0, 7903 display: 'none' 7904 } 7905 }; 7906 const normalizedWidth = 248; 7907 const normalizedHeight = 152; 7908 const normalizedColorSwatchSize = 32; 7909 7910 const StylesPreview = _ref => { 7911 let { 7912 label, 7913 isFocused 7914 } = _ref; 7915 const [fontWeight] = useStyle('typography.fontWeight'); 7916 const [fontFamily = 'serif'] = useStyle('typography.fontFamily'); 7917 const [headingFontFamily = fontFamily] = useStyle('elements.h1.typography.fontFamily'); 7918 const [headingFontWeight = fontWeight] = useStyle('elements.h1.typography.fontWeight'); 7919 const [textColor = 'black'] = useStyle('color.text'); 7920 const [headingColor = textColor] = useStyle('elements.h1.color.text'); 7921 const [linkColor = 'blue'] = useStyle('elements.link.color.text'); 7922 const [backgroundColor = 'white'] = useStyle('color.background'); 7923 const [gradientValue] = useStyle('color.gradient'); 7924 const [styles] = useGlobalStylesOutput(); 7925 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 7926 const [coreColors] = useSetting('color.palette.core'); 7927 const [themeColors] = useSetting('color.palette.theme'); 7928 const [customColors] = useSetting('color.palette.custom'); 7929 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 7930 const [containerResizeListener, { 7931 width 7932 }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 7933 const ratio = width ? width / normalizedWidth : 1; 7934 const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); 7935 const highlightedColors = paletteColors.filter( // we exclude these two colors because they are already visible in the preview. 7936 _ref2 => { 7937 let { 7938 color 7939 } = _ref2; 7940 return color !== backgroundColor && color !== headingColor; 7941 }).slice(0, 2); 7942 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 7943 className: "edit-site-global-styles-preview__iframe", 7944 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 7945 styles: styles 7946 }), 7947 style: { 7948 height: normalizedHeight * ratio, 7949 visibility: !width ? 'hidden' : 'visible' 7950 }, 7951 onMouseEnter: () => setIsHovered(true), 7952 onMouseLeave: () => setIsHovered(false), 7953 tabIndex: -1 7954 }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 7955 style: { 7956 height: normalizedHeight * ratio, 7957 width: '100%', 7958 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 7959 cursor: 'pointer' 7960 }, 7961 initial: "start", 7962 animate: (isHovered || isFocused) && !disableMotion ? 'hover' : 'start' 7963 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 7964 variants: firstFrame, 7965 style: { 7966 height: '100%', 7967 overflow: 'hidden' 7968 } 7969 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 7970 spacing: 10 * ratio, 7971 justify: "center", 7972 style: { 7973 height: '100%', 7974 overflow: 'hidden' 7975 } 7976 }, (0,external_wp_element_namespaceObject.createElement)("div", { 7977 style: { 7978 fontFamily: headingFontFamily, 7979 fontSize: 65 * ratio, 7980 color: headingColor, 7981 fontWeight: headingFontWeight 7982 } 7983 }, "Aa"), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 7984 spacing: 4 * ratio 7985 }, highlightedColors.map(_ref3 => { 7986 let { 7987 slug, 7988 color 7989 } = _ref3; 7990 return (0,external_wp_element_namespaceObject.createElement)("div", { 7991 key: slug, 7992 style: { 7993 height: normalizedColorSwatchSize * ratio, 7994 width: normalizedColorSwatchSize * ratio, 7995 background: color, 7996 borderRadius: normalizedColorSwatchSize * ratio / 2 7997 } 7998 }); 7999 })))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 8000 variants: secondFrame, 8001 style: { 8002 height: '100%', 8003 overflow: 'hidden' 8004 } 8005 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8006 spacing: 3 * ratio, 8007 justify: "center", 8008 style: { 8009 height: '100%', 8010 overflow: 'hidden', 8011 padding: 10 * ratio, 8012 boxSizing: 'border-box' 8013 } 8014 }, label && (0,external_wp_element_namespaceObject.createElement)("div", { 8015 style: { 8016 fontSize: 35 * ratio, 8017 fontFamily: headingFontFamily, 8018 color: headingColor, 8019 fontWeight: headingFontWeight, 8020 lineHeight: '1em' 8021 } 8022 }, label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8023 spacing: 2 * ratio, 8024 justify: "flex-start" 8025 }, (0,external_wp_element_namespaceObject.createElement)("div", { 8026 style: { 8027 fontFamily, 8028 fontSize: 24 * ratio, 8029 color: textColor 8030 } 8031 }, "Aa"), (0,external_wp_element_namespaceObject.createElement)("div", { 8032 style: { 8033 fontFamily, 8034 fontSize: 24 * ratio, 8035 color: linkColor 8036 } 8037 }, "Aa")), paletteColors && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8038 spacing: 0 8039 }, paletteColors.slice(0, 4).map((_ref4, index) => { 8040 let { 8041 color 8042 } = _ref4; 8043 return (0,external_wp_element_namespaceObject.createElement)("div", { 8044 key: index, 8045 style: { 8046 height: 10 * ratio, 8047 width: 30 * ratio, 8048 background: color, 8049 flexGrow: 1 8050 } 8051 }); 8052 })))))); 8053 }; 8054 8055 /* harmony default export */ var preview = (StylesPreview); 8056 8057 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js 8058 8059 8060 /** 8061 * WordPress dependencies 8062 */ 8063 8064 8065 8066 8067 8068 /** 8069 * Internal dependencies 8070 */ 8071 8072 8073 8074 8075 8076 8077 function ScreenRoot() { 8078 const { 8079 variations 8080 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8081 return { 8082 variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() 8083 }; 8084 }, []); 8085 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { 8086 size: "small" 8087 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8088 spacing: 2 8089 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardMedia, null, (0,external_wp_element_namespaceObject.createElement)(preview, null))), !!(variations !== null && variations !== void 0 && variations.length) && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8090 path: "/variations" 8091 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8092 justify: "space-between" 8093 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Browse styles')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { 8094 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 8095 }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(context_menu, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardDivider, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.')), (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8096 path: "/blocks" 8097 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8098 justify: "space-between" 8099 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { 8100 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 8101 })))))); 8102 } 8103 8104 /* harmony default export */ var screen_root = (ScreenRoot); 8105 8106 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js 8107 8108 8109 /** 8110 * WordPress dependencies 8111 */ 8112 8113 8114 8115 /** 8116 * Internal dependencies 8117 */ 8118 8119 8120 8121 function ScreenHeader(_ref) { 8122 let { 8123 title, 8124 description 8125 } = _ref; 8126 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8127 spacing: 2 8128 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8129 spacing: 2 8130 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(NavigationBackButton, { 8131 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 8132 size: "small", 8133 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') 8134 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 8135 level: 5 8136 }, title))), description && (0,external_wp_element_namespaceObject.createElement)("p", { 8137 className: "edit-site-global-styles-header__description" 8138 }, description)); 8139 } 8140 8141 /* harmony default export */ var header = (ScreenHeader); 8142 8143 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js 8144 8145 8146 /** 8147 * WordPress dependencies 8148 */ 8149 8150 8151 8152 8153 8154 8155 8156 8157 /** 8158 * Internal dependencies 8159 */ 8160 8161 8162 8163 8164 8165 8166 8167 8168 function useSortedBlockTypes() { 8169 const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // Ensure core blocks are prioritized in the returned results, 8170 // because third party blocks can be registered earlier than 8171 // the core blocks (usually by using the `init` action), 8172 // thus affecting the display order. 8173 // We don't sort reusable blocks as they are handled differently. 8174 8175 const groupByType = (blocks, block) => { 8176 const { 8177 core, 8178 noncore 8179 } = blocks; 8180 const type = block.name.startsWith('core/') ? core : noncore; 8181 type.push(block); 8182 return blocks; 8183 }; 8184 8185 const { 8186 core: coreItems, 8187 noncore: nonCoreItems 8188 } = blockItems.reduce(groupByType, { 8189 core: [], 8190 noncore: [] 8191 }); 8192 return [...coreItems, ...nonCoreItems]; 8193 } 8194 8195 function BlockMenuItem(_ref) { 8196 let { 8197 block 8198 } = _ref; 8199 const hasTypographyPanel = useHasTypographyPanel(block.name); 8200 const hasColorPanel = useHasColorPanel(block.name); 8201 const hasBorderPanel = useHasBorderPanel(block.name); 8202 const hasDimensionsPanel = useHasDimensionsPanel(block.name); 8203 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 8204 const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel; 8205 8206 if (!hasBlockMenuItem) { 8207 return null; 8208 } 8209 8210 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8211 path: '/blocks/' + block.name 8212 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8213 justify: "flex-start" 8214 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { 8215 icon: block.icon 8216 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title))); 8217 } 8218 8219 function ScreenBlockList() { 8220 const sortedBlockTypes = useSortedBlockTypes(); 8221 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 8222 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 8223 const isMatchingSearchTerm = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm, []); 8224 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 8225 if (!filterValue) { 8226 return sortedBlockTypes; 8227 } 8228 8229 return sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); 8230 }, [filterValue, sortedBlockTypes, isMatchingSearchTerm]); 8231 const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); // Announce search results on change 8232 8233 (0,external_wp_element_namespaceObject.useEffect)(() => { 8234 if (!filterValue) { 8235 return; 8236 } // We extract the results from the wrapper div's `ref` because 8237 // filtered items can contain items that will eventually not 8238 // render and there is no reliable way to detect when a child 8239 // will return `null`. 8240 // TODO: We should find a better way of handling this as it's 8241 // fragile and depends on the number of rendered elements of `BlockMenuItem`, 8242 // which is now one. 8243 // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 8244 8245 8246 const count = blockTypesListRef.current.childElementCount; 8247 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 8248 /* translators: %d: number of results. */ 8249 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); 8250 debouncedSpeak(resultsFoundMessage, count); 8251 }, [filterValue, debouncedSpeak]); 8252 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8253 title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 8254 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') 8255 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { 8256 className: "edit-site-block-types-search", 8257 onChange: setFilterValue, 8258 value: filterValue, 8259 label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'), 8260 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') 8261 }), (0,external_wp_element_namespaceObject.createElement)("div", { 8262 ref: blockTypesListRef, 8263 className: "edit-site-block-types-item-list" 8264 }, filteredBlockTypes.map(block => (0,external_wp_element_namespaceObject.createElement)(BlockMenuItem, { 8265 block: block, 8266 key: 'menu-itemblock-' + block.name 8267 })))); 8268 } 8269 8270 /* harmony default export */ var screen_block_list = (ScreenBlockList); 8271 8272 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js 8273 8274 8275 /** 8276 * WordPress dependencies 8277 */ 8278 8279 /** 8280 * Internal dependencies 8281 */ 8282 8283 8284 8285 8286 function ScreenBlock(_ref) { 8287 let { 8288 name 8289 } = _ref; 8290 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 8291 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8292 title: blockType.title 8293 }), (0,external_wp_element_namespaceObject.createElement)(context_menu, { 8294 parentMenu: '/blocks/' + name, 8295 name: name 8296 })); 8297 } 8298 8299 /* harmony default export */ var screen_block = (ScreenBlock); 8300 8301 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js 8302 8303 8304 /** 8305 * WordPress dependencies 8306 */ 8307 8308 8309 function Subtitle(_ref) { 8310 let { 8311 children 8312 } = _ref; 8313 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 8314 className: "edit-site-global-styles-subtitle", 8315 level: 2 8316 }, children); 8317 } 8318 8319 /* harmony default export */ var subtitle = (Subtitle); 8320 8321 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js 8322 8323 8324 /** 8325 * WordPress dependencies 8326 */ 8327 8328 8329 /** 8330 * Internal dependencies 8331 */ 8332 8333 8334 8335 8336 8337 8338 8339 function Item(_ref) { 8340 let { 8341 name, 8342 parentMenu, 8343 element, 8344 label 8345 } = _ref; 8346 const hasSupport = !name; 8347 const prefix = element === 'text' || !element ? '' : `elements.$element}.`; 8348 const extraStyles = element === 'link' ? { 8349 textDecoration: 'underline' 8350 } : {}; 8351 const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name); 8352 const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name); 8353 const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name); 8354 const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); 8355 const [backgroundColor] = useStyle(prefix + 'color.background', name); 8356 const [gradientValue] = useStyle(prefix + 'color.gradient', name); 8357 const [color] = useStyle(prefix + 'color.text', name); 8358 8359 if (!hasSupport) { 8360 return null; 8361 } 8362 8363 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8364 path: parentMenu + '/typography/' + element 8365 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8366 justify: "flex-start" 8367 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { 8368 className: "edit-site-global-styles-screen-typography__indicator", 8369 style: { 8370 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 8371 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 8372 color, 8373 fontStyle, 8374 fontWeight, 8375 letterSpacing, 8376 ...extraStyles 8377 } 8378 }, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, label))); 8379 } 8380 8381 function ScreenTypography(_ref2) { 8382 let { 8383 name 8384 } = _ref2; 8385 const parentMenu = name === undefined ? '' : '/blocks/' + name; 8386 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8387 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 8388 description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.') 8389 }), !name && (0,external_wp_element_namespaceObject.createElement)("div", { 8390 className: "edit-site-global-styles-screen-typography" 8391 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8392 spacing: 3 8393 }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { 8394 isBordered: true, 8395 isSeparated: true 8396 }, (0,external_wp_element_namespaceObject.createElement)(Item, { 8397 name: name, 8398 parentMenu: parentMenu, 8399 element: "text", 8400 label: (0,external_wp_i18n_namespaceObject.__)('Text') 8401 }), (0,external_wp_element_namespaceObject.createElement)(Item, { 8402 name: name, 8403 parentMenu: parentMenu, 8404 element: "link", 8405 label: (0,external_wp_i18n_namespaceObject.__)('Links') 8406 })))), !!name && (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { 8407 name: name, 8408 element: "text" 8409 })); 8410 } 8411 8412 /* harmony default export */ var screen_typography = (ScreenTypography); 8413 8414 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js 8415 8416 8417 /** 8418 * WordPress dependencies 8419 */ 8420 8421 /** 8422 * Internal dependencies 8423 */ 8424 8425 8426 8427 const screen_typography_element_elements = { 8428 text: { 8429 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), 8430 title: (0,external_wp_i18n_namespaceObject.__)('Text') 8431 }, 8432 link: { 8433 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), 8434 title: (0,external_wp_i18n_namespaceObject.__)('Links') 8435 } 8436 }; 8437 8438 function ScreenTypographyElement(_ref) { 8439 let { 8440 name, 8441 element 8442 } = _ref; 8443 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8444 title: screen_typography_element_elements[element].title, 8445 description: screen_typography_element_elements[element].description 8446 }), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { 8447 name: name, 8448 element: element 8449 })); 8450 } 8451 8452 /* harmony default export */ var screen_typography_element = (ScreenTypographyElement); 8453 8454 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js 8455 8456 8457 8458 /** 8459 * External dependencies 8460 */ 8461 8462 /** 8463 * WordPress dependencies 8464 */ 8465 8466 8467 8468 function ColorIndicatorWrapper(_ref) { 8469 let { 8470 className, 8471 ...props 8472 } = _ref; 8473 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, extends_extends({ 8474 className: classnames_default()('edit-site-global-styles__color-indicator-wrapper', className) 8475 }, props)); 8476 } 8477 8478 /* harmony default export */ var color_indicator_wrapper = (ColorIndicatorWrapper); 8479 8480 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js 8481 8482 8483 /** 8484 * WordPress dependencies 8485 */ 8486 8487 8488 8489 /** 8490 * Internal dependencies 8491 */ 8492 8493 8494 8495 8496 8497 const EMPTY_COLORS = []; 8498 8499 function Palette(_ref) { 8500 let { 8501 name 8502 } = _ref; 8503 const [customColors] = useSetting('color.palette.custom'); 8504 const [themeColors] = useSetting('color.palette.theme'); 8505 const [defaultColors] = useSetting('color.palette.default'); 8506 const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); 8507 const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); 8508 const screenPath = !name ? '/colors/palette' : '/blocks/' + name + '/colors/palette'; 8509 const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of palette colors. 8510 (0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors'); 8511 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8512 spacing: 3 8513 }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Palette')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { 8514 isBordered: true, 8515 isSeparated: true 8516 }, (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8517 path: screenPath 8518 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8519 direction: colors.length === 0 ? 'row-reverse' : 'row' 8520 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, { 8521 isLayered: false, 8522 offset: -8 8523 }, colors.slice(0, 5).map(_ref2 => { 8524 let { 8525 color 8526 } = _ref2; 8527 return (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { 8528 key: color 8529 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { 8530 colorValue: color 8531 })); 8532 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText))))); 8533 } 8534 8535 /* harmony default export */ var palette = (Palette); 8536 8537 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js 8538 8539 8540 /** 8541 * WordPress dependencies 8542 */ 8543 8544 8545 /** 8546 * Internal dependencies 8547 */ 8548 8549 8550 8551 8552 8553 8554 8555 8556 function BackgroundColorItem(_ref) { 8557 let { 8558 name, 8559 parentMenu 8560 } = _ref; 8561 const supports = getSupportedGlobalStylesPanels(name); 8562 const hasSupport = supports.includes('backgroundColor') || supports.includes('background'); 8563 const [backgroundColor] = useStyle('color.background', name); 8564 const [gradientValue] = useStyle('color.gradient', name); 8565 8566 if (!hasSupport) { 8567 return null; 8568 } 8569 8570 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8571 path: parentMenu + '/colors/background' 8572 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8573 justify: "flex-start" 8574 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { 8575 expanded: false 8576 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { 8577 colorValue: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor 8578 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Background')))); 8579 } 8580 8581 function TextColorItem(_ref2) { 8582 let { 8583 name, 8584 parentMenu 8585 } = _ref2; 8586 const supports = getSupportedGlobalStylesPanels(name); 8587 const hasSupport = supports.includes('color'); 8588 const [color] = useStyle('color.text', name); 8589 8590 if (!hasSupport) { 8591 return null; 8592 } 8593 8594 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8595 path: parentMenu + '/colors/text' 8596 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8597 justify: "flex-start" 8598 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { 8599 expanded: false 8600 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { 8601 colorValue: color 8602 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Text')))); 8603 } 8604 8605 function LinkColorItem(_ref3) { 8606 let { 8607 name, 8608 parentMenu 8609 } = _ref3; 8610 const supports = getSupportedGlobalStylesPanels(name); 8611 const hasSupport = supports.includes('linkColor'); 8612 const [color] = useStyle('elements.link.color.text', name); 8613 8614 if (!hasSupport) { 8615 return null; 8616 } 8617 8618 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { 8619 path: parentMenu + '/colors/link' 8620 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 8621 justify: "flex-start" 8622 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { 8623 expanded: false 8624 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { 8625 colorValue: color 8626 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Links')))); 8627 } 8628 8629 function ScreenColors(_ref4) { 8630 let { 8631 name 8632 } = _ref4; 8633 const parentMenu = name === undefined ? '' : '/blocks/' + name; 8634 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8635 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 8636 description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.') 8637 }), (0,external_wp_element_namespaceObject.createElement)("div", { 8638 className: "edit-site-global-styles-screen-colors" 8639 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8640 spacing: 10 8641 }, (0,external_wp_element_namespaceObject.createElement)(palette, { 8642 name: name 8643 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8644 spacing: 3 8645 }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { 8646 isBordered: true, 8647 isSeparated: true 8648 }, (0,external_wp_element_namespaceObject.createElement)(BackgroundColorItem, { 8649 name: name, 8650 parentMenu: parentMenu 8651 }), (0,external_wp_element_namespaceObject.createElement)(TextColorItem, { 8652 name: name, 8653 parentMenu: parentMenu 8654 }), (0,external_wp_element_namespaceObject.createElement)(LinkColorItem, { 8655 name: name, 8656 parentMenu: parentMenu 8657 })))))); 8658 } 8659 8660 /* harmony default export */ var screen_colors = (ScreenColors); 8661 8662 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js 8663 8664 8665 /** 8666 * WordPress dependencies 8667 */ 8668 8669 8670 /** 8671 * Internal dependencies 8672 */ 8673 8674 8675 function ColorPalettePanel(_ref) { 8676 let { 8677 name 8678 } = _ref; 8679 const [themeColors, setThemeColors] = useSetting('color.palette.theme', name); 8680 const [baseThemeColors] = useSetting('color.palette.theme', name, 'base'); 8681 const [defaultColors, setDefaultColors] = useSetting('color.palette.default', name); 8682 const [baseDefaultColors] = useSetting('color.palette.default', name, 'base'); 8683 const [customColors, setCustomColors] = useSetting('color.palette.custom', name); 8684 const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); 8685 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8686 className: "edit-site-global-styles-color-palette-panel", 8687 spacing: 10 8688 }, !!themeColors && !!themeColors.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8689 canReset: themeColors !== baseThemeColors, 8690 canOnlyChangeValues: true, 8691 colors: themeColors, 8692 onChange: setThemeColors, 8693 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') 8694 }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8695 canReset: defaultColors !== baseDefaultColors, 8696 canOnlyChangeValues: true, 8697 colors: defaultColors, 8698 onChange: setDefaultColors, 8699 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') 8700 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8701 colors: customColors, 8702 onChange: setCustomColors, 8703 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 8704 emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'), 8705 slugPrefix: "custom-" 8706 })); 8707 } 8708 8709 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js 8710 8711 8712 /** 8713 * External dependencies 8714 */ 8715 8716 /** 8717 * WordPress dependencies 8718 */ 8719 8720 8721 8722 /** 8723 * Internal dependencies 8724 */ 8725 8726 8727 8728 function GradientPalettePanel(_ref) { 8729 let { 8730 name 8731 } = _ref; 8732 const [themeGradients, setThemeGradients] = useSetting('color.gradients.theme', name); 8733 const [baseThemeGradients] = useSetting('color.gradients.theme', name, 'base'); 8734 const [defaultGradients, setDefaultGradients] = useSetting('color.gradients.default', name); 8735 const [baseDefaultGradients] = useSetting('color.gradients.default', name, 'base'); 8736 const [customGradients, setCustomGradients] = useSetting('color.gradients.custom', name); 8737 const [defaultPaletteEnabled] = useSetting('color.defaultGradients', name); 8738 const [duotonePalette] = useSetting('color.duotone') || []; 8739 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 8740 className: "edit-site-global-styles-gradient-palette-panel", 8741 spacing: 10 8742 }, !!themeGradients && !!themeGradients.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8743 canReset: themeGradients !== baseThemeGradients, 8744 canOnlyChangeValues: true, 8745 gradients: themeGradients, 8746 onChange: setThemeGradients, 8747 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') 8748 }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8749 canReset: defaultGradients !== baseDefaultGradients, 8750 canOnlyChangeValues: true, 8751 gradients: defaultGradients, 8752 onChange: setDefaultGradients, 8753 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') 8754 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 8755 gradients: customGradients, 8756 onChange: setCustomGradients, 8757 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 8758 emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'), 8759 slugPrefix: "custom-" 8760 }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Duotone')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { 8761 margin: 3 8762 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, { 8763 duotonePalette: duotonePalette, 8764 disableCustomDuotone: true, 8765 disableCustomColors: true, 8766 clearable: false, 8767 onChange: external_lodash_namespaceObject.noop 8768 }))); 8769 } 8770 8771 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js 8772 8773 8774 /** 8775 * WordPress dependencies 8776 */ 8777 8778 8779 8780 /** 8781 * Internal dependencies 8782 */ 8783 8784 8785 8786 8787 8788 function ScreenColorPalette(_ref) { 8789 let { 8790 name 8791 } = _ref; 8792 const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('solid'); 8793 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8794 title: (0,external_wp_i18n_namespaceObject.__)('Palette'), 8795 description: (0,external_wp_i18n_namespaceObject.__)('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.') 8796 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 8797 className: "edit-site-screen-color-palette-toggle", 8798 value: currentTab, 8799 onChange: setCurrentTab, 8800 label: (0,external_wp_i18n_namespaceObject.__)('Select palette type'), 8801 hideLabelFromVision: true, 8802 isBlock: true 8803 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 8804 value: "solid", 8805 label: (0,external_wp_i18n_namespaceObject.__)('Solid') 8806 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 8807 value: "gradient", 8808 label: (0,external_wp_i18n_namespaceObject.__)('Gradient') 8809 })), currentTab === 'solid' && (0,external_wp_element_namespaceObject.createElement)(ColorPalettePanel, { 8810 name: name 8811 }), currentTab === 'gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientPalettePanel, { 8812 name: name 8813 })); 8814 } 8815 8816 /* harmony default export */ var screen_color_palette = (ScreenColorPalette); 8817 8818 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background-color.js 8819 8820 8821 8822 /** 8823 * WordPress dependencies 8824 */ 8825 8826 8827 /** 8828 * Internal dependencies 8829 */ 8830 8831 8832 8833 8834 function ScreenBackgroundColor(_ref) { 8835 let { 8836 name 8837 } = _ref; 8838 const supports = getSupportedGlobalStylesPanels(name); 8839 const [solids] = useSetting('color.palette', name); 8840 const [gradients] = useSetting('color.gradients', name); 8841 const [areCustomSolidsEnabled] = useSetting('color.custom', name); 8842 const [areCustomGradientsEnabled] = useSetting('color.customGradient', name); 8843 const colorsPerOrigin = useColorsPerOrigin(name); 8844 const gradientsPerOrigin = useGradientsPerOrigin(name); 8845 const [isBackgroundEnabled] = useSetting('color.background', name); 8846 const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled); 8847 const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled); 8848 const [backgroundColor, setBackgroundColor] = useStyle('color.background', name); 8849 const [userBackgroundColor] = useStyle('color.background', name, 'user'); 8850 const [gradient, setGradient] = useStyle('color.gradient', name); 8851 const [userGradient] = useStyle('color.gradient', name, 'user'); 8852 8853 if (!hasBackgroundColor && !hasGradientColor) { 8854 return null; 8855 } 8856 8857 let backgroundSettings = {}; 8858 8859 if (hasBackgroundColor) { 8860 backgroundSettings = { 8861 colorValue: backgroundColor, 8862 onColorChange: setBackgroundColor 8863 }; 8864 8865 if (backgroundColor) { 8866 backgroundSettings.clearable = backgroundColor === userBackgroundColor; 8867 } 8868 } 8869 8870 let gradientSettings = {}; 8871 8872 if (hasGradientColor) { 8873 gradientSettings = { 8874 gradientValue: gradient, 8875 onGradientChange: setGradient 8876 }; 8877 8878 if (gradient) { 8879 gradientSettings.clearable = gradient === userGradient; 8880 } 8881 } 8882 8883 const controlProps = { ...backgroundSettings, 8884 ...gradientSettings 8885 }; 8886 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8887 title: (0,external_wp_i18n_namespaceObject.__)('Background'), 8888 description: (0,external_wp_i18n_namespaceObject.__)('Set a background color or gradient for the whole site.') 8889 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({ 8890 className: "edit-site-screen-background-color__control", 8891 colors: colorsPerOrigin, 8892 gradients: gradientsPerOrigin, 8893 disableCustomColors: !areCustomSolidsEnabled, 8894 disableCustomGradients: !areCustomGradientsEnabled, 8895 __experimentalHasMultipleOrigins: true, 8896 showTitle: false, 8897 enableAlpha: true, 8898 __experimentalIsRenderedInSidebar: true 8899 }, controlProps))); 8900 } 8901 8902 /* harmony default export */ var screen_background_color = (ScreenBackgroundColor); 8903 8904 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-text-color.js 8905 8906 8907 /** 8908 * WordPress dependencies 8909 */ 8910 8911 8912 /** 8913 * Internal dependencies 8914 */ 8915 8916 8917 8918 8919 function ScreenTextColor(_ref) { 8920 let { 8921 name 8922 } = _ref; 8923 const supports = getSupportedGlobalStylesPanels(name); 8924 const [solids] = useSetting('color.palette', name); 8925 const [areCustomSolidsEnabled] = useSetting('color.custom', name); 8926 const [isTextEnabled] = useSetting('color.text', name); 8927 const colorsPerOrigin = useColorsPerOrigin(name); 8928 const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled); 8929 const [color, setColor] = useStyle('color.text', name); 8930 const [userColor] = useStyle('color.text', name, 'user'); 8931 8932 if (!hasTextColor) { 8933 return null; 8934 } 8935 8936 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8937 title: (0,external_wp_i18n_namespaceObject.__)('Text'), 8938 description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for text across the site.') 8939 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { 8940 className: "edit-site-screen-text-color__control", 8941 colors: colorsPerOrigin, 8942 disableCustomColors: !areCustomSolidsEnabled, 8943 __experimentalHasMultipleOrigins: true, 8944 showTitle: false, 8945 enableAlpha: true, 8946 __experimentalIsRenderedInSidebar: true, 8947 colorValue: color, 8948 onColorChange: setColor, 8949 clearable: color === userColor 8950 })); 8951 } 8952 8953 /* harmony default export */ var screen_text_color = (ScreenTextColor); 8954 8955 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-link-color.js 8956 8957 8958 /** 8959 * WordPress dependencies 8960 */ 8961 8962 8963 /** 8964 * Internal dependencies 8965 */ 8966 8967 8968 8969 8970 function ScreenLinkColor(_ref) { 8971 let { 8972 name 8973 } = _ref; 8974 const supports = getSupportedGlobalStylesPanels(name); 8975 const [solids] = useSetting('color.palette', name); 8976 const [areCustomSolidsEnabled] = useSetting('color.custom', name); 8977 const colorsPerOrigin = useColorsPerOrigin(name); 8978 const [isLinkEnabled] = useSetting('color.link', name); 8979 const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled); 8980 const [linkColor, setLinkColor] = useStyle('elements.link.color.text', name); 8981 const [userLinkColor] = useStyle('elements.link.color.text', name, 'user'); 8982 8983 if (!hasLinkColor) { 8984 return null; 8985 } 8986 8987 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 8988 title: (0,external_wp_i18n_namespaceObject.__)('Links'), 8989 description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for links across the site.') 8990 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { 8991 className: "edit-site-screen-link-color__control", 8992 colors: colorsPerOrigin, 8993 disableCustomColors: !areCustomSolidsEnabled, 8994 __experimentalHasMultipleOrigins: true, 8995 showTitle: false, 8996 enableAlpha: true, 8997 __experimentalIsRenderedInSidebar: true, 8998 colorValue: linkColor, 8999 onColorChange: setLinkColor, 9000 clearable: linkColor === userLinkColor 9001 })); 9002 } 9003 9004 /* harmony default export */ var screen_link_color = (ScreenLinkColor); 9005 9006 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js 9007 9008 9009 /** 9010 * WordPress dependencies 9011 */ 9012 9013 /** 9014 * Internal dependencies 9015 */ 9016 9017 9018 9019 9020 9021 function ScreenLayout(_ref) { 9022 let { 9023 name 9024 } = _ref; 9025 const hasBorderPanel = useHasBorderPanel(name); 9026 const hasDimensionsPanel = useHasDimensionsPanel(name); 9027 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 9028 title: (0,external_wp_i18n_namespaceObject.__)('Layout') 9029 }), hasDimensionsPanel && (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, { 9030 name: name 9031 }), hasBorderPanel && (0,external_wp_element_namespaceObject.createElement)(BorderPanel, { 9032 name: name 9033 })); 9034 } 9035 9036 /* harmony default export */ var screen_layout = (ScreenLayout); 9037 9038 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/global-styles-provider.js 9039 9040 9041 /** 9042 * External dependencies 9043 */ 9044 9045 /** 9046 * WordPress dependencies 9047 */ 9048 9049 9050 9051 9052 /** 9053 * Internal dependencies 9054 */ 9055 9056 9057 9058 function mergeTreesCustomizer(_, srcValue) { 9059 // We only pass as arrays the presets, 9060 // in which case we want the new array of values 9061 // to override the old array (no merging). 9062 if (Array.isArray(srcValue)) { 9063 return srcValue; 9064 } 9065 } 9066 9067 function mergeBaseAndUserConfigs(base, user) { 9068 return (0,external_lodash_namespaceObject.mergeWith)({}, base, user, mergeTreesCustomizer); 9069 } 9070 9071 const cleanEmptyObject = object => { 9072 if (!(0,external_lodash_namespaceObject.isObject)(object) || Array.isArray(object)) { 9073 return object; 9074 } 9075 9076 const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), external_lodash_namespaceObject.identity); 9077 return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects; 9078 }; 9079 9080 function useGlobalStylesUserConfig() { 9081 const { 9082 globalStylesId, 9083 settings, 9084 styles 9085 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9086 const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); 9087 9088 const record = _globalStylesId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined; 9089 return { 9090 globalStylesId: _globalStylesId, 9091 settings: record === null || record === void 0 ? void 0 : record.settings, 9092 styles: record === null || record === void 0 ? void 0 : record.styles 9093 }; 9094 }, []); 9095 const { 9096 getEditedEntityRecord 9097 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 9098 const { 9099 editEntityRecord 9100 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 9101 const config = (0,external_wp_element_namespaceObject.useMemo)(() => { 9102 return { 9103 settings: settings !== null && settings !== void 0 ? settings : {}, 9104 styles: styles !== null && styles !== void 0 ? styles : {} 9105 }; 9106 }, [settings, styles]); 9107 const setConfig = (0,external_wp_element_namespaceObject.useCallback)(callback => { 9108 var _record$styles, _record$settings; 9109 9110 const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); 9111 const currentConfig = { 9112 styles: (_record$styles = record === null || record === void 0 ? void 0 : record.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, 9113 settings: (_record$settings = record === null || record === void 0 ? void 0 : record.settings) !== null && _record$settings !== void 0 ? _record$settings : {} 9114 }; 9115 const updatedConfig = callback(currentConfig); 9116 editEntityRecord('root', 'globalStyles', globalStylesId, { 9117 styles: cleanEmptyObject(updatedConfig.styles) || {}, 9118 settings: cleanEmptyObject(updatedConfig.settings) || {} 9119 }); 9120 }, [globalStylesId]); 9121 return [!!settings || !!styles, config, setConfig]; 9122 } 9123 9124 function useGlobalStylesBaseConfig() { 9125 const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => { 9126 return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(); 9127 }, []); 9128 return [!!baseConfig, baseConfig]; 9129 } 9130 9131 function useGlobalStylesContext() { 9132 const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); 9133 const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); 9134 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 9135 if (!baseConfig || !userConfig) { 9136 return {}; 9137 } 9138 9139 return mergeBaseAndUserConfigs(baseConfig, userConfig); 9140 }, [userConfig, baseConfig]); 9141 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 9142 return { 9143 isReady: isUserConfigReady && isBaseConfigReady, 9144 user: userConfig, 9145 base: baseConfig, 9146 merged: mergedConfig, 9147 setUserConfig 9148 }; 9149 }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); 9150 return context; 9151 } 9152 9153 function GlobalStylesProvider(_ref) { 9154 let { 9155 children 9156 } = _ref; 9157 const context = useGlobalStylesContext(); 9158 9159 if (!context.isReady) { 9160 return null; 9161 } 9162 9163 return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { 9164 value: context 9165 }, children); 9166 } 9167 9168 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js 9169 9170 9171 /** 9172 * External dependencies 9173 */ 9174 9175 9176 /** 9177 * WordPress dependencies 9178 */ 9179 9180 9181 9182 9183 9184 9185 9186 /** 9187 * Internal dependencies 9188 */ 9189 9190 9191 9192 9193 9194 9195 function compareVariations(a, b) { 9196 return (0,external_lodash_namespaceObject.isEqual)(a.styles, b.styles) && (0,external_lodash_namespaceObject.isEqual)(a.settings, b.settings); 9197 } 9198 9199 function Variation(_ref) { 9200 let { 9201 variation 9202 } = _ref; 9203 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 9204 const { 9205 base, 9206 user, 9207 setUserConfig 9208 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 9209 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 9210 var _variation$settings, _variation$styles; 9211 9212 return { 9213 user: { 9214 settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, 9215 styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {} 9216 }, 9217 base, 9218 merged: mergeBaseAndUserConfigs(base, variation), 9219 setUserConfig: () => {} 9220 }; 9221 }, [variation, base]); 9222 9223 const selectVariation = () => { 9224 setUserConfig(() => { 9225 return { 9226 settings: variation.settings, 9227 styles: variation.styles 9228 }; 9229 }); 9230 }; 9231 9232 const selectOnEnter = event => { 9233 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 9234 event.preventDefault(); 9235 selectVariation(); 9236 } 9237 }; 9238 9239 const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => { 9240 return compareVariations(user, variation); 9241 }, [user, variation]); 9242 return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { 9243 value: context 9244 }, (0,external_wp_element_namespaceObject.createElement)("div", { 9245 className: classnames_default()('edit-site-global-styles-variations_item', { 9246 'is-active': isActive 9247 }), 9248 role: "button", 9249 onClick: selectVariation, 9250 onKeyDown: selectOnEnter, 9251 tabIndex: "0", 9252 "aria-label": variation === null || variation === void 0 ? void 0 : variation.title, 9253 onFocus: () => setIsFocused(true), 9254 onBlur: () => setIsFocused(false) 9255 }, (0,external_wp_element_namespaceObject.createElement)("div", { 9256 className: "edit-site-global-styles-variations_item-preview" 9257 }, (0,external_wp_element_namespaceObject.createElement)(preview, { 9258 label: variation === null || variation === void 0 ? void 0 : variation.title, 9259 isFocused: isFocused 9260 })))); 9261 } 9262 9263 function ScreenStyleVariations() { 9264 const { 9265 variations 9266 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9267 return { 9268 variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() 9269 }; 9270 }, []); 9271 const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => { 9272 return [{ 9273 title: (0,external_wp_i18n_namespaceObject.__)('Default'), 9274 settings: {}, 9275 styles: {} 9276 }, ...variations]; 9277 }, [variations]); 9278 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { 9279 back: "/", 9280 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 9281 description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles') 9282 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { 9283 size: "small", 9284 isBorderless: true 9285 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, { 9286 columns: 2 9287 }, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0,external_wp_element_namespaceObject.createElement)(Variation, { 9288 key: index, 9289 variation: variation 9290 })))))); 9291 } 9292 9293 /* harmony default export */ var screen_style_variations = (ScreenStyleVariations); 9294 9295 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 9296 9297 9298 9299 /** 9300 * WordPress dependencies 9301 */ 9302 9303 9304 /** 9305 * Internal dependencies 9306 */ 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 function GlobalStylesNavigationScreen(_ref) { 9322 let { 9323 className, 9324 ...props 9325 } = _ref; 9326 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, extends_extends({ 9327 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ') 9328 }, props)); 9329 } 9330 9331 function ContextScreens(_ref2) { 9332 let { 9333 name 9334 } = _ref2; 9335 const parentMenu = name === undefined ? '' : '/blocks/' + name; 9336 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9337 path: parentMenu + '/typography' 9338 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography, { 9339 name: name 9340 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9341 path: parentMenu + '/typography/text' 9342 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { 9343 name: name, 9344 element: "text" 9345 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9346 path: parentMenu + '/typography/link' 9347 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { 9348 name: name, 9349 element: "link" 9350 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9351 path: parentMenu + '/colors' 9352 }, (0,external_wp_element_namespaceObject.createElement)(screen_colors, { 9353 name: name 9354 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9355 path: parentMenu + '/colors/palette' 9356 }, (0,external_wp_element_namespaceObject.createElement)(screen_color_palette, { 9357 name: name 9358 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9359 path: parentMenu + '/colors/background' 9360 }, (0,external_wp_element_namespaceObject.createElement)(screen_background_color, { 9361 name: name 9362 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9363 path: parentMenu + '/colors/text' 9364 }, (0,external_wp_element_namespaceObject.createElement)(screen_text_color, { 9365 name: name 9366 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9367 path: parentMenu + '/colors/link' 9368 }, (0,external_wp_element_namespaceObject.createElement)(screen_link_color, { 9369 name: name 9370 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9371 path: parentMenu + '/layout' 9372 }, (0,external_wp_element_namespaceObject.createElement)(screen_layout, { 9373 name: name 9374 }))); 9375 } 9376 9377 function GlobalStylesUI() { 9378 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 9379 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { 9380 className: "edit-site-global-styles-sidebar__navigator-provider", 9381 initialPath: "/" 9382 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9383 path: "/" 9384 }, (0,external_wp_element_namespaceObject.createElement)(screen_root, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9385 path: "/variations" 9386 }, (0,external_wp_element_namespaceObject.createElement)(screen_style_variations, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9387 path: "/blocks" 9388 }, (0,external_wp_element_namespaceObject.createElement)(screen_block_list, null)), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { 9389 key: 'menu-block-' + block.name, 9390 path: '/blocks/' + block.name 9391 }, (0,external_wp_element_namespaceObject.createElement)(screen_block, { 9392 name: block.name 9393 }))), (0,external_wp_element_namespaceObject.createElement)(ContextScreens, null), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(ContextScreens, { 9394 key: 'screens-block-' + block.name, 9395 name: block.name 9396 }))); 9397 } 9398 9399 /* harmony default export */ var ui = (GlobalStylesUI); 9400 9401 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 9402 9403 9404 9405 9406 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/global-styles-sidebar.js 9407 9408 9409 /** 9410 * WordPress dependencies 9411 */ 9412 9413 9414 9415 9416 9417 /** 9418 * Internal dependencies 9419 */ 9420 9421 9422 9423 function GlobalStylesSidebar() { 9424 const [canReset, onReset] = useGlobalStylesReset(); 9425 const { 9426 toggle 9427 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 9428 return (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, { 9429 className: "edit-site-global-styles-sidebar", 9430 identifier: "edit-site/global-styles", 9431 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 9432 icon: library_styles, 9433 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'), 9434 panelClassName: "edit-site-global-styles-sidebar__panel", 9435 header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_wp_element_namespaceObject.createElement)("span", { 9436 className: "edit-site-global-styles-sidebar__beta" 9437 }, (0,external_wp_i18n_namespaceObject.__)('Beta'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { 9438 icon: more_vertical, 9439 label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'), 9440 toggleProps: { 9441 disabled: !canReset 9442 }, 9443 controls: [{ 9444 title: (0,external_wp_i18n_namespaceObject.__)('Reset to defaults'), 9445 onClick: onReset 9446 }, { 9447 title: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'), 9448 onClick: () => toggle('core/edit-site', 'welcomeGuideStyles') 9449 }] 9450 }))) 9451 }, (0,external_wp_element_namespaceObject.createElement)(ui, null)); 9452 } 9453 9454 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js 9455 9456 9457 /** 9458 * WordPress dependencies 9459 */ 9460 9461 9462 9463 const ALLOWED_BLOCKS = { 9464 'core/navigation': ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'], 9465 'core/social-links': ['core/social-link'], 9466 'core/navigation-submenu': ['core/navigation-link', 'core/navigation-submenu'], 9467 'core/navigation-link': ['core/navigation-link', 'core/navigation-submenu'] 9468 }; 9469 function navigation_menu_NavigationMenu(_ref) { 9470 let { 9471 innerBlocks, 9472 id 9473 } = _ref; 9474 const { 9475 updateBlockListSettings 9476 } = useDispatch(blockEditorStore); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList 9477 //Think through a better way of doing this, possible with adding allowed blocks to block library metadata 9478 9479 useEffect(() => { 9480 updateBlockListSettings('', { 9481 allowedBlocks: ALLOWED_BLOCKS['core/navigation'] 9482 }); 9483 innerBlocks.forEach(block => { 9484 if (ALLOWED_BLOCKS[block.name]) { 9485 updateBlockListSettings(block.clientId, { 9486 allowedBlocks: ALLOWED_BLOCKS[block.name] 9487 }); 9488 } 9489 }); 9490 }, [updateBlockListSettings, innerBlocks]); 9491 return createElement(Fragment, null, createElement(ListView, { 9492 id: id, 9493 showNestedBlocks: true, 9494 expandNested: false, 9495 __experimentalFeatures: true, 9496 __experimentalPersistentListViewFeatures: true 9497 })); 9498 } 9499 9500 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js 9501 9502 9503 /** 9504 * WordPress dependencies 9505 */ 9506 9507 9508 9509 9510 9511 9512 9513 9514 /** 9515 * Internal dependencies 9516 */ 9517 9518 9519 const NAVIGATION_MENUS_QUERY = [{ 9520 per_page: -1, 9521 status: 'publish' 9522 }]; 9523 function navigation_inspector_NavigationInspector() { 9524 var _navigationMenus$; 9525 9526 const { 9527 selectedNavigationBlockId, 9528 clientIdToRef, 9529 navigationMenus, 9530 isResolvingNavigationMenus, 9531 hasResolvedNavigationMenus, 9532 firstNavigationBlockId 9533 } = useSelect(select => { 9534 const { 9535 __experimentalGetActiveBlockIdByBlockNames, 9536 __experimentalGetGlobalBlocksByName, 9537 getBlock 9538 } = select(blockEditorStore); 9539 const { 9540 getEntityRecords, 9541 hasFinishedResolution, 9542 isResolving 9543 } = select(coreStore); 9544 const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY[0]]; // Get the active Navigation block (if present). 9545 9546 const selectedNavId = __experimentalGetActiveBlockIdByBlockNames('core/navigation'); // Get all Navigation blocks currently within the editor canvas. 9547 9548 9549 const navBlockIds = __experimentalGetGlobalBlocksByName('core/navigation'); 9550 9551 const idToRef = {}; 9552 navBlockIds.forEach(id => { 9553 var _getBlock, _getBlock$attributes; 9554 9555 idToRef[id] = (_getBlock = getBlock(id)) === null || _getBlock === void 0 ? void 0 : (_getBlock$attributes = _getBlock.attributes) === null || _getBlock$attributes === void 0 ? void 0 : _getBlock$attributes.ref; 9556 }); 9557 return { 9558 selectedNavigationBlockId: selectedNavId, 9559 firstNavigationBlockId: navBlockIds === null || navBlockIds === void 0 ? void 0 : navBlockIds[0], 9560 clientIdToRef: idToRef, 9561 navigationMenus: getEntityRecords(...navigationMenusQuery), 9562 isResolvingNavigationMenus: isResolving('getEntityRecords', navigationMenusQuery), 9563 hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery) 9564 }; 9565 }, []); 9566 const navMenuListId = useInstanceId(NavigationMenu, 'edit-site-navigation-inspector-menu'); 9567 const firstNavRefInTemplate = clientIdToRef[firstNavigationBlockId]; 9568 const firstNavigationMenuRef = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id; // Default Navigation Menu is either: 9569 // - the Navigation Menu referenced by the first Nav block within the template. 9570 // - the first of the available Navigation Menus (`wp_navigation`) posts. 9571 9572 const defaultNavigationMenuId = firstNavRefInTemplate || firstNavigationMenuRef; // The Navigation Menu manually selected by the user within the Nav inspector. 9573 9574 const [currentMenuId, setCurrentMenuId] = useState(firstNavRefInTemplate); // If a Nav block is selected within the canvas then set the 9575 // Navigation Menu referenced by it's `ref` attribute to be 9576 // active within the Navigation sidebar. 9577 9578 useEffect(() => { 9579 if (selectedNavigationBlockId) { 9580 setCurrentMenuId(clientIdToRef[selectedNavigationBlockId]); 9581 } 9582 }, [selectedNavigationBlockId]); 9583 let options = []; 9584 9585 if (navigationMenus) { 9586 options = navigationMenus.map(_ref => { 9587 let { 9588 id, 9589 title 9590 } = _ref; 9591 return { 9592 value: id, 9593 label: title.rendered 9594 }; 9595 }); 9596 } 9597 9598 const [innerBlocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_navigation', { 9599 id: currentMenuId || defaultNavigationMenuId 9600 }); 9601 const { 9602 isLoadingInnerBlocks, 9603 hasLoadedInnerBlocks 9604 } = useSelect(select => { 9605 const { 9606 isResolving, 9607 hasFinishedResolution 9608 } = select(coreStore); 9609 return { 9610 isLoadingInnerBlocks: isResolving('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]), 9611 hasLoadedInnerBlocks: hasFinishedResolution('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]) 9612 }; 9613 }, [currentMenuId, defaultNavigationMenuId]); 9614 const isLoading = !(hasResolvedNavigationMenus && hasLoadedInnerBlocks); 9615 const hasMoreThanOneNavigationMenu = (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 1; 9616 const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length); // Entity block editor will return entities that are not currently published. 9617 // Guard by only allowing their usage if there are published Nav Menus. 9618 9619 const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : []; 9620 const hasInnerBlocks = !!(publishedInnerBlocks !== null && publishedInnerBlocks !== void 0 && publishedInnerBlocks.length); 9621 useEffect(() => { 9622 if (isResolvingNavigationMenus) { 9623 speak('Loading Navigation sidebar menus.'); 9624 } 9625 9626 if (hasResolvedNavigationMenus) { 9627 speak('Navigation sidebar menus have loaded.'); 9628 } 9629 }, [isResolvingNavigationMenus, hasResolvedNavigationMenus]); 9630 useEffect(() => { 9631 if (isLoadingInnerBlocks) { 9632 speak('Loading Navigation sidebar selected menu items.'); 9633 } 9634 9635 if (hasLoadedInnerBlocks) { 9636 speak('Navigation sidebar selected menu items have loaded.'); 9637 } 9638 }, [isLoadingInnerBlocks, hasLoadedInnerBlocks]); 9639 return createElement("div", { 9640 className: "edit-site-navigation-inspector" 9641 }, hasResolvedNavigationMenus && !hasNavigationMenus && createElement("p", { 9642 className: "edit-site-navigation-inspector__empty-msg" 9643 }, __('There are no Navigation Menus.')), !hasResolvedNavigationMenus && createElement("div", { 9644 className: "edit-site-navigation-inspector__placeholder" 9645 }), hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && createElement(SelectControl, { 9646 "aria-controls": // aria-controls should only apply when referenced element is in DOM 9647 hasLoadedInnerBlocks ? navMenuListId : undefined, 9648 value: currentMenuId || defaultNavigationMenuId, 9649 options: options, 9650 onChange: newMenuId => setCurrentMenuId(Number(newMenuId)) 9651 }), isLoading && createElement(Fragment, null, createElement("div", { 9652 className: "edit-site-navigation-inspector__placeholder is-child" 9653 }), createElement("div", { 9654 className: "edit-site-navigation-inspector__placeholder is-child" 9655 }), createElement("div", { 9656 className: "edit-site-navigation-inspector__placeholder is-child" 9657 })), hasInnerBlocks && !isLoading && createElement(BlockEditorProvider, { 9658 value: publishedInnerBlocks, 9659 onChange: onChange, 9660 onInput: onInput 9661 }, createElement(NavigationMenu, { 9662 id: navMenuListId, 9663 innerBlocks: publishedInnerBlocks 9664 })), !hasInnerBlocks && !isLoading && createElement("p", { 9665 className: "edit-site-navigation-inspector__empty-msg" 9666 }, __('Navigation Menu is empty.'))); 9667 } 9668 9669 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/index.js 9670 9671 9672 /** 9673 * WordPress dependencies 9674 */ 9675 9676 9677 9678 /** 9679 * Internal dependencies 9680 */ 9681 9682 9683 9684 function NavigationMenuSidebar() { 9685 return createElement(DefaultSidebar, { 9686 className: "edit-site-navigation-menu-sidebar", 9687 identifier: "edit-site/navigation-menu", 9688 title: __('Navigation Menus'), 9689 icon: navigation, 9690 closeLabel: __('Close navigation menu sidebar'), 9691 panelClassName: "edit-site-navigation-menu-sidebar__panel", 9692 header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus')))) 9693 }, createElement(NavigationInspector, null)); 9694 } 9695 9696 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/constants.js 9697 const SIDEBAR_TEMPLATE = 'edit-site/template'; 9698 const SIDEBAR_BLOCK = 'edit-site/block-inspector'; 9699 9700 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/settings-header/index.js 9701 9702 9703 /** 9704 * WordPress dependencies 9705 */ 9706 9707 9708 9709 9710 /** 9711 * Internal dependencies 9712 */ 9713 9714 9715 9716 9717 const SettingsHeader = _ref => { 9718 let { 9719 sidebarName 9720 } = _ref; 9721 const { 9722 enableComplementaryArea 9723 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9724 9725 const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); 9726 9727 const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); 9728 9729 const [templateAriaLabel, templateActiveClass] = sidebarName === SIDEBAR_TEMPLATE ? // translators: ARIA label for the Template sidebar tab, selected. 9730 [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : // translators: ARIA label for the Template Settings Sidebar tab, not selected. 9731 [(0,external_wp_i18n_namespaceObject.__)('Template'), '']; 9732 const [blockAriaLabel, blockActiveClass] = sidebarName === SIDEBAR_BLOCK ? // translators: ARIA label for the Block Settings Sidebar tab, selected. 9733 [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected. 9734 [(0,external_wp_i18n_namespaceObject.__)('Block'), '']; 9735 /* Use a list so screen readers will announce how many tabs there are. */ 9736 9737 return (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9738 onClick: openTemplateSettings, 9739 className: `edit-site-sidebar__panel-tab $templateActiveClass}`, 9740 "aria-label": templateAriaLabel // translators: Data label for the Template Settings Sidebar tab. 9741 , 9742 "data-label": (0,external_wp_i18n_namespaceObject.__)('Template') 9743 }, // translators: Text label for the Template Settings Sidebar tab. 9744 (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9745 onClick: openBlockSettings, 9746 className: `edit-site-sidebar__panel-tab $blockActiveClass}`, 9747 "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab. 9748 , 9749 "data-label": (0,external_wp_i18n_namespaceObject.__)('Block') 9750 }, // translators: Text label for the Block Settings Sidebar tab. 9751 (0,external_wp_i18n_namespaceObject.__)('Block')))); 9752 }; 9753 9754 /* harmony default export */ var settings_header = (SettingsHeader); 9755 9756 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/template-areas.js 9757 9758 9759 /** 9760 * WordPress dependencies 9761 */ 9762 9763 9764 9765 9766 9767 /** 9768 * Internal dependencies 9769 */ 9770 9771 9772 9773 function TemplateAreaItem(_ref) { 9774 let { 9775 area, 9776 clientId 9777 } = _ref; 9778 const { 9779 selectBlock, 9780 toggleBlockHighlight 9781 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 9782 const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { 9783 const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); 9784 9785 return defaultAreas.find(defaultArea => defaultArea.area === area); 9786 }, [area]); 9787 9788 const highlightBlock = () => toggleBlockHighlight(clientId, true); 9789 9790 const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); 9791 9792 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 9793 className: "edit-site-template-card__template-areas-item", 9794 icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, 9795 onMouseOver: highlightBlock, 9796 onMouseLeave: cancelHighlightBlock, 9797 onFocus: highlightBlock, 9798 onBlur: cancelHighlightBlock, 9799 onClick: () => { 9800 selectBlock(clientId); 9801 } 9802 }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label); 9803 } 9804 9805 function template_areas_TemplateAreas() { 9806 const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); 9807 9808 if (!templateParts.length) { 9809 return null; 9810 } 9811 9812 return (0,external_wp_element_namespaceObject.createElement)("section", { 9813 className: "edit-site-template-card__template-areas" 9814 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 9815 level: 3, 9816 className: "edit-site-template-card__template-areas-title" 9817 }, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_wp_element_namespaceObject.createElement)("ul", { 9818 className: "edit-site-template-card__template-areas-list" 9819 }, templateParts.map(_ref2 => { 9820 let { 9821 templatePart, 9822 block 9823 } = _ref2; 9824 return (0,external_wp_element_namespaceObject.createElement)("li", { 9825 key: templatePart.slug 9826 }, (0,external_wp_element_namespaceObject.createElement)(TemplateAreaItem, { 9827 area: templatePart.area, 9828 clientId: block.clientId 9829 })); 9830 }))); 9831 } 9832 9833 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/index.js 9834 9835 9836 /** 9837 * WordPress dependencies 9838 */ 9839 9840 9841 9842 9843 /** 9844 * Internal dependencies 9845 */ 9846 9847 9848 9849 function TemplateCard() { 9850 const { 9851 title, 9852 description, 9853 icon 9854 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9855 const { 9856 getEditedPostType, 9857 getEditedPostId 9858 } = select(store_store); 9859 const { 9860 getEntityRecord 9861 } = select(external_wp_coreData_namespaceObject.store); 9862 const { 9863 __experimentalGetTemplateInfo: getTemplateInfo 9864 } = select(external_wp_editor_namespaceObject.store); 9865 const postType = getEditedPostType(); 9866 const postId = getEditedPostId(); 9867 const record = getEntityRecord('postType', postType, postId); 9868 const info = record ? getTemplateInfo(record) : {}; 9869 return info; 9870 }, []); 9871 9872 if (!title && !description) { 9873 return null; 9874 } 9875 9876 return (0,external_wp_element_namespaceObject.createElement)("div", { 9877 className: "edit-site-template-card" 9878 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 9879 className: "edit-site-template-card__icon", 9880 icon: icon 9881 }), (0,external_wp_element_namespaceObject.createElement)("div", { 9882 className: "edit-site-template-card__content" 9883 }, (0,external_wp_element_namespaceObject.createElement)("h2", { 9884 className: "edit-site-template-card__title" 9885 }, title), (0,external_wp_element_namespaceObject.createElement)("div", { 9886 className: "edit-site-template-card__description" 9887 }, description), (0,external_wp_element_namespaceObject.createElement)(template_areas_TemplateAreas, null))); 9888 } 9889 9890 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js 9891 9892 9893 /** 9894 * WordPress dependencies 9895 */ 9896 9897 9898 9899 9900 9901 9902 9903 /** 9904 * Internal dependencies 9905 */ 9906 9907 9908 9909 9910 9911 9912 9913 9914 const { 9915 Slot: InspectorSlot, 9916 Fill: InspectorFill 9917 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector'); 9918 const SidebarInspectorFill = InspectorFill; 9919 function SidebarComplementaryAreaFills() { 9920 const { 9921 sidebar, 9922 isEditorSidebarOpened, 9923 hasBlockSelection 9924 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9925 const _sidebar = select(store).getActiveComplementaryArea(STORE_NAME); 9926 9927 const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar); 9928 9929 return { 9930 sidebar: _sidebar, 9931 isEditorSidebarOpened: _isEditorSidebarOpened, 9932 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 9933 }; 9934 }, []); 9935 const { 9936 enableComplementaryArea 9937 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9938 (0,external_wp_element_namespaceObject.useEffect)(() => { 9939 if (!isEditorSidebarOpened) return; 9940 9941 if (hasBlockSelection) { 9942 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); 9943 } else { 9944 enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); 9945 } 9946 }, [hasBlockSelection, isEditorSidebarOpened]); 9947 let sidebarName = sidebar; 9948 9949 if (!isEditorSidebarOpened) { 9950 sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE; 9951 } // Conditionally include NavMenu sidebar in Plugin only. 9952 // Optimise for dead code elimination. 9953 // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination. 9954 9955 9956 let MaybeNavigationMenuSidebar = external_wp_element_namespaceObject.Fragment; 9957 9958 if (false) {} 9959 9960 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, { 9961 identifier: sidebarName, 9962 title: (0,external_wp_i18n_namespaceObject.__)('Settings'), 9963 icon: library_cog, 9964 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings sidebar'), 9965 header: (0,external_wp_element_namespaceObject.createElement)(settings_header, { 9966 sidebarName: sidebarName 9967 }), 9968 headerClassName: "edit-site-sidebar__panel-tabs" 9969 }, sidebarName === SIDEBAR_TEMPLATE && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && (0,external_wp_element_namespaceObject.createElement)(InspectorSlot, { 9970 bubblesVirtually: true 9971 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesSidebar, null), (0,external_wp_element_namespaceObject.createElement)(MaybeNavigationMenuSidebar, null)); 9972 } 9973 9974 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] 9975 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 9976 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js 9977 9978 9979 /** 9980 * WordPress dependencies 9981 */ 9982 9983 const home = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 9984 xmlns: "http://www.w3.org/2000/svg", 9985 viewBox: "0 0 24 24" 9986 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 9987 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" 9988 })); 9989 /* harmony default export */ var library_home = (home); 9990 9991 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 9992 9993 9994 /** 9995 * WordPress dependencies 9996 */ 9997 9998 const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 9999 xmlns: "http://www.w3.org/2000/svg", 10000 viewBox: "0 0 24 24" 10001 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10002 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 10003 })); 10004 /* harmony default export */ var symbol_filled = (symbolFilled); 10005 10006 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/main-dashboard-button/index.js 10007 10008 10009 /** 10010 * WordPress dependencies 10011 */ 10012 10013 const slotName = '__experimentalMainDashboardButton'; 10014 const { 10015 Fill, 10016 Slot: MainDashboardButtonSlot 10017 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); 10018 const MainDashboardButton = Fill; 10019 10020 const main_dashboard_button_Slot = _ref => { 10021 let { 10022 children 10023 } = _ref; 10024 const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName); 10025 const hasFills = Boolean(slot.fills && slot.fills.length); 10026 10027 if (!hasFills) { 10028 return children; 10029 } 10030 10031 return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, { 10032 bubblesVirtually: true 10033 }); 10034 }; 10035 10036 MainDashboardButton.Slot = main_dashboard_button_Slot; 10037 /* harmony default export */ var main_dashboard_button = (MainDashboardButton); 10038 10039 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/index.js 10040 10041 10042 10043 /** 10044 * External dependencies 10045 */ 10046 10047 /** 10048 * WordPress dependencies 10049 */ 10050 10051 10052 10053 10054 10055 10056 10057 10058 /** 10059 * Internal dependencies 10060 */ 10061 10062 10063 10064 10065 const SITE_EDITOR_KEY = 'site-editor'; 10066 10067 function NavLink(_ref) { 10068 let { 10069 params, 10070 replace, 10071 ...props 10072 } = _ref; 10073 const linkProps = useLink(params, replace); 10074 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationItem, extends_extends({}, linkProps, props)); 10075 } 10076 10077 const NavigationPanel = _ref2 => { 10078 let { 10079 activeItem = SITE_EDITOR_KEY 10080 } = _ref2; 10081 const { 10082 homeTemplate, 10083 isNavigationOpen, 10084 siteTitle 10085 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10086 const { 10087 getEntityRecord 10088 } = select(external_wp_coreData_namespaceObject.store); 10089 const { 10090 getSettings, 10091 isNavigationOpened 10092 } = select(store_store); 10093 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 10094 return { 10095 siteTitle: siteData.name, 10096 homeTemplate: getSettings().__unstableHomeTemplate, 10097 isNavigationOpen: isNavigationOpened() 10098 }; 10099 }, []); 10100 const { 10101 setIsNavigationPanelOpened 10102 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10103 10104 const closeOnEscape = event => { 10105 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 10106 event.preventDefault(); 10107 setIsNavigationPanelOpened(false); 10108 } 10109 }; 10110 10111 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions 10112 (0,external_wp_element_namespaceObject.createElement)("div", { 10113 className: classnames_default()(`edit-site-navigation-panel`, { 10114 'is-open': isNavigationOpen 10115 }), 10116 onKeyDown: closeOnEscape 10117 }, (0,external_wp_element_namespaceObject.createElement)("div", { 10118 className: "edit-site-navigation-panel__inner" 10119 }, (0,external_wp_element_namespaceObject.createElement)("div", { 10120 className: "edit-site-navigation-panel__site-title-container" 10121 }, (0,external_wp_element_namespaceObject.createElement)("div", { 10122 className: "edit-site-navigation-panel__site-title" 10123 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), (0,external_wp_element_namespaceObject.createElement)("div", { 10124 className: "edit-site-navigation-panel__scroll-container" 10125 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigation, { 10126 activeItem: activeItem 10127 }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationBackButton, { 10128 backButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Dashboard'), 10129 className: "edit-site-navigation-panel__back-to-dashboard", 10130 href: "index.php" 10131 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationMenu, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationGroup, { 10132 title: (0,external_wp_i18n_namespaceObject.__)('Editor') 10133 }, (0,external_wp_element_namespaceObject.createElement)(NavLink, { 10134 icon: library_home, 10135 title: (0,external_wp_i18n_namespaceObject.__)('Site'), 10136 item: SITE_EDITOR_KEY, 10137 params: { 10138 postId: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postId, 10139 postType: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postType 10140 } 10141 }), (0,external_wp_element_namespaceObject.createElement)(NavLink, { 10142 icon: library_layout, 10143 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 10144 item: "wp_template", 10145 params: { 10146 postId: undefined, 10147 postType: 'wp_template' 10148 } 10149 }), (0,external_wp_element_namespaceObject.createElement)(NavLink, { 10150 icon: symbol_filled, 10151 title: (0,external_wp_i18n_namespaceObject.__)('Template Parts'), 10152 item: "wp_template_part", 10153 params: { 10154 postId: undefined, 10155 postType: 'wp_template_part' 10156 } 10157 }))))))) 10158 ); 10159 }; 10160 10161 /* harmony default export */ var navigation_panel = (NavigationPanel); 10162 10163 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js 10164 10165 10166 /** 10167 * WordPress dependencies 10168 */ 10169 10170 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 10171 xmlns: "http://www.w3.org/2000/svg", 10172 viewBox: "-2 -2 24 24" 10173 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10174 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" 10175 })); 10176 /* harmony default export */ var library_wordpress = (wordpress); 10177 10178 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-toggle/index.js 10179 10180 10181 /** 10182 * External dependencies 10183 */ 10184 10185 /** 10186 * WordPress dependencies 10187 */ 10188 10189 10190 10191 10192 10193 10194 10195 10196 /** 10197 * Internal dependencies 10198 */ 10199 10200 10201 10202 function NavigationToggle(_ref) { 10203 let { 10204 icon 10205 } = _ref; 10206 const { 10207 isNavigationOpen, 10208 isRequestingSiteIcon, 10209 siteIconUrl 10210 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10211 const { 10212 getEntityRecord, 10213 isResolving 10214 } = select(external_wp_coreData_namespaceObject.store); 10215 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 10216 return { 10217 isNavigationOpen: select(store_store).isNavigationOpened(), 10218 isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), 10219 siteIconUrl: siteData.site_icon_url 10220 }; 10221 }, []); 10222 const { 10223 setIsNavigationPanelOpened 10224 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10225 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 10226 const navigationToggleRef = (0,external_wp_element_namespaceObject.useRef)(); 10227 (0,external_wp_element_namespaceObject.useEffect)(() => { 10228 // TODO: Remove this effect when alternative solution is merged. 10229 // See: https://github.com/WordPress/gutenberg/pull/37314 10230 if (!isNavigationOpen) { 10231 navigationToggleRef.current.focus(); 10232 } 10233 }, [isNavigationOpen]); 10234 10235 const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen); 10236 10237 let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 10238 size: "36px", 10239 icon: library_wordpress 10240 }); 10241 const effect = { 10242 expand: { 10243 scale: 1.25, 10244 transition: { 10245 type: 'tween', 10246 duration: '0.3' 10247 } 10248 } 10249 }; 10250 10251 if (siteIconUrl) { 10252 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { 10253 variants: !disableMotion && effect, 10254 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 10255 className: "edit-site-navigation-toggle__site-icon", 10256 src: siteIconUrl 10257 }); 10258 } else if (isRequestingSiteIcon) { 10259 buttonIcon = null; 10260 } else if (icon) { 10261 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 10262 size: "36px", 10263 icon: icon 10264 }); 10265 } 10266 10267 const classes = classnames_default()({ 10268 'edit-site-navigation-toggle__button': true, 10269 'has-icon': siteIconUrl 10270 }); 10271 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 10272 className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''), 10273 whileHover: "expand" 10274 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10275 className: classes, 10276 label: (0,external_wp_i18n_namespaceObject.__)('Toggle navigation'), 10277 ref: navigationToggleRef // isPressed will add unwanted styles. 10278 , 10279 "aria-pressed": isNavigationOpen, 10280 onClick: toggleNavigationPanel, 10281 showTooltip: true 10282 }, buttonIcon)); 10283 } 10284 10285 /* harmony default export */ var navigation_toggle = (NavigationToggle); 10286 10287 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/index.js 10288 10289 10290 /** 10291 * WordPress dependencies 10292 */ 10293 10294 10295 10296 10297 /** 10298 * Internal dependencies 10299 */ 10300 10301 10302 10303 10304 const { 10305 Fill: NavigationPanelPreviewFill, 10306 Slot: NavigationPanelPreviewSlot 10307 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationPanelPreview'); 10308 const { 10309 Fill: NavigationSidebarFill, 10310 Slot: NavigationSidebarSlot 10311 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationSidebar'); 10312 10313 function NavigationSidebar(_ref) { 10314 let { 10315 isDefaultOpen = false, 10316 activeTemplateType 10317 } = _ref; 10318 const isDesktopViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 10319 const { 10320 setIsNavigationPanelOpened 10321 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10322 (0,external_wp_element_namespaceObject.useEffect)(function autoOpenNavigationPanelOnViewportChange() { 10323 setIsNavigationPanelOpened(isDefaultOpen && isDesktopViewport); 10324 }, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]); 10325 return (0,external_wp_element_namespaceObject.createElement)(NavigationSidebarFill, null, (0,external_wp_element_namespaceObject.createElement)(navigation_toggle, null), (0,external_wp_element_namespaceObject.createElement)(navigation_panel, { 10326 activeItem: activeTemplateType 10327 }), (0,external_wp_element_namespaceObject.createElement)(NavigationPanelPreviewSlot, null)); 10328 } 10329 10330 NavigationSidebar.Slot = NavigationSidebarSlot; 10331 /* harmony default export */ var navigation_sidebar = (NavigationSidebar); 10332 10333 ;// CONCATENATED MODULE: external ["wp","reusableBlocks"] 10334 var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; 10335 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js 10336 10337 10338 /** 10339 * WordPress dependencies 10340 */ 10341 10342 10343 10344 10345 function ConvertToRegularBlocks(_ref) { 10346 let { 10347 clientId 10348 } = _ref; 10349 const { 10350 getBlocks 10351 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 10352 const { 10353 replaceBlocks 10354 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 10355 const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]); 10356 10357 if (!canRemove) { 10358 return null; 10359 } 10360 10361 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => { 10362 let { 10363 onClose 10364 } = _ref2; 10365 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 10366 onClick: () => { 10367 replaceBlocks(clientId, getBlocks(clientId)); 10368 onClose(); 10369 } 10370 }, (0,external_wp_i18n_namespaceObject.__)('Detach blocks from template part')); 10371 }); 10372 } 10373 10374 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/create-template-part-modal/index.js 10375 10376 10377 /** 10378 * WordPress dependencies 10379 */ 10380 10381 10382 10383 10384 10385 10386 10387 /** 10388 * Internal dependencies 10389 */ 10390 10391 10392 function CreateTemplatePartModal(_ref) { 10393 let { 10394 closeModal, 10395 onCreate 10396 } = _ref; 10397 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 10398 const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(TEMPLATE_PART_AREA_GENERAL); 10399 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 10400 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); 10401 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); 10402 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 10403 title: (0,external_wp_i18n_namespaceObject.__)('Create a template part'), 10404 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 10405 onRequestClose: closeModal, 10406 overlayClassName: "edit-site-create-template-part-modal" 10407 }, (0,external_wp_element_namespaceObject.createElement)("form", { 10408 onSubmit: async event => { 10409 event.preventDefault(); 10410 10411 if (!title) { 10412 return; 10413 } 10414 10415 setIsSubmitting(true); 10416 await onCreate({ 10417 title, 10418 area 10419 }); 10420 } 10421 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 10422 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 10423 value: title, 10424 onChange: setTitle, 10425 required: true 10426 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, { 10427 label: (0,external_wp_i18n_namespaceObject.__)('Area'), 10428 id: `edit-site-create-template-part-modal__area-selection-$instanceId}`, 10429 className: "edit-site-create-template-part-modal__area-base-control" 10430 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, { 10431 label: (0,external_wp_i18n_namespaceObject.__)('Area'), 10432 className: "edit-site-create-template-part-modal__area-radio-group", 10433 id: `edit-site-create-template-part-modal__area-selection-$instanceId}`, 10434 onChange: setArea, 10435 checked: area 10436 }, templatePartAreas.map(_ref2 => { 10437 let { 10438 icon, 10439 label, 10440 area: value, 10441 description 10442 } = _ref2; 10443 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadio, { 10444 key: label, 10445 value: value, 10446 className: "edit-site-create-template-part-modal__area-radio" 10447 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 10448 align: "start", 10449 justify: "start" 10450 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 10451 icon: icon 10452 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, { 10453 className: "edit-site-create-template-part-modal__option-label" 10454 }, label, (0,external_wp_element_namespaceObject.createElement)("div", null, description)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { 10455 className: "edit-site-create-template-part-modal__checkbox" 10456 }, area === value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 10457 icon: library_check 10458 })))); 10459 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 10460 className: "edit-site-create-template-part-modal__modal-actions", 10461 justify: "flex-end" 10462 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10463 variant: "secondary", 10464 onClick: () => { 10465 closeModal(); 10466 } 10467 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10468 variant: "primary", 10469 type: "submit", 10470 disabled: !title, 10471 isBusy: isSubmitting 10472 }, (0,external_wp_i18n_namespaceObject.__)('Create')))))); 10473 } 10474 10475 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js 10476 10477 10478 /** 10479 * External dependencies 10480 */ 10481 10482 /** 10483 * WordPress dependencies 10484 */ 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 /** 10495 * Internal dependencies 10496 */ 10497 10498 10499 function ConvertToTemplatePart(_ref) { 10500 let { 10501 clientIds, 10502 blocks 10503 } = _ref; 10504 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 10505 const { 10506 replaceBlocks 10507 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 10508 const { 10509 saveEntityRecord 10510 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 10511 const { 10512 createSuccessNotice 10513 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 10514 10515 const onConvert = async _ref2 => { 10516 let { 10517 title, 10518 area 10519 } = _ref2; 10520 // Currently template parts only allow latin chars. 10521 // Fallback slug will receive suffix by default. 10522 const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; 10523 const templatePart = await saveEntityRecord('postType', 'wp_template_part', { 10524 slug: cleanSlug, 10525 title, 10526 content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), 10527 area 10528 }); 10529 replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { 10530 slug: templatePart.slug, 10531 theme: templatePart.theme 10532 })); 10533 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { 10534 type: 'snackbar' 10535 }); // The modal and this component will be unmounted because of `replaceBlocks` above, 10536 // so no need to call `closeModal` or `onClose`. 10537 }; 10538 10539 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 10540 onClick: () => { 10541 setIsModalOpen(true); 10542 } 10543 }, (0,external_wp_i18n_namespaceObject.__)('Make template part'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { 10544 closeModal: () => { 10545 setIsModalOpen(false); 10546 }, 10547 onCreate: onConvert 10548 })); 10549 } 10550 10551 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js 10552 10553 10554 /** 10555 * WordPress dependencies 10556 */ 10557 10558 10559 /** 10560 * Internal dependencies 10561 */ 10562 10563 10564 10565 function TemplatePartConverter() { 10566 var _blocks$; 10567 10568 const { 10569 clientIds, 10570 blocks 10571 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10572 const { 10573 getSelectedBlockClientIds, 10574 getBlocksByClientId 10575 } = select(external_wp_blockEditor_namespaceObject.store); 10576 const selectedBlockClientIds = getSelectedBlockClientIds(); 10577 return { 10578 clientIds: selectedBlockClientIds, 10579 blocks: getBlocksByClientId(selectedBlockClientIds) 10580 }; 10581 }, []); // Allow converting a single template part to standard blocks. 10582 10583 if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') { 10584 return (0,external_wp_element_namespaceObject.createElement)(ConvertToRegularBlocks, { 10585 clientId: clientIds[0] 10586 }); 10587 } 10588 10589 return (0,external_wp_element_namespaceObject.createElement)(ConvertToTemplatePart, { 10590 clientIds: clientIds, 10591 blocks: blocks 10592 }); 10593 } 10594 10595 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js 10596 10597 10598 /** 10599 * WordPress dependencies 10600 */ 10601 10602 const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 10603 xmlns: "http://www.w3.org/2000/svg", 10604 viewBox: "0 0 24 24" 10605 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10606 d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" 10607 })); 10608 /* harmony default export */ var library_pencil = (pencil); 10609 10610 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js 10611 /** 10612 * Internal dependencies 10613 */ 10614 10615 /* harmony default export */ var edit = (library_pencil); 10616 10617 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigate-to-link/index.js 10618 10619 10620 /** 10621 * WordPress dependencies 10622 */ 10623 10624 10625 10626 10627 10628 10629 10630 function NavigateToLink(_ref) { 10631 let { 10632 type, 10633 id, 10634 activePage, 10635 onActivePageChange 10636 } = _ref; 10637 const post = (0,external_wp_data_namespaceObject.useSelect)(select => type && id && type !== 'URL' && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', type, id), [type, id]); 10638 const onClick = (0,external_wp_element_namespaceObject.useMemo)(() => { 10639 if (!(post !== null && post !== void 0 && post.link)) return null; 10640 const path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(post.link); 10641 if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null; 10642 return () => onActivePageChange({ 10643 type, 10644 slug: post.slug, 10645 path, 10646 context: { 10647 postType: post.type, 10648 postId: post.id 10649 } 10650 }); 10651 }, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]); 10652 return onClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10653 icon: edit, 10654 label: (0,external_wp_i18n_namespaceObject.__)('Edit Page Template'), 10655 onClick: onClick 10656 }); 10657 } 10658 10659 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/block-inspector-button.js 10660 10661 10662 /** 10663 * WordPress dependencies 10664 */ 10665 10666 10667 10668 10669 10670 10671 /** 10672 * Internal dependencies 10673 */ 10674 10675 10676 10677 10678 function BlockInspectorButton(_ref) { 10679 let { 10680 onClick = () => {} 10681 } = _ref; 10682 const { 10683 shortcut, 10684 isBlockInspectorOpen 10685 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 10686 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-block-settings-sidebar'), 10687 isBlockInspectorOpen: select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK 10688 }), []); 10689 const { 10690 enableComplementaryArea, 10691 disableComplementaryArea 10692 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10693 const label = isBlockInspectorOpen ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings'); 10694 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 10695 onClick: () => { 10696 if (isBlockInspectorOpen) { 10697 disableComplementaryArea(STORE_NAME); 10698 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed')); 10699 } else { 10700 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); 10701 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar')); 10702 } // Close dropdown menu. 10703 10704 10705 onClick(); 10706 }, 10707 shortcut: shortcut 10708 }, label); 10709 } 10710 10711 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/edit-template-part-menu-button/index.js 10712 10713 10714 10715 /** 10716 * WordPress dependencies 10717 */ 10718 10719 10720 10721 10722 10723 10724 /** 10725 * Internal dependencies 10726 */ 10727 10728 10729 10730 function EditTemplatePartMenuButton() { 10731 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref => { 10732 let { 10733 selectedClientIds, 10734 onClose 10735 } = _ref; 10736 return (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuItem, { 10737 selectedClientId: selectedClientIds[0], 10738 onClose: onClose 10739 }); 10740 }); 10741 } 10742 10743 function EditTemplatePartMenuItem(_ref2) { 10744 let { 10745 selectedClientId, 10746 onClose 10747 } = _ref2; 10748 const { 10749 params 10750 } = useLocation(); 10751 const selectedTemplatePart = (0,external_wp_data_namespaceObject.useSelect)(select => { 10752 const block = select(external_wp_blockEditor_namespaceObject.store).getBlock(selectedClientId); 10753 10754 if (block && (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 10755 const { 10756 theme, 10757 slug 10758 } = block.attributes; 10759 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API. 10760 `$theme}//${slug}`); 10761 } 10762 }, [selectedClientId]); 10763 const linkProps = useLink({ 10764 postId: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.id, 10765 postType: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.type 10766 }, { 10767 fromTemplateId: params.postId 10768 }); 10769 10770 if (!selectedTemplatePart) { 10771 return null; 10772 } 10773 10774 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, linkProps, { 10775 onClick: event => { 10776 linkProps.onClick(event); 10777 onClose(); 10778 } 10779 }), 10780 /* translators: %s: template part title */ 10781 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Edit %s'), selectedTemplatePart.slug)); 10782 } 10783 10784 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 10785 10786 10787 /** 10788 * WordPress dependencies 10789 */ 10790 10791 const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 10792 xmlns: "http://www.w3.org/2000/svg", 10793 viewBox: "0 0 24 24" 10794 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 10795 d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" 10796 })); 10797 /* harmony default export */ var arrow_left = (arrowLeft); 10798 10799 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/back-button.js 10800 10801 10802 /** 10803 * WordPress dependencies 10804 */ 10805 10806 10807 10808 /** 10809 * Internal dependencies 10810 */ 10811 10812 10813 10814 function BackButton() { 10815 var _location$state; 10816 10817 const location = useLocation(); 10818 const history = useHistory(); 10819 const isTemplatePart = location.params.postType === 'wp_template_part'; 10820 const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId; 10821 10822 if (!isTemplatePart || !previousTemplateId) { 10823 return null; 10824 } 10825 10826 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 10827 className: "edit-site-visual-editor__back-button", 10828 icon: arrow_left, 10829 onClick: () => { 10830 history.back(); 10831 } 10832 }, (0,external_wp_i18n_namespaceObject.__)('Back')); 10833 } 10834 10835 /* harmony default export */ var back_button = (BackButton); 10836 10837 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resize-handle.js 10838 10839 10840 /** 10841 * WordPress dependencies 10842 */ 10843 10844 10845 10846 const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. 10847 10848 function ResizeHandle(_ref) { 10849 let { 10850 direction, 10851 resizeWidthBy 10852 } = _ref; 10853 10854 function handleKeyDown(event) { 10855 const { 10856 keyCode 10857 } = event; 10858 10859 if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { 10860 resizeWidthBy(DELTA_DISTANCE); 10861 } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { 10862 resizeWidthBy(-DELTA_DISTANCE); 10863 } 10864 } 10865 10866 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("button", { 10867 className: `resizable-editor__drag-handle is-$direction}`, 10868 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 10869 "aria-describedby": `resizable-editor__resize-help-$direction}`, 10870 onKeyDown: handleKeyDown 10871 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 10872 id: `resizable-editor__resize-help-$direction}` 10873 }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.'))); 10874 } 10875 10876 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resizable-editor.js 10877 10878 10879 10880 /** 10881 * WordPress dependencies 10882 */ 10883 10884 10885 10886 10887 10888 /** 10889 * Internal dependencies 10890 */ 10891 10892 10893 10894 const DEFAULT_STYLES = { 10895 width: '100%', 10896 height: '100%' 10897 }; // Removes the inline styles in the drag handles. 10898 10899 const HANDLE_STYLES_OVERRIDE = { 10900 position: undefined, 10901 userSelect: undefined, 10902 cursor: undefined, 10903 width: undefined, 10904 height: undefined, 10905 top: undefined, 10906 right: undefined, 10907 bottom: undefined, 10908 left: undefined 10909 }; 10910 10911 function ResizableEditor(_ref) { 10912 let { 10913 enableResizing, 10914 settings, 10915 children, 10916 ...props 10917 } = _ref; 10918 const deviceType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetPreviewDeviceType(), []); 10919 const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); 10920 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.width); 10921 const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.height); 10922 const iframeRef = (0,external_wp_element_namespaceObject.useRef)(); 10923 const mouseMoveTypingResetRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)(); 10924 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, mouseMoveTypingResetRef]); 10925 (0,external_wp_element_namespaceObject.useEffect)(function autoResizeIframeHeight() { 10926 const iframe = iframeRef.current; 10927 10928 if (!iframe || !enableResizing) { 10929 return; 10930 } 10931 10932 let animationFrame = null; 10933 10934 function resizeHeight() { 10935 if (!animationFrame) { 10936 // Throttle the updates on animation frame. 10937 animationFrame = iframe.contentWindow.requestAnimationFrame(() => { 10938 setHeight(iframe.contentDocument.documentElement.scrollHeight); 10939 animationFrame = null; 10940 }); 10941 } 10942 } 10943 10944 let resizeObserver; 10945 10946 function registerObserver() { 10947 var _resizeObserver; 10948 10949 (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect(); 10950 resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter 10951 // gets destroyed and remounted after initialization in <Iframe>. 10952 10953 resizeObserver.observe(iframe.contentDocument.documentElement); 10954 resizeHeight(); 10955 } // This is only required in Firefox for some unknown reasons. 10956 10957 10958 iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari. 10959 10960 registerObserver(); 10961 return () => { 10962 var _iframe$contentWindow, _resizeObserver2; 10963 10964 (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame); 10965 (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect(); 10966 iframe.removeEventListener('load', registerObserver); 10967 }; 10968 }, [enableResizing]); 10969 const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { 10970 if (iframeRef.current) { 10971 setWidth(iframeRef.current.offsetWidth + deltaPixels); 10972 } 10973 }, []); 10974 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, { 10975 size: { 10976 width, 10977 height 10978 }, 10979 onResizeStop: (event, direction, element) => { 10980 setWidth(element.style.width); 10981 }, 10982 minWidth: 300, 10983 maxWidth: "100%", 10984 maxHeight: "100%", 10985 enable: { 10986 right: enableResizing, 10987 left: enableResizing 10988 }, 10989 showHandle: enableResizing // The editor is centered horizontally, resizing it only 10990 // moves half the distance. Hence double the ratio to correctly 10991 // align the cursor to the resizer handle. 10992 , 10993 resizeRatio: 2, 10994 handleComponent: { 10995 left: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { 10996 direction: "left", 10997 resizeWidthBy: resizeWidthBy 10998 }), 10999 right: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { 11000 direction: "right", 11001 resizeWidthBy: resizeWidthBy 11002 }) 11003 }, 11004 handleClasses: undefined, 11005 handleStyles: { 11006 left: HANDLE_STYLES_OVERRIDE, 11007 right: HANDLE_STYLES_OVERRIDE 11008 } 11009 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, extends_extends({ 11010 style: enableResizing ? undefined : deviceStyles, 11011 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 11012 styles: settings.styles 11013 }), (0,external_wp_element_namespaceObject.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing. 11014 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 11015 `.is-root-container { display: flow-root; }`), enableResizing && (0,external_wp_element_namespaceObject.createElement)("style", null, // Force the <html> and <body>'s heights to fit the content. 11016 `html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container, 11017 // which isn't a requirement in auto resize mode. 11018 `.is-root-container { min-height: 0 !important; }`)), 11019 assets: settings.__unstableResolvedAssets, 11020 ref: ref, 11021 name: "editor-canvas", 11022 className: "edit-site-visual-editor__editor-canvas" 11023 }, props), settings.svgFilters, children)); 11024 } 11025 11026 /* harmony default export */ var resizable_editor = (ResizableEditor); 11027 11028 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/index.js 11029 11030 11031 11032 /** 11033 * External dependencies 11034 */ 11035 11036 /** 11037 * WordPress dependencies 11038 */ 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 /** 11051 * Internal dependencies 11052 */ 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 const LAYOUT = { 11063 type: 'default', 11064 // At the root level of the site editor, no alignments should be allowed. 11065 alignments: [] 11066 }; 11067 function BlockEditor(_ref) { 11068 let { 11069 setIsInserterOpen 11070 } = _ref; 11071 const { 11072 settings 11073 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11074 let storedSettings = select(store_store).getSettings(setIsInserterOpen); 11075 11076 if (!storedSettings.__experimentalBlockPatterns) { 11077 storedSettings = { ...storedSettings, 11078 __experimentalBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns() 11079 }; 11080 } 11081 11082 if (!storedSettings.__experimentalBlockPatternCategories) { 11083 storedSettings = { ...storedSettings, 11084 __experimentalBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() 11085 }; 11086 } 11087 11088 return { 11089 settings: storedSettings 11090 }; 11091 }, [setIsInserterOpen]); 11092 const { 11093 templateType, 11094 templateId, 11095 page 11096 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11097 const { 11098 getEditedPostType, 11099 getEditedPostId, 11100 getPage 11101 } = select(store_store); 11102 return { 11103 templateType: getEditedPostType(), 11104 templateId: getEditedPostId(), 11105 page: getPage() 11106 }; 11107 }, [setIsInserterOpen]); 11108 const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); 11109 const { 11110 setPage 11111 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11112 const { 11113 enableComplementaryArea 11114 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 11115 const openNavigationSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { 11116 enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu'); 11117 }, [enableComplementaryArea]); 11118 const contentRef = (0,external_wp_element_namespaceObject.useRef)(); 11119 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)()]); 11120 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 11121 const { 11122 clearSelectedBlock 11123 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 11124 const isTemplatePart = templateType === 'wp_template_part'; 11125 11126 const NavMenuSidebarToggle = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { 11127 className: "components-toolbar__control", 11128 label: (0,external_wp_i18n_namespaceObject.__)('Open list view'), 11129 onClick: openNavigationSidebar, 11130 icon: list_view 11131 })); // Conditionally include NavMenu sidebar in Plugin only. 11132 // Optimise for dead code elimination. 11133 // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination. 11134 11135 11136 let MaybeNavMenuSidebarToggle = external_wp_element_namespaceObject.Fragment; 11137 11138 if (false) {} 11139 11140 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 11141 settings: settings, 11142 value: blocks, 11143 onInput: onInput, 11144 onChange: onChange, 11145 useSubRegistry: false 11146 }, (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuButton, null), (0,external_wp_element_namespaceObject.createElement)(TemplatePartConverter, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl.ViewerFill, null, (0,external_wp_element_namespaceObject.useCallback)(fillProps => (0,external_wp_element_namespaceObject.createElement)(NavigateToLink, extends_extends({}, fillProps, { 11147 activePage: page, 11148 onActivePageChange: setPage 11149 })), [page])), (0,external_wp_element_namespaceObject.createElement)(SidebarInspectorFill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, { 11150 className: classnames_default()('edit-site-visual-editor', { 11151 'is-focus-mode': isTemplatePart 11152 }), 11153 __unstableContentRef: contentRef, 11154 onClick: event => { 11155 // Clear selected block when clicking on the gray background. 11156 if (event.target === event.currentTarget) { 11157 clearSelectedBlock(); 11158 } 11159 } 11160 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(back_button, null), (0,external_wp_element_namespaceObject.createElement)(resizable_editor // Reinitialize the editor and reset the states when the template changes. 11161 , { 11162 key: templateId, 11163 enableResizing: isTemplatePart && // Disable resizing in mobile viewport. 11164 !isMobileViewport, 11165 settings: settings, 11166 contentRef: mergedRefs 11167 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { 11168 className: "edit-site-block-editor__block-list wp-site-blocks", 11169 __experimentalLayout: LAYOUT, 11170 renderAppender: isTemplatePart ? false : undefined 11171 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref2 => { 11172 let { 11173 onClose 11174 } = _ref2; 11175 return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorButton, { 11176 onClick: onClose 11177 }); 11178 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0,external_wp_element_namespaceObject.createElement)(MaybeNavMenuSidebarToggle, null)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null)); 11179 } 11180 11181 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 11182 var lib = __webpack_require__(773); 11183 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/code-editor-text-area.js 11184 11185 11186 /** 11187 * External dependencies 11188 */ 11189 11190 /** 11191 * WordPress dependencies 11192 */ 11193 11194 /** 11195 * WordPress dependencies 11196 */ 11197 11198 /** 11199 * WordPress dependencies 11200 */ 11201 11202 11203 11204 11205 11206 function CodeEditorTextArea(_ref) { 11207 let { 11208 value, 11209 onChange, 11210 onInput 11211 } = _ref; 11212 const [stateValue, setStateValue] = (0,external_wp_element_namespaceObject.useState)(value); 11213 const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false); 11214 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditorTextArea); 11215 11216 if (!isDirty && stateValue !== value) { 11217 setStateValue(value); 11218 } 11219 /** 11220 * Handles a textarea change event to notify the onChange prop callback and 11221 * reflect the new value in the component's own state. This marks the start 11222 * of the user's edits, if not already changed, preventing future props 11223 * changes to value from replacing the rendered value. This is expected to 11224 * be followed by a reset to dirty state via `stopEditing`. 11225 * 11226 * @see stopEditing 11227 * 11228 * @param {Event} event Change event. 11229 */ 11230 11231 11232 const onChangeHandler = event => { 11233 const newValue = event.target.value; 11234 onInput(newValue); 11235 setStateValue(newValue); 11236 setIsDirty(true); 11237 }; 11238 /** 11239 * Function called when the user has completed their edits, responsible for 11240 * ensuring that changes, if made, are surfaced to the onPersist prop 11241 * callback and resetting dirty state. 11242 */ 11243 11244 11245 const stopEditing = () => { 11246 if (isDirty) { 11247 onChange(stateValue); 11248 setIsDirty(false); 11249 } 11250 }; 11251 11252 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 11253 as: "label", 11254 htmlFor: `code-editor-text-area-$instanceId}` 11255 }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { 11256 autoComplete: "off", 11257 dir: "auto", 11258 value: stateValue, 11259 onChange: onChangeHandler, 11260 onBlur: stopEditing, 11261 className: "edit-site-code-editor-text-area", 11262 id: `code-editor-text-area-$instanceId}`, 11263 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') 11264 })); 11265 } 11266 11267 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/index.js 11268 11269 11270 /** 11271 * WordPress dependencies 11272 */ 11273 11274 11275 11276 11277 11278 11279 /** 11280 * Internal dependencies 11281 */ 11282 11283 11284 11285 function CodeEditor() { 11286 const { 11287 templateType, 11288 shortcut 11289 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11290 const { 11291 getEditedPostType 11292 } = select(store_store); 11293 const { 11294 getShortcutRepresentation 11295 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 11296 return { 11297 templateType: getEditedPostType(), 11298 shortcut: getShortcutRepresentation('core/edit-site/toggle-mode') 11299 }; 11300 }, []); 11301 const [contentStructure, setContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', templateType, 'content'); 11302 const [blocks,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); 11303 const content = contentStructure instanceof Function ? contentStructure({ 11304 blocks 11305 }) : contentStructure; 11306 const { 11307 switchEditorMode 11308 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11309 return (0,external_wp_element_namespaceObject.createElement)("div", { 11310 className: "edit-site-code-editor" 11311 }, (0,external_wp_element_namespaceObject.createElement)("div", { 11312 className: "edit-site-code-editor__toolbar" 11313 }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11314 variant: "tertiary", 11315 onClick: () => switchEditorMode('visual'), 11316 shortcut: shortcut 11317 }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", { 11318 className: "edit-site-code-editor__body" 11319 }, (0,external_wp_element_namespaceObject.createElement)(CodeEditorTextArea, { 11320 value: content, 11321 onChange: newContent => { 11322 onChange((0,external_wp_blocks_namespaceObject.parse)(newContent), { 11323 selection: undefined 11324 }); 11325 }, 11326 onInput: setContent 11327 }))); 11328 } 11329 11330 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/index.js 11331 /** 11332 * WordPress dependencies 11333 */ 11334 11335 11336 11337 11338 11339 11340 /** 11341 * Internal dependencies 11342 */ 11343 11344 11345 11346 11347 11348 function KeyboardShortcuts(_ref) { 11349 let { 11350 openEntitiesSavedStates 11351 } = _ref; 11352 const { 11353 __experimentalGetDirtyEntityRecords, 11354 isSavingEntityRecord 11355 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 11356 const { 11357 getEditorMode 11358 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 11359 const isListViewOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isListViewOpened(), []); 11360 const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []); 11361 const { 11362 redo, 11363 undo 11364 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 11365 const { 11366 setIsListViewOpened, 11367 switchEditorMode 11368 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11369 const { 11370 enableComplementaryArea, 11371 disableComplementaryArea 11372 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 11373 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { 11374 event.preventDefault(); 11375 11376 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 11377 11378 const isDirty = !!dirtyEntityRecords.length; 11379 const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 11380 11381 if (!isSaving && isDirty) { 11382 openEntitiesSavedStates(); 11383 } 11384 }); 11385 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/undo', event => { 11386 undo(); 11387 event.preventDefault(); 11388 }); 11389 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/redo', event => { 11390 redo(); 11391 event.preventDefault(); 11392 }); 11393 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-list-view', () => { 11394 setIsListViewOpened(!isListViewOpen); 11395 }); 11396 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => { 11397 // This shortcut has no known clashes, but use preventDefault to prevent any 11398 // obscure shortcuts from triggering. 11399 event.preventDefault(); 11400 11401 if (isBlockInspectorOpen) { 11402 disableComplementaryArea(STORE_NAME); 11403 } else { 11404 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); 11405 } 11406 }); 11407 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => { 11408 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); 11409 }); 11410 return null; 11411 } 11412 11413 function KeyboardShortcutsRegister() { 11414 // Registering the shortcuts. 11415 const { 11416 registerShortcut 11417 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 11418 (0,external_wp_element_namespaceObject.useEffect)(() => { 11419 registerShortcut({ 11420 name: 'core/edit-site/save', 11421 category: 'global', 11422 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 11423 keyCombination: { 11424 modifier: 'primary', 11425 character: 's' 11426 } 11427 }); 11428 registerShortcut({ 11429 name: 'core/edit-site/undo', 11430 category: 'global', 11431 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 11432 keyCombination: { 11433 modifier: 'primary', 11434 character: 'z' 11435 } 11436 }); 11437 registerShortcut({ 11438 name: 'core/edit-site/redo', 11439 category: 'global', 11440 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 11441 keyCombination: { 11442 modifier: 'primaryShift', 11443 character: 'z' 11444 } 11445 }); 11446 registerShortcut({ 11447 name: 'core/edit-site/toggle-list-view', 11448 category: 'global', 11449 description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'), 11450 keyCombination: { 11451 modifier: 'access', 11452 character: 'o' 11453 } 11454 }); 11455 registerShortcut({ 11456 name: 'core/edit-site/toggle-block-settings-sidebar', 11457 category: 'global', 11458 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the block settings sidebar.'), 11459 keyCombination: { 11460 modifier: 'primaryShift', 11461 character: ',' 11462 } 11463 }); 11464 registerShortcut({ 11465 name: 'core/edit-site/keyboard-shortcuts', 11466 category: 'main', 11467 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 11468 keyCombination: { 11469 modifier: 'access', 11470 character: 'h' 11471 } 11472 }); 11473 registerShortcut({ 11474 name: 'core/edit-site/next-region', 11475 category: 'global', 11476 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 11477 keyCombination: { 11478 modifier: 'ctrl', 11479 character: '`' 11480 }, 11481 aliases: [{ 11482 modifier: 'access', 11483 character: 'n' 11484 }] 11485 }); 11486 registerShortcut({ 11487 name: 'core/edit-site/previous-region', 11488 category: 'global', 11489 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 11490 keyCombination: { 11491 modifier: 'ctrlShift', 11492 character: '`' 11493 }, 11494 aliases: [{ 11495 modifier: 'access', 11496 character: 'p' 11497 }] 11498 }); 11499 registerShortcut({ 11500 name: 'core/edit-site/toggle-mode', 11501 category: 'global', 11502 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), 11503 keyCombination: { 11504 modifier: 'secondary', 11505 character: 'm' 11506 } 11507 }); 11508 }, [registerShortcut]); 11509 return null; 11510 } 11511 11512 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 11513 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); 11514 11515 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/url-query-controller/index.js 11516 /** 11517 * WordPress dependencies 11518 */ 11519 11520 11521 /** 11522 * Internal dependencies 11523 */ 11524 11525 11526 11527 function URLQueryController() { 11528 const { 11529 setTemplate, 11530 setTemplatePart, 11531 setPage 11532 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11533 const { 11534 params: { 11535 postId, 11536 postType 11537 } 11538 } = useLocation(); // Set correct entity on page navigation. 11539 11540 (0,external_wp_element_namespaceObject.useEffect)(() => { 11541 if ('page' === postType || 'post' === postType) { 11542 setPage({ 11543 context: { 11544 postType, 11545 postId 11546 } 11547 }); // Resolves correct template based on ID. 11548 } else if ('wp_template' === postType) { 11549 setTemplate(postId); 11550 } else if ('wp_template_part' === postType) { 11551 setTemplatePart(postId); 11552 } 11553 }, [postId, postType]); 11554 return null; 11555 } 11556 11557 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js 11558 11559 11560 /** 11561 * WordPress dependencies 11562 */ 11563 11564 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 11565 xmlns: "http://www.w3.org/2000/svg", 11566 viewBox: "0 0 24 24" 11567 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 11568 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" 11569 })); 11570 /* harmony default export */ var library_close = (close_close); 11571 11572 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/inserter-sidebar.js 11573 11574 11575 11576 /** 11577 * WordPress dependencies 11578 */ 11579 11580 11581 11582 11583 11584 11585 11586 /** 11587 * Internal dependencies 11588 */ 11589 11590 11591 function InserterSidebar() { 11592 const { 11593 setIsInserterOpened 11594 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11595 const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetInsertionPoint(), []); 11596 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 11597 const TagName = !isMobile ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; 11598 const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ 11599 onClose: () => setIsInserterOpened(false), 11600 focusOnMount: null 11601 }); 11602 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); 11603 (0,external_wp_element_namespaceObject.useEffect)(() => { 11604 libraryRef.current.focusSearch(); 11605 }, []); 11606 return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({ 11607 ref: inserterDialogRef 11608 }, inserterDialogProps, { 11609 className: "edit-site-editor__inserter-panel" 11610 }), (0,external_wp_element_namespaceObject.createElement)(TagName, { 11611 className: "edit-site-editor__inserter-panel-header" 11612 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11613 icon: library_close, 11614 label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), 11615 onClick: () => setIsInserterOpened(false) 11616 })), (0,external_wp_element_namespaceObject.createElement)("div", { 11617 className: "edit-site-editor__inserter-panel-content" 11618 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { 11619 showInserterHelpPanel: true, 11620 shouldFocusBlock: isMobile, 11621 rootClientId: insertionPoint.rootClientId, 11622 __experimentalInsertionIndex: insertionPoint.insertionIndex, 11623 __experimentalFilterValue: insertionPoint.filterValue, 11624 ref: libraryRef 11625 }))); 11626 } 11627 11628 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/list-view-sidebar.js 11629 11630 11631 /** 11632 * WordPress dependencies 11633 */ 11634 11635 11636 11637 11638 11639 11640 11641 /** 11642 * Internal dependencies 11643 */ 11644 11645 11646 function ListViewSidebar() { 11647 const { 11648 setIsListViewOpened 11649 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11650 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 11651 const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 11652 const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 11653 11654 function closeOnEscape(event) { 11655 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 11656 setIsListViewOpened(false); 11657 } 11658 } 11659 11660 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar); 11661 const labelId = `edit-site-editor__list-view-panel-label-$instanceId}`; 11662 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions 11663 (0,external_wp_element_namespaceObject.createElement)("div", { 11664 "aria-labelledby": labelId, 11665 className: "edit-site-editor__list-view-panel", 11666 onKeyDown: closeOnEscape 11667 }, (0,external_wp_element_namespaceObject.createElement)("div", { 11668 className: "edit-site-editor__list-view-panel-header", 11669 ref: headerFocusReturnRef 11670 }, (0,external_wp_element_namespaceObject.createElement)("strong", { 11671 id: labelId 11672 }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11673 icon: close_small, 11674 label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'), 11675 onClick: () => setIsListViewOpened(false) 11676 })), (0,external_wp_element_namespaceObject.createElement)("div", { 11677 className: "edit-site-editor__list-view-panel-content", 11678 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef]) 11679 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { 11680 showNestedBlocks: true, 11681 __experimentalFeatures: true, 11682 __experimentalPersistentListViewFeatures: true 11683 }))) 11684 ); 11685 } 11686 11687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js 11688 11689 11690 /** 11691 * WordPress dependencies 11692 */ 11693 11694 11695 11696 11697 11698 function CopyButton(_ref) { 11699 let { 11700 text, 11701 children 11702 } = _ref; 11703 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 11704 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11705 variant: "secondary", 11706 ref: ref 11707 }, children); 11708 } 11709 11710 function ErrorBoundaryWarning(_ref2) { 11711 let { 11712 message, 11713 error, 11714 reboot, 11715 dashboardLink 11716 } = _ref2; 11717 const actions = []; 11718 11719 if (reboot) { 11720 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11721 key: "recovery", 11722 onClick: reboot, 11723 variant: "secondary" 11724 }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery'))); 11725 } 11726 11727 if (error) { 11728 actions.push((0,external_wp_element_namespaceObject.createElement)(CopyButton, { 11729 key: "copy-error", 11730 text: error.stack 11731 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))); 11732 } 11733 11734 if (dashboardLink) { 11735 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 11736 key: "back-to-dashboard", 11737 variant: "secondary", 11738 href: dashboardLink 11739 }, (0,external_wp_i18n_namespaceObject.__)('Back to dashboard'))); 11740 } 11741 11742 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { 11743 className: "editor-error-boundary", 11744 actions: actions 11745 }, message); 11746 } 11747 11748 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js 11749 11750 11751 /** 11752 * WordPress dependencies 11753 */ 11754 11755 11756 /** 11757 * Internal dependencies 11758 */ 11759 11760 11761 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 11762 constructor() { 11763 super(...arguments); 11764 this.reboot = this.reboot.bind(this); 11765 this.state = { 11766 error: null 11767 }; 11768 } 11769 11770 static getDerivedStateFromError(error) { 11771 return { 11772 error 11773 }; 11774 } 11775 11776 reboot() { 11777 this.props.onError(); 11778 } 11779 11780 render() { 11781 const { 11782 error 11783 } = this.state; 11784 11785 if (!error) { 11786 return this.props.children; 11787 } 11788 11789 return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, { 11790 message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'), 11791 error: error, 11792 reboot: this.reboot 11793 }); 11794 } 11795 11796 } 11797 11798 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js 11799 11800 function WelcomeGuideImage(_ref) { 11801 let { 11802 nonAnimatedSrc, 11803 animatedSrc 11804 } = _ref; 11805 return (0,external_wp_element_namespaceObject.createElement)("picture", { 11806 className: "edit-site-welcome-guide__image" 11807 }, (0,external_wp_element_namespaceObject.createElement)("source", { 11808 srcSet: nonAnimatedSrc, 11809 media: "(prefers-reduced-motion: reduce)" 11810 }), (0,external_wp_element_namespaceObject.createElement)("img", { 11811 src: animatedSrc, 11812 width: "312", 11813 height: "240", 11814 alt: "" 11815 })); 11816 } 11817 11818 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js 11819 11820 11821 /** 11822 * WordPress dependencies 11823 */ 11824 11825 11826 11827 11828 11829 /** 11830 * Internal dependencies 11831 */ 11832 11833 11834 function WelcomeGuideEditor() { 11835 const { 11836 toggle 11837 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 11838 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), []); 11839 11840 if (!isActive) { 11841 return null; 11842 } 11843 11844 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { 11845 className: "edit-site-welcome-guide", 11846 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), 11847 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), 11848 onFinish: () => toggle('core/edit-site', 'welcomeGuide'), 11849 pages: [{ 11850 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { 11851 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 11852 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 11853 }), 11854 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { 11855 className: "edit-site-welcome-guide__heading" 11856 }, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_wp_element_namespaceObject.createElement)("p", { 11857 className: "edit-site-welcome-guide__text" 11858 }, (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')), (0,external_wp_element_namespaceObject.createElement)("p", { 11859 className: "edit-site-welcome-guide__text" 11860 }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), { 11861 StylesIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { 11862 alt: (0,external_wp_i18n_namespaceObject.__)('styles'), 11863 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" 11864 }) 11865 }))) 11866 }] 11867 }); 11868 } 11869 11870 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js 11871 11872 11873 /** 11874 * WordPress dependencies 11875 */ 11876 11877 11878 11879 11880 11881 /** 11882 * Internal dependencies 11883 */ 11884 11885 11886 11887 function WelcomeGuideStyles() { 11888 const { 11889 toggle 11890 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 11891 const { 11892 isActive, 11893 isStylesOpen 11894 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11895 const sidebar = select(store).getActiveComplementaryArea(store_store.name); 11896 return { 11897 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), 11898 isStylesOpen: sidebar === 'edit-site/global-styles' 11899 }; 11900 }, []); 11901 11902 if (!isActive || !isStylesOpen) { 11903 return null; 11904 } 11905 11906 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { 11907 className: "edit-site-welcome-guide", 11908 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to styles'), 11909 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), 11910 onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), 11911 pages: [{ 11912 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { 11913 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", 11914 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" 11915 }), 11916 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { 11917 className: "edit-site-welcome-guide__heading" 11918 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles')), (0,external_wp_element_namespaceObject.createElement)("p", { 11919 className: "edit-site-welcome-guide__text" 11920 }, (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'))) 11921 }, { 11922 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { 11923 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", 11924 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" 11925 }), 11926 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { 11927 className: "edit-site-welcome-guide__heading" 11928 }, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_wp_element_namespaceObject.createElement)("p", { 11929 className: "edit-site-welcome-guide__text" 11930 }, (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '))) 11931 }, { 11932 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { 11933 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", 11934 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" 11935 }), 11936 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { 11937 className: "edit-site-welcome-guide__heading" 11938 }, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_wp_element_namespaceObject.createElement)("p", { 11939 className: "edit-site-welcome-guide__text" 11940 }, (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'))) 11941 }, { 11942 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { 11943 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 11944 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 11945 }), 11946 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { 11947 className: "edit-site-welcome-guide__heading" 11948 }, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_wp_element_namespaceObject.createElement)("p", { 11949 className: "edit-site-welcome-guide__text" 11950 }, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 11951 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/styles-overview/') 11952 }, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.')))) 11953 }] 11954 }); 11955 } 11956 11957 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js 11958 11959 11960 /** 11961 * Internal dependencies 11962 */ 11963 11964 11965 function WelcomeGuide() { 11966 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideEditor, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideStyles, null)); 11967 } 11968 11969 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/global-styles-renderer.js 11970 /** 11971 * External dependencies 11972 */ 11973 11974 /** 11975 * WordPress dependencies 11976 */ 11977 11978 11979 11980 /** 11981 * Internal dependencies 11982 */ 11983 11984 11985 /** 11986 * Internal dependencies 11987 */ 11988 11989 11990 11991 function useGlobalStylesRenderer() { 11992 const [styles, settings, svgFilters] = useGlobalStylesOutput(); 11993 const { 11994 getSettings 11995 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 11996 const { 11997 updateSettings 11998 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11999 (0,external_wp_element_namespaceObject.useEffect)(() => { 12000 if (!styles || !settings) { 12001 return; 12002 } 12003 12004 const currentStoreSettings = getSettings(); 12005 const nonGlobalStyles = (0,external_lodash_namespaceObject.filter)(currentStoreSettings.styles, style => !style.isGlobalStyles); 12006 updateSettings({ ...currentStoreSettings, 12007 styles: [...nonGlobalStyles, ...styles], 12008 svgFilters, 12009 __experimentalFeatures: settings 12010 }); 12011 }, [styles, settings]); 12012 } 12013 12014 function GlobalStylesRenderer() { 12015 useGlobalStylesRenderer(); 12016 return null; 12017 } 12018 12019 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 12020 /** 12021 * WordPress dependencies 12022 */ 12023 12024 12025 12026 12027 12028 /** 12029 * Internal dependencies 12030 */ 12031 12032 12033 function useTitle(title) { 12034 const location = useLocation(); 12035 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { 12036 var _select$getEntityReco; 12037 12038 return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title; 12039 }, []); 12040 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); 12041 (0,external_wp_element_namespaceObject.useEffect)(() => { 12042 isInitialLocationRef.current = false; 12043 }, [location]); 12044 (0,external_wp_element_namespaceObject.useEffect)(() => { 12045 // Don't update or announce the title for initial page load. 12046 if (isInitialLocationRef.current) { 12047 return; 12048 } 12049 12050 if (title && siteTitle) { 12051 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 12052 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 12053 /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ 12054 (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s — WordPress'), title, siteTitle); 12055 document.title = formattedTitle; // Announce title on route change for screen readers. 12056 12057 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( 12058 /* translators: The page title that is currently displaying. */ 12059 (0,external_wp_i18n_namespaceObject.__)('Now displaying: %s'), document.title), 'assertive'); 12060 } 12061 }, [title, siteTitle, location]); 12062 } 12063 12064 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 12065 12066 12067 /** 12068 * WordPress dependencies 12069 */ 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 /** 12081 * Internal dependencies 12082 */ 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 const interfaceLabels = { 12100 drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar') 12101 }; 12102 12103 function Editor(_ref) { 12104 let { 12105 onError 12106 } = _ref; 12107 const { 12108 isInserterOpen, 12109 isListViewOpen, 12110 sidebarIsOpened, 12111 settings, 12112 entityId, 12113 templateType, 12114 page, 12115 template, 12116 templateResolved, 12117 isNavigationOpen, 12118 previousShortcut, 12119 nextShortcut, 12120 editorMode, 12121 showIconLabels 12122 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12123 const { 12124 isInserterOpened, 12125 isListViewOpened, 12126 getSettings, 12127 getEditedPostType, 12128 getEditedPostId, 12129 getPage, 12130 isNavigationOpened, 12131 getEditorMode 12132 } = select(store_store); 12133 const { 12134 hasFinishedResolution, 12135 getEntityRecord 12136 } = select(external_wp_coreData_namespaceObject.store); 12137 const postType = getEditedPostType(); 12138 const postId = getEditedPostId(); // The currently selected entity to display. Typically template or template part. 12139 12140 return { 12141 isInserterOpen: isInserterOpened(), 12142 isListViewOpen: isListViewOpened(), 12143 sidebarIsOpened: !!select(store).getActiveComplementaryArea(store_store.name), 12144 settings: getSettings(), 12145 templateType: postType, 12146 page: getPage(), 12147 template: postId ? getEntityRecord('postType', postType, postId) : null, 12148 templateResolved: postId ? hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) : false, 12149 entityId: postId, 12150 isNavigationOpen: isNavigationOpened(), 12151 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), 12152 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), 12153 editorMode: getEditorMode(), 12154 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'showIconLabels') 12155 }; 12156 }, []); 12157 const { 12158 setPage, 12159 setIsInserterOpened 12160 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 12161 const { 12162 enableComplementaryArea 12163 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 12164 const [isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen] = (0,external_wp_element_namespaceObject.useState)(false); 12165 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setIsEntitiesSavedStatesOpen(true), []); 12166 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => { 12167 setIsEntitiesSavedStatesOpen(false); 12168 }, []); 12169 const blockContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(page === null || page === void 0 ? void 0 : page.context), 12170 queryContext: [(page === null || page === void 0 ? void 0 : page.context.queryContext) || { 12171 page: 1 12172 }, newQueryContext => setPage({ ...page, 12173 context: { ...(page === null || page === void 0 ? void 0 : page.context), 12174 queryContext: { ...(page === null || page === void 0 ? void 0 : page.context.queryContext), 12175 ...newQueryContext 12176 } 12177 } 12178 })] 12179 }), [page === null || page === void 0 ? void 0 : page.context]); 12180 (0,external_wp_element_namespaceObject.useEffect)(() => { 12181 if (isNavigationOpen) { 12182 document.body.classList.add('is-navigation-sidebar-open'); 12183 } else { 12184 document.body.classList.remove('is-navigation-sidebar-open'); 12185 } 12186 }, [isNavigationOpen]); 12187 (0,external_wp_element_namespaceObject.useEffect)(function openGlobalStylesOnLoad() { 12188 const searchParams = new URLSearchParams(window.location.search); 12189 12190 if (searchParams.get('styles') === 'open') { 12191 enableComplementaryArea('core/edit-site', 'edit-site/global-styles'); 12192 } 12193 }, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded. 12194 12195 const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined; 12196 const secondarySidebarLabel = isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); 12197 12198 const secondarySidebar = () => { 12199 if (editorMode === 'visual' && isInserterOpen) { 12200 return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); 12201 } 12202 12203 if (editorMode === 'visual' && isListViewOpen) { 12204 return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null); 12205 } 12206 12207 return null; 12208 }; // Only announce the title once the editor is ready to prevent "Replace" 12209 // action in <URlQueryController> from double-announcing. 12210 12211 12212 useTitle(isReady && (0,external_wp_i18n_namespaceObject.__)('Editor (beta)')); 12213 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(URLQueryController, null), isReady && (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { 12214 kind: "root", 12215 type: "site" 12216 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { 12217 kind: "postType", 12218 type: templateType, 12219 id: entityId 12220 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { 12221 value: blockContext 12222 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesRenderer, null), (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, { 12223 onError: onError 12224 }, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarComplementaryAreaFills, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { 12225 labels: { ...interfaceLabels, 12226 secondarySidebar: secondarySidebarLabel 12227 }, 12228 className: showIconLabels && 'show-icon-labels', 12229 secondarySidebar: secondarySidebar(), 12230 sidebar: sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { 12231 scope: "core/edit-site" 12232 }), 12233 drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), 12234 header: (0,external_wp_element_namespaceObject.createElement)(Header, { 12235 openEntitiesSavedStates: openEntitiesSavedStates, 12236 showIconLabels: showIconLabels 12237 }), 12238 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), 12239 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, { 12240 scope: "core/block-inspector" 12241 }), editorMode === 'visual' && template && (0,external_wp_element_namespaceObject.createElement)(BlockEditor, { 12242 setIsInserterOpen: setIsInserterOpened 12243 }), editorMode === 'text' && template && (0,external_wp_element_namespaceObject.createElement)(CodeEditor, null), templateResolved && !template && (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && entityId && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { 12244 status: "warning", 12245 isDismissible: false 12246 }, (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, { 12247 openEntitiesSavedStates: openEntitiesSavedStates 12248 })), 12249 actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen ? (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { 12250 close: closeEntitiesSavedStates 12251 }) : (0,external_wp_element_namespaceObject.createElement)("div", { 12252 className: "edit-site-editor__toggle-save-panel" 12253 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 12254 variant: "secondary", 12255 className: "edit-site-editor__toggle-save-panel-button", 12256 onClick: openEntitiesSavedStates, 12257 "aria-expanded": false 12258 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')))), 12259 footer: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { 12260 rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Template') 12261 }), 12262 shortcuts: { 12263 previous: previousShortcut, 12264 next: nextShortcut 12265 } 12266 }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null)))))))); 12267 } 12268 12269 /* harmony default export */ var editor = (Editor); 12270 12271 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/use-register-shortcuts.js 12272 /** 12273 * WordPress dependencies 12274 */ 12275 12276 12277 12278 12279 function useRegisterShortcuts() { 12280 const { 12281 registerShortcut 12282 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 12283 (0,external_wp_element_namespaceObject.useEffect)(() => { 12284 registerShortcut({ 12285 name: 'core/edit-site/next-region', 12286 category: 'global', 12287 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 12288 keyCombination: { 12289 modifier: 'ctrl', 12290 character: '`' 12291 }, 12292 aliases: [{ 12293 modifier: 'access', 12294 character: 'n' 12295 }] 12296 }); 12297 registerShortcut({ 12298 name: 'core/edit-site/previous-region', 12299 category: 'global', 12300 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 12301 keyCombination: { 12302 modifier: 'ctrlShift', 12303 character: '`' 12304 }, 12305 aliases: [{ 12306 modifier: 'access', 12307 character: 'p' 12308 }] 12309 }); 12310 }, []); 12311 } 12312 12313 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js 12314 12315 12316 /** 12317 * WordPress dependencies 12318 */ 12319 12320 const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12321 xmlns: "http://www.w3.org/2000/svg", 12322 viewBox: "0 0 24 24" 12323 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12324 d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" 12325 })); 12326 /* harmony default export */ var library_post = (post); 12327 12328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js 12329 12330 12331 /** 12332 * WordPress dependencies 12333 */ 12334 12335 const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12336 xmlns: "http://www.w3.org/2000/svg", 12337 viewBox: "0 0 24 24" 12338 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12339 d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" 12340 })); 12341 /* harmony default export */ var library_page = (page); 12342 12343 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js 12344 12345 12346 /** 12347 * WordPress dependencies 12348 */ 12349 12350 const archive = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12351 viewBox: "0 0 24 24", 12352 xmlns: "http://www.w3.org/2000/svg" 12353 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12354 d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z" 12355 })); 12356 /* harmony default export */ var library_archive = (archive); 12357 12358 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js 12359 12360 12361 /** 12362 * WordPress dependencies 12363 */ 12364 12365 const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12366 xmlns: "http://www.w3.org/2000/svg", 12367 viewBox: "0 0 24 24" 12368 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12369 d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" 12370 })); 12371 /* harmony default export */ var library_search = (search); 12372 12373 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js 12374 12375 12376 /** 12377 * WordPress dependencies 12378 */ 12379 12380 const notFound = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12381 xmlns: "http://www.w3.org/2000/svg", 12382 viewBox: "0 0 24 24" 12383 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12384 d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" 12385 })); 12386 /* harmony default export */ var not_found = (notFound); 12387 12388 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js 12389 12390 12391 /** 12392 * WordPress dependencies 12393 */ 12394 12395 const list = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12396 viewBox: "0 0 24 24", 12397 xmlns: "http://www.w3.org/2000/svg" 12398 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12399 d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" 12400 })); 12401 /* harmony default export */ var library_list = (list); 12402 12403 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js 12404 12405 12406 /** 12407 * WordPress dependencies 12408 */ 12409 12410 const category = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12411 viewBox: "0 0 24 24", 12412 xmlns: "http://www.w3.org/2000/svg" 12413 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12414 d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", 12415 fillRule: "evenodd", 12416 clipRule: "evenodd" 12417 })); 12418 /* harmony default export */ var library_category = (category); 12419 12420 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js 12421 12422 12423 /** 12424 * WordPress dependencies 12425 */ 12426 12427 const postAuthor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12428 viewBox: "0 0 24 24", 12429 xmlns: "http://www.w3.org/2000/svg" 12430 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12431 d: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z", 12432 fillRule: "evenodd", 12433 clipRule: "evenodd" 12434 })); 12435 /* harmony default export */ var post_author = (postAuthor); 12436 12437 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js 12438 12439 12440 /** 12441 * WordPress dependencies 12442 */ 12443 12444 const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12445 xmlns: "http://www.w3.org/2000/svg", 12446 viewBox: "0 0 24 24" 12447 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12448 "fill-rule": "evenodd", 12449 d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", 12450 "clip-rule": "evenodd" 12451 })); 12452 /* harmony default export */ var block_meta = (blockDefault); 12453 12454 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-date.js 12455 12456 12457 /** 12458 * WordPress dependencies 12459 */ 12460 12461 const postDate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12462 xmlns: "http://www.w3.org/2000/svg", 12463 viewBox: "0 0 24 24" 12464 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12465 d: "M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z" 12466 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12467 d: "M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z" 12468 })); 12469 /* harmony default export */ var post_date = (postDate); 12470 12471 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js 12472 12473 12474 /** 12475 * WordPress dependencies 12476 */ 12477 12478 const tag = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12479 xmlns: "http://www.w3.org/2000/svg", 12480 viewBox: "0 0 24 24" 12481 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12482 d: "M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z" 12483 })); 12484 /* harmony default export */ var library_tag = (tag); 12485 12486 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js 12487 12488 12489 /** 12490 * WordPress dependencies 12491 */ 12492 12493 const media = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 12494 xmlns: "http://www.w3.org/2000/svg", 12495 viewBox: "0 0 24 24" 12496 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 12497 d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" 12498 })); 12499 /* harmony default export */ var library_media = (media); 12500 12501 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template.js 12502 12503 12504 /** 12505 * External dependencies 12506 */ 12507 12508 /** 12509 * WordPress dependencies 12510 */ 12511 12512 12513 12514 12515 12516 12517 12518 12519 /** 12520 * Internal dependencies 12521 */ 12522 12523 12524 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404']; 12525 const TEMPLATE_ICONS = { 12526 'front-page': library_home, 12527 'single-post': library_post, 12528 page: library_page, 12529 archive: library_archive, 12530 search: library_search, 12531 404: not_found, 12532 index: library_list, 12533 category: library_category, 12534 author: post_author, 12535 taxonomy: block_meta, 12536 date: post_date, 12537 tag: library_tag, 12538 attachment: library_media 12539 }; 12540 function NewTemplate(_ref) { 12541 let { 12542 postType 12543 } = _ref; 12544 const history = useHistory(); 12545 const { 12546 templates, 12547 defaultTemplateTypes 12548 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 12549 templates: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { 12550 per_page: -1 12551 }), 12552 defaultTemplateTypes: select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes() 12553 }), []); 12554 const { 12555 saveEntityRecord 12556 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 12557 const { 12558 createErrorNotice 12559 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 12560 12561 async function createTemplate(_ref2) { 12562 let { 12563 slug 12564 } = _ref2; 12565 12566 try { 12567 const { 12568 title, 12569 description 12570 } = (0,external_lodash_namespaceObject.find)(defaultTemplateTypes, { 12571 slug 12572 }); 12573 const template = await saveEntityRecord('postType', 'wp_template', { 12574 excerpt: description, 12575 // Slugs need to be strings, so this is for template `404` 12576 slug: slug.toString(), 12577 status: 'publish', 12578 title 12579 }, { 12580 throwOnError: true 12581 }); // Navigate to the created template editor. 12582 12583 history.push({ 12584 postId: template.id, 12585 postType: template.type 12586 }); // TODO: Add a success notice? 12587 } catch (error) { 12588 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); 12589 createErrorNotice(errorMessage, { 12590 type: 'snackbar' 12591 }); 12592 } 12593 } 12594 12595 const existingTemplateSlugs = (0,external_lodash_namespaceObject.map)(templates, 'slug'); 12596 const missingTemplates = (0,external_lodash_namespaceObject.filter)(defaultTemplateTypes, template => (0,external_lodash_namespaceObject.includes)(DEFAULT_TEMPLATE_SLUGS, template.slug) && !(0,external_lodash_namespaceObject.includes)(existingTemplateSlugs, template.slug)); 12597 12598 if (!missingTemplates.length) { 12599 return null; 12600 } // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. 12601 12602 12603 missingTemplates.sort((template1, template2) => { 12604 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 12605 }); 12606 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { 12607 className: "edit-site-new-template-dropdown", 12608 icon: null, 12609 text: postType.labels.add_new, 12610 label: postType.labels.add_new_item, 12611 popoverProps: { 12612 noArrow: false 12613 }, 12614 toggleProps: { 12615 variant: 'primary' 12616 } 12617 }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, { 12618 className: "edit-site-new-template-dropdown__popover" 12619 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 12620 label: postType.labels.add_new_item 12621 }, (0,external_lodash_namespaceObject.map)(missingTemplates, _ref3 => { 12622 let { 12623 title, 12624 description, 12625 slug 12626 } = _ref3; 12627 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 12628 icon: TEMPLATE_ICONS[slug], 12629 iconPosition: "left", 12630 info: description, 12631 key: slug, 12632 onClick: () => { 12633 createTemplate({ 12634 slug 12635 }); // We will be navigated way so no need to close the dropdown. 12636 } 12637 }, title); 12638 })))); 12639 } 12640 12641 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template-part.js 12642 12643 12644 /** 12645 * External dependencies 12646 */ 12647 12648 /** 12649 * WordPress dependencies 12650 */ 12651 12652 12653 12654 12655 12656 12657 12658 /** 12659 * Internal dependencies 12660 */ 12661 12662 12663 12664 function NewTemplatePart(_ref) { 12665 let { 12666 postType 12667 } = _ref; 12668 const history = useHistory(); 12669 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 12670 const { 12671 createErrorNotice 12672 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 12673 const { 12674 saveEntityRecord 12675 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 12676 12677 async function createTemplatePart(_ref2) { 12678 let { 12679 title, 12680 area 12681 } = _ref2; 12682 12683 if (!title) { 12684 createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Title is not defined.'), { 12685 type: 'snackbar' 12686 }); 12687 return; 12688 } 12689 12690 try { 12691 // Currently template parts only allow latin chars. 12692 // Fallback slug will receive suffix by default. 12693 const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; 12694 const templatePart = await saveEntityRecord('postType', 'wp_template_part', { 12695 slug: cleanSlug, 12696 title, 12697 content: '', 12698 area 12699 }, { 12700 throwOnError: true 12701 }); 12702 setIsModalOpen(false); // Navigate to the created template part editor. 12703 12704 history.push({ 12705 postId: templatePart.id, 12706 postType: templatePart.type 12707 }); // TODO: Add a success notice? 12708 } catch (error) { 12709 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); 12710 createErrorNotice(errorMessage, { 12711 type: 'snackbar' 12712 }); 12713 setIsModalOpen(false); 12714 } 12715 } 12716 12717 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 12718 variant: "primary", 12719 onClick: () => { 12720 setIsModalOpen(true); 12721 } 12722 }, postType.labels.add_new), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { 12723 closeModal: () => setIsModalOpen(false), 12724 onCreate: createTemplatePart 12725 })); 12726 } 12727 12728 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 12729 12730 12731 /** 12732 * WordPress dependencies 12733 */ 12734 12735 12736 /** 12737 * Internal dependencies 12738 */ 12739 12740 12741 12742 function AddNewTemplate(_ref) { 12743 let { 12744 templateType = 'wp_template' 12745 } = _ref; 12746 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); 12747 12748 if (!postType) { 12749 return null; 12750 } 12751 12752 if (templateType === 'wp_template') { 12753 return (0,external_wp_element_namespaceObject.createElement)(NewTemplate, { 12754 postType: postType 12755 }); 12756 } else if (templateType === 'wp_template_part') { 12757 return (0,external_wp_element_namespaceObject.createElement)(NewTemplatePart, { 12758 postType: postType 12759 }); 12760 } 12761 12762 return null; 12763 } 12764 12765 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/header.js 12766 12767 12768 /** 12769 * WordPress dependencies 12770 */ 12771 12772 12773 12774 /** 12775 * Internal dependencies 12776 */ 12777 12778 12779 function header_Header(_ref) { 12780 var _postType$labels; 12781 12782 let { 12783 templateType 12784 } = _ref; 12785 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); 12786 12787 if (!postType) { 12788 return null; 12789 } 12790 12791 return (0,external_wp_element_namespaceObject.createElement)("header", { 12792 className: "edit-site-list-header" 12793 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 12794 level: 1, 12795 className: "edit-site-list-header__title" 12796 }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), (0,external_wp_element_namespaceObject.createElement)("div", { 12797 className: "edit-site-list-header__right" 12798 }, (0,external_wp_element_namespaceObject.createElement)(AddNewTemplate, { 12799 templateType: templateType 12800 }))); 12801 } 12802 12803 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js 12804 /** 12805 * Check if a template is removable. 12806 * 12807 * @param {Object} template The template entity to check. 12808 * @return {boolean} Whether the template is revertable. 12809 */ 12810 function isTemplateRemovable(template) { 12811 if (!template) { 12812 return false; 12813 } 12814 12815 return template.source === 'custom' && !template.has_theme_file; 12816 } 12817 12818 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/rename-menu-item.js 12819 12820 12821 /** 12822 * WordPress dependencies 12823 */ 12824 12825 12826 12827 12828 12829 12830 function RenameMenuItem(_ref) { 12831 let { 12832 template, 12833 onClose 12834 } = _ref; 12835 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => template.title.rendered); 12836 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 12837 const { 12838 editEntityRecord, 12839 saveEditedEntityRecord 12840 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 12841 const { 12842 createSuccessNotice, 12843 createErrorNotice 12844 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 12845 12846 if (!template.is_custom) { 12847 return null; 12848 } 12849 12850 async function onTemplateRename(event) { 12851 event.preventDefault(); 12852 12853 try { 12854 await editEntityRecord('postType', template.type, template.id, { 12855 title 12856 }); // Update state before saving rerenders the list. 12857 12858 setTitle(''); 12859 setIsModalOpen(false); 12860 onClose(); // Persist edited entity. 12861 12862 await saveEditedEntityRecord('postType', template.type, template.id, { 12863 throwOnError: true 12864 }); 12865 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity renamed.'), { 12866 type: 'snackbar' 12867 }); 12868 } catch (error) { 12869 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the entity.'); 12870 createErrorNotice(errorMessage, { 12871 type: 'snackbar' 12872 }); 12873 } 12874 } 12875 12876 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 12877 onClick: () => { 12878 setIsModalOpen(true); 12879 setTitle(template.title.rendered); 12880 } 12881 }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 12882 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 12883 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 12884 onRequestClose: () => { 12885 setIsModalOpen(false); 12886 }, 12887 overlayClassName: "edit-site-list__rename-modal" 12888 }, (0,external_wp_element_namespaceObject.createElement)("form", { 12889 onSubmit: onTemplateRename 12890 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 12891 align: "flex-start", 12892 gap: 8 12893 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 12894 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 12895 value: title, 12896 onChange: setTitle, 12897 required: true 12898 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 12899 className: "edit-site-list__rename-modal-actions", 12900 justify: "flex-end", 12901 expanded: false 12902 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 12903 variant: "tertiary", 12904 onClick: () => { 12905 setIsModalOpen(false); 12906 } 12907 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 12908 variant: "primary", 12909 type: "submit" 12910 }, (0,external_wp_i18n_namespaceObject.__)('Save'))))))); 12911 } 12912 12913 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/index.js 12914 12915 12916 /** 12917 * WordPress dependencies 12918 */ 12919 12920 12921 12922 12923 12924 12925 /** 12926 * Internal dependencies 12927 */ 12928 12929 12930 12931 12932 12933 function Actions(_ref) { 12934 let { 12935 template 12936 } = _ref; 12937 const { 12938 removeTemplate, 12939 revertTemplate 12940 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 12941 const { 12942 saveEditedEntityRecord 12943 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 12944 const { 12945 createSuccessNotice, 12946 createErrorNotice 12947 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 12948 const isRemovable = isTemplateRemovable(template); 12949 const isRevertable = isTemplateRevertable(template); 12950 12951 if (!isRemovable && !isRevertable) { 12952 return null; 12953 } 12954 12955 async function revertAndSaveTemplate() { 12956 try { 12957 await revertTemplate(template, { 12958 allowUndo: false 12959 }); 12960 await saveEditedEntityRecord('postType', template.type, template.id); 12961 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity reverted.'), { 12962 type: 'snackbar' 12963 }); 12964 } catch (error) { 12965 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the entity.'); 12966 createErrorNotice(errorMessage, { 12967 type: 'snackbar' 12968 }); 12969 } 12970 } 12971 12972 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { 12973 icon: more_vertical, 12974 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 12975 className: "edit-site-list-table__actions" 12976 }, _ref2 => { 12977 let { 12978 onClose 12979 } = _ref2; 12980 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRemovable && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(RenameMenuItem, { 12981 template: template, 12982 onClose: onClose 12983 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 12984 isDestructive: true, 12985 isTertiary: true, 12986 onClick: () => { 12987 removeTemplate(template); 12988 onClose(); 12989 } 12990 }, (0,external_wp_i18n_namespaceObject.__)('Delete'))), isRevertable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 12991 info: (0,external_wp_i18n_namespaceObject.__)('Restore to default state'), 12992 onClick: () => { 12993 revertAndSaveTemplate(); 12994 onClose(); 12995 } 12996 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))); 12997 }); 12998 } 12999 13000 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js 13001 13002 13003 /** 13004 * WordPress dependencies 13005 */ 13006 13007 const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 13008 xmlns: "http://www.w3.org/2000/svg", 13009 viewBox: "0 0 24 24" 13010 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 13011 d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" 13012 })); 13013 /* harmony default export */ var library_plugins = (plugins); 13014 13015 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 13016 13017 13018 /** 13019 * WordPress dependencies 13020 */ 13021 13022 const commentAuthorAvatar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 13023 xmlns: "http://www.w3.org/2000/svg", 13024 viewBox: "0 0 24 24" 13025 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 13026 fillRule: "evenodd", 13027 d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", 13028 clipRule: "evenodd" 13029 })); 13030 /* harmony default export */ var comment_author_avatar = (commentAuthorAvatar); 13031 13032 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js 13033 13034 13035 /** 13036 * WordPress dependencies 13037 */ 13038 13039 const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 13040 xmlns: "http://www.w3.org/2000/svg", 13041 viewBox: "0 0 24 24" 13042 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 13043 d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" 13044 })); 13045 /* harmony default export */ var library_globe = (globe); 13046 13047 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/added-by.js 13048 13049 13050 /** 13051 * External dependencies 13052 */ 13053 13054 /** 13055 * WordPress dependencies 13056 */ 13057 13058 13059 13060 13061 13062 13063 13064 const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part']; 13065 13066 function CustomizedTooltip(_ref) { 13067 let { 13068 isCustomized, 13069 children 13070 } = _ref; 13071 13072 if (!isCustomized) { 13073 return children; 13074 } 13075 13076 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, { 13077 text: (0,external_wp_i18n_namespaceObject.__)('This template has been customized') 13078 }, children); 13079 } 13080 13081 function BaseAddedBy(_ref2) { 13082 let { 13083 text, 13084 icon, 13085 imageUrl, 13086 isCustomized 13087 } = _ref2; 13088 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 13089 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 13090 alignment: "left" 13091 }, (0,external_wp_element_namespaceObject.createElement)(CustomizedTooltip, { 13092 isCustomized: isCustomized 13093 }, imageUrl ? (0,external_wp_element_namespaceObject.createElement)("div", { 13094 className: classnames_default()('edit-site-list-added-by__avatar', { 13095 'is-loaded': isImageLoaded 13096 }) 13097 }, (0,external_wp_element_namespaceObject.createElement)("img", { 13098 onLoad: () => setIsImageLoaded(true), 13099 alt: "", 13100 src: imageUrl 13101 })) : (0,external_wp_element_namespaceObject.createElement)("div", { 13102 className: classnames_default()('edit-site-list-added-by__icon', { 13103 'is-customized': isCustomized 13104 }) 13105 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 13106 icon: icon 13107 }))), (0,external_wp_element_namespaceObject.createElement)("span", null, text)); 13108 } 13109 13110 function AddedByTheme(_ref3) { 13111 var _theme$name; 13112 13113 let { 13114 slug, 13115 isCustomized 13116 } = _ref3; 13117 const theme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTheme(slug), [slug]); 13118 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { 13119 icon: library_layout, 13120 text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug, 13121 isCustomized: isCustomized 13122 }); 13123 } 13124 13125 function AddedByPlugin(_ref4) { 13126 let { 13127 slug, 13128 isCustomized 13129 } = _ref4; 13130 const plugin = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPlugin(slug), [slug]); 13131 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { 13132 icon: library_plugins, 13133 text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug, 13134 isCustomized: isCustomized 13135 }); 13136 } 13137 13138 function AddedByAuthor(_ref5) { 13139 var _user$avatar_urls; 13140 13141 let { 13142 id 13143 } = _ref5; 13144 const user = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getUser(id), [id]); 13145 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { 13146 icon: comment_author_avatar, 13147 imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48], 13148 text: user === null || user === void 0 ? void 0 : user.nickname 13149 }); 13150 } 13151 13152 function AddedBySite() { 13153 const { 13154 name, 13155 logoURL 13156 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13157 var _getMedia; 13158 13159 const { 13160 getEntityRecord, 13161 getMedia 13162 } = select(external_wp_coreData_namespaceObject.store); 13163 const siteData = getEntityRecord('root', '__unstableBase'); 13164 return { 13165 name: siteData === null || siteData === void 0 ? void 0 : siteData.name, 13166 logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined 13167 }; 13168 }, []); 13169 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { 13170 icon: library_globe, 13171 imageUrl: logoURL, 13172 text: name 13173 }); 13174 } 13175 13176 function AddedBy(_ref6) { 13177 let { 13178 templateType, 13179 template 13180 } = _ref6; 13181 13182 if (!template) { 13183 return; 13184 } 13185 13186 if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) { 13187 // Template originally provided by a theme, but customized by a user. 13188 // Templates originally didn't have the 'origin' field so identify 13189 // older customized templates by checking for no origin and a 'theme' 13190 // or 'custom' source. 13191 if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) { 13192 return (0,external_wp_element_namespaceObject.createElement)(AddedByTheme, { 13193 slug: template.theme, 13194 isCustomized: template.source === 'custom' 13195 }); 13196 } // Template originally provided by a plugin, but customized by a user. 13197 13198 13199 if (template.has_theme_file && template.origin === 'plugin') { 13200 return (0,external_wp_element_namespaceObject.createElement)(AddedByPlugin, { 13201 slug: template.theme, 13202 isCustomized: template.source === 'custom' 13203 }); 13204 } // Template was created from scratch, but has no author. Author support 13205 // was only added to templates in WordPress 5.9. Fallback to showing the 13206 // site logo and title. 13207 13208 13209 if (!template.has_theme_file && template.source === 'custom' && !template.author) { 13210 return (0,external_wp_element_namespaceObject.createElement)(AddedBySite, null); 13211 } 13212 } // Simply show the author for templates created from scratch that have an 13213 // author or for any other post type. 13214 13215 13216 return (0,external_wp_element_namespaceObject.createElement)(AddedByAuthor, { 13217 id: template.author 13218 }); 13219 } 13220 13221 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/table.js 13222 13223 13224 /** 13225 * WordPress dependencies 13226 */ 13227 13228 13229 13230 13231 13232 /** 13233 * Internal dependencies 13234 */ 13235 13236 13237 13238 13239 function Table(_ref) { 13240 let { 13241 templateType 13242 } = _ref; 13243 const { 13244 records: templates, 13245 isResolving: isLoading 13246 } = (0,external_wp_coreData_namespaceObject.__experimentalUseEntityRecords)('postType', templateType, { 13247 per_page: -1 13248 }); 13249 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); 13250 13251 if (!templates || isLoading) { 13252 return null; 13253 } 13254 13255 if (!templates.length) { 13256 var _postType$labels, _postType$labels$name; 13257 13258 return (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_i18n_namespaceObject.sprintf)( // translators: The template type name, should be either "templates" or "template parts". 13259 (0,external_wp_i18n_namespaceObject.__)('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase())); 13260 } 13261 13262 return (// These explicit aria roles are needed for Safari. 13263 // See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables 13264 (0,external_wp_element_namespaceObject.createElement)("table", { 13265 className: "edit-site-list-table", 13266 role: "table" 13267 }, (0,external_wp_element_namespaceObject.createElement)("thead", null, (0,external_wp_element_namespaceObject.createElement)("tr", { 13268 className: "edit-site-list-table-head", 13269 role: "row" 13270 }, (0,external_wp_element_namespaceObject.createElement)("th", { 13271 className: "edit-site-list-table-column", 13272 role: "columnheader" 13273 }, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)("th", { 13274 className: "edit-site-list-table-column", 13275 role: "columnheader" 13276 }, (0,external_wp_i18n_namespaceObject.__)('Added by')), (0,external_wp_element_namespaceObject.createElement)("th", { 13277 className: "edit-site-list-table-column", 13278 role: "columnheader" 13279 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Actions'))))), (0,external_wp_element_namespaceObject.createElement)("tbody", null, templates.map(template => { 13280 var _template$title; 13281 13282 return (0,external_wp_element_namespaceObject.createElement)("tr", { 13283 key: template.id, 13284 className: "edit-site-list-table-row", 13285 role: "row" 13286 }, (0,external_wp_element_namespaceObject.createElement)("td", { 13287 className: "edit-site-list-table-column", 13288 role: "cell" 13289 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { 13290 level: 4 13291 }, (0,external_wp_element_namespaceObject.createElement)(Link, { 13292 params: { 13293 postId: template.id, 13294 postType: template.type 13295 } 13296 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug))), template.description), (0,external_wp_element_namespaceObject.createElement)("td", { 13297 className: "edit-site-list-table-column", 13298 role: "cell" 13299 }, (0,external_wp_element_namespaceObject.createElement)(AddedBy, { 13300 templateType: templateType, 13301 template: template 13302 })), (0,external_wp_element_namespaceObject.createElement)("td", { 13303 className: "edit-site-list-table-column", 13304 role: "cell" 13305 }, (0,external_wp_element_namespaceObject.createElement)(Actions, { 13306 template: template 13307 }))); 13308 }))) 13309 ); 13310 } 13311 13312 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/index.js 13313 13314 13315 /** 13316 * External dependencies 13317 */ 13318 13319 /** 13320 * WordPress dependencies 13321 */ 13322 13323 13324 13325 13326 13327 13328 13329 /** 13330 * Internal dependencies 13331 */ 13332 13333 13334 13335 13336 13337 13338 13339 13340 function List() { 13341 var _postType$labels, _postType$labels2; 13342 13343 const { 13344 params: { 13345 postType: templateType 13346 } 13347 } = useLocation(); 13348 useRegisterShortcuts(); 13349 const { 13350 previousShortcut, 13351 nextShortcut, 13352 isNavigationOpen 13353 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13354 return { 13355 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), 13356 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), 13357 isNavigationOpen: select(store_store).isNavigationOpened() 13358 }; 13359 }, []); 13360 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); 13361 useTitle(postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name); // `postType` could load in asynchronously. Only provide the detailed region labels if 13362 // the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults. 13363 13364 const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list; 13365 const detailedRegionLabels = postType ? { 13366 header: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page. 13367 (0,external_wp_i18n_namespaceObject.__)('%s - Header'), itemsListLabel), 13368 body: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Content' as in the content area of that page. 13369 (0,external_wp_i18n_namespaceObject.__)('%s - Content'), itemsListLabel) 13370 } : undefined; 13371 return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { 13372 className: classnames_default()('edit-site-list', { 13373 'is-navigation-open': isNavigationOpen 13374 }), 13375 labels: { 13376 drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar'), 13377 ...detailedRegionLabels 13378 }, 13379 header: (0,external_wp_element_namespaceObject.createElement)(header_Header, { 13380 templateType: templateType 13381 }), 13382 drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), 13383 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), 13384 content: (0,external_wp_element_namespaceObject.createElement)(Table, { 13385 templateType: templateType 13386 }), 13387 shortcuts: { 13388 previous: previousShortcut, 13389 next: nextShortcut 13390 } 13391 }); 13392 } 13393 13394 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-is-list-page.js 13395 /** 13396 * Returns if the params match the list page route. 13397 * 13398 * @param {Object} params The search params. 13399 * @param {string} params.postId The post ID. 13400 * @param {string} params.postType The post type. 13401 * @return {boolean} Is list page or not. 13402 */ 13403 function getIsListPage(_ref) { 13404 let { 13405 postId, 13406 postType 13407 } = _ref; 13408 return !!(!postId && postType); 13409 } 13410 13411 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 13412 13413 13414 /** 13415 * WordPress dependencies 13416 */ 13417 13418 13419 13420 13421 13422 13423 /** 13424 * Internal dependencies 13425 */ 13426 13427 13428 13429 13430 13431 13432 function EditSiteApp(_ref) { 13433 let { 13434 reboot 13435 } = _ref; 13436 const { 13437 createErrorNotice 13438 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 13439 13440 function onPluginAreaError(name) { 13441 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( 13442 /* translators: %s: plugin name */ 13443 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 13444 } 13445 13446 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(Routes, null, _ref2 => { 13447 let { 13448 params 13449 } = _ref2; 13450 const isListPage = getIsListPage(params); 13451 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage ? (0,external_wp_element_namespaceObject.createElement)(List, null) : (0,external_wp_element_namespaceObject.createElement)(editor, { 13452 onError: reboot 13453 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { 13454 onError: onPluginAreaError 13455 }), (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar // Open the navigation sidebar by default when in the list page. 13456 , { 13457 isDefaultOpen: !!isListPage, 13458 activeTemplateType: isListPage ? params.postType : undefined 13459 })); 13460 })); 13461 } 13462 13463 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/plugin-sidebar/index.js 13464 13465 13466 13467 /** 13468 * WordPress dependencies 13469 */ 13470 13471 /** 13472 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. 13473 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. 13474 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: 13475 * 13476 * ```js 13477 * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); 13478 * ``` 13479 * 13480 * @see PluginSidebarMoreMenuItem 13481 * 13482 * @param {Object} props Element props. 13483 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. 13484 * @param {string} [props.className] An optional class name added to the sidebar body. 13485 * @param {string} props.title Title displayed at the top of the sidebar. 13486 * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. 13487 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. 13488 * 13489 * @example 13490 * ```js 13491 * // Using ES5 syntax 13492 * var __ = wp.i18n.__; 13493 * var el = wp.element.createElement; 13494 * var PanelBody = wp.components.PanelBody; 13495 * var PluginSidebar = wp.editSite.PluginSidebar; 13496 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 13497 * 13498 * function MyPluginSidebar() { 13499 * return el( 13500 * PluginSidebar, 13501 * { 13502 * name: 'my-sidebar', 13503 * title: 'My sidebar title', 13504 * icon: moreIcon, 13505 * }, 13506 * el( 13507 * PanelBody, 13508 * {}, 13509 * __( 'My sidebar content' ) 13510 * ) 13511 * ); 13512 * } 13513 * ``` 13514 * 13515 * @example 13516 * ```jsx 13517 * // Using ESNext syntax 13518 * import { __ } from '@wordpress/i18n'; 13519 * import { PanelBody } from '@wordpress/components'; 13520 * import { PluginSidebar } from '@wordpress/edit-site'; 13521 * import { more } from '@wordpress/icons'; 13522 * 13523 * const MyPluginSidebar = () => ( 13524 * <PluginSidebar 13525 * name="my-sidebar" 13526 * title="My sidebar title" 13527 * icon={ more } 13528 * > 13529 * <PanelBody> 13530 * { __( 'My sidebar content' ) } 13531 * </PanelBody> 13532 * </PluginSidebar> 13533 * ); 13534 * ``` 13535 */ 13536 13537 function PluginSidebarEditSite(_ref) { 13538 let { 13539 className, 13540 ...props 13541 } = _ref; 13542 return (0,external_wp_element_namespaceObject.createElement)(complementary_area, extends_extends({ 13543 panelClassName: className, 13544 className: "edit-site-sidebar", 13545 scope: "core/edit-site" 13546 }, props)); 13547 } 13548 13549 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-sidebar-more-menu-item/index.js 13550 13551 13552 13553 /** 13554 * WordPress dependencies 13555 */ 13556 13557 /** 13558 * Renders a menu item in `Plugins` group in `More Menu` drop down, 13559 * and can be used to activate the corresponding `PluginSidebar` component. 13560 * The text within the component appears as the menu item label. 13561 * 13562 * @param {Object} props Component props. 13563 * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. 13564 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. 13565 * 13566 * @example 13567 * ```js 13568 * // Using ES5 syntax 13569 * var __ = wp.i18n.__; 13570 * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem; 13571 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 13572 * 13573 * function MySidebarMoreMenuItem() { 13574 * return wp.element.createElement( 13575 * PluginSidebarMoreMenuItem, 13576 * { 13577 * target: 'my-sidebar', 13578 * icon: moreIcon, 13579 * }, 13580 * __( 'My sidebar title' ) 13581 * ) 13582 * } 13583 * ``` 13584 * 13585 * @example 13586 * ```jsx 13587 * // Using ESNext syntax 13588 * import { __ } from '@wordpress/i18n'; 13589 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site'; 13590 * import { more } from '@wordpress/icons'; 13591 * 13592 * const MySidebarMoreMenuItem = () => ( 13593 * <PluginSidebarMoreMenuItem 13594 * target="my-sidebar" 13595 * icon={ more } 13596 * > 13597 * { __( 'My sidebar title' ) } 13598 * </PluginSidebarMoreMenuItem> 13599 * ); 13600 * ``` 13601 * 13602 * @return {WPComponent} The component to be rendered. 13603 */ 13604 13605 function PluginSidebarMoreMenuItem(props) { 13606 return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. 13607 // @see https://github.com/WordPress/gutenberg/issues/14457 13608 , extends_extends({ 13609 __unstableExplicitMenuItem: true, 13610 scope: "core/edit-site" 13611 }, props)); 13612 } 13613 13614 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-more-menu-item/index.js 13615 /** 13616 * WordPress dependencies 13617 */ 13618 13619 13620 13621 13622 /** 13623 * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. 13624 * The text within the component appears as the menu item label. 13625 * 13626 * @param {Object} props Component properties. 13627 * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. 13628 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. 13629 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. 13630 * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. 13631 * 13632 * @example 13633 * ```js 13634 * // Using ES5 syntax 13635 * var __ = wp.i18n.__; 13636 * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem; 13637 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 13638 * 13639 * function onButtonClick() { 13640 * alert( 'Button clicked.' ); 13641 * } 13642 * 13643 * function MyButtonMoreMenuItem() { 13644 * return wp.element.createElement( 13645 * PluginMoreMenuItem, 13646 * { 13647 * icon: moreIcon, 13648 * onClick: onButtonClick, 13649 * }, 13650 * __( 'My button title' ) 13651 * ); 13652 * } 13653 * ``` 13654 * 13655 * @example 13656 * ```jsx 13657 * // Using ESNext syntax 13658 * import { __ } from '@wordpress/i18n'; 13659 * import { PluginMoreMenuItem } from '@wordpress/edit-site'; 13660 * import { more } from '@wordpress/icons'; 13661 * 13662 * function onButtonClick() { 13663 * alert( 'Button clicked.' ); 13664 * } 13665 * 13666 * const MyButtonMoreMenuItem = () => ( 13667 * <PluginMoreMenuItem 13668 * icon={ more } 13669 * onClick={ onButtonClick } 13670 * > 13671 * { __( 'My button title' ) } 13672 * </PluginMoreMenuItem> 13673 * ); 13674 * ``` 13675 * 13676 * @return {WPComponent} The component to be rendered. 13677 */ 13678 13679 /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 13680 var _ownProps$as; 13681 13682 return { 13683 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, 13684 icon: ownProps.icon || context.icon, 13685 name: 'core/edit-site/plugin-more-menu' 13686 }; 13687 }))(action_item)); 13688 13689 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js 13690 13691 13692 /** 13693 * WordPress dependencies 13694 */ 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 /** 13706 * Internal dependencies 13707 */ 13708 13709 13710 13711 13712 13713 13714 /** 13715 * Reinitializes the editor after the user chooses to reboot the editor after 13716 * an unhandled error occurs, replacing previously mounted editor element using 13717 * an initial state from prior to the crash. 13718 * 13719 * @param {Element} target DOM node in which editor is rendered. 13720 * @param {?Object} settings Editor settings object. 13721 */ 13722 13723 function reinitializeEditor(target, settings) { 13724 // Display warning if editor wasn't able to resolve homepage template. 13725 if (!settings.__unstableHomeTemplate) { 13726 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, { 13727 message: (0,external_wp_i18n_namespaceObject.__)('The editor is unable to find a block template for the homepage.'), 13728 dashboardLink: "index.php" 13729 }), target); 13730 return; 13731 } // This will be a no-op if the target doesn't have any React nodes. 13732 13733 13734 (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target); 13735 const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering 13736 // so that we won't trigger unnecessary re-renders with useEffect. 13737 13738 { 13739 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 13740 editorMode: 'visual', 13741 fixedToolbar: false, 13742 focusMode: false, 13743 keepCaretInsideBlock: false, 13744 welcomeGuide: true, 13745 welcomeGuideStyles: true 13746 }); 13747 (0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too, 13748 // so that they can be selected with core/editor selectors in any editor. 13749 // This is needed because edit-site doesn't initialize with EditorProvider, 13750 // which internally uses updateEditorSettings as well. 13751 13752 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({ 13753 defaultTemplateTypes: settings.defaultTemplateTypes, 13754 defaultTemplatePartAreas: settings.defaultTemplatePartAreas 13755 }); 13756 const isLandingOnListPage = getIsListPage((0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href)); 13757 13758 if (isLandingOnListPage) { 13759 // Default the navigation panel to be opened when we're in a bigger 13760 // screen and land in the list screen. 13761 (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsNavigationPanelOpened((0,external_wp_data_namespaceObject.select)(external_wp_viewport_namespaceObject.store).isViewportMatch('medium')); 13762 } 13763 } 13764 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(EditSiteApp, { 13765 reboot: reboot 13766 }), target); 13767 } 13768 /** 13769 * Initializes the site editor screen. 13770 * 13771 * @param {string} id ID of the root element to render the screen in. 13772 * @param {Object} settings Editor settings. 13773 */ 13774 13775 function initializeEditor(id, settings) { 13776 settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); 13777 13778 settings.__experimentalFetchRichUrlData = external_wp_coreData_namespaceObject.__experimentalFetchUrlData; 13779 settings.__experimentalSpotlightEntityBlocks = ['core/template-part']; 13780 const target = document.getElementById(id); 13781 13782 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); 13783 13784 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); 13785 13786 if (false) {} 13787 13788 reinitializeEditor(target, settings); 13789 } 13790 13791 13792 13793 13794 13795 13796 }(); 13797 (window.wp = window.wp || {}).editSite = __webpack_exports__; 13798 /******/ })() 13799 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |