| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ var __webpack_modules__ = ({ |
| 3 |
|
| 4 |
/***/ 9367: |
| 5 |
/***/ (function(module, exports) { |
| 6 |
|
| 7 |
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
| 8 |
autosize 4.0.2 |
| 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 |
/***/ 4184: |
| 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 |
/***/ 1934: |
| 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 |
/***/ 3729: |
| 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 |
/***/ 8303: |
| 561 |
/***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
| 562 |
|
| 563 |
// Load in dependencies |
| 564 |
var computedStyle = __webpack_require__(1934); |
| 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 |
/***/ 2703: |
| 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__(414); |
| 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 |
bool: shim, |
| 706 |
func: shim, |
| 707 |
number: shim, |
| 708 |
object: shim, |
| 709 |
string: shim, |
| 710 |
symbol: shim, |
| 711 |
|
| 712 |
any: shim, |
| 713 |
arrayOf: getShim, |
| 714 |
element: shim, |
| 715 |
elementType: shim, |
| 716 |
instanceOf: getShim, |
| 717 |
node: shim, |
| 718 |
objectOf: getShim, |
| 719 |
oneOf: getShim, |
| 720 |
oneOfType: getShim, |
| 721 |
shape: getShim, |
| 722 |
exact: getShim, |
| 723 |
|
| 724 |
checkPropTypes: emptyFunctionWithReset, |
| 725 |
resetWarningCache: emptyFunction |
| 726 |
}; |
| 727 |
|
| 728 |
ReactPropTypes.PropTypes = ReactPropTypes; |
| 729 |
|
| 730 |
return ReactPropTypes; |
| 731 |
}; |
| 732 |
|
| 733 |
|
| 734 |
/***/ }), |
| 735 |
|
| 736 |
/***/ 5697: |
| 737 |
/***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
| 738 |
|
| 739 |
/** |
| 740 |
* Copyright (c) 2013-present, Facebook, Inc. |
| 741 |
* |
| 742 |
* This source code is licensed under the MIT license found in the |
| 743 |
* LICENSE file in the root directory of this source tree. |
| 744 |
*/ |
| 745 |
|
| 746 |
if (false) { var throwOnDirectAccess, ReactIs; } else { |
| 747 |
// By explicitly using `prop-types` you are opting into new production behavior. |
| 748 |
// http://fb.me/prop-types-in-prod |
| 749 |
module.exports = __webpack_require__(2703)(); |
| 750 |
} |
| 751 |
|
| 752 |
|
| 753 |
/***/ }), |
| 754 |
|
| 755 |
/***/ 414: |
| 756 |
/***/ (function(module) { |
| 757 |
|
| 758 |
"use strict"; |
| 759 |
/** |
| 760 |
* Copyright (c) 2013-present, Facebook, Inc. |
| 761 |
* |
| 762 |
* This source code is licensed under the MIT license found in the |
| 763 |
* LICENSE file in the root directory of this source tree. |
| 764 |
*/ |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
| 769 |
|
| 770 |
module.exports = ReactPropTypesSecret; |
| 771 |
|
| 772 |
|
| 773 |
/***/ }), |
| 774 |
|
| 775 |
/***/ 4857: |
| 776 |
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
| 777 |
|
| 778 |
"use strict"; |
| 779 |
|
| 780 |
var __extends = (this && this.__extends) || (function () { |
| 781 |
var extendStatics = Object.setPrototypeOf || |
| 782 |
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
| 783 |
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
| 784 |
return function (d, b) { |
| 785 |
extendStatics(d, b); |
| 786 |
function __() { this.constructor = d; } |
| 787 |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 788 |
}; |
| 789 |
})(); |
| 790 |
var __assign = (this && this.__assign) || Object.assign || function(t) { |
| 791 |
for (var s, i = 1, n = arguments.length; i < n; i++) { |
| 792 |
s = arguments[i]; |
| 793 |
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) |
| 794 |
t[p] = s[p]; |
| 795 |
} |
| 796 |
return t; |
| 797 |
}; |
| 798 |
var __rest = (this && this.__rest) || function (s, e) { |
| 799 |
var t = {}; |
| 800 |
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
| 801 |
t[p] = s[p]; |
| 802 |
if (s != null && typeof Object.getOwnPropertySymbols === "function") |
| 803 |
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
| 804 |
t[p[i]] = s[p[i]]; |
| 805 |
return t; |
| 806 |
}; |
| 807 |
exports.__esModule = true; |
| 808 |
var React = __webpack_require__(9196); |
| 809 |
var PropTypes = __webpack_require__(5697); |
| 810 |
var autosize = __webpack_require__(9367); |
| 811 |
var _getLineHeight = __webpack_require__(8303); |
| 812 |
var getLineHeight = _getLineHeight; |
| 813 |
var RESIZED = "autosize:resized"; |
| 814 |
/** |
| 815 |
* A light replacement for built-in textarea component |
| 816 |
* which automaticaly adjusts its height to match the content |
| 817 |
*/ |
| 818 |
var TextareaAutosizeClass = /** @class */ (function (_super) { |
| 819 |
__extends(TextareaAutosizeClass, _super); |
| 820 |
function TextareaAutosizeClass() { |
| 821 |
var _this = _super !== null && _super.apply(this, arguments) || this; |
| 822 |
_this.state = { |
| 823 |
lineHeight: null |
| 824 |
}; |
| 825 |
_this.textarea = null; |
| 826 |
_this.onResize = function (e) { |
| 827 |
if (_this.props.onResize) { |
| 828 |
_this.props.onResize(e); |
| 829 |
} |
| 830 |
}; |
| 831 |
_this.updateLineHeight = function () { |
| 832 |
if (_this.textarea) { |
| 833 |
_this.setState({ |
| 834 |
lineHeight: getLineHeight(_this.textarea) |
| 835 |
}); |
| 836 |
} |
| 837 |
}; |
| 838 |
_this.onChange = function (e) { |
| 839 |
var onChange = _this.props.onChange; |
| 840 |
_this.currentValue = e.currentTarget.value; |
| 841 |
onChange && onChange(e); |
| 842 |
}; |
| 843 |
return _this; |
| 844 |
} |
| 845 |
TextareaAutosizeClass.prototype.componentDidMount = function () { |
| 846 |
var _this = this; |
| 847 |
var _a = this.props, maxRows = _a.maxRows, async = _a.async; |
| 848 |
if (typeof maxRows === "number") { |
| 849 |
this.updateLineHeight(); |
| 850 |
} |
| 851 |
if (typeof maxRows === "number" || async) { |
| 852 |
/* |
| 853 |
the defer is needed to: |
| 854 |
- force "autosize" to activate the scrollbar when this.props.maxRows is passed |
| 855 |
- support StyledComponents (see #71) |
| 856 |
*/ |
| 857 |
setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); |
| 858 |
} |
| 859 |
else { |
| 860 |
this.textarea && autosize(this.textarea); |
| 861 |
} |
| 862 |
if (this.textarea) { |
| 863 |
this.textarea.addEventListener(RESIZED, this.onResize); |
| 864 |
} |
| 865 |
}; |
| 866 |
TextareaAutosizeClass.prototype.componentWillUnmount = function () { |
| 867 |
if (this.textarea) { |
| 868 |
this.textarea.removeEventListener(RESIZED, this.onResize); |
| 869 |
autosize.destroy(this.textarea); |
| 870 |
} |
| 871 |
}; |
| 872 |
TextareaAutosizeClass.prototype.render = function () { |
| 873 |
var _this = this; |
| 874 |
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; |
| 875 |
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; |
| 876 |
return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { |
| 877 |
_this.textarea = element; |
| 878 |
if (typeof _this.props.innerRef === 'function') { |
| 879 |
_this.props.innerRef(element); |
| 880 |
} |
| 881 |
else if (_this.props.innerRef) { |
| 882 |
_this.props.innerRef.current = element; |
| 883 |
} |
| 884 |
} }), children)); |
| 885 |
}; |
| 886 |
TextareaAutosizeClass.prototype.componentDidUpdate = function () { |
| 887 |
this.textarea && autosize.update(this.textarea); |
| 888 |
}; |
| 889 |
TextareaAutosizeClass.defaultProps = { |
| 890 |
rows: 1, |
| 891 |
async: false |
| 892 |
}; |
| 893 |
TextareaAutosizeClass.propTypes = { |
| 894 |
rows: PropTypes.number, |
| 895 |
maxRows: PropTypes.number, |
| 896 |
onResize: PropTypes.func, |
| 897 |
innerRef: PropTypes.any, |
| 898 |
async: PropTypes.bool |
| 899 |
}; |
| 900 |
return TextareaAutosizeClass; |
| 901 |
}(React.Component)); |
| 902 |
exports.TextareaAutosize = React.forwardRef(function (props, ref) { |
| 903 |
return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); |
| 904 |
}); |
| 905 |
|
| 906 |
|
| 907 |
/***/ }), |
| 908 |
|
| 909 |
/***/ 4042: |
| 910 |
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
| 911 |
|
| 912 |
"use strict"; |
| 913 |
var __webpack_unused_export__; |
| 914 |
|
| 915 |
__webpack_unused_export__ = true; |
| 916 |
var TextareaAutosize_1 = __webpack_require__(4857); |
| 917 |
exports.Z = TextareaAutosize_1.TextareaAutosize; |
| 918 |
|
| 919 |
|
| 920 |
/***/ }), |
| 921 |
|
| 922 |
/***/ 9196: |
| 923 |
/***/ (function(module) { |
| 924 |
|
| 925 |
"use strict"; |
| 926 |
module.exports = window["React"]; |
| 927 |
|
| 928 |
/***/ }) |
| 929 |
|
| 930 |
/******/ }); |
| 931 |
/************************************************************************/ |
| 932 |
/******/ // The module cache |
| 933 |
/******/ var __webpack_module_cache__ = {}; |
| 934 |
/******/ |
| 935 |
/******/ // The require function |
| 936 |
/******/ function __webpack_require__(moduleId) { |
| 937 |
/******/ // Check if module is in cache |
| 938 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 939 |
/******/ if (cachedModule !== undefined) { |
| 940 |
/******/ return cachedModule.exports; |
| 941 |
/******/ } |
| 942 |
/******/ // Create a new module (and put it into the cache) |
| 943 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 944 |
/******/ // no module.id needed |
| 945 |
/******/ // no module.loaded needed |
| 946 |
/******/ exports: {} |
| 947 |
/******/ }; |
| 948 |
/******/ |
| 949 |
/******/ // Execute the module function |
| 950 |
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 951 |
/******/ |
| 952 |
/******/ // Return the exports of the module |
| 953 |
/******/ return module.exports; |
| 954 |
/******/ } |
| 955 |
/******/ |
| 956 |
/************************************************************************/ |
| 957 |
/******/ /* webpack/runtime/compat get default export */ |
| 958 |
/******/ !function() { |
| 959 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 960 |
/******/ __webpack_require__.n = function(module) { |
| 961 |
/******/ var getter = module && module.__esModule ? |
| 962 |
/******/ function() { return module['default']; } : |
| 963 |
/******/ function() { return module; }; |
| 964 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 965 |
/******/ return getter; |
| 966 |
/******/ }; |
| 967 |
/******/ }(); |
| 968 |
/******/ |
| 969 |
/******/ /* webpack/runtime/define property getters */ |
| 970 |
/******/ !function() { |
| 971 |
/******/ // define getter functions for harmony exports |
| 972 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 973 |
/******/ for(var key in definition) { |
| 974 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 975 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 976 |
/******/ } |
| 977 |
/******/ } |
| 978 |
/******/ }; |
| 979 |
/******/ }(); |
| 980 |
/******/ |
| 981 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 982 |
/******/ !function() { |
| 983 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 984 |
/******/ }(); |
| 985 |
/******/ |
| 986 |
/******/ /* webpack/runtime/make namespace object */ |
| 987 |
/******/ !function() { |
| 988 |
/******/ // define __esModule on exports |
| 989 |
/******/ __webpack_require__.r = function(exports) { |
| 990 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 991 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 992 |
/******/ } |
| 993 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 994 |
/******/ }; |
| 995 |
/******/ }(); |
| 996 |
/******/ |
| 997 |
/************************************************************************/ |
| 998 |
var __webpack_exports__ = {}; |
| 999 |
// This entry need to be wrapped in an IIFE because it need to be in strict mode. |
| 1000 |
!function() { |
| 1001 |
"use strict"; |
| 1002 |
// ESM COMPAT FLAG |
| 1003 |
__webpack_require__.r(__webpack_exports__); |
| 1004 |
|
| 1005 |
// EXPORTS |
| 1006 |
__webpack_require__.d(__webpack_exports__, { |
| 1007 |
"PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; }, |
| 1008 |
"PluginSidebar": function() { return /* reexport */ PluginSidebarEditSite; }, |
| 1009 |
"PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; }, |
| 1010 |
"__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; }, |
| 1011 |
"__experimentalNavigationToggle": function() { return /* reexport */ navigation_toggle; }, |
| 1012 |
"initializeEditor": function() { return /* binding */ initializeEditor; }, |
| 1013 |
"reinitializeEditor": function() { return /* binding */ reinitializeEditor; } |
| 1014 |
}); |
| 1015 |
|
| 1016 |
// NAMESPACE OBJECT: ./packages/interface/build-module/store/actions.js |
| 1017 |
var actions_namespaceObject = {}; |
| 1018 |
__webpack_require__.r(actions_namespaceObject); |
| 1019 |
__webpack_require__.d(actions_namespaceObject, { |
| 1020 |
"disableComplementaryArea": function() { return disableComplementaryArea; }, |
| 1021 |
"enableComplementaryArea": function() { return enableComplementaryArea; }, |
| 1022 |
"pinItem": function() { return pinItem; }, |
| 1023 |
"setFeatureDefaults": function() { return setFeatureDefaults; }, |
| 1024 |
"setFeatureValue": function() { return setFeatureValue; }, |
| 1025 |
"toggleFeature": function() { return toggleFeature; }, |
| 1026 |
"unpinItem": function() { return unpinItem; } |
| 1027 |
}); |
| 1028 |
|
| 1029 |
// NAMESPACE OBJECT: ./packages/interface/build-module/store/selectors.js |
| 1030 |
var selectors_namespaceObject = {}; |
| 1031 |
__webpack_require__.r(selectors_namespaceObject); |
| 1032 |
__webpack_require__.d(selectors_namespaceObject, { |
| 1033 |
"getActiveComplementaryArea": function() { return getActiveComplementaryArea; }, |
| 1034 |
"isFeatureActive": function() { return isFeatureActive; }, |
| 1035 |
"isItemPinned": function() { return isItemPinned; } |
| 1036 |
}); |
| 1037 |
|
| 1038 |
// NAMESPACE OBJECT: ./packages/edit-site/build-module/store/actions.js |
| 1039 |
var store_actions_namespaceObject = {}; |
| 1040 |
__webpack_require__.r(store_actions_namespaceObject); |
| 1041 |
__webpack_require__.d(store_actions_namespaceObject, { |
| 1042 |
"__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; }, |
| 1043 |
"addTemplate": function() { return addTemplate; }, |
| 1044 |
"closeGeneralSidebar": function() { return closeGeneralSidebar; }, |
| 1045 |
"openGeneralSidebar": function() { return openGeneralSidebar; }, |
| 1046 |
"openNavigationPanelToMenu": function() { return openNavigationPanelToMenu; }, |
| 1047 |
"removeTemplate": function() { return removeTemplate; }, |
| 1048 |
"revertTemplate": function() { return revertTemplate; }, |
| 1049 |
"setHomeTemplateId": function() { return setHomeTemplateId; }, |
| 1050 |
"setIsInserterOpened": function() { return setIsInserterOpened; }, |
| 1051 |
"setIsListViewOpened": function() { return setIsListViewOpened; }, |
| 1052 |
"setIsNavigationPanelOpened": function() { return setIsNavigationPanelOpened; }, |
| 1053 |
"setNavigationPanelActiveMenu": function() { return setNavigationPanelActiveMenu; }, |
| 1054 |
"setPage": function() { return setPage; }, |
| 1055 |
"setTemplate": function() { return setTemplate; }, |
| 1056 |
"setTemplatePart": function() { return setTemplatePart; }, |
| 1057 |
"switchEditorMode": function() { return switchEditorMode; }, |
| 1058 |
"toggleFeature": function() { return actions_toggleFeature; }, |
| 1059 |
"updateSettings": function() { return updateSettings; } |
| 1060 |
}); |
| 1061 |
|
| 1062 |
// NAMESPACE OBJECT: ./packages/edit-site/build-module/store/selectors.js |
| 1063 |
var store_selectors_namespaceObject = {}; |
| 1064 |
__webpack_require__.r(store_selectors_namespaceObject); |
| 1065 |
__webpack_require__.d(store_selectors_namespaceObject, { |
| 1066 |
"__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; }, |
| 1067 |
"__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; }, |
| 1068 |
"getCanUserCreateMedia": function() { return getCanUserCreateMedia; }, |
| 1069 |
"getCurrentTemplateNavigationPanelSubMenu": function() { return getCurrentTemplateNavigationPanelSubMenu; }, |
| 1070 |
"getCurrentTemplateTemplateParts": function() { return getCurrentTemplateTemplateParts; }, |
| 1071 |
"getEditedPostId": function() { return getEditedPostId; }, |
| 1072 |
"getEditedPostType": function() { return getEditedPostType; }, |
| 1073 |
"getEditorMode": function() { return getEditorMode; }, |
| 1074 |
"getHomeTemplateId": function() { return getHomeTemplateId; }, |
| 1075 |
"getNavigationPanelActiveMenu": function() { return getNavigationPanelActiveMenu; }, |
| 1076 |
"getPage": function() { return getPage; }, |
| 1077 |
"getReusableBlocks": function() { return getReusableBlocks; }, |
| 1078 |
"getSettings": function() { return getSettings; }, |
| 1079 |
"isFeatureActive": function() { return selectors_isFeatureActive; }, |
| 1080 |
"isInserterOpened": function() { return isInserterOpened; }, |
| 1081 |
"isListViewOpened": function() { return isListViewOpened; }, |
| 1082 |
"isNavigationOpened": function() { return isNavigationOpened; } |
| 1083 |
}); |
| 1084 |
|
| 1085 |
;// CONCATENATED MODULE: external ["wp","element"] |
| 1086 |
var external_wp_element_namespaceObject = window["wp"]["element"]; |
| 1087 |
;// CONCATENATED MODULE: external ["wp","blocks"] |
| 1088 |
var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
| 1089 |
;// CONCATENATED MODULE: external ["wp","blockLibrary"] |
| 1090 |
var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; |
| 1091 |
;// CONCATENATED MODULE: external ["wp","data"] |
| 1092 |
var external_wp_data_namespaceObject = window["wp"]["data"]; |
| 1093 |
;// CONCATENATED MODULE: external ["wp","coreData"] |
| 1094 |
var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
| 1095 |
;// CONCATENATED MODULE: external ["wp","editor"] |
| 1096 |
var external_wp_editor_namespaceObject = window["wp"]["editor"]; |
| 1097 |
;// CONCATENATED MODULE: external ["wp","viewport"] |
| 1098 |
var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; |
| 1099 |
;// CONCATENATED MODULE: external ["wp","url"] |
| 1100 |
var external_wp_url_namespaceObject = window["wp"]["url"]; |
| 1101 |
;// CONCATENATED MODULE: external ["wp","hooks"] |
| 1102 |
var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
| 1103 |
;// CONCATENATED MODULE: external ["wp","mediaUtils"] |
| 1104 |
var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; |
| 1105 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/hooks/components.js |
| 1106 |
/** |
| 1107 |
* WordPress dependencies |
| 1108 |
*/ |
| 1109 |
|
| 1110 |
|
| 1111 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); |
| 1112 |
//# sourceMappingURL=components.js.map |
| 1113 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/hooks/index.js |
| 1114 |
/** |
| 1115 |
* Internal dependencies |
| 1116 |
*/ |
| 1117 |
|
| 1118 |
//# sourceMappingURL=index.js.map |
| 1119 |
;// CONCATENATED MODULE: external ["wp","dataControls"] |
| 1120 |
var external_wp_dataControls_namespaceObject = window["wp"]["dataControls"]; |
| 1121 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/defaults.js |
| 1122 |
const PREFERENCES_DEFAULTS = { |
| 1123 |
features: { |
| 1124 |
welcomeGuide: true, |
| 1125 |
welcomeGuideStyles: true |
| 1126 |
}, |
| 1127 |
editorMode: 'visual' |
| 1128 |
}; |
| 1129 |
//# sourceMappingURL=defaults.js.map |
| 1130 |
;// CONCATENATED MODULE: external ["wp","i18n"] |
| 1131 |
var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
| 1132 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/constants.js |
| 1133 |
/** |
| 1134 |
* The identifier for the data store. |
| 1135 |
* |
| 1136 |
* @type {string} |
| 1137 |
*/ |
| 1138 |
const STORE_NAME = 'core/edit-site'; |
| 1139 |
const TEMPLATE_PART_AREA_HEADER = 'header'; |
| 1140 |
const TEMPLATE_PART_AREA_FOOTER = 'footer'; |
| 1141 |
const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar'; |
| 1142 |
const TEMPLATE_PART_AREA_GENERAL = 'uncategorized'; |
| 1143 |
//# sourceMappingURL=constants.js.map |
| 1144 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigation-sidebar/navigation-panel/constants.js |
| 1145 |
/** |
| 1146 |
* WordPress dependencies |
| 1147 |
*/ |
| 1148 |
|
| 1149 |
/** |
| 1150 |
* Internal dependencies |
| 1151 |
*/ |
| 1152 |
|
| 1153 |
|
| 1154 |
const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search']; |
| 1155 |
const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single-post', 'front-page']; |
| 1156 |
const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY]; |
| 1157 |
const TEMPLATES_GENERAL = ['page-home']; |
| 1158 |
const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-']; |
| 1159 |
const TEMPLATES_PAGES_PREFIXES = ['page-']; |
| 1160 |
const TEMPLATE_OVERRIDES = { |
| 1161 |
singular: ['single', 'page'], |
| 1162 |
index: ['archive', '404', 'search', 'singular', 'home'], |
| 1163 |
home: ['front-page'] |
| 1164 |
}; |
| 1165 |
const MENU_ROOT = 'root'; |
| 1166 |
const MENU_TEMPLATE_PARTS = 'template-parts'; |
| 1167 |
const MENU_TEMPLATES = 'templates'; |
| 1168 |
const MENU_TEMPLATES_GENERAL = 'templates-general'; |
| 1169 |
const MENU_TEMPLATES_PAGES = 'templates-pages'; |
| 1170 |
const MENU_TEMPLATES_POSTS = 'templates-posts'; |
| 1171 |
const MENU_TEMPLATES_UNUSED = 'templates-unused'; |
| 1172 |
const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers'; |
| 1173 |
const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers'; |
| 1174 |
const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars'; |
| 1175 |
const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general'; |
| 1176 |
const TEMPLATE_PARTS_SUB_MENUS = [{ |
| 1177 |
area: TEMPLATE_PART_AREA_HEADER, |
| 1178 |
menu: MENU_TEMPLATE_PARTS_HEADERS, |
| 1179 |
title: (0,external_wp_i18n_namespaceObject.__)('headers') |
| 1180 |
}, { |
| 1181 |
area: TEMPLATE_PART_AREA_FOOTER, |
| 1182 |
menu: MENU_TEMPLATE_PARTS_FOOTERS, |
| 1183 |
title: (0,external_wp_i18n_namespaceObject.__)('footers') |
| 1184 |
}, { |
| 1185 |
area: TEMPLATE_PART_AREA_SIDEBAR, |
| 1186 |
menu: MENU_TEMPLATE_PARTS_SIDEBARS, |
| 1187 |
title: (0,external_wp_i18n_namespaceObject.__)('sidebars') |
| 1188 |
}, { |
| 1189 |
area: TEMPLATE_PART_AREA_GENERAL, |
| 1190 |
menu: MENU_TEMPLATE_PARTS_GENERAL, |
| 1191 |
title: (0,external_wp_i18n_namespaceObject.__)('general') |
| 1192 |
}]; |
| 1193 |
//# sourceMappingURL=constants.js.map |
| 1194 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/reducer.js |
| 1195 |
/** |
| 1196 |
* WordPress dependencies |
| 1197 |
*/ |
| 1198 |
|
| 1199 |
/** |
| 1200 |
* Internal dependencies |
| 1201 |
*/ |
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
/** |
| 1206 |
* Reducer returning the user preferences. |
| 1207 |
* |
| 1208 |
* @param {Object} state Current state. |
| 1209 |
* @param {Object} action Dispatched action. |
| 1210 |
* @return {Object} Updated state. |
| 1211 |
*/ |
| 1212 |
|
| 1213 |
const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ |
| 1214 |
features() { |
| 1215 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS.features; |
| 1216 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1217 |
|
| 1218 |
switch (action.type) { |
| 1219 |
case 'TOGGLE_FEATURE': |
| 1220 |
{ |
| 1221 |
return { ...state, |
| 1222 |
[action.feature]: !state[action.feature] |
| 1223 |
}; |
| 1224 |
} |
| 1225 |
|
| 1226 |
default: |
| 1227 |
return state; |
| 1228 |
} |
| 1229 |
}, |
| 1230 |
|
| 1231 |
editorMode() { |
| 1232 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS.editorMode; |
| 1233 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1234 |
|
| 1235 |
if (action.type === 'SWITCH_MODE') { |
| 1236 |
return action.mode; |
| 1237 |
} |
| 1238 |
|
| 1239 |
return state; |
| 1240 |
} |
| 1241 |
|
| 1242 |
}); |
| 1243 |
/** |
| 1244 |
* Reducer returning the editing canvas device type. |
| 1245 |
* |
| 1246 |
* @param {Object} state Current state. |
| 1247 |
* @param {Object} action Dispatched action. |
| 1248 |
* |
| 1249 |
* @return {Object} Updated state. |
| 1250 |
*/ |
| 1251 |
|
| 1252 |
function deviceType() { |
| 1253 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop'; |
| 1254 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1255 |
|
| 1256 |
switch (action.type) { |
| 1257 |
case 'SET_PREVIEW_DEVICE_TYPE': |
| 1258 |
return action.deviceType; |
| 1259 |
} |
| 1260 |
|
| 1261 |
return state; |
| 1262 |
} |
| 1263 |
/** |
| 1264 |
* Reducer returning the settings. |
| 1265 |
* |
| 1266 |
* @param {Object} state Current state. |
| 1267 |
* @param {Object} action Dispatched action. |
| 1268 |
* |
| 1269 |
* @return {Object} Updated state. |
| 1270 |
*/ |
| 1271 |
|
| 1272 |
function settings() { |
| 1273 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1274 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1275 |
|
| 1276 |
switch (action.type) { |
| 1277 |
case 'UPDATE_SETTINGS': |
| 1278 |
return { ...state, |
| 1279 |
...action.settings |
| 1280 |
}; |
| 1281 |
} |
| 1282 |
|
| 1283 |
return state; |
| 1284 |
} |
| 1285 |
/** |
| 1286 |
* Reducer keeping track of the currently edited Post Type, |
| 1287 |
* Post Id and the context provided to fill the content of the block editor. |
| 1288 |
* |
| 1289 |
* @param {Object} state Current edited post. |
| 1290 |
* @param {Object} action Dispatched action. |
| 1291 |
* |
| 1292 |
* @return {Object} Updated state. |
| 1293 |
*/ |
| 1294 |
|
| 1295 |
function editedPost() { |
| 1296 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1297 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1298 |
|
| 1299 |
switch (action.type) { |
| 1300 |
case 'SET_TEMPLATE': |
| 1301 |
case 'SET_PAGE': |
| 1302 |
return { |
| 1303 |
type: 'wp_template', |
| 1304 |
id: action.templateId, |
| 1305 |
page: action.page |
| 1306 |
}; |
| 1307 |
|
| 1308 |
case 'SET_TEMPLATE_PART': |
| 1309 |
return { |
| 1310 |
type: 'wp_template_part', |
| 1311 |
id: action.templatePartId |
| 1312 |
}; |
| 1313 |
} |
| 1314 |
|
| 1315 |
return state; |
| 1316 |
} |
| 1317 |
/** |
| 1318 |
* Reducer for information about the site's homepage. |
| 1319 |
* |
| 1320 |
* @param {Object} state Current state. |
| 1321 |
* @param {Object} action Dispatched action. |
| 1322 |
* |
| 1323 |
* @return {Object} Updated state. |
| 1324 |
*/ |
| 1325 |
|
| 1326 |
function homeTemplateId(state, action) { |
| 1327 |
switch (action.type) { |
| 1328 |
case 'SET_HOME_TEMPLATE': |
| 1329 |
return action.homeTemplateId; |
| 1330 |
} |
| 1331 |
|
| 1332 |
return state; |
| 1333 |
} |
| 1334 |
/** |
| 1335 |
* Reducer for information about the navigation panel, such as its active menu |
| 1336 |
* and whether it should be opened or closed. |
| 1337 |
* |
| 1338 |
* Note: this reducer interacts with the inserter and list view panels reducers |
| 1339 |
* to make sure that only one of the three panels is open at the same time. |
| 1340 |
* |
| 1341 |
* @param {Object} state Current state. |
| 1342 |
* @param {Object} action Dispatched action. |
| 1343 |
*/ |
| 1344 |
|
| 1345 |
function navigationPanel() { |
| 1346 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
| 1347 |
menu: MENU_ROOT, |
| 1348 |
isOpen: false |
| 1349 |
}; |
| 1350 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1351 |
|
| 1352 |
switch (action.type) { |
| 1353 |
case 'SET_NAVIGATION_PANEL_ACTIVE_MENU': |
| 1354 |
return { ...state, |
| 1355 |
menu: action.menu |
| 1356 |
}; |
| 1357 |
|
| 1358 |
case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
| 1359 |
return { ...state, |
| 1360 |
isOpen: true, |
| 1361 |
menu: action.menu |
| 1362 |
}; |
| 1363 |
|
| 1364 |
case 'SET_IS_NAVIGATION_PANEL_OPENED': |
| 1365 |
return { ...state, |
| 1366 |
menu: !action.isOpen ? MENU_ROOT : state.menu, |
| 1367 |
// Set menu to root when closing panel. |
| 1368 |
isOpen: action.isOpen |
| 1369 |
}; |
| 1370 |
|
| 1371 |
case 'SET_IS_LIST_VIEW_OPENED': |
| 1372 |
return { ...state, |
| 1373 |
menu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, |
| 1374 |
// Set menu to root when closing panel. |
| 1375 |
isOpen: action.isOpen ? false : state.isOpen |
| 1376 |
}; |
| 1377 |
|
| 1378 |
case 'SET_IS_INSERTER_OPENED': |
| 1379 |
return { ...state, |
| 1380 |
menu: state.isOpen && action.value ? MENU_ROOT : state.menu, |
| 1381 |
// Set menu to root when closing panel. |
| 1382 |
isOpen: action.value ? false : state.isOpen |
| 1383 |
}; |
| 1384 |
} |
| 1385 |
|
| 1386 |
return state; |
| 1387 |
} |
| 1388 |
/** |
| 1389 |
* Reducer to set the block inserter panel open or closed. |
| 1390 |
* |
| 1391 |
* Note: this reducer interacts with the navigation and list view panels reducers |
| 1392 |
* to make sure that only one of the three panels is open at the same time. |
| 1393 |
* |
| 1394 |
* @param {boolean|Object} state Current state. |
| 1395 |
* @param {Object} action Dispatched action. |
| 1396 |
*/ |
| 1397 |
|
| 1398 |
function blockInserterPanel() { |
| 1399 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
| 1400 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1401 |
|
| 1402 |
switch (action.type) { |
| 1403 |
case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
| 1404 |
return false; |
| 1405 |
|
| 1406 |
case 'SET_IS_NAVIGATION_PANEL_OPENED': |
| 1407 |
case 'SET_IS_LIST_VIEW_OPENED': |
| 1408 |
return action.isOpen ? false : state; |
| 1409 |
|
| 1410 |
case 'SET_IS_INSERTER_OPENED': |
| 1411 |
return action.value; |
| 1412 |
} |
| 1413 |
|
| 1414 |
return state; |
| 1415 |
} |
| 1416 |
/** |
| 1417 |
* Reducer to set the list view panel open or closed. |
| 1418 |
* |
| 1419 |
* Note: this reducer interacts with the navigation and inserter panels reducers |
| 1420 |
* to make sure that only one of the three panels is open at the same time. |
| 1421 |
* |
| 1422 |
* @param {Object} state Current state. |
| 1423 |
* @param {Object} action Dispatched action. |
| 1424 |
*/ |
| 1425 |
|
| 1426 |
function listViewPanel() { |
| 1427 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
| 1428 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1429 |
|
| 1430 |
switch (action.type) { |
| 1431 |
case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
| 1432 |
return false; |
| 1433 |
|
| 1434 |
case 'SET_IS_NAVIGATION_PANEL_OPENED': |
| 1435 |
return action.isOpen ? false : state; |
| 1436 |
|
| 1437 |
case 'SET_IS_INSERTER_OPENED': |
| 1438 |
return action.value ? false : state; |
| 1439 |
|
| 1440 |
case 'SET_IS_LIST_VIEW_OPENED': |
| 1441 |
return action.isOpen; |
| 1442 |
} |
| 1443 |
|
| 1444 |
return state; |
| 1445 |
} |
| 1446 |
/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
| 1447 |
preferences, |
| 1448 |
deviceType, |
| 1449 |
settings, |
| 1450 |
editedPost, |
| 1451 |
homeTemplateId, |
| 1452 |
navigationPanel, |
| 1453 |
blockInserterPanel, |
| 1454 |
listViewPanel |
| 1455 |
})); |
| 1456 |
//# sourceMappingURL=reducer.js.map |
| 1457 |
;// CONCATENATED MODULE: external ["wp","notices"] |
| 1458 |
var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
| 1459 |
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
| 1460 |
function extends_extends() { |
| 1461 |
extends_extends = Object.assign || function (target) { |
| 1462 |
for (var i = 1; i < arguments.length; i++) { |
| 1463 |
var source = arguments[i]; |
| 1464 |
|
| 1465 |
for (var key in source) { |
| 1466 |
if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 1467 |
target[key] = source[key]; |
| 1468 |
} |
| 1469 |
} |
| 1470 |
} |
| 1471 |
|
| 1472 |
return target; |
| 1473 |
}; |
| 1474 |
|
| 1475 |
return extends_extends.apply(this, arguments); |
| 1476 |
} |
| 1477 |
// EXTERNAL MODULE: ./node_modules/classnames/index.js |
| 1478 |
var classnames = __webpack_require__(4184); |
| 1479 |
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
| 1480 |
;// CONCATENATED MODULE: external ["wp","components"] |
| 1481 |
var external_wp_components_namespaceObject = window["wp"]["components"]; |
| 1482 |
;// CONCATENATED MODULE: external ["wp","primitives"] |
| 1483 |
var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
| 1484 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js |
| 1485 |
|
| 1486 |
|
| 1487 |
/** |
| 1488 |
* WordPress dependencies |
| 1489 |
*/ |
| 1490 |
|
| 1491 |
const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 1492 |
xmlns: "http://www.w3.org/2000/svg", |
| 1493 |
viewBox: "0 0 24 24" |
| 1494 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 1495 |
d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" |
| 1496 |
})); |
| 1497 |
/* harmony default export */ var library_check = (check); |
| 1498 |
//# sourceMappingURL=check.js.map |
| 1499 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-filled.js |
| 1500 |
|
| 1501 |
|
| 1502 |
/** |
| 1503 |
* WordPress dependencies |
| 1504 |
*/ |
| 1505 |
|
| 1506 |
const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 1507 |
xmlns: "http://www.w3.org/2000/svg", |
| 1508 |
viewBox: "0 0 24 24" |
| 1509 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 1510 |
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" |
| 1511 |
})); |
| 1512 |
/* harmony default export */ var star_filled = (starFilled); |
| 1513 |
//# sourceMappingURL=star-filled.js.map |
| 1514 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-empty.js |
| 1515 |
|
| 1516 |
|
| 1517 |
/** |
| 1518 |
* WordPress dependencies |
| 1519 |
*/ |
| 1520 |
|
| 1521 |
const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 1522 |
xmlns: "http://www.w3.org/2000/svg", |
| 1523 |
viewBox: "0 0 24 24" |
| 1524 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 1525 |
fillRule: "evenodd", |
| 1526 |
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", |
| 1527 |
clipRule: "evenodd" |
| 1528 |
})); |
| 1529 |
/* harmony default export */ var star_empty = (starEmpty); |
| 1530 |
//# sourceMappingURL=star-empty.js.map |
| 1531 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js |
| 1532 |
|
| 1533 |
|
| 1534 |
/** |
| 1535 |
* WordPress dependencies |
| 1536 |
*/ |
| 1537 |
|
| 1538 |
const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 1539 |
xmlns: "http://www.w3.org/2000/svg", |
| 1540 |
viewBox: "0 0 24 24" |
| 1541 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 1542 |
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" |
| 1543 |
})); |
| 1544 |
/* harmony default export */ var close_small = (closeSmall); |
| 1545 |
//# sourceMappingURL=close-small.js.map |
| 1546 |
;// CONCATENATED MODULE: external "lodash" |
| 1547 |
var external_lodash_namespaceObject = window["lodash"]; |
| 1548 |
;// CONCATENATED MODULE: ./packages/interface/build-module/store/reducer.js |
| 1549 |
/** |
| 1550 |
* External dependencies |
| 1551 |
*/ |
| 1552 |
|
| 1553 |
/** |
| 1554 |
* WordPress dependencies |
| 1555 |
*/ |
| 1556 |
|
| 1557 |
|
| 1558 |
/** |
| 1559 |
* Reducer to keep tract of the active area per scope. |
| 1560 |
* |
| 1561 |
* @param {boolean} state Previous state. |
| 1562 |
* @param {Object} action Action object. |
| 1563 |
* @param {string} action.type Action type. |
| 1564 |
* @param {string} action.itemType Type of item. |
| 1565 |
* @param {string} action.scope Item scope. |
| 1566 |
* @param {string} action.item Item name. |
| 1567 |
* |
| 1568 |
* @return {Object} Updated state. |
| 1569 |
*/ |
| 1570 |
|
| 1571 |
function singleEnableItems() { |
| 1572 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1573 |
let { |
| 1574 |
type, |
| 1575 |
itemType, |
| 1576 |
scope, |
| 1577 |
item |
| 1578 |
} = arguments.length > 1 ? arguments[1] : undefined; |
| 1579 |
|
| 1580 |
if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) { |
| 1581 |
return state; |
| 1582 |
} |
| 1583 |
|
| 1584 |
return { ...state, |
| 1585 |
[itemType]: { ...state[itemType], |
| 1586 |
[scope]: item || null |
| 1587 |
} |
| 1588 |
}; |
| 1589 |
} |
| 1590 |
/** |
| 1591 |
* Reducer keeping track of the "pinned" items per scope. |
| 1592 |
* |
| 1593 |
* @param {boolean} state Previous state. |
| 1594 |
* @param {Object} action Action object. |
| 1595 |
* @param {string} action.type Action type. |
| 1596 |
* @param {string} action.itemType Type of item. |
| 1597 |
* @param {string} action.scope Item scope. |
| 1598 |
* @param {string} action.item Item name. |
| 1599 |
* @param {boolean} action.isEnable Whether the item is pinned. |
| 1600 |
* |
| 1601 |
* @return {Object} Updated state. |
| 1602 |
*/ |
| 1603 |
|
| 1604 |
function multipleEnableItems() { |
| 1605 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1606 |
let { |
| 1607 |
type, |
| 1608 |
itemType, |
| 1609 |
scope, |
| 1610 |
item, |
| 1611 |
isEnable |
| 1612 |
} = arguments.length > 1 ? arguments[1] : undefined; |
| 1613 |
|
| 1614 |
if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || (0,external_lodash_namespaceObject.get)(state, [itemType, scope, item]) === isEnable) { |
| 1615 |
return state; |
| 1616 |
} |
| 1617 |
|
| 1618 |
const currentTypeState = state[itemType] || {}; |
| 1619 |
const currentScopeState = currentTypeState[scope] || {}; |
| 1620 |
return { ...state, |
| 1621 |
[itemType]: { ...currentTypeState, |
| 1622 |
[scope]: { ...currentScopeState, |
| 1623 |
[item]: isEnable || false |
| 1624 |
} |
| 1625 |
} |
| 1626 |
}; |
| 1627 |
} |
| 1628 |
/** |
| 1629 |
* Reducer returning the defaults for user preferences. |
| 1630 |
* |
| 1631 |
* This is kept intentionally separate from the preferences |
| 1632 |
* themselves so that defaults are not persisted. |
| 1633 |
* |
| 1634 |
* @param {Object} state Current state. |
| 1635 |
* @param {Object} action Dispatched action. |
| 1636 |
* |
| 1637 |
* @return {Object} Updated state. |
| 1638 |
*/ |
| 1639 |
|
| 1640 |
const preferenceDefaults = (0,external_wp_data_namespaceObject.combineReducers)({ |
| 1641 |
features() { |
| 1642 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1643 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1644 |
|
| 1645 |
if (action.type === 'SET_FEATURE_DEFAULTS') { |
| 1646 |
const { |
| 1647 |
scope, |
| 1648 |
defaults |
| 1649 |
} = action; |
| 1650 |
return { ...state, |
| 1651 |
[scope]: { ...state[scope], |
| 1652 |
...defaults |
| 1653 |
} |
| 1654 |
}; |
| 1655 |
} |
| 1656 |
|
| 1657 |
return state; |
| 1658 |
} |
| 1659 |
|
| 1660 |
}); |
| 1661 |
/** |
| 1662 |
* Reducer returning the user preferences. |
| 1663 |
* |
| 1664 |
* @param {Object} state Current state. |
| 1665 |
* @param {Object} action Dispatched action. |
| 1666 |
* |
| 1667 |
* @return {Object} Updated state. |
| 1668 |
*/ |
| 1669 |
|
| 1670 |
const reducer_preferences = (0,external_wp_data_namespaceObject.combineReducers)({ |
| 1671 |
features() { |
| 1672 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 1673 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
| 1674 |
|
| 1675 |
if (action.type === 'SET_FEATURE_VALUE') { |
| 1676 |
const { |
| 1677 |
scope, |
| 1678 |
featureName, |
| 1679 |
value |
| 1680 |
} = action; |
| 1681 |
return { ...state, |
| 1682 |
[scope]: { ...state[scope], |
| 1683 |
[featureName]: value |
| 1684 |
} |
| 1685 |
}; |
| 1686 |
} |
| 1687 |
|
| 1688 |
return state; |
| 1689 |
} |
| 1690 |
|
| 1691 |
}); |
| 1692 |
const enableItems = (0,external_wp_data_namespaceObject.combineReducers)({ |
| 1693 |
singleEnableItems, |
| 1694 |
multipleEnableItems |
| 1695 |
}); |
| 1696 |
/* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
| 1697 |
enableItems, |
| 1698 |
preferenceDefaults, |
| 1699 |
preferences: reducer_preferences |
| 1700 |
})); |
| 1701 |
//# sourceMappingURL=reducer.js.map |
| 1702 |
;// CONCATENATED MODULE: ./packages/interface/build-module/store/actions.js |
| 1703 |
/** |
| 1704 |
* Returns an action object used in signalling that an active area should be changed. |
| 1705 |
* |
| 1706 |
* @param {string} itemType Type of item. |
| 1707 |
* @param {string} scope Item scope. |
| 1708 |
* @param {string} item Item identifier. |
| 1709 |
* |
| 1710 |
* @return {Object} Action object. |
| 1711 |
*/ |
| 1712 |
function setSingleEnableItem(itemType, scope, item) { |
| 1713 |
return { |
| 1714 |
type: 'SET_SINGLE_ENABLE_ITEM', |
| 1715 |
itemType, |
| 1716 |
scope, |
| 1717 |
item |
| 1718 |
}; |
| 1719 |
} |
| 1720 |
/** |
| 1721 |
* Returns an action object used in signalling that a complementary item should be enabled. |
| 1722 |
* |
| 1723 |
* @param {string} scope Complementary area scope. |
| 1724 |
* @param {string} area Area identifier. |
| 1725 |
* |
| 1726 |
* @return {Object} Action object. |
| 1727 |
*/ |
| 1728 |
|
| 1729 |
|
| 1730 |
function enableComplementaryArea(scope, area) { |
| 1731 |
return setSingleEnableItem('complementaryArea', scope, area); |
| 1732 |
} |
| 1733 |
/** |
| 1734 |
* Returns an action object used in signalling that the complementary area of a given scope should be disabled. |
| 1735 |
* |
| 1736 |
* @param {string} scope Complementary area scope. |
| 1737 |
* |
| 1738 |
* @return {Object} Action object. |
| 1739 |
*/ |
| 1740 |
|
| 1741 |
function disableComplementaryArea(scope) { |
| 1742 |
return setSingleEnableItem('complementaryArea', scope, undefined); |
| 1743 |
} |
| 1744 |
/** |
| 1745 |
* Returns an action object to make an area enabled/disabled. |
| 1746 |
* |
| 1747 |
* @param {string} itemType Type of item. |
| 1748 |
* @param {string} scope Item scope. |
| 1749 |
* @param {string} item Item identifier. |
| 1750 |
* @param {boolean} isEnable Boolean indicating if an area should be pinned or not. |
| 1751 |
* |
| 1752 |
* @return {Object} Action object. |
| 1753 |
*/ |
| 1754 |
|
| 1755 |
function setMultipleEnableItem(itemType, scope, item, isEnable) { |
| 1756 |
return { |
| 1757 |
type: 'SET_MULTIPLE_ENABLE_ITEM', |
| 1758 |
itemType, |
| 1759 |
scope, |
| 1760 |
item, |
| 1761 |
isEnable |
| 1762 |
}; |
| 1763 |
} |
| 1764 |
/** |
| 1765 |
* Returns an action object used in signalling that an item should be pinned. |
| 1766 |
* |
| 1767 |
* @param {string} scope Item scope. |
| 1768 |
* @param {string} itemId Item identifier. |
| 1769 |
* |
| 1770 |
* @return {Object} Action object. |
| 1771 |
*/ |
| 1772 |
|
| 1773 |
|
| 1774 |
function pinItem(scope, itemId) { |
| 1775 |
return setMultipleEnableItem('pinnedItems', scope, itemId, true); |
| 1776 |
} |
| 1777 |
/** |
| 1778 |
* Returns an action object used in signalling that an item should be unpinned. |
| 1779 |
* |
| 1780 |
* @param {string} scope Item scope. |
| 1781 |
* @param {string} itemId Item identifier. |
| 1782 |
* |
| 1783 |
* @return {Object} Action object. |
| 1784 |
*/ |
| 1785 |
|
| 1786 |
function unpinItem(scope, itemId) { |
| 1787 |
return setMultipleEnableItem('pinnedItems', scope, itemId, false); |
| 1788 |
} |
| 1789 |
/** |
| 1790 |
* Returns an action object used in signalling that a feature should be toggled. |
| 1791 |
* |
| 1792 |
* @param {string} scope The feature scope (e.g. core/edit-post). |
| 1793 |
* @param {string} featureName The feature name. |
| 1794 |
*/ |
| 1795 |
|
| 1796 |
function toggleFeature(scope, featureName) { |
| 1797 |
return function (_ref) { |
| 1798 |
let { |
| 1799 |
select, |
| 1800 |
dispatch |
| 1801 |
} = _ref; |
| 1802 |
const currentValue = select.isFeatureActive(scope, featureName); |
| 1803 |
dispatch.setFeatureValue(scope, featureName, !currentValue); |
| 1804 |
}; |
| 1805 |
} |
| 1806 |
/** |
| 1807 |
* Returns an action object used in signalling that a feature should be set to |
| 1808 |
* a true or false value |
| 1809 |
* |
| 1810 |
* @param {string} scope The feature scope (e.g. core/edit-post). |
| 1811 |
* @param {string} featureName The feature name. |
| 1812 |
* @param {boolean} value The value to set. |
| 1813 |
* |
| 1814 |
* @return {Object} Action object. |
| 1815 |
*/ |
| 1816 |
|
| 1817 |
function setFeatureValue(scope, featureName, value) { |
| 1818 |
return { |
| 1819 |
type: 'SET_FEATURE_VALUE', |
| 1820 |
scope, |
| 1821 |
featureName, |
| 1822 |
value: !!value |
| 1823 |
}; |
| 1824 |
} |
| 1825 |
/** |
| 1826 |
* Returns an action object used in signalling that defaults should be set for features. |
| 1827 |
* |
| 1828 |
* @param {string} scope The feature scope (e.g. core/edit-post). |
| 1829 |
* @param {Object<string, boolean>} defaults A key/value map of feature names to values. |
| 1830 |
* |
| 1831 |
* @return {Object} Action object. |
| 1832 |
*/ |
| 1833 |
|
| 1834 |
function setFeatureDefaults(scope, defaults) { |
| 1835 |
return { |
| 1836 |
type: 'SET_FEATURE_DEFAULTS', |
| 1837 |
scope, |
| 1838 |
defaults |
| 1839 |
}; |
| 1840 |
} |
| 1841 |
//# sourceMappingURL=actions.js.map |
| 1842 |
;// CONCATENATED MODULE: ./packages/interface/build-module/store/selectors.js |
| 1843 |
/** |
| 1844 |
* External dependencies |
| 1845 |
*/ |
| 1846 |
|
| 1847 |
/** |
| 1848 |
* Returns the item that is enabled in a given scope. |
| 1849 |
* |
| 1850 |
* @param {Object} state Global application state. |
| 1851 |
* @param {string} itemType Type of item. |
| 1852 |
* @param {string} scope Item scope. |
| 1853 |
* |
| 1854 |
* @return {?string|null} The item that is enabled in the passed scope and type. |
| 1855 |
*/ |
| 1856 |
|
| 1857 |
function getSingleEnableItem(state, itemType, scope) { |
| 1858 |
return (0,external_lodash_namespaceObject.get)(state.enableItems.singleEnableItems, [itemType, scope]); |
| 1859 |
} |
| 1860 |
/** |
| 1861 |
* Returns the complementary area that is active in a given scope. |
| 1862 |
* |
| 1863 |
* @param {Object} state Global application state. |
| 1864 |
* @param {string} scope Item scope. |
| 1865 |
* |
| 1866 |
* @return {string} The complementary area that is active in the given scope. |
| 1867 |
*/ |
| 1868 |
|
| 1869 |
|
| 1870 |
function getActiveComplementaryArea(state, scope) { |
| 1871 |
return getSingleEnableItem(state, 'complementaryArea', scope); |
| 1872 |
} |
| 1873 |
/** |
| 1874 |
* Returns a boolean indicating if an item is enabled or not in a given scope. |
| 1875 |
* |
| 1876 |
* @param {Object} state Global application state. |
| 1877 |
* @param {string} itemType Type of item. |
| 1878 |
* @param {string} scope Scope. |
| 1879 |
* @param {string} item Item to check. |
| 1880 |
* |
| 1881 |
* @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item. |
| 1882 |
*/ |
| 1883 |
|
| 1884 |
function isMultipleEnabledItemEnabled(state, itemType, scope, item) { |
| 1885 |
return (0,external_lodash_namespaceObject.get)(state.enableItems.multipleEnableItems, [itemType, scope, item]); |
| 1886 |
} |
| 1887 |
/** |
| 1888 |
* Returns a boolean indicating if an item is pinned or not. |
| 1889 |
* |
| 1890 |
* @param {Object} state Global application state. |
| 1891 |
* @param {string} scope Scope. |
| 1892 |
* @param {string} item Item to check. |
| 1893 |
* |
| 1894 |
* @return {boolean} True if the item is pinned and false otherwise. |
| 1895 |
*/ |
| 1896 |
|
| 1897 |
|
| 1898 |
function isItemPinned(state, scope, item) { |
| 1899 |
return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false; |
| 1900 |
} |
| 1901 |
/** |
| 1902 |
* Returns a boolean indicating whether a feature is active for a particular |
| 1903 |
* scope. |
| 1904 |
* |
| 1905 |
* @param {Object} state The store state. |
| 1906 |
* @param {string} scope The scope of the feature (e.g. core/edit-post). |
| 1907 |
* @param {string} featureName The name of the feature. |
| 1908 |
* |
| 1909 |
* @return {boolean} Is the feature enabled? |
| 1910 |
*/ |
| 1911 |
|
| 1912 |
function isFeatureActive(state, scope, featureName) { |
| 1913 |
var _state$preferences$fe, _state$preferenceDefa; |
| 1914 |
|
| 1915 |
const featureValue = (_state$preferences$fe = state.preferences.features[scope]) === null || _state$preferences$fe === void 0 ? void 0 : _state$preferences$fe[featureName]; |
| 1916 |
const defaultedFeatureValue = featureValue !== undefined ? featureValue : (_state$preferenceDefa = state.preferenceDefaults.features[scope]) === null || _state$preferenceDefa === void 0 ? void 0 : _state$preferenceDefa[featureName]; |
| 1917 |
return !!defaultedFeatureValue; |
| 1918 |
} |
| 1919 |
//# sourceMappingURL=selectors.js.map |
| 1920 |
;// CONCATENATED MODULE: ./packages/interface/build-module/store/constants.js |
| 1921 |
/** |
| 1922 |
* The identifier for the data store. |
| 1923 |
* |
| 1924 |
* @type {string} |
| 1925 |
*/ |
| 1926 |
const constants_STORE_NAME = 'core/interface'; |
| 1927 |
//# sourceMappingURL=constants.js.map |
| 1928 |
;// CONCATENATED MODULE: ./packages/interface/build-module/store/index.js |
| 1929 |
/** |
| 1930 |
* WordPress dependencies |
| 1931 |
*/ |
| 1932 |
|
| 1933 |
/** |
| 1934 |
* Internal dependencies |
| 1935 |
*/ |
| 1936 |
|
| 1937 |
|
| 1938 |
|
| 1939 |
|
| 1940 |
|
| 1941 |
/** |
| 1942 |
* Store definition for the interface namespace. |
| 1943 |
* |
| 1944 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
| 1945 |
* |
| 1946 |
* @type {Object} |
| 1947 |
*/ |
| 1948 |
|
| 1949 |
const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { |
| 1950 |
reducer: store_reducer, |
| 1951 |
actions: actions_namespaceObject, |
| 1952 |
selectors: selectors_namespaceObject, |
| 1953 |
persist: ['enableItems', 'preferences'], |
| 1954 |
__experimentalUseThunks: true |
| 1955 |
}); // Once we build a more generic persistence plugin that works across types of stores |
| 1956 |
// we'd be able to replace this with a register call. |
| 1957 |
|
| 1958 |
(0,external_wp_data_namespaceObject.registerStore)(constants_STORE_NAME, { |
| 1959 |
reducer: store_reducer, |
| 1960 |
actions: actions_namespaceObject, |
| 1961 |
selectors: selectors_namespaceObject, |
| 1962 |
persist: ['enableItems', 'preferences'], |
| 1963 |
__experimentalUseThunks: true |
| 1964 |
}); |
| 1965 |
//# sourceMappingURL=index.js.map |
| 1966 |
;// CONCATENATED MODULE: external ["wp","plugins"] |
| 1967 |
var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
| 1968 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-context/index.js |
| 1969 |
/** |
| 1970 |
* WordPress dependencies |
| 1971 |
*/ |
| 1972 |
|
| 1973 |
/* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
| 1974 |
return { |
| 1975 |
icon: ownProps.icon || context.icon, |
| 1976 |
identifier: ownProps.identifier || `${context.name}/${ownProps.name}` |
| 1977 |
}; |
| 1978 |
})); |
| 1979 |
//# sourceMappingURL=index.js.map |
| 1980 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-toggle/index.js |
| 1981 |
|
| 1982 |
|
| 1983 |
|
| 1984 |
/** |
| 1985 |
* External dependencies |
| 1986 |
*/ |
| 1987 |
|
| 1988 |
/** |
| 1989 |
* WordPress dependencies |
| 1990 |
*/ |
| 1991 |
|
| 1992 |
|
| 1993 |
|
| 1994 |
/** |
| 1995 |
* Internal dependencies |
| 1996 |
*/ |
| 1997 |
|
| 1998 |
|
| 1999 |
|
| 2000 |
|
| 2001 |
function ComplementaryAreaToggle(_ref) { |
| 2002 |
let { |
| 2003 |
as = external_wp_components_namespaceObject.Button, |
| 2004 |
scope, |
| 2005 |
identifier, |
| 2006 |
icon, |
| 2007 |
selectedIcon, |
| 2008 |
...props |
| 2009 |
} = _ref; |
| 2010 |
const ComponentToUse = as; |
| 2011 |
const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); |
| 2012 |
const { |
| 2013 |
enableComplementaryArea, |
| 2014 |
disableComplementaryArea |
| 2015 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 2016 |
return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, extends_extends({ |
| 2017 |
icon: selectedIcon && isSelected ? selectedIcon : icon, |
| 2018 |
onClick: () => { |
| 2019 |
if (isSelected) { |
| 2020 |
disableComplementaryArea(scope); |
| 2021 |
} else { |
| 2022 |
enableComplementaryArea(scope, identifier); |
| 2023 |
} |
| 2024 |
} |
| 2025 |
}, (0,external_lodash_namespaceObject.omit)(props, ['name']))); |
| 2026 |
} |
| 2027 |
|
| 2028 |
/* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); |
| 2029 |
//# sourceMappingURL=index.js.map |
| 2030 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-header/index.js |
| 2031 |
|
| 2032 |
|
| 2033 |
|
| 2034 |
/** |
| 2035 |
* External dependencies |
| 2036 |
*/ |
| 2037 |
|
| 2038 |
/** |
| 2039 |
* WordPress dependencies |
| 2040 |
*/ |
| 2041 |
|
| 2042 |
|
| 2043 |
/** |
| 2044 |
* Internal dependencies |
| 2045 |
*/ |
| 2046 |
|
| 2047 |
|
| 2048 |
|
| 2049 |
const ComplementaryAreaHeader = _ref => { |
| 2050 |
let { |
| 2051 |
smallScreenTitle, |
| 2052 |
children, |
| 2053 |
className, |
| 2054 |
toggleButtonProps |
| 2055 |
} = _ref; |
| 2056 |
const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ |
| 2057 |
icon: close_small |
| 2058 |
}, toggleButtonProps)); |
| 2059 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2060 |
className: "components-panel__header interface-complementary-area-header__small" |
| 2061 |
}, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { |
| 2062 |
className: "interface-complementary-area-header__small-title" |
| 2063 |
}, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2064 |
className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), |
| 2065 |
tabIndex: -1 |
| 2066 |
}, children, toggleButton)); |
| 2067 |
}; |
| 2068 |
|
| 2069 |
/* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); |
| 2070 |
//# sourceMappingURL=index.js.map |
| 2071 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/action-item/index.js |
| 2072 |
|
| 2073 |
|
| 2074 |
|
| 2075 |
/** |
| 2076 |
* External dependencies |
| 2077 |
*/ |
| 2078 |
|
| 2079 |
/** |
| 2080 |
* WordPress dependencies |
| 2081 |
*/ |
| 2082 |
|
| 2083 |
|
| 2084 |
|
| 2085 |
|
| 2086 |
function ActionItemSlot(_ref) { |
| 2087 |
let { |
| 2088 |
name, |
| 2089 |
as: Component = external_wp_components_namespaceObject.ButtonGroup, |
| 2090 |
fillProps = {}, |
| 2091 |
bubblesVirtually, |
| 2092 |
...props |
| 2093 |
} = _ref; |
| 2094 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { |
| 2095 |
name: name, |
| 2096 |
bubblesVirtually: bubblesVirtually, |
| 2097 |
fillProps: fillProps |
| 2098 |
}, fills => { |
| 2099 |
if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) { |
| 2100 |
return null; |
| 2101 |
} // Special handling exists for backward compatibility. |
| 2102 |
// It ensures that menu items created by plugin authors aren't |
| 2103 |
// duplicated with automatically injected menu items coming |
| 2104 |
// from pinnable plugin sidebars. |
| 2105 |
// @see https://github.com/WordPress/gutenberg/issues/14457 |
| 2106 |
|
| 2107 |
|
| 2108 |
const initializedByPlugins = []; |
| 2109 |
external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => { |
| 2110 |
let { |
| 2111 |
props: { |
| 2112 |
__unstableExplicitMenuItem, |
| 2113 |
__unstableTarget |
| 2114 |
} |
| 2115 |
} = _ref2; |
| 2116 |
|
| 2117 |
if (__unstableTarget && __unstableExplicitMenuItem) { |
| 2118 |
initializedByPlugins.push(__unstableTarget); |
| 2119 |
} |
| 2120 |
}); |
| 2121 |
const children = external_wp_element_namespaceObject.Children.map(fills, child => { |
| 2122 |
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { |
| 2123 |
return null; |
| 2124 |
} |
| 2125 |
|
| 2126 |
return child; |
| 2127 |
}); |
| 2128 |
return (0,external_wp_element_namespaceObject.createElement)(Component, props, children); |
| 2129 |
}); |
| 2130 |
} |
| 2131 |
|
| 2132 |
function ActionItem(_ref3) { |
| 2133 |
let { |
| 2134 |
name, |
| 2135 |
as: Component = external_wp_components_namespaceObject.Button, |
| 2136 |
onClick, |
| 2137 |
...props |
| 2138 |
} = _ref3; |
| 2139 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
| 2140 |
name: name |
| 2141 |
}, _ref4 => { |
| 2142 |
let { |
| 2143 |
onClick: fpOnClick |
| 2144 |
} = _ref4; |
| 2145 |
return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({ |
| 2146 |
onClick: onClick || fpOnClick ? function () { |
| 2147 |
(onClick || external_lodash_namespaceObject.noop)(...arguments); |
| 2148 |
(fpOnClick || external_lodash_namespaceObject.noop)(...arguments); |
| 2149 |
} : undefined |
| 2150 |
}, props)); |
| 2151 |
}); |
| 2152 |
} |
| 2153 |
|
| 2154 |
ActionItem.Slot = ActionItemSlot; |
| 2155 |
/* harmony default export */ var action_item = (ActionItem); |
| 2156 |
//# sourceMappingURL=index.js.map |
| 2157 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-more-menu-item/index.js |
| 2158 |
|
| 2159 |
|
| 2160 |
|
| 2161 |
/** |
| 2162 |
* External dependencies |
| 2163 |
*/ |
| 2164 |
|
| 2165 |
/** |
| 2166 |
* WordPress dependencies |
| 2167 |
*/ |
| 2168 |
|
| 2169 |
|
| 2170 |
|
| 2171 |
/** |
| 2172 |
* Internal dependencies |
| 2173 |
*/ |
| 2174 |
|
| 2175 |
|
| 2176 |
|
| 2177 |
|
| 2178 |
const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. |
| 2179 |
// They are removed so they don't leak to DOM elements. |
| 2180 |
// @see https://github.com/WordPress/gutenberg/issues/14457 |
| 2181 |
(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); |
| 2182 |
|
| 2183 |
function ComplementaryAreaMoreMenuItem(_ref) { |
| 2184 |
let { |
| 2185 |
scope, |
| 2186 |
target, |
| 2187 |
__unstableExplicitMenuItem, |
| 2188 |
...props |
| 2189 |
} = _ref; |
| 2190 |
return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ |
| 2191 |
as: toggleProps => { |
| 2192 |
return (0,external_wp_element_namespaceObject.createElement)(action_item, extends_extends({ |
| 2193 |
__unstableExplicitMenuItem: __unstableExplicitMenuItem, |
| 2194 |
__unstableTarget: `${scope}/${target}`, |
| 2195 |
as: PluginsMenuItem, |
| 2196 |
name: `${scope}/plugin-more-menu` |
| 2197 |
}, toggleProps)); |
| 2198 |
}, |
| 2199 |
role: "menuitemcheckbox", |
| 2200 |
selectedIcon: library_check, |
| 2201 |
name: target, |
| 2202 |
scope: scope |
| 2203 |
}, props)); |
| 2204 |
} |
| 2205 |
//# sourceMappingURL=index.js.map |
| 2206 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/pinned-items/index.js |
| 2207 |
|
| 2208 |
|
| 2209 |
|
| 2210 |
/** |
| 2211 |
* External dependencies |
| 2212 |
*/ |
| 2213 |
|
| 2214 |
|
| 2215 |
/** |
| 2216 |
* WordPress dependencies |
| 2217 |
*/ |
| 2218 |
|
| 2219 |
|
| 2220 |
|
| 2221 |
function PinnedItems(_ref) { |
| 2222 |
let { |
| 2223 |
scope, |
| 2224 |
...props |
| 2225 |
} = _ref; |
| 2226 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, extends_extends({ |
| 2227 |
name: `PinnedItems/${scope}` |
| 2228 |
}, props)); |
| 2229 |
} |
| 2230 |
|
| 2231 |
function PinnedItemsSlot(_ref2) { |
| 2232 |
let { |
| 2233 |
scope, |
| 2234 |
className, |
| 2235 |
...props |
| 2236 |
} = _ref2; |
| 2237 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ |
| 2238 |
name: `PinnedItems/${scope}` |
| 2239 |
}, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2240 |
className: classnames_default()(className, 'interface-pinned-items') |
| 2241 |
}, fills)); |
| 2242 |
} |
| 2243 |
|
| 2244 |
PinnedItems.Slot = PinnedItemsSlot; |
| 2245 |
/* harmony default export */ var pinned_items = (PinnedItems); |
| 2246 |
//# sourceMappingURL=index.js.map |
| 2247 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area/index.js |
| 2248 |
|
| 2249 |
|
| 2250 |
|
| 2251 |
/** |
| 2252 |
* External dependencies |
| 2253 |
*/ |
| 2254 |
|
| 2255 |
/** |
| 2256 |
* WordPress dependencies |
| 2257 |
*/ |
| 2258 |
|
| 2259 |
|
| 2260 |
|
| 2261 |
|
| 2262 |
|
| 2263 |
|
| 2264 |
|
| 2265 |
/** |
| 2266 |
* Internal dependencies |
| 2267 |
*/ |
| 2268 |
|
| 2269 |
|
| 2270 |
|
| 2271 |
|
| 2272 |
|
| 2273 |
|
| 2274 |
|
| 2275 |
|
| 2276 |
function ComplementaryAreaSlot(_ref) { |
| 2277 |
let { |
| 2278 |
scope, |
| 2279 |
...props |
| 2280 |
} = _ref; |
| 2281 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ |
| 2282 |
name: `ComplementaryArea/${scope}` |
| 2283 |
}, props)); |
| 2284 |
} |
| 2285 |
|
| 2286 |
function ComplementaryAreaFill(_ref2) { |
| 2287 |
let { |
| 2288 |
scope, |
| 2289 |
children, |
| 2290 |
className |
| 2291 |
} = _ref2; |
| 2292 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
| 2293 |
name: `ComplementaryArea/${scope}` |
| 2294 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2295 |
className: className |
| 2296 |
}, children)); |
| 2297 |
} |
| 2298 |
|
| 2299 |
function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { |
| 2300 |
const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
| 2301 |
const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
| 2302 |
const { |
| 2303 |
enableComplementaryArea, |
| 2304 |
disableComplementaryArea |
| 2305 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 2306 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 2307 |
// If the complementary area is active and the editor is switching from a big to a small window size. |
| 2308 |
if (isActive && isSmall && !previousIsSmall.current) { |
| 2309 |
// Disable the complementary area. |
| 2310 |
disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. |
| 2311 |
|
| 2312 |
shouldOpenWhenNotSmall.current = true; |
| 2313 |
} else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size |
| 2314 |
// and we are going from a small to big window size. |
| 2315 |
shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { |
| 2316 |
// Remove the flag indicating the complementary area should be enabled. |
| 2317 |
shouldOpenWhenNotSmall.current = false; // Enable the complementary area. |
| 2318 |
|
| 2319 |
enableComplementaryArea(scope, identifier); |
| 2320 |
} else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, |
| 2321 |
// remove the flag. |
| 2322 |
shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { |
| 2323 |
shouldOpenWhenNotSmall.current = false; |
| 2324 |
} |
| 2325 |
|
| 2326 |
if (isSmall !== previousIsSmall.current) { |
| 2327 |
previousIsSmall.current = isSmall; |
| 2328 |
} |
| 2329 |
}, [isActive, isSmall, scope, identifier, activeArea]); |
| 2330 |
} |
| 2331 |
|
| 2332 |
function ComplementaryArea(_ref3) { |
| 2333 |
let { |
| 2334 |
children, |
| 2335 |
className, |
| 2336 |
closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), |
| 2337 |
identifier, |
| 2338 |
header, |
| 2339 |
headerClassName, |
| 2340 |
icon, |
| 2341 |
isPinnable = true, |
| 2342 |
panelClassName, |
| 2343 |
scope, |
| 2344 |
name, |
| 2345 |
smallScreenTitle, |
| 2346 |
title, |
| 2347 |
toggleShortcut, |
| 2348 |
isActiveByDefault, |
| 2349 |
showIconLabels = false |
| 2350 |
} = _ref3; |
| 2351 |
const { |
| 2352 |
isActive, |
| 2353 |
isPinned, |
| 2354 |
activeArea, |
| 2355 |
isSmall, |
| 2356 |
isLarge |
| 2357 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 2358 |
const { |
| 2359 |
getActiveComplementaryArea, |
| 2360 |
isItemPinned |
| 2361 |
} = select(store); |
| 2362 |
|
| 2363 |
const _activeArea = getActiveComplementaryArea(scope); |
| 2364 |
|
| 2365 |
return { |
| 2366 |
isActive: _activeArea === identifier, |
| 2367 |
isPinned: isItemPinned(scope, identifier), |
| 2368 |
activeArea: _activeArea, |
| 2369 |
isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), |
| 2370 |
isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') |
| 2371 |
}; |
| 2372 |
}, [identifier, scope]); |
| 2373 |
useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); |
| 2374 |
const { |
| 2375 |
enableComplementaryArea, |
| 2376 |
disableComplementaryArea, |
| 2377 |
pinItem, |
| 2378 |
unpinItem |
| 2379 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 2380 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 2381 |
if (isActiveByDefault && activeArea === undefined && !isSmall) { |
| 2382 |
enableComplementaryArea(scope, identifier); |
| 2383 |
} |
| 2384 |
}, [activeArea, isActiveByDefault, scope, identifier, isSmall]); |
| 2385 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { |
| 2386 |
scope: scope |
| 2387 |
}, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { |
| 2388 |
scope: scope, |
| 2389 |
identifier: identifier, |
| 2390 |
isPressed: isActive && (!showIconLabels || isLarge), |
| 2391 |
"aria-expanded": isActive, |
| 2392 |
label: title, |
| 2393 |
icon: showIconLabels ? library_check : icon, |
| 2394 |
showTooltip: !showIconLabels, |
| 2395 |
variant: showIconLabels ? 'tertiary' : undefined |
| 2396 |
})), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { |
| 2397 |
target: name, |
| 2398 |
scope: scope, |
| 2399 |
icon: icon |
| 2400 |
}, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { |
| 2401 |
className: classnames_default()('interface-complementary-area', className), |
| 2402 |
scope: scope |
| 2403 |
}, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { |
| 2404 |
className: headerClassName, |
| 2405 |
closeLabel: closeLabel, |
| 2406 |
onClose: () => disableComplementaryArea(scope), |
| 2407 |
smallScreenTitle: smallScreenTitle, |
| 2408 |
toggleButtonProps: { |
| 2409 |
label: closeLabel, |
| 2410 |
shortcut: toggleShortcut, |
| 2411 |
scope, |
| 2412 |
identifier |
| 2413 |
} |
| 2414 |
}, 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, { |
| 2415 |
className: "interface-complementary-area__pin-unpin-item", |
| 2416 |
icon: isPinned ? star_filled : star_empty, |
| 2417 |
label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), |
| 2418 |
onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), |
| 2419 |
isPressed: isPinned, |
| 2420 |
"aria-expanded": isPinned |
| 2421 |
}))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { |
| 2422 |
className: panelClassName |
| 2423 |
}, children))); |
| 2424 |
} |
| 2425 |
|
| 2426 |
const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); |
| 2427 |
ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; |
| 2428 |
/* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); |
| 2429 |
//# sourceMappingURL=index.js.map |
| 2430 |
;// CONCATENATED MODULE: external ["wp","compose"] |
| 2431 |
var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
| 2432 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/interface-skeleton/index.js |
| 2433 |
|
| 2434 |
|
| 2435 |
|
| 2436 |
/** |
| 2437 |
* External dependencies |
| 2438 |
*/ |
| 2439 |
|
| 2440 |
/** |
| 2441 |
* WordPress dependencies |
| 2442 |
*/ |
| 2443 |
|
| 2444 |
/** |
| 2445 |
* WordPress dependencies |
| 2446 |
*/ |
| 2447 |
|
| 2448 |
|
| 2449 |
|
| 2450 |
|
| 2451 |
|
| 2452 |
|
| 2453 |
function useHTMLClass(className) { |
| 2454 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 2455 |
const element = document && document.querySelector(`html:not(.${className})`); |
| 2456 |
|
| 2457 |
if (!element) { |
| 2458 |
return; |
| 2459 |
} |
| 2460 |
|
| 2461 |
element.classList.toggle(className); |
| 2462 |
return () => { |
| 2463 |
element.classList.toggle(className); |
| 2464 |
}; |
| 2465 |
}, [className]); |
| 2466 |
} |
| 2467 |
|
| 2468 |
function InterfaceSkeleton(_ref, ref) { |
| 2469 |
let { |
| 2470 |
footer, |
| 2471 |
header, |
| 2472 |
sidebar, |
| 2473 |
secondarySidebar, |
| 2474 |
notices, |
| 2475 |
content, |
| 2476 |
drawer, |
| 2477 |
actions, |
| 2478 |
labels, |
| 2479 |
className, |
| 2480 |
shortcuts |
| 2481 |
} = _ref; |
| 2482 |
const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); |
| 2483 |
useHTMLClass('interface-interface-skeleton__html-container'); |
| 2484 |
const defaultLabels = { |
| 2485 |
/* translators: accessibility text for the nav bar landmark region. */ |
| 2486 |
drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'), |
| 2487 |
|
| 2488 |
/* translators: accessibility text for the top bar landmark region. */ |
| 2489 |
header: (0,external_wp_i18n_namespaceObject.__)('Header'), |
| 2490 |
|
| 2491 |
/* translators: accessibility text for the content landmark region. */ |
| 2492 |
body: (0,external_wp_i18n_namespaceObject.__)('Content'), |
| 2493 |
|
| 2494 |
/* translators: accessibility text for the secondary sidebar landmark region. */ |
| 2495 |
secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), |
| 2496 |
|
| 2497 |
/* translators: accessibility text for the settings landmark region. */ |
| 2498 |
sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
| 2499 |
|
| 2500 |
/* translators: accessibility text for the publish landmark region. */ |
| 2501 |
actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), |
| 2502 |
|
| 2503 |
/* translators: accessibility text for the footer landmark region. */ |
| 2504 |
footer: (0,external_wp_i18n_namespaceObject.__)('Footer') |
| 2505 |
}; |
| 2506 |
const mergedLabels = { ...defaultLabels, |
| 2507 |
...labels |
| 2508 |
}; |
| 2509 |
return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, navigateRegionsProps, { |
| 2510 |
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]), |
| 2511 |
className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') |
| 2512 |
}), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2513 |
className: "interface-interface-skeleton__drawer", |
| 2514 |
role: "region", |
| 2515 |
"aria-label": mergedLabels.drawer, |
| 2516 |
tabIndex: "-1" |
| 2517 |
}, drawer), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2518 |
className: "interface-interface-skeleton__editor" |
| 2519 |
}, !!header && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2520 |
className: "interface-interface-skeleton__header", |
| 2521 |
role: "region", |
| 2522 |
"aria-label": mergedLabels.header, |
| 2523 |
tabIndex: "-1" |
| 2524 |
}, header), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2525 |
className: "interface-interface-skeleton__body" |
| 2526 |
}, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2527 |
className: "interface-interface-skeleton__secondary-sidebar", |
| 2528 |
role: "region", |
| 2529 |
"aria-label": mergedLabels.secondarySidebar, |
| 2530 |
tabIndex: "-1" |
| 2531 |
}, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2532 |
className: "interface-interface-skeleton__notices" |
| 2533 |
}, notices), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2534 |
className: "interface-interface-skeleton__content", |
| 2535 |
role: "region", |
| 2536 |
"aria-label": mergedLabels.body, |
| 2537 |
tabIndex: "-1" |
| 2538 |
}, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2539 |
className: "interface-interface-skeleton__sidebar", |
| 2540 |
role: "region", |
| 2541 |
"aria-label": mergedLabels.sidebar, |
| 2542 |
tabIndex: "-1" |
| 2543 |
}, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2544 |
className: "interface-interface-skeleton__actions", |
| 2545 |
role: "region", |
| 2546 |
"aria-label": mergedLabels.actions, |
| 2547 |
tabIndex: "-1" |
| 2548 |
}, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 2549 |
className: "interface-interface-skeleton__footer", |
| 2550 |
role: "region", |
| 2551 |
"aria-label": mergedLabels.footer, |
| 2552 |
tabIndex: "-1" |
| 2553 |
}, footer)); |
| 2554 |
} |
| 2555 |
|
| 2556 |
/* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); |
| 2557 |
//# sourceMappingURL=index.js.map |
| 2558 |
;// CONCATENATED MODULE: ./packages/interface/build-module/components/index.js |
| 2559 |
|
| 2560 |
|
| 2561 |
|
| 2562 |
|
| 2563 |
|
| 2564 |
|
| 2565 |
|
| 2566 |
|
| 2567 |
//# sourceMappingURL=index.js.map |
| 2568 |
;// CONCATENATED MODULE: ./packages/interface/build-module/index.js |
| 2569 |
|
| 2570 |
|
| 2571 |
//# sourceMappingURL=index.js.map |
| 2572 |
;// CONCATENATED MODULE: external ["wp","blockEditor"] |
| 2573 |
var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
| 2574 |
;// CONCATENATED MODULE: external ["wp","a11y"] |
| 2575 |
var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
| 2576 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/utils/is-template-revertable.js |
| 2577 |
/** |
| 2578 |
* Check if a template is revertable to its original theme-provided template file. |
| 2579 |
* |
| 2580 |
* @param {Object} template The template entity to check. |
| 2581 |
* @return {boolean} Whether the template is revertable. |
| 2582 |
*/ |
| 2583 |
function isTemplateRevertable(template) { |
| 2584 |
if (!template) { |
| 2585 |
return false; |
| 2586 |
} |
| 2587 |
/* eslint-disable camelcase */ |
| 2588 |
|
| 2589 |
|
| 2590 |
return (template === null || template === void 0 ? void 0 : template.source) === 'custom' && (template === null || template === void 0 ? void 0 : template.has_theme_file); |
| 2591 |
/* eslint-enable camelcase */ |
| 2592 |
} |
| 2593 |
//# sourceMappingURL=is-template-revertable.js.map |
| 2594 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/actions.js |
| 2595 |
/** |
| 2596 |
* WordPress dependencies |
| 2597 |
*/ |
| 2598 |
|
| 2599 |
|
| 2600 |
|
| 2601 |
|
| 2602 |
|
| 2603 |
|
| 2604 |
|
| 2605 |
|
| 2606 |
|
| 2607 |
|
| 2608 |
/** |
| 2609 |
* Internal dependencies |
| 2610 |
*/ |
| 2611 |
|
| 2612 |
|
| 2613 |
|
| 2614 |
/** |
| 2615 |
* Returns an action object used to toggle a feature flag. |
| 2616 |
* |
| 2617 |
* @param {string} feature Feature name. |
| 2618 |
* |
| 2619 |
* @return {Object} Action object. |
| 2620 |
*/ |
| 2621 |
|
| 2622 |
function actions_toggleFeature(feature) { |
| 2623 |
return { |
| 2624 |
type: 'TOGGLE_FEATURE', |
| 2625 |
feature |
| 2626 |
}; |
| 2627 |
} |
| 2628 |
/** |
| 2629 |
* Returns an action object used to toggle the width of the editing canvas. |
| 2630 |
* |
| 2631 |
* @param {string} deviceType |
| 2632 |
* |
| 2633 |
* @return {Object} Action object. |
| 2634 |
*/ |
| 2635 |
|
| 2636 |
function __experimentalSetPreviewDeviceType(deviceType) { |
| 2637 |
return { |
| 2638 |
type: 'SET_PREVIEW_DEVICE_TYPE', |
| 2639 |
deviceType |
| 2640 |
}; |
| 2641 |
} |
| 2642 |
/** |
| 2643 |
* Returns an action object used to set a template. |
| 2644 |
* |
| 2645 |
* @param {number} templateId The template ID. |
| 2646 |
* @param {string} templateSlug The template slug. |
| 2647 |
* @return {Object} Action object. |
| 2648 |
*/ |
| 2649 |
|
| 2650 |
function* setTemplate(templateId, templateSlug) { |
| 2651 |
const pageContext = { |
| 2652 |
templateSlug |
| 2653 |
}; |
| 2654 |
|
| 2655 |
if (!templateSlug) { |
| 2656 |
const template = yield external_wp_data_namespaceObject.controls.resolveSelect(external_wp_coreData_namespaceObject.store, 'getEntityRecord', 'postType', 'wp_template', templateId); |
| 2657 |
pageContext.templateSlug = template === null || template === void 0 ? void 0 : template.slug; |
| 2658 |
} |
| 2659 |
|
| 2660 |
return { |
| 2661 |
type: 'SET_TEMPLATE', |
| 2662 |
templateId, |
| 2663 |
page: { |
| 2664 |
context: pageContext |
| 2665 |
} |
| 2666 |
}; |
| 2667 |
} |
| 2668 |
/** |
| 2669 |
* Adds a new template, and sets it as the current template. |
| 2670 |
* |
| 2671 |
* @param {Object} template The template. |
| 2672 |
* |
| 2673 |
* @return {Object} Action object used to set the current template. |
| 2674 |
*/ |
| 2675 |
|
| 2676 |
function* addTemplate(template) { |
| 2677 |
const newTemplate = yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'saveEntityRecord', 'postType', 'wp_template', template); |
| 2678 |
|
| 2679 |
if (template.content) { |
| 2680 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'editEntityRecord', 'postType', 'wp_template', newTemplate.id, { |
| 2681 |
blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) |
| 2682 |
}, { |
| 2683 |
undoIgnore: true |
| 2684 |
}); |
| 2685 |
} |
| 2686 |
|
| 2687 |
return { |
| 2688 |
type: 'SET_TEMPLATE', |
| 2689 |
templateId: newTemplate.id, |
| 2690 |
page: { |
| 2691 |
context: { |
| 2692 |
templateSlug: newTemplate.slug |
| 2693 |
} |
| 2694 |
} |
| 2695 |
}; |
| 2696 |
} |
| 2697 |
/** |
| 2698 |
* Removes a template. |
| 2699 |
* |
| 2700 |
* @param {Object} template The template object. |
| 2701 |
*/ |
| 2702 |
|
| 2703 |
function* removeTemplate(template) { |
| 2704 |
try { |
| 2705 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'deleteEntityRecord', 'postType', template.type, template.id, { |
| 2706 |
force: true |
| 2707 |
}); |
| 2708 |
const lastError = yield external_wp_data_namespaceObject.controls.select(external_wp_coreData_namespaceObject.store, 'getLastEntityDeleteError', 'postType', template.type, template.id); |
| 2709 |
|
| 2710 |
if (lastError) { |
| 2711 |
throw lastError; |
| 2712 |
} |
| 2713 |
|
| 2714 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createSuccessNotice', (0,external_wp_i18n_namespaceObject.sprintf)( |
| 2715 |
/* translators: The template/part's name. */ |
| 2716 |
(0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), template.title.rendered), { |
| 2717 |
type: 'snackbar' |
| 2718 |
}); |
| 2719 |
} catch (error) { |
| 2720 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.'); |
| 2721 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', errorMessage, { |
| 2722 |
type: 'snackbar' |
| 2723 |
}); |
| 2724 |
} |
| 2725 |
} |
| 2726 |
/** |
| 2727 |
* Returns an action object used to set a template part. |
| 2728 |
* |
| 2729 |
* @param {string} templatePartId The template part ID. |
| 2730 |
* |
| 2731 |
* @return {Object} Action object. |
| 2732 |
*/ |
| 2733 |
|
| 2734 |
function setTemplatePart(templatePartId) { |
| 2735 |
return { |
| 2736 |
type: 'SET_TEMPLATE_PART', |
| 2737 |
templatePartId |
| 2738 |
}; |
| 2739 |
} |
| 2740 |
/** |
| 2741 |
* Updates the homeTemplateId state with the templateId of the page resolved |
| 2742 |
* from the given path. |
| 2743 |
* |
| 2744 |
* @param {number} homeTemplateId The template ID for the homepage. |
| 2745 |
*/ |
| 2746 |
|
| 2747 |
function setHomeTemplateId(homeTemplateId) { |
| 2748 |
return { |
| 2749 |
type: 'SET_HOME_TEMPLATE', |
| 2750 |
homeTemplateId |
| 2751 |
}; |
| 2752 |
} |
| 2753 |
/** |
| 2754 |
* Resolves the template for a page and displays both. If no path is given, attempts |
| 2755 |
* to use the postId to generate a path like `?p=${ postId }`. |
| 2756 |
* |
| 2757 |
* @param {Object} page The page object. |
| 2758 |
* @param {string} page.type The page type. |
| 2759 |
* @param {string} page.slug The page slug. |
| 2760 |
* @param {string} page.path The page path. |
| 2761 |
* @param {Object} page.context The page context. |
| 2762 |
* |
| 2763 |
* @return {number} The resolved template ID for the page route. |
| 2764 |
*/ |
| 2765 |
|
| 2766 |
function* setPage(page) { |
| 2767 |
var _page$context; |
| 2768 |
|
| 2769 |
if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) { |
| 2770 |
const entity = yield external_wp_data_namespaceObject.controls.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 "/" |
| 2771 |
|
| 2772 |
page.path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link); |
| 2773 |
} |
| 2774 |
|
| 2775 |
const { |
| 2776 |
id: templateId, |
| 2777 |
slug: templateSlug |
| 2778 |
} = yield external_wp_data_namespaceObject.controls.resolveSelect(external_wp_coreData_namespaceObject.store, '__experimentalGetTemplateForLink', page.path); |
| 2779 |
yield { |
| 2780 |
type: 'SET_PAGE', |
| 2781 |
page: !templateSlug ? page : { ...page, |
| 2782 |
context: { ...page.context, |
| 2783 |
templateSlug |
| 2784 |
} |
| 2785 |
}, |
| 2786 |
templateId |
| 2787 |
}; |
| 2788 |
return templateId; |
| 2789 |
} |
| 2790 |
/** |
| 2791 |
* Returns an action object used to set the active navigation panel menu. |
| 2792 |
* |
| 2793 |
* @param {string} menu Menu prop of active menu. |
| 2794 |
* |
| 2795 |
* @return {Object} Action object. |
| 2796 |
*/ |
| 2797 |
|
| 2798 |
function setNavigationPanelActiveMenu(menu) { |
| 2799 |
return { |
| 2800 |
type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU', |
| 2801 |
menu |
| 2802 |
}; |
| 2803 |
} |
| 2804 |
/** |
| 2805 |
* Opens the navigation panel and sets its active menu at the same time. |
| 2806 |
* |
| 2807 |
* @param {string} menu Identifies the menu to open. |
| 2808 |
*/ |
| 2809 |
|
| 2810 |
function openNavigationPanelToMenu(menu) { |
| 2811 |
return { |
| 2812 |
type: 'OPEN_NAVIGATION_PANEL_TO_MENU', |
| 2813 |
menu |
| 2814 |
}; |
| 2815 |
} |
| 2816 |
/** |
| 2817 |
* Sets whether the navigation panel should be open. |
| 2818 |
* |
| 2819 |
* @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It |
| 2820 |
* does not toggle the state, but sets it directly. |
| 2821 |
*/ |
| 2822 |
|
| 2823 |
function setIsNavigationPanelOpened(isOpen) { |
| 2824 |
return { |
| 2825 |
type: 'SET_IS_NAVIGATION_PANEL_OPENED', |
| 2826 |
isOpen |
| 2827 |
}; |
| 2828 |
} |
| 2829 |
/** |
| 2830 |
* Returns an action object used to open/close the inserter. |
| 2831 |
* |
| 2832 |
* @param {boolean|Object} value Whether the inserter should be |
| 2833 |
* opened (true) or closed (false). |
| 2834 |
* To specify an insertion point, |
| 2835 |
* use an object. |
| 2836 |
* @param {string} value.rootClientId The root client ID to insert at. |
| 2837 |
* @param {number} value.insertionIndex The index to insert at. |
| 2838 |
* |
| 2839 |
* @return {Object} Action object. |
| 2840 |
*/ |
| 2841 |
|
| 2842 |
function setIsInserterOpened(value) { |
| 2843 |
return { |
| 2844 |
type: 'SET_IS_INSERTER_OPENED', |
| 2845 |
value |
| 2846 |
}; |
| 2847 |
} |
| 2848 |
/** |
| 2849 |
* Returns an action object used to update the settings. |
| 2850 |
* |
| 2851 |
* @param {Object} settings New settings. |
| 2852 |
* |
| 2853 |
* @return {Object} Action object. |
| 2854 |
*/ |
| 2855 |
|
| 2856 |
function updateSettings(settings) { |
| 2857 |
return { |
| 2858 |
type: 'UPDATE_SETTINGS', |
| 2859 |
settings |
| 2860 |
}; |
| 2861 |
} |
| 2862 |
/** |
| 2863 |
* Sets whether the list view panel should be open. |
| 2864 |
* |
| 2865 |
* @param {boolean} isOpen If true, opens the list view. If false, closes it. |
| 2866 |
* It does not toggle the state, but sets it directly. |
| 2867 |
*/ |
| 2868 |
|
| 2869 |
function setIsListViewOpened(isOpen) { |
| 2870 |
return { |
| 2871 |
type: 'SET_IS_LIST_VIEW_OPENED', |
| 2872 |
isOpen |
| 2873 |
}; |
| 2874 |
} |
| 2875 |
/** |
| 2876 |
* Reverts a template to its original theme-provided file. |
| 2877 |
* |
| 2878 |
* @param {Object} template The template to revert. |
| 2879 |
* @param {Object} [options] |
| 2880 |
* @param {boolean} [options.allowUndo] Whether to allow the user to undo |
| 2881 |
* reverting the template. Default true. |
| 2882 |
*/ |
| 2883 |
|
| 2884 |
function* revertTemplate(template) { |
| 2885 |
let { |
| 2886 |
allowUndo = true |
| 2887 |
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
| 2888 |
|
| 2889 |
if (!isTemplateRevertable(template)) { |
| 2890 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', (0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { |
| 2891 |
type: 'snackbar' |
| 2892 |
}); |
| 2893 |
return; |
| 2894 |
} |
| 2895 |
|
| 2896 |
try { |
| 2897 |
var _fileTemplate$content; |
| 2898 |
|
| 2899 |
const templateEntity = yield external_wp_data_namespaceObject.controls.select(external_wp_coreData_namespaceObject.store, 'getEntity', 'postType', template.type); |
| 2900 |
|
| 2901 |
if (!templateEntity) { |
| 2902 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { |
| 2903 |
type: 'snackbar' |
| 2904 |
}); |
| 2905 |
return; |
| 2906 |
} |
| 2907 |
|
| 2908 |
const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntity.baseURL}/${template.id}`, { |
| 2909 |
context: 'edit', |
| 2910 |
source: 'theme' |
| 2911 |
}); |
| 2912 |
const fileTemplate = yield (0,external_wp_dataControls_namespaceObject.apiFetch)({ |
| 2913 |
path: fileTemplatePath |
| 2914 |
}); |
| 2915 |
|
| 2916 |
if (!fileTemplate) { |
| 2917 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { |
| 2918 |
type: 'snackbar' |
| 2919 |
}); |
| 2920 |
return; |
| 2921 |
} |
| 2922 |
|
| 2923 |
const serializeBlocks = _ref => { |
| 2924 |
let { |
| 2925 |
blocks: blocksForSerialization = [] |
| 2926 |
} = _ref; |
| 2927 |
return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); |
| 2928 |
}; |
| 2929 |
|
| 2930 |
const edited = yield external_wp_data_namespaceObject.controls.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 |
| 2931 |
// the revert in the header toolbar correctly. |
| 2932 |
|
| 2933 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'editEntityRecord', 'postType', template.type, template.id, { |
| 2934 |
content: serializeBlocks, |
| 2935 |
// required to make the `undo` behave correctly |
| 2936 |
blocks: edited.blocks, |
| 2937 |
// required to revert the blocks in the editor |
| 2938 |
source: 'custom' // required to avoid turning the editor into a dirty state |
| 2939 |
|
| 2940 |
}, { |
| 2941 |
undoIgnore: true // required to merge this edit with the last undo level |
| 2942 |
|
| 2943 |
}); |
| 2944 |
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); |
| 2945 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'editEntityRecord', 'postType', template.type, fileTemplate.id, { |
| 2946 |
content: serializeBlocks, |
| 2947 |
blocks, |
| 2948 |
source: 'theme' |
| 2949 |
}); |
| 2950 |
|
| 2951 |
if (allowUndo) { |
| 2952 |
const undoRevert = async () => { |
| 2953 |
await (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { |
| 2954 |
content: serializeBlocks, |
| 2955 |
blocks: edited.blocks, |
| 2956 |
source: 'custom' |
| 2957 |
}); |
| 2958 |
}; |
| 2959 |
|
| 2960 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createSuccessNotice', (0,external_wp_i18n_namespaceObject.__)('Template reverted.'), { |
| 2961 |
type: 'snackbar', |
| 2962 |
actions: [{ |
| 2963 |
label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
| 2964 |
onClick: undoRevert |
| 2965 |
}] |
| 2966 |
}); |
| 2967 |
} else { |
| 2968 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createSuccessNotice', (0,external_wp_i18n_namespaceObject.__)('Template reverted.')); |
| 2969 |
} |
| 2970 |
} catch (error) { |
| 2971 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); |
| 2972 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', errorMessage, { |
| 2973 |
type: 'snackbar' |
| 2974 |
}); |
| 2975 |
} |
| 2976 |
} |
| 2977 |
/** |
| 2978 |
* Returns an action object used in signalling that the user opened an editor sidebar. |
| 2979 |
* |
| 2980 |
* @param {?string} name Sidebar name to be opened. |
| 2981 |
* |
| 2982 |
* @yield {Object} Action object. |
| 2983 |
*/ |
| 2984 |
|
| 2985 |
function* openGeneralSidebar(name) { |
| 2986 |
yield external_wp_data_namespaceObject.controls.dispatch(store, 'enableComplementaryArea', STORE_NAME, name); |
| 2987 |
} |
| 2988 |
/** |
| 2989 |
* Returns an action object signalling that the user closed the sidebar. |
| 2990 |
* |
| 2991 |
* @yield {Object} Action object. |
| 2992 |
*/ |
| 2993 |
|
| 2994 |
function* closeGeneralSidebar() { |
| 2995 |
yield external_wp_data_namespaceObject.controls.dispatch(store, 'disableComplementaryArea', STORE_NAME); |
| 2996 |
} |
| 2997 |
function* switchEditorMode(mode) { |
| 2998 |
yield { |
| 2999 |
type: 'SWITCH_MODE', |
| 3000 |
mode |
| 3001 |
}; // Unselect blocks when we switch to a non visual mode. |
| 3002 |
|
| 3003 |
if (mode !== 'visual') { |
| 3004 |
yield external_wp_data_namespaceObject.controls.dispatch(external_wp_blockEditor_namespaceObject.store.name, 'clearSelectedBlock'); |
| 3005 |
} |
| 3006 |
|
| 3007 |
const messages = { |
| 3008 |
visual: (0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), |
| 3009 |
mosaic: (0,external_wp_i18n_namespaceObject.__)('Mosaic view selected') |
| 3010 |
}; |
| 3011 |
|
| 3012 |
if (messages[mode]) { |
| 3013 |
(0,external_wp_a11y_namespaceObject.speak)(messages[mode], 'assertive'); |
| 3014 |
} |
| 3015 |
} |
| 3016 |
//# sourceMappingURL=actions.js.map |
| 3017 |
;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
| 3018 |
|
| 3019 |
|
| 3020 |
var LEAF_KEY, hasWeakMap; |
| 3021 |
|
| 3022 |
/** |
| 3023 |
* Arbitrary value used as key for referencing cache object in WeakMap tree. |
| 3024 |
* |
| 3025 |
* @type {Object} |
| 3026 |
*/ |
| 3027 |
LEAF_KEY = {}; |
| 3028 |
|
| 3029 |
/** |
| 3030 |
* Whether environment supports WeakMap. |
| 3031 |
* |
| 3032 |
* @type {boolean} |
| 3033 |
*/ |
| 3034 |
hasWeakMap = typeof WeakMap !== 'undefined'; |
| 3035 |
|
| 3036 |
/** |
| 3037 |
* Returns the first argument as the sole entry in an array. |
| 3038 |
* |
| 3039 |
* @param {*} value Value to return. |
| 3040 |
* |
| 3041 |
* @return {Array} Value returned as entry in array. |
| 3042 |
*/ |
| 3043 |
function arrayOf( value ) { |
| 3044 |
return [ value ]; |
| 3045 |
} |
| 3046 |
|
| 3047 |
/** |
| 3048 |
* Returns true if the value passed is object-like, or false otherwise. A value |
| 3049 |
* is object-like if it can support property assignment, e.g. object or array. |
| 3050 |
* |
| 3051 |
* @param {*} value Value to test. |
| 3052 |
* |
| 3053 |
* @return {boolean} Whether value is object-like. |
| 3054 |
*/ |
| 3055 |
function isObjectLike( value ) { |
| 3056 |
return !! value && 'object' === typeof value; |
| 3057 |
} |
| 3058 |
|
| 3059 |
/** |
| 3060 |
* Creates and returns a new cache object. |
| 3061 |
* |
| 3062 |
* @return {Object} Cache object. |
| 3063 |
*/ |
| 3064 |
function createCache() { |
| 3065 |
var cache = { |
| 3066 |
clear: function() { |
| 3067 |
cache.head = null; |
| 3068 |
}, |
| 3069 |
}; |
| 3070 |
|
| 3071 |
return cache; |
| 3072 |
} |
| 3073 |
|
| 3074 |
/** |
| 3075 |
* Returns true if entries within the two arrays are strictly equal by |
| 3076 |
* reference from a starting index. |
| 3077 |
* |
| 3078 |
* @param {Array} a First array. |
| 3079 |
* @param {Array} b Second array. |
| 3080 |
* @param {number} fromIndex Index from which to start comparison. |
| 3081 |
* |
| 3082 |
* @return {boolean} Whether arrays are shallowly equal. |
| 3083 |
*/ |
| 3084 |
function isShallowEqual( a, b, fromIndex ) { |
| 3085 |
var i; |
| 3086 |
|
| 3087 |
if ( a.length !== b.length ) { |
| 3088 |
return false; |
| 3089 |
} |
| 3090 |
|
| 3091 |
for ( i = fromIndex; i < a.length; i++ ) { |
| 3092 |
if ( a[ i ] !== b[ i ] ) { |
| 3093 |
return false; |
| 3094 |
} |
| 3095 |
} |
| 3096 |
|
| 3097 |
return true; |
| 3098 |
} |
| 3099 |
|
| 3100 |
/** |
| 3101 |
* Returns a memoized selector function. The getDependants function argument is |
| 3102 |
* called before the memoized selector and is expected to return an immutable |
| 3103 |
* reference or array of references on which the selector depends for computing |
| 3104 |
* its own return value. The memoize cache is preserved only as long as those |
| 3105 |
* dependant references remain the same. If getDependants returns a different |
| 3106 |
* reference(s), the cache is cleared and the selector value regenerated. |
| 3107 |
* |
| 3108 |
* @param {Function} selector Selector function. |
| 3109 |
* @param {Function} getDependants Dependant getter returning an immutable |
| 3110 |
* reference or array of reference used in |
| 3111 |
* cache bust consideration. |
| 3112 |
* |
| 3113 |
* @return {Function} Memoized selector. |
| 3114 |
*/ |
| 3115 |
/* harmony default export */ function rememo(selector, getDependants ) { |
| 3116 |
var rootCache, getCache; |
| 3117 |
|
| 3118 |
// Use object source as dependant if getter not provided |
| 3119 |
if ( ! getDependants ) { |
| 3120 |
getDependants = arrayOf; |
| 3121 |
} |
| 3122 |
|
| 3123 |
/** |
| 3124 |
* Returns the root cache. If WeakMap is supported, this is assigned to the |
| 3125 |
* root WeakMap cache set, otherwise it is a shared instance of the default |
| 3126 |
* cache object. |
| 3127 |
* |
| 3128 |
* @return {(WeakMap|Object)} Root cache object. |
| 3129 |
*/ |
| 3130 |
function getRootCache() { |
| 3131 |
return rootCache; |
| 3132 |
} |
| 3133 |
|
| 3134 |
/** |
| 3135 |
* Returns the cache for a given dependants array. When possible, a WeakMap |
| 3136 |
* will be used to create a unique cache for each set of dependants. This |
| 3137 |
* is feasible due to the nature of WeakMap in allowing garbage collection |
| 3138 |
* to occur on entries where the key object is no longer referenced. Since |
| 3139 |
* WeakMap requires the key to be an object, this is only possible when the |
| 3140 |
* dependant is object-like. The root cache is created as a hierarchy where |
| 3141 |
* each top-level key is the first entry in a dependants set, the value a |
| 3142 |
* WeakMap where each key is the next dependant, and so on. This continues |
| 3143 |
* so long as the dependants are object-like. If no dependants are object- |
| 3144 |
* like, then the cache is shared across all invocations. |
| 3145 |
* |
| 3146 |
* @see isObjectLike |
| 3147 |
* |
| 3148 |
* @param {Array} dependants Selector dependants. |
| 3149 |
* |
| 3150 |
* @return {Object} Cache object. |
| 3151 |
*/ |
| 3152 |
function getWeakMapCache( dependants ) { |
| 3153 |
var caches = rootCache, |
| 3154 |
isUniqueByDependants = true, |
| 3155 |
i, dependant, map, cache; |
| 3156 |
|
| 3157 |
for ( i = 0; i < dependants.length; i++ ) { |
| 3158 |
dependant = dependants[ i ]; |
| 3159 |
|
| 3160 |
// Can only compose WeakMap from object-like key. |
| 3161 |
if ( ! isObjectLike( dependant ) ) { |
| 3162 |
isUniqueByDependants = false; |
| 3163 |
break; |
| 3164 |
} |
| 3165 |
|
| 3166 |
// Does current segment of cache already have a WeakMap? |
| 3167 |
if ( caches.has( dependant ) ) { |
| 3168 |
// Traverse into nested WeakMap. |
| 3169 |
caches = caches.get( dependant ); |
| 3170 |
} else { |
| 3171 |
// Create, set, and traverse into a new one. |
| 3172 |
map = new WeakMap(); |
| 3173 |
caches.set( dependant, map ); |
| 3174 |
caches = map; |
| 3175 |
} |
| 3176 |
} |
| 3177 |
|
| 3178 |
// We use an arbitrary (but consistent) object as key for the last item |
| 3179 |
// in the WeakMap to serve as our running cache. |
| 3180 |
if ( ! caches.has( LEAF_KEY ) ) { |
| 3181 |
cache = createCache(); |
| 3182 |
cache.isUniqueByDependants = isUniqueByDependants; |
| 3183 |
caches.set( LEAF_KEY, cache ); |
| 3184 |
} |
| 3185 |
|
| 3186 |
return caches.get( LEAF_KEY ); |
| 3187 |
} |
| 3188 |
|
| 3189 |
// Assign cache handler by availability of WeakMap |
| 3190 |
getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
| 3191 |
|
| 3192 |
/** |
| 3193 |
* Resets root memoization cache. |
| 3194 |
*/ |
| 3195 |
function clear() { |
| 3196 |
rootCache = hasWeakMap ? new WeakMap() : createCache(); |
| 3197 |
} |
| 3198 |
|
| 3199 |
// eslint-disable-next-line jsdoc/check-param-names |
| 3200 |
/** |
| 3201 |
* The augmented selector call, considering first whether dependants have |
| 3202 |
* changed before passing it to underlying memoize function. |
| 3203 |
* |
| 3204 |
* @param {Object} source Source object for derivation. |
| 3205 |
* @param {...*} extraArgs Additional arguments to pass to selector. |
| 3206 |
* |
| 3207 |
* @return {*} Selector result. |
| 3208 |
*/ |
| 3209 |
function callSelector( /* source, ...extraArgs */ ) { |
| 3210 |
var len = arguments.length, |
| 3211 |
cache, node, i, args, dependants; |
| 3212 |
|
| 3213 |
// Create copy of arguments (avoid leaking deoptimization). |
| 3214 |
args = new Array( len ); |
| 3215 |
for ( i = 0; i < len; i++ ) { |
| 3216 |
args[ i ] = arguments[ i ]; |
| 3217 |
} |
| 3218 |
|
| 3219 |
dependants = getDependants.apply( null, args ); |
| 3220 |
cache = getCache( dependants ); |
| 3221 |
|
| 3222 |
// If not guaranteed uniqueness by dependants (primitive type or lack |
| 3223 |
// of WeakMap support), shallow compare against last dependants and, if |
| 3224 |
// references have changed, destroy cache to recalculate result. |
| 3225 |
if ( ! cache.isUniqueByDependants ) { |
| 3226 |
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
| 3227 |
cache.clear(); |
| 3228 |
} |
| 3229 |
|
| 3230 |
cache.lastDependants = dependants; |
| 3231 |
} |
| 3232 |
|
| 3233 |
node = cache.head; |
| 3234 |
while ( node ) { |
| 3235 |
// Check whether node arguments match arguments |
| 3236 |
if ( ! isShallowEqual( node.args, args, 1 ) ) { |
| 3237 |
node = node.next; |
| 3238 |
continue; |
| 3239 |
} |
| 3240 |
|
| 3241 |
// At this point we can assume we've found a match |
| 3242 |
|
| 3243 |
// Surface matched node to head if not already |
| 3244 |
if ( node !== cache.head ) { |
| 3245 |
// Adjust siblings to point to each other. |
| 3246 |
node.prev.next = node.next; |
| 3247 |
if ( node.next ) { |
| 3248 |
node.next.prev = node.prev; |
| 3249 |
} |
| 3250 |
|
| 3251 |
node.next = cache.head; |
| 3252 |
node.prev = null; |
| 3253 |
cache.head.prev = node; |
| 3254 |
cache.head = node; |
| 3255 |
} |
| 3256 |
|
| 3257 |
// Return immediately |
| 3258 |
return node.val; |
| 3259 |
} |
| 3260 |
|
| 3261 |
// No cached value found. Continue to insertion phase: |
| 3262 |
|
| 3263 |
node = { |
| 3264 |
// Generate the result from original function |
| 3265 |
val: selector.apply( null, args ), |
| 3266 |
}; |
| 3267 |
|
| 3268 |
// Avoid including the source object in the cache. |
| 3269 |
args[ 0 ] = null; |
| 3270 |
node.args = args; |
| 3271 |
|
| 3272 |
// Don't need to check whether node is already head, since it would |
| 3273 |
// have been returned above already if it was |
| 3274 |
|
| 3275 |
// Shift existing head down list |
| 3276 |
if ( cache.head ) { |
| 3277 |
cache.head.prev = node; |
| 3278 |
node.next = cache.head; |
| 3279 |
} |
| 3280 |
|
| 3281 |
cache.head = node; |
| 3282 |
|
| 3283 |
return node.val; |
| 3284 |
} |
| 3285 |
|
| 3286 |
callSelector.getDependants = getDependants; |
| 3287 |
callSelector.clear = clear; |
| 3288 |
clear(); |
| 3289 |
|
| 3290 |
return callSelector; |
| 3291 |
} |
| 3292 |
|
| 3293 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js |
| 3294 |
/** |
| 3295 |
* External dependencies |
| 3296 |
*/ |
| 3297 |
|
| 3298 |
/** |
| 3299 |
* Internal dependencies |
| 3300 |
*/ |
| 3301 |
|
| 3302 |
|
| 3303 |
function isTemplateSuperseded(slug, existingSlugs, showOnFront) { |
| 3304 |
if (!TEMPLATE_OVERRIDES[slug]) { |
| 3305 |
return false; |
| 3306 |
} // `home` template is unused if it is superseded by `front-page` |
| 3307 |
// or "show on front" is set to show a page rather than blog posts. |
| 3308 |
|
| 3309 |
|
| 3310 |
if (slug === 'home' && showOnFront !== 'posts') { |
| 3311 |
return true; |
| 3312 |
} |
| 3313 |
|
| 3314 |
return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront)); |
| 3315 |
} |
| 3316 |
function getTemplateLocation(slug) { |
| 3317 |
const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug); |
| 3318 |
|
| 3319 |
if (isTopLevelTemplate) { |
| 3320 |
return MENU_TEMPLATES; |
| 3321 |
} |
| 3322 |
|
| 3323 |
const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug); |
| 3324 |
|
| 3325 |
if (isGeneralTemplate) { |
| 3326 |
return MENU_TEMPLATES_GENERAL; |
| 3327 |
} |
| 3328 |
|
| 3329 |
const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix)); |
| 3330 |
|
| 3331 |
if (isPostsTemplate) { |
| 3332 |
return MENU_TEMPLATES_POSTS; |
| 3333 |
} |
| 3334 |
|
| 3335 |
const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix)); |
| 3336 |
|
| 3337 |
if (isPagesTemplate) { |
| 3338 |
return MENU_TEMPLATES_PAGES; |
| 3339 |
} |
| 3340 |
|
| 3341 |
return MENU_TEMPLATES_GENERAL; |
| 3342 |
} |
| 3343 |
function getUnusedTemplates(templates, showOnFront) { |
| 3344 |
const templateSlugs = map(templates, 'slug'); |
| 3345 |
const supersededTemplates = templates.filter(_ref => { |
| 3346 |
let { |
| 3347 |
slug |
| 3348 |
} = _ref; |
| 3349 |
return isTemplateSuperseded(slug, templateSlugs, showOnFront); |
| 3350 |
}); |
| 3351 |
return supersededTemplates; |
| 3352 |
} |
| 3353 |
function getTemplatesLocationMap(templates) { |
| 3354 |
return templates.reduce((obj, template) => { |
| 3355 |
obj[template.slug] = getTemplateLocation(template.slug); |
| 3356 |
return obj; |
| 3357 |
}, {}); |
| 3358 |
} |
| 3359 |
//# sourceMappingURL=template-hierarchy.js.map |
| 3360 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/selectors.js |
| 3361 |
/** |
| 3362 |
* External dependencies |
| 3363 |
*/ |
| 3364 |
|
| 3365 |
|
| 3366 |
/** |
| 3367 |
* WordPress dependencies |
| 3368 |
*/ |
| 3369 |
|
| 3370 |
|
| 3371 |
|
| 3372 |
|
| 3373 |
|
| 3374 |
|
| 3375 |
/** |
| 3376 |
* Internal dependencies |
| 3377 |
*/ |
| 3378 |
|
| 3379 |
|
| 3380 |
|
| 3381 |
/** |
| 3382 |
* @typedef {'template'|'template_type'} TemplateType Template type. |
| 3383 |
*/ |
| 3384 |
|
| 3385 |
/** |
| 3386 |
* Returns whether the given feature is enabled or not. |
| 3387 |
* |
| 3388 |
* @param {Object} state Global application state. |
| 3389 |
* @param {string} feature Feature slug. |
| 3390 |
* |
| 3391 |
* @return {boolean} Is active. |
| 3392 |
*/ |
| 3393 |
|
| 3394 |
function selectors_isFeatureActive(state, feature) { |
| 3395 |
return (0,external_lodash_namespaceObject.get)(state.preferences.features, [feature], false); |
| 3396 |
} |
| 3397 |
/** |
| 3398 |
* Returns the current editing canvas device type. |
| 3399 |
* |
| 3400 |
* @param {Object} state Global application state. |
| 3401 |
* |
| 3402 |
* @return {string} Device type. |
| 3403 |
*/ |
| 3404 |
|
| 3405 |
function __experimentalGetPreviewDeviceType(state) { |
| 3406 |
return state.deviceType; |
| 3407 |
} |
| 3408 |
/** |
| 3409 |
* Returns whether the current user can create media or not. |
| 3410 |
* |
| 3411 |
* @param {Object} state Global application state. |
| 3412 |
* |
| 3413 |
* @return {Object} Whether the current user can create media or not. |
| 3414 |
*/ |
| 3415 |
|
| 3416 |
const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => select(external_wp_coreData_namespaceObject.store).canUser('create', 'media')); |
| 3417 |
/** |
| 3418 |
* Returns any available Reusable blocks. |
| 3419 |
* |
| 3420 |
* @param {Object} state Global application state. |
| 3421 |
* |
| 3422 |
* @return {Array} The available reusable blocks. |
| 3423 |
*/ |
| 3424 |
|
| 3425 |
const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
| 3426 |
const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; |
| 3427 |
return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { |
| 3428 |
per_page: -1 |
| 3429 |
}) : []; |
| 3430 |
}); |
| 3431 |
/** |
| 3432 |
* Returns the settings, taking into account active features and permissions. |
| 3433 |
* |
| 3434 |
* @param {Object} state Global application state. |
| 3435 |
* @param {Function} setIsInserterOpen Setter for the open state of the global inserter. |
| 3436 |
* |
| 3437 |
* @return {Object} Settings. |
| 3438 |
*/ |
| 3439 |
|
| 3440 |
const getSettings = rememo((state, setIsInserterOpen) => { |
| 3441 |
const settings = { ...state.settings, |
| 3442 |
outlineMode: true, |
| 3443 |
focusMode: selectors_isFeatureActive(state, 'focusMode'), |
| 3444 |
hasFixedToolbar: selectors_isFeatureActive(state, 'fixedToolbar'), |
| 3445 |
__experimentalSetIsInserterOpened: setIsInserterOpen, |
| 3446 |
__experimentalReusableBlocks: getReusableBlocks(state) |
| 3447 |
}; |
| 3448 |
const canUserCreateMedia = getCanUserCreateMedia(state); |
| 3449 |
|
| 3450 |
if (!canUserCreateMedia) { |
| 3451 |
return settings; |
| 3452 |
} |
| 3453 |
|
| 3454 |
settings.mediaUpload = _ref => { |
| 3455 |
let { |
| 3456 |
onError, |
| 3457 |
...rest |
| 3458 |
} = _ref; |
| 3459 |
(0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ |
| 3460 |
wpAllowedMimeTypes: state.settings.allowedMimeTypes, |
| 3461 |
onError: _ref2 => { |
| 3462 |
let { |
| 3463 |
message |
| 3464 |
} = _ref2; |
| 3465 |
return onError(message); |
| 3466 |
}, |
| 3467 |
...rest |
| 3468 |
}); |
| 3469 |
}; |
| 3470 |
|
| 3471 |
return settings; |
| 3472 |
}, state => [getCanUserCreateMedia(state), state.settings, selectors_isFeatureActive(state, 'focusMode'), selectors_isFeatureActive(state, 'fixedToolbar'), getReusableBlocks(state)]); |
| 3473 |
/** |
| 3474 |
* Returns the current home template ID. |
| 3475 |
* |
| 3476 |
* @param {Object} state Global application state. |
| 3477 |
* |
| 3478 |
* @return {number?} Home template ID. |
| 3479 |
*/ |
| 3480 |
|
| 3481 |
function getHomeTemplateId(state) { |
| 3482 |
return state.homeTemplateId; |
| 3483 |
} |
| 3484 |
|
| 3485 |
function getCurrentEditedPost(state) { |
| 3486 |
return state.editedPost; |
| 3487 |
} |
| 3488 |
/** |
| 3489 |
* Returns the current edited post type (wp_template or wp_template_part). |
| 3490 |
* |
| 3491 |
* @param {Object} state Global application state. |
| 3492 |
* |
| 3493 |
* @return {TemplateType?} Template type. |
| 3494 |
*/ |
| 3495 |
|
| 3496 |
|
| 3497 |
function getEditedPostType(state) { |
| 3498 |
return getCurrentEditedPost(state).type; |
| 3499 |
} |
| 3500 |
/** |
| 3501 |
* Returns the ID of the currently edited template or template part. |
| 3502 |
* |
| 3503 |
* @param {Object} state Global application state. |
| 3504 |
* |
| 3505 |
* @return {string?} Post ID. |
| 3506 |
*/ |
| 3507 |
|
| 3508 |
function getEditedPostId(state) { |
| 3509 |
return getCurrentEditedPost(state).id; |
| 3510 |
} |
| 3511 |
/** |
| 3512 |
* Returns the current page object. |
| 3513 |
* |
| 3514 |
* @param {Object} state Global application state. |
| 3515 |
* |
| 3516 |
* @return {Object} Page. |
| 3517 |
*/ |
| 3518 |
|
| 3519 |
function getPage(state) { |
| 3520 |
return getCurrentEditedPost(state).page; |
| 3521 |
} |
| 3522 |
/** |
| 3523 |
* Returns the active menu in the navigation panel. |
| 3524 |
* |
| 3525 |
* @param {Object} state Global application state. |
| 3526 |
* |
| 3527 |
* @return {string} Active menu. |
| 3528 |
*/ |
| 3529 |
|
| 3530 |
function getNavigationPanelActiveMenu(state) { |
| 3531 |
return state.navigationPanel.menu; |
| 3532 |
} |
| 3533 |
/** |
| 3534 |
* Returns the current template or template part's corresponding |
| 3535 |
* navigation panel's sub menu, to be used with `openNavigationPanelToMenu`. |
| 3536 |
* |
| 3537 |
* @param {Object} state Global application state. |
| 3538 |
* |
| 3539 |
* @return {string} The current template or template part's sub menu. |
| 3540 |
*/ |
| 3541 |
|
| 3542 |
const getCurrentTemplateNavigationPanelSubMenu = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
| 3543 |
const templateType = getEditedPostType(state); |
| 3544 |
const templateId = getEditedPostId(state); |
| 3545 |
const template = templateId ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', templateType, templateId) : null; |
| 3546 |
|
| 3547 |
if (!template) { |
| 3548 |
return MENU_ROOT; |
| 3549 |
} |
| 3550 |
|
| 3551 |
if ('wp_template_part' === templateType) { |
| 3552 |
var _TEMPLATE_PARTS_SUB_M; |
| 3553 |
|
| 3554 |
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; |
| 3555 |
} |
| 3556 |
|
| 3557 |
const templates = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template'); |
| 3558 |
const showOnFront = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'site').show_on_front; |
| 3559 |
|
| 3560 |
if (isTemplateSuperseded(template.slug, (0,external_lodash_namespaceObject.map)(templates, 'slug'), showOnFront)) { |
| 3561 |
return MENU_TEMPLATES_UNUSED; |
| 3562 |
} |
| 3563 |
|
| 3564 |
return getTemplateLocation(template.slug); |
| 3565 |
}); |
| 3566 |
/** |
| 3567 |
* Returns the current opened/closed state of the navigation panel. |
| 3568 |
* |
| 3569 |
* @param {Object} state Global application state. |
| 3570 |
* |
| 3571 |
* @return {boolean} True if the navigation panel should be open; false if closed. |
| 3572 |
*/ |
| 3573 |
|
| 3574 |
function isNavigationOpened(state) { |
| 3575 |
return state.navigationPanel.isOpen; |
| 3576 |
} |
| 3577 |
/** |
| 3578 |
* Returns the current opened/closed state of the inserter panel. |
| 3579 |
* |
| 3580 |
* @param {Object} state Global application state. |
| 3581 |
* |
| 3582 |
* @return {boolean} True if the inserter panel should be open; false if closed. |
| 3583 |
*/ |
| 3584 |
|
| 3585 |
function isInserterOpened(state) { |
| 3586 |
return !!state.blockInserterPanel; |
| 3587 |
} |
| 3588 |
/** |
| 3589 |
* Get the insertion point for the inserter. |
| 3590 |
* |
| 3591 |
* @param {Object} state Global application state. |
| 3592 |
* |
| 3593 |
* @return {Object} The root client ID, index to insert at and starting filter value. |
| 3594 |
*/ |
| 3595 |
|
| 3596 |
function __experimentalGetInsertionPoint(state) { |
| 3597 |
const { |
| 3598 |
rootClientId, |
| 3599 |
insertionIndex, |
| 3600 |
filterValue |
| 3601 |
} = state.blockInserterPanel; |
| 3602 |
return { |
| 3603 |
rootClientId, |
| 3604 |
insertionIndex, |
| 3605 |
filterValue |
| 3606 |
}; |
| 3607 |
} |
| 3608 |
/** |
| 3609 |
* Returns the current opened/closed state of the list view panel. |
| 3610 |
* |
| 3611 |
* @param {Object} state Global application state. |
| 3612 |
* |
| 3613 |
* @return {boolean} True if the list view panel should be open; false if closed. |
| 3614 |
*/ |
| 3615 |
|
| 3616 |
function isListViewOpened(state) { |
| 3617 |
return state.listViewPanel; |
| 3618 |
} |
| 3619 |
/** |
| 3620 |
* Returns the template parts and their blocks for the current edited template. |
| 3621 |
* |
| 3622 |
* @param {Object} state Global application state. |
| 3623 |
* @return {Array} Template parts and their blocks in an array. |
| 3624 |
*/ |
| 3625 |
|
| 3626 |
const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
| 3627 |
var _template$blocks; |
| 3628 |
|
| 3629 |
const templateType = getEditedPostType(state); |
| 3630 |
const templateId = getEditedPostId(state); |
| 3631 |
const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', templateType, templateId); |
| 3632 |
const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', { |
| 3633 |
per_page: -1 |
| 3634 |
}); |
| 3635 |
const templatePartsById = (0,external_lodash_namespaceObject.keyBy)(templateParts, templatePart => templatePart.id); |
| 3636 |
return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)).map(block => { |
| 3637 |
const { |
| 3638 |
attributes: { |
| 3639 |
theme, |
| 3640 |
slug |
| 3641 |
} |
| 3642 |
} = block; |
| 3643 |
const templatePartId = `${theme}//${slug}`; |
| 3644 |
const templatePart = templatePartsById[templatePartId]; |
| 3645 |
return { |
| 3646 |
templatePart, |
| 3647 |
block |
| 3648 |
}; |
| 3649 |
}).filter(_ref3 => { |
| 3650 |
let { |
| 3651 |
templatePart |
| 3652 |
} = _ref3; |
| 3653 |
return !!templatePart; |
| 3654 |
}); |
| 3655 |
}); |
| 3656 |
/** |
| 3657 |
* Returns the current editing mode. |
| 3658 |
* |
| 3659 |
* @param {Object} state Global application state. |
| 3660 |
* |
| 3661 |
* @return {string} Editing mode. |
| 3662 |
*/ |
| 3663 |
|
| 3664 |
function getEditorMode(state) { |
| 3665 |
return state.preferences.editorMode || 'visual'; |
| 3666 |
} |
| 3667 |
//# sourceMappingURL=selectors.js.map |
| 3668 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/store/index.js |
| 3669 |
/** |
| 3670 |
* WordPress dependencies |
| 3671 |
*/ |
| 3672 |
|
| 3673 |
|
| 3674 |
/** |
| 3675 |
* Internal dependencies |
| 3676 |
*/ |
| 3677 |
|
| 3678 |
|
| 3679 |
|
| 3680 |
|
| 3681 |
|
| 3682 |
const storeConfig = { |
| 3683 |
reducer: reducer, |
| 3684 |
actions: store_actions_namespaceObject, |
| 3685 |
selectors: store_selectors_namespaceObject, |
| 3686 |
controls: external_wp_dataControls_namespaceObject.controls, |
| 3687 |
persist: ['preferences'] |
| 3688 |
}; |
| 3689 |
const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); // Once we build a more generic persistence plugin that works across types of stores |
| 3690 |
// we'd be able to replace this with a register call. |
| 3691 |
|
| 3692 |
(0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, storeConfig); |
| 3693 |
//# sourceMappingURL=index.js.map |
| 3694 |
;// CONCATENATED MODULE: ./node_modules/history/index.js |
| 3695 |
var r,B=r||(r={});B.Pop="POP";B.Push="PUSH";B.Replace="REPLACE";var C= false?0:function(b){return b};function D(b,h){if(!b){"undefined"!==typeof console&&console.warn(h);try{throw Error(h);}catch(k){}}}function E(b){b.preventDefault();b.returnValue=""} |
| 3696 |
function F(){var b=[];return{get length(){return b.length},push:function(h){b.push(h);return function(){b=b.filter(function(k){return k!==h})}},call:function(h){b.forEach(function(k){return k&&k(h)})}}}function H(){return Math.random().toString(36).substr(2,8)}function I(b){var h=b.pathname,k=b.search;b=b.hash;return(void 0===h?"/":h)+(void 0===k?"":k)+(void 0===b?"":b)} |
| 3697 |
function J(b){var h={};if(b){var k=b.indexOf("#");0<=k&&(h.hash=b.substr(k),b=b.substr(0,k));k=b.indexOf("?");0<=k&&(h.search=b.substr(k),b=b.substr(0,k));b&&(h.pathname=b)}return h} |
| 3698 |
function createBrowserHistory(b){function h(){var c=p.location,a=m.state||{};return[a.idx,C({pathname:c.pathname,search:c.search,hash:c.hash,state:a.usr||null,key:a.key||"default"})]}function k(c){return"string"===typeof c?c:I(c)}function x(c,a){void 0===a&&(a=null);return C(extends_extends({pathname:q.pathname,hash:"",search:""},"string"===typeof c?J(c):c,{state:a,key:H()}))}function z(c){t=c;c=h();v=c[0];q=c[1];d.call({action:t,location:q})}function A(c,a){function e(){A(c,a)}var l=r.Push,g=x(c, |
| 3699 |
a);if(!f.length||(f.call({action:l,location:g,retry:e}),!1)){var n=[{usr:g.state,key:g.key,idx:v+1},k(g)];g=n[0];n=n[1];try{m.pushState(g,"",n)}catch(G){p.location.assign(n)}z(l)}}function y(c,a){function e(){y(c,a)}var l=r.Replace,g=x(c,a);f.length&&(f.call({action:l,location:g,retry:e}),1)||(g=[{usr:g.state,key:g.key,idx:v},k(g)],m.replaceState(g[0],"",g[1]),z(l))}function w(c){m.go(c)}void 0===b&&(b={});b=b.window;var p=void 0===b?document.defaultView:b,m=p.history,u=null;p.addEventListener("popstate", |
| 3700 |
function(){if(u)f.call(u),u=null;else{var c=r.Pop,a=h(),e=a[0];a=a[1];if(f.length)if(null!=e){var l=v-e;l&&(u={action:c,location:a,retry:function(){w(-1*l)}},w(l))}else false?0: |
| 3701 |
void 0;else z(c)}});var t=r.Pop;b=h();var v=b[0],q=b[1],d=F(),f=F();null==v&&(v=0,m.replaceState(extends_extends({},m.state,{idx:v}),""));return{get action(){return t},get location(){return q},createHref:k,push:A,replace:y,go:w,back:function(){w(-1)},forward:function(){w(1)},listen:function(c){return d.push(c)},block:function(c){var a=f.push(c);1===f.length&&p.addEventListener("beforeunload",E);return function(){a();f.length||p.removeEventListener("beforeunload",E)}}}}; |
| 3702 |
function createHashHistory(b){function h(){var a=J(m.location.hash.substr(1)),e=a.pathname,l=a.search;a=a.hash;var g=u.state||{};return[g.idx,C({pathname:void 0===e?"/":e,search:void 0===l?"":l,hash:void 0===a?"":a,state:g.usr||null,key:g.key||"default"})]}function k(){if(t)c.call(t),t=null;else{var a=r.Pop,e=h(),l=e[0];e=e[1];if(c.length)if(null!=l){var g=q-l;g&&(t={action:a,location:e,retry:function(){p(-1*g)}},p(g))}else false?0: |
| 3703 |
void 0;else A(a)}}function x(a){var e=document.querySelector("base"),l="";e&&e.getAttribute("href")&&(e=m.location.href,l=e.indexOf("#"),l=-1===l?e:e.slice(0,l));return l+"#"+("string"===typeof a?a:I(a))}function z(a,e){void 0===e&&(e=null);return C(_extends({pathname:d.pathname,hash:"",search:""},"string"===typeof a?J(a):a,{state:e,key:H()}))}function A(a){v=a;a=h();q=a[0];d=a[1];f.call({action:v,location:d})}function y(a,e){function l(){y(a,e)}var g=r.Push,n=z(a,e); false? |
| 3704 |
0:void 0;if(!c.length||(c.call({action:g,location:n,retry:l}),!1)){var G=[{usr:n.state,key:n.key,idx:q+1},x(n)];n=G[0];G=G[1];try{u.pushState(n,"",G)}catch(K){m.location.assign(G)}A(g)}}function w(a,e){function l(){w(a,e)}var g=r.Replace,n=z(a,e); false?0:void 0;c.length&&(c.call({action:g,location:n,retry:l}),1)||(n=[{usr:n.state,key:n.key,idx:q},x(n)],u.replaceState(n[0],"",n[1]),A(g))}function p(a){u.go(a)}void 0===b&&(b={});b=b.window;var m=void 0===b?document.defaultView:b,u=m.history,t=null;m.addEventListener("popstate",k);m.addEventListener("hashchange",function(){var a=h()[1];I(a)!==I(d)&&k()});var v=r.Pop;b=h();var q=b[0],d=b[1],f=F(),c=F();null==q&&(q=0,u.replaceState(_extends({},u.state,{idx:q}),""));return{get action(){return v},get location(){return d}, |
| 3705 |
createHref:x,push:y,replace:w,go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(a){return f.push(a)},block:function(a){var e=c.push(a);1===c.length&&m.addEventListener("beforeunload",E);return function(){e();c.length||m.removeEventListener("beforeunload",E)}}}}; |
| 3706 |
function createMemoryHistory(b){function h(d,f){void 0===f&&(f=null);return C(_extends({pathname:t.pathname,search:"",hash:""},"string"===typeof d?J(d):d,{state:f,key:H()}))}function k(d,f,c){return!q.length||(q.call({action:d,location:f,retry:c}),!1)}function x(d,f){u=d;t=f;v.call({action:u,location:t})}function z(d,f){var c=r.Push,a=h(d,f); false?0: |
| 3707 |
void 0;k(c,a,function(){z(d,f)})&&(m+=1,p.splice(m,p.length,a),x(c,a))}function A(d,f){var c=r.Replace,a=h(d,f); false?0:void 0;k(c,a,function(){A(d,f)})&&(p[m]=a,x(c,a))}function y(d){var f=Math.min(Math.max(m+d,0),p.length-1),c=r.Pop,a=p[f];k(c,a,function(){y(d)})&&(m=f,x(c,a))}void 0===b&&(b={});var w=b;b=w.initialEntries;w=w.initialIndex;var p=(void 0=== |
| 3708 |
b?["/"]:b).map(function(d){var f=C(_extends({pathname:"/",search:"",hash:"",state:null,key:H()},"string"===typeof d?J(d):d)); false?0:void 0;return f}),m=Math.min(Math.max(null==w?p.length-1:w,0),p.length-1),u=r.Pop,t=p[m],v=F(),q=F();return{get index(){return m},get action(){return u},get location(){return t},createHref:function(d){return"string"=== |
| 3709 |
typeof d?d:I(d)},push:z,replace:A,go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(d){return v.push(d)},block:function(d){return q.push(d)}}}; |
| 3710 |
//# sourceMappingURL=index.js.map |
| 3711 |
|
| 3712 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/utils/history.js |
| 3713 |
/** |
| 3714 |
* External dependencies |
| 3715 |
*/ |
| 3716 |
|
| 3717 |
/** |
| 3718 |
* WordPress dependencies |
| 3719 |
*/ |
| 3720 |
|
| 3721 |
|
| 3722 |
const history_history = createBrowserHistory(); |
| 3723 |
const originalHistoryPush = history_history.push; |
| 3724 |
const originalHistoryReplace = history_history.replace; |
| 3725 |
|
| 3726 |
function push(params, state) { |
| 3727 |
return originalHistoryPush.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); |
| 3728 |
} |
| 3729 |
|
| 3730 |
function replace(params, state) { |
| 3731 |
return originalHistoryReplace.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); |
| 3732 |
} |
| 3733 |
|
| 3734 |
history_history.push = push; |
| 3735 |
history_history.replace = replace; |
| 3736 |
/* harmony default export */ var utils_history = (history_history); |
| 3737 |
//# sourceMappingURL=history.js.map |
| 3738 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/routes/index.js |
| 3739 |
|
| 3740 |
|
| 3741 |
/** |
| 3742 |
* WordPress dependencies |
| 3743 |
*/ |
| 3744 |
|
| 3745 |
/** |
| 3746 |
* Internal dependencies |
| 3747 |
*/ |
| 3748 |
|
| 3749 |
|
| 3750 |
const RoutesContext = (0,external_wp_element_namespaceObject.createContext)(); |
| 3751 |
const HistoryContext = (0,external_wp_element_namespaceObject.createContext)(); |
| 3752 |
function useLocation() { |
| 3753 |
return (0,external_wp_element_namespaceObject.useContext)(RoutesContext); |
| 3754 |
} |
| 3755 |
function useHistory() { |
| 3756 |
return (0,external_wp_element_namespaceObject.useContext)(HistoryContext); |
| 3757 |
} |
| 3758 |
|
| 3759 |
function getLocationWithParams(location) { |
| 3760 |
const searchParams = new URLSearchParams(location.search); |
| 3761 |
return { ...location, |
| 3762 |
params: Object.fromEntries(searchParams.entries()) |
| 3763 |
}; |
| 3764 |
} |
| 3765 |
|
| 3766 |
function Routes(_ref) { |
| 3767 |
let { |
| 3768 |
children |
| 3769 |
} = _ref; |
| 3770 |
const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(utils_history.location)); |
| 3771 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 3772 |
return utils_history.listen(_ref2 => { |
| 3773 |
let { |
| 3774 |
location: updatedLocation |
| 3775 |
} = _ref2; |
| 3776 |
setLocation(getLocationWithParams(updatedLocation)); |
| 3777 |
}); |
| 3778 |
}, []); |
| 3779 |
return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, { |
| 3780 |
value: utils_history |
| 3781 |
}, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, { |
| 3782 |
value: location |
| 3783 |
}, children(location))); |
| 3784 |
} |
| 3785 |
//# sourceMappingURL=index.js.map |
| 3786 |
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] |
| 3787 |
var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; |
| 3788 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js |
| 3789 |
|
| 3790 |
|
| 3791 |
/** |
| 3792 |
* WordPress dependencies |
| 3793 |
*/ |
| 3794 |
|
| 3795 |
const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 3796 |
xmlns: "http://www.w3.org/2000/svg", |
| 3797 |
viewBox: "0 0 24 24" |
| 3798 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 3799 |
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" |
| 3800 |
})); |
| 3801 |
/* harmony default export */ var library_plus = (plus); |
| 3802 |
//# sourceMappingURL=plus.js.map |
| 3803 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/list-view.js |
| 3804 |
|
| 3805 |
|
| 3806 |
/** |
| 3807 |
* WordPress dependencies |
| 3808 |
*/ |
| 3809 |
|
| 3810 |
const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 3811 |
viewBox: "0 0 24 24", |
| 3812 |
xmlns: "http://www.w3.org/2000/svg" |
| 3813 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 3814 |
d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" |
| 3815 |
})); |
| 3816 |
/* harmony default export */ var list_view = (listView); |
| 3817 |
//# sourceMappingURL=list-view.js.map |
| 3818 |
;// CONCATENATED MODULE: external ["wp","keycodes"] |
| 3819 |
var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; |
| 3820 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js |
| 3821 |
|
| 3822 |
|
| 3823 |
/** |
| 3824 |
* WordPress dependencies |
| 3825 |
*/ |
| 3826 |
|
| 3827 |
const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 3828 |
xmlns: "http://www.w3.org/2000/svg", |
| 3829 |
viewBox: "0 0 24 24" |
| 3830 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 3831 |
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" |
| 3832 |
})); |
| 3833 |
/* harmony default export */ var more_vertical = (moreVertical); |
| 3834 |
//# sourceMappingURL=more-vertical.js.map |
| 3835 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/external.js |
| 3836 |
|
| 3837 |
|
| 3838 |
/** |
| 3839 |
* WordPress dependencies |
| 3840 |
*/ |
| 3841 |
|
| 3842 |
const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 3843 |
xmlns: "http://www.w3.org/2000/svg", |
| 3844 |
viewBox: "0 0 24 24" |
| 3845 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 3846 |
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" |
| 3847 |
})); |
| 3848 |
/* harmony default export */ var library_external = (external); |
| 3849 |
//# sourceMappingURL=external.js.map |
| 3850 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js |
| 3851 |
/** |
| 3852 |
* WordPress dependencies |
| 3853 |
*/ |
| 3854 |
|
| 3855 |
const textFormattingShortcuts = [{ |
| 3856 |
keyCombination: { |
| 3857 |
modifier: 'primary', |
| 3858 |
character: 'b' |
| 3859 |
}, |
| 3860 |
description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') |
| 3861 |
}, { |
| 3862 |
keyCombination: { |
| 3863 |
modifier: 'primary', |
| 3864 |
character: 'i' |
| 3865 |
}, |
| 3866 |
description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') |
| 3867 |
}, { |
| 3868 |
keyCombination: { |
| 3869 |
modifier: 'primary', |
| 3870 |
character: 'k' |
| 3871 |
}, |
| 3872 |
description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') |
| 3873 |
}, { |
| 3874 |
keyCombination: { |
| 3875 |
modifier: 'primaryShift', |
| 3876 |
character: 'k' |
| 3877 |
}, |
| 3878 |
description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') |
| 3879 |
}, { |
| 3880 |
keyCombination: { |
| 3881 |
modifier: 'primary', |
| 3882 |
character: 'u' |
| 3883 |
}, |
| 3884 |
description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') |
| 3885 |
}]; |
| 3886 |
//# sourceMappingURL=config.js.map |
| 3887 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js |
| 3888 |
|
| 3889 |
|
| 3890 |
/** |
| 3891 |
* External dependencies |
| 3892 |
*/ |
| 3893 |
|
| 3894 |
/** |
| 3895 |
* WordPress dependencies |
| 3896 |
*/ |
| 3897 |
|
| 3898 |
|
| 3899 |
|
| 3900 |
|
| 3901 |
function KeyCombination(_ref) { |
| 3902 |
let { |
| 3903 |
keyCombination, |
| 3904 |
forceAriaLabel |
| 3905 |
} = _ref; |
| 3906 |
const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
| 3907 |
const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
| 3908 |
return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
| 3909 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination", |
| 3910 |
"aria-label": forceAriaLabel || ariaLabel |
| 3911 |
}, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => { |
| 3912 |
if (character === '+') { |
| 3913 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { |
| 3914 |
key: index |
| 3915 |
}, character); |
| 3916 |
} |
| 3917 |
|
| 3918 |
return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
| 3919 |
key: index, |
| 3920 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut-key" |
| 3921 |
}, character); |
| 3922 |
})); |
| 3923 |
} |
| 3924 |
|
| 3925 |
function Shortcut(_ref2) { |
| 3926 |
let { |
| 3927 |
description, |
| 3928 |
keyCombination, |
| 3929 |
aliases = [], |
| 3930 |
ariaLabel |
| 3931 |
} = _ref2; |
| 3932 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 3933 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut-description" |
| 3934 |
}, description), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 3935 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut-term" |
| 3936 |
}, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
| 3937 |
keyCombination: keyCombination, |
| 3938 |
forceAriaLabel: ariaLabel |
| 3939 |
}), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
| 3940 |
keyCombination: alias, |
| 3941 |
forceAriaLabel: ariaLabel, |
| 3942 |
key: index |
| 3943 |
})))); |
| 3944 |
} |
| 3945 |
//# sourceMappingURL=shortcut.js.map |
| 3946 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js |
| 3947 |
|
| 3948 |
|
| 3949 |
/** |
| 3950 |
* WordPress dependencies |
| 3951 |
*/ |
| 3952 |
|
| 3953 |
|
| 3954 |
/** |
| 3955 |
* Internal dependencies |
| 3956 |
*/ |
| 3957 |
|
| 3958 |
|
| 3959 |
function DynamicShortcut(_ref) { |
| 3960 |
let { |
| 3961 |
name |
| 3962 |
} = _ref; |
| 3963 |
const { |
| 3964 |
keyCombination, |
| 3965 |
description, |
| 3966 |
aliases |
| 3967 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 3968 |
const { |
| 3969 |
getShortcutKeyCombination, |
| 3970 |
getShortcutDescription, |
| 3971 |
getShortcutAliases |
| 3972 |
} = select(external_wp_keyboardShortcuts_namespaceObject.store); |
| 3973 |
return { |
| 3974 |
keyCombination: getShortcutKeyCombination(name), |
| 3975 |
aliases: getShortcutAliases(name), |
| 3976 |
description: getShortcutDescription(name) |
| 3977 |
}; |
| 3978 |
}, [name]); |
| 3979 |
|
| 3980 |
if (!keyCombination) { |
| 3981 |
return null; |
| 3982 |
} |
| 3983 |
|
| 3984 |
return (0,external_wp_element_namespaceObject.createElement)(Shortcut, { |
| 3985 |
keyCombination: keyCombination, |
| 3986 |
description: description, |
| 3987 |
aliases: aliases |
| 3988 |
}); |
| 3989 |
} |
| 3990 |
//# sourceMappingURL=dynamic-shortcut.js.map |
| 3991 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js |
| 3992 |
|
| 3993 |
|
| 3994 |
/** |
| 3995 |
* External dependencies |
| 3996 |
*/ |
| 3997 |
|
| 3998 |
|
| 3999 |
/** |
| 4000 |
* WordPress dependencies |
| 4001 |
*/ |
| 4002 |
|
| 4003 |
|
| 4004 |
|
| 4005 |
|
| 4006 |
|
| 4007 |
/** |
| 4008 |
* Internal dependencies |
| 4009 |
*/ |
| 4010 |
|
| 4011 |
|
| 4012 |
|
| 4013 |
|
| 4014 |
|
| 4015 |
const ShortcutList = _ref => { |
| 4016 |
let { |
| 4017 |
shortcuts |
| 4018 |
} = _ref; |
| 4019 |
return ( |
| 4020 |
/* |
| 4021 |
* Disable reason: The `list` ARIA role is redundant but |
| 4022 |
* Safari+VoiceOver won't announce the list otherwise. |
| 4023 |
*/ |
| 4024 |
|
| 4025 |
/* eslint-disable jsx-a11y/no-redundant-roles */ |
| 4026 |
(0,external_wp_element_namespaceObject.createElement)("ul", { |
| 4027 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut-list", |
| 4028 |
role: "list" |
| 4029 |
}, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { |
| 4030 |
className: "edit-site-keyboard-shortcut-help-modal__shortcut", |
| 4031 |
key: index |
| 4032 |
}, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(DynamicShortcut, { |
| 4033 |
name: shortcut |
| 4034 |
}) : (0,external_wp_element_namespaceObject.createElement)(Shortcut, shortcut)))) |
| 4035 |
/* eslint-enable jsx-a11y/no-redundant-roles */ |
| 4036 |
|
| 4037 |
); |
| 4038 |
}; |
| 4039 |
|
| 4040 |
const ShortcutSection = _ref2 => { |
| 4041 |
let { |
| 4042 |
title, |
| 4043 |
shortcuts, |
| 4044 |
className |
| 4045 |
} = _ref2; |
| 4046 |
return (0,external_wp_element_namespaceObject.createElement)("section", { |
| 4047 |
className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className) |
| 4048 |
}, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { |
| 4049 |
className: "edit-site-keyboard-shortcut-help-modal__section-title" |
| 4050 |
}, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { |
| 4051 |
shortcuts: shortcuts |
| 4052 |
})); |
| 4053 |
}; |
| 4054 |
|
| 4055 |
const ShortcutCategorySection = _ref3 => { |
| 4056 |
let { |
| 4057 |
title, |
| 4058 |
categoryName, |
| 4059 |
additionalShortcuts = [] |
| 4060 |
} = _ref3; |
| 4061 |
const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 4062 |
return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); |
| 4063 |
}, [categoryName]); |
| 4064 |
return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
| 4065 |
title: title, |
| 4066 |
shortcuts: categoryShortcuts.concat(additionalShortcuts) |
| 4067 |
}); |
| 4068 |
}; |
| 4069 |
|
| 4070 |
function KeyboardShortcutHelpModal(_ref4) { |
| 4071 |
let { |
| 4072 |
isModalActive, |
| 4073 |
toggleModal |
| 4074 |
} = _ref4; |
| 4075 |
|
| 4076 |
if (!isModalActive) { |
| 4077 |
return null; |
| 4078 |
} |
| 4079 |
|
| 4080 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
| 4081 |
className: "edit-site-keyboard-shortcut-help-modal", |
| 4082 |
title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), |
| 4083 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
| 4084 |
onRequestClose: toggleModal |
| 4085 |
}, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
| 4086 |
className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts", |
| 4087 |
shortcuts: ['core/edit-site/keyboard-shortcuts'] |
| 4088 |
}), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
| 4089 |
title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), |
| 4090 |
categoryName: "global" |
| 4091 |
}), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
| 4092 |
title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), |
| 4093 |
categoryName: "selection" |
| 4094 |
}), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
| 4095 |
title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), |
| 4096 |
categoryName: "block", |
| 4097 |
additionalShortcuts: [{ |
| 4098 |
keyCombination: { |
| 4099 |
character: '/' |
| 4100 |
}, |
| 4101 |
description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), |
| 4102 |
|
| 4103 |
/* translators: The forward-slash character. e.g. '/'. */ |
| 4104 |
ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') |
| 4105 |
}] |
| 4106 |
}), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
| 4107 |
title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), |
| 4108 |
shortcuts: textFormattingShortcuts |
| 4109 |
})); |
| 4110 |
} |
| 4111 |
//# sourceMappingURL=index.js.map |
| 4112 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/feature-toggle/index.js |
| 4113 |
|
| 4114 |
|
| 4115 |
/** |
| 4116 |
* External dependencies |
| 4117 |
*/ |
| 4118 |
|
| 4119 |
/** |
| 4120 |
* WordPress dependencies |
| 4121 |
*/ |
| 4122 |
|
| 4123 |
|
| 4124 |
|
| 4125 |
|
| 4126 |
|
| 4127 |
|
| 4128 |
/** |
| 4129 |
* Internal dependencies |
| 4130 |
*/ |
| 4131 |
|
| 4132 |
|
| 4133 |
function FeatureToggle(_ref) { |
| 4134 |
let { |
| 4135 |
feature, |
| 4136 |
label, |
| 4137 |
info, |
| 4138 |
messageActivated, |
| 4139 |
messageDeactivated |
| 4140 |
} = _ref; |
| 4141 |
|
| 4142 |
const speakMessage = () => { |
| 4143 |
if (isActive) { |
| 4144 |
(0,external_wp_a11y_namespaceObject.speak)(messageDeactivated || (0,external_wp_i18n_namespaceObject.__)('Feature deactivated')); |
| 4145 |
} else { |
| 4146 |
(0,external_wp_a11y_namespaceObject.speak)(messageActivated || (0,external_wp_i18n_namespaceObject.__)('Feature activated')); |
| 4147 |
} |
| 4148 |
}; |
| 4149 |
|
| 4150 |
const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 4151 |
return select(store_store).isFeatureActive(feature); |
| 4152 |
}, []); |
| 4153 |
const { |
| 4154 |
toggleFeature |
| 4155 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 4156 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4157 |
icon: isActive && library_check, |
| 4158 |
isSelected: isActive, |
| 4159 |
onClick: (0,external_lodash_namespaceObject.flow)(toggleFeature.bind(null, feature), speakMessage), |
| 4160 |
role: "menuitemcheckbox", |
| 4161 |
info: info |
| 4162 |
}, label); |
| 4163 |
} |
| 4164 |
//# sourceMappingURL=index.js.map |
| 4165 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/tools-more-menu-group/index.js |
| 4166 |
|
| 4167 |
|
| 4168 |
/** |
| 4169 |
* External dependencies |
| 4170 |
*/ |
| 4171 |
|
| 4172 |
/** |
| 4173 |
* WordPress dependencies |
| 4174 |
*/ |
| 4175 |
|
| 4176 |
|
| 4177 |
const { |
| 4178 |
Fill: ToolsMoreMenuGroup, |
| 4179 |
Slot |
| 4180 |
} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup'); |
| 4181 |
|
| 4182 |
ToolsMoreMenuGroup.Slot = _ref => { |
| 4183 |
let { |
| 4184 |
fillProps |
| 4185 |
} = _ref; |
| 4186 |
return (0,external_wp_element_namespaceObject.createElement)(Slot, { |
| 4187 |
fillProps: fillProps |
| 4188 |
}, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills); |
| 4189 |
}; |
| 4190 |
|
| 4191 |
/* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); |
| 4192 |
//# sourceMappingURL=index.js.map |
| 4193 |
// EXTERNAL MODULE: ./node_modules/downloadjs/download.js |
| 4194 |
var download = __webpack_require__(3729); |
| 4195 |
var download_default = /*#__PURE__*/__webpack_require__.n(download); |
| 4196 |
;// CONCATENATED MODULE: external ["wp","apiFetch"] |
| 4197 |
var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
| 4198 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
| 4199 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/download.js |
| 4200 |
|
| 4201 |
|
| 4202 |
/** |
| 4203 |
* WordPress dependencies |
| 4204 |
*/ |
| 4205 |
|
| 4206 |
const download_download = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 4207 |
xmlns: "http://www.w3.org/2000/svg", |
| 4208 |
viewBox: "0 0 24 24" |
| 4209 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 4210 |
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" |
| 4211 |
})); |
| 4212 |
/* harmony default export */ var library_download = (download_download); |
| 4213 |
//# sourceMappingURL=download.js.map |
| 4214 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/more-menu/site-export.js |
| 4215 |
|
| 4216 |
|
| 4217 |
/** |
| 4218 |
* External dependencies |
| 4219 |
*/ |
| 4220 |
|
| 4221 |
/** |
| 4222 |
* WordPress dependencies |
| 4223 |
*/ |
| 4224 |
|
| 4225 |
|
| 4226 |
|
| 4227 |
|
| 4228 |
|
| 4229 |
|
| 4230 |
|
| 4231 |
function SiteExport() { |
| 4232 |
const { |
| 4233 |
createErrorNotice |
| 4234 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 4235 |
|
| 4236 |
async function handleExport() { |
| 4237 |
try { |
| 4238 |
const response = await external_wp_apiFetch_default()({ |
| 4239 |
path: '/wp-block-editor/v1/export', |
| 4240 |
parse: false |
| 4241 |
}); |
| 4242 |
const blob = await response.blob(); |
| 4243 |
download_default()(blob, 'edit-site-export.zip', 'application/zip'); |
| 4244 |
} catch (errorResponse) { |
| 4245 |
let error = {}; |
| 4246 |
|
| 4247 |
try { |
| 4248 |
error = await errorResponse.json(); |
| 4249 |
} catch (e) {} |
| 4250 |
|
| 4251 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); |
| 4252 |
createErrorNotice(errorMessage, { |
| 4253 |
type: 'snackbar' |
| 4254 |
}); |
| 4255 |
} |
| 4256 |
} |
| 4257 |
|
| 4258 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4259 |
role: "menuitem", |
| 4260 |
icon: library_download, |
| 4261 |
onClick: handleExport, |
| 4262 |
info: (0,external_wp_i18n_namespaceObject.__)('Download your templates and template parts.') |
| 4263 |
}, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item')); |
| 4264 |
} |
| 4265 |
//# sourceMappingURL=site-export.js.map |
| 4266 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/more-menu/welcome-guide-menu-item.js |
| 4267 |
|
| 4268 |
|
| 4269 |
/** |
| 4270 |
* WordPress dependencies |
| 4271 |
*/ |
| 4272 |
|
| 4273 |
|
| 4274 |
|
| 4275 |
/** |
| 4276 |
* Internal dependencies |
| 4277 |
*/ |
| 4278 |
|
| 4279 |
|
| 4280 |
function WelcomeGuideMenuItem() { |
| 4281 |
const { |
| 4282 |
toggleFeature |
| 4283 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 4284 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4285 |
onClick: () => toggleFeature('welcomeGuide') |
| 4286 |
}, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')); |
| 4287 |
} |
| 4288 |
//# sourceMappingURL=welcome-guide-menu-item.js.map |
| 4289 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/more-menu/copy-content-menu-item.js |
| 4290 |
|
| 4291 |
|
| 4292 |
/** |
| 4293 |
* WordPress dependencies |
| 4294 |
*/ |
| 4295 |
|
| 4296 |
|
| 4297 |
|
| 4298 |
|
| 4299 |
|
| 4300 |
|
| 4301 |
|
| 4302 |
/** |
| 4303 |
* Internal dependencies |
| 4304 |
*/ |
| 4305 |
|
| 4306 |
|
| 4307 |
function CopyContentMenuItem() { |
| 4308 |
const { |
| 4309 |
createNotice |
| 4310 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 4311 |
const getText = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 4312 |
return () => { |
| 4313 |
const { |
| 4314 |
getEditedPostId, |
| 4315 |
getEditedPostType |
| 4316 |
} = select(store_store); |
| 4317 |
const { |
| 4318 |
getEditedEntityRecord |
| 4319 |
} = select(external_wp_coreData_namespaceObject.store); |
| 4320 |
const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId()); |
| 4321 |
|
| 4322 |
if (record) { |
| 4323 |
if (typeof record.content === 'function') { |
| 4324 |
return record.content(record); |
| 4325 |
} else if (record.blocks) { |
| 4326 |
return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); |
| 4327 |
} else if (record.content) { |
| 4328 |
return record.content; |
| 4329 |
} |
| 4330 |
} |
| 4331 |
|
| 4332 |
return ''; |
| 4333 |
}; |
| 4334 |
}, []); |
| 4335 |
|
| 4336 |
function onSuccess() { |
| 4337 |
createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { |
| 4338 |
isDismissible: true, |
| 4339 |
type: 'snackbar' |
| 4340 |
}); |
| 4341 |
} |
| 4342 |
|
| 4343 |
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); |
| 4344 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4345 |
ref: ref |
| 4346 |
}, (0,external_wp_i18n_namespaceObject.__)('Copy all content')); |
| 4347 |
} |
| 4348 |
//# sourceMappingURL=copy-content-menu-item.js.map |
| 4349 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/mode-switcher/index.js |
| 4350 |
|
| 4351 |
|
| 4352 |
/** |
| 4353 |
* WordPress dependencies |
| 4354 |
*/ |
| 4355 |
|
| 4356 |
|
| 4357 |
|
| 4358 |
|
| 4359 |
/** |
| 4360 |
* Internal dependencies |
| 4361 |
*/ |
| 4362 |
|
| 4363 |
/** |
| 4364 |
* Internal dependencies |
| 4365 |
*/ |
| 4366 |
|
| 4367 |
|
| 4368 |
/** |
| 4369 |
* Set of available mode options. |
| 4370 |
* |
| 4371 |
* @type {Array} |
| 4372 |
*/ |
| 4373 |
|
| 4374 |
const MODES = [{ |
| 4375 |
value: 'visual', |
| 4376 |
label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') |
| 4377 |
}, { |
| 4378 |
value: 'text', |
| 4379 |
label: (0,external_wp_i18n_namespaceObject.__)('Code editor') |
| 4380 |
}]; |
| 4381 |
|
| 4382 |
function ModeSwitcher() { |
| 4383 |
const { |
| 4384 |
shortcut, |
| 4385 |
mode |
| 4386 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
| 4387 |
shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'), |
| 4388 |
isRichEditingEnabled: select(store_store).getSettings().richEditingEnabled, |
| 4389 |
isCodeEditingEnabled: select(store_store).getSettings().codeEditingEnabled, |
| 4390 |
mode: select(store_store).getEditorMode() |
| 4391 |
}), []); |
| 4392 |
const { |
| 4393 |
switchEditorMode |
| 4394 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 4395 |
const choices = MODES.map(choice => { |
| 4396 |
if (choice.value !== mode) { |
| 4397 |
return { ...choice, |
| 4398 |
shortcut |
| 4399 |
}; |
| 4400 |
} |
| 4401 |
|
| 4402 |
return choice; |
| 4403 |
}); |
| 4404 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 4405 |
label: (0,external_wp_i18n_namespaceObject.__)('Editor') |
| 4406 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { |
| 4407 |
choices: choices, |
| 4408 |
value: mode, |
| 4409 |
onSelect: switchEditorMode |
| 4410 |
})); |
| 4411 |
} |
| 4412 |
|
| 4413 |
/* harmony default export */ var mode_switcher = (ModeSwitcher); |
| 4414 |
//# sourceMappingURL=index.js.map |
| 4415 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/more-menu/index.js |
| 4416 |
|
| 4417 |
|
| 4418 |
/** |
| 4419 |
* WordPress dependencies |
| 4420 |
*/ |
| 4421 |
|
| 4422 |
|
| 4423 |
|
| 4424 |
|
| 4425 |
|
| 4426 |
|
| 4427 |
|
| 4428 |
/** |
| 4429 |
* Internal dependencies |
| 4430 |
*/ |
| 4431 |
|
| 4432 |
|
| 4433 |
|
| 4434 |
|
| 4435 |
|
| 4436 |
|
| 4437 |
|
| 4438 |
|
| 4439 |
const POPOVER_PROPS = { |
| 4440 |
className: 'edit-site-more-menu__content', |
| 4441 |
position: 'bottom left' |
| 4442 |
}; |
| 4443 |
const TOGGLE_PROPS = { |
| 4444 |
tooltipPosition: 'bottom' |
| 4445 |
}; |
| 4446 |
function MoreMenu() { |
| 4447 |
const [isModalActive, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); |
| 4448 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal); |
| 4449 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
| 4450 |
className: "edit-site-more-menu", |
| 4451 |
icon: more_vertical, |
| 4452 |
label: (0,external_wp_i18n_namespaceObject.__)('More tools & options'), |
| 4453 |
popoverProps: POPOVER_PROPS, |
| 4454 |
toggleProps: TOGGLE_PROPS |
| 4455 |
}, _ref => { |
| 4456 |
let { |
| 4457 |
onClose |
| 4458 |
} = _ref; |
| 4459 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 4460 |
label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') |
| 4461 |
}, (0,external_wp_element_namespaceObject.createElement)(FeatureToggle, { |
| 4462 |
feature: "fixedToolbar", |
| 4463 |
label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), |
| 4464 |
info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), |
| 4465 |
messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), |
| 4466 |
messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') |
| 4467 |
}), (0,external_wp_element_namespaceObject.createElement)(FeatureToggle, { |
| 4468 |
feature: "focusMode", |
| 4469 |
label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), |
| 4470 |
info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), |
| 4471 |
messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), |
| 4472 |
messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') |
| 4473 |
}), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, { |
| 4474 |
name: "core/edit-site/plugin-more-menu", |
| 4475 |
label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), |
| 4476 |
as: external_wp_components_namespaceObject.MenuGroup, |
| 4477 |
fillProps: { |
| 4478 |
onClick: onClose |
| 4479 |
} |
| 4480 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 4481 |
label: (0,external_wp_i18n_namespaceObject.__)('Tools') |
| 4482 |
}, (0,external_wp_element_namespaceObject.createElement)(SiteExport, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4483 |
onClick: toggleModal, |
| 4484 |
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') |
| 4485 |
}, (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, { |
| 4486 |
icon: library_external, |
| 4487 |
role: "menuitem", |
| 4488 |
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/site-editor/'), |
| 4489 |
target: "_blank", |
| 4490 |
rel: "noopener noreferrer" |
| 4491 |
}, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
| 4492 |
as: "span" |
| 4493 |
}, |
| 4494 |
/* translators: accessibility text */ |
| 4495 |
(0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { |
| 4496 |
fillProps: { |
| 4497 |
onClose |
| 4498 |
} |
| 4499 |
}))); |
| 4500 |
}), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, { |
| 4501 |
isModalActive: isModalActive, |
| 4502 |
toggleModal: toggleModal |
| 4503 |
})); |
| 4504 |
} |
| 4505 |
//# sourceMappingURL=index.js.map |
| 4506 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/save-button/index.js |
| 4507 |
|
| 4508 |
|
| 4509 |
/** |
| 4510 |
* External dependencies |
| 4511 |
*/ |
| 4512 |
|
| 4513 |
/** |
| 4514 |
* WordPress dependencies |
| 4515 |
*/ |
| 4516 |
|
| 4517 |
|
| 4518 |
|
| 4519 |
|
| 4520 |
|
| 4521 |
function SaveButton(_ref) { |
| 4522 |
let { |
| 4523 |
openEntitiesSavedStates, |
| 4524 |
isEntitiesSavedStatesOpen |
| 4525 |
} = _ref; |
| 4526 |
const { |
| 4527 |
isDirty, |
| 4528 |
isSaving |
| 4529 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 4530 |
const { |
| 4531 |
__experimentalGetDirtyEntityRecords, |
| 4532 |
isSavingEntityRecord |
| 4533 |
} = select(external_wp_coreData_namespaceObject.store); |
| 4534 |
|
| 4535 |
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
| 4536 |
|
| 4537 |
return { |
| 4538 |
isDirty: dirtyEntityRecords.length > 0, |
| 4539 |
isSaving: (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key)) |
| 4540 |
}; |
| 4541 |
}, []); |
| 4542 |
const disabled = !isDirty || isSaving; |
| 4543 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 4544 |
variant: "primary", |
| 4545 |
className: "edit-site-save-button__button", |
| 4546 |
"aria-disabled": disabled, |
| 4547 |
"aria-expanded": isEntitiesSavedStatesOpen, |
| 4548 |
disabled: disabled, |
| 4549 |
isBusy: isSaving, |
| 4550 |
onClick: disabled ? undefined : openEntitiesSavedStates |
| 4551 |
}, (0,external_wp_i18n_namespaceObject.__)('Save'))); |
| 4552 |
} |
| 4553 |
//# sourceMappingURL=index.js.map |
| 4554 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/undo.js |
| 4555 |
|
| 4556 |
|
| 4557 |
/** |
| 4558 |
* WordPress dependencies |
| 4559 |
*/ |
| 4560 |
|
| 4561 |
const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 4562 |
xmlns: "http://www.w3.org/2000/svg", |
| 4563 |
viewBox: "0 0 24 24" |
| 4564 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 4565 |
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" |
| 4566 |
})); |
| 4567 |
/* harmony default export */ var library_undo = (undo); |
| 4568 |
//# sourceMappingURL=undo.js.map |
| 4569 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/redo.js |
| 4570 |
|
| 4571 |
|
| 4572 |
/** |
| 4573 |
* WordPress dependencies |
| 4574 |
*/ |
| 4575 |
|
| 4576 |
const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 4577 |
xmlns: "http://www.w3.org/2000/svg", |
| 4578 |
viewBox: "0 0 24 24" |
| 4579 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 4580 |
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" |
| 4581 |
})); |
| 4582 |
/* harmony default export */ var library_redo = (redo); |
| 4583 |
//# sourceMappingURL=redo.js.map |
| 4584 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/undo-redo/undo.js |
| 4585 |
|
| 4586 |
|
| 4587 |
/** |
| 4588 |
* WordPress dependencies |
| 4589 |
*/ |
| 4590 |
|
| 4591 |
|
| 4592 |
|
| 4593 |
|
| 4594 |
|
| 4595 |
|
| 4596 |
function UndoButton() { |
| 4597 |
const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []); |
| 4598 |
const { |
| 4599 |
undo |
| 4600 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 4601 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 4602 |
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo, |
| 4603 |
label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
| 4604 |
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this |
| 4605 |
// button, because it will remove focus for keyboard users. |
| 4606 |
// See: https://github.com/WordPress/gutenberg/issues/3486 |
| 4607 |
, |
| 4608 |
"aria-disabled": !hasUndo, |
| 4609 |
onClick: hasUndo ? undo : undefined |
| 4610 |
}); |
| 4611 |
} |
| 4612 |
//# sourceMappingURL=undo.js.map |
| 4613 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/undo-redo/redo.js |
| 4614 |
|
| 4615 |
|
| 4616 |
/** |
| 4617 |
* WordPress dependencies |
| 4618 |
*/ |
| 4619 |
|
| 4620 |
|
| 4621 |
|
| 4622 |
|
| 4623 |
|
| 4624 |
|
| 4625 |
function RedoButton() { |
| 4626 |
const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []); |
| 4627 |
const { |
| 4628 |
redo |
| 4629 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 4630 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 4631 |
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo, |
| 4632 |
label: (0,external_wp_i18n_namespaceObject.__)('Redo'), |
| 4633 |
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this |
| 4634 |
// button, because it will remove focus for keyboard users. |
| 4635 |
// See: https://github.com/WordPress/gutenberg/issues/3486 |
| 4636 |
, |
| 4637 |
"aria-disabled": !hasRedo, |
| 4638 |
onClick: hasRedo ? redo : undefined |
| 4639 |
}); |
| 4640 |
} |
| 4641 |
//# sourceMappingURL=redo.js.map |
| 4642 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-down.js |
| 4643 |
|
| 4644 |
|
| 4645 |
/** |
| 4646 |
* WordPress dependencies |
| 4647 |
*/ |
| 4648 |
|
| 4649 |
const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 4650 |
viewBox: "0 0 24 24", |
| 4651 |
xmlns: "http://www.w3.org/2000/svg" |
| 4652 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 4653 |
d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" |
| 4654 |
})); |
| 4655 |
/* harmony default export */ var chevron_down = (chevronDown); |
| 4656 |
//# sourceMappingURL=chevron-down.js.map |
| 4657 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/document-actions/index.js |
| 4658 |
|
| 4659 |
|
| 4660 |
/** |
| 4661 |
* External dependencies |
| 4662 |
*/ |
| 4663 |
|
| 4664 |
/** |
| 4665 |
* WordPress dependencies |
| 4666 |
*/ |
| 4667 |
|
| 4668 |
|
| 4669 |
|
| 4670 |
|
| 4671 |
|
| 4672 |
|
| 4673 |
|
| 4674 |
|
| 4675 |
|
| 4676 |
function getBlockDisplayText(block) { |
| 4677 |
if (block) { |
| 4678 |
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); |
| 4679 |
return blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, block.attributes) : null; |
| 4680 |
} |
| 4681 |
|
| 4682 |
return null; |
| 4683 |
} |
| 4684 |
|
| 4685 |
function useSecondaryText() { |
| 4686 |
const { |
| 4687 |
getBlock |
| 4688 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); |
| 4689 |
const activeEntityBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetActiveBlockIdByBlockNames(['core/template-part']), []); |
| 4690 |
|
| 4691 |
if (activeEntityBlockId) { |
| 4692 |
return { |
| 4693 |
label: getBlockDisplayText(getBlock(activeEntityBlockId)), |
| 4694 |
isActive: true |
| 4695 |
}; |
| 4696 |
} |
| 4697 |
|
| 4698 |
return {}; |
| 4699 |
} |
| 4700 |
/** |
| 4701 |
* @param {Object} props Props for the DocumentActions component. |
| 4702 |
* @param {string} props.entityTitle The title to display. |
| 4703 |
* @param {string} props.entityLabel A label to use for entity-related options. |
| 4704 |
* E.g. "template" would be used for "edit |
| 4705 |
* template" and "show template details". |
| 4706 |
* @param {boolean} props.isLoaded Whether the data is available. |
| 4707 |
* @param {Function} props.children React component to use for the |
| 4708 |
* information dropdown area. Should be a |
| 4709 |
* function which accepts dropdown props. |
| 4710 |
*/ |
| 4711 |
|
| 4712 |
|
| 4713 |
function DocumentActions(_ref) { |
| 4714 |
let { |
| 4715 |
entityTitle, |
| 4716 |
entityLabel, |
| 4717 |
isLoaded, |
| 4718 |
children: dropdownContent |
| 4719 |
} = _ref; |
| 4720 |
const { |
| 4721 |
label |
| 4722 |
} = useSecondaryText(); // The title ref is passed to the popover as the anchorRef so that the |
| 4723 |
// dropdown is centered over the whole title area rather than just one |
| 4724 |
// part of it. |
| 4725 |
|
| 4726 |
const titleRef = (0,external_wp_element_namespaceObject.useRef)(); // Return a simple loading indicator until we have information to show. |
| 4727 |
|
| 4728 |
if (!isLoaded) { |
| 4729 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 4730 |
className: "edit-site-document-actions" |
| 4731 |
}, (0,external_wp_i18n_namespaceObject.__)('Loading…')); |
| 4732 |
} // Return feedback that the template does not seem to exist. |
| 4733 |
|
| 4734 |
|
| 4735 |
if (!entityTitle) { |
| 4736 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 4737 |
className: "edit-site-document-actions" |
| 4738 |
}, (0,external_wp_i18n_namespaceObject.__)('Template not found')); |
| 4739 |
} |
| 4740 |
|
| 4741 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 4742 |
className: classnames_default()('edit-site-document-actions', { |
| 4743 |
'has-secondary-label': !!label |
| 4744 |
}) |
| 4745 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 4746 |
ref: titleRef, |
| 4747 |
className: "edit-site-document-actions__title-wrapper" |
| 4748 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
| 4749 |
size: "body", |
| 4750 |
className: "edit-site-document-actions__title", |
| 4751 |
as: "h1" |
| 4752 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
| 4753 |
as: "span" |
| 4754 |
}, (0,external_wp_i18n_namespaceObject.sprintf)( |
| 4755 |
/* translators: %s: the entity being edited, like "template"*/ |
| 4756 |
(0,external_wp_i18n_namespaceObject.__)('Editing %s: '), entityLabel)), entityTitle), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
| 4757 |
size: "body", |
| 4758 |
className: "edit-site-document-actions__secondary-item" |
| 4759 |
}, label !== null && label !== void 0 ? label : ''), dropdownContent && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
| 4760 |
popoverProps: { |
| 4761 |
anchorRef: titleRef.current |
| 4762 |
}, |
| 4763 |
position: "bottom center", |
| 4764 |
renderToggle: _ref2 => { |
| 4765 |
let { |
| 4766 |
isOpen, |
| 4767 |
onToggle |
| 4768 |
} = _ref2; |
| 4769 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 4770 |
className: "edit-site-document-actions__get-info", |
| 4771 |
icon: chevron_down, |
| 4772 |
"aria-expanded": isOpen, |
| 4773 |
"aria-haspopup": "true", |
| 4774 |
onClick: onToggle, |
| 4775 |
label: (0,external_wp_i18n_namespaceObject.sprintf)( |
| 4776 |
/* translators: %s: the entity to see details about, like "template"*/ |
| 4777 |
(0,external_wp_i18n_namespaceObject.__)('Show %s details'), entityLabel) |
| 4778 |
}); |
| 4779 |
}, |
| 4780 |
contentClassName: "edit-site-document-actions__info-dropdown", |
| 4781 |
renderContent: dropdownContent |
| 4782 |
}))); |
| 4783 |
} |
| 4784 |
//# sourceMappingURL=index.js.map |
| 4785 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/routes/link.js |
| 4786 |
|
| 4787 |
|
| 4788 |
|
| 4789 |
/** |
| 4790 |
* WordPress dependencies |
| 4791 |
*/ |
| 4792 |
|
| 4793 |
/** |
| 4794 |
* Internal dependencies |
| 4795 |
*/ |
| 4796 |
|
| 4797 |
|
| 4798 |
function useLink() { |
| 4799 |
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 4800 |
let state = arguments.length > 1 ? arguments[1] : undefined; |
| 4801 |
let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
| 4802 |
const history = useHistory(); |
| 4803 |
|
| 4804 |
function onClick(event) { |
| 4805 |
event.preventDefault(); |
| 4806 |
|
| 4807 |
if (shouldReplace) { |
| 4808 |
history.replace(params, state); |
| 4809 |
} else { |
| 4810 |
history.push(params, state); |
| 4811 |
} |
| 4812 |
} |
| 4813 |
|
| 4814 |
return { |
| 4815 |
href: (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), |
| 4816 |
onClick |
| 4817 |
}; |
| 4818 |
} |
| 4819 |
function Link(_ref) { |
| 4820 |
let { |
| 4821 |
params = {}, |
| 4822 |
state, |
| 4823 |
replace: shouldReplace = false, |
| 4824 |
children, |
| 4825 |
...props |
| 4826 |
} = _ref; |
| 4827 |
const { |
| 4828 |
href, |
| 4829 |
onClick |
| 4830 |
} = useLink(params, state, shouldReplace); |
| 4831 |
return (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({ |
| 4832 |
href: href, |
| 4833 |
onClick: onClick |
| 4834 |
}, props), children); |
| 4835 |
} |
| 4836 |
//# sourceMappingURL=link.js.map |
| 4837 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-details/template-areas.js |
| 4838 |
|
| 4839 |
|
| 4840 |
|
| 4841 |
/** |
| 4842 |
* WordPress dependencies |
| 4843 |
*/ |
| 4844 |
|
| 4845 |
|
| 4846 |
|
| 4847 |
|
| 4848 |
|
| 4849 |
|
| 4850 |
/** |
| 4851 |
* Internal dependencies |
| 4852 |
*/ |
| 4853 |
|
| 4854 |
|
| 4855 |
|
| 4856 |
|
| 4857 |
|
| 4858 |
|
| 4859 |
function TemplatePartItemMore(_ref) { |
| 4860 |
var _templatePart$title; |
| 4861 |
|
| 4862 |
let { |
| 4863 |
onClose, |
| 4864 |
templatePart, |
| 4865 |
closeTemplateDetailsDropdown |
| 4866 |
} = _ref; |
| 4867 |
const { |
| 4868 |
revertTemplate |
| 4869 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 4870 |
const { |
| 4871 |
params |
| 4872 |
} = useLocation(); |
| 4873 |
const editLinkProps = useLink({ |
| 4874 |
postId: templatePart.id, |
| 4875 |
postType: templatePart.type |
| 4876 |
}, { |
| 4877 |
fromTemplateId: params.postId |
| 4878 |
}); |
| 4879 |
|
| 4880 |
function editTemplatePart(event) { |
| 4881 |
editLinkProps.onClick(event); |
| 4882 |
onClose(); |
| 4883 |
closeTemplateDetailsDropdown(); |
| 4884 |
} |
| 4885 |
|
| 4886 |
function clearCustomizations() { |
| 4887 |
revertTemplate(templatePart); |
| 4888 |
onClose(); |
| 4889 |
closeTemplateDetailsDropdown(); |
| 4890 |
} |
| 4891 |
|
| 4892 |
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, { |
| 4893 |
onClick: editTemplatePart |
| 4894 |
}), (0,external_wp_i18n_namespaceObject.sprintf)( |
| 4895 |
/* translators: %s: template part title */ |
| 4896 |
(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, { |
| 4897 |
info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), |
| 4898 |
onClick: clearCustomizations |
| 4899 |
}, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')))); |
| 4900 |
} |
| 4901 |
|
| 4902 |
function TemplatePartItem(_ref2) { |
| 4903 |
let { |
| 4904 |
templatePart, |
| 4905 |
clientId, |
| 4906 |
closeTemplateDetailsDropdown |
| 4907 |
} = _ref2; |
| 4908 |
const { |
| 4909 |
selectBlock, |
| 4910 |
toggleBlockHighlight |
| 4911 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 4912 |
const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 4913 |
const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); |
| 4914 |
|
| 4915 |
return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area); |
| 4916 |
}, [templatePart.area]); |
| 4917 |
|
| 4918 |
const highlightBlock = () => toggleBlockHighlight(clientId, true); |
| 4919 |
|
| 4920 |
const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); |
| 4921 |
|
| 4922 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 4923 |
role: "menuitem", |
| 4924 |
className: "edit-site-template-details__template-areas-item" |
| 4925 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 4926 |
role: "button", |
| 4927 |
icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, |
| 4928 |
iconPosition: "left", |
| 4929 |
onClick: () => { |
| 4930 |
selectBlock(clientId); |
| 4931 |
}, |
| 4932 |
onMouseOver: highlightBlock, |
| 4933 |
onMouseLeave: cancelHighlightBlock, |
| 4934 |
onFocus: highlightBlock, |
| 4935 |
onBlur: cancelHighlightBlock |
| 4936 |
}, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
| 4937 |
icon: more_vertical, |
| 4938 |
label: (0,external_wp_i18n_namespaceObject.__)('More options'), |
| 4939 |
className: "edit-site-template-details__template-areas-item-more" |
| 4940 |
}, _ref3 => { |
| 4941 |
let { |
| 4942 |
onClose |
| 4943 |
} = _ref3; |
| 4944 |
return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItemMore, { |
| 4945 |
onClose: onClose, |
| 4946 |
templatePart: templatePart, |
| 4947 |
closeTemplateDetailsDropdown: closeTemplateDetailsDropdown |
| 4948 |
}); |
| 4949 |
})); |
| 4950 |
} |
| 4951 |
|
| 4952 |
function TemplateAreas(_ref4) { |
| 4953 |
let { |
| 4954 |
closeTemplateDetailsDropdown |
| 4955 |
} = _ref4; |
| 4956 |
const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); |
| 4957 |
|
| 4958 |
if (!templateParts.length) { |
| 4959 |
return null; |
| 4960 |
} |
| 4961 |
|
| 4962 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 4963 |
label: (0,external_wp_i18n_namespaceObject.__)('Areas'), |
| 4964 |
className: "edit-site-template-details__group edit-site-template-details__template-areas" |
| 4965 |
}, templateParts.map(_ref5 => { |
| 4966 |
let { |
| 4967 |
templatePart, |
| 4968 |
block |
| 4969 |
} = _ref5; |
| 4970 |
return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItem, { |
| 4971 |
key: templatePart.slug, |
| 4972 |
clientId: block.clientId, |
| 4973 |
templatePart: templatePart, |
| 4974 |
closeTemplateDetailsDropdown: closeTemplateDetailsDropdown |
| 4975 |
}); |
| 4976 |
})); |
| 4977 |
} |
| 4978 |
//# sourceMappingURL=template-areas.js.map |
| 4979 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-details/edit-template-title.js |
| 4980 |
|
| 4981 |
|
| 4982 |
/** |
| 4983 |
* WordPress dependencies |
| 4984 |
*/ |
| 4985 |
|
| 4986 |
|
| 4987 |
|
| 4988 |
function EditTemplateTitle(_ref) { |
| 4989 |
let { |
| 4990 |
template |
| 4991 |
} = _ref; |
| 4992 |
const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', template.type, 'title', template.id); |
| 4993 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
| 4994 |
label: (0,external_wp_i18n_namespaceObject.__)('Title'), |
| 4995 |
value: title, |
| 4996 |
help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'), |
| 4997 |
onChange: newTitle => { |
| 4998 |
setTitle(newTitle || template.slug); |
| 4999 |
} |
| 5000 |
}); |
| 5001 |
} |
| 5002 |
//# sourceMappingURL=edit-template-title.js.map |
| 5003 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-details/index.js |
| 5004 |
|
| 5005 |
|
| 5006 |
|
| 5007 |
/** |
| 5008 |
* WordPress dependencies |
| 5009 |
*/ |
| 5010 |
|
| 5011 |
|
| 5012 |
|
| 5013 |
|
| 5014 |
|
| 5015 |
/** |
| 5016 |
* Internal dependencies |
| 5017 |
*/ |
| 5018 |
|
| 5019 |
|
| 5020 |
|
| 5021 |
|
| 5022 |
|
| 5023 |
|
| 5024 |
|
| 5025 |
function TemplateDetails(_ref) { |
| 5026 |
let { |
| 5027 |
template, |
| 5028 |
onClose |
| 5029 |
} = _ref; |
| 5030 |
const { |
| 5031 |
title, |
| 5032 |
description |
| 5033 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetTemplateInfo(template), []); |
| 5034 |
const { |
| 5035 |
revertTemplate |
| 5036 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 5037 |
const templateSubMenu = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 5038 |
if ((template === null || template === void 0 ? void 0 : template.type) === 'wp_template') { |
| 5039 |
return { |
| 5040 |
title: (0,external_wp_i18n_namespaceObject.__)('templates'), |
| 5041 |
menu: MENU_TEMPLATES |
| 5042 |
}; |
| 5043 |
} |
| 5044 |
|
| 5045 |
return TEMPLATE_PARTS_SUB_MENUS.find(_ref2 => { |
| 5046 |
let { |
| 5047 |
area |
| 5048 |
} = _ref2; |
| 5049 |
return area === (template === null || template === void 0 ? void 0 : template.area); |
| 5050 |
}); |
| 5051 |
}, [template]); |
| 5052 |
const browseAllLinkProps = useLink({ |
| 5053 |
// TODO: We should update this to filter by template part's areas as well. |
| 5054 |
postType: template.type, |
| 5055 |
postId: undefined |
| 5056 |
}); |
| 5057 |
|
| 5058 |
if (!template) { |
| 5059 |
return null; |
| 5060 |
} |
| 5061 |
|
| 5062 |
const revert = () => { |
| 5063 |
revertTemplate(template); |
| 5064 |
onClose(); |
| 5065 |
}; |
| 5066 |
|
| 5067 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5068 |
className: "edit-site-template-details" |
| 5069 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5070 |
className: "edit-site-template-details__group" |
| 5071 |
}, template.is_custom ? (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, { |
| 5072 |
template: template |
| 5073 |
}) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 5074 |
level: 4, |
| 5075 |
weight: 600, |
| 5076 |
className: "edit-site-template-details__title" |
| 5077 |
}, title), description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
| 5078 |
size: "body", |
| 5079 |
className: "edit-site-template-details__description", |
| 5080 |
as: "p" |
| 5081 |
}, description)), (0,external_wp_element_namespaceObject.createElement)(TemplateAreas, { |
| 5082 |
closeTemplateDetailsDropdown: onClose |
| 5083 |
}), isTemplateRevertable(template) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 5084 |
className: "edit-site-template-details__group edit-site-template-details__revert" |
| 5085 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 5086 |
className: "edit-site-template-details__revert-button", |
| 5087 |
info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), |
| 5088 |
onClick: revert |
| 5089 |
}, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({ |
| 5090 |
className: "edit-site-template-details__show-all-button" |
| 5091 |
}, browseAllLinkProps), (0,external_wp_i18n_namespaceObject.sprintf)( |
| 5092 |
/* translators: the template part's area name ("Headers", "Sidebars") or "templates". */ |
| 5093 |
(0,external_wp_i18n_namespaceObject.__)('Browse all %s'), templateSubMenu.title))); |
| 5094 |
} |
| 5095 |
//# sourceMappingURL=index.js.map |
| 5096 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/index.js |
| 5097 |
|
| 5098 |
|
| 5099 |
/** |
| 5100 |
* WordPress dependencies |
| 5101 |
*/ |
| 5102 |
|
| 5103 |
|
| 5104 |
|
| 5105 |
|
| 5106 |
|
| 5107 |
|
| 5108 |
|
| 5109 |
|
| 5110 |
|
| 5111 |
|
| 5112 |
|
| 5113 |
/** |
| 5114 |
* Internal dependencies |
| 5115 |
*/ |
| 5116 |
|
| 5117 |
|
| 5118 |
|
| 5119 |
|
| 5120 |
|
| 5121 |
|
| 5122 |
|
| 5123 |
|
| 5124 |
|
| 5125 |
const preventDefault = event => { |
| 5126 |
event.preventDefault(); |
| 5127 |
}; |
| 5128 |
|
| 5129 |
function Header(_ref) { |
| 5130 |
let { |
| 5131 |
openEntitiesSavedStates, |
| 5132 |
isEntitiesSavedStatesOpen |
| 5133 |
} = _ref; |
| 5134 |
const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); |
| 5135 |
const { |
| 5136 |
deviceType, |
| 5137 |
entityTitle, |
| 5138 |
template, |
| 5139 |
templateType, |
| 5140 |
isInserterOpen, |
| 5141 |
isListViewOpen, |
| 5142 |
listViewShortcut, |
| 5143 |
isLoaded, |
| 5144 |
isVisualMode |
| 5145 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 5146 |
const { |
| 5147 |
__experimentalGetPreviewDeviceType, |
| 5148 |
getEditedPostType, |
| 5149 |
getEditedPostId, |
| 5150 |
isInserterOpened, |
| 5151 |
isListViewOpened, |
| 5152 |
getEditorMode |
| 5153 |
} = select(store_store); |
| 5154 |
const { |
| 5155 |
getEditedEntityRecord |
| 5156 |
} = select(external_wp_coreData_namespaceObject.store); |
| 5157 |
const { |
| 5158 |
__experimentalGetTemplateInfo: getTemplateInfo |
| 5159 |
} = select(external_wp_editor_namespaceObject.store); |
| 5160 |
const { |
| 5161 |
getShortcutRepresentation |
| 5162 |
} = select(external_wp_keyboardShortcuts_namespaceObject.store); |
| 5163 |
const postType = getEditedPostType(); |
| 5164 |
const postId = getEditedPostId(); |
| 5165 |
const record = getEditedEntityRecord('postType', postType, postId); |
| 5166 |
|
| 5167 |
const _isLoaded = !!postId; |
| 5168 |
|
| 5169 |
return { |
| 5170 |
deviceType: __experimentalGetPreviewDeviceType(), |
| 5171 |
entityTitle: getTemplateInfo(record).title, |
| 5172 |
isLoaded: _isLoaded, |
| 5173 |
template: record, |
| 5174 |
templateType: postType, |
| 5175 |
isInserterOpen: isInserterOpened(), |
| 5176 |
isListViewOpen: isListViewOpened(), |
| 5177 |
listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'), |
| 5178 |
isVisualMode: getEditorMode() === 'visual' |
| 5179 |
}; |
| 5180 |
}, []); |
| 5181 |
const { |
| 5182 |
__experimentalSetPreviewDeviceType: setPreviewDeviceType, |
| 5183 |
setIsInserterOpened, |
| 5184 |
setIsListViewOpened |
| 5185 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 5186 |
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
| 5187 |
const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { |
| 5188 |
if (isInserterOpen) { |
| 5189 |
// Focusing the inserter button closes the inserter popover |
| 5190 |
inserterButton.current.focus(); |
| 5191 |
} else { |
| 5192 |
setIsInserterOpened(true); |
| 5193 |
} |
| 5194 |
}, [isInserterOpen, setIsInserterOpened]); |
| 5195 |
const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); |
| 5196 |
const isFocusMode = templateType === 'wp_template_part'; |
| 5197 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5198 |
className: "edit-site-header" |
| 5199 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5200 |
className: "edit-site-header_start" |
| 5201 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5202 |
className: "edit-site-header__toolbar" |
| 5203 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 5204 |
ref: inserterButton, |
| 5205 |
variant: "primary", |
| 5206 |
isPressed: isInserterOpen, |
| 5207 |
className: "edit-site-header-toolbar__inserter-toggle", |
| 5208 |
disabled: !isVisualMode, |
| 5209 |
onMouseDown: preventDefault, |
| 5210 |
onClick: openInserter, |
| 5211 |
icon: library_plus, |
| 5212 |
label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button') |
| 5213 |
}), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
| 5214 |
as: external_wp_blockEditor_namespaceObject.ToolSelector, |
| 5215 |
disabled: !isVisualMode |
| 5216 |
}), (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, { |
| 5217 |
className: "edit-site-header-toolbar__list-view-toggle", |
| 5218 |
disabled: !isVisualMode, |
| 5219 |
icon: list_view, |
| 5220 |
isPressed: isListViewOpen |
| 5221 |
/* translators: button label text should, if possible, be under 16 characters. */ |
| 5222 |
, |
| 5223 |
label: (0,external_wp_i18n_namespaceObject.__)('List View'), |
| 5224 |
onClick: toggleListView, |
| 5225 |
shortcut: listViewShortcut |
| 5226 |
})))), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5227 |
className: "edit-site-header_center" |
| 5228 |
}, (0,external_wp_element_namespaceObject.createElement)(DocumentActions, { |
| 5229 |
entityTitle: entityTitle, |
| 5230 |
entityLabel: templateType === 'wp_template_part' ? 'template part' : 'template', |
| 5231 |
isLoaded: isLoaded |
| 5232 |
}, _ref2 => { |
| 5233 |
let { |
| 5234 |
onClose |
| 5235 |
} = _ref2; |
| 5236 |
return (0,external_wp_element_namespaceObject.createElement)(TemplateDetails, { |
| 5237 |
template: template, |
| 5238 |
onClose: onClose |
| 5239 |
}); |
| 5240 |
})), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5241 |
className: "edit-site-header_end" |
| 5242 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 5243 |
className: "edit-site-header__actions" |
| 5244 |
}, !isFocusMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, { |
| 5245 |
deviceType: deviceType, |
| 5246 |
setDeviceType: setPreviewDeviceType |
| 5247 |
}), (0,external_wp_element_namespaceObject.createElement)(SaveButton, { |
| 5248 |
openEntitiesSavedStates: openEntitiesSavedStates, |
| 5249 |
isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen |
| 5250 |
}), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { |
| 5251 |
scope: "core/edit-site" |
| 5252 |
}), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null)))); |
| 5253 |
} |
| 5254 |
//# sourceMappingURL=index.js.map |
| 5255 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/cog.js |
| 5256 |
|
| 5257 |
|
| 5258 |
/** |
| 5259 |
* WordPress dependencies |
| 5260 |
*/ |
| 5261 |
|
| 5262 |
const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5263 |
xmlns: "http://www.w3.org/2000/svg", |
| 5264 |
viewBox: "0 0 24 24" |
| 5265 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5266 |
fillRule: "evenodd", |
| 5267 |
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", |
| 5268 |
clipRule: "evenodd" |
| 5269 |
})); |
| 5270 |
/* harmony default export */ var library_cog = (cog); |
| 5271 |
//# sourceMappingURL=cog.js.map |
| 5272 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/default-sidebar.js |
| 5273 |
|
| 5274 |
|
| 5275 |
/** |
| 5276 |
* WordPress dependencies |
| 5277 |
*/ |
| 5278 |
|
| 5279 |
function DefaultSidebar(_ref) { |
| 5280 |
let { |
| 5281 |
className, |
| 5282 |
identifier, |
| 5283 |
title, |
| 5284 |
icon, |
| 5285 |
children, |
| 5286 |
closeLabel, |
| 5287 |
header, |
| 5288 |
headerClassName, |
| 5289 |
panelClassName |
| 5290 |
} = _ref; |
| 5291 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(complementary_area, { |
| 5292 |
className: className, |
| 5293 |
scope: "core/edit-site", |
| 5294 |
identifier: identifier, |
| 5295 |
title: title, |
| 5296 |
icon: icon, |
| 5297 |
closeLabel: closeLabel, |
| 5298 |
header: header, |
| 5299 |
headerClassName: headerClassName, |
| 5300 |
panelClassName: panelClassName |
| 5301 |
}, children), (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { |
| 5302 |
scope: "core/edit-site", |
| 5303 |
identifier: identifier, |
| 5304 |
icon: icon |
| 5305 |
}, title)); |
| 5306 |
} |
| 5307 |
//# sourceMappingURL=default-sidebar.js.map |
| 5308 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/styles.js |
| 5309 |
|
| 5310 |
|
| 5311 |
/** |
| 5312 |
* WordPress dependencies |
| 5313 |
*/ |
| 5314 |
|
| 5315 |
const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5316 |
viewBox: "0 0 24 24", |
| 5317 |
xmlns: "http://www.w3.org/2000/svg" |
| 5318 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5319 |
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" |
| 5320 |
})); |
| 5321 |
/* harmony default export */ var library_styles = (styles); |
| 5322 |
//# sourceMappingURL=styles.js.map |
| 5323 |
;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js |
| 5324 |
/** |
| 5325 |
* WordPress dependencies |
| 5326 |
*/ |
| 5327 |
|
| 5328 |
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
| 5329 |
|
| 5330 |
/** |
| 5331 |
* Return an SVG icon. |
| 5332 |
* |
| 5333 |
* @param {IconProps} props icon is the SVG component to render |
| 5334 |
* size is a number specifiying the icon size in pixels |
| 5335 |
* Other props will be passed to wrapped SVG component |
| 5336 |
* |
| 5337 |
* @return {JSX.Element} Icon component |
| 5338 |
*/ |
| 5339 |
|
| 5340 |
function Icon(_ref) { |
| 5341 |
let { |
| 5342 |
icon, |
| 5343 |
size = 24, |
| 5344 |
...props |
| 5345 |
} = _ref; |
| 5346 |
return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
| 5347 |
width: size, |
| 5348 |
height: size, |
| 5349 |
...props |
| 5350 |
}); |
| 5351 |
} |
| 5352 |
|
| 5353 |
/* harmony default export */ var build_module_icon = (Icon); |
| 5354 |
//# sourceMappingURL=index.js.map |
| 5355 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-left.js |
| 5356 |
|
| 5357 |
|
| 5358 |
/** |
| 5359 |
* WordPress dependencies |
| 5360 |
*/ |
| 5361 |
|
| 5362 |
const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5363 |
xmlns: "http://www.w3.org/2000/svg", |
| 5364 |
viewBox: "0 0 24 24" |
| 5365 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5366 |
d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" |
| 5367 |
})); |
| 5368 |
/* harmony default export */ var chevron_left = (chevronLeft); |
| 5369 |
//# sourceMappingURL=chevron-left.js.map |
| 5370 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-right.js |
| 5371 |
|
| 5372 |
|
| 5373 |
/** |
| 5374 |
* WordPress dependencies |
| 5375 |
*/ |
| 5376 |
|
| 5377 |
const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5378 |
xmlns: "http://www.w3.org/2000/svg", |
| 5379 |
viewBox: "0 0 24 24" |
| 5380 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5381 |
d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" |
| 5382 |
})); |
| 5383 |
/* harmony default export */ var chevron_right = (chevronRight); |
| 5384 |
//# sourceMappingURL=chevron-right.js.map |
| 5385 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/navigation-button.js |
| 5386 |
|
| 5387 |
|
| 5388 |
|
| 5389 |
/** |
| 5390 |
* WordPress dependencies |
| 5391 |
*/ |
| 5392 |
|
| 5393 |
|
| 5394 |
|
| 5395 |
function GenericNavigationButton(_ref) { |
| 5396 |
let { |
| 5397 |
icon, |
| 5398 |
children, |
| 5399 |
...props |
| 5400 |
} = _ref; |
| 5401 |
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, { |
| 5402 |
justify: "flex-start" |
| 5403 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { |
| 5404 |
icon: icon, |
| 5405 |
size: 24 |
| 5406 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children); |
| 5407 |
} |
| 5408 |
|
| 5409 |
function NavigationButton(_ref2) { |
| 5410 |
let { |
| 5411 |
path, |
| 5412 |
...props |
| 5413 |
} = _ref2; |
| 5414 |
const { |
| 5415 |
goTo |
| 5416 |
} = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); |
| 5417 |
const dataAttrName = 'data-navigator-focusable-id'; |
| 5418 |
const dataAttrValue = path; |
| 5419 |
const dataAttrCssSelector = `[${dataAttrName}="${dataAttrValue}"]`; |
| 5420 |
const buttonProps = { ...props, |
| 5421 |
[dataAttrName]: dataAttrValue |
| 5422 |
}; |
| 5423 |
return (0,external_wp_element_namespaceObject.createElement)(GenericNavigationButton, extends_extends({ |
| 5424 |
onClick: () => goTo(path, { |
| 5425 |
focusTargetSelector: dataAttrCssSelector |
| 5426 |
}) |
| 5427 |
}, buttonProps)); |
| 5428 |
} |
| 5429 |
|
| 5430 |
function NavigationBackButton(_ref3) { |
| 5431 |
let { ...props |
| 5432 |
} = _ref3; |
| 5433 |
const { |
| 5434 |
goBack |
| 5435 |
} = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)(); |
| 5436 |
return (0,external_wp_element_namespaceObject.createElement)(GenericNavigationButton, extends_extends({ |
| 5437 |
onClick: goBack |
| 5438 |
}, props)); |
| 5439 |
} |
| 5440 |
|
| 5441 |
|
| 5442 |
//# sourceMappingURL=navigation-button.js.map |
| 5443 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/typography.js |
| 5444 |
|
| 5445 |
|
| 5446 |
/** |
| 5447 |
* WordPress dependencies |
| 5448 |
*/ |
| 5449 |
|
| 5450 |
const typography = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5451 |
xmlns: "http://www.w3.org/2000/svg", |
| 5452 |
viewBox: "0 0 24 24" |
| 5453 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5454 |
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" |
| 5455 |
})); |
| 5456 |
/* harmony default export */ var library_typography = (typography); |
| 5457 |
//# sourceMappingURL=typography.js.map |
| 5458 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/color.js |
| 5459 |
|
| 5460 |
|
| 5461 |
/** |
| 5462 |
* WordPress dependencies |
| 5463 |
*/ |
| 5464 |
|
| 5465 |
const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5466 |
viewBox: "0 0 24 24", |
| 5467 |
xmlns: "http://www.w3.org/2000/svg" |
| 5468 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5469 |
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" |
| 5470 |
})); |
| 5471 |
/* harmony default export */ var library_color = (color); |
| 5472 |
//# sourceMappingURL=color.js.map |
| 5473 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/layout.js |
| 5474 |
|
| 5475 |
|
| 5476 |
/** |
| 5477 |
* WordPress dependencies |
| 5478 |
*/ |
| 5479 |
|
| 5480 |
const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 5481 |
xmlns: "http://www.w3.org/2000/svg", |
| 5482 |
viewBox: "0 0 24 24" |
| 5483 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 5484 |
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" |
| 5485 |
})); |
| 5486 |
/* harmony default export */ var library_layout = (layout); |
| 5487 |
//# sourceMappingURL=layout.js.map |
| 5488 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/utils.js |
| 5489 |
/** |
| 5490 |
* External dependencies |
| 5491 |
*/ |
| 5492 |
|
| 5493 |
/* Supporting data */ |
| 5494 |
|
| 5495 |
const ROOT_BLOCK_NAME = 'root'; |
| 5496 |
const ROOT_BLOCK_SELECTOR = 'body'; |
| 5497 |
const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'])); |
| 5498 |
const PRESET_METADATA = [{ |
| 5499 |
path: ['color', 'palette'], |
| 5500 |
valueKey: 'color', |
| 5501 |
cssVarInfix: 'color', |
| 5502 |
classes: [{ |
| 5503 |
classSuffix: 'color', |
| 5504 |
propertyName: 'color' |
| 5505 |
}, { |
| 5506 |
classSuffix: 'background-color', |
| 5507 |
propertyName: 'background-color' |
| 5508 |
}, { |
| 5509 |
classSuffix: 'border-color', |
| 5510 |
propertyName: 'border-color' |
| 5511 |
}] |
| 5512 |
}, { |
| 5513 |
path: ['color', 'gradients'], |
| 5514 |
valueKey: 'gradient', |
| 5515 |
cssVarInfix: 'gradient', |
| 5516 |
classes: [{ |
| 5517 |
classSuffix: 'gradient-background', |
| 5518 |
propertyName: 'background' |
| 5519 |
}] |
| 5520 |
}, { |
| 5521 |
path: ['typography', 'fontSizes'], |
| 5522 |
valueKey: 'size', |
| 5523 |
cssVarInfix: 'font-size', |
| 5524 |
classes: [{ |
| 5525 |
classSuffix: 'font-size', |
| 5526 |
propertyName: 'font-size' |
| 5527 |
}] |
| 5528 |
}, { |
| 5529 |
path: ['typography', 'fontFamilies'], |
| 5530 |
valueKey: 'fontFamily', |
| 5531 |
cssVarInfix: 'font-family', |
| 5532 |
classes: [{ |
| 5533 |
classSuffix: 'font-family', |
| 5534 |
propertyName: 'font-family' |
| 5535 |
}] |
| 5536 |
}]; |
| 5537 |
const STYLE_PATH_TO_CSS_VAR_INFIX = { |
| 5538 |
'color.background': 'color', |
| 5539 |
'color.text': 'color', |
| 5540 |
'elements.link.color.text': 'color', |
| 5541 |
'color.gradient': 'gradient', |
| 5542 |
'typography.fontSize': 'font-size', |
| 5543 |
'typography.fontFamily': 'font-family' |
| 5544 |
}; |
| 5545 |
|
| 5546 |
function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { |
| 5547 |
// Block presets take priority above root level presets. |
| 5548 |
const orderedPresetsByOrigin = [(0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, ...presetPath]), (0,external_lodash_namespaceObject.get)(features, presetPath)]; |
| 5549 |
|
| 5550 |
for (const presetByOrigin of orderedPresetsByOrigin) { |
| 5551 |
if (presetByOrigin) { |
| 5552 |
// Preset origins ordered by priority. |
| 5553 |
const origins = ['custom', 'theme', 'default']; |
| 5554 |
|
| 5555 |
for (const origin of origins) { |
| 5556 |
const presets = presetByOrigin[origin]; |
| 5557 |
|
| 5558 |
if (presets) { |
| 5559 |
const presetObject = (0,external_lodash_namespaceObject.find)(presets, preset => preset[presetProperty] === presetValueValue); |
| 5560 |
|
| 5561 |
if (presetObject) { |
| 5562 |
if (presetProperty === 'slug') { |
| 5563 |
return presetObject; |
| 5564 |
} // if there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored. |
| 5565 |
|
| 5566 |
|
| 5567 |
const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug); |
| 5568 |
|
| 5569 |
if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { |
| 5570 |
return presetObject; |
| 5571 |
} |
| 5572 |
|
| 5573 |
return undefined; |
| 5574 |
} |
| 5575 |
} |
| 5576 |
} |
| 5577 |
} |
| 5578 |
} |
| 5579 |
} |
| 5580 |
|
| 5581 |
function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { |
| 5582 |
if (!presetPropertyValue) { |
| 5583 |
return presetPropertyValue; |
| 5584 |
} |
| 5585 |
|
| 5586 |
const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; |
| 5587 |
const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', cssVarInfix]); |
| 5588 |
|
| 5589 |
if (!metadata) { |
| 5590 |
// The property doesn't have preset data |
| 5591 |
// so the value should be returned as it is. |
| 5592 |
return presetPropertyValue; |
| 5593 |
} |
| 5594 |
|
| 5595 |
const { |
| 5596 |
valueKey, |
| 5597 |
path |
| 5598 |
} = metadata; |
| 5599 |
const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue); |
| 5600 |
|
| 5601 |
if (!presetObject) { |
| 5602 |
// Value wasn't found in the presets, |
| 5603 |
// so it must be a custom value. |
| 5604 |
return presetPropertyValue; |
| 5605 |
} |
| 5606 |
|
| 5607 |
return `var:preset|${cssVarInfix}|${presetObject.slug}`; |
| 5608 |
} |
| 5609 |
|
| 5610 |
function getValueFromPresetVariable(features, blockName, variable, _ref) { |
| 5611 |
let [presetType, slug] = _ref; |
| 5612 |
const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', presetType]); |
| 5613 |
|
| 5614 |
if (!metadata) { |
| 5615 |
return variable; |
| 5616 |
} |
| 5617 |
|
| 5618 |
const presetObject = findInPresetsBy(features, blockName, metadata.path, 'slug', slug); |
| 5619 |
|
| 5620 |
if (presetObject) { |
| 5621 |
const { |
| 5622 |
valueKey |
| 5623 |
} = metadata; |
| 5624 |
const result = presetObject[valueKey]; |
| 5625 |
return getValueFromVariable(features, blockName, result); |
| 5626 |
} |
| 5627 |
|
| 5628 |
return variable; |
| 5629 |
} |
| 5630 |
|
| 5631 |
function getValueFromCustomVariable(features, blockName, variable, path) { |
| 5632 |
var _get; |
| 5633 |
|
| 5634 |
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]); |
| 5635 |
|
| 5636 |
if (!result) { |
| 5637 |
return variable; |
| 5638 |
} // A variable may reference another variable so we need recursion until we find the value. |
| 5639 |
|
| 5640 |
|
| 5641 |
return getValueFromVariable(features, blockName, result); |
| 5642 |
} |
| 5643 |
|
| 5644 |
function getValueFromVariable(features, blockName, variable) { |
| 5645 |
if (!variable || !(0,external_lodash_namespaceObject.isString)(variable)) { |
| 5646 |
return variable; |
| 5647 |
} |
| 5648 |
|
| 5649 |
const USER_VALUE_PREFIX = 'var:'; |
| 5650 |
const THEME_VALUE_PREFIX = 'var(--wp--'; |
| 5651 |
const THEME_VALUE_SUFFIX = ')'; |
| 5652 |
let parsedVar; |
| 5653 |
|
| 5654 |
if (variable.startsWith(USER_VALUE_PREFIX)) { |
| 5655 |
parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|'); |
| 5656 |
} else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { |
| 5657 |
parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--'); |
| 5658 |
} else { |
| 5659 |
// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )` |
| 5660 |
return variable; |
| 5661 |
} |
| 5662 |
|
| 5663 |
const [type, ...path] = parsedVar; |
| 5664 |
|
| 5665 |
if (type === 'preset') { |
| 5666 |
return getValueFromPresetVariable(features, blockName, variable, path); |
| 5667 |
} |
| 5668 |
|
| 5669 |
if (type === 'custom') { |
| 5670 |
return getValueFromCustomVariable(features, blockName, variable, path); |
| 5671 |
} |
| 5672 |
|
| 5673 |
return variable; |
| 5674 |
} |
| 5675 |
//# sourceMappingURL=utils.js.map |
| 5676 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/context.js |
| 5677 |
/** |
| 5678 |
* WordPress dependencies |
| 5679 |
*/ |
| 5680 |
|
| 5681 |
const DEFAULT_GLOBAL_STYLES_CONTEXT = { |
| 5682 |
user: {}, |
| 5683 |
base: {}, |
| 5684 |
merged: {}, |
| 5685 |
setUserConfig: () => {} |
| 5686 |
}; |
| 5687 |
const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT); |
| 5688 |
//# sourceMappingURL=context.js.map |
| 5689 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/hooks.js |
| 5690 |
/** |
| 5691 |
* External dependencies |
| 5692 |
*/ |
| 5693 |
|
| 5694 |
/** |
| 5695 |
* WordPress dependencies |
| 5696 |
*/ |
| 5697 |
|
| 5698 |
|
| 5699 |
|
| 5700 |
|
| 5701 |
/** |
| 5702 |
* Internal dependencies |
| 5703 |
*/ |
| 5704 |
|
| 5705 |
|
| 5706 |
|
| 5707 |
const EMPTY_CONFIG = { |
| 5708 |
isGlobalStylesUserThemeJSON: true, |
| 5709 |
version: 1 |
| 5710 |
}; |
| 5711 |
const useGlobalStylesReset = () => { |
| 5712 |
const { |
| 5713 |
user: config, |
| 5714 |
setUserConfig |
| 5715 |
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
| 5716 |
const canReset = !!config && !(0,external_lodash_namespaceObject.isEqual)(config, EMPTY_CONFIG); |
| 5717 |
return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])]; |
| 5718 |
}; |
| 5719 |
function useSetting(path, blockName) { |
| 5720 |
var _getSettingValueForCo; |
| 5721 |
|
| 5722 |
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; |
| 5723 |
const { |
| 5724 |
merged: mergedConfig, |
| 5725 |
base: baseConfig, |
| 5726 |
user: userConfig, |
| 5727 |
setUserConfig |
| 5728 |
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
| 5729 |
const fullPath = !blockName ? `settings.${path}` : `settings.blocks.${blockName}.${path}`; |
| 5730 |
|
| 5731 |
const setSetting = newValue => { |
| 5732 |
setUserConfig(currentConfig => { |
| 5733 |
const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); |
| 5734 |
const pathToSet = external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path] ? fullPath + '.custom' : fullPath; |
| 5735 |
(0,external_lodash_namespaceObject.set)(newUserConfig, pathToSet, newValue); |
| 5736 |
return newUserConfig; |
| 5737 |
}); |
| 5738 |
}; |
| 5739 |
|
| 5740 |
const getSettingValueForContext = name => { |
| 5741 |
const currentPath = !name ? `settings.${path}` : `settings.blocks.${name}.${path}`; |
| 5742 |
|
| 5743 |
const getSettingValue = configToUse => { |
| 5744 |
const result = (0,external_lodash_namespaceObject.get)(configToUse, currentPath); |
| 5745 |
|
| 5746 |
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path]) { |
| 5747 |
var _ref, _result$custom; |
| 5748 |
|
| 5749 |
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; |
| 5750 |
} |
| 5751 |
|
| 5752 |
return result; |
| 5753 |
}; |
| 5754 |
|
| 5755 |
let result; |
| 5756 |
|
| 5757 |
switch (source) { |
| 5758 |
case 'all': |
| 5759 |
result = getSettingValue(mergedConfig); |
| 5760 |
break; |
| 5761 |
|
| 5762 |
case 'user': |
| 5763 |
result = getSettingValue(userConfig); |
| 5764 |
break; |
| 5765 |
|
| 5766 |
case 'base': |
| 5767 |
result = getSettingValue(baseConfig); |
| 5768 |
break; |
| 5769 |
|
| 5770 |
default: |
| 5771 |
throw 'Unsupported source'; |
| 5772 |
} |
| 5773 |
|
| 5774 |
return result; |
| 5775 |
}; // Unlike styles settings get inherited from top level settings. |
| 5776 |
|
| 5777 |
|
| 5778 |
const resultWithFallback = (_getSettingValueForCo = getSettingValueForContext(blockName)) !== null && _getSettingValueForCo !== void 0 ? _getSettingValueForCo : getSettingValueForContext(); |
| 5779 |
return [resultWithFallback, setSetting]; |
| 5780 |
} |
| 5781 |
function useStyle(path, blockName) { |
| 5782 |
var _get; |
| 5783 |
|
| 5784 |
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; |
| 5785 |
const { |
| 5786 |
merged: mergedConfig, |
| 5787 |
base: baseConfig, |
| 5788 |
user: userConfig, |
| 5789 |
setUserConfig |
| 5790 |
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
| 5791 |
const finalPath = !blockName ? `styles.${path}` : `styles.blocks.${blockName}.${path}`; |
| 5792 |
|
| 5793 |
const setStyle = newValue => { |
| 5794 |
setUserConfig(currentConfig => { |
| 5795 |
const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); |
| 5796 |
(0,external_lodash_namespaceObject.set)(newUserConfig, finalPath, getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue)); |
| 5797 |
return newUserConfig; |
| 5798 |
}); |
| 5799 |
}; |
| 5800 |
|
| 5801 |
let result; |
| 5802 |
|
| 5803 |
switch (source) { |
| 5804 |
case 'all': |
| 5805 |
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)); |
| 5806 |
break; |
| 5807 |
|
| 5808 |
case 'user': |
| 5809 |
result = getValueFromVariable(mergedConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(userConfig, finalPath)); |
| 5810 |
break; |
| 5811 |
|
| 5812 |
case 'base': |
| 5813 |
result = getValueFromVariable(baseConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(baseConfig, finalPath)); |
| 5814 |
break; |
| 5815 |
|
| 5816 |
default: |
| 5817 |
throw 'Unsupported source'; |
| 5818 |
} |
| 5819 |
|
| 5820 |
return [result, setStyle]; |
| 5821 |
} |
| 5822 |
const hooks_ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']; |
| 5823 |
function getSupportedGlobalStylesPanels(name) { |
| 5824 |
if (!name) { |
| 5825 |
return hooks_ROOT_BLOCK_SUPPORTS; |
| 5826 |
} |
| 5827 |
|
| 5828 |
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); |
| 5829 |
|
| 5830 |
if (!blockType) { |
| 5831 |
return []; |
| 5832 |
} |
| 5833 |
|
| 5834 |
const supportKeys = []; |
| 5835 |
Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => { |
| 5836 |
if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { |
| 5837 |
return; |
| 5838 |
} // Opting out means that, for certain support keys like background color, |
| 5839 |
// blocks have to explicitly set the support value false. If the key is |
| 5840 |
// unset, we still enable it. |
| 5841 |
|
| 5842 |
|
| 5843 |
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { |
| 5844 |
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) { |
| 5845 |
return supportKeys.push(styleName); |
| 5846 |
} |
| 5847 |
} |
| 5848 |
|
| 5849 |
if ((0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) { |
| 5850 |
return supportKeys.push(styleName); |
| 5851 |
} |
| 5852 |
}); |
| 5853 |
return supportKeys; |
| 5854 |
} |
| 5855 |
function useColorsPerOrigin(name) { |
| 5856 |
const [customColors] = useSetting('color.palette.custom', name); |
| 5857 |
const [themeColors] = useSetting('color.palette.theme', name); |
| 5858 |
const [defaultColors] = useSetting('color.palette.default', name); |
| 5859 |
const [shouldDisplayDefaultColors] = useSetting('color.defaultPalette'); |
| 5860 |
return (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 5861 |
const result = []; |
| 5862 |
|
| 5863 |
if (themeColors && themeColors.length) { |
| 5864 |
result.push({ |
| 5865 |
name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), |
| 5866 |
colors: themeColors |
| 5867 |
}); |
| 5868 |
} |
| 5869 |
|
| 5870 |
if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { |
| 5871 |
result.push({ |
| 5872 |
name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), |
| 5873 |
colors: defaultColors |
| 5874 |
}); |
| 5875 |
} |
| 5876 |
|
| 5877 |
if (customColors && customColors.length) { |
| 5878 |
result.push({ |
| 5879 |
name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), |
| 5880 |
colors: customColors |
| 5881 |
}); |
| 5882 |
} |
| 5883 |
|
| 5884 |
return result; |
| 5885 |
}, [customColors, themeColors, defaultColors]); |
| 5886 |
} |
| 5887 |
function useGradientsPerOrigin(name) { |
| 5888 |
const [customGradients] = useSetting('color.gradients.custom', name); |
| 5889 |
const [themeGradients] = useSetting('color.gradients.theme', name); |
| 5890 |
const [defaultGradients] = useSetting('color.gradients.default', name); |
| 5891 |
const [shouldDisplayDefaultGradients] = useSetting('color.defaultGradients'); |
| 5892 |
return (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 5893 |
const result = []; |
| 5894 |
|
| 5895 |
if (themeGradients && themeGradients.length) { |
| 5896 |
result.push({ |
| 5897 |
name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), |
| 5898 |
gradients: themeGradients |
| 5899 |
}); |
| 5900 |
} |
| 5901 |
|
| 5902 |
if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { |
| 5903 |
result.push({ |
| 5904 |
name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), |
| 5905 |
gradients: defaultGradients |
| 5906 |
}); |
| 5907 |
} |
| 5908 |
|
| 5909 |
if (customGradients && customGradients.length) { |
| 5910 |
result.push({ |
| 5911 |
name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), |
| 5912 |
gradients: customGradients |
| 5913 |
}); |
| 5914 |
} |
| 5915 |
|
| 5916 |
return result; |
| 5917 |
}, [customGradients, themeGradients, defaultGradients]); |
| 5918 |
} |
| 5919 |
//# sourceMappingURL=hooks.js.map |
| 5920 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/border-panel.js |
| 5921 |
|
| 5922 |
|
| 5923 |
/** |
| 5924 |
* WordPress dependencies |
| 5925 |
*/ |
| 5926 |
|
| 5927 |
|
| 5928 |
|
| 5929 |
/** |
| 5930 |
* Internal dependencies |
| 5931 |
*/ |
| 5932 |
|
| 5933 |
|
| 5934 |
const MIN_BORDER_WIDTH = 0; // Defining empty array here instead of inline avoids unnecessary re-renders of |
| 5935 |
// color control. |
| 5936 |
|
| 5937 |
const EMPTY_ARRAY = []; |
| 5938 |
function useHasBorderPanel(name) { |
| 5939 |
const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)]; |
| 5940 |
return controls.some(Boolean); |
| 5941 |
} |
| 5942 |
|
| 5943 |
function useHasBorderColorControl(name) { |
| 5944 |
const supports = getSupportedGlobalStylesPanels(name); |
| 5945 |
return useSetting('border.color', name)[0] && supports.includes('borderColor'); |
| 5946 |
} |
| 5947 |
|
| 5948 |
function useHasBorderRadiusControl(name) { |
| 5949 |
const supports = getSupportedGlobalStylesPanels(name); |
| 5950 |
return useSetting('border.radius', name)[0] && supports.includes('borderRadius'); |
| 5951 |
} |
| 5952 |
|
| 5953 |
function useHasBorderStyleControl(name) { |
| 5954 |
const supports = getSupportedGlobalStylesPanels(name); |
| 5955 |
return useSetting('border.style', name)[0] && supports.includes('borderStyle'); |
| 5956 |
} |
| 5957 |
|
| 5958 |
function useHasBorderWidthControl(name) { |
| 5959 |
const supports = getSupportedGlobalStylesPanels(name); |
| 5960 |
return useSetting('border.width', name)[0] && supports.includes('borderWidth'); |
| 5961 |
} |
| 5962 |
|
| 5963 |
function BorderPanel(_ref) { |
| 5964 |
let { |
| 5965 |
name |
| 5966 |
} = _ref; |
| 5967 |
// To better reflect if the user has customized a value we need to |
| 5968 |
// ensure the style value being checked is from the `user` origin. |
| 5969 |
const [userBorderStyles] = useStyle('border', name, 'user'); |
| 5970 |
|
| 5971 |
const createHasValueCallback = feature => () => !!(userBorderStyles !== null && userBorderStyles !== void 0 && userBorderStyles[feature]); |
| 5972 |
|
| 5973 |
const createResetCallback = setStyle => () => setStyle(undefined); |
| 5974 |
|
| 5975 |
const handleOnChange = setStyle => value => { |
| 5976 |
setStyle(value || undefined); |
| 5977 |
}; |
| 5978 |
|
| 5979 |
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ |
| 5980 |
availableUnits: useSetting('spacing.units')[0] || ['px', 'em', 'rem'] |
| 5981 |
}); // Border width. |
| 5982 |
|
| 5983 |
const showBorderWidth = useHasBorderWidthControl(name); |
| 5984 |
const [borderWidthValue, setBorderWidth] = useStyle('border.width', name); // Border style. |
| 5985 |
|
| 5986 |
const showBorderStyle = useHasBorderStyleControl(name); |
| 5987 |
const [borderStyle, setBorderStyle] = useStyle('border.style', name); // Border color. |
| 5988 |
|
| 5989 |
const showBorderColor = useHasBorderColorControl(name); |
| 5990 |
const [borderColor, setBorderColor] = useStyle('border.color', name); |
| 5991 |
const [colors = EMPTY_ARRAY] = useSetting('color.palette'); |
| 5992 |
const disableCustomColors = !useSetting('color.custom')[0]; |
| 5993 |
const disableCustomGradients = !useSetting('color.customGradient')[0]; // Border radius. |
| 5994 |
|
| 5995 |
const showBorderRadius = useHasBorderRadiusControl(name); |
| 5996 |
const [borderRadiusValues, setBorderRadius] = useStyle('border.radius', name); |
| 5997 |
|
| 5998 |
const hasBorderRadius = () => { |
| 5999 |
const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius; |
| 6000 |
|
| 6001 |
if (typeof borderValues === 'object') { |
| 6002 |
return Object.entries(borderValues).some(Boolean); |
| 6003 |
} |
| 6004 |
|
| 6005 |
return !!borderValues; |
| 6006 |
}; |
| 6007 |
|
| 6008 |
const resetAll = () => { |
| 6009 |
setBorderColor(undefined); |
| 6010 |
setBorderRadius(undefined); |
| 6011 |
setBorderStyle(undefined); |
| 6012 |
setBorderWidth(undefined); |
| 6013 |
}; // When we set a border color or width ensure we have a style so the user |
| 6014 |
// can see a visible border. |
| 6015 |
|
| 6016 |
|
| 6017 |
const handleOnChangeWithStyle = setStyle => value => { |
| 6018 |
if (!!value && !borderStyle) { |
| 6019 |
setBorderStyle('solid'); |
| 6020 |
} |
| 6021 |
|
| 6022 |
setStyle(value || undefined); |
| 6023 |
}; |
| 6024 |
|
| 6025 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { |
| 6026 |
label: (0,external_wp_i18n_namespaceObject.__)('Border'), |
| 6027 |
resetAll: resetAll |
| 6028 |
}, showBorderWidth && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6029 |
className: "single-column", |
| 6030 |
hasValue: createHasValueCallback('width'), |
| 6031 |
label: (0,external_wp_i18n_namespaceObject.__)('Width'), |
| 6032 |
onDeselect: createResetCallback(setBorderWidth), |
| 6033 |
isShownByDefault: true |
| 6034 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { |
| 6035 |
value: borderWidthValue, |
| 6036 |
label: (0,external_wp_i18n_namespaceObject.__)('Width'), |
| 6037 |
min: MIN_BORDER_WIDTH, |
| 6038 |
onChange: handleOnChangeWithStyle(setBorderWidth), |
| 6039 |
units: units |
| 6040 |
})), showBorderStyle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6041 |
className: "single-column", |
| 6042 |
hasValue: createHasValueCallback('style'), |
| 6043 |
label: (0,external_wp_i18n_namespaceObject.__)('Style'), |
| 6044 |
onDeselect: createResetCallback(setBorderStyle), |
| 6045 |
isShownByDefault: true |
| 6046 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderStyleControl, { |
| 6047 |
value: borderStyle, |
| 6048 |
onChange: handleOnChange(setBorderStyle) |
| 6049 |
})), showBorderColor && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6050 |
hasValue: createHasValueCallback('color'), |
| 6051 |
label: (0,external_wp_i18n_namespaceObject.__)('Color'), |
| 6052 |
onDeselect: createResetCallback(setBorderColor), |
| 6053 |
isShownByDefault: true |
| 6054 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { |
| 6055 |
label: (0,external_wp_i18n_namespaceObject.__)('Color'), |
| 6056 |
colorValue: borderColor, |
| 6057 |
colors: colors, |
| 6058 |
gradients: undefined, |
| 6059 |
disableCustomColors: disableCustomColors, |
| 6060 |
disableCustomGradients: disableCustomGradients, |
| 6061 |
onColorChange: handleOnChangeWithStyle(setBorderColor), |
| 6062 |
clearable: false |
| 6063 |
})), showBorderRadius && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6064 |
hasValue: hasBorderRadius, |
| 6065 |
label: (0,external_wp_i18n_namespaceObject.__)('Radius'), |
| 6066 |
onDeselect: createResetCallback(setBorderRadius), |
| 6067 |
isShownByDefault: true |
| 6068 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderRadiusControl, { |
| 6069 |
values: borderRadiusValues, |
| 6070 |
onChange: handleOnChange(setBorderRadius) |
| 6071 |
}))); |
| 6072 |
} |
| 6073 |
//# sourceMappingURL=border-panel.js.map |
| 6074 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/color-utils.js |
| 6075 |
/** |
| 6076 |
* Internal dependencies |
| 6077 |
*/ |
| 6078 |
|
| 6079 |
function useHasColorPanel(name) { |
| 6080 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6081 |
return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor'); |
| 6082 |
} |
| 6083 |
//# sourceMappingURL=color-utils.js.map |
| 6084 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/dimensions-panel.js |
| 6085 |
|
| 6086 |
|
| 6087 |
/** |
| 6088 |
* WordPress dependencies |
| 6089 |
*/ |
| 6090 |
|
| 6091 |
|
| 6092 |
|
| 6093 |
/** |
| 6094 |
* Internal dependencies |
| 6095 |
*/ |
| 6096 |
|
| 6097 |
|
| 6098 |
const AXIAL_SIDES = ['horizontal', 'vertical']; |
| 6099 |
function useHasDimensionsPanel(name) { |
| 6100 |
const hasPadding = useHasPadding(name); |
| 6101 |
const hasMargin = useHasMargin(name); |
| 6102 |
const hasGap = useHasGap(name); |
| 6103 |
return hasPadding || hasMargin || hasGap; |
| 6104 |
} |
| 6105 |
|
| 6106 |
function useHasPadding(name) { |
| 6107 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6108 |
const [settings] = useSetting('spacing.padding', name); |
| 6109 |
return settings && supports.includes('padding'); |
| 6110 |
} |
| 6111 |
|
| 6112 |
function useHasMargin(name) { |
| 6113 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6114 |
const [settings] = useSetting('spacing.margin', name); |
| 6115 |
return settings && supports.includes('margin'); |
| 6116 |
} |
| 6117 |
|
| 6118 |
function useHasGap(name) { |
| 6119 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6120 |
const [settings] = useSetting('spacing.blockGap', name); |
| 6121 |
return settings && supports.includes('--wp--style--block-gap'); |
| 6122 |
} |
| 6123 |
|
| 6124 |
function filterValuesBySides(values, sides) { |
| 6125 |
if (!sides) { |
| 6126 |
// If no custom side configuration all sides are opted into by default. |
| 6127 |
return values; |
| 6128 |
} // Only include sides opted into within filtered values. |
| 6129 |
|
| 6130 |
|
| 6131 |
const filteredValues = {}; |
| 6132 |
sides.forEach(side => { |
| 6133 |
if (side === 'vertical') { |
| 6134 |
filteredValues.top = values.top; |
| 6135 |
filteredValues.bottom = values.bottom; |
| 6136 |
} |
| 6137 |
|
| 6138 |
if (side === 'horizontal') { |
| 6139 |
filteredValues.left = values.left; |
| 6140 |
filteredValues.right = values.right; |
| 6141 |
} |
| 6142 |
|
| 6143 |
filteredValues[side] = values[side]; |
| 6144 |
}); |
| 6145 |
return filteredValues; |
| 6146 |
} |
| 6147 |
|
| 6148 |
function splitStyleValue(value) { |
| 6149 |
// Check for shorthand value ( a string value ). |
| 6150 |
if (value && typeof value === 'string') { |
| 6151 |
// Convert to value for individual sides for BoxControl. |
| 6152 |
return { |
| 6153 |
top: value, |
| 6154 |
right: value, |
| 6155 |
bottom: value, |
| 6156 |
left: value |
| 6157 |
}; |
| 6158 |
} |
| 6159 |
|
| 6160 |
return value; |
| 6161 |
} |
| 6162 |
|
| 6163 |
function DimensionsPanel(_ref) { |
| 6164 |
let { |
| 6165 |
name |
| 6166 |
} = _ref; |
| 6167 |
const showPaddingControl = useHasPadding(name); |
| 6168 |
const showMarginControl = useHasMargin(name); |
| 6169 |
const showGapControl = useHasGap(name); |
| 6170 |
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ |
| 6171 |
availableUnits: useSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw'] |
| 6172 |
}); |
| 6173 |
const [rawPadding, setRawPadding] = useStyle('spacing.padding', name); |
| 6174 |
const paddingValues = splitStyleValue(rawPadding); |
| 6175 |
const paddingSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'padding'); |
| 6176 |
const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side)); |
| 6177 |
|
| 6178 |
const setPaddingValues = newPaddingValues => { |
| 6179 |
const padding = filterValuesBySides(newPaddingValues, paddingSides); |
| 6180 |
setRawPadding(padding); |
| 6181 |
}; |
| 6182 |
|
| 6183 |
const resetPaddingValue = () => setPaddingValues({}); |
| 6184 |
|
| 6185 |
const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length; |
| 6186 |
|
| 6187 |
const [rawMargin, setRawMargin] = useStyle('spacing.margin', name); |
| 6188 |
const marginValues = splitStyleValue(rawMargin); |
| 6189 |
const marginSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'margin'); |
| 6190 |
const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side)); |
| 6191 |
|
| 6192 |
const setMarginValues = newMarginValues => { |
| 6193 |
const margin = filterValuesBySides(newMarginValues, marginSides); |
| 6194 |
setRawMargin(margin); |
| 6195 |
}; |
| 6196 |
|
| 6197 |
const resetMarginValue = () => setMarginValues({}); |
| 6198 |
|
| 6199 |
const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length; |
| 6200 |
|
| 6201 |
const [gapValue, setGapValue] = useStyle('spacing.blockGap', name); |
| 6202 |
|
| 6203 |
const resetGapValue = () => setGapValue(undefined); |
| 6204 |
|
| 6205 |
const hasGapValue = () => !!gapValue; |
| 6206 |
|
| 6207 |
const resetAll = () => { |
| 6208 |
resetPaddingValue(); |
| 6209 |
resetMarginValue(); |
| 6210 |
resetGapValue(); |
| 6211 |
}; |
| 6212 |
|
| 6213 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { |
| 6214 |
label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'), |
| 6215 |
resetAll: resetAll |
| 6216 |
}, showPaddingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6217 |
hasValue: hasPaddingValue, |
| 6218 |
label: (0,external_wp_i18n_namespaceObject.__)('Padding'), |
| 6219 |
onDeselect: resetPaddingValue, |
| 6220 |
isShownByDefault: true |
| 6221 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { |
| 6222 |
values: paddingValues, |
| 6223 |
onChange: setPaddingValues, |
| 6224 |
label: (0,external_wp_i18n_namespaceObject.__)('Padding'), |
| 6225 |
sides: paddingSides, |
| 6226 |
units: units, |
| 6227 |
allowReset: false, |
| 6228 |
splitOnAxis: isAxialPadding |
| 6229 |
})), showMarginControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6230 |
hasValue: hasMarginValue, |
| 6231 |
label: (0,external_wp_i18n_namespaceObject.__)('Margin'), |
| 6232 |
onDeselect: resetMarginValue, |
| 6233 |
isShownByDefault: true |
| 6234 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { |
| 6235 |
values: marginValues, |
| 6236 |
onChange: setMarginValues, |
| 6237 |
label: (0,external_wp_i18n_namespaceObject.__)('Margin'), |
| 6238 |
sides: marginSides, |
| 6239 |
units: units, |
| 6240 |
allowReset: false, |
| 6241 |
splitOnAxis: isAxialMargin |
| 6242 |
})), showGapControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
| 6243 |
hasValue: hasGapValue, |
| 6244 |
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), |
| 6245 |
onDeselect: resetGapValue, |
| 6246 |
isShownByDefault: true |
| 6247 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { |
| 6248 |
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), |
| 6249 |
__unstableInputWidth: "80px", |
| 6250 |
min: 0, |
| 6251 |
onChange: setGapValue, |
| 6252 |
units: units, |
| 6253 |
value: gapValue |
| 6254 |
}))); |
| 6255 |
} |
| 6256 |
//# sourceMappingURL=dimensions-panel.js.map |
| 6257 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/typography-panel.js |
| 6258 |
|
| 6259 |
|
| 6260 |
/** |
| 6261 |
* WordPress dependencies |
| 6262 |
*/ |
| 6263 |
|
| 6264 |
|
| 6265 |
/** |
| 6266 |
* Internal dependencies |
| 6267 |
*/ |
| 6268 |
|
| 6269 |
|
| 6270 |
function useHasTypographyPanel(name) { |
| 6271 |
const hasLineHeight = useHasLineHeightControl(name); |
| 6272 |
const hasFontAppearance = useHasAppearanceControl(name); |
| 6273 |
const hasLetterSpacing = useHasLetterSpacingControl(name); |
| 6274 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6275 |
return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize'); |
| 6276 |
} |
| 6277 |
|
| 6278 |
function useHasLineHeightControl(name) { |
| 6279 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6280 |
return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight'); |
| 6281 |
} |
| 6282 |
|
| 6283 |
function useHasAppearanceControl(name) { |
| 6284 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6285 |
const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); |
| 6286 |
const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); |
| 6287 |
return hasFontStyles || hasFontWeights; |
| 6288 |
} |
| 6289 |
|
| 6290 |
function useHasLetterSpacingControl(name) { |
| 6291 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6292 |
return useSetting('typography.letterSpacing', name)[0] && supports.includes('letterSpacing'); |
| 6293 |
} |
| 6294 |
|
| 6295 |
function TypographyPanel(_ref) { |
| 6296 |
let { |
| 6297 |
name, |
| 6298 |
element |
| 6299 |
} = _ref; |
| 6300 |
const supports = getSupportedGlobalStylesPanels(name); |
| 6301 |
const prefix = element === 'text' || !element ? '' : `elements.${element}.`; |
| 6302 |
const [fontSizes] = useSetting('typography.fontSizes', name); |
| 6303 |
const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0]; |
| 6304 |
const [fontFamilies] = useSetting('typography.fontFamilies', name); |
| 6305 |
const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); |
| 6306 |
const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); |
| 6307 |
const hasLineHeightEnabled = useHasLineHeightControl(name); |
| 6308 |
const hasAppearanceControl = useHasAppearanceControl(name); |
| 6309 |
const hasLetterSpacingControl = useHasLetterSpacingControl(name); |
| 6310 |
const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name); |
| 6311 |
const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name); |
| 6312 |
const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name); |
| 6313 |
const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name); |
| 6314 |
const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name); |
| 6315 |
const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); |
| 6316 |
const [backgroundColor] = useStyle(prefix + 'color.background', name); |
| 6317 |
const [gradientValue] = useStyle(prefix + 'color.gradient', name); |
| 6318 |
const [color] = useStyle(prefix + 'color.text', name); |
| 6319 |
const extraStyles = element === 'link' ? { |
| 6320 |
textDecoration: 'underline' |
| 6321 |
} : {}; |
| 6322 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
| 6323 |
className: "edit-site-typography-panel", |
| 6324 |
initialOpen: true |
| 6325 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6326 |
className: "edit-site-typography-panel__preview", |
| 6327 |
style: { |
| 6328 |
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', |
| 6329 |
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
| 6330 |
color, |
| 6331 |
fontSize, |
| 6332 |
fontStyle, |
| 6333 |
fontWeight, |
| 6334 |
letterSpacing, |
| 6335 |
...extraStyles |
| 6336 |
} |
| 6337 |
}, "Aa"), supports.includes('fontFamily') && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontFamilyControl, { |
| 6338 |
fontFamilies: fontFamilies, |
| 6339 |
value: fontFamily, |
| 6340 |
onChange: setFontFamily |
| 6341 |
}), supports.includes('fontSize') && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, { |
| 6342 |
value: fontSize, |
| 6343 |
onChange: setFontSize, |
| 6344 |
fontSizes: fontSizes, |
| 6345 |
disableCustomFontSizes: disableCustomFontSizes |
| 6346 |
}), hasLineHeightEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.LineHeightControl, { |
| 6347 |
value: lineHeight, |
| 6348 |
onChange: setLineHeight |
| 6349 |
}), hasAppearanceControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontAppearanceControl, { |
| 6350 |
value: { |
| 6351 |
fontStyle, |
| 6352 |
fontWeight |
| 6353 |
}, |
| 6354 |
onChange: _ref2 => { |
| 6355 |
let { |
| 6356 |
fontStyle: newFontStyle, |
| 6357 |
fontWeight: newFontWeight |
| 6358 |
} = _ref2; |
| 6359 |
setFontStyle(newFontStyle); |
| 6360 |
setFontWeight(newFontWeight); |
| 6361 |
}, |
| 6362 |
hasFontStyles: hasFontStyles, |
| 6363 |
hasFontWeights: hasFontWeights |
| 6364 |
}), hasLetterSpacingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLetterSpacingControl, { |
| 6365 |
value: letterSpacing, |
| 6366 |
onChange: setLetterSpacing |
| 6367 |
})); |
| 6368 |
} |
| 6369 |
//# sourceMappingURL=typography-panel.js.map |
| 6370 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/context-menu.js |
| 6371 |
|
| 6372 |
|
| 6373 |
/** |
| 6374 |
* WordPress dependencies |
| 6375 |
*/ |
| 6376 |
|
| 6377 |
|
| 6378 |
|
| 6379 |
/** |
| 6380 |
* Internal dependencies |
| 6381 |
*/ |
| 6382 |
|
| 6383 |
|
| 6384 |
|
| 6385 |
|
| 6386 |
|
| 6387 |
|
| 6388 |
|
| 6389 |
function ContextMenu(_ref) { |
| 6390 |
let { |
| 6391 |
name, |
| 6392 |
parentMenu = '' |
| 6393 |
} = _ref; |
| 6394 |
const hasTypographyPanel = useHasTypographyPanel(name); |
| 6395 |
const hasColorPanel = useHasColorPanel(name); |
| 6396 |
const hasBorderPanel = useHasBorderPanel(name); |
| 6397 |
const hasDimensionsPanel = useHasDimensionsPanel(name); |
| 6398 |
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; |
| 6399 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 6400 |
icon: library_typography, |
| 6401 |
path: parentMenu + '/typography' |
| 6402 |
}, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 6403 |
icon: library_color, |
| 6404 |
path: parentMenu + '/colors' |
| 6405 |
}, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 6406 |
icon: library_layout, |
| 6407 |
path: parentMenu + '/layout' |
| 6408 |
}, (0,external_wp_i18n_namespaceObject.__)('Layout'))); |
| 6409 |
} |
| 6410 |
|
| 6411 |
/* harmony default export */ var context_menu = (ContextMenu); |
| 6412 |
//# sourceMappingURL=context-menu.js.map |
| 6413 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/use-global-styles-output.js |
| 6414 |
/** |
| 6415 |
* External dependencies |
| 6416 |
*/ |
| 6417 |
|
| 6418 |
/** |
| 6419 |
* WordPress dependencies |
| 6420 |
*/ |
| 6421 |
|
| 6422 |
|
| 6423 |
|
| 6424 |
/** |
| 6425 |
* Internal dependencies |
| 6426 |
*/ |
| 6427 |
|
| 6428 |
/** |
| 6429 |
* Internal dependencies |
| 6430 |
*/ |
| 6431 |
|
| 6432 |
|
| 6433 |
|
| 6434 |
|
| 6435 |
function compileStyleValue(uncompiledValue) { |
| 6436 |
const VARIABLE_REFERENCE_PREFIX = 'var:'; |
| 6437 |
const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; |
| 6438 |
const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; |
| 6439 |
|
| 6440 |
if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { |
| 6441 |
const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); |
| 6442 |
return `var(--wp--${variable})`; |
| 6443 |
} |
| 6444 |
|
| 6445 |
return uncompiledValue; |
| 6446 |
} |
| 6447 |
/** |
| 6448 |
* Transform given preset tree into a set of style declarations. |
| 6449 |
* |
| 6450 |
* @param {Object} blockPresets |
| 6451 |
* |
| 6452 |
* @return {Array} An array of style declarations. |
| 6453 |
*/ |
| 6454 |
|
| 6455 |
|
| 6456 |
function getPresetsDeclarations() { |
| 6457 |
let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 6458 |
return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref) => { |
| 6459 |
let { |
| 6460 |
path, |
| 6461 |
valueKey, |
| 6462 |
cssVarInfix |
| 6463 |
} = _ref; |
| 6464 |
const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); |
| 6465 |
['default', 'theme', 'custom'].forEach(origin => { |
| 6466 |
if (presetByOrigin[origin]) { |
| 6467 |
presetByOrigin[origin].forEach(value => { |
| 6468 |
declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${value[valueKey]}`); |
| 6469 |
}); |
| 6470 |
} |
| 6471 |
}); |
| 6472 |
return declarations; |
| 6473 |
}, []); |
| 6474 |
} |
| 6475 |
/** |
| 6476 |
* Transform given preset tree into a set of preset class declarations. |
| 6477 |
* |
| 6478 |
* @param {string} blockSelector |
| 6479 |
* @param {Object} blockPresets |
| 6480 |
* @return {string} CSS declarations for the preset classes. |
| 6481 |
*/ |
| 6482 |
|
| 6483 |
|
| 6484 |
function getPresetsClasses(blockSelector) { |
| 6485 |
let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
| 6486 |
return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref2) => { |
| 6487 |
let { |
| 6488 |
path, |
| 6489 |
cssVarInfix, |
| 6490 |
classes |
| 6491 |
} = _ref2; |
| 6492 |
|
| 6493 |
if (!classes) { |
| 6494 |
return declarations; |
| 6495 |
} |
| 6496 |
|
| 6497 |
const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); |
| 6498 |
['default', 'theme', 'custom'].forEach(origin => { |
| 6499 |
if (presetByOrigin[origin]) { |
| 6500 |
presetByOrigin[origin].forEach(_ref3 => { |
| 6501 |
let { |
| 6502 |
slug |
| 6503 |
} = _ref3; |
| 6504 |
classes.forEach(_ref4 => { |
| 6505 |
let { |
| 6506 |
classSuffix, |
| 6507 |
propertyName |
| 6508 |
} = _ref4; |
| 6509 |
const classSelectorToUse = `.has-${(0,external_lodash_namespaceObject.kebabCase)(slug)}-${classSuffix}`; |
| 6510 |
const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" |
| 6511 |
.map(selector => `${selector}${classSelectorToUse}`).join(','); |
| 6512 |
const value = `var(--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(slug)})`; |
| 6513 |
declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; |
| 6514 |
}); |
| 6515 |
}); |
| 6516 |
} |
| 6517 |
}); |
| 6518 |
return declarations; |
| 6519 |
}, ''); |
| 6520 |
} |
| 6521 |
|
| 6522 |
function flattenTree() { |
| 6523 |
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 6524 |
let prefix = arguments.length > 1 ? arguments[1] : undefined; |
| 6525 |
let token = arguments.length > 2 ? arguments[2] : undefined; |
| 6526 |
let result = []; |
| 6527 |
Object.keys(input).forEach(key => { |
| 6528 |
const newKey = prefix + (0,external_lodash_namespaceObject.kebabCase)(key.replace('/', '-')); |
| 6529 |
const newLeaf = input[key]; |
| 6530 |
|
| 6531 |
if (newLeaf instanceof Object) { |
| 6532 |
const newPrefix = newKey + token; |
| 6533 |
result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; |
| 6534 |
} else { |
| 6535 |
result.push(`${newKey}: ${newLeaf}`); |
| 6536 |
} |
| 6537 |
}); |
| 6538 |
return result; |
| 6539 |
} |
| 6540 |
/** |
| 6541 |
* Transform given style tree into a set of style declarations. |
| 6542 |
* |
| 6543 |
* @param {Object} blockStyles Block styles. |
| 6544 |
* |
| 6545 |
* @return {Array} An array of style declarations. |
| 6546 |
*/ |
| 6547 |
|
| 6548 |
|
| 6549 |
function getStylesDeclarations() { |
| 6550 |
let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
| 6551 |
return (0,external_lodash_namespaceObject.reduce)(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => { |
| 6552 |
let { |
| 6553 |
value, |
| 6554 |
properties |
| 6555 |
} = _ref5; |
| 6556 |
const pathToValue = value; |
| 6557 |
|
| 6558 |
if ((0,external_lodash_namespaceObject.first)(pathToValue) === 'elements') { |
| 6559 |
return declarations; |
| 6560 |
} |
| 6561 |
|
| 6562 |
const styleValue = (0,external_lodash_namespaceObject.get)(blockStyles, pathToValue); |
| 6563 |
|
| 6564 |
if (!!properties && !(0,external_lodash_namespaceObject.isString)(styleValue)) { |
| 6565 |
Object.entries(properties).forEach(entry => { |
| 6566 |
const [name, prop] = entry; |
| 6567 |
|
| 6568 |
if (!(0,external_lodash_namespaceObject.get)(styleValue, [prop], false)) { |
| 6569 |
// Do not create a declaration |
| 6570 |
// for sub-properties that don't have any value. |
| 6571 |
return; |
| 6572 |
} |
| 6573 |
|
| 6574 |
const cssProperty = (0,external_lodash_namespaceObject.kebabCase)(name); |
| 6575 |
declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(styleValue, [prop]))}`); |
| 6576 |
}); |
| 6577 |
} else if ((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue, false)) { |
| 6578 |
const cssProperty = key.startsWith('--') ? key : (0,external_lodash_namespaceObject.kebabCase)(key); |
| 6579 |
declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue))}`); |
| 6580 |
} |
| 6581 |
|
| 6582 |
return declarations; |
| 6583 |
}, []); |
| 6584 |
} |
| 6585 |
|
| 6586 |
const getNodesWithStyles = (tree, blockSelectors) => { |
| 6587 |
var _tree$styles, _tree$styles2; |
| 6588 |
|
| 6589 |
const nodes = []; |
| 6590 |
|
| 6591 |
if (!(tree !== null && tree !== void 0 && tree.styles)) { |
| 6592 |
return nodes; |
| 6593 |
} |
| 6594 |
|
| 6595 |
const pickStyleKeys = treeToPickFrom => (0,external_lodash_namespaceObject.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography'].includes(key)); // Top-level. |
| 6596 |
|
| 6597 |
|
| 6598 |
const styles = pickStyleKeys(tree.styles); |
| 6599 |
|
| 6600 |
if (!!styles) { |
| 6601 |
nodes.push({ |
| 6602 |
styles, |
| 6603 |
selector: ROOT_BLOCK_SELECTOR |
| 6604 |
}); |
| 6605 |
} |
| 6606 |
|
| 6607 |
(0,external_lodash_namespaceObject.forEach)((_tree$styles = tree.styles) === null || _tree$styles === void 0 ? void 0 : _tree$styles.elements, (value, key) => { |
| 6608 |
if (!!value && !!external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key]) { |
| 6609 |
nodes.push({ |
| 6610 |
styles: value, |
| 6611 |
selector: external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key] |
| 6612 |
}); |
| 6613 |
} |
| 6614 |
}); // Iterate over blocks: they can have styles & elements. |
| 6615 |
|
| 6616 |
(0,external_lodash_namespaceObject.forEach)((_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.blocks, (node, blockName) => { |
| 6617 |
var _blockSelectors$block; |
| 6618 |
|
| 6619 |
const blockStyles = pickStyleKeys(node); |
| 6620 |
|
| 6621 |
if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) { |
| 6622 |
nodes.push({ |
| 6623 |
styles: blockStyles, |
| 6624 |
selector: blockSelectors[blockName].selector |
| 6625 |
}); |
| 6626 |
} |
| 6627 |
|
| 6628 |
(0,external_lodash_namespaceObject.forEach)(node === null || node === void 0 ? void 0 : node.elements, (value, elementName) => { |
| 6629 |
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])) { |
| 6630 |
nodes.push({ |
| 6631 |
styles: value, |
| 6632 |
selector: blockSelectors[blockName].selector.split(',').map(sel => sel + ' ' + external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]).join(',') |
| 6633 |
}); |
| 6634 |
} |
| 6635 |
}); |
| 6636 |
}); |
| 6637 |
return nodes; |
| 6638 |
}; |
| 6639 |
const getNodesWithSettings = (tree, blockSelectors) => { |
| 6640 |
var _tree$settings, _tree$settings2; |
| 6641 |
|
| 6642 |
const nodes = []; |
| 6643 |
|
| 6644 |
if (!(tree !== null && tree !== void 0 && tree.settings)) { |
| 6645 |
return nodes; |
| 6646 |
} |
| 6647 |
|
| 6648 |
const pickPresets = treeToPickFrom => { |
| 6649 |
const presets = {}; |
| 6650 |
PRESET_METADATA.forEach(_ref6 => { |
| 6651 |
let { |
| 6652 |
path |
| 6653 |
} = _ref6; |
| 6654 |
const value = (0,external_lodash_namespaceObject.get)(treeToPickFrom, path, false); |
| 6655 |
|
| 6656 |
if (value !== false) { |
| 6657 |
(0,external_lodash_namespaceObject.set)(presets, path, value); |
| 6658 |
} |
| 6659 |
}); |
| 6660 |
return presets; |
| 6661 |
}; // Top-level. |
| 6662 |
|
| 6663 |
|
| 6664 |
const presets = pickPresets(tree.settings); |
| 6665 |
const custom = (_tree$settings = tree.settings) === null || _tree$settings === void 0 ? void 0 : _tree$settings.custom; |
| 6666 |
|
| 6667 |
if (!(0,external_lodash_namespaceObject.isEmpty)(presets) || !!custom) { |
| 6668 |
nodes.push({ |
| 6669 |
presets, |
| 6670 |
custom, |
| 6671 |
selector: ROOT_BLOCK_SELECTOR |
| 6672 |
}); |
| 6673 |
} // Blocks. |
| 6674 |
|
| 6675 |
|
| 6676 |
(0,external_lodash_namespaceObject.forEach)((_tree$settings2 = tree.settings) === null || _tree$settings2 === void 0 ? void 0 : _tree$settings2.blocks, (node, blockName) => { |
| 6677 |
const blockPresets = pickPresets(node); |
| 6678 |
const blockCustom = node.custom; |
| 6679 |
|
| 6680 |
if (!(0,external_lodash_namespaceObject.isEmpty)(blockPresets) || !!blockCustom) { |
| 6681 |
nodes.push({ |
| 6682 |
presets: blockPresets, |
| 6683 |
custom: blockCustom, |
| 6684 |
selector: blockSelectors[blockName].selector |
| 6685 |
}); |
| 6686 |
} |
| 6687 |
}); |
| 6688 |
return nodes; |
| 6689 |
}; |
| 6690 |
const toCustomProperties = (tree, blockSelectors) => { |
| 6691 |
const settings = getNodesWithSettings(tree, blockSelectors); |
| 6692 |
let ruleset = ''; |
| 6693 |
settings.forEach(_ref7 => { |
| 6694 |
let { |
| 6695 |
presets, |
| 6696 |
custom, |
| 6697 |
selector |
| 6698 |
} = _ref7; |
| 6699 |
const declarations = getPresetsDeclarations(presets); |
| 6700 |
const customProps = flattenTree(custom, '--wp--custom--', '--'); |
| 6701 |
|
| 6702 |
if (customProps.length > 0) { |
| 6703 |
declarations.push(...customProps); |
| 6704 |
} |
| 6705 |
|
| 6706 |
if (declarations.length > 0) { |
| 6707 |
ruleset = ruleset + `${selector}{${declarations.join(';')};}`; |
| 6708 |
} |
| 6709 |
}); |
| 6710 |
return ruleset; |
| 6711 |
}; |
| 6712 |
const toStyles = (tree, blockSelectors) => { |
| 6713 |
const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); |
| 6714 |
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); |
| 6715 |
let ruleset = '.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }'; |
| 6716 |
nodesWithStyles.forEach(_ref8 => { |
| 6717 |
let { |
| 6718 |
selector, |
| 6719 |
styles |
| 6720 |
} = _ref8; |
| 6721 |
const declarations = getStylesDeclarations(styles); |
| 6722 |
|
| 6723 |
if (declarations.length === 0) { |
| 6724 |
return; |
| 6725 |
} |
| 6726 |
|
| 6727 |
ruleset = ruleset + `${selector}{${declarations.join(';')};}`; |
| 6728 |
}); |
| 6729 |
nodesWithSettings.forEach(_ref9 => { |
| 6730 |
let { |
| 6731 |
selector, |
| 6732 |
presets |
| 6733 |
} = _ref9; |
| 6734 |
|
| 6735 |
if (ROOT_BLOCK_SELECTOR === selector) { |
| 6736 |
// Do not add extra specificity for top-level classes. |
| 6737 |
selector = ''; |
| 6738 |
} |
| 6739 |
|
| 6740 |
const classes = getPresetsClasses(selector, presets); |
| 6741 |
|
| 6742 |
if (!(0,external_lodash_namespaceObject.isEmpty)(classes)) { |
| 6743 |
ruleset = ruleset + classes; |
| 6744 |
} |
| 6745 |
}); |
| 6746 |
return ruleset; |
| 6747 |
}; |
| 6748 |
|
| 6749 |
const getBlockSelectors = blockTypes => { |
| 6750 |
const result = {}; |
| 6751 |
blockTypes.forEach(blockType => { |
| 6752 |
var _blockType$supports$_, _blockType$supports; |
| 6753 |
|
| 6754 |
const name = blockType.name; |
| 6755 |
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('/', '-'); |
| 6756 |
result[name] = { |
| 6757 |
name, |
| 6758 |
selector |
| 6759 |
}; |
| 6760 |
}); |
| 6761 |
return result; |
| 6762 |
}; |
| 6763 |
|
| 6764 |
function useGlobalStylesOutput() { |
| 6765 |
const [stylesheets, setStylesheets] = (0,external_wp_element_namespaceObject.useState)([]); |
| 6766 |
const [settings, setSettings] = (0,external_wp_element_namespaceObject.useState)({}); |
| 6767 |
const { |
| 6768 |
merged: mergedConfig |
| 6769 |
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
| 6770 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 6771 |
if (!(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.styles) || !(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.settings)) { |
| 6772 |
return; |
| 6773 |
} |
| 6774 |
|
| 6775 |
const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)()); |
| 6776 |
const customProperties = toCustomProperties(mergedConfig, blockSelectors); |
| 6777 |
const globalStyles = toStyles(mergedConfig, blockSelectors); |
| 6778 |
setStylesheets([{ |
| 6779 |
css: customProperties, |
| 6780 |
isGlobalStyles: true |
| 6781 |
}, { |
| 6782 |
css: globalStyles, |
| 6783 |
isGlobalStyles: true |
| 6784 |
}]); |
| 6785 |
setSettings(mergedConfig.settings); |
| 6786 |
}, [mergedConfig]); |
| 6787 |
return [stylesheets, settings]; |
| 6788 |
} |
| 6789 |
//# sourceMappingURL=use-global-styles-output.js.map |
| 6790 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/preview.js |
| 6791 |
|
| 6792 |
|
| 6793 |
/** |
| 6794 |
* WordPress dependencies |
| 6795 |
*/ |
| 6796 |
|
| 6797 |
/** |
| 6798 |
* Internal dependencies |
| 6799 |
*/ |
| 6800 |
|
| 6801 |
|
| 6802 |
|
| 6803 |
|
| 6804 |
const StylesPreview = _ref => { |
| 6805 |
let { |
| 6806 |
height = 150 |
| 6807 |
} = _ref; |
| 6808 |
const [fontFamily = 'serif'] = useStyle('typography.fontFamily'); |
| 6809 |
const [textColor = 'black'] = useStyle('color.text'); |
| 6810 |
const [linkColor = 'blue'] = useStyle('elements.link.color.text'); |
| 6811 |
const [backgroundColor = 'white'] = useStyle('color.background'); |
| 6812 |
const [gradientValue] = useStyle('color.gradient'); |
| 6813 |
const [styles] = useGlobalStylesOutput(); |
| 6814 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, { |
| 6815 |
className: "edit-site-global-styles-preview__iframe", |
| 6816 |
head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
| 6817 |
styles: styles |
| 6818 |
}), |
| 6819 |
style: { |
| 6820 |
height |
| 6821 |
} |
| 6822 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6823 |
style: { |
| 6824 |
display: 'flex', |
| 6825 |
gap: 20, |
| 6826 |
alignItems: 'center', |
| 6827 |
justifyContent: 'center', |
| 6828 |
height: '100%', |
| 6829 |
transform: `scale(${height / 150})`, |
| 6830 |
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
| 6831 |
cursor: 'pointer' |
| 6832 |
} |
| 6833 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6834 |
style: { |
| 6835 |
fontFamily, |
| 6836 |
fontSize: '80px' |
| 6837 |
} |
| 6838 |
}, "Aa"), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6839 |
style: { |
| 6840 |
display: 'flex', |
| 6841 |
gap: 20, |
| 6842 |
flexDirection: 'column' |
| 6843 |
} |
| 6844 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6845 |
style: { |
| 6846 |
height: 40, |
| 6847 |
width: 40, |
| 6848 |
background: textColor, |
| 6849 |
borderRadius: 20 |
| 6850 |
} |
| 6851 |
}), ' ', (0,external_wp_element_namespaceObject.createElement)("div", { |
| 6852 |
style: { |
| 6853 |
height: 40, |
| 6854 |
width: 40, |
| 6855 |
background: linkColor, |
| 6856 |
borderRadius: 20 |
| 6857 |
} |
| 6858 |
})))); |
| 6859 |
}; |
| 6860 |
|
| 6861 |
/* harmony default export */ var preview = (StylesPreview); |
| 6862 |
//# sourceMappingURL=preview.js.map |
| 6863 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-root.js |
| 6864 |
|
| 6865 |
|
| 6866 |
/** |
| 6867 |
* WordPress dependencies |
| 6868 |
*/ |
| 6869 |
|
| 6870 |
|
| 6871 |
|
| 6872 |
|
| 6873 |
|
| 6874 |
/** |
| 6875 |
* Internal dependencies |
| 6876 |
*/ |
| 6877 |
|
| 6878 |
|
| 6879 |
|
| 6880 |
|
| 6881 |
|
| 6882 |
function ScreenRoot() { |
| 6883 |
const { |
| 6884 |
variations |
| 6885 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 6886 |
return { |
| 6887 |
variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() |
| 6888 |
}; |
| 6889 |
}, []); |
| 6890 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
| 6891 |
size: "small" |
| 6892 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 6893 |
spacing: 2 |
| 6894 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_wp_element_namespaceObject.createElement)(preview, null)), !!(variations !== null && variations !== void 0 && variations.length) && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 6895 |
path: "/variations" |
| 6896 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 6897 |
justify: "space-between" |
| 6898 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Other styles')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { |
| 6899 |
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
| 6900 |
})))))), (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, { |
| 6901 |
path: "/blocks" |
| 6902 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 6903 |
justify: "space-between" |
| 6904 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { |
| 6905 |
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
| 6906 |
}))))))); |
| 6907 |
} |
| 6908 |
|
| 6909 |
/* harmony default export */ var screen_root = (ScreenRoot); |
| 6910 |
//# sourceMappingURL=screen-root.js.map |
| 6911 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/header.js |
| 6912 |
|
| 6913 |
|
| 6914 |
/** |
| 6915 |
* WordPress dependencies |
| 6916 |
*/ |
| 6917 |
|
| 6918 |
|
| 6919 |
|
| 6920 |
/** |
| 6921 |
* Internal dependencies |
| 6922 |
*/ |
| 6923 |
|
| 6924 |
|
| 6925 |
|
| 6926 |
function ScreenHeader(_ref) { |
| 6927 |
let { |
| 6928 |
title, |
| 6929 |
description |
| 6930 |
} = _ref; |
| 6931 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 6932 |
spacing: 2 |
| 6933 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 6934 |
spacing: 2 |
| 6935 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(NavigationBackButton, { |
| 6936 |
icon: (0,external_wp_element_namespaceObject.createElement)(build_module_icon, { |
| 6937 |
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, |
| 6938 |
variant: "muted" |
| 6939 |
}), |
| 6940 |
size: "small", |
| 6941 |
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') |
| 6942 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 6943 |
level: 5 |
| 6944 |
}, title))), description && (0,external_wp_element_namespaceObject.createElement)("p", { |
| 6945 |
className: "edit-site-global-styles-header__description" |
| 6946 |
}, description)); |
| 6947 |
} |
| 6948 |
|
| 6949 |
/* harmony default export */ var header = (ScreenHeader); |
| 6950 |
//# sourceMappingURL=header.js.map |
| 6951 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-block-list.js |
| 6952 |
|
| 6953 |
|
| 6954 |
/** |
| 6955 |
* WordPress dependencies |
| 6956 |
*/ |
| 6957 |
|
| 6958 |
|
| 6959 |
|
| 6960 |
|
| 6961 |
/** |
| 6962 |
* Internal dependencies |
| 6963 |
*/ |
| 6964 |
|
| 6965 |
|
| 6966 |
|
| 6967 |
|
| 6968 |
|
| 6969 |
|
| 6970 |
|
| 6971 |
|
| 6972 |
function BlockMenuItem(_ref) { |
| 6973 |
let { |
| 6974 |
block |
| 6975 |
} = _ref; |
| 6976 |
const hasTypographyPanel = useHasTypographyPanel(block.name); |
| 6977 |
const hasColorPanel = useHasColorPanel(block.name); |
| 6978 |
const hasBorderPanel = useHasBorderPanel(block.name); |
| 6979 |
const hasDimensionsPanel = useHasDimensionsPanel(block.name); |
| 6980 |
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; |
| 6981 |
const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel; |
| 6982 |
|
| 6983 |
if (!hasBlockMenuItem) { |
| 6984 |
return null; |
| 6985 |
} |
| 6986 |
|
| 6987 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 6988 |
path: '/blocks/' + block.name |
| 6989 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 6990 |
justify: "flex-start" |
| 6991 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
| 6992 |
icon: block.icon |
| 6993 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title))); |
| 6994 |
} |
| 6995 |
|
| 6996 |
function ScreenBlockList() { |
| 6997 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 6998 |
title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), |
| 6999 |
description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') |
| 7000 |
}), (0,external_wp_blocks_namespaceObject.getBlockTypes)().map(block => (0,external_wp_element_namespaceObject.createElement)(BlockMenuItem, { |
| 7001 |
block: block, |
| 7002 |
key: 'menu-itemblock-' + block.name |
| 7003 |
}))); |
| 7004 |
} |
| 7005 |
|
| 7006 |
/* harmony default export */ var screen_block_list = (ScreenBlockList); |
| 7007 |
//# sourceMappingURL=screen-block-list.js.map |
| 7008 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-block.js |
| 7009 |
|
| 7010 |
|
| 7011 |
/** |
| 7012 |
* WordPress dependencies |
| 7013 |
*/ |
| 7014 |
|
| 7015 |
/** |
| 7016 |
* Internal dependencies |
| 7017 |
*/ |
| 7018 |
|
| 7019 |
|
| 7020 |
|
| 7021 |
|
| 7022 |
function ScreenBlock(_ref) { |
| 7023 |
let { |
| 7024 |
name |
| 7025 |
} = _ref; |
| 7026 |
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); |
| 7027 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7028 |
title: blockType.title |
| 7029 |
}), (0,external_wp_element_namespaceObject.createElement)(context_menu, { |
| 7030 |
parentMenu: '/blocks/' + name, |
| 7031 |
name: name |
| 7032 |
})); |
| 7033 |
} |
| 7034 |
|
| 7035 |
/* harmony default export */ var screen_block = (ScreenBlock); |
| 7036 |
//# sourceMappingURL=screen-block.js.map |
| 7037 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/subtitle.js |
| 7038 |
|
| 7039 |
|
| 7040 |
/** |
| 7041 |
* WordPress dependencies |
| 7042 |
*/ |
| 7043 |
|
| 7044 |
|
| 7045 |
function Subtitle(_ref) { |
| 7046 |
let { |
| 7047 |
children |
| 7048 |
} = _ref; |
| 7049 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 7050 |
className: "edit-site-global-styles-subtitle", |
| 7051 |
level: 2 |
| 7052 |
}, children); |
| 7053 |
} |
| 7054 |
|
| 7055 |
/* harmony default export */ var subtitle = (Subtitle); |
| 7056 |
//# sourceMappingURL=subtitle.js.map |
| 7057 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-typography.js |
| 7058 |
|
| 7059 |
|
| 7060 |
/** |
| 7061 |
* WordPress dependencies |
| 7062 |
*/ |
| 7063 |
|
| 7064 |
|
| 7065 |
/** |
| 7066 |
* Internal dependencies |
| 7067 |
*/ |
| 7068 |
|
| 7069 |
|
| 7070 |
|
| 7071 |
|
| 7072 |
|
| 7073 |
|
| 7074 |
|
| 7075 |
function Item(_ref) { |
| 7076 |
let { |
| 7077 |
name, |
| 7078 |
parentMenu, |
| 7079 |
element, |
| 7080 |
label |
| 7081 |
} = _ref; |
| 7082 |
const hasSupport = !name; |
| 7083 |
const prefix = element === 'text' || !element ? '' : `elements.${element}.`; |
| 7084 |
const extraStyles = element === 'link' ? { |
| 7085 |
textDecoration: 'underline' |
| 7086 |
} : {}; |
| 7087 |
const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name); |
| 7088 |
const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name); |
| 7089 |
const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name); |
| 7090 |
const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); |
| 7091 |
const [backgroundColor] = useStyle(prefix + 'color.background', name); |
| 7092 |
const [gradientValue] = useStyle(prefix + 'color.gradient', name); |
| 7093 |
const [color] = useStyle(prefix + 'color.text', name); |
| 7094 |
|
| 7095 |
if (!hasSupport) { |
| 7096 |
return null; |
| 7097 |
} |
| 7098 |
|
| 7099 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 7100 |
path: parentMenu + '/typography/' + element |
| 7101 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 7102 |
justify: "flex-start" |
| 7103 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
| 7104 |
className: "edit-site-global-styles-screen-typography__indicator", |
| 7105 |
style: { |
| 7106 |
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', |
| 7107 |
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
| 7108 |
color, |
| 7109 |
fontStyle, |
| 7110 |
fontWeight, |
| 7111 |
letterSpacing, |
| 7112 |
...extraStyles |
| 7113 |
} |
| 7114 |
}, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, label))); |
| 7115 |
} |
| 7116 |
|
| 7117 |
function ScreenTypography(_ref2) { |
| 7118 |
let { |
| 7119 |
name |
| 7120 |
} = _ref2; |
| 7121 |
const parentMenu = name === undefined ? '' : '/blocks/' + name; |
| 7122 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7123 |
title: (0,external_wp_i18n_namespaceObject.__)('Typography'), |
| 7124 |
description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.') |
| 7125 |
}), !name && (0,external_wp_element_namespaceObject.createElement)("div", { |
| 7126 |
className: "edit-site-global-styles-screen-typography" |
| 7127 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7128 |
spacing: 3 |
| 7129 |
}, (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, { |
| 7130 |
isBordered: true, |
| 7131 |
isSeparated: true |
| 7132 |
}, (0,external_wp_element_namespaceObject.createElement)(Item, { |
| 7133 |
name: name, |
| 7134 |
parentMenu: parentMenu, |
| 7135 |
element: "text", |
| 7136 |
label: (0,external_wp_i18n_namespaceObject.__)('Text') |
| 7137 |
}), (0,external_wp_element_namespaceObject.createElement)(Item, { |
| 7138 |
name: name, |
| 7139 |
parentMenu: parentMenu, |
| 7140 |
element: "link", |
| 7141 |
label: (0,external_wp_i18n_namespaceObject.__)('Links') |
| 7142 |
})))), !!name && (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { |
| 7143 |
name: name, |
| 7144 |
element: "text" |
| 7145 |
})); |
| 7146 |
} |
| 7147 |
|
| 7148 |
/* harmony default export */ var screen_typography = (ScreenTypography); |
| 7149 |
//# sourceMappingURL=screen-typography.js.map |
| 7150 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-typography-element.js |
| 7151 |
|
| 7152 |
|
| 7153 |
/** |
| 7154 |
* WordPress dependencies |
| 7155 |
*/ |
| 7156 |
|
| 7157 |
/** |
| 7158 |
* Internal dependencies |
| 7159 |
*/ |
| 7160 |
|
| 7161 |
|
| 7162 |
|
| 7163 |
const screen_typography_element_elements = { |
| 7164 |
text: { |
| 7165 |
description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), |
| 7166 |
title: (0,external_wp_i18n_namespaceObject.__)('Text') |
| 7167 |
}, |
| 7168 |
link: { |
| 7169 |
description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), |
| 7170 |
title: (0,external_wp_i18n_namespaceObject.__)('Links') |
| 7171 |
} |
| 7172 |
}; |
| 7173 |
|
| 7174 |
function ScreenTypographyElement(_ref) { |
| 7175 |
let { |
| 7176 |
name, |
| 7177 |
element |
| 7178 |
} = _ref; |
| 7179 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7180 |
title: screen_typography_element_elements[element].title, |
| 7181 |
description: screen_typography_element_elements[element].description |
| 7182 |
}), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { |
| 7183 |
name: name, |
| 7184 |
element: element |
| 7185 |
})); |
| 7186 |
} |
| 7187 |
|
| 7188 |
/* harmony default export */ var screen_typography_element = (ScreenTypographyElement); |
| 7189 |
//# sourceMappingURL=screen-typography-element.js.map |
| 7190 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/palette.js |
| 7191 |
|
| 7192 |
|
| 7193 |
/** |
| 7194 |
* WordPress dependencies |
| 7195 |
*/ |
| 7196 |
|
| 7197 |
|
| 7198 |
|
| 7199 |
/** |
| 7200 |
* Internal dependencies |
| 7201 |
*/ |
| 7202 |
|
| 7203 |
|
| 7204 |
|
| 7205 |
|
| 7206 |
const EMPTY_COLORS = []; |
| 7207 |
|
| 7208 |
function Palette(_ref) { |
| 7209 |
let { |
| 7210 |
name |
| 7211 |
} = _ref; |
| 7212 |
const [customColors] = useSetting('color.palette.custom'); |
| 7213 |
const [themeColors] = useSetting('color.palette.theme'); |
| 7214 |
const [defaultColors] = useSetting('color.palette.default'); |
| 7215 |
const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); |
| 7216 |
const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); |
| 7217 |
const screenPath = !name ? '/colors/palette' : '/blocks/' + name + '/colors/palette'; |
| 7218 |
const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of palette colors. |
| 7219 |
(0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors'); |
| 7220 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7221 |
spacing: 3 |
| 7222 |
}, (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, { |
| 7223 |
isBordered: true, |
| 7224 |
isSeparated: true |
| 7225 |
}, (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 7226 |
path: screenPath |
| 7227 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 7228 |
direction: colors.length === 0 ? 'row-reverse' : 'row' |
| 7229 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, { |
| 7230 |
isLayered: false, |
| 7231 |
offset: -8 |
| 7232 |
}, colors.slice(0, 5).map(_ref2 => { |
| 7233 |
let { |
| 7234 |
color |
| 7235 |
} = _ref2; |
| 7236 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
| 7237 |
key: color, |
| 7238 |
colorValue: color |
| 7239 |
}); |
| 7240 |
}))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText))))); |
| 7241 |
} |
| 7242 |
|
| 7243 |
/* harmony default export */ var palette = (Palette); |
| 7244 |
//# sourceMappingURL=palette.js.map |
| 7245 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-colors.js |
| 7246 |
|
| 7247 |
|
| 7248 |
/** |
| 7249 |
* WordPress dependencies |
| 7250 |
*/ |
| 7251 |
|
| 7252 |
|
| 7253 |
/** |
| 7254 |
* Internal dependencies |
| 7255 |
*/ |
| 7256 |
|
| 7257 |
|
| 7258 |
|
| 7259 |
|
| 7260 |
|
| 7261 |
|
| 7262 |
|
| 7263 |
function BackgroundColorItem(_ref) { |
| 7264 |
let { |
| 7265 |
name, |
| 7266 |
parentMenu |
| 7267 |
} = _ref; |
| 7268 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7269 |
const hasSupport = supports.includes('backgroundColor') || supports.includes('background'); |
| 7270 |
const [backgroundColor] = useStyle('color.background', name); |
| 7271 |
const [gradientValue] = useStyle('color.gradient', name); |
| 7272 |
|
| 7273 |
if (!hasSupport) { |
| 7274 |
return null; |
| 7275 |
} |
| 7276 |
|
| 7277 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 7278 |
path: parentMenu + '/colors/background' |
| 7279 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 7280 |
justify: "flex-start" |
| 7281 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
| 7282 |
colorValue: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor |
| 7283 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Background')))); |
| 7284 |
} |
| 7285 |
|
| 7286 |
function TextColorItem(_ref2) { |
| 7287 |
let { |
| 7288 |
name, |
| 7289 |
parentMenu |
| 7290 |
} = _ref2; |
| 7291 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7292 |
const hasSupport = supports.includes('color'); |
| 7293 |
const [color] = useStyle('color.text', name); |
| 7294 |
|
| 7295 |
if (!hasSupport) { |
| 7296 |
return null; |
| 7297 |
} |
| 7298 |
|
| 7299 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 7300 |
path: parentMenu + '/colors/text' |
| 7301 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 7302 |
justify: "flex-start" |
| 7303 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
| 7304 |
colorValue: color |
| 7305 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Text')))); |
| 7306 |
} |
| 7307 |
|
| 7308 |
function LinkColorItem(_ref3) { |
| 7309 |
let { |
| 7310 |
name, |
| 7311 |
parentMenu |
| 7312 |
} = _ref3; |
| 7313 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7314 |
const hasSupport = supports.includes('linkColor'); |
| 7315 |
const [color] = useStyle('elements.link.color.text', name); |
| 7316 |
|
| 7317 |
if (!hasSupport) { |
| 7318 |
return null; |
| 7319 |
} |
| 7320 |
|
| 7321 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
| 7322 |
path: parentMenu + '/colors/link' |
| 7323 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 7324 |
justify: "flex-start" |
| 7325 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
| 7326 |
colorValue: color |
| 7327 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Links')))); |
| 7328 |
} |
| 7329 |
|
| 7330 |
function ScreenColors(_ref4) { |
| 7331 |
let { |
| 7332 |
name |
| 7333 |
} = _ref4; |
| 7334 |
const parentMenu = name === undefined ? '' : '/blocks/' + name; |
| 7335 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7336 |
title: (0,external_wp_i18n_namespaceObject.__)('Colors'), |
| 7337 |
description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.') |
| 7338 |
}), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 7339 |
className: "edit-site-global-styles-screen-colors" |
| 7340 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7341 |
spacing: 10 |
| 7342 |
}, (0,external_wp_element_namespaceObject.createElement)(palette, { |
| 7343 |
name: name |
| 7344 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7345 |
spacing: 3 |
| 7346 |
}, (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, { |
| 7347 |
isBordered: true, |
| 7348 |
isSeparated: true |
| 7349 |
}, (0,external_wp_element_namespaceObject.createElement)(BackgroundColorItem, { |
| 7350 |
name: name, |
| 7351 |
parentMenu: parentMenu |
| 7352 |
}), (0,external_wp_element_namespaceObject.createElement)(TextColorItem, { |
| 7353 |
name: name, |
| 7354 |
parentMenu: parentMenu |
| 7355 |
}), (0,external_wp_element_namespaceObject.createElement)(LinkColorItem, { |
| 7356 |
name: name, |
| 7357 |
parentMenu: parentMenu |
| 7358 |
})))))); |
| 7359 |
} |
| 7360 |
|
| 7361 |
/* harmony default export */ var screen_colors = (ScreenColors); |
| 7362 |
//# sourceMappingURL=screen-colors.js.map |
| 7363 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/color-palette-panel.js |
| 7364 |
|
| 7365 |
|
| 7366 |
/** |
| 7367 |
* WordPress dependencies |
| 7368 |
*/ |
| 7369 |
|
| 7370 |
|
| 7371 |
/** |
| 7372 |
* Internal dependencies |
| 7373 |
*/ |
| 7374 |
|
| 7375 |
|
| 7376 |
function ColorPalettePanel(_ref) { |
| 7377 |
let { |
| 7378 |
name |
| 7379 |
} = _ref; |
| 7380 |
const [themeColors, setThemeColors] = useSetting('color.palette.theme', name); |
| 7381 |
const [baseThemeColors] = useSetting('color.palette.theme', name, 'base'); |
| 7382 |
const [defaultColors, setDefaultColors] = useSetting('color.palette.default', name); |
| 7383 |
const [baseDefaultColors] = useSetting('color.palette.default', name, 'base'); |
| 7384 |
const [customColors, setCustomColors] = useSetting('color.palette.custom', name); |
| 7385 |
const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); |
| 7386 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7387 |
className: "edit-site-global-styles-color-palette-panel", |
| 7388 |
spacing: 10 |
| 7389 |
}, !!themeColors && !!themeColors.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7390 |
canReset: themeColors !== baseThemeColors, |
| 7391 |
canOnlyChangeValues: true, |
| 7392 |
colors: themeColors, |
| 7393 |
onChange: setThemeColors, |
| 7394 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') |
| 7395 |
}), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7396 |
canReset: defaultColors !== baseDefaultColors, |
| 7397 |
canOnlyChangeValues: true, |
| 7398 |
colors: defaultColors, |
| 7399 |
onChange: setDefaultColors, |
| 7400 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') |
| 7401 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7402 |
colors: customColors, |
| 7403 |
onChange: setCustomColors, |
| 7404 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), |
| 7405 |
emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'), |
| 7406 |
slugPrefix: "custom-" |
| 7407 |
})); |
| 7408 |
} |
| 7409 |
//# sourceMappingURL=color-palette-panel.js.map |
| 7410 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/gradients-palette-panel.js |
| 7411 |
|
| 7412 |
|
| 7413 |
/** |
| 7414 |
* External dependencies |
| 7415 |
*/ |
| 7416 |
|
| 7417 |
/** |
| 7418 |
* WordPress dependencies |
| 7419 |
*/ |
| 7420 |
|
| 7421 |
|
| 7422 |
|
| 7423 |
/** |
| 7424 |
* Internal dependencies |
| 7425 |
*/ |
| 7426 |
|
| 7427 |
|
| 7428 |
|
| 7429 |
function GradientPalettePanel(_ref) { |
| 7430 |
let { |
| 7431 |
name |
| 7432 |
} = _ref; |
| 7433 |
const [themeGradients, setThemeGradients] = useSetting('color.gradients.theme', name); |
| 7434 |
const [baseThemeGradients] = useSetting('color.gradients.theme', name, 'base'); |
| 7435 |
const [defaultGradients, setDefaultGradients] = useSetting('color.gradients.default', name); |
| 7436 |
const [baseDefaultGradients] = useSetting('color.gradients.default', name, 'base'); |
| 7437 |
const [customGradients, setCustomGradients] = useSetting('color.gradients.custom', name); |
| 7438 |
const [defaultPaletteEnabled] = useSetting('color.defaultGradients', name); |
| 7439 |
const [duotonePalette] = useSetting('color.duotone') || []; |
| 7440 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
| 7441 |
className: "edit-site-global-styles-gradient-palette-panel", |
| 7442 |
spacing: 10 |
| 7443 |
}, !!themeGradients && !!themeGradients.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7444 |
canReset: themeGradients !== baseThemeGradients, |
| 7445 |
canOnlyChangeValues: true, |
| 7446 |
gradients: themeGradients, |
| 7447 |
onChange: setThemeGradients, |
| 7448 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') |
| 7449 |
}), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7450 |
canReset: defaultGradients !== baseDefaultGradients, |
| 7451 |
canOnlyChangeValues: true, |
| 7452 |
gradients: defaultGradients, |
| 7453 |
onChange: setDefaultGradients, |
| 7454 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') |
| 7455 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
| 7456 |
gradients: customGradients, |
| 7457 |
onChange: setCustomGradients, |
| 7458 |
paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), |
| 7459 |
emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'), |
| 7460 |
slugPrefix: "custom-" |
| 7461 |
}), (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, { |
| 7462 |
margin: 3 |
| 7463 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, { |
| 7464 |
duotonePalette: duotonePalette, |
| 7465 |
disableCustomDuotone: true, |
| 7466 |
disableCustomColors: true, |
| 7467 |
clearable: false, |
| 7468 |
onChange: external_lodash_namespaceObject.noop |
| 7469 |
}))); |
| 7470 |
} |
| 7471 |
//# sourceMappingURL=gradients-palette-panel.js.map |
| 7472 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-color-palette.js |
| 7473 |
|
| 7474 |
|
| 7475 |
/** |
| 7476 |
* WordPress dependencies |
| 7477 |
*/ |
| 7478 |
|
| 7479 |
|
| 7480 |
|
| 7481 |
/** |
| 7482 |
* Internal dependencies |
| 7483 |
*/ |
| 7484 |
|
| 7485 |
|
| 7486 |
|
| 7487 |
|
| 7488 |
|
| 7489 |
function ScreenColorPalette(_ref) { |
| 7490 |
let { |
| 7491 |
name |
| 7492 |
} = _ref; |
| 7493 |
const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('solid'); |
| 7494 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7495 |
title: (0,external_wp_i18n_namespaceObject.__)('Palette'), |
| 7496 |
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.') |
| 7497 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { |
| 7498 |
className: "edit-site-screen-color-palette-toggle", |
| 7499 |
value: currentTab, |
| 7500 |
onChange: setCurrentTab, |
| 7501 |
label: (0,external_wp_i18n_namespaceObject.__)('Select palette type'), |
| 7502 |
hideLabelFromVision: true, |
| 7503 |
isBlock: true |
| 7504 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { |
| 7505 |
value: "solid", |
| 7506 |
label: (0,external_wp_i18n_namespaceObject.__)('Solid') |
| 7507 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { |
| 7508 |
value: "gradient", |
| 7509 |
label: (0,external_wp_i18n_namespaceObject.__)('Gradient') |
| 7510 |
})), currentTab === 'solid' && (0,external_wp_element_namespaceObject.createElement)(ColorPalettePanel, { |
| 7511 |
name: name |
| 7512 |
}), currentTab === 'gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientPalettePanel, { |
| 7513 |
name: name |
| 7514 |
})); |
| 7515 |
} |
| 7516 |
|
| 7517 |
/* harmony default export */ var screen_color_palette = (ScreenColorPalette); |
| 7518 |
//# sourceMappingURL=screen-color-palette.js.map |
| 7519 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-background-color.js |
| 7520 |
|
| 7521 |
|
| 7522 |
|
| 7523 |
/** |
| 7524 |
* WordPress dependencies |
| 7525 |
*/ |
| 7526 |
|
| 7527 |
|
| 7528 |
/** |
| 7529 |
* Internal dependencies |
| 7530 |
*/ |
| 7531 |
|
| 7532 |
|
| 7533 |
|
| 7534 |
|
| 7535 |
function ScreenBackgroundColor(_ref) { |
| 7536 |
let { |
| 7537 |
name |
| 7538 |
} = _ref; |
| 7539 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7540 |
const [solids] = useSetting('color.palette', name); |
| 7541 |
const [gradients] = useSetting('color.gradients', name); |
| 7542 |
const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
| 7543 |
const [areCustomGradientsEnabled] = useSetting('color.customGradient', name); |
| 7544 |
const colorsPerOrigin = useColorsPerOrigin(name); |
| 7545 |
const gradientsPerOrigin = useGradientsPerOrigin(name); |
| 7546 |
const [isBackgroundEnabled] = useSetting('color.background', name); |
| 7547 |
const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
| 7548 |
const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled); |
| 7549 |
const [backgroundColor, setBackgroundColor] = useStyle('color.background', name); |
| 7550 |
const [userBackgroundColor] = useStyle('color.background', name, 'user'); |
| 7551 |
const [gradient, setGradient] = useStyle('color.gradient', name); |
| 7552 |
const [userGradient] = useStyle('color.gradient', name, 'user'); |
| 7553 |
|
| 7554 |
if (!hasBackgroundColor && !hasGradientColor) { |
| 7555 |
return null; |
| 7556 |
} |
| 7557 |
|
| 7558 |
let backgroundSettings = {}; |
| 7559 |
|
| 7560 |
if (hasBackgroundColor) { |
| 7561 |
backgroundSettings = { |
| 7562 |
colorValue: backgroundColor, |
| 7563 |
onColorChange: setBackgroundColor |
| 7564 |
}; |
| 7565 |
|
| 7566 |
if (backgroundColor) { |
| 7567 |
backgroundSettings.clearable = backgroundColor === userBackgroundColor; |
| 7568 |
} |
| 7569 |
} |
| 7570 |
|
| 7571 |
let gradientSettings = {}; |
| 7572 |
|
| 7573 |
if (hasGradientColor) { |
| 7574 |
gradientSettings = { |
| 7575 |
gradientValue: gradient, |
| 7576 |
onGradientChange: setGradient |
| 7577 |
}; |
| 7578 |
|
| 7579 |
if (gradient) { |
| 7580 |
gradientSettings.clearable = gradient === userGradient; |
| 7581 |
} |
| 7582 |
} |
| 7583 |
|
| 7584 |
const controlProps = { ...backgroundSettings, |
| 7585 |
...gradientSettings |
| 7586 |
}; |
| 7587 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7588 |
title: (0,external_wp_i18n_namespaceObject.__)('Background'), |
| 7589 |
description: (0,external_wp_i18n_namespaceObject.__)('Set a background color or gradient for the whole site.') |
| 7590 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({ |
| 7591 |
className: "edit-site-screen-background-color__control", |
| 7592 |
colors: colorsPerOrigin, |
| 7593 |
gradients: gradientsPerOrigin, |
| 7594 |
disableCustomColors: !areCustomSolidsEnabled, |
| 7595 |
disableCustomGradients: !areCustomGradientsEnabled, |
| 7596 |
__experimentalHasMultipleOrigins: true, |
| 7597 |
showTitle: false, |
| 7598 |
enableAlpha: true, |
| 7599 |
__experimentalIsRenderedInSidebar: true |
| 7600 |
}, controlProps))); |
| 7601 |
} |
| 7602 |
|
| 7603 |
/* harmony default export */ var screen_background_color = (ScreenBackgroundColor); |
| 7604 |
//# sourceMappingURL=screen-background-color.js.map |
| 7605 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-text-color.js |
| 7606 |
|
| 7607 |
|
| 7608 |
/** |
| 7609 |
* WordPress dependencies |
| 7610 |
*/ |
| 7611 |
|
| 7612 |
|
| 7613 |
/** |
| 7614 |
* Internal dependencies |
| 7615 |
*/ |
| 7616 |
|
| 7617 |
|
| 7618 |
|
| 7619 |
|
| 7620 |
function ScreenTextColor(_ref) { |
| 7621 |
let { |
| 7622 |
name |
| 7623 |
} = _ref; |
| 7624 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7625 |
const [solids] = useSetting('color.palette', name); |
| 7626 |
const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
| 7627 |
const [isTextEnabled] = useSetting('color.text', name); |
| 7628 |
const colorsPerOrigin = useColorsPerOrigin(name); |
| 7629 |
const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
| 7630 |
const [color, setColor] = useStyle('color.text', name); |
| 7631 |
const [userColor] = useStyle('color.text', name, 'user'); |
| 7632 |
|
| 7633 |
if (!hasTextColor) { |
| 7634 |
return null; |
| 7635 |
} |
| 7636 |
|
| 7637 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7638 |
title: (0,external_wp_i18n_namespaceObject.__)('Text'), |
| 7639 |
description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for text across the site.') |
| 7640 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { |
| 7641 |
className: "edit-site-screen-text-color__control", |
| 7642 |
colors: colorsPerOrigin, |
| 7643 |
disableCustomColors: !areCustomSolidsEnabled, |
| 7644 |
__experimentalHasMultipleOrigins: true, |
| 7645 |
showTitle: false, |
| 7646 |
enableAlpha: true, |
| 7647 |
__experimentalIsRenderedInSidebar: true, |
| 7648 |
colorValue: color, |
| 7649 |
onColorChange: setColor, |
| 7650 |
clearable: color === userColor |
| 7651 |
})); |
| 7652 |
} |
| 7653 |
|
| 7654 |
/* harmony default export */ var screen_text_color = (ScreenTextColor); |
| 7655 |
//# sourceMappingURL=screen-text-color.js.map |
| 7656 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-link-color.js |
| 7657 |
|
| 7658 |
|
| 7659 |
/** |
| 7660 |
* WordPress dependencies |
| 7661 |
*/ |
| 7662 |
|
| 7663 |
|
| 7664 |
/** |
| 7665 |
* Internal dependencies |
| 7666 |
*/ |
| 7667 |
|
| 7668 |
|
| 7669 |
|
| 7670 |
|
| 7671 |
function ScreenLinkColor(_ref) { |
| 7672 |
let { |
| 7673 |
name |
| 7674 |
} = _ref; |
| 7675 |
const supports = getSupportedGlobalStylesPanels(name); |
| 7676 |
const [solids] = useSetting('color.palette', name); |
| 7677 |
const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
| 7678 |
const colorsPerOrigin = useColorsPerOrigin(name); |
| 7679 |
const [isLinkEnabled] = useSetting('color.link', name); |
| 7680 |
const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
| 7681 |
const [linkColor, setLinkColor] = useStyle('elements.link.color.text', name); |
| 7682 |
const [userLinkColor] = useStyle('elements.link.color.text', name, 'user'); |
| 7683 |
|
| 7684 |
if (!hasLinkColor) { |
| 7685 |
return null; |
| 7686 |
} |
| 7687 |
|
| 7688 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7689 |
title: (0,external_wp_i18n_namespaceObject.__)('Links'), |
| 7690 |
description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for links across the site.') |
| 7691 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { |
| 7692 |
className: "edit-site-screen-link-color__control", |
| 7693 |
colors: colorsPerOrigin, |
| 7694 |
disableCustomColors: !areCustomSolidsEnabled, |
| 7695 |
__experimentalHasMultipleOrigins: true, |
| 7696 |
showTitle: false, |
| 7697 |
enableAlpha: true, |
| 7698 |
__experimentalIsRenderedInSidebar: true, |
| 7699 |
colorValue: linkColor, |
| 7700 |
onColorChange: setLinkColor, |
| 7701 |
clearable: linkColor === userLinkColor |
| 7702 |
})); |
| 7703 |
} |
| 7704 |
|
| 7705 |
/* harmony default export */ var screen_link_color = (ScreenLinkColor); |
| 7706 |
//# sourceMappingURL=screen-link-color.js.map |
| 7707 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-layout.js |
| 7708 |
|
| 7709 |
|
| 7710 |
/** |
| 7711 |
* WordPress dependencies |
| 7712 |
*/ |
| 7713 |
|
| 7714 |
/** |
| 7715 |
* Internal dependencies |
| 7716 |
*/ |
| 7717 |
|
| 7718 |
|
| 7719 |
|
| 7720 |
|
| 7721 |
|
| 7722 |
function ScreenLayout(_ref) { |
| 7723 |
let { |
| 7724 |
name |
| 7725 |
} = _ref; |
| 7726 |
const hasBorderPanel = useHasBorderPanel(name); |
| 7727 |
const hasDimensionsPanel = useHasDimensionsPanel(name); |
| 7728 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7729 |
title: (0,external_wp_i18n_namespaceObject.__)('Layout') |
| 7730 |
}), hasDimensionsPanel && (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, { |
| 7731 |
name: name |
| 7732 |
}), hasBorderPanel && (0,external_wp_element_namespaceObject.createElement)(BorderPanel, { |
| 7733 |
name: name |
| 7734 |
})); |
| 7735 |
} |
| 7736 |
|
| 7737 |
/* harmony default export */ var screen_layout = (ScreenLayout); |
| 7738 |
//# sourceMappingURL=screen-layout.js.map |
| 7739 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/global-styles-provider.js |
| 7740 |
|
| 7741 |
|
| 7742 |
/** |
| 7743 |
* External dependencies |
| 7744 |
*/ |
| 7745 |
|
| 7746 |
/** |
| 7747 |
* WordPress dependencies |
| 7748 |
*/ |
| 7749 |
|
| 7750 |
|
| 7751 |
|
| 7752 |
|
| 7753 |
/** |
| 7754 |
* Internal dependencies |
| 7755 |
*/ |
| 7756 |
|
| 7757 |
|
| 7758 |
|
| 7759 |
function mergeTreesCustomizer(_, srcValue) { |
| 7760 |
// We only pass as arrays the presets, |
| 7761 |
// in which case we want the new array of values |
| 7762 |
// to override the old array (no merging). |
| 7763 |
if (Array.isArray(srcValue)) { |
| 7764 |
return srcValue; |
| 7765 |
} |
| 7766 |
} |
| 7767 |
|
| 7768 |
function mergeBaseAndUserConfigs(base, user) { |
| 7769 |
return (0,external_lodash_namespaceObject.mergeWith)({}, base, user, mergeTreesCustomizer); |
| 7770 |
} |
| 7771 |
|
| 7772 |
const cleanEmptyObject = object => { |
| 7773 |
if (!(0,external_lodash_namespaceObject.isObject)(object) || Array.isArray(object)) { |
| 7774 |
return object; |
| 7775 |
} |
| 7776 |
|
| 7777 |
const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), external_lodash_namespaceObject.identity); |
| 7778 |
return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects; |
| 7779 |
}; |
| 7780 |
|
| 7781 |
function useGlobalStylesUserConfig() { |
| 7782 |
const { |
| 7783 |
globalStylesId, |
| 7784 |
settings, |
| 7785 |
styles |
| 7786 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 7787 |
const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); |
| 7788 |
|
| 7789 |
const record = _globalStylesId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined; |
| 7790 |
return { |
| 7791 |
globalStylesId: _globalStylesId, |
| 7792 |
settings: record === null || record === void 0 ? void 0 : record.settings, |
| 7793 |
styles: record === null || record === void 0 ? void 0 : record.styles |
| 7794 |
}; |
| 7795 |
}, []); |
| 7796 |
const { |
| 7797 |
getEditedEntityRecord |
| 7798 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
| 7799 |
const { |
| 7800 |
editEntityRecord |
| 7801 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 7802 |
const config = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7803 |
return { |
| 7804 |
settings: settings !== null && settings !== void 0 ? settings : {}, |
| 7805 |
styles: styles !== null && styles !== void 0 ? styles : {} |
| 7806 |
}; |
| 7807 |
}, [settings, styles]); |
| 7808 |
const setConfig = (0,external_wp_element_namespaceObject.useCallback)(callback => { |
| 7809 |
var _record$styles, _record$settings; |
| 7810 |
|
| 7811 |
const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); |
| 7812 |
const currentConfig = { |
| 7813 |
styles: (_record$styles = record === null || record === void 0 ? void 0 : record.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, |
| 7814 |
settings: (_record$settings = record === null || record === void 0 ? void 0 : record.settings) !== null && _record$settings !== void 0 ? _record$settings : {} |
| 7815 |
}; |
| 7816 |
const updatedConfig = callback(currentConfig); |
| 7817 |
editEntityRecord('root', 'globalStyles', globalStylesId, { |
| 7818 |
styles: cleanEmptyObject(updatedConfig.styles) || {}, |
| 7819 |
settings: cleanEmptyObject(updatedConfig.settings) || {} |
| 7820 |
}); |
| 7821 |
}, [globalStylesId]); |
| 7822 |
return [!!settings || !!styles, config, setConfig]; |
| 7823 |
} |
| 7824 |
|
| 7825 |
function useGlobalStylesBaseConfig() { |
| 7826 |
const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 7827 |
return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(); |
| 7828 |
}, []); |
| 7829 |
return [!!baseConfig, baseConfig]; |
| 7830 |
} |
| 7831 |
|
| 7832 |
function useGlobalStylesContext() { |
| 7833 |
const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); |
| 7834 |
const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); |
| 7835 |
const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7836 |
if (!baseConfig || !userConfig) { |
| 7837 |
return {}; |
| 7838 |
} |
| 7839 |
|
| 7840 |
return mergeBaseAndUserConfigs(baseConfig, userConfig); |
| 7841 |
}, [userConfig, baseConfig]); |
| 7842 |
const context = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7843 |
return { |
| 7844 |
isReady: isUserConfigReady && isBaseConfigReady, |
| 7845 |
user: userConfig, |
| 7846 |
base: baseConfig, |
| 7847 |
merged: mergedConfig, |
| 7848 |
setUserConfig |
| 7849 |
}; |
| 7850 |
}, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); |
| 7851 |
return context; |
| 7852 |
} |
| 7853 |
|
| 7854 |
function GlobalStylesProvider(_ref) { |
| 7855 |
let { |
| 7856 |
children |
| 7857 |
} = _ref; |
| 7858 |
const context = useGlobalStylesContext(); |
| 7859 |
|
| 7860 |
if (!context.isReady) { |
| 7861 |
return null; |
| 7862 |
} |
| 7863 |
|
| 7864 |
return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { |
| 7865 |
value: context |
| 7866 |
}, children); |
| 7867 |
} |
| 7868 |
//# sourceMappingURL=global-styles-provider.js.map |
| 7869 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/screen-style-variations.js |
| 7870 |
|
| 7871 |
|
| 7872 |
/** |
| 7873 |
* External dependencies |
| 7874 |
*/ |
| 7875 |
|
| 7876 |
|
| 7877 |
/** |
| 7878 |
* WordPress dependencies |
| 7879 |
*/ |
| 7880 |
|
| 7881 |
|
| 7882 |
|
| 7883 |
|
| 7884 |
|
| 7885 |
|
| 7886 |
|
| 7887 |
/** |
| 7888 |
* Internal dependencies |
| 7889 |
*/ |
| 7890 |
|
| 7891 |
|
| 7892 |
|
| 7893 |
|
| 7894 |
|
| 7895 |
|
| 7896 |
function compareVariations(a, b) { |
| 7897 |
return (0,external_lodash_namespaceObject.isEqual)(a.styles, b.styles) && (0,external_lodash_namespaceObject.isEqual)(a.settings, b.settings); |
| 7898 |
} |
| 7899 |
|
| 7900 |
function Variation(_ref) { |
| 7901 |
let { |
| 7902 |
variation |
| 7903 |
} = _ref; |
| 7904 |
const { |
| 7905 |
base, |
| 7906 |
user, |
| 7907 |
setUserConfig |
| 7908 |
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
| 7909 |
const context = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7910 |
var _variation$settings, _variation$styles; |
| 7911 |
|
| 7912 |
return { |
| 7913 |
user: { |
| 7914 |
settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, |
| 7915 |
styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {} |
| 7916 |
}, |
| 7917 |
base, |
| 7918 |
merged: mergeBaseAndUserConfigs(base, variation), |
| 7919 |
setUserConfig: () => {} |
| 7920 |
}; |
| 7921 |
}, [variation, base]); |
| 7922 |
|
| 7923 |
const selectVariation = () => { |
| 7924 |
setUserConfig(() => { |
| 7925 |
return { |
| 7926 |
settings: variation.settings, |
| 7927 |
styles: variation.styles |
| 7928 |
}; |
| 7929 |
}); |
| 7930 |
}; |
| 7931 |
|
| 7932 |
const selectOnEnter = event => { |
| 7933 |
if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { |
| 7934 |
event.preventDefault(); |
| 7935 |
selectVariation(); |
| 7936 |
} |
| 7937 |
}; |
| 7938 |
|
| 7939 |
const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7940 |
return compareVariations(user, variation); |
| 7941 |
}, [user, variation]); |
| 7942 |
return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { |
| 7943 |
value: context |
| 7944 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 7945 |
className: classnames_default()('edit-site-global-styles-variations_item', { |
| 7946 |
'is-active': isActive |
| 7947 |
}), |
| 7948 |
role: "button", |
| 7949 |
onClick: selectVariation, |
| 7950 |
onKeyDown: selectOnEnter, |
| 7951 |
tabIndex: "0" |
| 7952 |
}, (0,external_wp_element_namespaceObject.createElement)(preview, { |
| 7953 |
height: 100 |
| 7954 |
}))); |
| 7955 |
} |
| 7956 |
|
| 7957 |
function ScreenStyleVariations() { |
| 7958 |
const { |
| 7959 |
variations |
| 7960 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 7961 |
return { |
| 7962 |
variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() |
| 7963 |
}; |
| 7964 |
}, []); |
| 7965 |
const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 7966 |
return [{ |
| 7967 |
name: (0,external_wp_i18n_namespaceObject.__)('Default'), |
| 7968 |
settings: {}, |
| 7969 |
styles: {} |
| 7970 |
}, ...variations]; |
| 7971 |
}, [variations]); |
| 7972 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
| 7973 |
back: "/", |
| 7974 |
title: (0,external_wp_i18n_namespaceObject.__)('Other styles'), |
| 7975 |
description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles') |
| 7976 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
| 7977 |
size: "small", |
| 7978 |
isBorderless: true |
| 7979 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, { |
| 7980 |
columns: 2 |
| 7981 |
}, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0,external_wp_element_namespaceObject.createElement)(Variation, { |
| 7982 |
key: index, |
| 7983 |
variation: variation |
| 7984 |
})))))); |
| 7985 |
} |
| 7986 |
|
| 7987 |
/* harmony default export */ var screen_style_variations = (ScreenStyleVariations); |
| 7988 |
//# sourceMappingURL=screen-style-variations.js.map |
| 7989 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/ui.js |
| 7990 |
|
| 7991 |
|
| 7992 |
|
| 7993 |
/** |
| 7994 |
* WordPress dependencies |
| 7995 |
*/ |
| 7996 |
|
| 7997 |
|
| 7998 |
/** |
| 7999 |
* Internal dependencies |
| 8000 |
*/ |
| 8001 |
|
| 8002 |
|
| 8003 |
|
| 8004 |
|
| 8005 |
|
| 8006 |
|
| 8007 |
|
| 8008 |
|
| 8009 |
|
| 8010 |
|
| 8011 |
|
| 8012 |
|
| 8013 |
|
| 8014 |
|
| 8015 |
function GlobalStylesNavigationScreen(_ref) { |
| 8016 |
let { |
| 8017 |
className, |
| 8018 |
...props |
| 8019 |
} = _ref; |
| 8020 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, extends_extends({ |
| 8021 |
className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ') |
| 8022 |
}, props)); |
| 8023 |
} |
| 8024 |
|
| 8025 |
function ContextScreens(_ref2) { |
| 8026 |
let { |
| 8027 |
name |
| 8028 |
} = _ref2; |
| 8029 |
const parentMenu = name === undefined ? '' : '/blocks/' + name; |
| 8030 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8031 |
path: parentMenu + '/typography' |
| 8032 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_typography, { |
| 8033 |
name: name |
| 8034 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8035 |
path: parentMenu + '/typography/text' |
| 8036 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { |
| 8037 |
name: name, |
| 8038 |
element: "text" |
| 8039 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8040 |
path: parentMenu + '/typography/link' |
| 8041 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { |
| 8042 |
name: name, |
| 8043 |
element: "link" |
| 8044 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8045 |
path: parentMenu + '/colors' |
| 8046 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_colors, { |
| 8047 |
name: name |
| 8048 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8049 |
path: parentMenu + '/colors/palette' |
| 8050 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_color_palette, { |
| 8051 |
name: name |
| 8052 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8053 |
path: parentMenu + '/colors/background' |
| 8054 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_background_color, { |
| 8055 |
name: name |
| 8056 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8057 |
path: parentMenu + '/colors/text' |
| 8058 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_text_color, { |
| 8059 |
name: name |
| 8060 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8061 |
path: parentMenu + '/colors/link' |
| 8062 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_link_color, { |
| 8063 |
name: name |
| 8064 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8065 |
path: parentMenu + '/layout' |
| 8066 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_layout, { |
| 8067 |
name: name |
| 8068 |
}))); |
| 8069 |
} |
| 8070 |
|
| 8071 |
function GlobalStylesUI() { |
| 8072 |
const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); |
| 8073 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { |
| 8074 |
className: "edit-site-global-styles-sidebar__navigator-provider", |
| 8075 |
initialPath: "/" |
| 8076 |
}, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8077 |
path: "/" |
| 8078 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_root, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8079 |
path: "/variations" |
| 8080 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_style_variations, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8081 |
path: "/blocks" |
| 8082 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_block_list, null)), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
| 8083 |
key: 'menu-block-' + block.name, |
| 8084 |
path: '/blocks/' + block.name |
| 8085 |
}, (0,external_wp_element_namespaceObject.createElement)(screen_block, { |
| 8086 |
name: block.name |
| 8087 |
}))), (0,external_wp_element_namespaceObject.createElement)(ContextScreens, null), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(ContextScreens, { |
| 8088 |
key: 'screens-block-' + block.name, |
| 8089 |
name: block.name |
| 8090 |
}))); |
| 8091 |
} |
| 8092 |
|
| 8093 |
/* harmony default export */ var ui = (GlobalStylesUI); |
| 8094 |
//# sourceMappingURL=ui.js.map |
| 8095 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/global-styles/index.js |
| 8096 |
|
| 8097 |
|
| 8098 |
|
| 8099 |
//# sourceMappingURL=index.js.map |
| 8100 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/global-styles-sidebar.js |
| 8101 |
|
| 8102 |
|
| 8103 |
/** |
| 8104 |
* WordPress dependencies |
| 8105 |
*/ |
| 8106 |
|
| 8107 |
|
| 8108 |
|
| 8109 |
|
| 8110 |
/** |
| 8111 |
* Internal dependencies |
| 8112 |
*/ |
| 8113 |
|
| 8114 |
|
| 8115 |
|
| 8116 |
|
| 8117 |
function GlobalStylesSidebar() { |
| 8118 |
const [canReset, onReset] = useGlobalStylesReset(); |
| 8119 |
const { |
| 8120 |
toggleFeature |
| 8121 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 8122 |
return (0,external_wp_element_namespaceObject.createElement)(DefaultSidebar, { |
| 8123 |
className: "edit-site-global-styles-sidebar", |
| 8124 |
identifier: "edit-site/global-styles", |
| 8125 |
title: (0,external_wp_i18n_namespaceObject.__)('Styles'), |
| 8126 |
icon: library_styles, |
| 8127 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'), |
| 8128 |
panelClassName: "edit-site-global-styles-sidebar__panel", |
| 8129 |
header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_wp_element_namespaceObject.createElement)("span", { |
| 8130 |
className: "edit-site-global-styles-sidebar__beta" |
| 8131 |
}, (0,external_wp_i18n_namespaceObject.__)('Beta'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
| 8132 |
icon: more_vertical, |
| 8133 |
label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'), |
| 8134 |
toggleProps: { |
| 8135 |
disabled: !canReset |
| 8136 |
}, |
| 8137 |
controls: [{ |
| 8138 |
title: (0,external_wp_i18n_namespaceObject.__)('Reset to defaults'), |
| 8139 |
onClick: onReset |
| 8140 |
}, { |
| 8141 |
title: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'), |
| 8142 |
onClick: () => toggleFeature('welcomeGuideStyles') |
| 8143 |
}] |
| 8144 |
}))) |
| 8145 |
}, (0,external_wp_element_namespaceObject.createElement)(ui, null)); |
| 8146 |
} |
| 8147 |
//# sourceMappingURL=global-styles-sidebar.js.map |
| 8148 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/constants.js |
| 8149 |
const SIDEBAR_TEMPLATE = 'edit-site/template'; |
| 8150 |
const SIDEBAR_BLOCK = 'edit-site/block-inspector'; |
| 8151 |
//# sourceMappingURL=constants.js.map |
| 8152 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/settings-header/index.js |
| 8153 |
|
| 8154 |
|
| 8155 |
/** |
| 8156 |
* WordPress dependencies |
| 8157 |
*/ |
| 8158 |
|
| 8159 |
|
| 8160 |
|
| 8161 |
|
| 8162 |
/** |
| 8163 |
* Internal dependencies |
| 8164 |
*/ |
| 8165 |
|
| 8166 |
|
| 8167 |
|
| 8168 |
|
| 8169 |
const SettingsHeader = _ref => { |
| 8170 |
let { |
| 8171 |
sidebarName |
| 8172 |
} = _ref; |
| 8173 |
const { |
| 8174 |
enableComplementaryArea |
| 8175 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 8176 |
|
| 8177 |
const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); |
| 8178 |
|
| 8179 |
const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
| 8180 |
|
| 8181 |
const [templateAriaLabel, templateActiveClass] = sidebarName === SIDEBAR_TEMPLATE ? // translators: ARIA label for the Template sidebar tab, selected. |
| 8182 |
[(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : // translators: ARIA label for the Template Settings Sidebar tab, not selected. |
| 8183 |
[(0,external_wp_i18n_namespaceObject.__)('Template'), '']; |
| 8184 |
const [blockAriaLabel, blockActiveClass] = sidebarName === SIDEBAR_BLOCK ? // translators: ARIA label for the Block Settings Sidebar tab, selected. |
| 8185 |
[(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected. |
| 8186 |
[(0,external_wp_i18n_namespaceObject.__)('Block'), '']; |
| 8187 |
/* Use a list so screen readers will announce how many tabs there are. */ |
| 8188 |
|
| 8189 |
return (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8190 |
onClick: openTemplateSettings, |
| 8191 |
className: `edit-site-sidebar__panel-tab ${templateActiveClass}`, |
| 8192 |
"aria-label": templateAriaLabel // translators: Data label for the Template Settings Sidebar tab. |
| 8193 |
, |
| 8194 |
"data-label": (0,external_wp_i18n_namespaceObject.__)('Template') |
| 8195 |
}, // translators: Text label for the Template Settings Sidebar tab. |
| 8196 |
(0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8197 |
onClick: openBlockSettings, |
| 8198 |
className: `edit-site-sidebar__panel-tab ${blockActiveClass}`, |
| 8199 |
"aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab. |
| 8200 |
, |
| 8201 |
"data-label": (0,external_wp_i18n_namespaceObject.__)('Block') |
| 8202 |
}, // translators: Text label for the Block Settings Sidebar tab. |
| 8203 |
(0,external_wp_i18n_namespaceObject.__)('Block')))); |
| 8204 |
}; |
| 8205 |
|
| 8206 |
/* harmony default export */ var settings_header = (SettingsHeader); |
| 8207 |
//# sourceMappingURL=index.js.map |
| 8208 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/template-card/template-areas.js |
| 8209 |
|
| 8210 |
|
| 8211 |
/** |
| 8212 |
* WordPress dependencies |
| 8213 |
*/ |
| 8214 |
|
| 8215 |
|
| 8216 |
|
| 8217 |
|
| 8218 |
|
| 8219 |
/** |
| 8220 |
* Internal dependencies |
| 8221 |
*/ |
| 8222 |
|
| 8223 |
|
| 8224 |
|
| 8225 |
function TemplateAreaItem(_ref) { |
| 8226 |
let { |
| 8227 |
area, |
| 8228 |
clientId |
| 8229 |
} = _ref; |
| 8230 |
const { |
| 8231 |
selectBlock, |
| 8232 |
toggleBlockHighlight |
| 8233 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 8234 |
const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8235 |
const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); |
| 8236 |
|
| 8237 |
return defaultAreas.find(defaultArea => defaultArea.area === area); |
| 8238 |
}, [area]); |
| 8239 |
|
| 8240 |
const highlightBlock = () => toggleBlockHighlight(clientId, true); |
| 8241 |
|
| 8242 |
const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); |
| 8243 |
|
| 8244 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8245 |
className: "edit-site-template-card__template-areas-item", |
| 8246 |
icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, |
| 8247 |
onMouseOver: highlightBlock, |
| 8248 |
onMouseLeave: cancelHighlightBlock, |
| 8249 |
onFocus: highlightBlock, |
| 8250 |
onBlur: cancelHighlightBlock, |
| 8251 |
onClick: () => { |
| 8252 |
selectBlock(clientId); |
| 8253 |
} |
| 8254 |
}, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label); |
| 8255 |
} |
| 8256 |
|
| 8257 |
function template_areas_TemplateAreas() { |
| 8258 |
const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); |
| 8259 |
|
| 8260 |
if (!templateParts.length) { |
| 8261 |
return null; |
| 8262 |
} |
| 8263 |
|
| 8264 |
return (0,external_wp_element_namespaceObject.createElement)("section", { |
| 8265 |
className: "edit-site-template-card__template-areas" |
| 8266 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 8267 |
level: 3, |
| 8268 |
className: "edit-site-template-card__template-areas-title" |
| 8269 |
}, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_wp_element_namespaceObject.createElement)("ul", { |
| 8270 |
className: "edit-site-template-card__template-areas-list" |
| 8271 |
}, templateParts.map(_ref2 => { |
| 8272 |
let { |
| 8273 |
templatePart, |
| 8274 |
block |
| 8275 |
} = _ref2; |
| 8276 |
return (0,external_wp_element_namespaceObject.createElement)("li", { |
| 8277 |
key: templatePart.slug |
| 8278 |
}, (0,external_wp_element_namespaceObject.createElement)(TemplateAreaItem, { |
| 8279 |
area: templatePart.area, |
| 8280 |
clientId: block.clientId |
| 8281 |
})); |
| 8282 |
}))); |
| 8283 |
} |
| 8284 |
//# sourceMappingURL=template-areas.js.map |
| 8285 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/template-card/index.js |
| 8286 |
|
| 8287 |
|
| 8288 |
/** |
| 8289 |
* WordPress dependencies |
| 8290 |
*/ |
| 8291 |
|
| 8292 |
|
| 8293 |
|
| 8294 |
|
| 8295 |
/** |
| 8296 |
* Internal dependencies |
| 8297 |
*/ |
| 8298 |
|
| 8299 |
|
| 8300 |
|
| 8301 |
function TemplateCard() { |
| 8302 |
const { |
| 8303 |
title, |
| 8304 |
description, |
| 8305 |
icon |
| 8306 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8307 |
const { |
| 8308 |
getEditedPostType, |
| 8309 |
getEditedPostId |
| 8310 |
} = select(store_store); |
| 8311 |
const { |
| 8312 |
getEntityRecord |
| 8313 |
} = select(external_wp_coreData_namespaceObject.store); |
| 8314 |
const { |
| 8315 |
__experimentalGetTemplateInfo: getTemplateInfo |
| 8316 |
} = select(external_wp_editor_namespaceObject.store); |
| 8317 |
const postType = getEditedPostType(); |
| 8318 |
const postId = getEditedPostId(); |
| 8319 |
const record = getEntityRecord('postType', postType, postId); |
| 8320 |
const info = record ? getTemplateInfo(record) : {}; |
| 8321 |
return info; |
| 8322 |
}, []); |
| 8323 |
|
| 8324 |
if (!title && !description) { |
| 8325 |
return null; |
| 8326 |
} |
| 8327 |
|
| 8328 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8329 |
className: "edit-site-template-card" |
| 8330 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 8331 |
className: "edit-site-template-card__icon", |
| 8332 |
icon: icon |
| 8333 |
}), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8334 |
className: "edit-site-template-card__content" |
| 8335 |
}, (0,external_wp_element_namespaceObject.createElement)("h2", { |
| 8336 |
className: "edit-site-template-card__title" |
| 8337 |
}, title), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8338 |
className: "edit-site-template-card__description" |
| 8339 |
}, description), (0,external_wp_element_namespaceObject.createElement)(template_areas_TemplateAreas, null))); |
| 8340 |
} |
| 8341 |
//# sourceMappingURL=index.js.map |
| 8342 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/index.js |
| 8343 |
|
| 8344 |
|
| 8345 |
/** |
| 8346 |
* WordPress dependencies |
| 8347 |
*/ |
| 8348 |
|
| 8349 |
|
| 8350 |
|
| 8351 |
|
| 8352 |
|
| 8353 |
|
| 8354 |
|
| 8355 |
/** |
| 8356 |
* Internal dependencies |
| 8357 |
*/ |
| 8358 |
|
| 8359 |
|
| 8360 |
|
| 8361 |
|
| 8362 |
|
| 8363 |
|
| 8364 |
|
| 8365 |
const { |
| 8366 |
Slot: InspectorSlot, |
| 8367 |
Fill: InspectorFill |
| 8368 |
} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector'); |
| 8369 |
const SidebarInspectorFill = InspectorFill; |
| 8370 |
function SidebarComplementaryAreaFills() { |
| 8371 |
const { |
| 8372 |
sidebar, |
| 8373 |
isEditorSidebarOpened, |
| 8374 |
hasBlockSelection |
| 8375 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8376 |
const _sidebar = select(store).getActiveComplementaryArea(STORE_NAME); |
| 8377 |
|
| 8378 |
const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar); |
| 8379 |
|
| 8380 |
return { |
| 8381 |
sidebar: _sidebar, |
| 8382 |
isEditorSidebarOpened: _isEditorSidebarOpened, |
| 8383 |
hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() |
| 8384 |
}; |
| 8385 |
}, []); |
| 8386 |
const { |
| 8387 |
enableComplementaryArea |
| 8388 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 8389 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 8390 |
if (!isEditorSidebarOpened) return; |
| 8391 |
|
| 8392 |
if (hasBlockSelection) { |
| 8393 |
enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
| 8394 |
} else { |
| 8395 |
enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); |
| 8396 |
} |
| 8397 |
}, [hasBlockSelection, isEditorSidebarOpened]); |
| 8398 |
let sidebarName = sidebar; |
| 8399 |
|
| 8400 |
if (!isEditorSidebarOpened) { |
| 8401 |
sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE; |
| 8402 |
} |
| 8403 |
|
| 8404 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(DefaultSidebar, { |
| 8405 |
identifier: sidebarName, |
| 8406 |
title: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
| 8407 |
icon: library_cog, |
| 8408 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings sidebar'), |
| 8409 |
header: (0,external_wp_element_namespaceObject.createElement)(settings_header, { |
| 8410 |
sidebarName: sidebarName |
| 8411 |
}), |
| 8412 |
headerClassName: "edit-site-sidebar__panel-tabs" |
| 8413 |
}, sidebarName === SIDEBAR_TEMPLATE && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && (0,external_wp_element_namespaceObject.createElement)(InspectorSlot, { |
| 8414 |
bubblesVirtually: true |
| 8415 |
})), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesSidebar, null)); |
| 8416 |
} |
| 8417 |
//# sourceMappingURL=index.js.map |
| 8418 |
;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
| 8419 |
var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
| 8420 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/home.js |
| 8421 |
|
| 8422 |
|
| 8423 |
/** |
| 8424 |
* WordPress dependencies |
| 8425 |
*/ |
| 8426 |
|
| 8427 |
const home = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 8428 |
xmlns: "http://www.w3.org/2000/svg", |
| 8429 |
viewBox: "0 0 24 24" |
| 8430 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 8431 |
d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" |
| 8432 |
})); |
| 8433 |
/* harmony default export */ var library_home = (home); |
| 8434 |
//# sourceMappingURL=home.js.map |
| 8435 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/symbol-filled.js |
| 8436 |
|
| 8437 |
|
| 8438 |
/** |
| 8439 |
* WordPress dependencies |
| 8440 |
*/ |
| 8441 |
|
| 8442 |
const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 8443 |
xmlns: "http://www.w3.org/2000/svg", |
| 8444 |
viewBox: "0 0 24 24" |
| 8445 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 8446 |
d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" |
| 8447 |
})); |
| 8448 |
/* harmony default export */ var symbol_filled = (symbolFilled); |
| 8449 |
//# sourceMappingURL=symbol-filled.js.map |
| 8450 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/main-dashboard-button/index.js |
| 8451 |
|
| 8452 |
|
| 8453 |
/** |
| 8454 |
* WordPress dependencies |
| 8455 |
*/ |
| 8456 |
|
| 8457 |
const slotName = '__experimentalMainDashboardButton'; |
| 8458 |
const { |
| 8459 |
Fill, |
| 8460 |
Slot: MainDashboardButtonSlot |
| 8461 |
} = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); |
| 8462 |
const MainDashboardButton = Fill; |
| 8463 |
|
| 8464 |
const main_dashboard_button_Slot = _ref => { |
| 8465 |
let { |
| 8466 |
children |
| 8467 |
} = _ref; |
| 8468 |
const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName); |
| 8469 |
const hasFills = Boolean(slot.fills && slot.fills.length); |
| 8470 |
|
| 8471 |
if (!hasFills) { |
| 8472 |
return children; |
| 8473 |
} |
| 8474 |
|
| 8475 |
return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, { |
| 8476 |
bubblesVirtually: true |
| 8477 |
}); |
| 8478 |
}; |
| 8479 |
|
| 8480 |
MainDashboardButton.Slot = main_dashboard_button_Slot; |
| 8481 |
/* harmony default export */ var main_dashboard_button = (MainDashboardButton); |
| 8482 |
//# sourceMappingURL=index.js.map |
| 8483 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigation-sidebar/navigation-panel/index.js |
| 8484 |
|
| 8485 |
|
| 8486 |
|
| 8487 |
/** |
| 8488 |
* External dependencies |
| 8489 |
*/ |
| 8490 |
|
| 8491 |
/** |
| 8492 |
* WordPress dependencies |
| 8493 |
*/ |
| 8494 |
|
| 8495 |
|
| 8496 |
|
| 8497 |
|
| 8498 |
|
| 8499 |
|
| 8500 |
|
| 8501 |
|
| 8502 |
/** |
| 8503 |
* Internal dependencies |
| 8504 |
*/ |
| 8505 |
|
| 8506 |
|
| 8507 |
|
| 8508 |
|
| 8509 |
const SITE_EDITOR_KEY = 'site-editor'; |
| 8510 |
|
| 8511 |
function NavLink(_ref) { |
| 8512 |
let { |
| 8513 |
params, |
| 8514 |
replace, |
| 8515 |
...props |
| 8516 |
} = _ref; |
| 8517 |
const linkProps = useLink(params, replace); |
| 8518 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationItem, extends_extends({}, linkProps, props)); |
| 8519 |
} |
| 8520 |
|
| 8521 |
const NavigationPanel = _ref2 => { |
| 8522 |
let { |
| 8523 |
activeItem = SITE_EDITOR_KEY |
| 8524 |
} = _ref2; |
| 8525 |
const { |
| 8526 |
isNavigationOpen, |
| 8527 |
siteTitle |
| 8528 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8529 |
const { |
| 8530 |
getEntityRecord |
| 8531 |
} = select(external_wp_coreData_namespaceObject.store); |
| 8532 |
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
| 8533 |
return { |
| 8534 |
siteTitle: siteData.name, |
| 8535 |
isNavigationOpen: select(store_store).isNavigationOpened() |
| 8536 |
}; |
| 8537 |
}, []); |
| 8538 |
const { |
| 8539 |
setIsNavigationPanelOpened |
| 8540 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 8541 |
|
| 8542 |
const closeOnEscape = event => { |
| 8543 |
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { |
| 8544 |
event.preventDefault(); |
| 8545 |
setIsNavigationPanelOpened(false); |
| 8546 |
} |
| 8547 |
}; |
| 8548 |
|
| 8549 |
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
| 8550 |
(0,external_wp_element_namespaceObject.createElement)("div", { |
| 8551 |
className: classnames_default()(`edit-site-navigation-panel`, { |
| 8552 |
'is-open': isNavigationOpen |
| 8553 |
}), |
| 8554 |
onKeyDown: closeOnEscape |
| 8555 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8556 |
className: "edit-site-navigation-panel__inner" |
| 8557 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8558 |
className: "edit-site-navigation-panel__site-title-container" |
| 8559 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8560 |
className: "edit-site-navigation-panel__site-title" |
| 8561 |
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 8562 |
className: "edit-site-navigation-panel__scroll-container" |
| 8563 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigation, { |
| 8564 |
activeItem: activeItem |
| 8565 |
}, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationBackButton, { |
| 8566 |
backButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Dashboard'), |
| 8567 |
className: "edit-site-navigation-panel__back-to-dashboard", |
| 8568 |
href: "index.php" |
| 8569 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationMenu, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationGroup, { |
| 8570 |
title: (0,external_wp_i18n_namespaceObject.__)('Editor') |
| 8571 |
}, (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
| 8572 |
icon: library_home, |
| 8573 |
title: (0,external_wp_i18n_namespaceObject.__)('Site'), |
| 8574 |
item: SITE_EDITOR_KEY, |
| 8575 |
params: { |
| 8576 |
postId: undefined, |
| 8577 |
postType: undefined |
| 8578 |
} |
| 8579 |
}), (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
| 8580 |
icon: library_layout, |
| 8581 |
title: (0,external_wp_i18n_namespaceObject.__)('Templates'), |
| 8582 |
item: "wp_template", |
| 8583 |
params: { |
| 8584 |
postId: undefined, |
| 8585 |
postType: 'wp_template' |
| 8586 |
} |
| 8587 |
}), (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
| 8588 |
icon: symbol_filled, |
| 8589 |
title: (0,external_wp_i18n_namespaceObject.__)('Template Parts'), |
| 8590 |
item: "wp_template_part", |
| 8591 |
params: { |
| 8592 |
postId: undefined, |
| 8593 |
postType: 'wp_template_part' |
| 8594 |
} |
| 8595 |
}))))))) |
| 8596 |
); |
| 8597 |
}; |
| 8598 |
|
| 8599 |
/* harmony default export */ var navigation_panel = (NavigationPanel); |
| 8600 |
//# sourceMappingURL=index.js.map |
| 8601 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/wordpress.js |
| 8602 |
|
| 8603 |
|
| 8604 |
/** |
| 8605 |
* WordPress dependencies |
| 8606 |
*/ |
| 8607 |
|
| 8608 |
const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 8609 |
xmlns: "http://www.w3.org/2000/svg", |
| 8610 |
viewBox: "-2 -2 24 24" |
| 8611 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 8612 |
d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" |
| 8613 |
})); |
| 8614 |
/* harmony default export */ var library_wordpress = (wordpress); |
| 8615 |
//# sourceMappingURL=wordpress.js.map |
| 8616 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigation-sidebar/navigation-toggle/index.js |
| 8617 |
|
| 8618 |
|
| 8619 |
/** |
| 8620 |
* WordPress dependencies |
| 8621 |
*/ |
| 8622 |
|
| 8623 |
|
| 8624 |
|
| 8625 |
|
| 8626 |
|
| 8627 |
|
| 8628 |
|
| 8629 |
/** |
| 8630 |
* Internal dependencies |
| 8631 |
*/ |
| 8632 |
|
| 8633 |
|
| 8634 |
|
| 8635 |
function NavigationToggle(_ref) { |
| 8636 |
let { |
| 8637 |
icon |
| 8638 |
} = _ref; |
| 8639 |
const { |
| 8640 |
isNavigationOpen, |
| 8641 |
isRequestingSiteIcon, |
| 8642 |
siteIconUrl |
| 8643 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8644 |
const { |
| 8645 |
getEntityRecord, |
| 8646 |
isResolving |
| 8647 |
} = select(external_wp_coreData_namespaceObject.store); |
| 8648 |
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
| 8649 |
return { |
| 8650 |
isNavigationOpen: select(store_store).isNavigationOpened(), |
| 8651 |
isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), |
| 8652 |
siteIconUrl: siteData.site_icon_url |
| 8653 |
}; |
| 8654 |
}, []); |
| 8655 |
const { |
| 8656 |
setIsNavigationPanelOpened |
| 8657 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 8658 |
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); |
| 8659 |
const navigationToggleRef = (0,external_wp_element_namespaceObject.useRef)(); |
| 8660 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 8661 |
// TODO: Remove this effect when alternative solution is merged. |
| 8662 |
// See: https://github.com/WordPress/gutenberg/pull/37314 |
| 8663 |
if (!isNavigationOpen) { |
| 8664 |
navigationToggleRef.current.focus(); |
| 8665 |
} |
| 8666 |
}, [isNavigationOpen]); |
| 8667 |
|
| 8668 |
const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen); |
| 8669 |
|
| 8670 |
let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 8671 |
size: "36px", |
| 8672 |
icon: library_wordpress |
| 8673 |
}); |
| 8674 |
const effect = { |
| 8675 |
expand: { |
| 8676 |
scale: 1.7, |
| 8677 |
borderRadius: 0, |
| 8678 |
transition: { |
| 8679 |
type: 'tween', |
| 8680 |
duration: '0.2' |
| 8681 |
} |
| 8682 |
} |
| 8683 |
}; |
| 8684 |
|
| 8685 |
if (siteIconUrl) { |
| 8686 |
buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { |
| 8687 |
variants: !disableMotion && effect, |
| 8688 |
alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), |
| 8689 |
className: "edit-site-navigation-toggle__site-icon", |
| 8690 |
src: siteIconUrl |
| 8691 |
}); |
| 8692 |
} else if (isRequestingSiteIcon) { |
| 8693 |
buttonIcon = null; |
| 8694 |
} else if (icon) { |
| 8695 |
buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 8696 |
size: "36px", |
| 8697 |
icon: icon |
| 8698 |
}); |
| 8699 |
} |
| 8700 |
|
| 8701 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
| 8702 |
className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''), |
| 8703 |
whileHover: "expand" |
| 8704 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8705 |
className: "edit-site-navigation-toggle__button has-icon", |
| 8706 |
label: (0,external_wp_i18n_namespaceObject.__)('Toggle navigation'), |
| 8707 |
ref: navigationToggleRef // isPressed will add unwanted styles. |
| 8708 |
, |
| 8709 |
"aria-pressed": isNavigationOpen, |
| 8710 |
onClick: toggleNavigationPanel, |
| 8711 |
showTooltip: true |
| 8712 |
}, buttonIcon)); |
| 8713 |
} |
| 8714 |
|
| 8715 |
/* harmony default export */ var navigation_toggle = (NavigationToggle); |
| 8716 |
//# sourceMappingURL=index.js.map |
| 8717 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigation-sidebar/index.js |
| 8718 |
|
| 8719 |
|
| 8720 |
/** |
| 8721 |
* WordPress dependencies |
| 8722 |
*/ |
| 8723 |
|
| 8724 |
|
| 8725 |
|
| 8726 |
|
| 8727 |
/** |
| 8728 |
* Internal dependencies |
| 8729 |
*/ |
| 8730 |
|
| 8731 |
|
| 8732 |
|
| 8733 |
|
| 8734 |
const { |
| 8735 |
Fill: NavigationPanelPreviewFill, |
| 8736 |
Slot: NavigationPanelPreviewSlot |
| 8737 |
} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationPanelPreview'); |
| 8738 |
const { |
| 8739 |
Fill: NavigationSidebarFill, |
| 8740 |
Slot: NavigationSidebarSlot |
| 8741 |
} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationSidebar'); |
| 8742 |
|
| 8743 |
function NavigationSidebar(_ref) { |
| 8744 |
let { |
| 8745 |
isDefaultOpen = false, |
| 8746 |
activeTemplateType |
| 8747 |
} = _ref; |
| 8748 |
const isDesktopViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
| 8749 |
const { |
| 8750 |
setIsNavigationPanelOpened |
| 8751 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 8752 |
(0,external_wp_element_namespaceObject.useEffect)(function autoOpenNavigationPanelOnViewportChange() { |
| 8753 |
setIsNavigationPanelOpened(isDefaultOpen && isDesktopViewport); |
| 8754 |
}, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]); |
| 8755 |
return (0,external_wp_element_namespaceObject.createElement)(NavigationSidebarFill, null, (0,external_wp_element_namespaceObject.createElement)(navigation_toggle, null), (0,external_wp_element_namespaceObject.createElement)(navigation_panel, { |
| 8756 |
activeItem: activeTemplateType |
| 8757 |
}), (0,external_wp_element_namespaceObject.createElement)(NavigationPanelPreviewSlot, null)); |
| 8758 |
} |
| 8759 |
|
| 8760 |
NavigationSidebar.Slot = NavigationSidebarSlot; |
| 8761 |
/* harmony default export */ var navigation_sidebar = (NavigationSidebar); |
| 8762 |
//# sourceMappingURL=index.js.map |
| 8763 |
;// CONCATENATED MODULE: external ["wp","reusableBlocks"] |
| 8764 |
var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; |
| 8765 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-part-converter/convert-to-regular.js |
| 8766 |
|
| 8767 |
|
| 8768 |
/** |
| 8769 |
* WordPress dependencies |
| 8770 |
*/ |
| 8771 |
|
| 8772 |
|
| 8773 |
|
| 8774 |
|
| 8775 |
function ConvertToRegularBlocks(_ref) { |
| 8776 |
let { |
| 8777 |
clientId |
| 8778 |
} = _ref; |
| 8779 |
const { |
| 8780 |
getBlocks |
| 8781 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); |
| 8782 |
const { |
| 8783 |
replaceBlocks |
| 8784 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 8785 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => { |
| 8786 |
let { |
| 8787 |
onClose |
| 8788 |
} = _ref2; |
| 8789 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 8790 |
onClick: () => { |
| 8791 |
replaceBlocks(clientId, getBlocks(clientId)); |
| 8792 |
onClose(); |
| 8793 |
} |
| 8794 |
}, (0,external_wp_i18n_namespaceObject.__)('Detach blocks from template part')); |
| 8795 |
}); |
| 8796 |
} |
| 8797 |
//# sourceMappingURL=convert-to-regular.js.map |
| 8798 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/create-template-part-modal/index.js |
| 8799 |
|
| 8800 |
|
| 8801 |
/** |
| 8802 |
* WordPress dependencies |
| 8803 |
*/ |
| 8804 |
|
| 8805 |
|
| 8806 |
|
| 8807 |
|
| 8808 |
|
| 8809 |
|
| 8810 |
|
| 8811 |
/** |
| 8812 |
* Internal dependencies |
| 8813 |
*/ |
| 8814 |
|
| 8815 |
|
| 8816 |
function CreateTemplatePartModal(_ref) { |
| 8817 |
let { |
| 8818 |
closeModal, |
| 8819 |
onCreate |
| 8820 |
} = _ref; |
| 8821 |
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); |
| 8822 |
const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(TEMPLATE_PART_AREA_GENERAL); |
| 8823 |
const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); |
| 8824 |
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); |
| 8825 |
const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); |
| 8826 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
| 8827 |
title: (0,external_wp_i18n_namespaceObject.__)('Create a template part'), |
| 8828 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
| 8829 |
onRequestClose: closeModal, |
| 8830 |
overlayClassName: "edit-site-create-template-part-modal" |
| 8831 |
}, (0,external_wp_element_namespaceObject.createElement)("form", { |
| 8832 |
onSubmit: async event => { |
| 8833 |
event.preventDefault(); |
| 8834 |
|
| 8835 |
if (!title) { |
| 8836 |
return; |
| 8837 |
} |
| 8838 |
|
| 8839 |
setIsSubmitting(true); |
| 8840 |
await onCreate({ |
| 8841 |
title, |
| 8842 |
area |
| 8843 |
}); |
| 8844 |
} |
| 8845 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
| 8846 |
label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
| 8847 |
value: title, |
| 8848 |
onChange: setTitle, |
| 8849 |
required: true |
| 8850 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, { |
| 8851 |
label: (0,external_wp_i18n_namespaceObject.__)('Area'), |
| 8852 |
id: `edit-site-create-template-part-modal__area-selection-${instanceId}`, |
| 8853 |
className: "edit-site-create-template-part-modal__area-base-control" |
| 8854 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, { |
| 8855 |
label: (0,external_wp_i18n_namespaceObject.__)('Area'), |
| 8856 |
className: "edit-site-create-template-part-modal__area-radio-group", |
| 8857 |
id: `edit-site-create-template-part-modal__area-selection-${instanceId}`, |
| 8858 |
onChange: setArea, |
| 8859 |
checked: area |
| 8860 |
}, templatePartAreas.map(_ref2 => { |
| 8861 |
let { |
| 8862 |
icon, |
| 8863 |
label, |
| 8864 |
area: value, |
| 8865 |
description |
| 8866 |
} = _ref2; |
| 8867 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadio, { |
| 8868 |
key: label, |
| 8869 |
value: value, |
| 8870 |
className: "edit-site-create-template-part-modal__area-radio" |
| 8871 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
| 8872 |
align: "start", |
| 8873 |
justify: "start" |
| 8874 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 8875 |
icon: icon |
| 8876 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, { |
| 8877 |
className: "edit-site-create-template-part-modal__option-label" |
| 8878 |
}, label, (0,external_wp_element_namespaceObject.createElement)("div", null, description)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
| 8879 |
className: "edit-site-create-template-part-modal__checkbox" |
| 8880 |
}, area === value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 8881 |
icon: library_check |
| 8882 |
})))); |
| 8883 |
}))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
| 8884 |
className: "edit-site-create-template-part-modal__modal-actions", |
| 8885 |
justify: "flex-end" |
| 8886 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8887 |
variant: "secondary", |
| 8888 |
onClick: () => { |
| 8889 |
closeModal(); |
| 8890 |
} |
| 8891 |
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 8892 |
variant: "primary", |
| 8893 |
type: "submit", |
| 8894 |
disabled: !title, |
| 8895 |
isBusy: isSubmitting |
| 8896 |
}, (0,external_wp_i18n_namespaceObject.__)('Create')))))); |
| 8897 |
} |
| 8898 |
//# sourceMappingURL=index.js.map |
| 8899 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-part-converter/convert-to-template-part.js |
| 8900 |
|
| 8901 |
|
| 8902 |
/** |
| 8903 |
* External dependencies |
| 8904 |
*/ |
| 8905 |
|
| 8906 |
/** |
| 8907 |
* WordPress dependencies |
| 8908 |
*/ |
| 8909 |
|
| 8910 |
|
| 8911 |
|
| 8912 |
|
| 8913 |
|
| 8914 |
|
| 8915 |
|
| 8916 |
|
| 8917 |
|
| 8918 |
/** |
| 8919 |
* Internal dependencies |
| 8920 |
*/ |
| 8921 |
|
| 8922 |
|
| 8923 |
function ConvertToTemplatePart(_ref) { |
| 8924 |
let { |
| 8925 |
clientIds, |
| 8926 |
blocks |
| 8927 |
} = _ref; |
| 8928 |
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
| 8929 |
const { |
| 8930 |
replaceBlocks |
| 8931 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 8932 |
const { |
| 8933 |
saveEntityRecord |
| 8934 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 8935 |
const { |
| 8936 |
createSuccessNotice |
| 8937 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 8938 |
|
| 8939 |
const onConvert = async _ref2 => { |
| 8940 |
let { |
| 8941 |
title, |
| 8942 |
area |
| 8943 |
} = _ref2; |
| 8944 |
const templatePart = await saveEntityRecord('postType', 'wp_template_part', { |
| 8945 |
slug: (0,external_lodash_namespaceObject.kebabCase)(title), |
| 8946 |
title, |
| 8947 |
content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), |
| 8948 |
area |
| 8949 |
}); |
| 8950 |
replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { |
| 8951 |
slug: templatePart.slug, |
| 8952 |
theme: templatePart.theme |
| 8953 |
})); |
| 8954 |
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { |
| 8955 |
type: 'snackbar' |
| 8956 |
}); // The modal and this component will be unmounted because of `replaceBlocks` above, |
| 8957 |
// so no need to call `closeModal` or `onClose`. |
| 8958 |
}; |
| 8959 |
|
| 8960 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 8961 |
onClick: () => { |
| 8962 |
setIsModalOpen(true); |
| 8963 |
} |
| 8964 |
}, (0,external_wp_i18n_namespaceObject.__)('Make template part'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { |
| 8965 |
closeModal: () => { |
| 8966 |
setIsModalOpen(false); |
| 8967 |
}, |
| 8968 |
onCreate: onConvert |
| 8969 |
})); |
| 8970 |
} |
| 8971 |
//# sourceMappingURL=convert-to-template-part.js.map |
| 8972 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/template-part-converter/index.js |
| 8973 |
|
| 8974 |
|
| 8975 |
/** |
| 8976 |
* WordPress dependencies |
| 8977 |
*/ |
| 8978 |
|
| 8979 |
|
| 8980 |
/** |
| 8981 |
* Internal dependencies |
| 8982 |
*/ |
| 8983 |
|
| 8984 |
|
| 8985 |
|
| 8986 |
function TemplatePartConverter() { |
| 8987 |
var _blocks$; |
| 8988 |
|
| 8989 |
const { |
| 8990 |
clientIds, |
| 8991 |
blocks |
| 8992 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 8993 |
const { |
| 8994 |
getSelectedBlockClientIds, |
| 8995 |
getBlocksByClientId |
| 8996 |
} = select(external_wp_blockEditor_namespaceObject.store); |
| 8997 |
const selectedBlockClientIds = getSelectedBlockClientIds(); |
| 8998 |
return { |
| 8999 |
clientIds: selectedBlockClientIds, |
| 9000 |
blocks: getBlocksByClientId(selectedBlockClientIds) |
| 9001 |
}; |
| 9002 |
}, []); // Allow converting a single template part to standard blocks. |
| 9003 |
|
| 9004 |
if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') { |
| 9005 |
return (0,external_wp_element_namespaceObject.createElement)(ConvertToRegularBlocks, { |
| 9006 |
clientId: clientIds[0] |
| 9007 |
}); |
| 9008 |
} |
| 9009 |
|
| 9010 |
return (0,external_wp_element_namespaceObject.createElement)(ConvertToTemplatePart, { |
| 9011 |
clientIds: clientIds, |
| 9012 |
blocks: blocks |
| 9013 |
}); |
| 9014 |
} |
| 9015 |
//# sourceMappingURL=index.js.map |
| 9016 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/pencil.js |
| 9017 |
|
| 9018 |
|
| 9019 |
/** |
| 9020 |
* WordPress dependencies |
| 9021 |
*/ |
| 9022 |
|
| 9023 |
const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 9024 |
xmlns: "http://www.w3.org/2000/svg", |
| 9025 |
viewBox: "0 0 24 24" |
| 9026 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 9027 |
d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" |
| 9028 |
})); |
| 9029 |
/* harmony default export */ var library_pencil = (pencil); |
| 9030 |
//# sourceMappingURL=pencil.js.map |
| 9031 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/edit.js |
| 9032 |
/** |
| 9033 |
* Internal dependencies |
| 9034 |
*/ |
| 9035 |
|
| 9036 |
/* harmony default export */ var edit = (library_pencil); |
| 9037 |
//# sourceMappingURL=edit.js.map |
| 9038 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/navigate-to-link/index.js |
| 9039 |
|
| 9040 |
|
| 9041 |
/** |
| 9042 |
* WordPress dependencies |
| 9043 |
*/ |
| 9044 |
|
| 9045 |
|
| 9046 |
|
| 9047 |
|
| 9048 |
|
| 9049 |
|
| 9050 |
|
| 9051 |
function NavigateToLink(_ref) { |
| 9052 |
let { |
| 9053 |
type, |
| 9054 |
id, |
| 9055 |
activePage, |
| 9056 |
onActivePageChange |
| 9057 |
} = _ref; |
| 9058 |
const post = (0,external_wp_data_namespaceObject.useSelect)(select => type && id && type !== 'URL' && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', type, id), [type, id]); |
| 9059 |
const onClick = (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 9060 |
if (!(post !== null && post !== void 0 && post.link)) return null; |
| 9061 |
const path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(post.link); |
| 9062 |
if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null; |
| 9063 |
return () => onActivePageChange({ |
| 9064 |
type, |
| 9065 |
slug: post.slug, |
| 9066 |
path, |
| 9067 |
context: { |
| 9068 |
postType: post.type, |
| 9069 |
postId: post.id |
| 9070 |
} |
| 9071 |
}); |
| 9072 |
}, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]); |
| 9073 |
return onClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 9074 |
icon: edit, |
| 9075 |
label: (0,external_wp_i18n_namespaceObject.__)('Edit Page Template'), |
| 9076 |
onClick: onClick |
| 9077 |
}); |
| 9078 |
} |
| 9079 |
//# sourceMappingURL=index.js.map |
| 9080 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/block-editor/block-inspector-button.js |
| 9081 |
|
| 9082 |
|
| 9083 |
/** |
| 9084 |
* WordPress dependencies |
| 9085 |
*/ |
| 9086 |
|
| 9087 |
|
| 9088 |
|
| 9089 |
|
| 9090 |
|
| 9091 |
|
| 9092 |
/** |
| 9093 |
* Internal dependencies |
| 9094 |
*/ |
| 9095 |
|
| 9096 |
|
| 9097 |
|
| 9098 |
|
| 9099 |
function BlockInspectorButton(_ref) { |
| 9100 |
let { |
| 9101 |
onClick = () => {} |
| 9102 |
} = _ref; |
| 9103 |
const { |
| 9104 |
shortcut, |
| 9105 |
isBlockInspectorOpen |
| 9106 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
| 9107 |
shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-block-settings-sidebar'), |
| 9108 |
isBlockInspectorOpen: select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK |
| 9109 |
}), []); |
| 9110 |
const { |
| 9111 |
enableComplementaryArea, |
| 9112 |
disableComplementaryArea |
| 9113 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 9114 |
const label = isBlockInspectorOpen ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings'); |
| 9115 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 9116 |
onClick: () => { |
| 9117 |
if (isBlockInspectorOpen) { |
| 9118 |
disableComplementaryArea(STORE_NAME); |
| 9119 |
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed')); |
| 9120 |
} else { |
| 9121 |
enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
| 9122 |
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar')); |
| 9123 |
} // Close dropdown menu. |
| 9124 |
|
| 9125 |
|
| 9126 |
onClick(); |
| 9127 |
}, |
| 9128 |
shortcut: shortcut |
| 9129 |
}, label); |
| 9130 |
} |
| 9131 |
//# sourceMappingURL=block-inspector-button.js.map |
| 9132 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/edit-template-part-menu-button/index.js |
| 9133 |
|
| 9134 |
|
| 9135 |
|
| 9136 |
/** |
| 9137 |
* WordPress dependencies |
| 9138 |
*/ |
| 9139 |
|
| 9140 |
|
| 9141 |
|
| 9142 |
|
| 9143 |
|
| 9144 |
|
| 9145 |
/** |
| 9146 |
* Internal dependencies |
| 9147 |
*/ |
| 9148 |
|
| 9149 |
|
| 9150 |
|
| 9151 |
function EditTemplatePartMenuButton() { |
| 9152 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref => { |
| 9153 |
let { |
| 9154 |
selectedClientIds, |
| 9155 |
onClose |
| 9156 |
} = _ref; |
| 9157 |
return (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuItem, { |
| 9158 |
selectedClientId: selectedClientIds[0], |
| 9159 |
onClose: onClose |
| 9160 |
}); |
| 9161 |
}); |
| 9162 |
} |
| 9163 |
|
| 9164 |
function EditTemplatePartMenuItem(_ref2) { |
| 9165 |
let { |
| 9166 |
selectedClientId, |
| 9167 |
onClose |
| 9168 |
} = _ref2; |
| 9169 |
const { |
| 9170 |
params |
| 9171 |
} = useLocation(); |
| 9172 |
const selectedTemplatePart = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 9173 |
const block = select(external_wp_blockEditor_namespaceObject.store).getBlock(selectedClientId); |
| 9174 |
|
| 9175 |
if (block && (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { |
| 9176 |
const { |
| 9177 |
theme, |
| 9178 |
slug |
| 9179 |
} = block.attributes; |
| 9180 |
return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API. |
| 9181 |
`${theme}//${slug}`); |
| 9182 |
} |
| 9183 |
}, [selectedClientId]); |
| 9184 |
const linkProps = useLink({ |
| 9185 |
postId: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.id, |
| 9186 |
postType: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.type |
| 9187 |
}, { |
| 9188 |
fromTemplateId: params.postId |
| 9189 |
}); |
| 9190 |
|
| 9191 |
if (!selectedTemplatePart) { |
| 9192 |
return null; |
| 9193 |
} |
| 9194 |
|
| 9195 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, linkProps, { |
| 9196 |
onClick: event => { |
| 9197 |
linkProps.onClick(event); |
| 9198 |
onClose(); |
| 9199 |
} |
| 9200 |
}), |
| 9201 |
/* translators: %s: template part title */ |
| 9202 |
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Edit %s'), selectedTemplatePart.slug)); |
| 9203 |
} |
| 9204 |
//# sourceMappingURL=index.js.map |
| 9205 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/arrow-left.js |
| 9206 |
|
| 9207 |
|
| 9208 |
/** |
| 9209 |
* WordPress dependencies |
| 9210 |
*/ |
| 9211 |
|
| 9212 |
const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 9213 |
xmlns: "http://www.w3.org/2000/svg", |
| 9214 |
viewBox: "0 0 24 24" |
| 9215 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 9216 |
d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" |
| 9217 |
})); |
| 9218 |
/* harmony default export */ var arrow_left = (arrowLeft); |
| 9219 |
//# sourceMappingURL=arrow-left.js.map |
| 9220 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/block-editor/back-button.js |
| 9221 |
|
| 9222 |
|
| 9223 |
/** |
| 9224 |
* WordPress dependencies |
| 9225 |
*/ |
| 9226 |
|
| 9227 |
|
| 9228 |
|
| 9229 |
/** |
| 9230 |
* Internal dependencies |
| 9231 |
*/ |
| 9232 |
|
| 9233 |
|
| 9234 |
|
| 9235 |
function BackButton() { |
| 9236 |
var _location$state; |
| 9237 |
|
| 9238 |
const location = useLocation(); |
| 9239 |
const history = useHistory(); |
| 9240 |
const isTemplatePart = location.params.postType === 'wp_template_part'; |
| 9241 |
const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId; |
| 9242 |
|
| 9243 |
if (!isTemplatePart || !previousTemplateId) { |
| 9244 |
return null; |
| 9245 |
} |
| 9246 |
|
| 9247 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 9248 |
className: "edit-site-visual-editor__back-button", |
| 9249 |
icon: arrow_left, |
| 9250 |
onClick: () => { |
| 9251 |
history.back(); |
| 9252 |
} |
| 9253 |
}, (0,external_wp_i18n_namespaceObject.__)('Back')); |
| 9254 |
} |
| 9255 |
|
| 9256 |
/* harmony default export */ var back_button = (BackButton); |
| 9257 |
//# sourceMappingURL=back-button.js.map |
| 9258 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/block-editor/resize-handle.js |
| 9259 |
|
| 9260 |
|
| 9261 |
/** |
| 9262 |
* WordPress dependencies |
| 9263 |
*/ |
| 9264 |
|
| 9265 |
|
| 9266 |
|
| 9267 |
const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. |
| 9268 |
|
| 9269 |
function ResizeHandle(_ref) { |
| 9270 |
let { |
| 9271 |
direction, |
| 9272 |
resizeWidthBy |
| 9273 |
} = _ref; |
| 9274 |
|
| 9275 |
function handleKeyDown(event) { |
| 9276 |
const { |
| 9277 |
keyCode |
| 9278 |
} = event; |
| 9279 |
|
| 9280 |
if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { |
| 9281 |
resizeWidthBy(DELTA_DISTANCE); |
| 9282 |
} else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { |
| 9283 |
resizeWidthBy(-DELTA_DISTANCE); |
| 9284 |
} |
| 9285 |
} |
| 9286 |
|
| 9287 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("button", { |
| 9288 |
className: `resizable-editor__drag-handle is-${direction}`, |
| 9289 |
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), |
| 9290 |
"aria-describedby": `resizable-editor__resize-help-${direction}`, |
| 9291 |
onKeyDown: handleKeyDown |
| 9292 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
| 9293 |
id: `resizable-editor__resize-help-${direction}` |
| 9294 |
}, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.'))); |
| 9295 |
} |
| 9296 |
//# sourceMappingURL=resize-handle.js.map |
| 9297 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/block-editor/resizable-editor.js |
| 9298 |
|
| 9299 |
|
| 9300 |
|
| 9301 |
/** |
| 9302 |
* WordPress dependencies |
| 9303 |
*/ |
| 9304 |
|
| 9305 |
|
| 9306 |
|
| 9307 |
|
| 9308 |
|
| 9309 |
/** |
| 9310 |
* Internal dependencies |
| 9311 |
*/ |
| 9312 |
|
| 9313 |
|
| 9314 |
|
| 9315 |
const DEFAULT_STYLES = { |
| 9316 |
width: '100%', |
| 9317 |
height: '100%' |
| 9318 |
}; // Removes the inline styles in the drag handles. |
| 9319 |
|
| 9320 |
const HANDLE_STYLES_OVERRIDE = { |
| 9321 |
position: undefined, |
| 9322 |
userSelect: undefined, |
| 9323 |
cursor: undefined, |
| 9324 |
width: undefined, |
| 9325 |
height: undefined, |
| 9326 |
top: undefined, |
| 9327 |
right: undefined, |
| 9328 |
bottom: undefined, |
| 9329 |
left: undefined |
| 9330 |
}; |
| 9331 |
|
| 9332 |
function ResizableEditor(_ref) { |
| 9333 |
let { |
| 9334 |
enableResizing, |
| 9335 |
settings, |
| 9336 |
...props |
| 9337 |
} = _ref; |
| 9338 |
const deviceType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetPreviewDeviceType(), []); |
| 9339 |
const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); |
| 9340 |
const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.width); |
| 9341 |
const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.height); |
| 9342 |
const iframeRef = (0,external_wp_element_namespaceObject.useRef)(); |
| 9343 |
const mouseMoveTypingResetRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)(); |
| 9344 |
const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, mouseMoveTypingResetRef]); |
| 9345 |
(0,external_wp_element_namespaceObject.useEffect)(function autoResizeIframeHeight() { |
| 9346 |
const iframe = iframeRef.current; |
| 9347 |
|
| 9348 |
if (!iframe || !enableResizing) { |
| 9349 |
return; |
| 9350 |
} |
| 9351 |
|
| 9352 |
let animationFrame = null; |
| 9353 |
|
| 9354 |
function resizeHeight() { |
| 9355 |
if (!animationFrame) { |
| 9356 |
// Throttle the updates on animation frame. |
| 9357 |
animationFrame = iframe.contentWindow.requestAnimationFrame(() => { |
| 9358 |
setHeight(iframe.contentDocument.documentElement.scrollHeight); |
| 9359 |
animationFrame = null; |
| 9360 |
}); |
| 9361 |
} |
| 9362 |
} |
| 9363 |
|
| 9364 |
let resizeObserver; |
| 9365 |
|
| 9366 |
function registerObserver() { |
| 9367 |
var _resizeObserver; |
| 9368 |
|
| 9369 |
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect(); |
| 9370 |
resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter |
| 9371 |
// gets destroyed and remounted after initialization in <Iframe>. |
| 9372 |
|
| 9373 |
resizeObserver.observe(iframe.contentDocument.documentElement); |
| 9374 |
resizeHeight(); |
| 9375 |
} // This is only required in Firefox for some unknown reasons. |
| 9376 |
|
| 9377 |
|
| 9378 |
iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari. |
| 9379 |
|
| 9380 |
registerObserver(); |
| 9381 |
return () => { |
| 9382 |
var _iframe$contentWindow, _resizeObserver2; |
| 9383 |
|
| 9384 |
(_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame); |
| 9385 |
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect(); |
| 9386 |
iframe.removeEventListener('load', registerObserver); |
| 9387 |
}; |
| 9388 |
}, [enableResizing]); |
| 9389 |
const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { |
| 9390 |
if (iframeRef.current) { |
| 9391 |
setWidth(iframeRef.current.offsetWidth + deltaPixels); |
| 9392 |
} |
| 9393 |
}, []); |
| 9394 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, { |
| 9395 |
size: { |
| 9396 |
width, |
| 9397 |
height |
| 9398 |
}, |
| 9399 |
onResizeStop: (event, direction, element) => { |
| 9400 |
setWidth(element.style.width); |
| 9401 |
}, |
| 9402 |
minWidth: 300, |
| 9403 |
maxWidth: "100%", |
| 9404 |
maxHeight: "100%", |
| 9405 |
enable: { |
| 9406 |
right: enableResizing, |
| 9407 |
left: enableResizing |
| 9408 |
}, |
| 9409 |
showHandle: enableResizing // The editor is centered horizontally, resizing it only |
| 9410 |
// moves half the distance. Hence double the ratio to correctly |
| 9411 |
// align the cursor to the resizer handle. |
| 9412 |
, |
| 9413 |
resizeRatio: 2, |
| 9414 |
handleComponent: { |
| 9415 |
left: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { |
| 9416 |
direction: "left", |
| 9417 |
resizeWidthBy: resizeWidthBy |
| 9418 |
}), |
| 9419 |
right: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { |
| 9420 |
direction: "right", |
| 9421 |
resizeWidthBy: resizeWidthBy |
| 9422 |
}) |
| 9423 |
}, |
| 9424 |
handleClasses: undefined, |
| 9425 |
handleStyles: { |
| 9426 |
left: HANDLE_STYLES_OVERRIDE, |
| 9427 |
right: HANDLE_STYLES_OVERRIDE |
| 9428 |
} |
| 9429 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, extends_extends({ |
| 9430 |
style: enableResizing ? undefined : deviceStyles, |
| 9431 |
head: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
| 9432 |
styles: settings.styles |
| 9433 |
}), (0,external_wp_element_namespaceObject.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing. |
| 9434 |
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context |
| 9435 |
`.is-root-container { display: flow-root; }`), enableResizing && (0,external_wp_element_namespaceObject.createElement)("style", null, // Force the <html> and <body>'s heights to fit the content. |
| 9436 |
`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container, |
| 9437 |
// which isn't a requirement in auto resize mode. |
| 9438 |
`.is-root-container { min-height: 0 !important; }`)), |
| 9439 |
assets: settings.__unstableResolvedAssets, |
| 9440 |
ref: ref, |
| 9441 |
name: "editor-canvas", |
| 9442 |
className: "edit-site-visual-editor__editor-canvas" |
| 9443 |
}, props))); |
| 9444 |
} |
| 9445 |
|
| 9446 |
/* harmony default export */ var resizable_editor = (ResizableEditor); |
| 9447 |
//# sourceMappingURL=resizable-editor.js.map |
| 9448 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/block-editor/index.js |
| 9449 |
|
| 9450 |
|
| 9451 |
|
| 9452 |
/** |
| 9453 |
* External dependencies |
| 9454 |
*/ |
| 9455 |
|
| 9456 |
/** |
| 9457 |
* WordPress dependencies |
| 9458 |
*/ |
| 9459 |
|
| 9460 |
|
| 9461 |
|
| 9462 |
|
| 9463 |
|
| 9464 |
|
| 9465 |
|
| 9466 |
/** |
| 9467 |
* Internal dependencies |
| 9468 |
*/ |
| 9469 |
|
| 9470 |
|
| 9471 |
|
| 9472 |
|
| 9473 |
|
| 9474 |
|
| 9475 |
|
| 9476 |
|
| 9477 |
|
| 9478 |
const LAYOUT = { |
| 9479 |
type: 'default', |
| 9480 |
// At the root level of the site editor, no alignments should be allowed. |
| 9481 |
alignments: [] |
| 9482 |
}; |
| 9483 |
function BlockEditor(_ref) { |
| 9484 |
let { |
| 9485 |
setIsInserterOpen |
| 9486 |
} = _ref; |
| 9487 |
const { |
| 9488 |
settings, |
| 9489 |
templateType, |
| 9490 |
templateId, |
| 9491 |
page |
| 9492 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 9493 |
const { |
| 9494 |
getSettings, |
| 9495 |
getEditedPostType, |
| 9496 |
getEditedPostId, |
| 9497 |
getPage |
| 9498 |
} = select(store_store); |
| 9499 |
return { |
| 9500 |
settings: getSettings(setIsInserterOpen), |
| 9501 |
templateType: getEditedPostType(), |
| 9502 |
templateId: getEditedPostId(), |
| 9503 |
page: getPage() |
| 9504 |
}; |
| 9505 |
}, [setIsInserterOpen]); |
| 9506 |
const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); |
| 9507 |
const { |
| 9508 |
setPage |
| 9509 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 9510 |
const contentRef = (0,external_wp_element_namespaceObject.useRef)(); |
| 9511 |
const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)()]); |
| 9512 |
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); |
| 9513 |
const { |
| 9514 |
clearSelectedBlock |
| 9515 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 9516 |
const isTemplatePart = templateType === 'wp_template_part'; |
| 9517 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { |
| 9518 |
settings: settings, |
| 9519 |
value: blocks, |
| 9520 |
onInput: onInput, |
| 9521 |
onChange: onChange, |
| 9522 |
useSubRegistry: false |
| 9523 |
}, (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuButton, null), (0,external_wp_element_namespaceObject.createElement)(TemplatePartConverter, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl.ViewerFill, null, (0,external_wp_element_namespaceObject.useCallback)(fillProps => (0,external_wp_element_namespaceObject.createElement)(NavigateToLink, extends_extends({}, fillProps, { |
| 9524 |
activePage: page, |
| 9525 |
onActivePageChange: setPage |
| 9526 |
})), [page])), (0,external_wp_element_namespaceObject.createElement)(SidebarInspectorFill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, { |
| 9527 |
className: classnames_default()('edit-site-visual-editor', { |
| 9528 |
'is-focus-mode': isTemplatePart |
| 9529 |
}), |
| 9530 |
__unstableContentRef: contentRef, |
| 9531 |
onClick: event => { |
| 9532 |
// Clear selected block when clicking on the gray background. |
| 9533 |
if (event.target === event.currentTarget) { |
| 9534 |
clearSelectedBlock(); |
| 9535 |
} |
| 9536 |
} |
| 9537 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(back_button, null), (0,external_wp_element_namespaceObject.createElement)(resizable_editor // Reinitialize the editor and reset the states when the template changes. |
| 9538 |
, { |
| 9539 |
key: templateId, |
| 9540 |
enableResizing: isTemplatePart && // Disable resizing in mobile viewport. |
| 9541 |
!isMobileViewport, |
| 9542 |
settings: settings, |
| 9543 |
contentRef: mergedRefs |
| 9544 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { |
| 9545 |
className: "edit-site-block-editor__block-list wp-site-blocks", |
| 9546 |
__experimentalLayout: LAYOUT, |
| 9547 |
renderAppender: isTemplatePart ? false : undefined |
| 9548 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref2 => { |
| 9549 |
let { |
| 9550 |
onClose |
| 9551 |
} = _ref2; |
| 9552 |
return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorButton, { |
| 9553 |
onClick: onClose |
| 9554 |
}); |
| 9555 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null)); |
| 9556 |
} |
| 9557 |
//# sourceMappingURL=index.js.map |
| 9558 |
// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
| 9559 |
var lib = __webpack_require__(4042); |
| 9560 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/code-editor/code-editor-text-area.js |
| 9561 |
|
| 9562 |
|
| 9563 |
/** |
| 9564 |
* External dependencies |
| 9565 |
*/ |
| 9566 |
|
| 9567 |
/** |
| 9568 |
* WordPress dependencies |
| 9569 |
*/ |
| 9570 |
|
| 9571 |
/** |
| 9572 |
* WordPress dependencies |
| 9573 |
*/ |
| 9574 |
|
| 9575 |
/** |
| 9576 |
* WordPress dependencies |
| 9577 |
*/ |
| 9578 |
|
| 9579 |
|
| 9580 |
|
| 9581 |
|
| 9582 |
|
| 9583 |
function CodeEditorTextArea(_ref) { |
| 9584 |
let { |
| 9585 |
value, |
| 9586 |
onChange, |
| 9587 |
onInput |
| 9588 |
} = _ref; |
| 9589 |
const [stateValue, setStateValue] = (0,external_wp_element_namespaceObject.useState)(value); |
| 9590 |
const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false); |
| 9591 |
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditorTextArea); |
| 9592 |
|
| 9593 |
if (!isDirty && stateValue !== value) { |
| 9594 |
setStateValue(value); |
| 9595 |
} |
| 9596 |
/** |
| 9597 |
* Handles a textarea change event to notify the onChange prop callback and |
| 9598 |
* reflect the new value in the component's own state. This marks the start |
| 9599 |
* of the user's edits, if not already changed, preventing future props |
| 9600 |
* changes to value from replacing the rendered value. This is expected to |
| 9601 |
* be followed by a reset to dirty state via `stopEditing`. |
| 9602 |
* |
| 9603 |
* @see stopEditing |
| 9604 |
* |
| 9605 |
* @param {Event} event Change event. |
| 9606 |
*/ |
| 9607 |
|
| 9608 |
|
| 9609 |
const onChangeHandler = event => { |
| 9610 |
const newValue = event.target.value; |
| 9611 |
onInput(newValue); |
| 9612 |
setStateValue(newValue); |
| 9613 |
setIsDirty(true); |
| 9614 |
}; |
| 9615 |
/** |
| 9616 |
* Function called when the user has completed their edits, responsible for |
| 9617 |
* ensuring that changes, if made, are surfaced to the onPersist prop |
| 9618 |
* callback and resetting dirty state. |
| 9619 |
*/ |
| 9620 |
|
| 9621 |
|
| 9622 |
const stopEditing = () => { |
| 9623 |
if (isDirty) { |
| 9624 |
onChange(stateValue); |
| 9625 |
setIsDirty(false); |
| 9626 |
} |
| 9627 |
}; |
| 9628 |
|
| 9629 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
| 9630 |
as: "label", |
| 9631 |
htmlFor: `code-editor-text-area-${instanceId}` |
| 9632 |
}, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { |
| 9633 |
autoComplete: "off", |
| 9634 |
dir: "auto", |
| 9635 |
value: stateValue, |
| 9636 |
onChange: onChangeHandler, |
| 9637 |
onBlur: stopEditing, |
| 9638 |
className: "edit-site-code-editor-text-area", |
| 9639 |
id: `code-editor-text-area-${instanceId}`, |
| 9640 |
placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') |
| 9641 |
})); |
| 9642 |
} |
| 9643 |
//# sourceMappingURL=code-editor-text-area.js.map |
| 9644 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/code-editor/index.js |
| 9645 |
|
| 9646 |
|
| 9647 |
/** |
| 9648 |
* WordPress dependencies |
| 9649 |
*/ |
| 9650 |
|
| 9651 |
|
| 9652 |
|
| 9653 |
|
| 9654 |
|
| 9655 |
|
| 9656 |
/** |
| 9657 |
* Internal dependencies |
| 9658 |
*/ |
| 9659 |
|
| 9660 |
|
| 9661 |
|
| 9662 |
function CodeEditor() { |
| 9663 |
const { |
| 9664 |
templateType, |
| 9665 |
shortcut |
| 9666 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 9667 |
const { |
| 9668 |
getEditedPostType |
| 9669 |
} = select(store_store); |
| 9670 |
const { |
| 9671 |
getShortcutRepresentation |
| 9672 |
} = select(external_wp_keyboardShortcuts_namespaceObject.store); |
| 9673 |
return { |
| 9674 |
templateType: getEditedPostType(), |
| 9675 |
shortcut: getShortcutRepresentation('core/edit-site/toggle-mode') |
| 9676 |
}; |
| 9677 |
}, []); |
| 9678 |
const [contentStructure, setContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', templateType, 'content'); |
| 9679 |
const [blocks,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); |
| 9680 |
const content = contentStructure instanceof Function ? contentStructure({ |
| 9681 |
blocks |
| 9682 |
}) : contentStructure; |
| 9683 |
const { |
| 9684 |
switchEditorMode |
| 9685 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 9686 |
return (0,external_wp_element_namespaceObject.createElement)("div", { |
| 9687 |
className: "edit-site-code-editor" |
| 9688 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 9689 |
className: "edit-site-code-editor__toolbar" |
| 9690 |
}, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 9691 |
variant: "tertiary", |
| 9692 |
onClick: () => switchEditorMode('visual'), |
| 9693 |
shortcut: shortcut |
| 9694 |
}, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 9695 |
className: "edit-site-code-editor__body" |
| 9696 |
}, (0,external_wp_element_namespaceObject.createElement)(CodeEditorTextArea, { |
| 9697 |
value: content, |
| 9698 |
onChange: newContent => { |
| 9699 |
onChange((0,external_wp_blocks_namespaceObject.parse)(newContent), { |
| 9700 |
selection: undefined |
| 9701 |
}); |
| 9702 |
}, |
| 9703 |
onInput: setContent |
| 9704 |
}))); |
| 9705 |
} |
| 9706 |
//# sourceMappingURL=index.js.map |
| 9707 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/keyboard-shortcuts/index.js |
| 9708 |
/** |
| 9709 |
* WordPress dependencies |
| 9710 |
*/ |
| 9711 |
|
| 9712 |
|
| 9713 |
|
| 9714 |
|
| 9715 |
|
| 9716 |
|
| 9717 |
/** |
| 9718 |
* Internal dependencies |
| 9719 |
*/ |
| 9720 |
|
| 9721 |
|
| 9722 |
|
| 9723 |
|
| 9724 |
|
| 9725 |
function KeyboardShortcuts(_ref) { |
| 9726 |
let { |
| 9727 |
openEntitiesSavedStates |
| 9728 |
} = _ref; |
| 9729 |
const { |
| 9730 |
__experimentalGetDirtyEntityRecords, |
| 9731 |
isSavingEntityRecord |
| 9732 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
| 9733 |
const { |
| 9734 |
getEditorMode |
| 9735 |
} = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
| 9736 |
const isListViewOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isListViewOpened(), []); |
| 9737 |
const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []); |
| 9738 |
const { |
| 9739 |
redo, |
| 9740 |
undo |
| 9741 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 9742 |
const { |
| 9743 |
setIsListViewOpened, |
| 9744 |
switchEditorMode |
| 9745 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 9746 |
const { |
| 9747 |
enableComplementaryArea, |
| 9748 |
disableComplementaryArea |
| 9749 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 9750 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { |
| 9751 |
event.preventDefault(); |
| 9752 |
|
| 9753 |
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
| 9754 |
|
| 9755 |
const isDirty = !!dirtyEntityRecords.length; |
| 9756 |
const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); |
| 9757 |
|
| 9758 |
if (!isSaving && isDirty) { |
| 9759 |
openEntitiesSavedStates(); |
| 9760 |
} |
| 9761 |
}); |
| 9762 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/undo', event => { |
| 9763 |
undo(); |
| 9764 |
event.preventDefault(); |
| 9765 |
}); |
| 9766 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/redo', event => { |
| 9767 |
redo(); |
| 9768 |
event.preventDefault(); |
| 9769 |
}); |
| 9770 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-list-view', () => { |
| 9771 |
setIsListViewOpened(!isListViewOpen); |
| 9772 |
}); |
| 9773 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => { |
| 9774 |
// This shortcut has no known clashes, but use preventDefault to prevent any |
| 9775 |
// obscure shortcuts from triggering. |
| 9776 |
event.preventDefault(); |
| 9777 |
|
| 9778 |
if (isBlockInspectorOpen) { |
| 9779 |
disableComplementaryArea(STORE_NAME); |
| 9780 |
} else { |
| 9781 |
enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
| 9782 |
} |
| 9783 |
}); |
| 9784 |
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => { |
| 9785 |
switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); |
| 9786 |
}); |
| 9787 |
return null; |
| 9788 |
} |
| 9789 |
|
| 9790 |
function KeyboardShortcutsRegister() { |
| 9791 |
// Registering the shortcuts |
| 9792 |
const { |
| 9793 |
registerShortcut |
| 9794 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
| 9795 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 9796 |
registerShortcut({ |
| 9797 |
name: 'core/edit-site/save', |
| 9798 |
category: 'global', |
| 9799 |
description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), |
| 9800 |
keyCombination: { |
| 9801 |
modifier: 'primary', |
| 9802 |
character: 's' |
| 9803 |
} |
| 9804 |
}); |
| 9805 |
registerShortcut({ |
| 9806 |
name: 'core/edit-site/undo', |
| 9807 |
category: 'global', |
| 9808 |
description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), |
| 9809 |
keyCombination: { |
| 9810 |
modifier: 'primary', |
| 9811 |
character: 'z' |
| 9812 |
} |
| 9813 |
}); |
| 9814 |
registerShortcut({ |
| 9815 |
name: 'core/edit-site/redo', |
| 9816 |
category: 'global', |
| 9817 |
description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), |
| 9818 |
keyCombination: { |
| 9819 |
modifier: 'primaryShift', |
| 9820 |
character: 'z' |
| 9821 |
} |
| 9822 |
}); |
| 9823 |
registerShortcut({ |
| 9824 |
name: 'core/edit-site/toggle-list-view', |
| 9825 |
category: 'global', |
| 9826 |
description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'), |
| 9827 |
keyCombination: { |
| 9828 |
modifier: 'access', |
| 9829 |
character: 'o' |
| 9830 |
} |
| 9831 |
}); |
| 9832 |
registerShortcut({ |
| 9833 |
name: 'core/edit-site/toggle-block-settings-sidebar', |
| 9834 |
category: 'global', |
| 9835 |
description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the block settings sidebar.'), |
| 9836 |
keyCombination: { |
| 9837 |
modifier: 'primaryShift', |
| 9838 |
character: ',' |
| 9839 |
} |
| 9840 |
}); |
| 9841 |
registerShortcut({ |
| 9842 |
name: 'core/edit-site/keyboard-shortcuts', |
| 9843 |
category: 'main', |
| 9844 |
description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), |
| 9845 |
keyCombination: { |
| 9846 |
modifier: 'access', |
| 9847 |
character: 'h' |
| 9848 |
} |
| 9849 |
}); |
| 9850 |
registerShortcut({ |
| 9851 |
name: 'core/edit-site/next-region', |
| 9852 |
category: 'global', |
| 9853 |
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), |
| 9854 |
keyCombination: { |
| 9855 |
modifier: 'ctrl', |
| 9856 |
character: '`' |
| 9857 |
}, |
| 9858 |
aliases: [{ |
| 9859 |
modifier: 'access', |
| 9860 |
character: 'n' |
| 9861 |
}] |
| 9862 |
}); |
| 9863 |
registerShortcut({ |
| 9864 |
name: 'core/edit-site/previous-region', |
| 9865 |
category: 'global', |
| 9866 |
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), |
| 9867 |
keyCombination: { |
| 9868 |
modifier: 'ctrlShift', |
| 9869 |
character: '`' |
| 9870 |
}, |
| 9871 |
aliases: [{ |
| 9872 |
modifier: 'access', |
| 9873 |
character: 'p' |
| 9874 |
}] |
| 9875 |
}); |
| 9876 |
registerShortcut({ |
| 9877 |
name: 'core/edit-site/toggle-mode', |
| 9878 |
category: 'global', |
| 9879 |
description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), |
| 9880 |
keyCombination: { |
| 9881 |
modifier: 'secondary', |
| 9882 |
character: 'm' |
| 9883 |
} |
| 9884 |
}); |
| 9885 |
}, [registerShortcut]); |
| 9886 |
return null; |
| 9887 |
} |
| 9888 |
|
| 9889 |
KeyboardShortcuts.Register = KeyboardShortcutsRegister; |
| 9890 |
/* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); |
| 9891 |
//# sourceMappingURL=index.js.map |
| 9892 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/url-query-controller/index.js |
| 9893 |
/** |
| 9894 |
* WordPress dependencies |
| 9895 |
*/ |
| 9896 |
|
| 9897 |
|
| 9898 |
/** |
| 9899 |
* Internal dependencies |
| 9900 |
*/ |
| 9901 |
|
| 9902 |
|
| 9903 |
|
| 9904 |
function URLQueryController() { |
| 9905 |
const { |
| 9906 |
setTemplate, |
| 9907 |
setTemplatePart, |
| 9908 |
setPage |
| 9909 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 9910 |
const { |
| 9911 |
params: { |
| 9912 |
postId, |
| 9913 |
postType |
| 9914 |
} |
| 9915 |
} = useLocation(); // Set correct entity on page navigation. |
| 9916 |
|
| 9917 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 9918 |
if ('page' === postType || 'post' === postType) { |
| 9919 |
setPage({ |
| 9920 |
context: { |
| 9921 |
postType, |
| 9922 |
postId |
| 9923 |
} |
| 9924 |
}); // Resolves correct template based on ID. |
| 9925 |
} else if ('wp_template' === postType) { |
| 9926 |
setTemplate(postId); |
| 9927 |
} else if ('wp_template_part' === postType) { |
| 9928 |
setTemplatePart(postId); |
| 9929 |
} |
| 9930 |
}, [postId, postType]); |
| 9931 |
return null; |
| 9932 |
} |
| 9933 |
//# sourceMappingURL=index.js.map |
| 9934 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/close.js |
| 9935 |
|
| 9936 |
|
| 9937 |
/** |
| 9938 |
* WordPress dependencies |
| 9939 |
*/ |
| 9940 |
|
| 9941 |
const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 9942 |
xmlns: "http://www.w3.org/2000/svg", |
| 9943 |
viewBox: "0 0 24 24" |
| 9944 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 9945 |
d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" |
| 9946 |
})); |
| 9947 |
/* harmony default export */ var library_close = (close_close); |
| 9948 |
//# sourceMappingURL=close.js.map |
| 9949 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/secondary-sidebar/inserter-sidebar.js |
| 9950 |
|
| 9951 |
|
| 9952 |
|
| 9953 |
/** |
| 9954 |
* WordPress dependencies |
| 9955 |
*/ |
| 9956 |
|
| 9957 |
|
| 9958 |
|
| 9959 |
|
| 9960 |
|
| 9961 |
|
| 9962 |
|
| 9963 |
/** |
| 9964 |
* Internal dependencies |
| 9965 |
*/ |
| 9966 |
|
| 9967 |
|
| 9968 |
function InserterSidebar() { |
| 9969 |
const { |
| 9970 |
setIsInserterOpened |
| 9971 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 9972 |
const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetInsertionPoint(), []); |
| 9973 |
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); |
| 9974 |
const TagName = !isMobile ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; |
| 9975 |
const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ |
| 9976 |
onClose: () => setIsInserterOpened(false), |
| 9977 |
focusOnMount: null |
| 9978 |
}); |
| 9979 |
const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); |
| 9980 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 9981 |
libraryRef.current.focusSearch(); |
| 9982 |
}, []); |
| 9983 |
return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({ |
| 9984 |
ref: inserterDialogRef |
| 9985 |
}, inserterDialogProps, { |
| 9986 |
className: "edit-site-editor__inserter-panel" |
| 9987 |
}), (0,external_wp_element_namespaceObject.createElement)(TagName, { |
| 9988 |
className: "edit-site-editor__inserter-panel-header" |
| 9989 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 9990 |
icon: library_close, |
| 9991 |
label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), |
| 9992 |
onClick: () => setIsInserterOpened(false) |
| 9993 |
})), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 9994 |
className: "edit-site-editor__inserter-panel-content" |
| 9995 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { |
| 9996 |
showInserterHelpPanel: true, |
| 9997 |
shouldFocusBlock: isMobile, |
| 9998 |
rootClientId: insertionPoint.rootClientId, |
| 9999 |
__experimentalInsertionIndex: insertionPoint.insertionIndex, |
| 10000 |
__experimentalFilterValue: insertionPoint.filterValue, |
| 10001 |
ref: libraryRef |
| 10002 |
}))); |
| 10003 |
} |
| 10004 |
//# sourceMappingURL=inserter-sidebar.js.map |
| 10005 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/secondary-sidebar/list-view-sidebar.js |
| 10006 |
|
| 10007 |
|
| 10008 |
/** |
| 10009 |
* WordPress dependencies |
| 10010 |
*/ |
| 10011 |
|
| 10012 |
|
| 10013 |
|
| 10014 |
|
| 10015 |
|
| 10016 |
|
| 10017 |
|
| 10018 |
/** |
| 10019 |
* Internal dependencies |
| 10020 |
*/ |
| 10021 |
|
| 10022 |
|
| 10023 |
function ListViewSidebar() { |
| 10024 |
const { |
| 10025 |
setIsListViewOpened |
| 10026 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 10027 |
const { |
| 10028 |
clearSelectedBlock, |
| 10029 |
selectBlock |
| 10030 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
| 10031 |
|
| 10032 |
async function selectEditorBlock(clientId) { |
| 10033 |
await clearSelectedBlock(); |
| 10034 |
selectBlock(clientId, -1); |
| 10035 |
} |
| 10036 |
|
| 10037 |
const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); |
| 10038 |
const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
| 10039 |
const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
| 10040 |
|
| 10041 |
function closeOnEscape(event) { |
| 10042 |
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { |
| 10043 |
setIsListViewOpened(false); |
| 10044 |
} |
| 10045 |
} |
| 10046 |
|
| 10047 |
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar); |
| 10048 |
const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`; |
| 10049 |
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
| 10050 |
(0,external_wp_element_namespaceObject.createElement)("div", { |
| 10051 |
"aria-labelledby": labelId, |
| 10052 |
className: "edit-site-editor__list-view-panel", |
| 10053 |
onKeyDown: closeOnEscape |
| 10054 |
}, (0,external_wp_element_namespaceObject.createElement)("div", { |
| 10055 |
className: "edit-site-editor__list-view-panel-header", |
| 10056 |
ref: headerFocusReturnRef |
| 10057 |
}, (0,external_wp_element_namespaceObject.createElement)("strong", { |
| 10058 |
id: labelId |
| 10059 |
}, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 10060 |
icon: close_small, |
| 10061 |
label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'), |
| 10062 |
onClick: () => setIsListViewOpened(false) |
| 10063 |
})), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 10064 |
className: "edit-site-editor__list-view-panel-content", |
| 10065 |
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef]) |
| 10066 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { |
| 10067 |
onSelect: selectEditorBlock, |
| 10068 |
showNestedBlocks: true, |
| 10069 |
__experimentalFeatures: true, |
| 10070 |
__experimentalPersistentListViewFeatures: true |
| 10071 |
}))) |
| 10072 |
); |
| 10073 |
} |
| 10074 |
//# sourceMappingURL=list-view-sidebar.js.map |
| 10075 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/error-boundary/index.js |
| 10076 |
|
| 10077 |
|
| 10078 |
/** |
| 10079 |
* WordPress dependencies |
| 10080 |
*/ |
| 10081 |
|
| 10082 |
|
| 10083 |
|
| 10084 |
|
| 10085 |
|
| 10086 |
|
| 10087 |
function CopyButton(_ref) { |
| 10088 |
let { |
| 10089 |
text, |
| 10090 |
children |
| 10091 |
} = _ref; |
| 10092 |
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); |
| 10093 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 10094 |
variant: "secondary", |
| 10095 |
ref: ref |
| 10096 |
}, children); |
| 10097 |
} |
| 10098 |
|
| 10099 |
class ErrorBoundary extends external_wp_element_namespaceObject.Component { |
| 10100 |
constructor() { |
| 10101 |
super(...arguments); |
| 10102 |
this.reboot = this.reboot.bind(this); |
| 10103 |
this.state = { |
| 10104 |
error: null |
| 10105 |
}; |
| 10106 |
} |
| 10107 |
|
| 10108 |
static getDerivedStateFromError(error) { |
| 10109 |
return { |
| 10110 |
error |
| 10111 |
}; |
| 10112 |
} |
| 10113 |
|
| 10114 |
reboot() { |
| 10115 |
this.props.onError(); |
| 10116 |
} |
| 10117 |
|
| 10118 |
render() { |
| 10119 |
const { |
| 10120 |
error |
| 10121 |
} = this.state; |
| 10122 |
|
| 10123 |
if (!error) { |
| 10124 |
return this.props.children; |
| 10125 |
} |
| 10126 |
|
| 10127 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { |
| 10128 |
className: "editor-error-boundary", |
| 10129 |
actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 10130 |
key: "recovery", |
| 10131 |
onClick: this.reboot, |
| 10132 |
variant: "secondary" |
| 10133 |
}, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { |
| 10134 |
key: "copy-error", |
| 10135 |
text: error.stack |
| 10136 |
}, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))] |
| 10137 |
}, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')); |
| 10138 |
} |
| 10139 |
|
| 10140 |
} |
| 10141 |
//# sourceMappingURL=index.js.map |
| 10142 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/welcome-guide/image.js |
| 10143 |
|
| 10144 |
function WelcomeGuideImage(_ref) { |
| 10145 |
let { |
| 10146 |
nonAnimatedSrc, |
| 10147 |
animatedSrc |
| 10148 |
} = _ref; |
| 10149 |
return (0,external_wp_element_namespaceObject.createElement)("picture", { |
| 10150 |
className: "edit-site-welcome-guide__image" |
| 10151 |
}, (0,external_wp_element_namespaceObject.createElement)("source", { |
| 10152 |
srcSet: nonAnimatedSrc, |
| 10153 |
media: "(prefers-reduced-motion: reduce)" |
| 10154 |
}), (0,external_wp_element_namespaceObject.createElement)("img", { |
| 10155 |
src: animatedSrc, |
| 10156 |
width: "312", |
| 10157 |
height: "240", |
| 10158 |
alt: "" |
| 10159 |
})); |
| 10160 |
} |
| 10161 |
//# sourceMappingURL=image.js.map |
| 10162 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/welcome-guide/editor.js |
| 10163 |
|
| 10164 |
|
| 10165 |
/** |
| 10166 |
* WordPress dependencies |
| 10167 |
*/ |
| 10168 |
|
| 10169 |
|
| 10170 |
|
| 10171 |
|
| 10172 |
/** |
| 10173 |
* Internal dependencies |
| 10174 |
*/ |
| 10175 |
|
| 10176 |
|
| 10177 |
|
| 10178 |
function WelcomeGuideEditor() { |
| 10179 |
const { |
| 10180 |
toggleFeature |
| 10181 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 10182 |
const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isFeatureActive('welcomeGuide'), []); |
| 10183 |
|
| 10184 |
if (!isActive) { |
| 10185 |
return null; |
| 10186 |
} |
| 10187 |
|
| 10188 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
| 10189 |
className: "edit-site-welcome-guide", |
| 10190 |
contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), |
| 10191 |
finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), |
| 10192 |
onFinish: () => toggleFeature('welcomeGuide'), |
| 10193 |
pages: [{ |
| 10194 |
image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
| 10195 |
nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", |
| 10196 |
animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" |
| 10197 |
}), |
| 10198 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
| 10199 |
className: "edit-site-welcome-guide__heading" |
| 10200 |
}, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10201 |
className: "edit-site-welcome-guide__text" |
| 10202 |
}, (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10203 |
className: "edit-site-welcome-guide__text" |
| 10204 |
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), { |
| 10205 |
StylesIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { |
| 10206 |
alt: (0,external_wp_i18n_namespaceObject.__)('styles'), |
| 10207 |
src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" |
| 10208 |
}) |
| 10209 |
}))) |
| 10210 |
}] |
| 10211 |
}); |
| 10212 |
} |
| 10213 |
//# sourceMappingURL=editor.js.map |
| 10214 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/welcome-guide/styles.js |
| 10215 |
|
| 10216 |
|
| 10217 |
/** |
| 10218 |
* WordPress dependencies |
| 10219 |
*/ |
| 10220 |
|
| 10221 |
|
| 10222 |
|
| 10223 |
|
| 10224 |
/** |
| 10225 |
* Internal dependencies |
| 10226 |
*/ |
| 10227 |
|
| 10228 |
|
| 10229 |
|
| 10230 |
function WelcomeGuideStyles() { |
| 10231 |
const { |
| 10232 |
toggleFeature |
| 10233 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 10234 |
const { |
| 10235 |
isActive, |
| 10236 |
isStylesOpen |
| 10237 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 10238 |
const sidebar = select(store).getActiveComplementaryArea(store_store.name); |
| 10239 |
return { |
| 10240 |
isActive: select(store_store).isFeatureActive('welcomeGuideStyles'), |
| 10241 |
isStylesOpen: sidebar === 'edit-site/global-styles' |
| 10242 |
}; |
| 10243 |
}, []); |
| 10244 |
|
| 10245 |
if (!isActive || !isStylesOpen) { |
| 10246 |
return null; |
| 10247 |
} |
| 10248 |
|
| 10249 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
| 10250 |
className: "edit-site-welcome-guide", |
| 10251 |
contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to styles'), |
| 10252 |
finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), |
| 10253 |
onFinish: () => toggleFeature('welcomeGuideStyles'), |
| 10254 |
pages: [{ |
| 10255 |
image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
| 10256 |
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", |
| 10257 |
animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" |
| 10258 |
}), |
| 10259 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
| 10260 |
className: "edit-site-welcome-guide__heading" |
| 10261 |
}, (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10262 |
className: "edit-site-welcome-guide__text" |
| 10263 |
}, (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'))) |
| 10264 |
}, { |
| 10265 |
image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
| 10266 |
nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", |
| 10267 |
animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" |
| 10268 |
}), |
| 10269 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
| 10270 |
className: "edit-site-welcome-guide__heading" |
| 10271 |
}, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10272 |
className: "edit-site-welcome-guide__text" |
| 10273 |
}, (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '))) |
| 10274 |
}, { |
| 10275 |
image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
| 10276 |
nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", |
| 10277 |
animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" |
| 10278 |
}), |
| 10279 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
| 10280 |
className: "edit-site-welcome-guide__heading" |
| 10281 |
}, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10282 |
className: "edit-site-welcome-guide__text" |
| 10283 |
}, (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'))) |
| 10284 |
}, { |
| 10285 |
image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
| 10286 |
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
| 10287 |
animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
| 10288 |
}), |
| 10289 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
| 10290 |
className: "edit-site-welcome-guide__heading" |
| 10291 |
}, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_wp_element_namespaceObject.createElement)("p", { |
| 10292 |
className: "edit-site-welcome-guide__text" |
| 10293 |
}, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
| 10294 |
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/styles-overview/') |
| 10295 |
}, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.')))) |
| 10296 |
}] |
| 10297 |
}); |
| 10298 |
} |
| 10299 |
//# sourceMappingURL=styles.js.map |
| 10300 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/welcome-guide/index.js |
| 10301 |
|
| 10302 |
|
| 10303 |
/** |
| 10304 |
* Internal dependencies |
| 10305 |
*/ |
| 10306 |
|
| 10307 |
|
| 10308 |
function WelcomeGuide() { |
| 10309 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideEditor, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideStyles, null)); |
| 10310 |
} |
| 10311 |
//# sourceMappingURL=index.js.map |
| 10312 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/editor/global-styles-renderer.js |
| 10313 |
/** |
| 10314 |
* WordPress dependencies |
| 10315 |
*/ |
| 10316 |
|
| 10317 |
|
| 10318 |
/** |
| 10319 |
* Internal dependencies |
| 10320 |
*/ |
| 10321 |
|
| 10322 |
|
| 10323 |
/** |
| 10324 |
* Internal dependencies |
| 10325 |
*/ |
| 10326 |
|
| 10327 |
|
| 10328 |
|
| 10329 |
function useGlobalStylesRenderer() { |
| 10330 |
const [styles, settings] = useGlobalStylesOutput(); |
| 10331 |
const { |
| 10332 |
getSettings |
| 10333 |
} = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
| 10334 |
const { |
| 10335 |
updateSettings |
| 10336 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 10337 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 10338 |
var _currentStoreSettings; |
| 10339 |
|
| 10340 |
if (!styles || !settings) { |
| 10341 |
return; |
| 10342 |
} |
| 10343 |
|
| 10344 |
const currentStoreSettings = getSettings(); |
| 10345 |
const nonGlobalStyles = currentStoreSettings === null || currentStoreSettings === void 0 ? void 0 : (_currentStoreSettings = currentStoreSettings.styles) === null || _currentStoreSettings === void 0 ? void 0 : _currentStoreSettings.filter(style => !style.isGlobalStyles); |
| 10346 |
updateSettings({ ...currentStoreSettings, |
| 10347 |
styles: [...nonGlobalStyles, ...styles], |
| 10348 |
__experimentalFeatures: settings |
| 10349 |
}); |
| 10350 |
}, [styles, settings]); |
| 10351 |
} |
| 10352 |
|
| 10353 |
function GlobalStylesRenderer() { |
| 10354 |
useGlobalStylesRenderer(); |
| 10355 |
return null; |
| 10356 |
} |
| 10357 |
//# sourceMappingURL=global-styles-renderer.js.map |
| 10358 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/routes/use-title.js |
| 10359 |
/** |
| 10360 |
* WordPress dependencies |
| 10361 |
*/ |
| 10362 |
|
| 10363 |
|
| 10364 |
|
| 10365 |
|
| 10366 |
|
| 10367 |
/** |
| 10368 |
* Internal dependencies |
| 10369 |
*/ |
| 10370 |
|
| 10371 |
|
| 10372 |
function useTitle(title) { |
| 10373 |
const location = useLocation(); |
| 10374 |
const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 10375 |
var _select$getEntityReco; |
| 10376 |
|
| 10377 |
return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title; |
| 10378 |
}, []); |
| 10379 |
const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); |
| 10380 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 10381 |
isInitialLocationRef.current = false; |
| 10382 |
}, [location]); |
| 10383 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 10384 |
// Don't update or announce the title for initial page load. |
| 10385 |
if (isInitialLocationRef.current) { |
| 10386 |
return; |
| 10387 |
} |
| 10388 |
|
| 10389 |
if (title && siteTitle) { |
| 10390 |
// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 |
| 10391 |
const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( |
| 10392 |
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ |
| 10393 |
(0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s — WordPress'), title, siteTitle); |
| 10394 |
document.title = formattedTitle; // Announce title on route change for screen readers. |
| 10395 |
|
| 10396 |
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( |
| 10397 |
/* translators: The page title that is currently displaying. */ |
| 10398 |
(0,external_wp_i18n_namespaceObject.__)('Now displaying: %s'), document.title), 'assertive'); |
| 10399 |
} |
| 10400 |
}, [title, siteTitle, location]); |
| 10401 |
} |
| 10402 |
//# sourceMappingURL=use-title.js.map |
| 10403 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/editor/index.js |
| 10404 |
|
| 10405 |
|
| 10406 |
/** |
| 10407 |
* WordPress dependencies |
| 10408 |
*/ |
| 10409 |
|
| 10410 |
|
| 10411 |
|
| 10412 |
|
| 10413 |
|
| 10414 |
|
| 10415 |
|
| 10416 |
|
| 10417 |
|
| 10418 |
|
| 10419 |
|
| 10420 |
/** |
| 10421 |
* Internal dependencies |
| 10422 |
*/ |
| 10423 |
|
| 10424 |
|
| 10425 |
|
| 10426 |
|
| 10427 |
|
| 10428 |
|
| 10429 |
|
| 10430 |
|
| 10431 |
|
| 10432 |
|
| 10433 |
|
| 10434 |
|
| 10435 |
|
| 10436 |
|
| 10437 |
|
| 10438 |
|
| 10439 |
const interfaceLabels = { |
| 10440 |
secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), |
| 10441 |
drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar') |
| 10442 |
}; |
| 10443 |
|
| 10444 |
function Editor(_ref) { |
| 10445 |
let { |
| 10446 |
onError |
| 10447 |
} = _ref; |
| 10448 |
const { |
| 10449 |
isInserterOpen, |
| 10450 |
isListViewOpen, |
| 10451 |
sidebarIsOpened, |
| 10452 |
settings, |
| 10453 |
entityId, |
| 10454 |
templateType, |
| 10455 |
page, |
| 10456 |
template, |
| 10457 |
templateResolved, |
| 10458 |
isNavigationOpen, |
| 10459 |
previousShortcut, |
| 10460 |
nextShortcut, |
| 10461 |
editorMode |
| 10462 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 10463 |
const { |
| 10464 |
isInserterOpened, |
| 10465 |
isListViewOpened, |
| 10466 |
getSettings, |
| 10467 |
getEditedPostType, |
| 10468 |
getEditedPostId, |
| 10469 |
getPage, |
| 10470 |
isNavigationOpened, |
| 10471 |
getEditorMode |
| 10472 |
} = select(store_store); |
| 10473 |
const { |
| 10474 |
hasFinishedResolution, |
| 10475 |
getEntityRecord |
| 10476 |
} = select(external_wp_coreData_namespaceObject.store); |
| 10477 |
const postType = getEditedPostType(); |
| 10478 |
const postId = getEditedPostId(); // The currently selected entity to display. Typically template or template part. |
| 10479 |
|
| 10480 |
return { |
| 10481 |
isInserterOpen: isInserterOpened(), |
| 10482 |
isListViewOpen: isListViewOpened(), |
| 10483 |
sidebarIsOpened: !!select(store).getActiveComplementaryArea(store_store.name), |
| 10484 |
settings: getSettings(), |
| 10485 |
templateType: postType, |
| 10486 |
page: getPage(), |
| 10487 |
template: postId ? getEntityRecord('postType', postType, postId) : null, |
| 10488 |
templateResolved: postId ? hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) : false, |
| 10489 |
entityId: postId, |
| 10490 |
isNavigationOpen: isNavigationOpened(), |
| 10491 |
previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), |
| 10492 |
nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), |
| 10493 |
editorMode: getEditorMode() |
| 10494 |
}; |
| 10495 |
}, []); |
| 10496 |
const { |
| 10497 |
setPage, |
| 10498 |
setIsInserterOpened |
| 10499 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 10500 |
const { |
| 10501 |
enableComplementaryArea |
| 10502 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
| 10503 |
const { |
| 10504 |
createErrorNotice |
| 10505 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 10506 |
const [isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
| 10507 |
const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setIsEntitiesSavedStatesOpen(true), []); |
| 10508 |
const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => { |
| 10509 |
setIsEntitiesSavedStatesOpen(false); |
| 10510 |
}, []); |
| 10511 |
const blockContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(page === null || page === void 0 ? void 0 : page.context), |
| 10512 |
queryContext: [(page === null || page === void 0 ? void 0 : page.context.queryContext) || { |
| 10513 |
page: 1 |
| 10514 |
}, newQueryContext => setPage({ ...page, |
| 10515 |
context: { ...(page === null || page === void 0 ? void 0 : page.context), |
| 10516 |
queryContext: { ...(page === null || page === void 0 ? void 0 : page.context.queryContext), |
| 10517 |
...newQueryContext |
| 10518 |
} |
| 10519 |
} |
| 10520 |
})] |
| 10521 |
}), [page === null || page === void 0 ? void 0 : page.context]); |
| 10522 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 10523 |
if (isNavigationOpen) { |
| 10524 |
document.body.classList.add('is-navigation-sidebar-open'); |
| 10525 |
} else { |
| 10526 |
document.body.classList.remove('is-navigation-sidebar-open'); |
| 10527 |
} |
| 10528 |
}, [isNavigationOpen]); |
| 10529 |
(0,external_wp_element_namespaceObject.useEffect)(function openGlobalStylesOnLoad() { |
| 10530 |
const searchParams = new URLSearchParams(window.location.search); |
| 10531 |
|
| 10532 |
if (searchParams.get('styles') === 'open') { |
| 10533 |
enableComplementaryArea('core/edit-site', 'edit-site/global-styles'); |
| 10534 |
} |
| 10535 |
}, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded |
| 10536 |
|
| 10537 |
const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined; |
| 10538 |
|
| 10539 |
const secondarySidebar = () => { |
| 10540 |
if (isInserterOpen) { |
| 10541 |
return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); |
| 10542 |
} |
| 10543 |
|
| 10544 |
if (isListViewOpen) { |
| 10545 |
return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null); |
| 10546 |
} |
| 10547 |
|
| 10548 |
return null; |
| 10549 |
}; |
| 10550 |
|
| 10551 |
function onPluginAreaError(name) { |
| 10552 |
createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
| 10553 |
/* translators: %s: plugin name */ |
| 10554 |
(0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); |
| 10555 |
} // Only announce the title once the editor is ready to prevent "Replace" |
| 10556 |
// action in <URlQueryController> from double-announcing. |
| 10557 |
|
| 10558 |
|
| 10559 |
useTitle(isReady && (0,external_wp_i18n_namespaceObject.__)('Editor (beta)')); |
| 10560 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(URLQueryController, null), isReady && (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { |
| 10561 |
kind: "root", |
| 10562 |
type: "site" |
| 10563 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { |
| 10564 |
kind: "postType", |
| 10565 |
type: templateType, |
| 10566 |
id: entityId |
| 10567 |
}, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { |
| 10568 |
value: blockContext |
| 10569 |
}, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesRenderer, null), (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, { |
| 10570 |
onError: onError |
| 10571 |
}, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarComplementaryAreaFills, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { |
| 10572 |
labels: interfaceLabels, |
| 10573 |
secondarySidebar: secondarySidebar(), |
| 10574 |
sidebar: sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { |
| 10575 |
scope: "core/edit-site" |
| 10576 |
}), |
| 10577 |
drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), |
| 10578 |
header: (0,external_wp_element_namespaceObject.createElement)(Header, { |
| 10579 |
openEntitiesSavedStates: openEntitiesSavedStates |
| 10580 |
}), |
| 10581 |
notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), |
| 10582 |
content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), editorMode === 'visual' && template && (0,external_wp_element_namespaceObject.createElement)(BlockEditor, { |
| 10583 |
setIsInserterOpen: setIsInserterOpened |
| 10584 |
}), editorMode === 'text' && template && (0,external_wp_element_namespaceObject.createElement)(CodeEditor, null), templateResolved && !template && (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && entityId && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { |
| 10585 |
status: "warning", |
| 10586 |
isDismissible: false |
| 10587 |
}, (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, { |
| 10588 |
openEntitiesSavedStates: openEntitiesSavedStates |
| 10589 |
})), |
| 10590 |
actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen ? (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { |
| 10591 |
close: closeEntitiesSavedStates |
| 10592 |
}) : (0,external_wp_element_namespaceObject.createElement)("div", { |
| 10593 |
className: "edit-site-editor__toggle-save-panel" |
| 10594 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 10595 |
variant: "secondary", |
| 10596 |
className: "edit-site-editor__toggle-save-panel-button", |
| 10597 |
onClick: openEntitiesSavedStates, |
| 10598 |
"aria-expanded": false |
| 10599 |
}, (0,external_wp_i18n_namespaceObject.__)('Open save panel')))), |
| 10600 |
footer: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { |
| 10601 |
rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Template') |
| 10602 |
}), |
| 10603 |
shortcuts: { |
| 10604 |
previous: previousShortcut, |
| 10605 |
next: nextShortcut |
| 10606 |
} |
| 10607 |
}), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { |
| 10608 |
onError: onPluginAreaError |
| 10609 |
})))))))); |
| 10610 |
} |
| 10611 |
|
| 10612 |
/* harmony default export */ var editor = (Editor); |
| 10613 |
//# sourceMappingURL=index.js.map |
| 10614 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/use-register-shortcuts.js |
| 10615 |
/** |
| 10616 |
* WordPress dependencies |
| 10617 |
*/ |
| 10618 |
|
| 10619 |
|
| 10620 |
|
| 10621 |
|
| 10622 |
function useRegisterShortcuts() { |
| 10623 |
const { |
| 10624 |
registerShortcut |
| 10625 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
| 10626 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
| 10627 |
registerShortcut({ |
| 10628 |
name: 'core/edit-site/next-region', |
| 10629 |
category: 'global', |
| 10630 |
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), |
| 10631 |
keyCombination: { |
| 10632 |
modifier: 'ctrl', |
| 10633 |
character: '`' |
| 10634 |
}, |
| 10635 |
aliases: [{ |
| 10636 |
modifier: 'access', |
| 10637 |
character: 'n' |
| 10638 |
}] |
| 10639 |
}); |
| 10640 |
registerShortcut({ |
| 10641 |
name: 'core/edit-site/previous-region', |
| 10642 |
category: 'global', |
| 10643 |
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), |
| 10644 |
keyCombination: { |
| 10645 |
modifier: 'ctrlShift', |
| 10646 |
character: '`' |
| 10647 |
}, |
| 10648 |
aliases: [{ |
| 10649 |
modifier: 'access', |
| 10650 |
character: 'p' |
| 10651 |
}] |
| 10652 |
}); |
| 10653 |
}, []); |
| 10654 |
} |
| 10655 |
//# sourceMappingURL=use-register-shortcuts.js.map |
| 10656 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/add-new-template/new-template.js |
| 10657 |
|
| 10658 |
|
| 10659 |
/** |
| 10660 |
* External dependencies |
| 10661 |
*/ |
| 10662 |
|
| 10663 |
/** |
| 10664 |
* WordPress dependencies |
| 10665 |
*/ |
| 10666 |
|
| 10667 |
|
| 10668 |
|
| 10669 |
|
| 10670 |
|
| 10671 |
|
| 10672 |
|
| 10673 |
/** |
| 10674 |
* Internal dependencies |
| 10675 |
*/ |
| 10676 |
|
| 10677 |
|
| 10678 |
const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index']; |
| 10679 |
function NewTemplate(_ref) { |
| 10680 |
let { |
| 10681 |
postType |
| 10682 |
} = _ref; |
| 10683 |
const history = useHistory(); |
| 10684 |
const { |
| 10685 |
templates, |
| 10686 |
defaultTemplateTypes |
| 10687 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
| 10688 |
templates: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { |
| 10689 |
per_page: -1 |
| 10690 |
}), |
| 10691 |
defaultTemplateTypes: select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes() |
| 10692 |
}), []); |
| 10693 |
const { |
| 10694 |
saveEntityRecord |
| 10695 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 10696 |
const { |
| 10697 |
createErrorNotice |
| 10698 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 10699 |
const { |
| 10700 |
getLastEntitySaveError |
| 10701 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
| 10702 |
|
| 10703 |
async function createTemplate(_ref2) { |
| 10704 |
let { |
| 10705 |
slug |
| 10706 |
} = _ref2; |
| 10707 |
|
| 10708 |
try { |
| 10709 |
const { |
| 10710 |
title, |
| 10711 |
description |
| 10712 |
} = (0,external_lodash_namespaceObject.find)(defaultTemplateTypes, { |
| 10713 |
slug |
| 10714 |
}); |
| 10715 |
const template = await saveEntityRecord('postType', 'wp_template', { |
| 10716 |
excerpt: description, |
| 10717 |
// Slugs need to be strings, so this is for template `404` |
| 10718 |
slug: slug.toString(), |
| 10719 |
status: 'publish', |
| 10720 |
title |
| 10721 |
}); |
| 10722 |
const lastEntitySaveError = getLastEntitySaveError('postType', 'wp_template', template.id); |
| 10723 |
|
| 10724 |
if (lastEntitySaveError) { |
| 10725 |
throw lastEntitySaveError; |
| 10726 |
} // Navigate to the created template editor. |
| 10727 |
|
| 10728 |
|
| 10729 |
history.push({ |
| 10730 |
postId: template.id, |
| 10731 |
postType: template.type |
| 10732 |
}); // TODO: Add a success notice? |
| 10733 |
} catch (error) { |
| 10734 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); |
| 10735 |
createErrorNotice(errorMessage, { |
| 10736 |
type: 'snackbar' |
| 10737 |
}); |
| 10738 |
} |
| 10739 |
} |
| 10740 |
|
| 10741 |
const existingTemplateSlugs = (0,external_lodash_namespaceObject.map)(templates, 'slug'); |
| 10742 |
const missingTemplates = (0,external_lodash_namespaceObject.filter)(defaultTemplateTypes, template => (0,external_lodash_namespaceObject.includes)(DEFAULT_TEMPLATE_SLUGS, template.slug) && !(0,external_lodash_namespaceObject.includes)(existingTemplateSlugs, template.slug)); |
| 10743 |
|
| 10744 |
if (!missingTemplates.length) { |
| 10745 |
return null; |
| 10746 |
} |
| 10747 |
|
| 10748 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
| 10749 |
className: "edit-site-new-template-dropdown", |
| 10750 |
icon: null, |
| 10751 |
text: postType.labels.add_new, |
| 10752 |
label: postType.labels.add_new_item, |
| 10753 |
popoverProps: { |
| 10754 |
noArrow: false |
| 10755 |
}, |
| 10756 |
toggleProps: { |
| 10757 |
variant: 'primary' |
| 10758 |
} |
| 10759 |
}, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, { |
| 10760 |
className: "edit-site-new-template-dropdown__popover" |
| 10761 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
| 10762 |
label: postType.labels.add_new_item |
| 10763 |
}, (0,external_lodash_namespaceObject.map)(missingTemplates, _ref3 => { |
| 10764 |
let { |
| 10765 |
title, |
| 10766 |
description, |
| 10767 |
slug |
| 10768 |
} = _ref3; |
| 10769 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 10770 |
info: description, |
| 10771 |
key: slug, |
| 10772 |
onClick: () => { |
| 10773 |
createTemplate({ |
| 10774 |
slug |
| 10775 |
}); // We will be navigated way so no need to close the dropdown. |
| 10776 |
} |
| 10777 |
}, title); |
| 10778 |
})))); |
| 10779 |
} |
| 10780 |
//# sourceMappingURL=new-template.js.map |
| 10781 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/add-new-template/new-template-part.js |
| 10782 |
|
| 10783 |
|
| 10784 |
/** |
| 10785 |
* External dependencies |
| 10786 |
*/ |
| 10787 |
|
| 10788 |
/** |
| 10789 |
* WordPress dependencies |
| 10790 |
*/ |
| 10791 |
|
| 10792 |
|
| 10793 |
|
| 10794 |
|
| 10795 |
|
| 10796 |
|
| 10797 |
|
| 10798 |
/** |
| 10799 |
* Internal dependencies |
| 10800 |
*/ |
| 10801 |
|
| 10802 |
|
| 10803 |
|
| 10804 |
function NewTemplatePart(_ref) { |
| 10805 |
let { |
| 10806 |
postType |
| 10807 |
} = _ref; |
| 10808 |
const history = useHistory(); |
| 10809 |
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
| 10810 |
const { |
| 10811 |
createErrorNotice |
| 10812 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 10813 |
const { |
| 10814 |
saveEntityRecord |
| 10815 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 10816 |
const { |
| 10817 |
getLastEntitySaveError |
| 10818 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
| 10819 |
|
| 10820 |
async function createTemplatePart(_ref2) { |
| 10821 |
let { |
| 10822 |
title, |
| 10823 |
area |
| 10824 |
} = _ref2; |
| 10825 |
|
| 10826 |
if (!title) { |
| 10827 |
createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Title is not defined.'), { |
| 10828 |
type: 'snackbar' |
| 10829 |
}); |
| 10830 |
return; |
| 10831 |
} |
| 10832 |
|
| 10833 |
try { |
| 10834 |
const templatePart = await saveEntityRecord('postType', 'wp_template_part', { |
| 10835 |
slug: (0,external_lodash_namespaceObject.kebabCase)(title), |
| 10836 |
title, |
| 10837 |
content: '', |
| 10838 |
area |
| 10839 |
}); |
| 10840 |
const lastEntitySaveError = getLastEntitySaveError('postType', 'wp_template_part', templatePart.id); |
| 10841 |
|
| 10842 |
if (lastEntitySaveError) { |
| 10843 |
throw lastEntitySaveError; |
| 10844 |
} |
| 10845 |
|
| 10846 |
setIsModalOpen(false); // Navigate to the created template part editor. |
| 10847 |
|
| 10848 |
history.push({ |
| 10849 |
postId: templatePart.id, |
| 10850 |
postType: templatePart.type |
| 10851 |
}); // TODO: Add a success notice? |
| 10852 |
} catch (error) { |
| 10853 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); |
| 10854 |
createErrorNotice(errorMessage, { |
| 10855 |
type: 'snackbar' |
| 10856 |
}); |
| 10857 |
setIsModalOpen(false); |
| 10858 |
} |
| 10859 |
} |
| 10860 |
|
| 10861 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 10862 |
variant: "primary", |
| 10863 |
onClick: () => { |
| 10864 |
setIsModalOpen(true); |
| 10865 |
} |
| 10866 |
}, postType.labels.add_new), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { |
| 10867 |
closeModal: () => setIsModalOpen(false), |
| 10868 |
onCreate: createTemplatePart |
| 10869 |
})); |
| 10870 |
} |
| 10871 |
//# sourceMappingURL=new-template-part.js.map |
| 10872 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/add-new-template/index.js |
| 10873 |
|
| 10874 |
|
| 10875 |
/** |
| 10876 |
* WordPress dependencies |
| 10877 |
*/ |
| 10878 |
|
| 10879 |
|
| 10880 |
/** |
| 10881 |
* Internal dependencies |
| 10882 |
*/ |
| 10883 |
|
| 10884 |
|
| 10885 |
|
| 10886 |
function AddNewTemplate(_ref) { |
| 10887 |
let { |
| 10888 |
templateType = 'wp_template' |
| 10889 |
} = _ref; |
| 10890 |
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
| 10891 |
|
| 10892 |
if (!postType) { |
| 10893 |
return null; |
| 10894 |
} |
| 10895 |
|
| 10896 |
if (templateType === 'wp_template') { |
| 10897 |
return (0,external_wp_element_namespaceObject.createElement)(NewTemplate, { |
| 10898 |
postType: postType |
| 10899 |
}); |
| 10900 |
} else if (templateType === 'wp_template_part') { |
| 10901 |
return (0,external_wp_element_namespaceObject.createElement)(NewTemplatePart, { |
| 10902 |
postType: postType |
| 10903 |
}); |
| 10904 |
} |
| 10905 |
|
| 10906 |
return null; |
| 10907 |
} |
| 10908 |
//# sourceMappingURL=index.js.map |
| 10909 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/header.js |
| 10910 |
|
| 10911 |
|
| 10912 |
/** |
| 10913 |
* WordPress dependencies |
| 10914 |
*/ |
| 10915 |
|
| 10916 |
|
| 10917 |
|
| 10918 |
/** |
| 10919 |
* Internal dependencies |
| 10920 |
*/ |
| 10921 |
|
| 10922 |
|
| 10923 |
function header_Header(_ref) { |
| 10924 |
var _postType$labels; |
| 10925 |
|
| 10926 |
let { |
| 10927 |
templateType |
| 10928 |
} = _ref; |
| 10929 |
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
| 10930 |
|
| 10931 |
if (!postType) { |
| 10932 |
return null; |
| 10933 |
} |
| 10934 |
|
| 10935 |
return (0,external_wp_element_namespaceObject.createElement)("header", { |
| 10936 |
className: "edit-site-list-header" |
| 10937 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 10938 |
level: 1, |
| 10939 |
className: "edit-site-list-header__title" |
| 10940 |
}, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), (0,external_wp_element_namespaceObject.createElement)("div", { |
| 10941 |
className: "edit-site-list-header__right" |
| 10942 |
}, (0,external_wp_element_namespaceObject.createElement)(AddNewTemplate, { |
| 10943 |
templateType: templateType |
| 10944 |
}))); |
| 10945 |
} |
| 10946 |
//# sourceMappingURL=header.js.map |
| 10947 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/utils/is-template-removable.js |
| 10948 |
/** |
| 10949 |
* Check if a template is removable. |
| 10950 |
* |
| 10951 |
* @param {Object} template The template entity to check. |
| 10952 |
* @return {boolean} Whether the template is revertable. |
| 10953 |
*/ |
| 10954 |
function isTemplateRemovable(template) { |
| 10955 |
if (!template) { |
| 10956 |
return false; |
| 10957 |
} |
| 10958 |
|
| 10959 |
return template.source === 'custom' && !template.has_theme_file; |
| 10960 |
} |
| 10961 |
//# sourceMappingURL=is-template-removable.js.map |
| 10962 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/actions/rename-menu-item.js |
| 10963 |
|
| 10964 |
|
| 10965 |
/** |
| 10966 |
* WordPress dependencies |
| 10967 |
*/ |
| 10968 |
|
| 10969 |
|
| 10970 |
|
| 10971 |
|
| 10972 |
|
| 10973 |
|
| 10974 |
function RenameMenuItem(_ref) { |
| 10975 |
let { |
| 10976 |
template, |
| 10977 |
onClose |
| 10978 |
} = _ref; |
| 10979 |
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => template.title.rendered); |
| 10980 |
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
| 10981 |
const { |
| 10982 |
getLastEntitySaveError |
| 10983 |
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
| 10984 |
const { |
| 10985 |
editEntityRecord, |
| 10986 |
saveEditedEntityRecord |
| 10987 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 10988 |
const { |
| 10989 |
createSuccessNotice, |
| 10990 |
createErrorNotice |
| 10991 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 10992 |
|
| 10993 |
if (!template.is_custom) { |
| 10994 |
return null; |
| 10995 |
} |
| 10996 |
|
| 10997 |
async function onTemplateRename(event) { |
| 10998 |
event.preventDefault(); |
| 10999 |
|
| 11000 |
try { |
| 11001 |
await editEntityRecord('postType', template.type, template.id, { |
| 11002 |
title |
| 11003 |
}); // Update state before saving rerenders the list. |
| 11004 |
|
| 11005 |
setTitle(''); |
| 11006 |
setIsModalOpen(false); |
| 11007 |
onClose(); // Persist edited entity. |
| 11008 |
|
| 11009 |
await saveEditedEntityRecord('postType', template.type, template.id); |
| 11010 |
const lastError = getLastEntitySaveError('postType', template.type, template.id); |
| 11011 |
|
| 11012 |
if (lastError) { |
| 11013 |
throw lastError; |
| 11014 |
} |
| 11015 |
|
| 11016 |
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity renamed.'), { |
| 11017 |
type: 'snackbar' |
| 11018 |
}); |
| 11019 |
} catch (error) { |
| 11020 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the entity.'); |
| 11021 |
createErrorNotice(errorMessage, { |
| 11022 |
type: 'snackbar' |
| 11023 |
}); |
| 11024 |
} |
| 11025 |
} |
| 11026 |
|
| 11027 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 11028 |
onClick: () => { |
| 11029 |
setIsModalOpen(true); |
| 11030 |
setTitle(template.title.rendered); |
| 11031 |
} |
| 11032 |
}, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
| 11033 |
title: (0,external_wp_i18n_namespaceObject.__)('Rename'), |
| 11034 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
| 11035 |
onRequestClose: () => { |
| 11036 |
setIsModalOpen(false); |
| 11037 |
}, |
| 11038 |
overlayClassName: "edit-site-list__rename-modal" |
| 11039 |
}, (0,external_wp_element_namespaceObject.createElement)("form", { |
| 11040 |
onSubmit: onTemplateRename |
| 11041 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
| 11042 |
align: "flex-start", |
| 11043 |
gap: 8 |
| 11044 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
| 11045 |
label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
| 11046 |
value: title, |
| 11047 |
onChange: setTitle, |
| 11048 |
required: true |
| 11049 |
}))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
| 11050 |
className: "edit-site-list__rename-modal-actions", |
| 11051 |
justify: "flex-end", |
| 11052 |
expanded: false |
| 11053 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 11054 |
variant: "tertiary", |
| 11055 |
onClick: () => { |
| 11056 |
setIsModalOpen(false); |
| 11057 |
} |
| 11058 |
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
| 11059 |
variant: "primary", |
| 11060 |
type: "submit" |
| 11061 |
}, (0,external_wp_i18n_namespaceObject.__)('Save'))))))); |
| 11062 |
} |
| 11063 |
//# sourceMappingURL=rename-menu-item.js.map |
| 11064 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/actions/index.js |
| 11065 |
|
| 11066 |
|
| 11067 |
/** |
| 11068 |
* WordPress dependencies |
| 11069 |
*/ |
| 11070 |
|
| 11071 |
|
| 11072 |
|
| 11073 |
|
| 11074 |
|
| 11075 |
|
| 11076 |
/** |
| 11077 |
* Internal dependencies |
| 11078 |
*/ |
| 11079 |
|
| 11080 |
|
| 11081 |
|
| 11082 |
|
| 11083 |
|
| 11084 |
function Actions(_ref) { |
| 11085 |
let { |
| 11086 |
template |
| 11087 |
} = _ref; |
| 11088 |
const { |
| 11089 |
removeTemplate, |
| 11090 |
revertTemplate |
| 11091 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
| 11092 |
const { |
| 11093 |
saveEditedEntityRecord |
| 11094 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
| 11095 |
const { |
| 11096 |
createSuccessNotice, |
| 11097 |
createErrorNotice |
| 11098 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
| 11099 |
const isRemovable = isTemplateRemovable(template); |
| 11100 |
const isRevertable = isTemplateRevertable(template); |
| 11101 |
|
| 11102 |
if (!isRemovable && !isRevertable) { |
| 11103 |
return null; |
| 11104 |
} |
| 11105 |
|
| 11106 |
async function revertAndSaveTemplate() { |
| 11107 |
try { |
| 11108 |
await revertTemplate(template, { |
| 11109 |
allowUndo: false |
| 11110 |
}); |
| 11111 |
await saveEditedEntityRecord('postType', template.type, template.id); |
| 11112 |
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity reverted.'), { |
| 11113 |
type: 'snackbar' |
| 11114 |
}); |
| 11115 |
} catch (error) { |
| 11116 |
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the entity.'); |
| 11117 |
createErrorNotice(errorMessage, { |
| 11118 |
type: 'snackbar' |
| 11119 |
}); |
| 11120 |
} |
| 11121 |
} |
| 11122 |
|
| 11123 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
| 11124 |
icon: more_vertical, |
| 11125 |
label: (0,external_wp_i18n_namespaceObject.__)('Actions'), |
| 11126 |
className: "edit-site-list-table__actions" |
| 11127 |
}, _ref2 => { |
| 11128 |
let { |
| 11129 |
onClose |
| 11130 |
} = _ref2; |
| 11131 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRemovable && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(RenameMenuItem, { |
| 11132 |
template: template, |
| 11133 |
onClose: onClose |
| 11134 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 11135 |
isDestructive: true, |
| 11136 |
isTertiary: true, |
| 11137 |
onClick: () => { |
| 11138 |
removeTemplate(template); |
| 11139 |
onClose(); |
| 11140 |
} |
| 11141 |
}, (0,external_wp_i18n_namespaceObject.__)('Delete'))), isRevertable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
| 11142 |
info: (0,external_wp_i18n_namespaceObject.__)('Restore to default state'), |
| 11143 |
onClick: () => { |
| 11144 |
revertAndSaveTemplate(); |
| 11145 |
onClose(); |
| 11146 |
} |
| 11147 |
}, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))); |
| 11148 |
}); |
| 11149 |
} |
| 11150 |
//# sourceMappingURL=index.js.map |
| 11151 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/plugins.js |
| 11152 |
|
| 11153 |
|
| 11154 |
/** |
| 11155 |
* WordPress dependencies |
| 11156 |
*/ |
| 11157 |
|
| 11158 |
const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 11159 |
xmlns: "http://www.w3.org/2000/svg", |
| 11160 |
viewBox: "0 0 24 24" |
| 11161 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 11162 |
d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" |
| 11163 |
})); |
| 11164 |
/* harmony default export */ var library_plugins = (plugins); |
| 11165 |
//# sourceMappingURL=plugins.js.map |
| 11166 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/comment-author-avatar.js |
| 11167 |
|
| 11168 |
|
| 11169 |
/** |
| 11170 |
* WordPress dependencies |
| 11171 |
*/ |
| 11172 |
|
| 11173 |
const commentAuthorAvatar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 11174 |
xmlns: "http://www.w3.org/2000/svg", |
| 11175 |
viewBox: "0 0 24 24" |
| 11176 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 11177 |
fillRule: "evenodd", |
| 11178 |
d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", |
| 11179 |
clipRule: "evenodd" |
| 11180 |
})); |
| 11181 |
/* harmony default export */ var comment_author_avatar = (commentAuthorAvatar); |
| 11182 |
//# sourceMappingURL=comment-author-avatar.js.map |
| 11183 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/globe.js |
| 11184 |
|
| 11185 |
|
| 11186 |
/** |
| 11187 |
* WordPress dependencies |
| 11188 |
*/ |
| 11189 |
|
| 11190 |
const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
| 11191 |
xmlns: "http://www.w3.org/2000/svg", |
| 11192 |
viewBox: "0 0 24 24" |
| 11193 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
| 11194 |
d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" |
| 11195 |
})); |
| 11196 |
/* harmony default export */ var library_globe = (globe); |
| 11197 |
//# sourceMappingURL=globe.js.map |
| 11198 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/added-by.js |
| 11199 |
|
| 11200 |
|
| 11201 |
/** |
| 11202 |
* External dependencies |
| 11203 |
*/ |
| 11204 |
|
| 11205 |
/** |
| 11206 |
* WordPress dependencies |
| 11207 |
*/ |
| 11208 |
|
| 11209 |
|
| 11210 |
|
| 11211 |
|
| 11212 |
|
| 11213 |
|
| 11214 |
|
| 11215 |
const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part']; |
| 11216 |
|
| 11217 |
function CustomizedTooltip(_ref) { |
| 11218 |
let { |
| 11219 |
isCustomized, |
| 11220 |
children |
| 11221 |
} = _ref; |
| 11222 |
|
| 11223 |
if (!isCustomized) { |
| 11224 |
return children; |
| 11225 |
} |
| 11226 |
|
| 11227 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, { |
| 11228 |
text: (0,external_wp_i18n_namespaceObject.__)('This template has been customized') |
| 11229 |
}, children); |
| 11230 |
} |
| 11231 |
|
| 11232 |
function BaseAddedBy(_ref2) { |
| 11233 |
let { |
| 11234 |
text, |
| 11235 |
icon, |
| 11236 |
imageUrl, |
| 11237 |
isCustomized |
| 11238 |
} = _ref2; |
| 11239 |
const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); |
| 11240 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
| 11241 |
alignment: "left" |
| 11242 |
}, (0,external_wp_element_namespaceObject.createElement)(CustomizedTooltip, { |
| 11243 |
isCustomized: isCustomized |
| 11244 |
}, imageUrl ? (0,external_wp_element_namespaceObject.createElement)("div", { |
| 11245 |
className: classnames_default()('edit-site-list-added-by__avatar', { |
| 11246 |
'is-loaded': isImageLoaded |
| 11247 |
}) |
| 11248 |
}, (0,external_wp_element_namespaceObject.createElement)("img", { |
| 11249 |
onLoad: () => setIsImageLoaded(true), |
| 11250 |
alt: "", |
| 11251 |
src: imageUrl |
| 11252 |
})) : (0,external_wp_element_namespaceObject.createElement)("div", { |
| 11253 |
className: classnames_default()('edit-site-list-added-by__icon', { |
| 11254 |
'is-customized': isCustomized |
| 11255 |
}) |
| 11256 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
| 11257 |
icon: icon |
| 11258 |
}))), (0,external_wp_element_namespaceObject.createElement)("span", null, text)); |
| 11259 |
} |
| 11260 |
|
| 11261 |
function AddedByTheme(_ref3) { |
| 11262 |
var _theme$name; |
| 11263 |
|
| 11264 |
let { |
| 11265 |
slug, |
| 11266 |
isCustomized |
| 11267 |
} = _ref3; |
| 11268 |
const theme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTheme(slug), [slug]); |
| 11269 |
return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
| 11270 |
icon: library_layout, |
| 11271 |
text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug, |
| 11272 |
isCustomized: isCustomized |
| 11273 |
}); |
| 11274 |
} |
| 11275 |
|
| 11276 |
function AddedByPlugin(_ref4) { |
| 11277 |
let { |
| 11278 |
slug, |
| 11279 |
isCustomized |
| 11280 |
} = _ref4; |
| 11281 |
const plugin = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPlugin(slug), [slug]); |
| 11282 |
return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
| 11283 |
icon: library_plugins, |
| 11284 |
text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug, |
| 11285 |
isCustomized: isCustomized |
| 11286 |
}); |
| 11287 |
} |
| 11288 |
|
| 11289 |
function AddedByAuthor(_ref5) { |
| 11290 |
var _user$avatar_urls; |
| 11291 |
|
| 11292 |
let { |
| 11293 |
id |
| 11294 |
} = _ref5; |
| 11295 |
const user = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getUser(id), [id]); |
| 11296 |
return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
| 11297 |
icon: comment_author_avatar, |
| 11298 |
imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48], |
| 11299 |
text: user === null || user === void 0 ? void 0 : user.nickname |
| 11300 |
}); |
| 11301 |
} |
| 11302 |
|
| 11303 |
function AddedBySite() { |
| 11304 |
const { |
| 11305 |
name, |
| 11306 |
logoURL |
| 11307 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 11308 |
var _getMedia; |
| 11309 |
|
| 11310 |
const { |
| 11311 |
getEntityRecord, |
| 11312 |
getMedia |
| 11313 |
} = select(external_wp_coreData_namespaceObject.store); |
| 11314 |
const siteData = getEntityRecord('root', '__unstableBase'); |
| 11315 |
return { |
| 11316 |
name: siteData === null || siteData === void 0 ? void 0 : siteData.name, |
| 11317 |
logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined |
| 11318 |
}; |
| 11319 |
}, []); |
| 11320 |
return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
| 11321 |
icon: library_globe, |
| 11322 |
imageUrl: logoURL, |
| 11323 |
text: name |
| 11324 |
}); |
| 11325 |
} |
| 11326 |
|
| 11327 |
function AddedBy(_ref6) { |
| 11328 |
let { |
| 11329 |
templateType, |
| 11330 |
template |
| 11331 |
} = _ref6; |
| 11332 |
|
| 11333 |
if (!template) { |
| 11334 |
return; |
| 11335 |
} |
| 11336 |
|
| 11337 |
if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) { |
| 11338 |
// Template originally provided by a theme, but customized by a user. |
| 11339 |
// Templates originally didn't have the 'origin' field so identify |
| 11340 |
// older customized templates by checking for no origin and a 'theme' |
| 11341 |
// or 'custom' source. |
| 11342 |
if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) { |
| 11343 |
return (0,external_wp_element_namespaceObject.createElement)(AddedByTheme, { |
| 11344 |
slug: template.theme, |
| 11345 |
isCustomized: template.source === 'custom' |
| 11346 |
}); |
| 11347 |
} // Template originally provided by a plugin, but customized by a user. |
| 11348 |
|
| 11349 |
|
| 11350 |
if (template.has_theme_file && template.origin === 'plugin') { |
| 11351 |
return (0,external_wp_element_namespaceObject.createElement)(AddedByPlugin, { |
| 11352 |
slug: template.theme, |
| 11353 |
isCustomized: template.source === 'custom' |
| 11354 |
}); |
| 11355 |
} // Template was created from scratch, but has no author. Author support |
| 11356 |
// was only added to templates in WordPress 5.9. Fallback to showing the |
| 11357 |
// site logo and title. |
| 11358 |
|
| 11359 |
|
| 11360 |
if (!template.has_theme_file && template.source === 'custom' && !template.author) { |
| 11361 |
return (0,external_wp_element_namespaceObject.createElement)(AddedBySite, null); |
| 11362 |
} |
| 11363 |
} // Simply show the author for templates created from scratch that have an |
| 11364 |
// author or for any other post type. |
| 11365 |
|
| 11366 |
|
| 11367 |
return (0,external_wp_element_namespaceObject.createElement)(AddedByAuthor, { |
| 11368 |
id: template.author |
| 11369 |
}); |
| 11370 |
} |
| 11371 |
//# sourceMappingURL=added-by.js.map |
| 11372 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/table.js |
| 11373 |
|
| 11374 |
|
| 11375 |
/** |
| 11376 |
* WordPress dependencies |
| 11377 |
*/ |
| 11378 |
|
| 11379 |
|
| 11380 |
|
| 11381 |
|
| 11382 |
/** |
| 11383 |
* Internal dependencies |
| 11384 |
*/ |
| 11385 |
|
| 11386 |
|
| 11387 |
|
| 11388 |
|
| 11389 |
function Table(_ref) { |
| 11390 |
let { |
| 11391 |
templateType |
| 11392 |
} = _ref; |
| 11393 |
const { |
| 11394 |
templates, |
| 11395 |
isLoading, |
| 11396 |
postType |
| 11397 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 11398 |
const { |
| 11399 |
getEntityRecords, |
| 11400 |
hasFinishedResolution, |
| 11401 |
getPostType |
| 11402 |
} = select(external_wp_coreData_namespaceObject.store); |
| 11403 |
return { |
| 11404 |
templates: getEntityRecords('postType', templateType, { |
| 11405 |
per_page: -1 |
| 11406 |
}), |
| 11407 |
isLoading: !hasFinishedResolution('getEntityRecords', ['postType', templateType, { |
| 11408 |
per_page: -1 |
| 11409 |
}]), |
| 11410 |
postType: getPostType(templateType) |
| 11411 |
}; |
| 11412 |
}, [templateType]); |
| 11413 |
|
| 11414 |
if (!templates || isLoading) { |
| 11415 |
return null; |
| 11416 |
} |
| 11417 |
|
| 11418 |
if (!templates.length) { |
| 11419 |
var _postType$labels, _postType$labels$name; |
| 11420 |
|
| 11421 |
return (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_i18n_namespaceObject.sprintf)( // translators: The template type name, should be either "templates" or "template parts". |
| 11422 |
(0,external_wp_i18n_namespaceObject.__)('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase())); |
| 11423 |
} |
| 11424 |
|
| 11425 |
return (// These explicit aria roles are needed for Safari. |
| 11426 |
// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables |
| 11427 |
(0,external_wp_element_namespaceObject.createElement)("table", { |
| 11428 |
className: "edit-site-list-table", |
| 11429 |
role: "table" |
| 11430 |
}, (0,external_wp_element_namespaceObject.createElement)("thead", null, (0,external_wp_element_namespaceObject.createElement)("tr", { |
| 11431 |
className: "edit-site-list-table-head", |
| 11432 |
role: "row" |
| 11433 |
}, (0,external_wp_element_namespaceObject.createElement)("th", { |
| 11434 |
className: "edit-site-list-table-column", |
| 11435 |
role: "columnheader" |
| 11436 |
}, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)("th", { |
| 11437 |
className: "edit-site-list-table-column", |
| 11438 |
role: "columnheader" |
| 11439 |
}, (0,external_wp_i18n_namespaceObject.__)('Added by')), (0,external_wp_element_namespaceObject.createElement)("th", { |
| 11440 |
className: "edit-site-list-table-column", |
| 11441 |
role: "columnheader" |
| 11442 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Actions'))))), (0,external_wp_element_namespaceObject.createElement)("tbody", null, templates.map(template => { |
| 11443 |
var _template$title; |
| 11444 |
|
| 11445 |
return (0,external_wp_element_namespaceObject.createElement)("tr", { |
| 11446 |
key: template.id, |
| 11447 |
className: "edit-site-list-table-row", |
| 11448 |
role: "row" |
| 11449 |
}, (0,external_wp_element_namespaceObject.createElement)("td", { |
| 11450 |
className: "edit-site-list-table-column", |
| 11451 |
role: "cell" |
| 11452 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
| 11453 |
level: 4 |
| 11454 |
}, (0,external_wp_element_namespaceObject.createElement)(Link, { |
| 11455 |
params: { |
| 11456 |
postId: template.id, |
| 11457 |
postType: template.type |
| 11458 |
} |
| 11459 |
}, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), (0,external_wp_element_namespaceObject.createElement)("td", { |
| 11460 |
className: "edit-site-list-table-column", |
| 11461 |
role: "cell" |
| 11462 |
}, (0,external_wp_element_namespaceObject.createElement)(AddedBy, { |
| 11463 |
templateType: templateType, |
| 11464 |
template: template |
| 11465 |
})), (0,external_wp_element_namespaceObject.createElement)("td", { |
| 11466 |
className: "edit-site-list-table-column", |
| 11467 |
role: "cell" |
| 11468 |
}, (0,external_wp_element_namespaceObject.createElement)(Actions, { |
| 11469 |
template: template |
| 11470 |
}))); |
| 11471 |
}))) |
| 11472 |
); |
| 11473 |
} |
| 11474 |
//# sourceMappingURL=table.js.map |
| 11475 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/list/index.js |
| 11476 |
|
| 11477 |
|
| 11478 |
/** |
| 11479 |
* External dependencies |
| 11480 |
*/ |
| 11481 |
|
| 11482 |
/** |
| 11483 |
* WordPress dependencies |
| 11484 |
*/ |
| 11485 |
|
| 11486 |
|
| 11487 |
|
| 11488 |
|
| 11489 |
|
| 11490 |
|
| 11491 |
|
| 11492 |
/** |
| 11493 |
* Internal dependencies |
| 11494 |
*/ |
| 11495 |
|
| 11496 |
|
| 11497 |
|
| 11498 |
|
| 11499 |
|
| 11500 |
|
| 11501 |
|
| 11502 |
|
| 11503 |
function List() { |
| 11504 |
var _postType$labels, _postType$labels2; |
| 11505 |
|
| 11506 |
const { |
| 11507 |
params: { |
| 11508 |
postType: templateType |
| 11509 |
} |
| 11510 |
} = useLocation(); |
| 11511 |
useRegisterShortcuts(); |
| 11512 |
const { |
| 11513 |
previousShortcut, |
| 11514 |
nextShortcut, |
| 11515 |
isNavigationOpen |
| 11516 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
| 11517 |
return { |
| 11518 |
previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), |
| 11519 |
nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), |
| 11520 |
isNavigationOpen: select(store_store).isNavigationOpened() |
| 11521 |
}; |
| 11522 |
}, []); |
| 11523 |
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
| 11524 |
useTitle(postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name); // `postType` could load in asynchronously. Only provide the detailed region labels if |
| 11525 |
// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults. |
| 11526 |
|
| 11527 |
const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list; |
| 11528 |
const detailedRegionLabels = postType ? { |
| 11529 |
header: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page. |
| 11530 |
(0,external_wp_i18n_namespaceObject.__)('%s - Header'), itemsListLabel), |
| 11531 |
body: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Content' as in the content area of that page. |
| 11532 |
(0,external_wp_i18n_namespaceObject.__)('%s - Content'), itemsListLabel) |
| 11533 |
} : undefined; |
| 11534 |
return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { |
| 11535 |
className: classnames_default()('edit-site-list', { |
| 11536 |
'is-navigation-open': isNavigationOpen |
| 11537 |
}), |
| 11538 |
labels: { |
| 11539 |
drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar'), |
| 11540 |
...detailedRegionLabels |
| 11541 |
}, |
| 11542 |
header: (0,external_wp_element_namespaceObject.createElement)(header_Header, { |
| 11543 |
templateType: templateType |
| 11544 |
}), |
| 11545 |
drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), |
| 11546 |
notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), |
| 11547 |
content: (0,external_wp_element_namespaceObject.createElement)(Table, { |
| 11548 |
templateType: templateType |
| 11549 |
}), |
| 11550 |
shortcuts: { |
| 11551 |
previous: previousShortcut, |
| 11552 |
next: nextShortcut |
| 11553 |
} |
| 11554 |
}); |
| 11555 |
} |
| 11556 |
//# sourceMappingURL=index.js.map |
| 11557 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/utils/get-is-list-page.js |
| 11558 |
/** |
| 11559 |
* Returns if the params match the list page route. |
| 11560 |
* |
| 11561 |
* @param {Object} params The search params. |
| 11562 |
* @param {string} params.postId The post ID. |
| 11563 |
* @param {string} params.postType The post type. |
| 11564 |
* @return {boolean} Is list page or not. |
| 11565 |
*/ |
| 11566 |
function getIsListPage(_ref) { |
| 11567 |
let { |
| 11568 |
postId, |
| 11569 |
postType |
| 11570 |
} = _ref; |
| 11571 |
return !!(!postId && postType); |
| 11572 |
} |
| 11573 |
//# sourceMappingURL=get-is-list-page.js.map |
| 11574 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/app/index.js |
| 11575 |
|
| 11576 |
|
| 11577 |
/** |
| 11578 |
* WordPress dependencies |
| 11579 |
*/ |
| 11580 |
|
| 11581 |
|
| 11582 |
/** |
| 11583 |
* Internal dependencies |
| 11584 |
*/ |
| 11585 |
|
| 11586 |
|
| 11587 |
|
| 11588 |
|
| 11589 |
|
| 11590 |
|
| 11591 |
function EditSiteApp(_ref) { |
| 11592 |
let { |
| 11593 |
reboot |
| 11594 |
} = _ref; |
| 11595 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(Routes, null, _ref2 => { |
| 11596 |
let { |
| 11597 |
params |
| 11598 |
} = _ref2; |
| 11599 |
const isListPage = getIsListPage(params); |
| 11600 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage ? (0,external_wp_element_namespaceObject.createElement)(List, null) : (0,external_wp_element_namespaceObject.createElement)(editor, { |
| 11601 |
onError: reboot |
| 11602 |
}), (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar // Open the navigation sidebar by default when in the list page. |
| 11603 |
, { |
| 11604 |
isDefaultOpen: !!isListPage, |
| 11605 |
activeTemplateType: isListPage ? params.postType : undefined |
| 11606 |
})); |
| 11607 |
})); |
| 11608 |
} |
| 11609 |
//# sourceMappingURL=index.js.map |
| 11610 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/routes/redirect-to-homepage.js |
| 11611 |
/** |
| 11612 |
* WordPress dependencies |
| 11613 |
*/ |
| 11614 |
|
| 11615 |
|
| 11616 |
/** |
| 11617 |
* Internal dependencies |
| 11618 |
*/ |
| 11619 |
|
| 11620 |
|
| 11621 |
|
| 11622 |
|
| 11623 |
function getNeedsHomepageRedirect(params) { |
| 11624 |
const { |
| 11625 |
postType |
| 11626 |
} = params; |
| 11627 |
return !getIsListPage(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType); |
| 11628 |
} |
| 11629 |
|
| 11630 |
async function getHomepageParams(siteUrl) { |
| 11631 |
const siteSettings = await external_wp_apiFetch_default()({ |
| 11632 |
path: '/wp/v2/settings' |
| 11633 |
}); |
| 11634 |
|
| 11635 |
if (!siteSettings) { |
| 11636 |
return; |
| 11637 |
} |
| 11638 |
|
| 11639 |
const { |
| 11640 |
show_on_front: showOnFront, |
| 11641 |
page_on_front: frontpageId |
| 11642 |
} = siteSettings; // If the user has set a page as the homepage, use those details. |
| 11643 |
|
| 11644 |
if (showOnFront === 'page') { |
| 11645 |
return { |
| 11646 |
postType: 'page', |
| 11647 |
postId: frontpageId |
| 11648 |
}; |
| 11649 |
} // Else get the home template. |
| 11650 |
// This matches the logic in `__experimentalGetTemplateForLink`. |
| 11651 |
// (packages/core-data/src/resolvers.js) |
| 11652 |
|
| 11653 |
|
| 11654 |
const template = await window.fetch((0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, { |
| 11655 |
'_wp-find-template': true |
| 11656 |
})).then(res => res.json()).then(_ref => { |
| 11657 |
let { |
| 11658 |
data |
| 11659 |
} = _ref; |
| 11660 |
return data; |
| 11661 |
}); |
| 11662 |
|
| 11663 |
if (!(template !== null && template !== void 0 && template.id)) { |
| 11664 |
return; |
| 11665 |
} |
| 11666 |
|
| 11667 |
return { |
| 11668 |
postType: 'wp_template', |
| 11669 |
postId: template.id |
| 11670 |
}; |
| 11671 |
} |
| 11672 |
|
| 11673 |
async function redirectToHomepage(siteUrl) { |
| 11674 |
const searchParams = new URLSearchParams(utils_history.location.search); |
| 11675 |
const params = Object.fromEntries(searchParams.entries()); |
| 11676 |
|
| 11677 |
if (getNeedsHomepageRedirect(params)) { |
| 11678 |
const homepageParams = await getHomepageParams(siteUrl); |
| 11679 |
|
| 11680 |
if (homepageParams) { |
| 11681 |
utils_history.replace(homepageParams); |
| 11682 |
} |
| 11683 |
} |
| 11684 |
} |
| 11685 |
//# sourceMappingURL=redirect-to-homepage.js.map |
| 11686 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/sidebar/plugin-sidebar/index.js |
| 11687 |
|
| 11688 |
|
| 11689 |
|
| 11690 |
/** |
| 11691 |
* WordPress dependencies |
| 11692 |
*/ |
| 11693 |
|
| 11694 |
/** |
| 11695 |
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. |
| 11696 |
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. |
| 11697 |
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: |
| 11698 |
* |
| 11699 |
* ```js |
| 11700 |
* wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); |
| 11701 |
* ``` |
| 11702 |
* |
| 11703 |
* @see PluginSidebarMoreMenuItem |
| 11704 |
* |
| 11705 |
* @param {Object} props Element props. |
| 11706 |
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. |
| 11707 |
* @param {string} [props.className] An optional class name added to the sidebar body. |
| 11708 |
* @param {string} props.title Title displayed at the top of the sidebar. |
| 11709 |
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. |
| 11710 |
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. |
| 11711 |
* |
| 11712 |
* @example |
| 11713 |
* ```js |
| 11714 |
* // Using ES5 syntax |
| 11715 |
* var __ = wp.i18n.__; |
| 11716 |
* var el = wp.element.createElement; |
| 11717 |
* var PanelBody = wp.components.PanelBody; |
| 11718 |
* var PluginSidebar = wp.editSite.PluginSidebar; |
| 11719 |
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
| 11720 |
* |
| 11721 |
* function MyPluginSidebar() { |
| 11722 |
* return el( |
| 11723 |
* PluginSidebar, |
| 11724 |
* { |
| 11725 |
* name: 'my-sidebar', |
| 11726 |
* title: 'My sidebar title', |
| 11727 |
* icon: moreIcon, |
| 11728 |
* }, |
| 11729 |
* el( |
| 11730 |
* PanelBody, |
| 11731 |
* {}, |
| 11732 |
* __( 'My sidebar content' ) |
| 11733 |
* ) |
| 11734 |
* ); |
| 11735 |
* } |
| 11736 |
* ``` |
| 11737 |
* |
| 11738 |
* @example |
| 11739 |
* ```jsx |
| 11740 |
* // Using ESNext syntax |
| 11741 |
* import { __ } from '@wordpress/i18n'; |
| 11742 |
* import { PanelBody } from '@wordpress/components'; |
| 11743 |
* import { PluginSidebar } from '@wordpress/edit-site'; |
| 11744 |
* import { more } from '@wordpress/icons'; |
| 11745 |
* |
| 11746 |
* const MyPluginSidebar = () => ( |
| 11747 |
* <PluginSidebar |
| 11748 |
* name="my-sidebar" |
| 11749 |
* title="My sidebar title" |
| 11750 |
* icon={ more } |
| 11751 |
* > |
| 11752 |
* <PanelBody> |
| 11753 |
* { __( 'My sidebar content' ) } |
| 11754 |
* </PanelBody> |
| 11755 |
* </PluginSidebar> |
| 11756 |
* ); |
| 11757 |
* ``` |
| 11758 |
*/ |
| 11759 |
|
| 11760 |
function PluginSidebarEditSite(_ref) { |
| 11761 |
let { |
| 11762 |
className, |
| 11763 |
...props |
| 11764 |
} = _ref; |
| 11765 |
return (0,external_wp_element_namespaceObject.createElement)(complementary_area, extends_extends({ |
| 11766 |
panelClassName: className, |
| 11767 |
className: "edit-site-sidebar", |
| 11768 |
scope: "core/edit-site" |
| 11769 |
}, props)); |
| 11770 |
} |
| 11771 |
//# sourceMappingURL=index.js.map |
| 11772 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/plugin-sidebar-more-menu-item/index.js |
| 11773 |
|
| 11774 |
|
| 11775 |
|
| 11776 |
/** |
| 11777 |
* WordPress dependencies |
| 11778 |
*/ |
| 11779 |
|
| 11780 |
/** |
| 11781 |
* Renders a menu item in `Plugins` group in `More Menu` drop down, |
| 11782 |
* and can be used to activate the corresponding `PluginSidebar` component. |
| 11783 |
* The text within the component appears as the menu item label. |
| 11784 |
* |
| 11785 |
* @param {Object} props Component props. |
| 11786 |
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. |
| 11787 |
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. |
| 11788 |
* |
| 11789 |
* @example |
| 11790 |
* ```js |
| 11791 |
* // Using ES5 syntax |
| 11792 |
* var __ = wp.i18n.__; |
| 11793 |
* var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem; |
| 11794 |
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
| 11795 |
* |
| 11796 |
* function MySidebarMoreMenuItem() { |
| 11797 |
* return wp.element.createElement( |
| 11798 |
* PluginSidebarMoreMenuItem, |
| 11799 |
* { |
| 11800 |
* target: 'my-sidebar', |
| 11801 |
* icon: moreIcon, |
| 11802 |
* }, |
| 11803 |
* __( 'My sidebar title' ) |
| 11804 |
* ) |
| 11805 |
* } |
| 11806 |
* ``` |
| 11807 |
* |
| 11808 |
* @example |
| 11809 |
* ```jsx |
| 11810 |
* // Using ESNext syntax |
| 11811 |
* import { __ } from '@wordpress/i18n'; |
| 11812 |
* import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site'; |
| 11813 |
* import { more } from '@wordpress/icons'; |
| 11814 |
* |
| 11815 |
* const MySidebarMoreMenuItem = () => ( |
| 11816 |
* <PluginSidebarMoreMenuItem |
| 11817 |
* target="my-sidebar" |
| 11818 |
* icon={ more } |
| 11819 |
* > |
| 11820 |
* { __( 'My sidebar title' ) } |
| 11821 |
* </PluginSidebarMoreMenuItem> |
| 11822 |
* ); |
| 11823 |
* ``` |
| 11824 |
* |
| 11825 |
* @return {WPComponent} The component to be rendered. |
| 11826 |
*/ |
| 11827 |
|
| 11828 |
function PluginSidebarMoreMenuItem(props) { |
| 11829 |
return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. |
| 11830 |
// @see https://github.com/WordPress/gutenberg/issues/14457 |
| 11831 |
, extends_extends({ |
| 11832 |
__unstableExplicitMenuItem: true, |
| 11833 |
scope: "core/edit-site" |
| 11834 |
}, props)); |
| 11835 |
} |
| 11836 |
//# sourceMappingURL=index.js.map |
| 11837 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/components/header/plugin-more-menu-item/index.js |
| 11838 |
/** |
| 11839 |
* WordPress dependencies |
| 11840 |
*/ |
| 11841 |
|
| 11842 |
|
| 11843 |
|
| 11844 |
/** |
| 11845 |
* Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. |
| 11846 |
* The text within the component appears as the menu item label. |
| 11847 |
* |
| 11848 |
* @param {Object} props Component properties. |
| 11849 |
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. |
| 11850 |
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. |
| 11851 |
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. |
| 11852 |
* @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. |
| 11853 |
* |
| 11854 |
* @example |
| 11855 |
* ```js |
| 11856 |
* // Using ES5 syntax |
| 11857 |
* var __ = wp.i18n.__; |
| 11858 |
* var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem; |
| 11859 |
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
| 11860 |
* |
| 11861 |
* function onButtonClick() { |
| 11862 |
* alert( 'Button clicked.' ); |
| 11863 |
* } |
| 11864 |
* |
| 11865 |
* function MyButtonMoreMenuItem() { |
| 11866 |
* return wp.element.createElement( |
| 11867 |
* PluginMoreMenuItem, |
| 11868 |
* { |
| 11869 |
* icon: moreIcon, |
| 11870 |
* onClick: onButtonClick, |
| 11871 |
* }, |
| 11872 |
* __( 'My button title' ) |
| 11873 |
* ); |
| 11874 |
* } |
| 11875 |
* ``` |
| 11876 |
* |
| 11877 |
* @example |
| 11878 |
* ```jsx |
| 11879 |
* // Using ESNext syntax |
| 11880 |
* import { __ } from '@wordpress/i18n'; |
| 11881 |
* import { PluginMoreMenuItem } from '@wordpress/edit-site'; |
| 11882 |
* import { more } from '@wordpress/icons'; |
| 11883 |
* |
| 11884 |
* function onButtonClick() { |
| 11885 |
* alert( 'Button clicked.' ); |
| 11886 |
* } |
| 11887 |
* |
| 11888 |
* const MyButtonMoreMenuItem = () => ( |
| 11889 |
* <PluginMoreMenuItem |
| 11890 |
* icon={ more } |
| 11891 |
* onClick={ onButtonClick } |
| 11892 |
* > |
| 11893 |
* { __( 'My button title' ) } |
| 11894 |
* </PluginMoreMenuItem> |
| 11895 |
* ); |
| 11896 |
* ``` |
| 11897 |
* |
| 11898 |
* @return {WPComponent} The component to be rendered. |
| 11899 |
*/ |
| 11900 |
|
| 11901 |
/* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
| 11902 |
return { |
| 11903 |
icon: ownProps.icon || context.icon, |
| 11904 |
name: 'core/edit-site/plugin-more-menu' |
| 11905 |
}; |
| 11906 |
}))(action_item)); |
| 11907 |
//# sourceMappingURL=index.js.map |
| 11908 |
;// CONCATENATED MODULE: ./packages/edit-site/build-module/index.js |
| 11909 |
|
| 11910 |
|
| 11911 |
/** |
| 11912 |
* WordPress dependencies |
| 11913 |
*/ |
| 11914 |
|
| 11915 |
|
| 11916 |
|
| 11917 |
|
| 11918 |
|
| 11919 |
|
| 11920 |
|
| 11921 |
|
| 11922 |
/** |
| 11923 |
* Internal dependencies |
| 11924 |
*/ |
| 11925 |
|
| 11926 |
|
| 11927 |
|
| 11928 |
|
| 11929 |
|
| 11930 |
|
| 11931 |
/** |
| 11932 |
* Reinitializes the editor after the user chooses to reboot the editor after |
| 11933 |
* an unhandled error occurs, replacing previously mounted editor element using |
| 11934 |
* an initial state from prior to the crash. |
| 11935 |
* |
| 11936 |
* @param {Element} target DOM node in which editor is rendered. |
| 11937 |
* @param {?Object} settings Editor settings object. |
| 11938 |
*/ |
| 11939 |
|
| 11940 |
async function reinitializeEditor(target, settings) { |
| 11941 |
// The site editor relies on `postType` and `postId` params in the URL to |
| 11942 |
// define what's being edited. When visiting via the dashboard link, these |
| 11943 |
// won't be present. Do a client side redirect to the 'homepage' if that's |
| 11944 |
// the case. |
| 11945 |
await redirectToHomepage(settings.siteUrl); // This will be a no-op if the target doesn't have any React nodes. |
| 11946 |
|
| 11947 |
(0,external_wp_element_namespaceObject.unmountComponentAtNode)(target); |
| 11948 |
const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering |
| 11949 |
// so that we won't trigger unnecessary re-renders with useEffect. |
| 11950 |
|
| 11951 |
{ |
| 11952 |
(0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too, |
| 11953 |
// so that they can be selected with core/editor selectors in any editor. |
| 11954 |
// This is needed because edit-site doesn't initialize with EditorProvider, |
| 11955 |
// which internally uses updateEditorSettings as well. |
| 11956 |
|
| 11957 |
(0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({ |
| 11958 |
defaultTemplateTypes: settings.defaultTemplateTypes, |
| 11959 |
defaultTemplatePartAreas: settings.defaultTemplatePartAreas |
| 11960 |
}); |
| 11961 |
const isLandingOnListPage = getIsListPage((0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href)); |
| 11962 |
|
| 11963 |
if (isLandingOnListPage) { |
| 11964 |
// Default the navigation panel to be opened when we're in a bigger |
| 11965 |
// screen and land in the list screen. |
| 11966 |
(0,external_wp_data_namespaceObject.dispatch)(store_store).setIsNavigationPanelOpened((0,external_wp_data_namespaceObject.select)(external_wp_viewport_namespaceObject.store).isViewportMatch('medium')); |
| 11967 |
} |
| 11968 |
} |
| 11969 |
(0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(EditSiteApp, { |
| 11970 |
reboot: reboot |
| 11971 |
}), target); |
| 11972 |
} |
| 11973 |
/** |
| 11974 |
* Initializes the site editor screen. |
| 11975 |
* |
| 11976 |
* @param {string} id ID of the root element to render the screen in. |
| 11977 |
* @param {Object} settings Editor settings. |
| 11978 |
*/ |
| 11979 |
|
| 11980 |
function initializeEditor(id, settings) { |
| 11981 |
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); |
| 11982 |
|
| 11983 |
settings.__experimentalFetchRichUrlData = external_wp_coreData_namespaceObject.__experimentalFetchUrlData; |
| 11984 |
settings.__experimentalSpotlightEntityBlocks = ['core/template-part']; |
| 11985 |
const target = document.getElementById(id); |
| 11986 |
|
| 11987 |
(0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); |
| 11988 |
|
| 11989 |
(0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); |
| 11990 |
|
| 11991 |
if (true) { |
| 11992 |
(0,external_wp_blockLibrary_namespaceObject.__experimentalRegisterExperimentalCoreBlocks)({ |
| 11993 |
enableFSEBlocks: true |
| 11994 |
}); |
| 11995 |
} |
| 11996 |
|
| 11997 |
reinitializeEditor(target, settings); |
| 11998 |
} |
| 11999 |
|
| 12000 |
|
| 12001 |
|
| 12002 |
|
| 12003 |
|
| 12004 |
//# sourceMappingURL=index.js.map |
| 12005 |
}(); |
| 12006 |
(window.wp = window.wp || {}).editSite = __webpack_exports__; |
| 12007 |
/******/ })() |
| 12008 |
; |