[ 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_w