|
1 /******/ (function() { // webpackBootstrap |
|
2 /******/ var __webpack_modules__ = ({ |
|
3 |
|
4 /***/ 6411: |
|
5 /***/ (function(module, exports) { |
|
6 |
|
7 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
8 autosize 4.0.4 |
|
9 license: MIT |
|
10 http://www.jacklmoore.com/autosize |
|
11 */ |
|
12 (function (global, factory) { |
|
13 if (true) { |
|
14 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), |
|
15 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? |
|
16 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), |
|
17 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
18 } else { var mod; } |
|
19 })(this, function (module, exports) { |
|
20 'use strict'; |
|
21 |
|
22 var map = typeof Map === "function" ? new Map() : function () { |
|
23 var keys = []; |
|
24 var values = []; |
|
25 |
|
26 return { |
|
27 has: function has(key) { |
|
28 return keys.indexOf(key) > -1; |
|
29 }, |
|
30 get: function get(key) { |
|
31 return values[keys.indexOf(key)]; |
|
32 }, |
|
33 set: function set(key, value) { |
|
34 if (keys.indexOf(key) === -1) { |
|
35 keys.push(key); |
|
36 values.push(value); |
|
37 } |
|
38 }, |
|
39 delete: function _delete(key) { |
|
40 var index = keys.indexOf(key); |
|
41 if (index > -1) { |
|
42 keys.splice(index, 1); |
|
43 values.splice(index, 1); |
|
44 } |
|
45 } |
|
46 }; |
|
47 }(); |
|
48 |
|
49 var createEvent = function createEvent(name) { |
|
50 return new Event(name, { bubbles: true }); |
|
51 }; |
|
52 try { |
|
53 new Event('test'); |
|
54 } catch (e) { |
|
55 // IE does not support `new Event()` |
|
56 createEvent = function createEvent(name) { |
|
57 var evt = document.createEvent('Event'); |
|
58 evt.initEvent(name, true, false); |
|
59 return evt; |
|
60 }; |
|
61 } |
|
62 |
|
63 function assign(ta) { |
|
64 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; |
|
65 |
|
66 var heightOffset = null; |
|
67 var clientWidth = null; |
|
68 var cachedHeight = null; |
|
69 |
|
70 function init() { |
|
71 var style = window.getComputedStyle(ta, null); |
|
72 |
|
73 if (style.resize === 'vertical') { |
|
74 ta.style.resize = 'none'; |
|
75 } else if (style.resize === 'both') { |
|
76 ta.style.resize = 'horizontal'; |
|
77 } |
|
78 |
|
79 if (style.boxSizing === 'content-box') { |
|
80 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); |
|
81 } else { |
|
82 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); |
|
83 } |
|
84 // Fix when a textarea is not on document body and heightOffset is Not a Number |
|
85 if (isNaN(heightOffset)) { |
|
86 heightOffset = 0; |
|
87 } |
|
88 |
|
89 update(); |
|
90 } |
|
91 |
|
92 function changeOverflow(value) { |
|
93 { |
|
94 // Chrome/Safari-specific fix: |
|
95 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space |
|
96 // made available by removing the scrollbar. The following forces the necessary text reflow. |
|
97 var width = ta.style.width; |
|
98 ta.style.width = '0px'; |
|
99 // Force reflow: |
|
100 /* jshint ignore:start */ |
|
101 ta.offsetWidth; |
|
102 /* jshint ignore:end */ |
|
103 ta.style.width = width; |
|
104 } |
|
105 |
|
106 ta.style.overflowY = value; |
|
107 } |
|
108 |
|
109 function getParentOverflows(el) { |
|
110 var arr = []; |
|
111 |
|
112 while (el && el.parentNode && el.parentNode instanceof Element) { |
|
113 if (el.parentNode.scrollTop) { |
|
114 arr.push({ |
|
115 node: el.parentNode, |
|
116 scrollTop: el.parentNode.scrollTop |
|
117 }); |
|
118 } |
|
119 el = el.parentNode; |
|
120 } |
|
121 |
|
122 return arr; |
|
123 } |
|
124 |
|
125 function resize() { |
|
126 if (ta.scrollHeight === 0) { |
|
127 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. |
|
128 return; |
|
129 } |
|
130 |
|
131 var overflows = getParentOverflows(ta); |
|
132 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) |
|
133 |
|
134 ta.style.height = ''; |
|
135 ta.style.height = ta.scrollHeight + heightOffset + 'px'; |
|
136 |
|
137 // used to check if an update is actually necessary on window.resize |
|
138 clientWidth = ta.clientWidth; |
|
139 |
|
140 // prevents scroll-position jumping |
|
141 overflows.forEach(function (el) { |
|
142 el.node.scrollTop = el.scrollTop; |
|
143 }); |
|
144 |
|
145 if (docTop) { |
|
146 document.documentElement.scrollTop = docTop; |
|
147 } |
|
148 } |
|
149 |
|
150 function update() { |
|
151 resize(); |
|
152 |
|
153 var styleHeight = Math.round(parseFloat(ta.style.height)); |
|
154 var computed = window.getComputedStyle(ta, null); |
|
155 |
|
156 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box |
|
157 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; |
|
158 |
|
159 // The actual height not matching the style height (set via the resize method) indicates that |
|
160 // the max-height has been exceeded, in which case the overflow should be allowed. |
|
161 if (actualHeight < styleHeight) { |
|
162 if (computed.overflowY === 'hidden') { |
|
163 changeOverflow('scroll'); |
|
164 resize(); |
|
165 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
166 } |
|
167 } else { |
|
168 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. |
|
169 if (computed.overflowY !== 'hidden') { |
|
170 changeOverflow('hidden'); |
|
171 resize(); |
|
172 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
173 } |
|
174 } |
|
175 |
|
176 if (cachedHeight !== actualHeight) { |
|
177 cachedHeight = actualHeight; |
|
178 var evt = createEvent('autosize:resized'); |
|
179 try { |
|
180 ta.dispatchEvent(evt); |
|
181 } catch (err) { |
|
182 // Firefox will throw an error on dispatchEvent for a detached element |
|
183 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 |
|
184 } |
|
185 } |
|
186 } |
|
187 |
|
188 var pageResize = function pageResize() { |
|
189 if (ta.clientWidth !== clientWidth) { |
|
190 update(); |
|
191 } |
|
192 }; |
|
193 |
|
194 var destroy = function (style) { |
|
195 window.removeEventListener('resize', pageResize, false); |
|
196 ta.removeEventListener('input', update, false); |
|
197 ta.removeEventListener('keyup', update, false); |
|
198 ta.removeEventListener('autosize:destroy', destroy, false); |
|
199 ta.removeEventListener('autosize:update', update, false); |
|
200 |
|
201 Object.keys(style).forEach(function (key) { |
|
202 ta.style[key] = style[key]; |
|
203 }); |
|
204 |
|
205 map.delete(ta); |
|
206 }.bind(ta, { |
|
207 height: ta.style.height, |
|
208 resize: ta.style.resize, |
|
209 overflowY: ta.style.overflowY, |
|
210 overflowX: ta.style.overflowX, |
|
211 wordWrap: ta.style.wordWrap |
|
212 }); |
|
213 |
|
214 ta.addEventListener('autosize:destroy', destroy, false); |
|
215 |
|
216 // IE9 does not fire onpropertychange or oninput for deletions, |
|
217 // so binding to onkeyup to catch most of those events. |
|
218 // There is no way that I know of to detect something like 'cut' in IE9. |
|
219 if ('onpropertychange' in ta && 'oninput' in ta) { |
|
220 ta.addEventListener('keyup', update, false); |
|
221 } |
|
222 |
|
223 window.addEventListener('resize', pageResize, false); |
|
224 ta.addEventListener('input', update, false); |
|
225 ta.addEventListener('autosize:update', update, false); |
|
226 ta.style.overflowX = 'hidden'; |
|
227 ta.style.wordWrap = 'break-word'; |
|
228 |
|
229 map.set(ta, { |
|
230 destroy: destroy, |
|
231 update: update |
|
232 }); |
|
233 |
|
234 init(); |
|
235 } |
|
236 |
|
237 function destroy(ta) { |
|
238 var methods = map.get(ta); |
|
239 if (methods) { |
|
240 methods.destroy(); |
|
241 } |
|
242 } |
|
243 |
|
244 function update(ta) { |
|
245 var methods = map.get(ta); |
|
246 if (methods) { |
|
247 methods.update(); |
|
248 } |
|
249 } |
|
250 |
|
251 var autosize = null; |
|
252 |
|
253 // Do nothing in Node.js environment and IE8 (or lower) |
|
254 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { |
|
255 autosize = function autosize(el) { |
|
256 return el; |
|
257 }; |
|
258 autosize.destroy = function (el) { |
|
259 return el; |
|
260 }; |
|
261 autosize.update = function (el) { |
|
262 return el; |
|
263 }; |
|
264 } else { |
|
265 autosize = function autosize(el, options) { |
|
266 if (el) { |
|
267 Array.prototype.forEach.call(el.length ? el : [el], function (x) { |
|
268 return assign(x, options); |
|
269 }); |
|
270 } |
|
271 return el; |
|
272 }; |
|
273 autosize.destroy = function (el) { |
|
274 if (el) { |
|
275 Array.prototype.forEach.call(el.length ? el : [el], destroy); |
|
276 } |
|
277 return el; |
|
278 }; |
|
279 autosize.update = function (el) { |
|
280 if (el) { |
|
281 Array.prototype.forEach.call(el.length ? el : [el], update); |
|
282 } |
|
283 return el; |
|
284 }; |
|
285 } |
|
286 |
|
287 exports.default = autosize; |
|
288 module.exports = exports['default']; |
|
289 }); |
|
290 |
|
291 /***/ }), |
|
292 |
|
293 /***/ 4403: |
|
294 /***/ (function(module, exports) { |
|
295 |
|
296 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
297 Copyright (c) 2018 Jed Watson. |
|
298 Licensed under the MIT License (MIT), see |
|
299 http://jedwatson.github.io/classnames |
|
300 */ |
|
301 /* global define */ |
|
302 |
|
303 (function () { |
|
304 'use strict'; |
|
305 |
|
306 var hasOwn = {}.hasOwnProperty; |
|
307 |
|
308 function classNames() { |
|
309 var classes = []; |
|
310 |
|
311 for (var i = 0; i < arguments.length; i++) { |
|
312 var arg = arguments[i]; |
|
313 if (!arg) continue; |
|
314 |
|
315 var argType = typeof arg; |
|
316 |
|
317 if (argType === 'string' || argType === 'number') { |
|
318 classes.push(arg); |
|
319 } else if (Array.isArray(arg)) { |
|
320 if (arg.length) { |
|
321 var inner = classNames.apply(null, arg); |
|
322 if (inner) { |
|
323 classes.push(inner); |
|
324 } |
|
325 } |
|
326 } else if (argType === 'object') { |
|
327 if (arg.toString === Object.prototype.toString) { |
|
328 for (var key in arg) { |
|
329 if (hasOwn.call(arg, key) && arg[key]) { |
|
330 classes.push(key); |
|
331 } |
|
332 } |
|
333 } else { |
|
334 classes.push(arg.toString()); |
|
335 } |
|
336 } |
|
337 } |
|
338 |
|
339 return classes.join(' '); |
|
340 } |
|
341 |
|
342 if ( true && module.exports) { |
|
343 classNames.default = classNames; |
|
344 module.exports = classNames; |
|
345 } else if (true) { |
|
346 // register as 'classnames', consistent with npm package name |
|
347 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
348 return classNames; |
|
349 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
350 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
351 } else {} |
|
352 }()); |
|
353 |
|
354 |
|
355 /***/ }), |
|
356 |
|
357 /***/ 4827: |
|
358 /***/ (function(module) { |
|
359 |
|
360 // This code has been refactored for 140 bytes |
|
361 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js |
|
362 var computedStyle = function (el, prop, getComputedStyle) { |
|
363 getComputedStyle = window.getComputedStyle; |
|
364 |
|
365 // In one fell swoop |
|
366 return ( |
|
367 // If we have getComputedStyle |
|
368 getComputedStyle ? |
|
369 // Query it |
|
370 // TODO: From CSS-Query notes, we might need (node, null) for FF |
|
371 getComputedStyle(el) : |
|
372 |
|
373 // Otherwise, we are in IE and use currentStyle |
|
374 el.currentStyle |
|
375 )[ |
|
376 // Switch to camelCase for CSSOM |
|
377 // DEV: Grabbed from jQuery |
|
378 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 |
|
379 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 |
|
380 prop.replace(/-(\w)/gi, function (word, letter) { |
|
381 return letter.toUpperCase(); |
|
382 }) |
|
383 ]; |
|
384 }; |
|
385 |
|
386 module.exports = computedStyle; |
|
387 |
|
388 |
|
389 /***/ }), |
|
390 |
|
391 /***/ 8981: |
|
392 /***/ (function(module, exports) { |
|
393 |
|
394 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage |
|
395 // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime |
|
396 // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs |
|
397 // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling. |
|
398 // v4 adds AMD/UMD, commonJS, and plain browser support |
|
399 // v4.1 adds url download capability via solo URL argument (same domain/CORS only) |
|
400 // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors |
|
401 // https://github.com/rndme/download |
|
402 |
|
403 (function (root, factory) { |
|
404 if (true) { |
|
405 // AMD. Register as an anonymous module. |
|
406 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), |
|
407 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? |
|
408 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), |
|
409 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
410 } else {} |
|
411 }(this, function () { |
|
412 |
|
413 return function download(data, strFileName, strMimeType) { |
|
414 |
|
415 var self = window, // this script is only for browsers anyway... |
|
416 defaultMime = "application/octet-stream", // this default mime also triggers iframe downloads |
|
417 mimeType = strMimeType || defaultMime, |
|
418 payload = data, |
|
419 url = !strFileName && !strMimeType && payload, |
|
420 anchor = document.createElement("a"), |
|
421 toString = function(a){return String(a);}, |
|
422 myBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString), |
|
423 fileName = strFileName || "download", |
|
424 blob, |
|
425 reader; |
|
426 myBlob= myBlob.call ? myBlob.bind(self) : Blob ; |
|
427 |
|
428 if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback |
|
429 payload=[payload, mimeType]; |
|
430 mimeType=payload[0]; |
|
431 payload=payload[1]; |
|
432 } |
|
433 |
|
434 |
|
435 if(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument |
|
436 fileName = url.split("/").pop().split("?")[0]; |
|
437 anchor.href = url; // assign href prop to temp anchor |
|
438 if(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path: |
|
439 var ajax=new XMLHttpRequest(); |
|
440 ajax.open( "GET", url, true); |
|
441 ajax.responseType = 'blob'; |
|
442 ajax.onload= function(e){ |
|
443 download(e.target.response, fileName, defaultMime); |
|
444 }; |
|
445 setTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return: |
|
446 return ajax; |
|
447 } // end if valid url? |
|
448 } // end if url? |
|
449 |
|
450 |
|
451 //go ahead and download dataURLs right away |
|
452 if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){ |
|
453 |
|
454 if(payload.length > (1024*1024*1.999) && myBlob !== toString ){ |
|
455 payload=dataUrlToBlob(payload); |
|
456 mimeType=payload.type || defaultMime; |
|
457 }else{ |
|
458 return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs: |
|
459 navigator.msSaveBlob(dataUrlToBlob(payload), fileName) : |
|
460 saver(payload) ; // everyone else can save dataURLs un-processed |
|
461 } |
|
462 |
|
463 }else{//not data url, is it a string with special needs? |
|
464 if(/([\x80-\xff])/.test(payload)){ |
|
465 var i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length; |
|
466 for(i;i<mx;++i) tempUiArr[i]= payload.charCodeAt(i); |
|
467 payload=new myBlob([tempUiArr], {type: mimeType}); |
|
468 } |
|
469 } |
|
470 blob = payload instanceof myBlob ? |
|
471 payload : |
|
472 new myBlob([payload], {type: mimeType}) ; |
|
473 |
|
474 |
|
475 function dataUrlToBlob(strUrl) { |
|
476 var parts= strUrl.split(/[:;,]/), |
|
477 type= parts[1], |
|
478 decoder= parts[2] == "base64" ? atob : decodeURIComponent, |
|
479 binData= decoder( parts.pop() ), |
|
480 mx= binData.length, |
|
481 i= 0, |
|
482 uiArr= new Uint8Array(mx); |
|
483 |
|
484 for(i;i<mx;++i) uiArr[i]= binData.charCodeAt(i); |
|
485 |
|
486 return new myBlob([uiArr], {type: type}); |
|
487 } |
|
488 |
|
489 function saver(url, winMode){ |
|
490 |
|
491 if ('download' in anchor) { //html5 A[download] |
|
492 anchor.href = url; |
|
493 anchor.setAttribute("download", fileName); |
|
494 anchor.className = "download-js-link"; |
|
495 anchor.innerHTML = "downloading..."; |
|
496 anchor.style.display = "none"; |
|
497 document.body.appendChild(anchor); |
|
498 setTimeout(function() { |
|
499 anchor.click(); |
|
500 document.body.removeChild(anchor); |
|
501 if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(anchor.href);}, 250 );} |
|
502 }, 66); |
|
503 return true; |
|
504 } |
|
505 |
|
506 // handle non-a[download] safari as best we can: |
|
507 if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) { |
|
508 if(/^data:/.test(url)) url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); |
|
509 if(!window.open(url)){ // popup blocked, offer direct download: |
|
510 if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; } |
|
511 } |
|
512 return true; |
|
513 } |
|
514 |
|
515 //do iframe dataURL download (old ch+FF): |
|
516 var f = document.createElement("iframe"); |
|
517 document.body.appendChild(f); |
|
518 |
|
519 if(!winMode && /^data:/.test(url)){ // force a mime that will download: |
|
520 url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); |
|
521 } |
|
522 f.src=url; |
|
523 setTimeout(function(){ document.body.removeChild(f); }, 333); |
|
524 |
|
525 }//end saver |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL) |
|
531 return navigator.msSaveBlob(blob, fileName); |
|
532 } |
|
533 |
|
534 if(self.URL){ // simple fast and modern way using Blob and URL: |
|
535 saver(self.URL.createObjectURL(blob), true); |
|
536 }else{ |
|
537 // handle non-Blob()+non-URL browsers: |
|
538 if(typeof blob === "string" || blob.constructor===toString ){ |
|
539 try{ |
|
540 return saver( "data:" + mimeType + ";base64," + self.btoa(blob) ); |
|
541 }catch(y){ |
|
542 return saver( "data:" + mimeType + "," + encodeURIComponent(blob) ); |
|
543 } |
|
544 } |
|
545 |
|
546 // Blob but not URL support: |
|
547 reader=new FileReader(); |
|
548 reader.onload=function(e){ |
|
549 saver(this.result); |
|
550 }; |
|
551 reader.readAsDataURL(blob); |
|
552 } |
|
553 return true; |
|
554 }; /* end download() */ |
|
555 })); |
|
556 |
|
557 |
|
558 /***/ }), |
|
559 |
|
560 /***/ 9894: |
|
561 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
562 |
|
563 // Load in dependencies |
|
564 var computedStyle = __webpack_require__(4827); |
|
565 |
|
566 /** |
|
567 * Calculate the `line-height` of a given node |
|
568 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. |
|
569 * @returns {Number} `line-height` of the element in pixels |
|
570 */ |
|
571 function lineHeight(node) { |
|
572 // Grab the line-height via style |
|
573 var lnHeightStr = computedStyle(node, 'line-height'); |
|
574 var lnHeight = parseFloat(lnHeightStr, 10); |
|
575 |
|
576 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') |
|
577 if (lnHeightStr === lnHeight + '') { |
|
578 // Save the old lineHeight style and update the em unit to the element |
|
579 var _lnHeightStyle = node.style.lineHeight; |
|
580 node.style.lineHeight = lnHeightStr + 'em'; |
|
581 |
|
582 // Calculate the em based height |
|
583 lnHeightStr = computedStyle(node, 'line-height'); |
|
584 lnHeight = parseFloat(lnHeightStr, 10); |
|
585 |
|
586 // Revert the lineHeight style |
|
587 if (_lnHeightStyle) { |
|
588 node.style.lineHeight = _lnHeightStyle; |
|
589 } else { |
|
590 delete node.style.lineHeight; |
|
591 } |
|
592 } |
|
593 |
|
594 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) |
|
595 // DEV: `em` units are converted to `pt` in IE6 |
|
596 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length |
|
597 if (lnHeightStr.indexOf('pt') !== -1) { |
|
598 lnHeight *= 4; |
|
599 lnHeight /= 3; |
|
600 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) |
|
601 } else if (lnHeightStr.indexOf('mm') !== -1) { |
|
602 lnHeight *= 96; |
|
603 lnHeight /= 25.4; |
|
604 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) |
|
605 } else if (lnHeightStr.indexOf('cm') !== -1) { |
|
606 lnHeight *= 96; |
|
607 lnHeight /= 2.54; |
|
608 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) |
|
609 } else if (lnHeightStr.indexOf('in') !== -1) { |
|
610 lnHeight *= 96; |
|
611 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) |
|
612 } else if (lnHeightStr.indexOf('pc') !== -1) { |
|
613 lnHeight *= 16; |
|
614 } |
|
615 |
|
616 // Continue our computation |
|
617 lnHeight = Math.round(lnHeight); |
|
618 |
|
619 // If the line-height is "normal", calculate by font-size |
|
620 if (lnHeightStr === 'normal') { |
|
621 // Create a temporary node |
|
622 var nodeName = node.nodeName; |
|
623 var _node = document.createElement(nodeName); |
|
624 _node.innerHTML = ' '; |
|
625 |
|
626 // If we have a text area, reset it to only 1 row |
|
627 // https://github.com/twolfson/line-height/issues/4 |
|
628 if (nodeName.toUpperCase() === 'TEXTAREA') { |
|
629 _node.setAttribute('rows', '1'); |
|
630 } |
|
631 |
|
632 // Set the font-size of the element |
|
633 var fontSizeStr = computedStyle(node, 'font-size'); |
|
634 _node.style.fontSize = fontSizeStr; |
|
635 |
|
636 // Remove default padding/border which can affect offset height |
|
637 // https://github.com/twolfson/line-height/issues/4 |
|
638 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight |
|
639 _node.style.padding = '0px'; |
|
640 _node.style.border = '0px'; |
|
641 |
|
642 // Append it to the body |
|
643 var body = document.body; |
|
644 body.appendChild(_node); |
|
645 |
|
646 // Assume the line height of the element is the height |
|
647 var height = _node.offsetHeight; |
|
648 lnHeight = height; |
|
649 |
|
650 // Remove our child from the DOM |
|
651 body.removeChild(_node); |
|
652 } |
|
653 |
|
654 // Return the calculated height |
|
655 return lnHeight; |
|
656 } |
|
657 |
|
658 // Export lineHeight |
|
659 module.exports = lineHeight; |
|
660 |
|
661 |
|
662 /***/ }), |
|
663 |
|
664 /***/ 5372: |
|
665 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
666 |
|
667 "use strict"; |
|
668 /** |
|
669 * Copyright (c) 2013-present, Facebook, Inc. |
|
670 * |
|
671 * This source code is licensed under the MIT license found in the |
|
672 * LICENSE file in the root directory of this source tree. |
|
673 */ |
|
674 |
|
675 |
|
676 |
|
677 var ReactPropTypesSecret = __webpack_require__(9567); |
|
678 |
|
679 function emptyFunction() {} |
|
680 function emptyFunctionWithReset() {} |
|
681 emptyFunctionWithReset.resetWarningCache = emptyFunction; |
|
682 |
|
683 module.exports = function() { |
|
684 function shim(props, propName, componentName, location, propFullName, secret) { |
|
685 if (secret === ReactPropTypesSecret) { |
|
686 // It is still safe when called from React. |
|
687 return; |
|
688 } |
|
689 var err = new Error( |
|
690 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + |
|
691 'Use PropTypes.checkPropTypes() to call them. ' + |
|
692 'Read more at http://fb.me/use-check-prop-types' |
|
693 ); |
|
694 err.name = 'Invariant Violation'; |
|
695 throw err; |
|
696 }; |
|
697 shim.isRequired = shim; |
|
698 function getShim() { |
|
699 return shim; |
|
700 }; |
|
701 // Important! |
|
702 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. |
|
703 var ReactPropTypes = { |
|
704 array: shim, |
|
705 bigint: shim, |
|
706 bool: shim, |
|
707 func: shim, |
|
708 number: shim, |
|
709 object: shim, |
|
710 string: shim, |
|
711 symbol: shim, |
|
712 |
|
713 any: shim, |
|
714 arrayOf: getShim, |
|
715 element: shim, |
|
716 elementType: shim, |
|
717 instanceOf: getShim, |
|
718 node: shim, |
|
719 objectOf: getShim, |
|
720 oneOf: getShim, |
|
721 oneOfType: getShim, |
|
722 shape: getShim, |
|
723 exact: getShim, |
|
724 |
|
725 checkPropTypes: emptyFunctionWithReset, |
|
726 resetWarningCache: emptyFunction |
|
727 }; |
|
728 |
|
729 ReactPropTypes.PropTypes = ReactPropTypes; |
|
730 |
|
731 return ReactPropTypes; |
|
732 }; |
|
733 |
|
734 |
|
735 /***/ }), |
|
736 |
|
737 /***/ 2652: |
|
738 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
739 |
|
740 /** |
|
741 * Copyright (c) 2013-present, Facebook, Inc. |
|
742 * |
|
743 * This source code is licensed under the MIT license found in the |
|
744 * LICENSE file in the root directory of this source tree. |
|
745 */ |
|
746 |
|
747 if (false) { var throwOnDirectAccess, ReactIs; } else { |
|
748 // By explicitly using `prop-types` you are opting into new production behavior. |
|
749 // http://fb.me/prop-types-in-prod |
|
750 module.exports = __webpack_require__(5372)(); |
|
751 } |
|
752 |
|
753 |
|
754 /***/ }), |
|
755 |
|
756 /***/ 9567: |
|
757 /***/ (function(module) { |
|
758 |
|
759 "use strict"; |
|
760 /** |
|
761 * Copyright (c) 2013-present, Facebook, Inc. |
|
762 * |
|
763 * This source code is licensed under the MIT license found in the |
|
764 * LICENSE file in the root directory of this source tree. |
|
765 */ |
|
766 |
|
767 |
|
768 |
|
769 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
|
770 |
|
771 module.exports = ReactPropTypesSecret; |
|
772 |
|
773 |
|
774 /***/ }), |
|
775 |
|
776 /***/ 5438: |
|
777 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
|
778 |
|
779 "use strict"; |
|
780 |
|
781 var __extends = (this && this.__extends) || (function () { |
|
782 var extendStatics = Object.setPrototypeOf || |
|
783 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|
784 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|
785 return function (d, b) { |
|
786 extendStatics(d, b); |
|
787 function __() { this.constructor = d; } |
|
788 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|
789 }; |
|
790 })(); |
|
791 var __assign = (this && this.__assign) || Object.assign || function(t) { |
|
792 for (var s, i = 1, n = arguments.length; i < n; i++) { |
|
793 s = arguments[i]; |
|
794 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) |
|
795 t[p] = s[p]; |
|
796 } |
|
797 return t; |
|
798 }; |
|
799 var __rest = (this && this.__rest) || function (s, e) { |
|
800 var t = {}; |
|
801 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|
802 t[p] = s[p]; |
|
803 if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|
804 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
|
805 t[p[i]] = s[p[i]]; |
|
806 return t; |
|
807 }; |
|
808 exports.__esModule = true; |
|
809 var React = __webpack_require__(9196); |
|
810 var PropTypes = __webpack_require__(2652); |
|
811 var autosize = __webpack_require__(6411); |
|
812 var _getLineHeight = __webpack_require__(9894); |
|
813 var getLineHeight = _getLineHeight; |
|
814 var RESIZED = "autosize:resized"; |
|
815 /** |
|
816 * A light replacement for built-in textarea component |
|
817 * which automaticaly adjusts its height to match the content |
|
818 */ |
|
819 var TextareaAutosizeClass = /** @class */ (function (_super) { |
|
820 __extends(TextareaAutosizeClass, _super); |
|
821 function TextareaAutosizeClass() { |
|
822 var _this = _super !== null && _super.apply(this, arguments) || this; |
|
823 _this.state = { |
|
824 lineHeight: null |
|
825 }; |
|
826 _this.textarea = null; |
|
827 _this.onResize = function (e) { |
|
828 if (_this.props.onResize) { |
|
829 _this.props.onResize(e); |
|
830 } |
|
831 }; |
|
832 _this.updateLineHeight = function () { |
|
833 if (_this.textarea) { |
|
834 _this.setState({ |
|
835 lineHeight: getLineHeight(_this.textarea) |
|
836 }); |
|
837 } |
|
838 }; |
|
839 _this.onChange = function (e) { |
|
840 var onChange = _this.props.onChange; |
|
841 _this.currentValue = e.currentTarget.value; |
|
842 onChange && onChange(e); |
|
843 }; |
|
844 return _this; |
|
845 } |
|
846 TextareaAutosizeClass.prototype.componentDidMount = function () { |
|
847 var _this = this; |
|
848 var _a = this.props, maxRows = _a.maxRows, async = _a.async; |
|
849 if (typeof maxRows === "number") { |
|
850 this.updateLineHeight(); |
|
851 } |
|
852 if (typeof maxRows === "number" || async) { |
|
853 /* |
|
854 the defer is needed to: |
|
855 - force "autosize" to activate the scrollbar when this.props.maxRows is passed |
|
856 - support StyledComponents (see #71) |
|
857 */ |
|
858 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); |
|
859 } |
|
860 else { |
|
861 this.textarea && autosize(this.textarea); |
|
862 } |
|
863 if (this.textarea) { |
|
864 this.textarea.addEventListener(RESIZED, this.onResize); |
|
865 } |
|
866 }; |
|
867 TextareaAutosizeClass.prototype.componentWillUnmount = function () { |
|
868 if (this.textarea) { |
|
869 this.textarea.removeEventListener(RESIZED, this.onResize); |
|
870 autosize.destroy(this.textarea); |
|
871 } |
|
872 }; |
|
873 TextareaAutosizeClass.prototype.render = function () { |
|
874 var _this = this; |
|
875 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; |
|
876 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; |
|
877 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { |
|
878 _this.textarea = element; |
|
879 if (typeof _this.props.innerRef === 'function') { |
|
880 _this.props.innerRef(element); |
|
881 } |
|
882 else if (_this.props.innerRef) { |
|
883 _this.props.innerRef.current = element; |
|
884 } |
|
885 } }), children)); |
|
886 }; |
|
887 TextareaAutosizeClass.prototype.componentDidUpdate = function () { |
|
888 this.textarea && autosize.update(this.textarea); |
|
889 }; |
|
890 TextareaAutosizeClass.defaultProps = { |
|
891 rows: 1, |
|
892 async: false |
|
893 }; |
|
894 TextareaAutosizeClass.propTypes = { |
|
895 rows: PropTypes.number, |
|
896 maxRows: PropTypes.number, |
|
897 onResize: PropTypes.func, |
|
898 innerRef: PropTypes.any, |
|
899 async: PropTypes.bool |
|
900 }; |
|
901 return TextareaAutosizeClass; |
|
902 }(React.Component)); |
|
903 exports.TextareaAutosize = React.forwardRef(function (props, ref) { |
|
904 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); |
|
905 }); |
|
906 |
|
907 |
|
908 /***/ }), |
|
909 |
|
910 /***/ 773: |
|
911 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
|
912 |
|
913 "use strict"; |
|
914 var __webpack_unused_export__; |
|
915 |
|
916 __webpack_unused_export__ = true; |
|
917 var TextareaAutosize_1 = __webpack_require__(5438); |
|
918 exports.Z = TextareaAutosize_1.TextareaAutosize; |
|
919 |
|
920 |
|
921 /***/ }), |
|
922 |
|
923 /***/ 9196: |
|
924 /***/ (function(module) { |
|
925 |
|
926 "use strict"; |
|
927 module.exports = window["React"]; |
|
928 |
|
929 /***/ }) |
|
930 |
|
931 /******/ }); |
|
932 /************************************************************************/ |
|
933 /******/ // The module cache |
|
934 /******/ var __webpack_module_cache__ = {}; |
|
935 /******/ |
|
936 /******/ // The require function |
|
937 /******/ function __webpack_require__(moduleId) { |
|
938 /******/ // Check if module is in cache |
|
939 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
|
940 /******/ if (cachedModule !== undefined) { |
|
941 /******/ return cachedModule.exports; |
|
942 /******/ } |
|
943 /******/ // Create a new module (and put it into the cache) |
|
944 /******/ var module = __webpack_module_cache__[moduleId] = { |
|
945 /******/ // no module.id needed |
|
946 /******/ // no module.loaded needed |
|
947 /******/ exports: {} |
|
948 /******/ }; |
|
949 /******/ |
|
950 /******/ // Execute the module function |
|
951 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
952 /******/ |
|
953 /******/ // Return the exports of the module |
|
954 /******/ return module.exports; |
|
955 /******/ } |
|
956 /******/ |
|
957 /************************************************************************/ |
|
958 /******/ /* webpack/runtime/compat get default export */ |
|
959 /******/ !function() { |
|
960 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
961 /******/ __webpack_require__.n = function(module) { |
|
962 /******/ var getter = module && module.__esModule ? |
|
963 /******/ function() { return module['default']; } : |
|
964 /******/ function() { return module; }; |
|
965 /******/ __webpack_require__.d(getter, { a: getter }); |
|
966 /******/ return getter; |
|
967 /******/ }; |
|
968 /******/ }(); |
|
969 /******/ |
|
970 /******/ /* webpack/runtime/define property getters */ |
|
971 /******/ !function() { |
|
972 /******/ // define getter functions for harmony exports |
|
973 /******/ __webpack_require__.d = function(exports, definition) { |
|
974 /******/ for(var key in definition) { |
|
975 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
976 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
977 /******/ } |
|
978 /******/ } |
|
979 /******/ }; |
|
980 /******/ }(); |
|
981 /******/ |
|
982 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
983 /******/ !function() { |
|
984 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
985 /******/ }(); |
|
986 /******/ |
|
987 /******/ /* webpack/runtime/make namespace object */ |
|
988 /******/ !function() { |
|
989 /******/ // define __esModule on exports |
|
990 /******/ __webpack_require__.r = function(exports) { |
|
991 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
992 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
993 /******/ } |
|
994 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
995 /******/ }; |
|
996 /******/ }(); |
|
997 /******/ |
|
998 /************************************************************************/ |
|
999 var __webpack_exports__ = {}; |
|
1000 // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
|
1001 !function() { |
|
1002 "use strict"; |
|
1003 // ESM COMPAT FLAG |
|
1004 __webpack_require__.r(__webpack_exports__); |
|
1005 |
|
1006 // EXPORTS |
|
1007 __webpack_require__.d(__webpack_exports__, { |
|
1008 "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; }, |
|
1009 "PluginSidebar": function() { return /* reexport */ PluginSidebarEditSite; }, |
|
1010 "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; }, |
|
1011 "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; }, |
|
1012 "__experimentalNavigationToggle": function() { return /* reexport */ navigation_toggle; }, |
|
1013 "initializeEditor": function() { return /* binding */ initializeEditor; }, |
|
1014 "reinitializeEditor": function() { return /* binding */ reinitializeEditor; } |
|
1015 }); |
|
1016 |
|
1017 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js |
|
1018 var actions_namespaceObject = {}; |
|
1019 __webpack_require__.r(actions_namespaceObject); |
|
1020 __webpack_require__.d(actions_namespaceObject, { |
|
1021 "disableComplementaryArea": function() { return disableComplementaryArea; }, |
|
1022 "enableComplementaryArea": function() { return enableComplementaryArea; }, |
|
1023 "pinItem": function() { return pinItem; }, |
|
1024 "setFeatureDefaults": function() { return setFeatureDefaults; }, |
|
1025 "setFeatureValue": function() { return setFeatureValue; }, |
|
1026 "toggleFeature": function() { return toggleFeature; }, |
|
1027 "unpinItem": function() { return unpinItem; } |
|
1028 }); |
|
1029 |
|
1030 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
|
1031 var selectors_namespaceObject = {}; |
|
1032 __webpack_require__.r(selectors_namespaceObject); |
|
1033 __webpack_require__.d(selectors_namespaceObject, { |
|
1034 "getActiveComplementaryArea": function() { return getActiveComplementaryArea; }, |
|
1035 "isFeatureActive": function() { return isFeatureActive; }, |
|
1036 "isItemPinned": function() { return isItemPinned; } |
|
1037 }); |
|
1038 |
|
1039 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js |
|
1040 var store_actions_namespaceObject = {}; |
|
1041 __webpack_require__.r(store_actions_namespaceObject); |
|
1042 __webpack_require__.d(store_actions_namespaceObject, { |
|
1043 "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; }, |
|
1044 "addTemplate": function() { return addTemplate; }, |
|
1045 "closeGeneralSidebar": function() { return closeGeneralSidebar; }, |
|
1046 "openGeneralSidebar": function() { return openGeneralSidebar; }, |
|
1047 "openNavigationPanelToMenu": function() { return openNavigationPanelToMenu; }, |
|
1048 "removeTemplate": function() { return removeTemplate; }, |
|
1049 "revertTemplate": function() { return revertTemplate; }, |
|
1050 "setHomeTemplateId": function() { return setHomeTemplateId; }, |
|
1051 "setIsInserterOpened": function() { return setIsInserterOpened; }, |
|
1052 "setIsListViewOpened": function() { return setIsListViewOpened; }, |
|
1053 "setIsNavigationPanelOpened": function() { return setIsNavigationPanelOpened; }, |
|
1054 "setNavigationPanelActiveMenu": function() { return setNavigationPanelActiveMenu; }, |
|
1055 "setPage": function() { return setPage; }, |
|
1056 "setTemplate": function() { return setTemplate; }, |
|
1057 "setTemplatePart": function() { return setTemplatePart; }, |
|
1058 "switchEditorMode": function() { return switchEditorMode; }, |
|
1059 "toggleFeature": function() { return actions_toggleFeature; }, |
|
1060 "updateSettings": function() { return updateSettings; } |
|
1061 }); |
|
1062 |
|
1063 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js |
|
1064 var store_selectors_namespaceObject = {}; |
|
1065 __webpack_require__.r(store_selectors_namespaceObject); |
|
1066 __webpack_require__.d(store_selectors_namespaceObject, { |
|
1067 "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; }, |
|
1068 "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; }, |
|
1069 "__unstableGetPreference": function() { return __unstableGetPreference; }, |
|
1070 "getCanUserCreateMedia": function() { return getCanUserCreateMedia; }, |
|
1071 "getCurrentTemplateNavigationPanelSubMenu": function() { return getCurrentTemplateNavigationPanelSubMenu; }, |
|
1072 "getCurrentTemplateTemplateParts": function() { return getCurrentTemplateTemplateParts; }, |
|
1073 "getEditedPostId": function() { return getEditedPostId; }, |
|
1074 "getEditedPostType": function() { return getEditedPostType; }, |
|
1075 "getEditorMode": function() { return getEditorMode; }, |
|
1076 "getHomeTemplateId": function() { return getHomeTemplateId; }, |
|
1077 "getNavigationPanelActiveMenu": function() { return getNavigationPanelActiveMenu; }, |
|
1078 "getPage": function() { return getPage; }, |
|
1079 "getReusableBlocks": function() { return getReusableBlocks; }, |
|
1080 "getSettings": function() { return getSettings; }, |
|
1081 "isFeatureActive": function() { return selectors_isFeatureActive; }, |
|
1082 "isInserterOpened": function() { return isInserterOpened; }, |
|
1083 "isListViewOpened": function() { return isListViewOpened; }, |
|
1084 "isNavigationOpened": function() { return isNavigationOpened; } |
|
1085 }); |
|
1086 |
|
1087 ;// CONCATENATED MODULE: external ["wp","element"] |
|
1088 var external_wp_element_namespaceObject = window["wp"]["element"]; |
|
1089 ;// CONCATENATED MODULE: external ["wp","blocks"] |
|
1090 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
1091 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] |
|
1092 var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; |
|
1093 ;// CONCATENATED MODULE: external ["wp","data"] |
|
1094 var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
1095 ;// CONCATENATED MODULE: external ["wp","coreData"] |
|
1096 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
|
1097 ;// CONCATENATED MODULE: external ["wp","editor"] |
|
1098 var external_wp_editor_namespaceObject = window["wp"]["editor"]; |
|
1099 ;// CONCATENATED MODULE: external ["wp","preferences"] |
|
1100 var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; |
|
1101 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
1102 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
1103 ;// CONCATENATED MODULE: external ["wp","viewport"] |
|
1104 var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; |
|
1105 ;// CONCATENATED MODULE: external ["wp","url"] |
|
1106 var external_wp_url_namespaceObject = window["wp"]["url"]; |
|
1107 ;// CONCATENATED MODULE: external ["wp","hooks"] |
|
1108 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
|
1109 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] |
|
1110 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; |
|
1111 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/components.js |
|
1112 /** |
|
1113 * WordPress dependencies |
|
1114 */ |
|
1115 |
|
1116 |
|
1117 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); |
|
1118 |
|
1119 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js |
|
1120 /** |
|
1121 * Internal dependencies |
|
1122 */ |
|
1123 |
|
1124 |
|
1125 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js |
|
1126 /** |
|
1127 * The identifier for the data store. |
|
1128 * |
|
1129 * @type {string} |
|
1130 */ |
|
1131 const STORE_NAME = 'core/edit-site'; |
|
1132 const TEMPLATE_PART_AREA_HEADER = 'header'; |
|
1133 const TEMPLATE_PART_AREA_FOOTER = 'footer'; |
|
1134 const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar'; |
|
1135 const TEMPLATE_PART_AREA_GENERAL = 'uncategorized'; |
|
1136 |
|
1137 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/constants.js |
|
1138 /** |
|
1139 * WordPress dependencies |
|
1140 */ |
|
1141 |
|
1142 /** |
|
1143 * Internal dependencies |
|
1144 */ |
|
1145 |
|
1146 |
|
1147 const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search']; |
|
1148 const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single-post', 'front-page']; |
|
1149 const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY]; |
|
1150 const TEMPLATES_GENERAL = ['page-home']; |
|
1151 const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-']; |
|
1152 const TEMPLATES_PAGES_PREFIXES = ['page-']; |
|
1153 const TEMPLATE_OVERRIDES = { |
|
1154 singular: ['single', 'page'], |
|
1155 index: ['archive', '404', 'search', 'singular', 'home'], |
|
1156 home: ['front-page'] |
|
1157 }; |
|
1158 const MENU_ROOT = 'root'; |
|
1159 const MENU_TEMPLATE_PARTS = 'template-parts'; |
|
1160 const MENU_TEMPLATES = 'templates'; |
|
1161 const MENU_TEMPLATES_GENERAL = 'templates-general'; |
|
1162 const MENU_TEMPLATES_PAGES = 'templates-pages'; |
|
1163 const MENU_TEMPLATES_POSTS = 'templates-posts'; |
|
1164 const MENU_TEMPLATES_UNUSED = 'templates-unused'; |
|
1165 const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers'; |
|
1166 const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers'; |
|
1167 const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars'; |
|
1168 const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general'; |
|
1169 const TEMPLATE_PARTS_SUB_MENUS = [{ |
|
1170 area: TEMPLATE_PART_AREA_HEADER, |
|
1171 menu: MENU_TEMPLATE_PARTS_HEADERS, |
|
1172 title: (0,external_wp_i18n_namespaceObject.__)('headers') |
|
1173 }, { |
|
1174 area: TEMPLATE_PART_AREA_FOOTER, |
|
1175 menu: MENU_TEMPLATE_PARTS_FOOTERS, |
|
1176 title: (0,external_wp_i18n_namespaceObject.__)('footers') |
|
1177 }, { |
|
1178 area: TEMPLATE_PART_AREA_SIDEBAR, |
|
1179 menu: MENU_TEMPLATE_PARTS_SIDEBARS, |
|
1180 title: (0,external_wp_i18n_namespaceObject.__)('sidebars') |
|
1181 }, { |
|
1182 area: TEMPLATE_PART_AREA_GENERAL, |
|
1183 menu: MENU_TEMPLATE_PARTS_GENERAL, |
|
1184 title: (0,external_wp_i18n_namespaceObject.__)('general') |
|
1185 }]; |
|
1186 |
|
1187 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js |
|
1188 /** |
|
1189 * WordPress dependencies |
|
1190 */ |
|
1191 |
|
1192 /** |
|
1193 * Internal dependencies |
|
1194 */ |
|
1195 |
|
1196 |
|
1197 /** |
|
1198 * Reducer returning the editing canvas device type. |
|
1199 * |
|
1200 * @param {Object} state Current state. |
|
1201 * @param {Object} action Dispatched action. |
|
1202 * |
|
1203 * @return {Object} Updated state. |
|
1204 */ |
|
1205 |
|
1206 function deviceType() { |
|
1207 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop'; |
|
1208 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1209 |
|
1210 switch (action.type) { |
|
1211 case 'SET_PREVIEW_DEVICE_TYPE': |
|
1212 return action.deviceType; |
|
1213 } |
|
1214 |
|
1215 return state; |
|
1216 } |
|
1217 /** |
|
1218 * Reducer returning the settings. |
|
1219 * |
|
1220 * @param {Object} state Current state. |
|
1221 * @param {Object} action Dispatched action. |
|
1222 * |
|
1223 * @return {Object} Updated state. |
|
1224 */ |
|
1225 |
|
1226 function settings() { |
|
1227 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1228 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1229 |
|
1230 switch (action.type) { |
|
1231 case 'UPDATE_SETTINGS': |
|
1232 return { ...state, |
|
1233 ...action.settings |
|
1234 }; |
|
1235 } |
|
1236 |
|
1237 return state; |
|
1238 } |
|
1239 /** |
|
1240 * Reducer keeping track of the currently edited Post Type, |
|
1241 * Post Id and the context provided to fill the content of the block editor. |
|
1242 * |
|
1243 * @param {Object} state Current edited post. |
|
1244 * @param {Object} action Dispatched action. |
|
1245 * |
|
1246 * @return {Object} Updated state. |
|
1247 */ |
|
1248 |
|
1249 function editedPost() { |
|
1250 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1251 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1252 |
|
1253 switch (action.type) { |
|
1254 case 'SET_TEMPLATE': |
|
1255 case 'SET_PAGE': |
|
1256 return { |
|
1257 type: 'wp_template', |
|
1258 id: action.templateId, |
|
1259 page: action.page |
|
1260 }; |
|
1261 |
|
1262 case 'SET_TEMPLATE_PART': |
|
1263 return { |
|
1264 type: 'wp_template_part', |
|
1265 id: action.templatePartId |
|
1266 }; |
|
1267 } |
|
1268 |
|
1269 return state; |
|
1270 } |
|
1271 /** |
|
1272 * Reducer for information about the site's homepage. |
|
1273 * |
|
1274 * @param {Object} state Current state. |
|
1275 * @param {Object} action Dispatched action. |
|
1276 * |
|
1277 * @return {Object} Updated state. |
|
1278 */ |
|
1279 |
|
1280 function homeTemplateId(state, action) { |
|
1281 switch (action.type) { |
|
1282 case 'SET_HOME_TEMPLATE': |
|
1283 return action.homeTemplateId; |
|
1284 } |
|
1285 |
|
1286 return state; |
|
1287 } |
|
1288 /** |
|
1289 * Reducer for information about the navigation panel, such as its active menu |
|
1290 * and whether it should be opened or closed. |
|
1291 * |
|
1292 * Note: this reducer interacts with the inserter and list view panels reducers |
|
1293 * to make sure that only one of the three panels is open at the same time. |
|
1294 * |
|
1295 * @param {Object} state Current state. |
|
1296 * @param {Object} action Dispatched action. |
|
1297 */ |
|
1298 |
|
1299 function navigationPanel() { |
|
1300 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
|
1301 menu: MENU_ROOT, |
|
1302 isOpen: false |
|
1303 }; |
|
1304 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1305 |
|
1306 switch (action.type) { |
|
1307 case 'SET_NAVIGATION_PANEL_ACTIVE_MENU': |
|
1308 return { ...state, |
|
1309 menu: action.menu |
|
1310 }; |
|
1311 |
|
1312 case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
|
1313 return { ...state, |
|
1314 isOpen: true, |
|
1315 menu: action.menu |
|
1316 }; |
|
1317 |
|
1318 case 'SET_IS_NAVIGATION_PANEL_OPENED': |
|
1319 return { ...state, |
|
1320 menu: !action.isOpen ? MENU_ROOT : state.menu, |
|
1321 // Set menu to root when closing panel. |
|
1322 isOpen: action.isOpen |
|
1323 }; |
|
1324 |
|
1325 case 'SET_IS_LIST_VIEW_OPENED': |
|
1326 return { ...state, |
|
1327 menu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, |
|
1328 // Set menu to root when closing panel. |
|
1329 isOpen: action.isOpen ? false : state.isOpen |
|
1330 }; |
|
1331 |
|
1332 case 'SET_IS_INSERTER_OPENED': |
|
1333 return { ...state, |
|
1334 menu: state.isOpen && action.value ? MENU_ROOT : state.menu, |
|
1335 // Set menu to root when closing panel. |
|
1336 isOpen: action.value ? false : state.isOpen |
|
1337 }; |
|
1338 } |
|
1339 |
|
1340 return state; |
|
1341 } |
|
1342 /** |
|
1343 * Reducer to set the block inserter panel open or closed. |
|
1344 * |
|
1345 * Note: this reducer interacts with the navigation and list view panels reducers |
|
1346 * to make sure that only one of the three panels is open at the same time. |
|
1347 * |
|
1348 * @param {boolean|Object} state Current state. |
|
1349 * @param {Object} action Dispatched action. |
|
1350 */ |
|
1351 |
|
1352 function blockInserterPanel() { |
|
1353 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
1354 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1355 |
|
1356 switch (action.type) { |
|
1357 case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
|
1358 return false; |
|
1359 |
|
1360 case 'SET_IS_NAVIGATION_PANEL_OPENED': |
|
1361 case 'SET_IS_LIST_VIEW_OPENED': |
|
1362 return action.isOpen ? false : state; |
|
1363 |
|
1364 case 'SET_IS_INSERTER_OPENED': |
|
1365 return action.value; |
|
1366 } |
|
1367 |
|
1368 return state; |
|
1369 } |
|
1370 /** |
|
1371 * Reducer to set the list view panel open or closed. |
|
1372 * |
|
1373 * Note: this reducer interacts with the navigation and inserter panels reducers |
|
1374 * to make sure that only one of the three panels is open at the same time. |
|
1375 * |
|
1376 * @param {Object} state Current state. |
|
1377 * @param {Object} action Dispatched action. |
|
1378 */ |
|
1379 |
|
1380 function listViewPanel() { |
|
1381 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
1382 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1383 |
|
1384 switch (action.type) { |
|
1385 case 'OPEN_NAVIGATION_PANEL_TO_MENU': |
|
1386 return false; |
|
1387 |
|
1388 case 'SET_IS_NAVIGATION_PANEL_OPENED': |
|
1389 return action.isOpen ? false : state; |
|
1390 |
|
1391 case 'SET_IS_INSERTER_OPENED': |
|
1392 return action.value ? false : state; |
|
1393 |
|
1394 case 'SET_IS_LIST_VIEW_OPENED': |
|
1395 return action.isOpen; |
|
1396 } |
|
1397 |
|
1398 return state; |
|
1399 } |
|
1400 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
|
1401 deviceType, |
|
1402 settings, |
|
1403 editedPost, |
|
1404 homeTemplateId, |
|
1405 navigationPanel, |
|
1406 blockInserterPanel, |
|
1407 listViewPanel |
|
1408 })); |
|
1409 |
|
1410 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
|
1411 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
|
1412 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
|
1413 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
|
1414 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
|
1415 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
|
1416 ;// CONCATENATED MODULE: external ["wp","notices"] |
|
1417 var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
|
1418 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
1419 function extends_extends() { |
|
1420 extends_extends = Object.assign ? Object.assign.bind() : function (target) { |
|
1421 for (var i = 1; i < arguments.length; i++) { |
|
1422 var source = arguments[i]; |
|
1423 |
|
1424 for (var key in source) { |
|
1425 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
1426 target[key] = source[key]; |
|
1427 } |
|
1428 } |
|
1429 } |
|
1430 |
|
1431 return target; |
|
1432 }; |
|
1433 return extends_extends.apply(this, arguments); |
|
1434 } |
|
1435 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
|
1436 var classnames = __webpack_require__(4403); |
|
1437 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
1438 ;// CONCATENATED MODULE: external ["wp","components"] |
|
1439 var external_wp_components_namespaceObject = window["wp"]["components"]; |
|
1440 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
1441 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
1442 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
1443 |
|
1444 |
|
1445 /** |
|
1446 * WordPress dependencies |
|
1447 */ |
|
1448 |
|
1449 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1450 xmlns: "http://www.w3.org/2000/svg", |
|
1451 viewBox: "0 0 24 24" |
|
1452 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1453 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" |
|
1454 })); |
|
1455 /* harmony default export */ var library_check = (check); |
|
1456 |
|
1457 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
|
1458 |
|
1459 |
|
1460 /** |
|
1461 * WordPress dependencies |
|
1462 */ |
|
1463 |
|
1464 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1465 xmlns: "http://www.w3.org/2000/svg", |
|
1466 viewBox: "0 0 24 24" |
|
1467 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1468 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" |
|
1469 })); |
|
1470 /* harmony default export */ var star_filled = (starFilled); |
|
1471 |
|
1472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
|
1473 |
|
1474 |
|
1475 /** |
|
1476 * WordPress dependencies |
|
1477 */ |
|
1478 |
|
1479 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1480 xmlns: "http://www.w3.org/2000/svg", |
|
1481 viewBox: "0 0 24 24" |
|
1482 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1483 fillRule: "evenodd", |
|
1484 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", |
|
1485 clipRule: "evenodd" |
|
1486 })); |
|
1487 /* harmony default export */ var star_empty = (starEmpty); |
|
1488 |
|
1489 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
|
1490 |
|
1491 |
|
1492 /** |
|
1493 * WordPress dependencies |
|
1494 */ |
|
1495 |
|
1496 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1497 xmlns: "http://www.w3.org/2000/svg", |
|
1498 viewBox: "0 0 24 24" |
|
1499 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1500 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" |
|
1501 })); |
|
1502 /* harmony default export */ var close_small = (closeSmall); |
|
1503 |
|
1504 ;// CONCATENATED MODULE: external "lodash" |
|
1505 var external_lodash_namespaceObject = window["lodash"]; |
|
1506 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js |
|
1507 /** |
|
1508 * WordPress dependencies |
|
1509 */ |
|
1510 |
|
1511 |
|
1512 /** |
|
1513 * Enable the complementary area. |
|
1514 * |
|
1515 * @param {string} scope Complementary area scope. |
|
1516 * @param {string} area Area identifier. |
|
1517 */ |
|
1518 |
|
1519 const enableComplementaryArea = (scope, area) => _ref => { |
|
1520 let { |
|
1521 registry |
|
1522 } = _ref; |
|
1523 |
|
1524 // Return early if there's no area. |
|
1525 if (!area) { |
|
1526 return; |
|
1527 } |
|
1528 |
|
1529 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area); |
|
1530 }; |
|
1531 /** |
|
1532 * Disable the complementary area. |
|
1533 * |
|
1534 * @param {string} scope Complementary area scope. |
|
1535 */ |
|
1536 |
|
1537 const disableComplementaryArea = scope => _ref2 => { |
|
1538 let { |
|
1539 registry |
|
1540 } = _ref2; |
|
1541 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null); |
|
1542 }; |
|
1543 /** |
|
1544 * Pins an item. |
|
1545 * |
|
1546 * @param {string} scope Item scope. |
|
1547 * @param {string} item Item identifier. |
|
1548 * |
|
1549 * @return {Object} Action object. |
|
1550 */ |
|
1551 |
|
1552 const pinItem = (scope, item) => _ref3 => { |
|
1553 let { |
|
1554 registry |
|
1555 } = _ref3; |
|
1556 |
|
1557 // Return early if there's no item. |
|
1558 if (!item) { |
|
1559 return; |
|
1560 } |
|
1561 |
|
1562 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do. |
|
1563 |
|
1564 if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) { |
|
1565 return; |
|
1566 } |
|
1567 |
|
1568 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, |
|
1569 [item]: true |
|
1570 }); |
|
1571 }; |
|
1572 /** |
|
1573 * Unpins an item. |
|
1574 * |
|
1575 * @param {string} scope Item scope. |
|
1576 * @param {string} item Item identifier. |
|
1577 */ |
|
1578 |
|
1579 const unpinItem = (scope, item) => _ref4 => { |
|
1580 let { |
|
1581 registry |
|
1582 } = _ref4; |
|
1583 |
|
1584 // Return early if there's no item. |
|
1585 if (!item) { |
|
1586 return; |
|
1587 } |
|
1588 |
|
1589 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); |
|
1590 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, |
|
1591 [item]: false |
|
1592 }); |
|
1593 }; |
|
1594 /** |
|
1595 * Returns an action object used in signalling that a feature should be toggled. |
|
1596 * |
|
1597 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
1598 * @param {string} featureName The feature name. |
|
1599 */ |
|
1600 |
|
1601 function toggleFeature(scope, featureName) { |
|
1602 return function (_ref5) { |
|
1603 let { |
|
1604 registry |
|
1605 } = _ref5; |
|
1606 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { |
|
1607 since: '6.0', |
|
1608 alternative: `dispatch( 'core/preferences' ).toggle` |
|
1609 }); |
|
1610 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); |
|
1611 }; |
|
1612 } |
|
1613 /** |
|
1614 * Returns an action object used in signalling that a feature should be set to |
|
1615 * a true or false value |
|
1616 * |
|
1617 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
1618 * @param {string} featureName The feature name. |
|
1619 * @param {boolean} value The value to set. |
|
1620 * |
|
1621 * @return {Object} Action object. |
|
1622 */ |
|
1623 |
|
1624 function setFeatureValue(scope, featureName, value) { |
|
1625 return function (_ref6) { |
|
1626 let { |
|
1627 registry |
|
1628 } = _ref6; |
|
1629 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { |
|
1630 since: '6.0', |
|
1631 alternative: `dispatch( 'core/preferences' ).set` |
|
1632 }); |
|
1633 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); |
|
1634 }; |
|
1635 } |
|
1636 /** |
|
1637 * Returns an action object used in signalling that defaults should be set for features. |
|
1638 * |
|
1639 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
1640 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. |
|
1641 * |
|
1642 * @return {Object} Action object. |
|
1643 */ |
|
1644 |
|
1645 function setFeatureDefaults(scope, defaults) { |
|
1646 return function (_ref7) { |
|
1647 let { |
|
1648 registry |
|
1649 } = _ref7; |
|
1650 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { |
|
1651 since: '6.0', |
|
1652 alternative: `dispatch( 'core/preferences' ).setDefaults` |
|
1653 }); |
|
1654 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); |
|
1655 }; |
|
1656 } |
|
1657 |
|
1658 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
|
1659 /** |
|
1660 * WordPress dependencies |
|
1661 */ |
|
1662 |
|
1663 |
|
1664 |
|
1665 /** |
|
1666 * Returns the complementary area that is active in a given scope. |
|
1667 * |
|
1668 * @param {Object} state Global application state. |
|
1669 * @param {string} scope Item scope. |
|
1670 * |
|
1671 * @return {string} The complementary area that is active in the given scope. |
|
1672 */ |
|
1673 |
|
1674 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { |
|
1675 return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea'); |
|
1676 }); |
|
1677 /** |
|
1678 * Returns a boolean indicating if an item is pinned or not. |
|
1679 * |
|
1680 * @param {Object} state Global application state. |
|
1681 * @param {string} scope Scope. |
|
1682 * @param {string} item Item to check. |
|
1683 * |
|
1684 * @return {boolean} True if the item is pinned and false otherwise. |
|
1685 */ |
|
1686 |
|
1687 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { |
|
1688 var _pinnedItems$item; |
|
1689 |
|
1690 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); |
|
1691 return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; |
|
1692 }); |
|
1693 /** |
|
1694 * Returns a boolean indicating whether a feature is active for a particular |
|
1695 * scope. |
|
1696 * |
|
1697 * @param {Object} state The store state. |
|
1698 * @param {string} scope The scope of the feature (e.g. core/edit-post). |
|
1699 * @param {string} featureName The name of the feature. |
|
1700 * |
|
1701 * @return {boolean} Is the feature enabled? |
|
1702 */ |
|
1703 |
|
1704 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { |
|
1705 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { |
|
1706 since: '6.0', |
|
1707 alternative: `select( 'core/preferences' ).get( scope, featureName )` |
|
1708 }); |
|
1709 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); |
|
1710 }); |
|
1711 |
|
1712 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js |
|
1713 /** |
|
1714 * The identifier for the data store. |
|
1715 * |
|
1716 * @type {string} |
|
1717 */ |
|
1718 const constants_STORE_NAME = 'core/interface'; |
|
1719 |
|
1720 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js |
|
1721 /** |
|
1722 * WordPress dependencies |
|
1723 */ |
|
1724 |
|
1725 /** |
|
1726 * Internal dependencies |
|
1727 */ |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 /** |
|
1733 * Store definition for the interface namespace. |
|
1734 * |
|
1735 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
1736 * |
|
1737 * @type {Object} |
|
1738 */ |
|
1739 |
|
1740 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { |
|
1741 reducer: () => {}, |
|
1742 actions: actions_namespaceObject, |
|
1743 selectors: selectors_namespaceObject |
|
1744 }); // Once we build a more generic persistence plugin that works across types of stores |
|
1745 // we'd be able to replace this with a register call. |
|
1746 |
|
1747 (0,external_wp_data_namespaceObject.register)(store); |
|
1748 |
|
1749 ;// CONCATENATED MODULE: external ["wp","plugins"] |
|
1750 var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
|
1751 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js |
|
1752 /** |
|
1753 * WordPress dependencies |
|
1754 */ |
|
1755 |
|
1756 /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
1757 return { |
|
1758 icon: ownProps.icon || context.icon, |
|
1759 identifier: ownProps.identifier || `${context.name}/${ownProps.name}` |
|
1760 }; |
|
1761 })); |
|
1762 |
|
1763 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js |
|
1764 |
|
1765 |
|
1766 |
|
1767 /** |
|
1768 * External dependencies |
|
1769 */ |
|
1770 |
|
1771 /** |
|
1772 * WordPress dependencies |
|
1773 */ |
|
1774 |
|
1775 |
|
1776 |
|
1777 /** |
|
1778 * Internal dependencies |
|
1779 */ |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 function ComplementaryAreaToggle(_ref) { |
|
1785 let { |
|
1786 as = external_wp_components_namespaceObject.Button, |
|
1787 scope, |
|
1788 identifier, |
|
1789 icon, |
|
1790 selectedIcon, |
|
1791 ...props |
|
1792 } = _ref; |
|
1793 const ComponentToUse = as; |
|
1794 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); |
|
1795 const { |
|
1796 enableComplementaryArea, |
|
1797 disableComplementaryArea |
|
1798 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
1799 return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, extends_extends({ |
|
1800 icon: selectedIcon && isSelected ? selectedIcon : icon, |
|
1801 onClick: () => { |
|
1802 if (isSelected) { |
|
1803 disableComplementaryArea(scope); |
|
1804 } else { |
|
1805 enableComplementaryArea(scope, identifier); |
|
1806 } |
|
1807 } |
|
1808 }, (0,external_lodash_namespaceObject.omit)(props, ['name']))); |
|
1809 } |
|
1810 |
|
1811 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); |
|
1812 |
|
1813 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js |
|
1814 |
|
1815 |
|
1816 |
|
1817 /** |
|
1818 * External dependencies |
|
1819 */ |
|
1820 |
|
1821 /** |
|
1822 * WordPress dependencies |
|
1823 */ |
|
1824 |
|
1825 |
|
1826 /** |
|
1827 * Internal dependencies |
|
1828 */ |
|
1829 |
|
1830 |
|
1831 |
|
1832 const ComplementaryAreaHeader = _ref => { |
|
1833 let { |
|
1834 smallScreenTitle, |
|
1835 children, |
|
1836 className, |
|
1837 toggleButtonProps |
|
1838 } = _ref; |
|
1839 const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ |
|
1840 icon: close_small |
|
1841 }, toggleButtonProps)); |
|
1842 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1843 className: "components-panel__header interface-complementary-area-header__small" |
|
1844 }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { |
|
1845 className: "interface-complementary-area-header__small-title" |
|
1846 }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1847 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), |
|
1848 tabIndex: -1 |
|
1849 }, children, toggleButton)); |
|
1850 }; |
|
1851 |
|
1852 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); |
|
1853 |
|
1854 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js |
|
1855 |
|
1856 |
|
1857 |
|
1858 /** |
|
1859 * External dependencies |
|
1860 */ |
|
1861 |
|
1862 /** |
|
1863 * WordPress dependencies |
|
1864 */ |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 function ActionItemSlot(_ref) { |
|
1870 let { |
|
1871 name, |
|
1872 as: Component = external_wp_components_namespaceObject.ButtonGroup, |
|
1873 fillProps = {}, |
|
1874 bubblesVirtually, |
|
1875 ...props |
|
1876 } = _ref; |
|
1877 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { |
|
1878 name: name, |
|
1879 bubblesVirtually: bubblesVirtually, |
|
1880 fillProps: fillProps |
|
1881 }, fills => { |
|
1882 if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) { |
|
1883 return null; |
|
1884 } // Special handling exists for backward compatibility. |
|
1885 // It ensures that menu items created by plugin authors aren't |
|
1886 // duplicated with automatically injected menu items coming |
|
1887 // from pinnable plugin sidebars. |
|
1888 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
1889 |
|
1890 |
|
1891 const initializedByPlugins = []; |
|
1892 external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => { |
|
1893 let { |
|
1894 props: { |
|
1895 __unstableExplicitMenuItem, |
|
1896 __unstableTarget |
|
1897 } |
|
1898 } = _ref2; |
|
1899 |
|
1900 if (__unstableTarget && __unstableExplicitMenuItem) { |
|
1901 initializedByPlugins.push(__unstableTarget); |
|
1902 } |
|
1903 }); |
|
1904 const children = external_wp_element_namespaceObject.Children.map(fills, child => { |
|
1905 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { |
|
1906 return null; |
|
1907 } |
|
1908 |
|
1909 return child; |
|
1910 }); |
|
1911 return (0,external_wp_element_namespaceObject.createElement)(Component, props, children); |
|
1912 }); |
|
1913 } |
|
1914 |
|
1915 function ActionItem(_ref3) { |
|
1916 let { |
|
1917 name, |
|
1918 as: Component = external_wp_components_namespaceObject.Button, |
|
1919 onClick, |
|
1920 ...props |
|
1921 } = _ref3; |
|
1922 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
|
1923 name: name |
|
1924 }, _ref4 => { |
|
1925 let { |
|
1926 onClick: fpOnClick |
|
1927 } = _ref4; |
|
1928 return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({ |
|
1929 onClick: onClick || fpOnClick ? function () { |
|
1930 (onClick || external_lodash_namespaceObject.noop)(...arguments); |
|
1931 (fpOnClick || external_lodash_namespaceObject.noop)(...arguments); |
|
1932 } : undefined |
|
1933 }, props)); |
|
1934 }); |
|
1935 } |
|
1936 |
|
1937 ActionItem.Slot = ActionItemSlot; |
|
1938 /* harmony default export */ var action_item = (ActionItem); |
|
1939 |
|
1940 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js |
|
1941 |
|
1942 |
|
1943 |
|
1944 /** |
|
1945 * External dependencies |
|
1946 */ |
|
1947 |
|
1948 /** |
|
1949 * WordPress dependencies |
|
1950 */ |
|
1951 |
|
1952 |
|
1953 |
|
1954 /** |
|
1955 * Internal dependencies |
|
1956 */ |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. |
|
1962 // They are removed so they don't leak to DOM elements. |
|
1963 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
1964 (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); |
|
1965 |
|
1966 function ComplementaryAreaMoreMenuItem(_ref) { |
|
1967 let { |
|
1968 scope, |
|
1969 target, |
|
1970 __unstableExplicitMenuItem, |
|
1971 ...props |
|
1972 } = _ref; |
|
1973 return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({ |
|
1974 as: toggleProps => { |
|
1975 return (0,external_wp_element_namespaceObject.createElement)(action_item, extends_extends({ |
|
1976 __unstableExplicitMenuItem: __unstableExplicitMenuItem, |
|
1977 __unstableTarget: `${scope}/${target}`, |
|
1978 as: PluginsMenuItem, |
|
1979 name: `${scope}/plugin-more-menu` |
|
1980 }, toggleProps)); |
|
1981 }, |
|
1982 role: "menuitemcheckbox", |
|
1983 selectedIcon: library_check, |
|
1984 name: target, |
|
1985 scope: scope |
|
1986 }, props)); |
|
1987 } |
|
1988 |
|
1989 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js |
|
1990 |
|
1991 |
|
1992 |
|
1993 /** |
|
1994 * External dependencies |
|
1995 */ |
|
1996 |
|
1997 |
|
1998 /** |
|
1999 * WordPress dependencies |
|
2000 */ |
|
2001 |
|
2002 |
|
2003 |
|
2004 function PinnedItems(_ref) { |
|
2005 let { |
|
2006 scope, |
|
2007 ...props |
|
2008 } = _ref; |
|
2009 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, extends_extends({ |
|
2010 name: `PinnedItems/${scope}` |
|
2011 }, props)); |
|
2012 } |
|
2013 |
|
2014 function PinnedItemsSlot(_ref2) { |
|
2015 let { |
|
2016 scope, |
|
2017 className, |
|
2018 ...props |
|
2019 } = _ref2; |
|
2020 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ |
|
2021 name: `PinnedItems/${scope}` |
|
2022 }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2023 className: classnames_default()(className, 'interface-pinned-items') |
|
2024 }, fills)); |
|
2025 } |
|
2026 |
|
2027 PinnedItems.Slot = PinnedItemsSlot; |
|
2028 /* harmony default export */ var pinned_items = (PinnedItems); |
|
2029 |
|
2030 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js |
|
2031 |
|
2032 |
|
2033 |
|
2034 /** |
|
2035 * External dependencies |
|
2036 */ |
|
2037 |
|
2038 /** |
|
2039 * WordPress dependencies |
|
2040 */ |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 /** |
|
2049 * Internal dependencies |
|
2050 */ |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 function ComplementaryAreaSlot(_ref) { |
|
2060 let { |
|
2061 scope, |
|
2062 ...props |
|
2063 } = _ref; |
|
2064 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({ |
|
2065 name: `ComplementaryArea/${scope}` |
|
2066 }, props)); |
|
2067 } |
|
2068 |
|
2069 function ComplementaryAreaFill(_ref2) { |
|
2070 let { |
|
2071 scope, |
|
2072 children, |
|
2073 className |
|
2074 } = _ref2; |
|
2075 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
|
2076 name: `ComplementaryArea/${scope}` |
|
2077 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2078 className: className |
|
2079 }, children)); |
|
2080 } |
|
2081 |
|
2082 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { |
|
2083 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
|
2084 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
|
2085 const { |
|
2086 enableComplementaryArea, |
|
2087 disableComplementaryArea |
|
2088 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
2089 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
2090 // If the complementary area is active and the editor is switching from a big to a small window size. |
|
2091 if (isActive && isSmall && !previousIsSmall.current) { |
|
2092 // Disable the complementary area. |
|
2093 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. |
|
2094 |
|
2095 shouldOpenWhenNotSmall.current = true; |
|
2096 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size |
|
2097 // and we are going from a small to big window size. |
|
2098 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { |
|
2099 // Remove the flag indicating the complementary area should be enabled. |
|
2100 shouldOpenWhenNotSmall.current = false; // Enable the complementary area. |
|
2101 |
|
2102 enableComplementaryArea(scope, identifier); |
|
2103 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, |
|
2104 // remove the flag. |
|
2105 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { |
|
2106 shouldOpenWhenNotSmall.current = false; |
|
2107 } |
|
2108 |
|
2109 if (isSmall !== previousIsSmall.current) { |
|
2110 previousIsSmall.current = isSmall; |
|
2111 } |
|
2112 }, [isActive, isSmall, scope, identifier, activeArea]); |
|
2113 } |
|
2114 |
|
2115 function ComplementaryArea(_ref3) { |
|
2116 let { |
|
2117 children, |
|
2118 className, |
|
2119 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), |
|
2120 identifier, |
|
2121 header, |
|
2122 headerClassName, |
|
2123 icon, |
|
2124 isPinnable = true, |
|
2125 panelClassName, |
|
2126 scope, |
|
2127 name, |
|
2128 smallScreenTitle, |
|
2129 title, |
|
2130 toggleShortcut, |
|
2131 isActiveByDefault, |
|
2132 showIconLabels = false |
|
2133 } = _ref3; |
|
2134 const { |
|
2135 isActive, |
|
2136 isPinned, |
|
2137 activeArea, |
|
2138 isSmall, |
|
2139 isLarge |
|
2140 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
2141 const { |
|
2142 getActiveComplementaryArea, |
|
2143 isItemPinned |
|
2144 } = select(store); |
|
2145 |
|
2146 const _activeArea = getActiveComplementaryArea(scope); |
|
2147 |
|
2148 return { |
|
2149 isActive: _activeArea === identifier, |
|
2150 isPinned: isItemPinned(scope, identifier), |
|
2151 activeArea: _activeArea, |
|
2152 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), |
|
2153 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') |
|
2154 }; |
|
2155 }, [identifier, scope]); |
|
2156 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); |
|
2157 const { |
|
2158 enableComplementaryArea, |
|
2159 disableComplementaryArea, |
|
2160 pinItem, |
|
2161 unpinItem |
|
2162 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
2163 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
2164 if (isActiveByDefault && activeArea === undefined && !isSmall) { |
|
2165 enableComplementaryArea(scope, identifier); |
|
2166 } |
|
2167 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]); |
|
2168 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { |
|
2169 scope: scope |
|
2170 }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { |
|
2171 scope: scope, |
|
2172 identifier: identifier, |
|
2173 isPressed: isActive && (!showIconLabels || isLarge), |
|
2174 "aria-expanded": isActive, |
|
2175 label: title, |
|
2176 icon: showIconLabels ? library_check : icon, |
|
2177 showTooltip: !showIconLabels, |
|
2178 variant: showIconLabels ? 'tertiary' : undefined |
|
2179 })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { |
|
2180 target: name, |
|
2181 scope: scope, |
|
2182 icon: icon |
|
2183 }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { |
|
2184 className: classnames_default()('interface-complementary-area', className), |
|
2185 scope: scope |
|
2186 }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { |
|
2187 className: headerClassName, |
|
2188 closeLabel: closeLabel, |
|
2189 onClose: () => disableComplementaryArea(scope), |
|
2190 smallScreenTitle: smallScreenTitle, |
|
2191 toggleButtonProps: { |
|
2192 label: closeLabel, |
|
2193 shortcut: toggleShortcut, |
|
2194 scope, |
|
2195 identifier |
|
2196 } |
|
2197 }, 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, { |
|
2198 className: "interface-complementary-area__pin-unpin-item", |
|
2199 icon: isPinned ? star_filled : star_empty, |
|
2200 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), |
|
2201 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), |
|
2202 isPressed: isPinned, |
|
2203 "aria-expanded": isPinned |
|
2204 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { |
|
2205 className: panelClassName |
|
2206 }, children))); |
|
2207 } |
|
2208 |
|
2209 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); |
|
2210 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; |
|
2211 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); |
|
2212 |
|
2213 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
2214 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
|
2215 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js |
|
2216 |
|
2217 |
|
2218 |
|
2219 /** |
|
2220 * External dependencies |
|
2221 */ |
|
2222 |
|
2223 /** |
|
2224 * WordPress dependencies |
|
2225 */ |
|
2226 |
|
2227 /** |
|
2228 * WordPress dependencies |
|
2229 */ |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 function useHTMLClass(className) { |
|
2237 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
2238 const element = document && document.querySelector(`html:not(.${className})`); |
|
2239 |
|
2240 if (!element) { |
|
2241 return; |
|
2242 } |
|
2243 |
|
2244 element.classList.toggle(className); |
|
2245 return () => { |
|
2246 element.classList.toggle(className); |
|
2247 }; |
|
2248 }, [className]); |
|
2249 } |
|
2250 |
|
2251 function InterfaceSkeleton(_ref, ref) { |
|
2252 let { |
|
2253 footer, |
|
2254 header, |
|
2255 sidebar, |
|
2256 secondarySidebar, |
|
2257 notices, |
|
2258 content, |
|
2259 drawer, |
|
2260 actions, |
|
2261 labels, |
|
2262 className, |
|
2263 shortcuts |
|
2264 } = _ref; |
|
2265 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); |
|
2266 useHTMLClass('interface-interface-skeleton__html-container'); |
|
2267 const defaultLabels = { |
|
2268 /* translators: accessibility text for the nav bar landmark region. */ |
|
2269 drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'), |
|
2270 |
|
2271 /* translators: accessibility text for the top bar landmark region. */ |
|
2272 header: (0,external_wp_i18n_namespaceObject.__)('Header'), |
|
2273 |
|
2274 /* translators: accessibility text for the content landmark region. */ |
|
2275 body: (0,external_wp_i18n_namespaceObject.__)('Content'), |
|
2276 |
|
2277 /* translators: accessibility text for the secondary sidebar landmark region. */ |
|
2278 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), |
|
2279 |
|
2280 /* translators: accessibility text for the settings landmark region. */ |
|
2281 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
|
2282 |
|
2283 /* translators: accessibility text for the publish landmark region. */ |
|
2284 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), |
|
2285 |
|
2286 /* translators: accessibility text for the footer landmark region. */ |
|
2287 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') |
|
2288 }; |
|
2289 const mergedLabels = { ...defaultLabels, |
|
2290 ...labels |
|
2291 }; |
|
2292 return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, navigateRegionsProps, { |
|
2293 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]), |
|
2294 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') |
|
2295 }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2296 className: "interface-interface-skeleton__drawer", |
|
2297 role: "region", |
|
2298 "aria-label": mergedLabels.drawer, |
|
2299 tabIndex: "-1" |
|
2300 }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2301 className: "interface-interface-skeleton__editor" |
|
2302 }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2303 className: "interface-interface-skeleton__header", |
|
2304 role: "region", |
|
2305 "aria-label": mergedLabels.header, |
|
2306 tabIndex: "-1" |
|
2307 }, header), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2308 className: "interface-interface-skeleton__body" |
|
2309 }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2310 className: "interface-interface-skeleton__secondary-sidebar", |
|
2311 role: "region", |
|
2312 "aria-label": mergedLabels.secondarySidebar, |
|
2313 tabIndex: "-1" |
|
2314 }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2315 className: "interface-interface-skeleton__notices" |
|
2316 }, notices), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2317 className: "interface-interface-skeleton__content", |
|
2318 role: "region", |
|
2319 "aria-label": mergedLabels.body, |
|
2320 tabIndex: "-1" |
|
2321 }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2322 className: "interface-interface-skeleton__sidebar", |
|
2323 role: "region", |
|
2324 "aria-label": mergedLabels.sidebar, |
|
2325 tabIndex: "-1" |
|
2326 }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2327 className: "interface-interface-skeleton__actions", |
|
2328 role: "region", |
|
2329 "aria-label": mergedLabels.actions, |
|
2330 tabIndex: "-1" |
|
2331 }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2332 className: "interface-interface-skeleton__footer", |
|
2333 role: "region", |
|
2334 "aria-label": mergedLabels.footer, |
|
2335 tabIndex: "-1" |
|
2336 }, footer)); |
|
2337 } |
|
2338 |
|
2339 /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); |
|
2340 |
|
2341 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js |
|
2342 |
|
2343 |
|
2344 /** |
|
2345 * WordPress dependencies |
|
2346 */ |
|
2347 |
|
2348 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
2349 xmlns: "http://www.w3.org/2000/svg", |
|
2350 viewBox: "0 0 24 24" |
|
2351 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
2352 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" |
|
2353 })); |
|
2354 /* harmony default export */ var more_vertical = (moreVertical); |
|
2355 |
|
2356 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js |
|
2357 |
|
2358 |
|
2359 /** |
|
2360 * External dependencies |
|
2361 */ |
|
2362 |
|
2363 /** |
|
2364 * WordPress dependencies |
|
2365 */ |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 function MoreMenuDropdown(_ref) { |
|
2371 let { |
|
2372 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, |
|
2373 className, |
|
2374 |
|
2375 /* translators: button label text should, if possible, be under 16 characters. */ |
|
2376 label = (0,external_wp_i18n_namespaceObject.__)('Options'), |
|
2377 popoverProps, |
|
2378 toggleProps, |
|
2379 children |
|
2380 } = _ref; |
|
2381 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, { |
|
2382 className: classnames_default()('interface-more-menu-dropdown', className), |
|
2383 icon: more_vertical, |
|
2384 label: label, |
|
2385 popoverProps: { |
|
2386 position: 'bottom left', |
|
2387 ...popoverProps, |
|
2388 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className) |
|
2389 }, |
|
2390 toggleProps: { |
|
2391 tooltipPosition: 'bottom', |
|
2392 ...toggleProps |
|
2393 } |
|
2394 }, onClose => children(onClose)); |
|
2395 } |
|
2396 |
|
2397 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js |
|
2398 |
|
2399 |
|
2400 /** |
|
2401 * WordPress dependencies |
|
2402 */ |
|
2403 |
|
2404 |
|
2405 function PreferencesModal(_ref) { |
|
2406 let { |
|
2407 closeModal, |
|
2408 children |
|
2409 } = _ref; |
|
2410 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
2411 className: "interface-preferences-modal", |
|
2412 title: (0,external_wp_i18n_namespaceObject.__)('Preferences'), |
|
2413 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
2414 onRequestClose: closeModal |
|
2415 }, children); |
|
2416 } |
|
2417 |
|
2418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
|
2419 /** |
|
2420 * WordPress dependencies |
|
2421 */ |
|
2422 |
|
2423 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
|
2424 |
|
2425 /** |
|
2426 * Return an SVG icon. |
|
2427 * |
|
2428 * @param {IconProps} props icon is the SVG component to render |
|
2429 * size is a number specifiying the icon size in pixels |
|
2430 * Other props will be passed to wrapped SVG component |
|
2431 * |
|
2432 * @return {JSX.Element} Icon component |
|
2433 */ |
|
2434 |
|
2435 function Icon(_ref) { |
|
2436 let { |
|
2437 icon, |
|
2438 size = 24, |
|
2439 ...props |
|
2440 } = _ref; |
|
2441 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
|
2442 width: size, |
|
2443 height: size, |
|
2444 ...props |
|
2445 }); |
|
2446 } |
|
2447 |
|
2448 /* harmony default export */ var icon = (Icon); |
|
2449 |
|
2450 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js |
|
2451 |
|
2452 |
|
2453 /** |
|
2454 * WordPress dependencies |
|
2455 */ |
|
2456 |
|
2457 const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
2458 xmlns: "http://www.w3.org/2000/svg", |
|
2459 viewBox: "0 0 24 24" |
|
2460 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
2461 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" |
|
2462 })); |
|
2463 /* harmony default export */ var chevron_left = (chevronLeft); |
|
2464 |
|
2465 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js |
|
2466 |
|
2467 |
|
2468 /** |
|
2469 * WordPress dependencies |
|
2470 */ |
|
2471 |
|
2472 const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
2473 xmlns: "http://www.w3.org/2000/svg", |
|
2474 viewBox: "0 0 24 24" |
|
2475 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
2476 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" |
|
2477 })); |
|
2478 /* harmony default export */ var chevron_right = (chevronRight); |
|
2479 |
|
2480 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js |
|
2481 |
|
2482 |
|
2483 /** |
|
2484 * WordPress dependencies |
|
2485 */ |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 const PREFERENCES_MENU = 'preferences-menu'; |
|
2492 function PreferencesModalTabs(_ref) { |
|
2493 let { |
|
2494 sections |
|
2495 } = _ref; |
|
2496 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components |
|
2497 // between small and large viewports. |
|
2498 |
|
2499 const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU); |
|
2500 /** |
|
2501 * Create helper objects from `sections` for easier data handling. |
|
2502 * `tabs` is used for creating the `TabPanel` and `sectionsContentMap` |
|
2503 * is used for easier access to active tab's content. |
|
2504 */ |
|
2505 |
|
2506 const { |
|
2507 tabs, |
|
2508 sectionsContentMap |
|
2509 } = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
2510 let mappedTabs = { |
|
2511 tabs: [], |
|
2512 sectionsContentMap: {} |
|
2513 }; |
|
2514 |
|
2515 if (sections.length) { |
|
2516 mappedTabs = sections.reduce((accumulator, _ref2) => { |
|
2517 let { |
|
2518 name, |
|
2519 tabLabel: title, |
|
2520 content |
|
2521 } = _ref2; |
|
2522 accumulator.tabs.push({ |
|
2523 name, |
|
2524 title |
|
2525 }); |
|
2526 accumulator.sectionsContentMap[name] = content; |
|
2527 return accumulator; |
|
2528 }, { |
|
2529 tabs: [], |
|
2530 sectionsContentMap: {} |
|
2531 }); |
|
2532 } |
|
2533 |
|
2534 return mappedTabs; |
|
2535 }, [sections]); |
|
2536 const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]); |
|
2537 let modalContent; // We render different components based on the viewport size. |
|
2538 |
|
2539 if (isLargeViewport) { |
|
2540 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { |
|
2541 className: "interface-preferences__tabs", |
|
2542 tabs: tabs, |
|
2543 initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined, |
|
2544 onSelect: setActiveMenu, |
|
2545 orientation: "vertical" |
|
2546 }, getCurrentTab); |
|
2547 } else { |
|
2548 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { |
|
2549 initialPath: "/", |
|
2550 className: "interface-preferences__provider" |
|
2551 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { |
|
2552 path: "/" |
|
2553 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
2554 isBorderless: true, |
|
2555 size: "small" |
|
2556 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => { |
|
2557 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { |
|
2558 key: tab.name, |
|
2559 path: tab.name, |
|
2560 as: external_wp_components_namespaceObject.__experimentalItem, |
|
2561 isAction: true |
|
2562 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
2563 justify: "space-between" |
|
2564 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { |
|
2565 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
|
2566 })))); |
|
2567 }))))), sections.length && sections.map(section => { |
|
2568 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { |
|
2569 key: `${section.name}-menu`, |
|
2570 path: section.name |
|
2571 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
2572 isBorderless: true, |
|
2573 size: "large" |
|
2574 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, { |
|
2575 isBorderless: false, |
|
2576 justify: "left", |
|
2577 size: "small", |
|
2578 gap: "6" |
|
2579 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { |
|
2580 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, |
|
2581 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') |
|
2582 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
2583 size: "16" |
|
2584 }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content))); |
|
2585 })); |
|
2586 } |
|
2587 |
|
2588 return modalContent; |
|
2589 } |
|
2590 |
|
2591 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js |
|
2592 |
|
2593 |
|
2594 const Section = _ref => { |
|
2595 let { |
|
2596 description, |
|
2597 title, |
|
2598 children |
|
2599 } = _ref; |
|
2600 return (0,external_wp_element_namespaceObject.createElement)("fieldset", { |
|
2601 className: "interface-preferences-modal__section" |
|
2602 }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("h2", { |
|
2603 className: "interface-preferences-modal__section-title" |
|
2604 }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", { |
|
2605 className: "interface-preferences-modal__section-description" |
|
2606 }, description)), children); |
|
2607 }; |
|
2608 |
|
2609 /* harmony default export */ var preferences_modal_section = (Section); |
|
2610 |
|
2611 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js |
|
2612 |
|
2613 |
|
2614 /** |
|
2615 * WordPress dependencies |
|
2616 */ |
|
2617 |
|
2618 |
|
2619 function BaseOption(_ref) { |
|
2620 let { |
|
2621 help, |
|
2622 label, |
|
2623 isChecked, |
|
2624 onChange, |
|
2625 children |
|
2626 } = _ref; |
|
2627 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
2628 className: "interface-preferences-modal__option" |
|
2629 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { |
|
2630 help: help, |
|
2631 label: label, |
|
2632 checked: isChecked, |
|
2633 onChange: onChange |
|
2634 }), children); |
|
2635 } |
|
2636 |
|
2637 /* harmony default export */ var preferences_modal_base_option = (BaseOption); |
|
2638 |
|
2639 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js |
|
2654 |
|
2655 |
|
2656 |
|
2657 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
|
2658 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
|
2659 ;// CONCATENATED MODULE: external ["wp","a11y"] |
|
2660 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
|
2661 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js |
|
2662 /** |
|
2663 * Check if a template is revertable to its original theme-provided template file. |
|
2664 * |
|
2665 * @param {Object} template The template entity to check. |
|
2666 * @return {boolean} Whether the template is revertable. |
|
2667 */ |
|
2668 function isTemplateRevertable(template) { |
|
2669 if (!template) { |
|
2670 return false; |
|
2671 } |
|
2672 /* eslint-disable camelcase */ |
|
2673 |
|
2674 |
|
2675 return (template === null || template === void 0 ? void 0 : template.source) === 'custom' && (template === null || template === void 0 ? void 0 : template.has_theme_file); |
|
2676 /* eslint-enable camelcase */ |
|
2677 } |
|
2678 |
|
2679 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js |
|
2680 /** |
|
2681 * WordPress dependencies |
|
2682 */ |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 /** |
|
2695 * Internal dependencies |
|
2696 */ |
|
2697 |
|
2698 |
|
2699 |
|
2700 /** |
|
2701 * Dispatches an action that toggles a feature flag. |
|
2702 * |
|
2703 * @param {string} featureName Feature name. |
|
2704 */ |
|
2705 |
|
2706 function actions_toggleFeature(featureName) { |
|
2707 return function (_ref) { |
|
2708 let { |
|
2709 registry |
|
2710 } = _ref; |
|
2711 external_wp_deprecated_default()("select( 'core/edit-site' ).toggleFeature( featureName )", { |
|
2712 since: '6.0', |
|
2713 alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )" |
|
2714 }); |
|
2715 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); |
|
2716 }; |
|
2717 } |
|
2718 /** |
|
2719 * Action that changes the width of the editing canvas. |
|
2720 * |
|
2721 * @param {string} deviceType |
|
2722 * |
|
2723 * @return {Object} Action object. |
|
2724 */ |
|
2725 |
|
2726 function __experimentalSetPreviewDeviceType(deviceType) { |
|
2727 return { |
|
2728 type: 'SET_PREVIEW_DEVICE_TYPE', |
|
2729 deviceType |
|
2730 }; |
|
2731 } |
|
2732 /** |
|
2733 * Action that sets a template, optionally fetching it from REST API. |
|
2734 * |
|
2735 * @param {number} templateId The template ID. |
|
2736 * @param {string} templateSlug The template slug. |
|
2737 * @return {Object} Action object. |
|
2738 */ |
|
2739 |
|
2740 const setTemplate = (templateId, templateSlug) => async _ref2 => { |
|
2741 let { |
|
2742 dispatch, |
|
2743 registry |
|
2744 } = _ref2; |
|
2745 |
|
2746 if (!templateSlug) { |
|
2747 const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId); |
|
2748 templateSlug = template === null || template === void 0 ? void 0 : template.slug; |
|
2749 } |
|
2750 |
|
2751 dispatch({ |
|
2752 type: 'SET_TEMPLATE', |
|
2753 templateId, |
|
2754 page: { |
|
2755 context: { |
|
2756 templateSlug |
|
2757 } |
|
2758 } |
|
2759 }); |
|
2760 }; |
|
2761 /** |
|
2762 * Action that adds a new template and sets it as the current template. |
|
2763 * |
|
2764 * @param {Object} template The template. |
|
2765 * |
|
2766 * @return {Object} Action object used to set the current template. |
|
2767 */ |
|
2768 |
|
2769 const addTemplate = template => async _ref3 => { |
|
2770 let { |
|
2771 dispatch, |
|
2772 registry |
|
2773 } = _ref3; |
|
2774 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); |
|
2775 |
|
2776 if (template.content) { |
|
2777 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', 'wp_template', newTemplate.id, { |
|
2778 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) |
|
2779 }, { |
|
2780 undoIgnore: true |
|
2781 }); |
|
2782 } |
|
2783 |
|
2784 dispatch({ |
|
2785 type: 'SET_TEMPLATE', |
|
2786 templateId: newTemplate.id, |
|
2787 page: { |
|
2788 context: { |
|
2789 templateSlug: newTemplate.slug |
|
2790 } |
|
2791 } |
|
2792 }); |
|
2793 }; |
|
2794 /** |
|
2795 * Action that removes a template. |
|
2796 * |
|
2797 * @param {Object} template The template object. |
|
2798 */ |
|
2799 |
|
2800 const removeTemplate = template => async _ref4 => { |
|
2801 let { |
|
2802 registry |
|
2803 } = _ref4; |
|
2804 |
|
2805 try { |
|
2806 await registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', template.type, template.id, { |
|
2807 force: true |
|
2808 }); |
|
2809 const lastError = registry.select(external_wp_coreData_namespaceObject.store).getLastEntityDeleteError('postType', template.type, template.id); |
|
2810 |
|
2811 if (lastError) { |
|
2812 throw lastError; |
|
2813 } |
|
2814 |
|
2815 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
|
2816 /* translators: The template/part's name. */ |
|
2817 (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), template.title.rendered), { |
|
2818 type: 'snackbar' |
|
2819 }); |
|
2820 } catch (error) { |
|
2821 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.'); |
|
2822 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { |
|
2823 type: 'snackbar' |
|
2824 }); |
|
2825 } |
|
2826 }; |
|
2827 /** |
|
2828 * Action that sets a template part. |
|
2829 * |
|
2830 * @param {string} templatePartId The template part ID. |
|
2831 * |
|
2832 * @return {Object} Action object. |
|
2833 */ |
|
2834 |
|
2835 function setTemplatePart(templatePartId) { |
|
2836 return { |
|
2837 type: 'SET_TEMPLATE_PART', |
|
2838 templatePartId |
|
2839 }; |
|
2840 } |
|
2841 /** |
|
2842 * Action that sets the home template ID to the template ID of the page resolved |
|
2843 * from a given path. |
|
2844 * |
|
2845 * @param {number} homeTemplateId The template ID for the homepage. |
|
2846 */ |
|
2847 |
|
2848 function setHomeTemplateId(homeTemplateId) { |
|
2849 return { |
|
2850 type: 'SET_HOME_TEMPLATE', |
|
2851 homeTemplateId |
|
2852 }; |
|
2853 } |
|
2854 /** |
|
2855 * Resolves the template for a page and displays both. If no path is given, attempts |
|
2856 * to use the postId to generate a path like `?p=${ postId }`. |
|
2857 * |
|
2858 * @param {Object} page The page object. |
|
2859 * @param {string} page.type The page type. |
|
2860 * @param {string} page.slug The page slug. |
|
2861 * @param {string} page.path The page path. |
|
2862 * @param {Object} page.context The page context. |
|
2863 * |
|
2864 * @return {number} The resolved template ID for the page route. |
|
2865 */ |
|
2866 |
|
2867 const setPage = page => async _ref5 => { |
|
2868 var _page$context; |
|
2869 |
|
2870 let { |
|
2871 dispatch, |
|
2872 registry |
|
2873 } = _ref5; |
|
2874 |
|
2875 if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) { |
|
2876 const entity = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', page.context.postType || 'post', page.context.postId); // If the entity is undefined for some reason, path will resolve to "/" |
|
2877 |
|
2878 page.path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link); |
|
2879 } |
|
2880 |
|
2881 const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(page.path); |
|
2882 |
|
2883 if (!template) { |
|
2884 return; |
|
2885 } |
|
2886 |
|
2887 dispatch({ |
|
2888 type: 'SET_PAGE', |
|
2889 page: template.slug ? { ...page, |
|
2890 context: { ...page.context, |
|
2891 templateSlug: template.slug |
|
2892 } |
|
2893 } : page, |
|
2894 templateId: template.id |
|
2895 }); |
|
2896 return template.id; |
|
2897 }; |
|
2898 /** |
|
2899 * Action that sets the active navigation panel menu. |
|
2900 * |
|
2901 * @param {string} menu Menu prop of active menu. |
|
2902 * |
|
2903 * @return {Object} Action object. |
|
2904 */ |
|
2905 |
|
2906 function setNavigationPanelActiveMenu(menu) { |
|
2907 return { |
|
2908 type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU', |
|
2909 menu |
|
2910 }; |
|
2911 } |
|
2912 /** |
|
2913 * Opens the navigation panel and sets its active menu at the same time. |
|
2914 * |
|
2915 * @param {string} menu Identifies the menu to open. |
|
2916 */ |
|
2917 |
|
2918 function openNavigationPanelToMenu(menu) { |
|
2919 return { |
|
2920 type: 'OPEN_NAVIGATION_PANEL_TO_MENU', |
|
2921 menu |
|
2922 }; |
|
2923 } |
|
2924 /** |
|
2925 * Sets whether the navigation panel should be open. |
|
2926 * |
|
2927 * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It |
|
2928 * does not toggle the state, but sets it directly. |
|
2929 */ |
|
2930 |
|
2931 function setIsNavigationPanelOpened(isOpen) { |
|
2932 return { |
|
2933 type: 'SET_IS_NAVIGATION_PANEL_OPENED', |
|
2934 isOpen |
|
2935 }; |
|
2936 } |
|
2937 /** |
|
2938 * Opens or closes the inserter. |
|
2939 * |
|
2940 * @param {boolean|Object} value Whether the inserter should be |
|
2941 * opened (true) or closed (false). |
|
2942 * To specify an insertion point, |
|
2943 * use an object. |
|
2944 * @param {string} value.rootClientId The root client ID to insert at. |
|
2945 * @param {number} value.insertionIndex The index to insert at. |
|
2946 * |
|
2947 * @return {Object} Action object. |
|
2948 */ |
|
2949 |
|
2950 function setIsInserterOpened(value) { |
|
2951 return { |
|
2952 type: 'SET_IS_INSERTER_OPENED', |
|
2953 value |
|
2954 }; |
|
2955 } |
|
2956 /** |
|
2957 * Returns an action object used to update the settings. |
|
2958 * |
|
2959 * @param {Object} settings New settings. |
|
2960 * |
|
2961 * @return {Object} Action object. |
|
2962 */ |
|
2963 |
|
2964 function updateSettings(settings) { |
|
2965 return { |
|
2966 type: 'UPDATE_SETTINGS', |
|
2967 settings |
|
2968 }; |
|
2969 } |
|
2970 /** |
|
2971 * Sets whether the list view panel should be open. |
|
2972 * |
|
2973 * @param {boolean} isOpen If true, opens the list view. If false, closes it. |
|
2974 * It does not toggle the state, but sets it directly. |
|
2975 */ |
|
2976 |
|
2977 function setIsListViewOpened(isOpen) { |
|
2978 return { |
|
2979 type: 'SET_IS_LIST_VIEW_OPENED', |
|
2980 isOpen |
|
2981 }; |
|
2982 } |
|
2983 /** |
|
2984 * Reverts a template to its original theme-provided file. |
|
2985 * |
|
2986 * @param {Object} template The template to revert. |
|
2987 * @param {Object} [options] |
|
2988 * @param {boolean} [options.allowUndo] Whether to allow the user to undo |
|
2989 * reverting the template. Default true. |
|
2990 */ |
|
2991 |
|
2992 const revertTemplate = function (template) { |
|
2993 let { |
|
2994 allowUndo = true |
|
2995 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
2996 return async _ref6 => { |
|
2997 let { |
|
2998 registry |
|
2999 } = _ref6; |
|
3000 |
|
3001 if (!isTemplateRevertable(template)) { |
|
3002 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { |
|
3003 type: 'snackbar' |
|
3004 }); |
|
3005 return; |
|
3006 } |
|
3007 |
|
3008 try { |
|
3009 var _fileTemplate$content; |
|
3010 |
|
3011 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); |
|
3012 |
|
3013 if (!templateEntityConfig) { |
|
3014 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { |
|
3015 type: 'snackbar' |
|
3016 }); |
|
3017 return; |
|
3018 } |
|
3019 |
|
3020 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, { |
|
3021 context: 'edit', |
|
3022 source: 'theme' |
|
3023 }); |
|
3024 const fileTemplate = await external_wp_apiFetch_default()({ |
|
3025 path: fileTemplatePath |
|
3026 }); |
|
3027 |
|
3028 if (!fileTemplate) { |
|
3029 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { |
|
3030 type: 'snackbar' |
|
3031 }); |
|
3032 return; |
|
3033 } |
|
3034 |
|
3035 const serializeBlocks = _ref7 => { |
|
3036 let { |
|
3037 blocks: blocksForSerialization = [] |
|
3038 } = _ref7; |
|
3039 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); |
|
3040 }; |
|
3041 |
|
3042 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo |
|
3043 // the revert in the header toolbar correctly. |
|
3044 |
|
3045 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { |
|
3046 content: serializeBlocks, |
|
3047 // Required to make the `undo` behave correctly. |
|
3048 blocks: edited.blocks, |
|
3049 // Required to revert the blocks in the editor. |
|
3050 source: 'custom' // required to avoid turning the editor into a dirty state |
|
3051 |
|
3052 }, { |
|
3053 undoIgnore: true // Required to merge this edit with the last undo level. |
|
3054 |
|
3055 }); |
|
3056 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); |
|
3057 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { |
|
3058 content: serializeBlocks, |
|
3059 blocks, |
|
3060 source: 'theme' |
|
3061 }); |
|
3062 |
|
3063 if (allowUndo) { |
|
3064 const undoRevert = () => { |
|
3065 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { |
|
3066 content: serializeBlocks, |
|
3067 blocks: edited.blocks, |
|
3068 source: 'custom' |
|
3069 }); |
|
3070 }; |
|
3071 |
|
3072 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'), { |
|
3073 type: 'snackbar', |
|
3074 actions: [{ |
|
3075 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
|
3076 onClick: undoRevert |
|
3077 }] |
|
3078 }); |
|
3079 } else { |
|
3080 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.')); |
|
3081 } |
|
3082 } catch (error) { |
|
3083 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); |
|
3084 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { |
|
3085 type: 'snackbar' |
|
3086 }); |
|
3087 } |
|
3088 }; |
|
3089 }; |
|
3090 /** |
|
3091 * Action that opens an editor sidebar. |
|
3092 * |
|
3093 * @param {?string} name Sidebar name to be opened. |
|
3094 */ |
|
3095 |
|
3096 const openGeneralSidebar = name => _ref8 => { |
|
3097 let { |
|
3098 registry |
|
3099 } = _ref8; |
|
3100 registry.dispatch(store).enableComplementaryArea(STORE_NAME, name); |
|
3101 }; |
|
3102 /** |
|
3103 * Action that closes the sidebar. |
|
3104 */ |
|
3105 |
|
3106 const closeGeneralSidebar = () => _ref9 => { |
|
3107 let { |
|
3108 registry |
|
3109 } = _ref9; |
|
3110 registry.dispatch(store).disableComplementaryArea(STORE_NAME); |
|
3111 }; |
|
3112 const switchEditorMode = mode => _ref10 => { |
|
3113 let { |
|
3114 registry |
|
3115 } = _ref10; |
|
3116 registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode); // Unselect blocks when we switch to a non visual mode. |
|
3117 |
|
3118 if (mode !== 'visual') { |
|
3119 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); |
|
3120 } |
|
3121 |
|
3122 if (mode === 'visual') { |
|
3123 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); |
|
3124 } else if (mode === 'mosaic') { |
|
3125 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Mosaic view selected'), 'assertive'); |
|
3126 } |
|
3127 }; |
|
3128 |
|
3129 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
|
3130 |
|
3131 |
|
3132 var LEAF_KEY, hasWeakMap; |
|
3133 |
|
3134 /** |
|
3135 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
3136 * |
|
3137 * @type {Object} |
|
3138 */ |
|
3139 LEAF_KEY = {}; |
|
3140 |
|
3141 /** |
|
3142 * Whether environment supports WeakMap. |
|
3143 * |
|
3144 * @type {boolean} |
|
3145 */ |
|
3146 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
3147 |
|
3148 /** |
|
3149 * Returns the first argument as the sole entry in an array. |
|
3150 * |
|
3151 * @param {*} value Value to return. |
|
3152 * |
|
3153 * @return {Array} Value returned as entry in array. |
|
3154 */ |
|
3155 function arrayOf( value ) { |
|
3156 return [ value ]; |
|
3157 } |
|
3158 |
|
3159 /** |
|
3160 * Returns true if the value passed is object-like, or false otherwise. A value |
|
3161 * is object-like if it can support property assignment, e.g. object or array. |
|
3162 * |
|
3163 * @param {*} value Value to test. |
|
3164 * |
|
3165 * @return {boolean} Whether value is object-like. |
|
3166 */ |
|
3167 function isObjectLike( value ) { |
|
3168 return !! value && 'object' === typeof value; |
|
3169 } |
|
3170 |
|
3171 /** |
|
3172 * Creates and returns a new cache object. |
|
3173 * |
|
3174 * @return {Object} Cache object. |
|
3175 */ |
|
3176 function createCache() { |
|
3177 var cache = { |
|
3178 clear: function() { |
|
3179 cache.head = null; |
|
3180 }, |
|
3181 }; |
|
3182 |
|
3183 return cache; |
|
3184 } |
|
3185 |
|
3186 /** |
|
3187 * Returns true if entries within the two arrays are strictly equal by |
|
3188 * reference from a starting index. |
|
3189 * |
|
3190 * @param {Array} a First array. |
|
3191 * @param {Array} b Second array. |
|
3192 * @param {number} fromIndex Index from which to start comparison. |
|
3193 * |
|
3194 * @return {boolean} Whether arrays are shallowly equal. |
|
3195 */ |
|
3196 function isShallowEqual( a, b, fromIndex ) { |
|
3197 var i; |
|
3198 |
|
3199 if ( a.length !== b.length ) { |
|
3200 return false; |
|
3201 } |
|
3202 |
|
3203 for ( i = fromIndex; i < a.length; i++ ) { |
|
3204 if ( a[ i ] !== b[ i ] ) { |
|
3205 return false; |
|
3206 } |
|
3207 } |
|
3208 |
|
3209 return true; |
|
3210 } |
|
3211 |
|
3212 /** |
|
3213 * Returns a memoized selector function. The getDependants function argument is |
|
3214 * called before the memoized selector and is expected to return an immutable |
|
3215 * reference or array of references on which the selector depends for computing |
|
3216 * its own return value. The memoize cache is preserved only as long as those |
|
3217 * dependant references remain the same. If getDependants returns a different |
|
3218 * reference(s), the cache is cleared and the selector value regenerated. |
|
3219 * |
|
3220 * @param {Function} selector Selector function. |
|
3221 * @param {Function} getDependants Dependant getter returning an immutable |
|
3222 * reference or array of reference used in |
|
3223 * cache bust consideration. |
|
3224 * |
|
3225 * @return {Function} Memoized selector. |
|
3226 */ |
|
3227 /* harmony default export */ function rememo(selector, getDependants ) { |
|
3228 var rootCache, getCache; |
|
3229 |
|
3230 // Use object source as dependant if getter not provided |
|
3231 if ( ! getDependants ) { |
|
3232 getDependants = arrayOf; |
|
3233 } |
|
3234 |
|
3235 /** |
|
3236 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
3237 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
3238 * cache object. |
|
3239 * |
|
3240 * @return {(WeakMap|Object)} Root cache object. |
|
3241 */ |
|
3242 function getRootCache() { |
|
3243 return rootCache; |
|
3244 } |
|
3245 |
|
3246 /** |
|
3247 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
3248 * will be used to create a unique cache for each set of dependants. This |
|
3249 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
3250 * to occur on entries where the key object is no longer referenced. Since |
|
3251 * WeakMap requires the key to be an object, this is only possible when the |
|
3252 * dependant is object-like. The root cache is created as a hierarchy where |
|
3253 * each top-level key is the first entry in a dependants set, the value a |
|
3254 * WeakMap where each key is the next dependant, and so on. This continues |
|
3255 * so long as the dependants are object-like. If no dependants are object- |
|
3256 * like, then the cache is shared across all invocations. |
|
3257 * |
|
3258 * @see isObjectLike |
|
3259 * |
|
3260 * @param {Array} dependants Selector dependants. |
|
3261 * |
|
3262 * @return {Object} Cache object. |
|
3263 */ |
|
3264 function getWeakMapCache( dependants ) { |
|
3265 var caches = rootCache, |
|
3266 isUniqueByDependants = true, |
|
3267 i, dependant, map, cache; |
|
3268 |
|
3269 for ( i = 0; i < dependants.length; i++ ) { |
|
3270 dependant = dependants[ i ]; |
|
3271 |
|
3272 // Can only compose WeakMap from object-like key. |
|
3273 if ( ! isObjectLike( dependant ) ) { |
|
3274 isUniqueByDependants = false; |
|
3275 break; |
|
3276 } |
|
3277 |
|
3278 // Does current segment of cache already have a WeakMap? |
|
3279 if ( caches.has( dependant ) ) { |
|
3280 // Traverse into nested WeakMap. |
|
3281 caches = caches.get( dependant ); |
|
3282 } else { |
|
3283 // Create, set, and traverse into a new one. |
|
3284 map = new WeakMap(); |
|
3285 caches.set( dependant, map ); |
|
3286 caches = map; |
|
3287 } |
|
3288 } |
|
3289 |
|
3290 // We use an arbitrary (but consistent) object as key for the last item |
|
3291 // in the WeakMap to serve as our running cache. |
|
3292 if ( ! caches.has( LEAF_KEY ) ) { |
|
3293 cache = createCache(); |
|
3294 cache.isUniqueByDependants = isUniqueByDependants; |
|
3295 caches.set( LEAF_KEY, cache ); |
|
3296 } |
|
3297 |
|
3298 return caches.get( LEAF_KEY ); |
|
3299 } |
|
3300 |
|
3301 // Assign cache handler by availability of WeakMap |
|
3302 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
3303 |
|
3304 /** |
|
3305 * Resets root memoization cache. |
|
3306 */ |
|
3307 function clear() { |
|
3308 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
3309 } |
|
3310 |
|
3311 // eslint-disable-next-line jsdoc/check-param-names |
|
3312 /** |
|
3313 * The augmented selector call, considering first whether dependants have |
|
3314 * changed before passing it to underlying memoize function. |
|
3315 * |
|
3316 * @param {Object} source Source object for derivation. |
|
3317 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
3318 * |
|
3319 * @return {*} Selector result. |
|
3320 */ |
|
3321 function callSelector( /* source, ...extraArgs */ ) { |
|
3322 var len = arguments.length, |
|
3323 cache, node, i, args, dependants; |
|
3324 |
|
3325 // Create copy of arguments (avoid leaking deoptimization). |
|
3326 args = new Array( len ); |
|
3327 for ( i = 0; i < len; i++ ) { |
|
3328 args[ i ] = arguments[ i ]; |
|
3329 } |
|
3330 |
|
3331 dependants = getDependants.apply( null, args ); |
|
3332 cache = getCache( dependants ); |
|
3333 |
|
3334 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
3335 // of WeakMap support), shallow compare against last dependants and, if |
|
3336 // references have changed, destroy cache to recalculate result. |
|
3337 if ( ! cache.isUniqueByDependants ) { |
|
3338 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
3339 cache.clear(); |
|
3340 } |
|
3341 |
|
3342 cache.lastDependants = dependants; |
|
3343 } |
|
3344 |
|
3345 node = cache.head; |
|
3346 while ( node ) { |
|
3347 // Check whether node arguments match arguments |
|
3348 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
3349 node = node.next; |
|
3350 continue; |
|
3351 } |
|
3352 |
|
3353 // At this point we can assume we've found a match |
|
3354 |
|
3355 // Surface matched node to head if not already |
|
3356 if ( node !== cache.head ) { |
|
3357 // Adjust siblings to point to each other. |
|
3358 node.prev.next = node.next; |
|
3359 if ( node.next ) { |
|
3360 node.next.prev = node.prev; |
|
3361 } |
|
3362 |
|
3363 node.next = cache.head; |
|
3364 node.prev = null; |
|
3365 cache.head.prev = node; |
|
3366 cache.head = node; |
|
3367 } |
|
3368 |
|
3369 // Return immediately |
|
3370 return node.val; |
|
3371 } |
|
3372 |
|
3373 // No cached value found. Continue to insertion phase: |
|
3374 |
|
3375 node = { |
|
3376 // Generate the result from original function |
|
3377 val: selector.apply( null, args ), |
|
3378 }; |
|
3379 |
|
3380 // Avoid including the source object in the cache. |
|
3381 args[ 0 ] = null; |
|
3382 node.args = args; |
|
3383 |
|
3384 // Don't need to check whether node is already head, since it would |
|
3385 // have been returned above already if it was |
|
3386 |
|
3387 // Shift existing head down list |
|
3388 if ( cache.head ) { |
|
3389 cache.head.prev = node; |
|
3390 node.next = cache.head; |
|
3391 } |
|
3392 |
|
3393 cache.head = node; |
|
3394 |
|
3395 return node.val; |
|
3396 } |
|
3397 |
|
3398 callSelector.getDependants = getDependants; |
|
3399 callSelector.clear = clear; |
|
3400 clear(); |
|
3401 |
|
3402 return callSelector; |
|
3403 } |
|
3404 |
|
3405 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js |
|
3406 /** |
|
3407 * External dependencies |
|
3408 */ |
|
3409 |
|
3410 /** |
|
3411 * Internal dependencies |
|
3412 */ |
|
3413 |
|
3414 |
|
3415 function isTemplateSuperseded(slug, existingSlugs, showOnFront) { |
|
3416 if (!TEMPLATE_OVERRIDES[slug]) { |
|
3417 return false; |
|
3418 } // `home` template is unused if it is superseded by `front-page` |
|
3419 // or "show on front" is set to show a page rather than blog posts. |
|
3420 |
|
3421 |
|
3422 if (slug === 'home' && showOnFront !== 'posts') { |
|
3423 return true; |
|
3424 } |
|
3425 |
|
3426 return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront)); |
|
3427 } |
|
3428 function getTemplateLocation(slug) { |
|
3429 const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug); |
|
3430 |
|
3431 if (isTopLevelTemplate) { |
|
3432 return MENU_TEMPLATES; |
|
3433 } |
|
3434 |
|
3435 const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug); |
|
3436 |
|
3437 if (isGeneralTemplate) { |
|
3438 return MENU_TEMPLATES_GENERAL; |
|
3439 } |
|
3440 |
|
3441 const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix)); |
|
3442 |
|
3443 if (isPostsTemplate) { |
|
3444 return MENU_TEMPLATES_POSTS; |
|
3445 } |
|
3446 |
|
3447 const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix)); |
|
3448 |
|
3449 if (isPagesTemplate) { |
|
3450 return MENU_TEMPLATES_PAGES; |
|
3451 } |
|
3452 |
|
3453 return MENU_TEMPLATES_GENERAL; |
|
3454 } |
|
3455 function getUnusedTemplates(templates, showOnFront) { |
|
3456 const templateSlugs = map(templates, 'slug'); |
|
3457 const supersededTemplates = templates.filter(_ref => { |
|
3458 let { |
|
3459 slug |
|
3460 } = _ref; |
|
3461 return isTemplateSuperseded(slug, templateSlugs, showOnFront); |
|
3462 }); |
|
3463 return supersededTemplates; |
|
3464 } |
|
3465 function getTemplatesLocationMap(templates) { |
|
3466 return templates.reduce((obj, template) => { |
|
3467 obj[template.slug] = getTemplateLocation(template.slug); |
|
3468 return obj; |
|
3469 }, {}); |
|
3470 } |
|
3471 |
|
3472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js |
|
3473 /** |
|
3474 * External dependencies |
|
3475 */ |
|
3476 |
|
3477 |
|
3478 /** |
|
3479 * WordPress dependencies |
|
3480 */ |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 /** |
|
3490 * Internal dependencies |
|
3491 */ |
|
3492 |
|
3493 |
|
3494 |
|
3495 /** |
|
3496 * @typedef {'template'|'template_type'} TemplateType Template type. |
|
3497 */ |
|
3498 |
|
3499 /** |
|
3500 * Helper for getting a preference from the preferences store. |
|
3501 * |
|
3502 * This is only present so that `getSettings` doesn't need to be made a |
|
3503 * registry selector. |
|
3504 * |
|
3505 * It's unstable because the selector needs to be exported and so part of the |
|
3506 * public API to work. |
|
3507 */ |
|
3508 |
|
3509 const __unstableGetPreference = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, name) => select(external_wp_preferences_namespaceObject.store).get('core/edit-site', name)); |
|
3510 /** |
|
3511 * Returns whether the given feature is enabled or not. |
|
3512 * |
|
3513 * @param {Object} state Global application state. |
|
3514 * @param {string} featureName Feature slug. |
|
3515 * |
|
3516 * @return {boolean} Is active. |
|
3517 */ |
|
3518 |
|
3519 function selectors_isFeatureActive(state, featureName) { |
|
3520 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive`, { |
|
3521 since: '6.0', |
|
3522 alternative: `select( 'core/preferences' ).get` |
|
3523 }); |
|
3524 return !!__unstableGetPreference(state, featureName); |
|
3525 } |
|
3526 /** |
|
3527 * Returns the current editing canvas device type. |
|
3528 * |
|
3529 * @param {Object} state Global application state. |
|
3530 * |
|
3531 * @return {string} Device type. |
|
3532 */ |
|
3533 |
|
3534 function __experimentalGetPreviewDeviceType(state) { |
|
3535 return state.deviceType; |
|
3536 } |
|
3537 /** |
|
3538 * Returns whether the current user can create media or not. |
|
3539 * |
|
3540 * @param {Object} state Global application state. |
|
3541 * |
|
3542 * @return {Object} Whether the current user can create media or not. |
|
3543 */ |
|
3544 |
|
3545 const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => select(external_wp_coreData_namespaceObject.store).canUser('create', 'media')); |
|
3546 /** |
|
3547 * Returns any available Reusable blocks. |
|
3548 * |
|
3549 * @param {Object} state Global application state. |
|
3550 * |
|
3551 * @return {Array} The available reusable blocks. |
|
3552 */ |
|
3553 |
|
3554 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
|
3555 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; |
|
3556 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { |
|
3557 per_page: -1 |
|
3558 }) : []; |
|
3559 }); |
|
3560 /** |
|
3561 * Returns the settings, taking into account active features and permissions. |
|
3562 * |
|
3563 * @param {Object} state Global application state. |
|
3564 * @param {Function} setIsInserterOpen Setter for the open state of the global inserter. |
|
3565 * |
|
3566 * @return {Object} Settings. |
|
3567 */ |
|
3568 |
|
3569 const getSettings = rememo((state, setIsInserterOpen) => { |
|
3570 const settings = { ...state.settings, |
|
3571 outlineMode: true, |
|
3572 focusMode: !!__unstableGetPreference(state, 'focusMode'), |
|
3573 hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'), |
|
3574 keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'), |
|
3575 showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'), |
|
3576 __experimentalSetIsInserterOpened: setIsInserterOpen, |
|
3577 __experimentalReusableBlocks: getReusableBlocks(state), |
|
3578 __experimentalPreferPatternsOnRoot: 'wp_template' === getEditedPostType(state) |
|
3579 }; |
|
3580 const canUserCreateMedia = getCanUserCreateMedia(state); |
|
3581 |
|
3582 if (!canUserCreateMedia) { |
|
3583 return settings; |
|
3584 } |
|
3585 |
|
3586 settings.mediaUpload = _ref => { |
|
3587 let { |
|
3588 onError, |
|
3589 ...rest |
|
3590 } = _ref; |
|
3591 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ |
|
3592 wpAllowedMimeTypes: state.settings.allowedMimeTypes, |
|
3593 onError: _ref2 => { |
|
3594 let { |
|
3595 message |
|
3596 } = _ref2; |
|
3597 return onError(message); |
|
3598 }, |
|
3599 ...rest |
|
3600 }); |
|
3601 }; |
|
3602 |
|
3603 return settings; |
|
3604 }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]); |
|
3605 /** |
|
3606 * Returns the current home template ID. |
|
3607 * |
|
3608 * @param {Object} state Global application state. |
|
3609 * |
|
3610 * @return {number?} Home template ID. |
|
3611 */ |
|
3612 |
|
3613 function getHomeTemplateId(state) { |
|
3614 return state.homeTemplateId; |
|
3615 } |
|
3616 |
|
3617 function getCurrentEditedPost(state) { |
|
3618 return state.editedPost; |
|
3619 } |
|
3620 /** |
|
3621 * Returns the current edited post type (wp_template or wp_template_part). |
|
3622 * |
|
3623 * @param {Object} state Global application state. |
|
3624 * |
|
3625 * @return {TemplateType?} Template type. |
|
3626 */ |
|
3627 |
|
3628 |
|
3629 function getEditedPostType(state) { |
|
3630 return getCurrentEditedPost(state).type; |
|
3631 } |
|
3632 /** |
|
3633 * Returns the ID of the currently edited template or template part. |
|
3634 * |
|
3635 * @param {Object} state Global application state. |
|
3636 * |
|
3637 * @return {string?} Post ID. |
|
3638 */ |
|
3639 |
|
3640 function getEditedPostId(state) { |
|
3641 return getCurrentEditedPost(state).id; |
|
3642 } |
|
3643 /** |
|
3644 * Returns the current page object. |
|
3645 * |
|
3646 * @param {Object} state Global application state. |
|
3647 * |
|
3648 * @return {Object} Page. |
|
3649 */ |
|
3650 |
|
3651 function getPage(state) { |
|
3652 return getCurrentEditedPost(state).page; |
|
3653 } |
|
3654 /** |
|
3655 * Returns the active menu in the navigation panel. |
|
3656 * |
|
3657 * @param {Object} state Global application state. |
|
3658 * |
|
3659 * @return {string} Active menu. |
|
3660 */ |
|
3661 |
|
3662 function getNavigationPanelActiveMenu(state) { |
|
3663 return state.navigationPanel.menu; |
|
3664 } |
|
3665 /** |
|
3666 * Returns the current template or template part's corresponding |
|
3667 * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`. |
|
3668 * |
|
3669 * @param {Object} state Global application state. |
|
3670 * |
|
3671 * @return {string} The current template or template part's sub menu. |
|
3672 */ |
|
3673 |
|
3674 const getCurrentTemplateNavigationPanelSubMenu = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
|
3675 const templateType = getEditedPostType(state); |
|
3676 const templateId = getEditedPostId(state); |
|
3677 const template = templateId ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', templateType, templateId) : null; |
|
3678 |
|
3679 if (!template) { |
|
3680 return MENU_ROOT; |
|
3681 } |
|
3682 |
|
3683 if ('wp_template_part' === templateType) { |
|
3684 var _TEMPLATE_PARTS_SUB_M; |
|
3685 |
|
3686 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; |
|
3687 } |
|
3688 |
|
3689 const templates = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template'); |
|
3690 const showOnFront = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'site').show_on_front; |
|
3691 |
|
3692 if (isTemplateSuperseded(template.slug, (0,external_lodash_namespaceObject.map)(templates, 'slug'), showOnFront)) { |
|
3693 return MENU_TEMPLATES_UNUSED; |
|
3694 } |
|
3695 |
|
3696 return getTemplateLocation(template.slug); |
|
3697 }); |
|
3698 /** |
|
3699 * Returns the current opened/closed state of the navigation panel. |
|
3700 * |
|
3701 * @param {Object} state Global application state. |
|
3702 * |
|
3703 * @return {boolean} True if the navigation panel should be open; false if closed. |
|
3704 */ |
|
3705 |
|
3706 function isNavigationOpened(state) { |
|
3707 return state.navigationPanel.isOpen; |
|
3708 } |
|
3709 /** |
|
3710 * Returns the current opened/closed state of the inserter panel. |
|
3711 * |
|
3712 * @param {Object} state Global application state. |
|
3713 * |
|
3714 * @return {boolean} True if the inserter panel should be open; false if closed. |
|
3715 */ |
|
3716 |
|
3717 function isInserterOpened(state) { |
|
3718 return !!state.blockInserterPanel; |
|
3719 } |
|
3720 /** |
|
3721 * Get the insertion point for the inserter. |
|
3722 * |
|
3723 * @param {Object} state Global application state. |
|
3724 * |
|
3725 * @return {Object} The root client ID, index to insert at and starting filter value. |
|
3726 */ |
|
3727 |
|
3728 function __experimentalGetInsertionPoint(state) { |
|
3729 const { |
|
3730 rootClientId, |
|
3731 insertionIndex, |
|
3732 filterValue |
|
3733 } = state.blockInserterPanel; |
|
3734 return { |
|
3735 rootClientId, |
|
3736 insertionIndex, |
|
3737 filterValue |
|
3738 }; |
|
3739 } |
|
3740 /** |
|
3741 * Returns the current opened/closed state of the list view panel. |
|
3742 * |
|
3743 * @param {Object} state Global application state. |
|
3744 * |
|
3745 * @return {boolean} True if the list view panel should be open; false if closed. |
|
3746 */ |
|
3747 |
|
3748 function isListViewOpened(state) { |
|
3749 return state.listViewPanel; |
|
3750 } |
|
3751 /** |
|
3752 * Returns the template parts and their blocks for the current edited template. |
|
3753 * |
|
3754 * @param {Object} state Global application state. |
|
3755 * @return {Array} Template parts and their blocks in an array. |
|
3756 */ |
|
3757 |
|
3758 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
|
3759 var _template$blocks; |
|
3760 |
|
3761 const templateType = getEditedPostType(state); |
|
3762 const templateId = getEditedPostId(state); |
|
3763 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', templateType, templateId); |
|
3764 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', { |
|
3765 per_page: -1 |
|
3766 }); |
|
3767 const templatePartsById = (0,external_lodash_namespaceObject.keyBy)(templateParts, templatePart => templatePart.id); |
|
3768 return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)).map(block => { |
|
3769 const { |
|
3770 attributes: { |
|
3771 theme, |
|
3772 slug |
|
3773 } |
|
3774 } = block; |
|
3775 const templatePartId = `${theme}//${slug}`; |
|
3776 const templatePart = templatePartsById[templatePartId]; |
|
3777 return { |
|
3778 templatePart, |
|
3779 block |
|
3780 }; |
|
3781 }).filter(_ref3 => { |
|
3782 let { |
|
3783 templatePart |
|
3784 } = _ref3; |
|
3785 return !!templatePart; |
|
3786 }); |
|
3787 }); |
|
3788 /** |
|
3789 * Returns the current editing mode. |
|
3790 * |
|
3791 * @param {Object} state Global application state. |
|
3792 * |
|
3793 * @return {string} Editing mode. |
|
3794 */ |
|
3795 |
|
3796 function getEditorMode(state) { |
|
3797 return __unstableGetPreference(state, 'editorMode'); |
|
3798 } |
|
3799 |
|
3800 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js |
|
3801 /** |
|
3802 * WordPress dependencies |
|
3803 */ |
|
3804 |
|
3805 /** |
|
3806 * Internal dependencies |
|
3807 */ |
|
3808 |
|
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 const storeConfig = { |
|
3814 reducer: reducer, |
|
3815 actions: store_actions_namespaceObject, |
|
3816 selectors: store_selectors_namespaceObject |
|
3817 }; |
|
3818 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); |
|
3819 (0,external_wp_data_namespaceObject.register)(store_store); |
|
3820 |
|
3821 ;// CONCATENATED MODULE: ./node_modules/history/index.js |
|
3822 |
|
3823 |
|
3824 /** |
|
3825 * Actions represent the type of change to a location value. |
|
3826 * |
|
3827 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action |
|
3828 */ |
|
3829 var Action; |
|
3830 |
|
3831 (function (Action) { |
|
3832 /** |
|
3833 * A POP indicates a change to an arbitrary index in the history stack, such |
|
3834 * as a back or forward navigation. It does not describe the direction of the |
|
3835 * navigation, only that the current index changed. |
|
3836 * |
|
3837 * Note: This is the default action for newly created history objects. |
|
3838 */ |
|
3839 Action["Pop"] = "POP"; |
|
3840 /** |
|
3841 * A PUSH indicates a new entry being added to the history stack, such as when |
|
3842 * a link is clicked and a new page loads. When this happens, all subsequent |
|
3843 * entries in the stack are lost. |
|
3844 */ |
|
3845 |
|
3846 Action["Push"] = "PUSH"; |
|
3847 /** |
|
3848 * A REPLACE indicates the entry at the current index in the history stack |
|
3849 * being replaced by a new one. |
|
3850 */ |
|
3851 |
|
3852 Action["Replace"] = "REPLACE"; |
|
3853 })(Action || (Action = {})); |
|
3854 |
|
3855 var readOnly = false ? 0 : function (obj) { |
|
3856 return obj; |
|
3857 }; |
|
3858 |
|
3859 function warning(cond, message) { |
|
3860 if (!cond) { |
|
3861 // eslint-disable-next-line no-console |
|
3862 if (typeof console !== 'undefined') console.warn(message); |
|
3863 |
|
3864 try { |
|
3865 // Welcome to debugging history! |
|
3866 // |
|
3867 // This error is thrown as a convenience so you can more easily |
|
3868 // find the source for a warning that appears in the console by |
|
3869 // enabling "pause on exceptions" in your JavaScript debugger. |
|
3870 throw new Error(message); // eslint-disable-next-line no-empty |
|
3871 } catch (e) {} |
|
3872 } |
|
3873 } |
|
3874 |
|
3875 var BeforeUnloadEventType = 'beforeunload'; |
|
3876 var HashChangeEventType = 'hashchange'; |
|
3877 var PopStateEventType = 'popstate'; |
|
3878 /** |
|
3879 * Browser history stores the location in regular URLs. This is the standard for |
|
3880 * most web apps, but it requires some configuration on the server to ensure you |
|
3881 * serve the same app at multiple URLs. |
|
3882 * |
|
3883 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory |
|
3884 */ |
|
3885 |
|
3886 function createBrowserHistory(options) { |
|
3887 if (options === void 0) { |
|
3888 options = {}; |
|
3889 } |
|
3890 |
|
3891 var _options = options, |
|
3892 _options$window = _options.window, |
|
3893 window = _options$window === void 0 ? document.defaultView : _options$window; |
|
3894 var globalHistory = window.history; |
|
3895 |
|
3896 function getIndexAndLocation() { |
|
3897 var _window$location = window.location, |
|
3898 pathname = _window$location.pathname, |
|
3899 search = _window$location.search, |
|
3900 hash = _window$location.hash; |
|
3901 var state = globalHistory.state || {}; |
|
3902 return [state.idx, readOnly({ |
|
3903 pathname: pathname, |
|
3904 search: search, |
|
3905 hash: hash, |
|
3906 state: state.usr || null, |
|
3907 key: state.key || 'default' |
|
3908 })]; |
|
3909 } |
|
3910 |
|
3911 var blockedPopTx = null; |
|
3912 |
|
3913 function handlePop() { |
|
3914 if (blockedPopTx) { |
|
3915 blockers.call(blockedPopTx); |
|
3916 blockedPopTx = null; |
|
3917 } else { |
|
3918 var nextAction = Action.Pop; |
|
3919 |
|
3920 var _getIndexAndLocation = getIndexAndLocation(), |
|
3921 nextIndex = _getIndexAndLocation[0], |
|
3922 nextLocation = _getIndexAndLocation[1]; |
|
3923 |
|
3924 if (blockers.length) { |
|
3925 if (nextIndex != null) { |
|
3926 var delta = index - nextIndex; |
|
3927 |
|
3928 if (delta) { |
|
3929 // Revert the POP |
|
3930 blockedPopTx = { |
|
3931 action: nextAction, |
|
3932 location: nextLocation, |
|
3933 retry: function retry() { |
|
3934 go(delta * -1); |
|
3935 } |
|
3936 }; |
|
3937 go(delta); |
|
3938 } |
|
3939 } else { |
|
3940 // Trying to POP to a location with no index. We did not create |
|
3941 // this location, so we can't effectively block the navigation. |
|
3942 false ? 0 : void 0; |
|
3943 } |
|
3944 } else { |
|
3945 applyTx(nextAction); |
|
3946 } |
|
3947 } |
|
3948 } |
|
3949 |
|
3950 window.addEventListener(PopStateEventType, handlePop); |
|
3951 var action = Action.Pop; |
|
3952 |
|
3953 var _getIndexAndLocation2 = getIndexAndLocation(), |
|
3954 index = _getIndexAndLocation2[0], |
|
3955 location = _getIndexAndLocation2[1]; |
|
3956 |
|
3957 var listeners = createEvents(); |
|
3958 var blockers = createEvents(); |
|
3959 |
|
3960 if (index == null) { |
|
3961 index = 0; |
|
3962 globalHistory.replaceState(extends_extends({}, globalHistory.state, { |
|
3963 idx: index |
|
3964 }), ''); |
|
3965 } |
|
3966 |
|
3967 function createHref(to) { |
|
3968 return typeof to === 'string' ? to : createPath(to); |
|
3969 } // state defaults to `null` because `window.history.state` does |
|
3970 |
|
3971 |
|
3972 function getNextLocation(to, state) { |
|
3973 if (state === void 0) { |
|
3974 state = null; |
|
3975 } |
|
3976 |
|
3977 return readOnly(extends_extends({ |
|
3978 pathname: location.pathname, |
|
3979 hash: '', |
|
3980 search: '' |
|
3981 }, typeof to === 'string' ? parsePath(to) : to, { |
|
3982 state: state, |
|
3983 key: createKey() |
|
3984 })); |
|
3985 } |
|
3986 |
|
3987 function getHistoryStateAndUrl(nextLocation, index) { |
|
3988 return [{ |
|
3989 usr: nextLocation.state, |
|
3990 key: nextLocation.key, |
|
3991 idx: index |
|
3992 }, createHref(nextLocation)]; |
|
3993 } |
|
3994 |
|
3995 function allowTx(action, location, retry) { |
|
3996 return !blockers.length || (blockers.call({ |
|
3997 action: action, |
|
3998 location: location, |
|
3999 retry: retry |
|
4000 }), false); |
|
4001 } |
|
4002 |
|
4003 function applyTx(nextAction) { |
|
4004 action = nextAction; |
|
4005 |
|
4006 var _getIndexAndLocation3 = getIndexAndLocation(); |
|
4007 |
|
4008 index = _getIndexAndLocation3[0]; |
|
4009 location = _getIndexAndLocation3[1]; |
|
4010 listeners.call({ |
|
4011 action: action, |
|
4012 location: location |
|
4013 }); |
|
4014 } |
|
4015 |
|
4016 function push(to, state) { |
|
4017 var nextAction = Action.Push; |
|
4018 var nextLocation = getNextLocation(to, state); |
|
4019 |
|
4020 function retry() { |
|
4021 push(to, state); |
|
4022 } |
|
4023 |
|
4024 if (allowTx(nextAction, nextLocation, retry)) { |
|
4025 var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), |
|
4026 historyState = _getHistoryStateAndUr[0], |
|
4027 url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading |
|
4028 // try...catch because iOS limits us to 100 pushState calls :/ |
|
4029 |
|
4030 |
|
4031 try { |
|
4032 globalHistory.pushState(historyState, '', url); |
|
4033 } catch (error) { |
|
4034 // They are going to lose state here, but there is no real |
|
4035 // way to warn them about it since the page will refresh... |
|
4036 window.location.assign(url); |
|
4037 } |
|
4038 |
|
4039 applyTx(nextAction); |
|
4040 } |
|
4041 } |
|
4042 |
|
4043 function replace(to, state) { |
|
4044 var nextAction = Action.Replace; |
|
4045 var nextLocation = getNextLocation(to, state); |
|
4046 |
|
4047 function retry() { |
|
4048 replace(to, state); |
|
4049 } |
|
4050 |
|
4051 if (allowTx(nextAction, nextLocation, retry)) { |
|
4052 var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), |
|
4053 historyState = _getHistoryStateAndUr2[0], |
|
4054 url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading |
|
4055 |
|
4056 |
|
4057 globalHistory.replaceState(historyState, '', url); |
|
4058 applyTx(nextAction); |
|
4059 } |
|
4060 } |
|
4061 |
|
4062 function go(delta) { |
|
4063 globalHistory.go(delta); |
|
4064 } |
|
4065 |
|
4066 var history = { |
|
4067 get action() { |
|
4068 return action; |
|
4069 }, |
|
4070 |
|
4071 get location() { |
|
4072 return location; |
|
4073 }, |
|
4074 |
|
4075 createHref: createHref, |
|
4076 push: push, |
|
4077 replace: replace, |
|
4078 go: go, |
|
4079 back: function back() { |
|
4080 go(-1); |
|
4081 }, |
|
4082 forward: function forward() { |
|
4083 go(1); |
|
4084 }, |
|
4085 listen: function listen(listener) { |
|
4086 return listeners.push(listener); |
|
4087 }, |
|
4088 block: function block(blocker) { |
|
4089 var unblock = blockers.push(blocker); |
|
4090 |
|
4091 if (blockers.length === 1) { |
|
4092 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); |
|
4093 } |
|
4094 |
|
4095 return function () { |
|
4096 unblock(); // Remove the beforeunload listener so the document may |
|
4097 // still be salvageable in the pagehide event. |
|
4098 // See https://html.spec.whatwg.org/#unloading-documents |
|
4099 |
|
4100 if (!blockers.length) { |
|
4101 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); |
|
4102 } |
|
4103 }; |
|
4104 } |
|
4105 }; |
|
4106 return history; |
|
4107 } |
|
4108 /** |
|
4109 * Hash history stores the location in window.location.hash. This makes it ideal |
|
4110 * for situations where you don't want to send the location to the server for |
|
4111 * some reason, either because you do cannot configure it or the URL space is |
|
4112 * reserved for something else. |
|
4113 * |
|
4114 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory |
|
4115 */ |
|
4116 |
|
4117 function createHashHistory(options) { |
|
4118 if (options === void 0) { |
|
4119 options = {}; |
|
4120 } |
|
4121 |
|
4122 var _options2 = options, |
|
4123 _options2$window = _options2.window, |
|
4124 window = _options2$window === void 0 ? document.defaultView : _options2$window; |
|
4125 var globalHistory = window.history; |
|
4126 |
|
4127 function getIndexAndLocation() { |
|
4128 var _parsePath = parsePath(window.location.hash.substr(1)), |
|
4129 _parsePath$pathname = _parsePath.pathname, |
|
4130 pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname, |
|
4131 _parsePath$search = _parsePath.search, |
|
4132 search = _parsePath$search === void 0 ? '' : _parsePath$search, |
|
4133 _parsePath$hash = _parsePath.hash, |
|
4134 hash = _parsePath$hash === void 0 ? '' : _parsePath$hash; |
|
4135 |
|
4136 var state = globalHistory.state || {}; |
|
4137 return [state.idx, readOnly({ |
|
4138 pathname: pathname, |
|
4139 search: search, |
|
4140 hash: hash, |
|
4141 state: state.usr || null, |
|
4142 key: state.key || 'default' |
|
4143 })]; |
|
4144 } |
|
4145 |
|
4146 var blockedPopTx = null; |
|
4147 |
|
4148 function handlePop() { |
|
4149 if (blockedPopTx) { |
|
4150 blockers.call(blockedPopTx); |
|
4151 blockedPopTx = null; |
|
4152 } else { |
|
4153 var nextAction = Action.Pop; |
|
4154 |
|
4155 var _getIndexAndLocation4 = getIndexAndLocation(), |
|
4156 nextIndex = _getIndexAndLocation4[0], |
|
4157 nextLocation = _getIndexAndLocation4[1]; |
|
4158 |
|
4159 if (blockers.length) { |
|
4160 if (nextIndex != null) { |
|
4161 var delta = index - nextIndex; |
|
4162 |
|
4163 if (delta) { |
|
4164 // Revert the POP |
|
4165 blockedPopTx = { |
|
4166 action: nextAction, |
|
4167 location: nextLocation, |
|
4168 retry: function retry() { |
|
4169 go(delta * -1); |
|
4170 } |
|
4171 }; |
|
4172 go(delta); |
|
4173 } |
|
4174 } else { |
|
4175 // Trying to POP to a location with no index. We did not create |
|
4176 // this location, so we can't effectively block the navigation. |
|
4177 false ? 0 : void 0; |
|
4178 } |
|
4179 } else { |
|
4180 applyTx(nextAction); |
|
4181 } |
|
4182 } |
|
4183 } |
|
4184 |
|
4185 window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge |
|
4186 // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event |
|
4187 |
|
4188 window.addEventListener(HashChangeEventType, function () { |
|
4189 var _getIndexAndLocation5 = getIndexAndLocation(), |
|
4190 nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events. |
|
4191 |
|
4192 |
|
4193 if (createPath(nextLocation) !== createPath(location)) { |
|
4194 handlePop(); |
|
4195 } |
|
4196 }); |
|
4197 var action = Action.Pop; |
|
4198 |
|
4199 var _getIndexAndLocation6 = getIndexAndLocation(), |
|
4200 index = _getIndexAndLocation6[0], |
|
4201 location = _getIndexAndLocation6[1]; |
|
4202 |
|
4203 var listeners = createEvents(); |
|
4204 var blockers = createEvents(); |
|
4205 |
|
4206 if (index == null) { |
|
4207 index = 0; |
|
4208 globalHistory.replaceState(_extends({}, globalHistory.state, { |
|
4209 idx: index |
|
4210 }), ''); |
|
4211 } |
|
4212 |
|
4213 function getBaseHref() { |
|
4214 var base = document.querySelector('base'); |
|
4215 var href = ''; |
|
4216 |
|
4217 if (base && base.getAttribute('href')) { |
|
4218 var url = window.location.href; |
|
4219 var hashIndex = url.indexOf('#'); |
|
4220 href = hashIndex === -1 ? url : url.slice(0, hashIndex); |
|
4221 } |
|
4222 |
|
4223 return href; |
|
4224 } |
|
4225 |
|
4226 function createHref(to) { |
|
4227 return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to)); |
|
4228 } |
|
4229 |
|
4230 function getNextLocation(to, state) { |
|
4231 if (state === void 0) { |
|
4232 state = null; |
|
4233 } |
|
4234 |
|
4235 return readOnly(_extends({ |
|
4236 pathname: location.pathname, |
|
4237 hash: '', |
|
4238 search: '' |
|
4239 }, typeof to === 'string' ? parsePath(to) : to, { |
|
4240 state: state, |
|
4241 key: createKey() |
|
4242 })); |
|
4243 } |
|
4244 |
|
4245 function getHistoryStateAndUrl(nextLocation, index) { |
|
4246 return [{ |
|
4247 usr: nextLocation.state, |
|
4248 key: nextLocation.key, |
|
4249 idx: index |
|
4250 }, createHref(nextLocation)]; |
|
4251 } |
|
4252 |
|
4253 function allowTx(action, location, retry) { |
|
4254 return !blockers.length || (blockers.call({ |
|
4255 action: action, |
|
4256 location: location, |
|
4257 retry: retry |
|
4258 }), false); |
|
4259 } |
|
4260 |
|
4261 function applyTx(nextAction) { |
|
4262 action = nextAction; |
|
4263 |
|
4264 var _getIndexAndLocation7 = getIndexAndLocation(); |
|
4265 |
|
4266 index = _getIndexAndLocation7[0]; |
|
4267 location = _getIndexAndLocation7[1]; |
|
4268 listeners.call({ |
|
4269 action: action, |
|
4270 location: location |
|
4271 }); |
|
4272 } |
|
4273 |
|
4274 function push(to, state) { |
|
4275 var nextAction = Action.Push; |
|
4276 var nextLocation = getNextLocation(to, state); |
|
4277 |
|
4278 function retry() { |
|
4279 push(to, state); |
|
4280 } |
|
4281 |
|
4282 false ? 0 : void 0; |
|
4283 |
|
4284 if (allowTx(nextAction, nextLocation, retry)) { |
|
4285 var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1), |
|
4286 historyState = _getHistoryStateAndUr3[0], |
|
4287 url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading |
|
4288 // try...catch because iOS limits us to 100 pushState calls :/ |
|
4289 |
|
4290 |
|
4291 try { |
|
4292 globalHistory.pushState(historyState, '', url); |
|
4293 } catch (error) { |
|
4294 // They are going to lose state here, but there is no real |
|
4295 // way to warn them about it since the page will refresh... |
|
4296 window.location.assign(url); |
|
4297 } |
|
4298 |
|
4299 applyTx(nextAction); |
|
4300 } |
|
4301 } |
|
4302 |
|
4303 function replace(to, state) { |
|
4304 var nextAction = Action.Replace; |
|
4305 var nextLocation = getNextLocation(to, state); |
|
4306 |
|
4307 function retry() { |
|
4308 replace(to, state); |
|
4309 } |
|
4310 |
|
4311 false ? 0 : void 0; |
|
4312 |
|
4313 if (allowTx(nextAction, nextLocation, retry)) { |
|
4314 var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index), |
|
4315 historyState = _getHistoryStateAndUr4[0], |
|
4316 url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading |
|
4317 |
|
4318 |
|
4319 globalHistory.replaceState(historyState, '', url); |
|
4320 applyTx(nextAction); |
|
4321 } |
|
4322 } |
|
4323 |
|
4324 function go(delta) { |
|
4325 globalHistory.go(delta); |
|
4326 } |
|
4327 |
|
4328 var history = { |
|
4329 get action() { |
|
4330 return action; |
|
4331 }, |
|
4332 |
|
4333 get location() { |
|
4334 return location; |
|
4335 }, |
|
4336 |
|
4337 createHref: createHref, |
|
4338 push: push, |
|
4339 replace: replace, |
|
4340 go: go, |
|
4341 back: function back() { |
|
4342 go(-1); |
|
4343 }, |
|
4344 forward: function forward() { |
|
4345 go(1); |
|
4346 }, |
|
4347 listen: function listen(listener) { |
|
4348 return listeners.push(listener); |
|
4349 }, |
|
4350 block: function block(blocker) { |
|
4351 var unblock = blockers.push(blocker); |
|
4352 |
|
4353 if (blockers.length === 1) { |
|
4354 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); |
|
4355 } |
|
4356 |
|
4357 return function () { |
|
4358 unblock(); // Remove the beforeunload listener so the document may |
|
4359 // still be salvageable in the pagehide event. |
|
4360 // See https://html.spec.whatwg.org/#unloading-documents |
|
4361 |
|
4362 if (!blockers.length) { |
|
4363 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); |
|
4364 } |
|
4365 }; |
|
4366 } |
|
4367 }; |
|
4368 return history; |
|
4369 } |
|
4370 /** |
|
4371 * Memory history stores the current location in memory. It is designed for use |
|
4372 * in stateful non-browser environments like tests and React Native. |
|
4373 * |
|
4374 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory |
|
4375 */ |
|
4376 |
|
4377 function createMemoryHistory(options) { |
|
4378 if (options === void 0) { |
|
4379 options = {}; |
|
4380 } |
|
4381 |
|
4382 var _options3 = options, |
|
4383 _options3$initialEntr = _options3.initialEntries, |
|
4384 initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr, |
|
4385 initialIndex = _options3.initialIndex; |
|
4386 var entries = initialEntries.map(function (entry) { |
|
4387 var location = readOnly(_extends({ |
|
4388 pathname: '/', |
|
4389 search: '', |
|
4390 hash: '', |
|
4391 state: null, |
|
4392 key: createKey() |
|
4393 }, typeof entry === 'string' ? parsePath(entry) : entry)); |
|
4394 false ? 0 : void 0; |
|
4395 return location; |
|
4396 }); |
|
4397 var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1); |
|
4398 var action = Action.Pop; |
|
4399 var location = entries[index]; |
|
4400 var listeners = createEvents(); |
|
4401 var blockers = createEvents(); |
|
4402 |
|
4403 function createHref(to) { |
|
4404 return typeof to === 'string' ? to : createPath(to); |
|
4405 } |
|
4406 |
|
4407 function getNextLocation(to, state) { |
|
4408 if (state === void 0) { |
|
4409 state = null; |
|
4410 } |
|
4411 |
|
4412 return readOnly(_extends({ |
|
4413 pathname: location.pathname, |
|
4414 search: '', |
|
4415 hash: '' |
|
4416 }, typeof to === 'string' ? parsePath(to) : to, { |
|
4417 state: state, |
|
4418 key: createKey() |
|
4419 })); |
|
4420 } |
|
4421 |
|
4422 function allowTx(action, location, retry) { |
|
4423 return !blockers.length || (blockers.call({ |
|
4424 action: action, |
|
4425 location: location, |
|
4426 retry: retry |
|
4427 }), false); |
|
4428 } |
|
4429 |
|
4430 function applyTx(nextAction, nextLocation) { |
|
4431 action = nextAction; |
|
4432 location = nextLocation; |
|
4433 listeners.call({ |
|
4434 action: action, |
|
4435 location: location |
|
4436 }); |
|
4437 } |
|
4438 |
|
4439 function push(to, state) { |
|
4440 var nextAction = Action.Push; |
|
4441 var nextLocation = getNextLocation(to, state); |
|
4442 |
|
4443 function retry() { |
|
4444 push(to, state); |
|
4445 } |
|
4446 |
|
4447 false ? 0 : void 0; |
|
4448 |
|
4449 if (allowTx(nextAction, nextLocation, retry)) { |
|
4450 index += 1; |
|
4451 entries.splice(index, entries.length, nextLocation); |
|
4452 applyTx(nextAction, nextLocation); |
|
4453 } |
|
4454 } |
|
4455 |
|
4456 function replace(to, state) { |
|
4457 var nextAction = Action.Replace; |
|
4458 var nextLocation = getNextLocation(to, state); |
|
4459 |
|
4460 function retry() { |
|
4461 replace(to, state); |
|
4462 } |
|
4463 |
|
4464 false ? 0 : void 0; |
|
4465 |
|
4466 if (allowTx(nextAction, nextLocation, retry)) { |
|
4467 entries[index] = nextLocation; |
|
4468 applyTx(nextAction, nextLocation); |
|
4469 } |
|
4470 } |
|
4471 |
|
4472 function go(delta) { |
|
4473 var nextIndex = clamp(index + delta, 0, entries.length - 1); |
|
4474 var nextAction = Action.Pop; |
|
4475 var nextLocation = entries[nextIndex]; |
|
4476 |
|
4477 function retry() { |
|
4478 go(delta); |
|
4479 } |
|
4480 |
|
4481 if (allowTx(nextAction, nextLocation, retry)) { |
|
4482 index = nextIndex; |
|
4483 applyTx(nextAction, nextLocation); |
|
4484 } |
|
4485 } |
|
4486 |
|
4487 var history = { |
|
4488 get index() { |
|
4489 return index; |
|
4490 }, |
|
4491 |
|
4492 get action() { |
|
4493 return action; |
|
4494 }, |
|
4495 |
|
4496 get location() { |
|
4497 return location; |
|
4498 }, |
|
4499 |
|
4500 createHref: createHref, |
|
4501 push: push, |
|
4502 replace: replace, |
|
4503 go: go, |
|
4504 back: function back() { |
|
4505 go(-1); |
|
4506 }, |
|
4507 forward: function forward() { |
|
4508 go(1); |
|
4509 }, |
|
4510 listen: function listen(listener) { |
|
4511 return listeners.push(listener); |
|
4512 }, |
|
4513 block: function block(blocker) { |
|
4514 return blockers.push(blocker); |
|
4515 } |
|
4516 }; |
|
4517 return history; |
|
4518 } //////////////////////////////////////////////////////////////////////////////// |
|
4519 // UTILS |
|
4520 //////////////////////////////////////////////////////////////////////////////// |
|
4521 |
|
4522 function clamp(n, lowerBound, upperBound) { |
|
4523 return Math.min(Math.max(n, lowerBound), upperBound); |
|
4524 } |
|
4525 |
|
4526 function promptBeforeUnload(event) { |
|
4527 // Cancel the event. |
|
4528 event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set. |
|
4529 |
|
4530 event.returnValue = ''; |
|
4531 } |
|
4532 |
|
4533 function createEvents() { |
|
4534 var handlers = []; |
|
4535 return { |
|
4536 get length() { |
|
4537 return handlers.length; |
|
4538 }, |
|
4539 |
|
4540 push: function push(fn) { |
|
4541 handlers.push(fn); |
|
4542 return function () { |
|
4543 handlers = handlers.filter(function (handler) { |
|
4544 return handler !== fn; |
|
4545 }); |
|
4546 }; |
|
4547 }, |
|
4548 call: function call(arg) { |
|
4549 handlers.forEach(function (fn) { |
|
4550 return fn && fn(arg); |
|
4551 }); |
|
4552 } |
|
4553 }; |
|
4554 } |
|
4555 |
|
4556 function createKey() { |
|
4557 return Math.random().toString(36).substr(2, 8); |
|
4558 } |
|
4559 /** |
|
4560 * Creates a string URL path from the given pathname, search, and hash components. |
|
4561 * |
|
4562 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath |
|
4563 */ |
|
4564 |
|
4565 |
|
4566 function createPath(_ref) { |
|
4567 var _ref$pathname = _ref.pathname, |
|
4568 pathname = _ref$pathname === void 0 ? '/' : _ref$pathname, |
|
4569 _ref$search = _ref.search, |
|
4570 search = _ref$search === void 0 ? '' : _ref$search, |
|
4571 _ref$hash = _ref.hash, |
|
4572 hash = _ref$hash === void 0 ? '' : _ref$hash; |
|
4573 if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search; |
|
4574 if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash; |
|
4575 return pathname; |
|
4576 } |
|
4577 /** |
|
4578 * Parses a string URL path into its separate pathname, search, and hash components. |
|
4579 * |
|
4580 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath |
|
4581 */ |
|
4582 |
|
4583 function parsePath(path) { |
|
4584 var parsedPath = {}; |
|
4585 |
|
4586 if (path) { |
|
4587 var hashIndex = path.indexOf('#'); |
|
4588 |
|
4589 if (hashIndex >= 0) { |
|
4590 parsedPath.hash = path.substr(hashIndex); |
|
4591 path = path.substr(0, hashIndex); |
|
4592 } |
|
4593 |
|
4594 var searchIndex = path.indexOf('?'); |
|
4595 |
|
4596 if (searchIndex >= 0) { |
|
4597 parsedPath.search = path.substr(searchIndex); |
|
4598 path = path.substr(0, searchIndex); |
|
4599 } |
|
4600 |
|
4601 if (path) { |
|
4602 parsedPath.pathname = path; |
|
4603 } |
|
4604 } |
|
4605 |
|
4606 return parsedPath; |
|
4607 } |
|
4608 |
|
4609 |
|
4610 |
|
4611 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/history.js |
|
4612 /** |
|
4613 * External dependencies |
|
4614 */ |
|
4615 |
|
4616 /** |
|
4617 * WordPress dependencies |
|
4618 */ |
|
4619 |
|
4620 |
|
4621 const history_history = createBrowserHistory(); |
|
4622 const originalHistoryPush = history_history.push; |
|
4623 const originalHistoryReplace = history_history.replace; |
|
4624 |
|
4625 function push(params, state) { |
|
4626 return originalHistoryPush.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); |
|
4627 } |
|
4628 |
|
4629 function replace(params, state) { |
|
4630 return originalHistoryReplace.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state); |
|
4631 } |
|
4632 |
|
4633 history_history.push = push; |
|
4634 history_history.replace = replace; |
|
4635 /* harmony default export */ var utils_history = (history_history); |
|
4636 |
|
4637 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/index.js |
|
4638 |
|
4639 |
|
4640 /** |
|
4641 * WordPress dependencies |
|
4642 */ |
|
4643 |
|
4644 /** |
|
4645 * Internal dependencies |
|
4646 */ |
|
4647 |
|
4648 |
|
4649 const RoutesContext = (0,external_wp_element_namespaceObject.createContext)(); |
|
4650 const HistoryContext = (0,external_wp_element_namespaceObject.createContext)(); |
|
4651 function useLocation() { |
|
4652 return (0,external_wp_element_namespaceObject.useContext)(RoutesContext); |
|
4653 } |
|
4654 function useHistory() { |
|
4655 return (0,external_wp_element_namespaceObject.useContext)(HistoryContext); |
|
4656 } |
|
4657 |
|
4658 function getLocationWithParams(location) { |
|
4659 const searchParams = new URLSearchParams(location.search); |
|
4660 return { ...location, |
|
4661 params: Object.fromEntries(searchParams.entries()) |
|
4662 }; |
|
4663 } |
|
4664 |
|
4665 function Routes(_ref) { |
|
4666 let { |
|
4667 children |
|
4668 } = _ref; |
|
4669 const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(utils_history.location)); |
|
4670 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
4671 return utils_history.listen(_ref2 => { |
|
4672 let { |
|
4673 location: updatedLocation |
|
4674 } = _ref2; |
|
4675 setLocation(getLocationWithParams(updatedLocation)); |
|
4676 }); |
|
4677 }, []); |
|
4678 return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, { |
|
4679 value: utils_history |
|
4680 }, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, { |
|
4681 value: location |
|
4682 }, children(location))); |
|
4683 } |
|
4684 |
|
4685 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] |
|
4686 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; |
|
4687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js |
|
4688 |
|
4689 |
|
4690 /** |
|
4691 * WordPress dependencies |
|
4692 */ |
|
4693 |
|
4694 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
4695 xmlns: "http://www.w3.org/2000/svg", |
|
4696 viewBox: "0 0 24 24" |
|
4697 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
4698 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" |
|
4699 })); |
|
4700 /* harmony default export */ var library_plus = (plus); |
|
4701 |
|
4702 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js |
|
4703 |
|
4704 |
|
4705 /** |
|
4706 * WordPress dependencies |
|
4707 */ |
|
4708 |
|
4709 const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
4710 viewBox: "0 0 24 24", |
|
4711 xmlns: "http://www.w3.org/2000/svg" |
|
4712 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
4713 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" |
|
4714 })); |
|
4715 /* harmony default export */ var list_view = (listView); |
|
4716 |
|
4717 ;// CONCATENATED MODULE: external ["wp","keycodes"] |
|
4718 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; |
|
4719 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js |
|
4720 |
|
4721 |
|
4722 /** |
|
4723 * WordPress dependencies |
|
4724 */ |
|
4725 |
|
4726 const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
4727 xmlns: "http://www.w3.org/2000/svg", |
|
4728 viewBox: "0 0 24 24" |
|
4729 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
4730 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" |
|
4731 })); |
|
4732 /* harmony default export */ var library_external = (external); |
|
4733 |
|
4734 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js |
|
4735 /** |
|
4736 * WordPress dependencies |
|
4737 */ |
|
4738 |
|
4739 const textFormattingShortcuts = [{ |
|
4740 keyCombination: { |
|
4741 modifier: 'primary', |
|
4742 character: 'b' |
|
4743 }, |
|
4744 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') |
|
4745 }, { |
|
4746 keyCombination: { |
|
4747 modifier: 'primary', |
|
4748 character: 'i' |
|
4749 }, |
|
4750 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') |
|
4751 }, { |
|
4752 keyCombination: { |
|
4753 modifier: 'primary', |
|
4754 character: 'k' |
|
4755 }, |
|
4756 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') |
|
4757 }, { |
|
4758 keyCombination: { |
|
4759 modifier: 'primaryShift', |
|
4760 character: 'k' |
|
4761 }, |
|
4762 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') |
|
4763 }, { |
|
4764 keyCombination: { |
|
4765 modifier: 'primary', |
|
4766 character: 'u' |
|
4767 }, |
|
4768 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') |
|
4769 }]; |
|
4770 |
|
4771 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js |
|
4772 |
|
4773 |
|
4774 /** |
|
4775 * External dependencies |
|
4776 */ |
|
4777 |
|
4778 /** |
|
4779 * WordPress dependencies |
|
4780 */ |
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 function KeyCombination(_ref) { |
|
4786 let { |
|
4787 keyCombination, |
|
4788 forceAriaLabel |
|
4789 } = _ref; |
|
4790 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
4791 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
4792 return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
|
4793 className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination", |
|
4794 "aria-label": forceAriaLabel || ariaLabel |
|
4795 }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => { |
|
4796 if (character === '+') { |
|
4797 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { |
|
4798 key: index |
|
4799 }, character); |
|
4800 } |
|
4801 |
|
4802 return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
|
4803 key: index, |
|
4804 className: "edit-site-keyboard-shortcut-help-modal__shortcut-key" |
|
4805 }, character); |
|
4806 })); |
|
4807 } |
|
4808 |
|
4809 function Shortcut(_ref2) { |
|
4810 let { |
|
4811 description, |
|
4812 keyCombination, |
|
4813 aliases = [], |
|
4814 ariaLabel |
|
4815 } = _ref2; |
|
4816 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4817 className: "edit-site-keyboard-shortcut-help-modal__shortcut-description" |
|
4818 }, description), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4819 className: "edit-site-keyboard-shortcut-help-modal__shortcut-term" |
|
4820 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
|
4821 keyCombination: keyCombination, |
|
4822 forceAriaLabel: ariaLabel |
|
4823 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
|
4824 keyCombination: alias, |
|
4825 forceAriaLabel: ariaLabel, |
|
4826 key: index |
|
4827 })))); |
|
4828 } |
|
4829 |
|
4830 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js |
|
4831 |
|
4832 |
|
4833 /** |
|
4834 * WordPress dependencies |
|
4835 */ |
|
4836 |
|
4837 |
|
4838 /** |
|
4839 * Internal dependencies |
|
4840 */ |
|
4841 |
|
4842 |
|
4843 function DynamicShortcut(_ref) { |
|
4844 let { |
|
4845 name |
|
4846 } = _ref; |
|
4847 const { |
|
4848 keyCombination, |
|
4849 description, |
|
4850 aliases |
|
4851 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4852 const { |
|
4853 getShortcutKeyCombination, |
|
4854 getShortcutDescription, |
|
4855 getShortcutAliases |
|
4856 } = select(external_wp_keyboardShortcuts_namespaceObject.store); |
|
4857 return { |
|
4858 keyCombination: getShortcutKeyCombination(name), |
|
4859 aliases: getShortcutAliases(name), |
|
4860 description: getShortcutDescription(name) |
|
4861 }; |
|
4862 }, [name]); |
|
4863 |
|
4864 if (!keyCombination) { |
|
4865 return null; |
|
4866 } |
|
4867 |
|
4868 return (0,external_wp_element_namespaceObject.createElement)(Shortcut, { |
|
4869 keyCombination: keyCombination, |
|
4870 description: description, |
|
4871 aliases: aliases |
|
4872 }); |
|
4873 } |
|
4874 |
|
4875 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js |
|
4876 |
|
4877 |
|
4878 /** |
|
4879 * External dependencies |
|
4880 */ |
|
4881 |
|
4882 |
|
4883 /** |
|
4884 * WordPress dependencies |
|
4885 */ |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 /** |
|
4892 * Internal dependencies |
|
4893 */ |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 const ShortcutList = _ref => { |
|
4900 let { |
|
4901 shortcuts |
|
4902 } = _ref; |
|
4903 return ( |
|
4904 /* |
|
4905 * Disable reason: The `list` ARIA role is redundant but |
|
4906 * Safari+VoiceOver won't announce the list otherwise. |
|
4907 */ |
|
4908 |
|
4909 /* eslint-disable jsx-a11y/no-redundant-roles */ |
|
4910 (0,external_wp_element_namespaceObject.createElement)("ul", { |
|
4911 className: "edit-site-keyboard-shortcut-help-modal__shortcut-list", |
|
4912 role: "list" |
|
4913 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { |
|
4914 className: "edit-site-keyboard-shortcut-help-modal__shortcut", |
|
4915 key: index |
|
4916 }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(DynamicShortcut, { |
|
4917 name: shortcut |
|
4918 }) : (0,external_wp_element_namespaceObject.createElement)(Shortcut, shortcut)))) |
|
4919 /* eslint-enable jsx-a11y/no-redundant-roles */ |
|
4920 |
|
4921 ); |
|
4922 }; |
|
4923 |
|
4924 const ShortcutSection = _ref2 => { |
|
4925 let { |
|
4926 title, |
|
4927 shortcuts, |
|
4928 className |
|
4929 } = _ref2; |
|
4930 return (0,external_wp_element_namespaceObject.createElement)("section", { |
|
4931 className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className) |
|
4932 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { |
|
4933 className: "edit-site-keyboard-shortcut-help-modal__section-title" |
|
4934 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { |
|
4935 shortcuts: shortcuts |
|
4936 })); |
|
4937 }; |
|
4938 |
|
4939 const ShortcutCategorySection = _ref3 => { |
|
4940 let { |
|
4941 title, |
|
4942 categoryName, |
|
4943 additionalShortcuts = [] |
|
4944 } = _ref3; |
|
4945 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4946 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); |
|
4947 }, [categoryName]); |
|
4948 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4949 title: title, |
|
4950 shortcuts: categoryShortcuts.concat(additionalShortcuts) |
|
4951 }); |
|
4952 }; |
|
4953 |
|
4954 function KeyboardShortcutHelpModal(_ref4) { |
|
4955 let { |
|
4956 isModalActive, |
|
4957 toggleModal |
|
4958 } = _ref4; |
|
4959 |
|
4960 if (!isModalActive) { |
|
4961 return null; |
|
4962 } |
|
4963 |
|
4964 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
4965 className: "edit-site-keyboard-shortcut-help-modal", |
|
4966 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), |
|
4967 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
4968 onRequestClose: toggleModal |
|
4969 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4970 className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts", |
|
4971 shortcuts: ['core/edit-site/keyboard-shortcuts'] |
|
4972 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4973 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), |
|
4974 categoryName: "global" |
|
4975 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4976 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), |
|
4977 categoryName: "selection" |
|
4978 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4979 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), |
|
4980 categoryName: "block", |
|
4981 additionalShortcuts: [{ |
|
4982 keyCombination: { |
|
4983 character: '/' |
|
4984 }, |
|
4985 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), |
|
4986 |
|
4987 /* translators: The forward-slash character. e.g. '/'. */ |
|
4988 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') |
|
4989 }] |
|
4990 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4991 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), |
|
4992 shortcuts: textFormattingShortcuts |
|
4993 })); |
|
4994 } |
|
4995 |
|
4996 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/enable-feature.js |
|
4997 |
|
4998 |
|
4999 |
|
5000 /** |
|
5001 * WordPress dependencies |
|
5002 */ |
|
5003 |
|
5004 |
|
5005 |
|
5006 function EnableFeature(props) { |
|
5007 const { |
|
5008 featureName, |
|
5009 ...remainingProps |
|
5010 } = props; |
|
5011 const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName), [featureName]); |
|
5012 const { |
|
5013 toggle |
|
5014 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
|
5015 |
|
5016 const onChange = () => toggle('core/edit-site', featureName); |
|
5017 |
|
5018 return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, extends_extends({ |
|
5019 onChange: onChange, |
|
5020 isChecked: isChecked |
|
5021 }, remainingProps)); |
|
5022 } |
|
5023 |
|
5024 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/index.js |
|
5025 |
|
5026 |
|
5027 /** |
|
5028 * WordPress dependencies |
|
5029 */ |
|
5030 |
|
5031 |
|
5032 |
|
5033 /** |
|
5034 * Internal dependencies |
|
5035 */ |
|
5036 |
|
5037 |
|
5038 function EditSitePreferencesModal(_ref) { |
|
5039 let { |
|
5040 isModalActive, |
|
5041 toggleModal |
|
5042 } = _ref; |
|
5043 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ |
|
5044 name: 'general', |
|
5045 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), |
|
5046 content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
5047 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), |
|
5048 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.') |
|
5049 }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { |
|
5050 featureName: "focusMode", |
|
5051 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), |
|
5052 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') |
|
5053 }), (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { |
|
5054 featureName: "showIconLabels", |
|
5055 label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), |
|
5056 help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons') |
|
5057 })) |
|
5058 }, { |
|
5059 name: 'blocks', |
|
5060 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), |
|
5061 content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
5062 title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'), |
|
5063 description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.') |
|
5064 }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, { |
|
5065 featureName: "keepCaretInsideBlock", |
|
5066 help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), |
|
5067 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') |
|
5068 })) |
|
5069 }]); |
|
5070 |
|
5071 if (!isModalActive) { |
|
5072 return null; |
|
5073 } |
|
5074 |
|
5075 return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, { |
|
5076 closeModal: toggleModal |
|
5077 }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, { |
|
5078 sections: sections |
|
5079 })); |
|
5080 } |
|
5081 |
|
5082 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/tools-more-menu-group/index.js |
|
5083 |
|
5084 |
|
5085 /** |
|
5086 * External dependencies |
|
5087 */ |
|
5088 |
|
5089 /** |
|
5090 * WordPress dependencies |
|
5091 */ |
|
5092 |
|
5093 |
|
5094 const { |
|
5095 Fill: ToolsMoreMenuGroup, |
|
5096 Slot |
|
5097 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup'); |
|
5098 |
|
5099 ToolsMoreMenuGroup.Slot = _ref => { |
|
5100 let { |
|
5101 fillProps |
|
5102 } = _ref; |
|
5103 return (0,external_wp_element_namespaceObject.createElement)(Slot, { |
|
5104 fillProps: fillProps |
|
5105 }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills); |
|
5106 }; |
|
5107 |
|
5108 /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); |
|
5109 |
|
5110 // EXTERNAL MODULE: ./node_modules/downloadjs/download.js |
|
5111 var download = __webpack_require__(8981); |
|
5112 var download_default = /*#__PURE__*/__webpack_require__.n(download); |
|
5113 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js |
|
5114 |
|
5115 |
|
5116 /** |
|
5117 * WordPress dependencies |
|
5118 */ |
|
5119 |
|
5120 const download_download = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5121 xmlns: "http://www.w3.org/2000/svg", |
|
5122 viewBox: "0 0 24 24" |
|
5123 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5124 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" |
|
5125 })); |
|
5126 /* harmony default export */ var library_download = (download_download); |
|
5127 |
|
5128 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/site-export.js |
|
5129 |
|
5130 |
|
5131 /** |
|
5132 * External dependencies |
|
5133 */ |
|
5134 |
|
5135 /** |
|
5136 * WordPress dependencies |
|
5137 */ |
|
5138 |
|
5139 |
|
5140 |
|
5141 |
|
5142 |
|
5143 |
|
5144 |
|
5145 function SiteExport() { |
|
5146 const { |
|
5147 createErrorNotice |
|
5148 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
5149 |
|
5150 async function handleExport() { |
|
5151 try { |
|
5152 const response = await external_wp_apiFetch_default()({ |
|
5153 path: '/wp-block-editor/v1/export', |
|
5154 parse: false |
|
5155 }); |
|
5156 const blob = await response.blob(); |
|
5157 const contentDisposition = response.headers.get('content-disposition'); |
|
5158 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); |
|
5159 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; |
|
5160 download_default()(blob, fileName + '.zip', 'application/zip'); |
|
5161 } catch (errorResponse) { |
|
5162 let error = {}; |
|
5163 |
|
5164 try { |
|
5165 error = await errorResponse.json(); |
|
5166 } catch (e) {} |
|
5167 |
|
5168 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); |
|
5169 createErrorNotice(errorMessage, { |
|
5170 type: 'snackbar' |
|
5171 }); |
|
5172 } |
|
5173 } |
|
5174 |
|
5175 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5176 role: "menuitem", |
|
5177 icon: library_download, |
|
5178 onClick: handleExport, |
|
5179 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.') |
|
5180 }, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item')); |
|
5181 } |
|
5182 |
|
5183 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/welcome-guide-menu-item.js |
|
5184 |
|
5185 |
|
5186 /** |
|
5187 * WordPress dependencies |
|
5188 */ |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 function WelcomeGuideMenuItem() { |
|
5194 const { |
|
5195 toggle |
|
5196 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
|
5197 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5198 onClick: () => toggle('core/edit-site', 'welcomeGuide') |
|
5199 }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')); |
|
5200 } |
|
5201 |
|
5202 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/copy-content-menu-item.js |
|
5203 |
|
5204 |
|
5205 /** |
|
5206 * WordPress dependencies |
|
5207 */ |
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 |
|
5215 /** |
|
5216 * Internal dependencies |
|
5217 */ |
|
5218 |
|
5219 |
|
5220 function CopyContentMenuItem() { |
|
5221 const { |
|
5222 createNotice |
|
5223 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
5224 const getText = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5225 return () => { |
|
5226 const { |
|
5227 getEditedPostId, |
|
5228 getEditedPostType |
|
5229 } = select(store_store); |
|
5230 const { |
|
5231 getEditedEntityRecord |
|
5232 } = select(external_wp_coreData_namespaceObject.store); |
|
5233 const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId()); |
|
5234 |
|
5235 if (record) { |
|
5236 if (typeof record.content === 'function') { |
|
5237 return record.content(record); |
|
5238 } else if (record.blocks) { |
|
5239 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); |
|
5240 } else if (record.content) { |
|
5241 return record.content; |
|
5242 } |
|
5243 } |
|
5244 |
|
5245 return ''; |
|
5246 }; |
|
5247 }, []); |
|
5248 |
|
5249 function onSuccess() { |
|
5250 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { |
|
5251 isDismissible: true, |
|
5252 type: 'snackbar' |
|
5253 }); |
|
5254 } |
|
5255 |
|
5256 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); |
|
5257 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5258 ref: ref |
|
5259 }, (0,external_wp_i18n_namespaceObject.__)('Copy all content')); |
|
5260 } |
|
5261 |
|
5262 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/mode-switcher/index.js |
|
5263 |
|
5264 |
|
5265 /** |
|
5266 * WordPress dependencies |
|
5267 */ |
|
5268 |
|
5269 |
|
5270 |
|
5271 |
|
5272 /** |
|
5273 * Internal dependencies |
|
5274 */ |
|
5275 |
|
5276 /** |
|
5277 * Internal dependencies |
|
5278 */ |
|
5279 |
|
5280 |
|
5281 /** |
|
5282 * Set of available mode options. |
|
5283 * |
|
5284 * @type {Array} |
|
5285 */ |
|
5286 |
|
5287 const MODES = [{ |
|
5288 value: 'visual', |
|
5289 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') |
|
5290 }, { |
|
5291 value: 'text', |
|
5292 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') |
|
5293 }]; |
|
5294 |
|
5295 function ModeSwitcher() { |
|
5296 const { |
|
5297 shortcut, |
|
5298 mode |
|
5299 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
5300 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'), |
|
5301 isRichEditingEnabled: select(store_store).getSettings().richEditingEnabled, |
|
5302 isCodeEditingEnabled: select(store_store).getSettings().codeEditingEnabled, |
|
5303 mode: select(store_store).getEditorMode() |
|
5304 }), []); |
|
5305 const { |
|
5306 switchEditorMode |
|
5307 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5308 const choices = MODES.map(choice => { |
|
5309 if (choice.value !== mode) { |
|
5310 return { ...choice, |
|
5311 shortcut |
|
5312 }; |
|
5313 } |
|
5314 |
|
5315 return choice; |
|
5316 }); |
|
5317 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5318 label: (0,external_wp_i18n_namespaceObject.__)('Editor') |
|
5319 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { |
|
5320 choices: choices, |
|
5321 value: mode, |
|
5322 onSelect: switchEditorMode |
|
5323 })); |
|
5324 } |
|
5325 |
|
5326 /* harmony default export */ var mode_switcher = (ModeSwitcher); |
|
5327 |
|
5328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/index.js |
|
5329 |
|
5330 |
|
5331 /** |
|
5332 * WordPress dependencies |
|
5333 */ |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 |
|
5342 /** |
|
5343 * Internal dependencies |
|
5344 */ |
|
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 function MoreMenu() { |
|
5354 const [isModalActive, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); |
|
5355 const [isPreferencesModalActive, togglePreferencesModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false); |
|
5356 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal); |
|
5357 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, _ref => { |
|
5358 let { |
|
5359 onClose |
|
5360 } = _ref; |
|
5361 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5362 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') |
|
5363 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
5364 scope: "core/edit-site", |
|
5365 name: "fixedToolbar", |
|
5366 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), |
|
5367 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), |
|
5368 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), |
|
5369 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') |
|
5370 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
5371 scope: "core/edit-site", |
|
5372 name: "focusMode", |
|
5373 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), |
|
5374 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), |
|
5375 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), |
|
5376 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') |
|
5377 }), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, { |
|
5378 name: "core/edit-site/plugin-more-menu", |
|
5379 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), |
|
5380 as: external_wp_components_namespaceObject.MenuGroup, |
|
5381 fillProps: { |
|
5382 onClick: onClose |
|
5383 } |
|
5384 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5385 label: (0,external_wp_i18n_namespaceObject.__)('Tools') |
|
5386 }, (0,external_wp_element_namespaceObject.createElement)(SiteExport, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5387 onClick: toggleModal, |
|
5388 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') |
|
5389 }, (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, { |
|
5390 icon: library_external, |
|
5391 role: "menuitem", |
|
5392 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/site-editor/'), |
|
5393 target: "_blank", |
|
5394 rel: "noopener noreferrer" |
|
5395 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
5396 as: "span" |
|
5397 }, |
|
5398 /* translators: accessibility text */ |
|
5399 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { |
|
5400 fillProps: { |
|
5401 onClose |
|
5402 } |
|
5403 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5404 onClick: togglePreferencesModal |
|
5405 }, (0,external_wp_i18n_namespaceObject.__)('Preferences')))); |
|
5406 }), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, { |
|
5407 isModalActive: isModalActive, |
|
5408 toggleModal: toggleModal |
|
5409 }), (0,external_wp_element_namespaceObject.createElement)(EditSitePreferencesModal, { |
|
5410 isModalActive: isPreferencesModalActive, |
|
5411 toggleModal: togglePreferencesModal |
|
5412 })); |
|
5413 } |
|
5414 |
|
5415 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js |
|
5416 |
|
5417 |
|
5418 /** |
|
5419 * External dependencies |
|
5420 */ |
|
5421 |
|
5422 /** |
|
5423 * WordPress dependencies |
|
5424 */ |
|
5425 |
|
5426 |
|
5427 |
|
5428 |
|
5429 |
|
5430 function SaveButton(_ref) { |
|
5431 let { |
|
5432 openEntitiesSavedStates, |
|
5433 isEntitiesSavedStatesOpen |
|
5434 } = _ref; |
|
5435 const { |
|
5436 isDirty, |
|
5437 isSaving |
|
5438 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5439 const { |
|
5440 __experimentalGetDirtyEntityRecords, |
|
5441 isSavingEntityRecord |
|
5442 } = select(external_wp_coreData_namespaceObject.store); |
|
5443 |
|
5444 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
|
5445 |
|
5446 return { |
|
5447 isDirty: dirtyEntityRecords.length > 0, |
|
5448 isSaving: (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key)) |
|
5449 }; |
|
5450 }, []); |
|
5451 const disabled = !isDirty || isSaving; |
|
5452 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5453 variant: "primary", |
|
5454 className: "edit-site-save-button__button", |
|
5455 "aria-disabled": disabled, |
|
5456 "aria-expanded": isEntitiesSavedStatesOpen, |
|
5457 disabled: disabled, |
|
5458 isBusy: isSaving, |
|
5459 onClick: disabled ? undefined : openEntitiesSavedStates |
|
5460 }, (0,external_wp_i18n_namespaceObject.__)('Save'))); |
|
5461 } |
|
5462 |
|
5463 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js |
|
5464 |
|
5465 |
|
5466 /** |
|
5467 * WordPress dependencies |
|
5468 */ |
|
5469 |
|
5470 const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5471 xmlns: "http://www.w3.org/2000/svg", |
|
5472 viewBox: "0 0 24 24" |
|
5473 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5474 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" |
|
5475 })); |
|
5476 /* harmony default export */ var library_undo = (undo); |
|
5477 |
|
5478 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js |
|
5479 |
|
5480 |
|
5481 /** |
|
5482 * WordPress dependencies |
|
5483 */ |
|
5484 |
|
5485 const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5486 xmlns: "http://www.w3.org/2000/svg", |
|
5487 viewBox: "0 0 24 24" |
|
5488 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5489 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" |
|
5490 })); |
|
5491 /* harmony default export */ var library_redo = (redo); |
|
5492 |
|
5493 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/undo.js |
|
5494 |
|
5495 |
|
5496 /** |
|
5497 * WordPress dependencies |
|
5498 */ |
|
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 function UndoButton() { |
|
5506 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []); |
|
5507 const { |
|
5508 undo |
|
5509 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
5510 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5511 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo, |
|
5512 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
|
5513 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this |
|
5514 // button, because it will remove focus for keyboard users. |
|
5515 // See: https://github.com/WordPress/gutenberg/issues/3486 |
|
5516 , |
|
5517 "aria-disabled": !hasUndo, |
|
5518 onClick: hasUndo ? undo : undefined |
|
5519 }); |
|
5520 } |
|
5521 |
|
5522 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/redo.js |
|
5523 |
|
5524 |
|
5525 /** |
|
5526 * WordPress dependencies |
|
5527 */ |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 function RedoButton() { |
|
5535 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []); |
|
5536 const { |
|
5537 redo |
|
5538 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
5539 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5540 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo, |
|
5541 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), |
|
5542 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this |
|
5543 // button, because it will remove focus for keyboard users. |
|
5544 // See: https://github.com/WordPress/gutenberg/issues/3486 |
|
5545 , |
|
5546 "aria-disabled": !hasRedo, |
|
5547 onClick: hasRedo ? redo : undefined |
|
5548 }); |
|
5549 } |
|
5550 |
|
5551 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js |
|
5552 |
|
5553 |
|
5554 /** |
|
5555 * WordPress dependencies |
|
5556 */ |
|
5557 |
|
5558 const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5559 viewBox: "0 0 24 24", |
|
5560 xmlns: "http://www.w3.org/2000/svg" |
|
5561 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5562 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" |
|
5563 })); |
|
5564 /* harmony default export */ var chevron_down = (chevronDown); |
|
5565 |
|
5566 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/document-actions/index.js |
|
5567 |
|
5568 |
|
5569 /** |
|
5570 * External dependencies |
|
5571 */ |
|
5572 |
|
5573 /** |
|
5574 * WordPress dependencies |
|
5575 */ |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 function getBlockDisplayText(block) { |
|
5586 if (block) { |
|
5587 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); |
|
5588 return blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, block.attributes) : null; |
|
5589 } |
|
5590 |
|
5591 return null; |
|
5592 } |
|
5593 |
|
5594 function useSecondaryText() { |
|
5595 const { |
|
5596 getBlock |
|
5597 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); |
|
5598 const activeEntityBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetActiveBlockIdByBlockNames(['core/template-part']), []); |
|
5599 |
|
5600 if (activeEntityBlockId) { |
|
5601 return { |
|
5602 label: getBlockDisplayText(getBlock(activeEntityBlockId)), |
|
5603 isActive: true |
|
5604 }; |
|
5605 } |
|
5606 |
|
5607 return {}; |
|
5608 } |
|
5609 /** |
|
5610 * @param {Object} props Props for the DocumentActions component. |
|
5611 * @param {string} props.entityTitle The title to display. |
|
5612 * @param {string} props.entityLabel A label to use for entity-related options. |
|
5613 * E.g. "template" would be used for "edit |
|
5614 * template" and "show template details". |
|
5615 * @param {boolean} props.isLoaded Whether the data is available. |
|
5616 * @param {Function} props.children React component to use for the |
|
5617 * information dropdown area. Should be a |
|
5618 * function which accepts dropdown props. |
|
5619 * @param {boolean} props.showIconLabels Whether buttons display icons or text labels. |
|
5620 */ |
|
5621 |
|
5622 |
|
5623 function DocumentActions(_ref) { |
|
5624 let { |
|
5625 entityTitle, |
|
5626 entityLabel, |
|
5627 isLoaded, |
|
5628 children: dropdownContent, |
|
5629 showIconLabels |
|
5630 } = _ref; |
|
5631 const { |
|
5632 label |
|
5633 } = useSecondaryText(); // The title ref is passed to the popover as the anchorRef so that the |
|
5634 // dropdown is centered over the whole title area rather than just one |
|
5635 // part of it. |
|
5636 |
|
5637 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); // Return a simple loading indicator until we have information to show. |
|
5638 |
|
5639 if (!isLoaded) { |
|
5640 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5641 className: "edit-site-document-actions" |
|
5642 }, (0,external_wp_i18n_namespaceObject.__)('Loading…')); |
|
5643 } // Return feedback that the template does not seem to exist. |
|
5644 |
|
5645 |
|
5646 if (!entityTitle) { |
|
5647 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5648 className: "edit-site-document-actions" |
|
5649 }, (0,external_wp_i18n_namespaceObject.__)('Template not found')); |
|
5650 } |
|
5651 |
|
5652 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5653 className: classnames_default()('edit-site-document-actions', { |
|
5654 'has-secondary-label': !!label |
|
5655 }) |
|
5656 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5657 ref: titleRef, |
|
5658 className: "edit-site-document-actions__title-wrapper" |
|
5659 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
5660 size: "body", |
|
5661 className: "edit-site-document-actions__title", |
|
5662 as: "h1" |
|
5663 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
5664 as: "span" |
|
5665 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
|
5666 /* translators: %s: the entity being edited, like "template"*/ |
|
5667 (0,external_wp_i18n_namespaceObject.__)('Editing %s: '), entityLabel)), entityTitle), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
5668 size: "body", |
|
5669 className: "edit-site-document-actions__secondary-item" |
|
5670 }, label !== null && label !== void 0 ? label : ''), dropdownContent && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
|
5671 popoverProps: { |
|
5672 anchorRef: titleRef.current |
|
5673 }, |
|
5674 position: "bottom center", |
|
5675 renderToggle: _ref2 => { |
|
5676 let { |
|
5677 isOpen, |
|
5678 onToggle |
|
5679 } = _ref2; |
|
5680 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5681 className: "edit-site-document-actions__get-info", |
|
5682 icon: chevron_down, |
|
5683 "aria-expanded": isOpen, |
|
5684 "aria-haspopup": "true", |
|
5685 onClick: onToggle, |
|
5686 label: (0,external_wp_i18n_namespaceObject.sprintf)( |
|
5687 /* translators: %s: the entity to see details about, like "template"*/ |
|
5688 (0,external_wp_i18n_namespaceObject.__)('Show %s details'), entityLabel) |
|
5689 }, showIconLabels && (0,external_wp_i18n_namespaceObject.__)('Details')); |
|
5690 }, |
|
5691 contentClassName: "edit-site-document-actions__info-dropdown", |
|
5692 renderContent: dropdownContent |
|
5693 }))); |
|
5694 } |
|
5695 |
|
5696 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js |
|
5697 |
|
5698 |
|
5699 |
|
5700 /** |
|
5701 * WordPress dependencies |
|
5702 */ |
|
5703 |
|
5704 /** |
|
5705 * Internal dependencies |
|
5706 */ |
|
5707 |
|
5708 |
|
5709 function useLink() { |
|
5710 let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
5711 let state = arguments.length > 1 ? arguments[1] : undefined; |
|
5712 let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
5713 const history = useHistory(); |
|
5714 |
|
5715 function onClick(event) { |
|
5716 event.preventDefault(); |
|
5717 |
|
5718 if (shouldReplace) { |
|
5719 history.replace(params, state); |
|
5720 } else { |
|
5721 history.push(params, state); |
|
5722 } |
|
5723 } |
|
5724 |
|
5725 return { |
|
5726 href: (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), |
|
5727 onClick |
|
5728 }; |
|
5729 } |
|
5730 function Link(_ref) { |
|
5731 let { |
|
5732 params = {}, |
|
5733 state, |
|
5734 replace: shouldReplace = false, |
|
5735 children, |
|
5736 ...props |
|
5737 } = _ref; |
|
5738 const { |
|
5739 href, |
|
5740 onClick |
|
5741 } = useLink(params, state, shouldReplace); |
|
5742 return (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({ |
|
5743 href: href, |
|
5744 onClick: onClick |
|
5745 }, props), children); |
|
5746 } |
|
5747 |
|
5748 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/template-areas.js |
|
5749 |
|
5750 |
|
5751 |
|
5752 /** |
|
5753 * WordPress dependencies |
|
5754 */ |
|
5755 |
|
5756 |
|
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 /** |
|
5762 * Internal dependencies |
|
5763 */ |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 function TemplatePartItemMore(_ref) { |
|
5771 var _templatePart$title; |
|
5772 |
|
5773 let { |
|
5774 onClose, |
|
5775 templatePart, |
|
5776 closeTemplateDetailsDropdown |
|
5777 } = _ref; |
|
5778 const { |
|
5779 revertTemplate |
|
5780 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5781 const { |
|
5782 params |
|
5783 } = useLocation(); |
|
5784 const editLinkProps = useLink({ |
|
5785 postId: templatePart.id, |
|
5786 postType: templatePart.type |
|
5787 }, { |
|
5788 fromTemplateId: params.postId |
|
5789 }); |
|
5790 |
|
5791 function editTemplatePart(event) { |
|
5792 editLinkProps.onClick(event); |
|
5793 onClose(); |
|
5794 closeTemplateDetailsDropdown(); |
|
5795 } |
|
5796 |
|
5797 function clearCustomizations() { |
|
5798 revertTemplate(templatePart); |
|
5799 onClose(); |
|
5800 closeTemplateDetailsDropdown(); |
|
5801 } |
|
5802 |
|
5803 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, { |
|
5804 onClick: editTemplatePart |
|
5805 }), (0,external_wp_i18n_namespaceObject.sprintf)( |
|
5806 /* translators: %s: template part title */ |
|
5807 (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, { |
|
5808 info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), |
|
5809 onClick: clearCustomizations |
|
5810 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')))); |
|
5811 } |
|
5812 |
|
5813 function TemplatePartItem(_ref2) { |
|
5814 let { |
|
5815 templatePart, |
|
5816 clientId, |
|
5817 closeTemplateDetailsDropdown |
|
5818 } = _ref2; |
|
5819 const { |
|
5820 selectBlock, |
|
5821 toggleBlockHighlight |
|
5822 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
5823 const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5824 const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); |
|
5825 |
|
5826 return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area); |
|
5827 }, [templatePart.area]); |
|
5828 |
|
5829 const highlightBlock = () => toggleBlockHighlight(clientId, true); |
|
5830 |
|
5831 const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); |
|
5832 |
|
5833 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5834 role: "menuitem", |
|
5835 className: "edit-site-template-details__template-areas-item" |
|
5836 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5837 role: "button", |
|
5838 icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, |
|
5839 iconPosition: "left", |
|
5840 onClick: () => { |
|
5841 selectBlock(clientId); |
|
5842 }, |
|
5843 onMouseOver: highlightBlock, |
|
5844 onMouseLeave: cancelHighlightBlock, |
|
5845 onFocus: highlightBlock, |
|
5846 onBlur: cancelHighlightBlock |
|
5847 }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
|
5848 icon: more_vertical, |
|
5849 label: (0,external_wp_i18n_namespaceObject.__)('More options'), |
|
5850 className: "edit-site-template-details__template-areas-item-more" |
|
5851 }, _ref3 => { |
|
5852 let { |
|
5853 onClose |
|
5854 } = _ref3; |
|
5855 return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItemMore, { |
|
5856 onClose: onClose, |
|
5857 templatePart: templatePart, |
|
5858 closeTemplateDetailsDropdown: closeTemplateDetailsDropdown |
|
5859 }); |
|
5860 })); |
|
5861 } |
|
5862 |
|
5863 function TemplateAreas(_ref4) { |
|
5864 let { |
|
5865 closeTemplateDetailsDropdown |
|
5866 } = _ref4; |
|
5867 const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); |
|
5868 |
|
5869 if (!templateParts.length) { |
|
5870 return null; |
|
5871 } |
|
5872 |
|
5873 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5874 label: (0,external_wp_i18n_namespaceObject.__)('Areas'), |
|
5875 className: "edit-site-template-details__group edit-site-template-details__template-areas" |
|
5876 }, templateParts.map(_ref5 => { |
|
5877 let { |
|
5878 templatePart, |
|
5879 block |
|
5880 } = _ref5; |
|
5881 return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItem, { |
|
5882 key: templatePart.slug, |
|
5883 clientId: block.clientId, |
|
5884 templatePart: templatePart, |
|
5885 closeTemplateDetailsDropdown: closeTemplateDetailsDropdown |
|
5886 }); |
|
5887 })); |
|
5888 } |
|
5889 |
|
5890 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/edit-template-title.js |
|
5891 |
|
5892 |
|
5893 /** |
|
5894 * WordPress dependencies |
|
5895 */ |
|
5896 |
|
5897 |
|
5898 |
|
5899 function EditTemplateTitle(_ref) { |
|
5900 let { |
|
5901 template |
|
5902 } = _ref; |
|
5903 const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', template.type, 'title', template.id); |
|
5904 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
5905 label: (0,external_wp_i18n_namespaceObject.__)('Title'), |
|
5906 value: title, |
|
5907 help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'), |
|
5908 onChange: newTitle => { |
|
5909 setTitle(newTitle || template.slug); |
|
5910 } |
|
5911 }); |
|
5912 } |
|
5913 |
|
5914 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/index.js |
|
5915 |
|
5916 |
|
5917 |
|
5918 /** |
|
5919 * WordPress dependencies |
|
5920 */ |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 /** |
|
5927 * Internal dependencies |
|
5928 */ |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 function TemplateDetails(_ref) { |
|
5937 let { |
|
5938 template, |
|
5939 onClose |
|
5940 } = _ref; |
|
5941 const { |
|
5942 title, |
|
5943 description |
|
5944 } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetTemplateInfo(template), []); |
|
5945 const { |
|
5946 revertTemplate |
|
5947 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5948 const templateSubMenu = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
5949 if ((template === null || template === void 0 ? void 0 : template.type) === 'wp_template') { |
|
5950 return { |
|
5951 title: (0,external_wp_i18n_namespaceObject.__)('templates'), |
|
5952 menu: MENU_TEMPLATES |
|
5953 }; |
|
5954 } |
|
5955 |
|
5956 return TEMPLATE_PARTS_SUB_MENUS.find(_ref2 => { |
|
5957 let { |
|
5958 area |
|
5959 } = _ref2; |
|
5960 return area === (template === null || template === void 0 ? void 0 : template.area); |
|
5961 }); |
|
5962 }, [template]); |
|
5963 const browseAllLinkProps = useLink({ |
|
5964 // TODO: We should update this to filter by template part's areas as well. |
|
5965 postType: template.type, |
|
5966 postId: undefined |
|
5967 }); // Only user-created and non-default templates can change the name. |
|
5968 |
|
5969 const canEditTitle = template.is_custom && !template.has_theme_file; |
|
5970 |
|
5971 if (!template) { |
|
5972 return null; |
|
5973 } |
|
5974 |
|
5975 const revert = () => { |
|
5976 revertTemplate(template); |
|
5977 onClose(); |
|
5978 }; |
|
5979 |
|
5980 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5981 className: "edit-site-template-details" |
|
5982 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5983 className: "edit-site-template-details__group" |
|
5984 }, canEditTitle ? (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, { |
|
5985 template: template |
|
5986 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
5987 level: 4, |
|
5988 weight: 600, |
|
5989 className: "edit-site-template-details__title" |
|
5990 }, title), description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
5991 size: "body", |
|
5992 className: "edit-site-template-details__description", |
|
5993 as: "p" |
|
5994 }, description)), (0,external_wp_element_namespaceObject.createElement)(TemplateAreas, { |
|
5995 closeTemplateDetailsDropdown: onClose |
|
5996 }), isTemplateRevertable(template) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5997 className: "edit-site-template-details__group edit-site-template-details__revert" |
|
5998 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5999 className: "edit-site-template-details__revert-button", |
|
6000 info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'), |
|
6001 onClick: revert |
|
6002 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({ |
|
6003 className: "edit-site-template-details__show-all-button" |
|
6004 }, browseAllLinkProps), (0,external_wp_i18n_namespaceObject.sprintf)( |
|
6005 /* translators: the template part's area name ("Headers", "Sidebars") or "templates". */ |
|
6006 (0,external_wp_i18n_namespaceObject.__)('Browse all %s'), templateSubMenu.title))); |
|
6007 } |
|
6008 |
|
6009 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/index.js |
|
6010 |
|
6011 |
|
6012 /** |
|
6013 * WordPress dependencies |
|
6014 */ |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 /** |
|
6027 * Internal dependencies |
|
6028 */ |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 const preventDefault = event => { |
|
6039 event.preventDefault(); |
|
6040 }; |
|
6041 |
|
6042 function Header(_ref) { |
|
6043 let { |
|
6044 openEntitiesSavedStates, |
|
6045 isEntitiesSavedStatesOpen, |
|
6046 showIconLabels |
|
6047 } = _ref; |
|
6048 const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); |
|
6049 const { |
|
6050 deviceType, |
|
6051 entityTitle, |
|
6052 template, |
|
6053 templateType, |
|
6054 isInserterOpen, |
|
6055 isListViewOpen, |
|
6056 listViewShortcut, |
|
6057 isLoaded, |
|
6058 isVisualMode |
|
6059 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
6060 const { |
|
6061 __experimentalGetPreviewDeviceType, |
|
6062 getEditedPostType, |
|
6063 getEditedPostId, |
|
6064 isInserterOpened, |
|
6065 isListViewOpened, |
|
6066 getEditorMode |
|
6067 } = select(store_store); |
|
6068 const { |
|
6069 getEditedEntityRecord |
|
6070 } = select(external_wp_coreData_namespaceObject.store); |
|
6071 const { |
|
6072 __experimentalGetTemplateInfo: getTemplateInfo |
|
6073 } = select(external_wp_editor_namespaceObject.store); |
|
6074 const { |
|
6075 getShortcutRepresentation |
|
6076 } = select(external_wp_keyboardShortcuts_namespaceObject.store); |
|
6077 const postType = getEditedPostType(); |
|
6078 const postId = getEditedPostId(); |
|
6079 const record = getEditedEntityRecord('postType', postType, postId); |
|
6080 |
|
6081 const _isLoaded = !!postId; |
|
6082 |
|
6083 return { |
|
6084 deviceType: __experimentalGetPreviewDeviceType(), |
|
6085 entityTitle: getTemplateInfo(record).title, |
|
6086 isLoaded: _isLoaded, |
|
6087 template: record, |
|
6088 templateType: postType, |
|
6089 isInserterOpen: isInserterOpened(), |
|
6090 isListViewOpen: isListViewOpened(), |
|
6091 listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'), |
|
6092 isVisualMode: getEditorMode() === 'visual' |
|
6093 }; |
|
6094 }, []); |
|
6095 const { |
|
6096 __experimentalSetPreviewDeviceType: setPreviewDeviceType, |
|
6097 setIsInserterOpened, |
|
6098 setIsListViewOpened |
|
6099 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
6100 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
|
6101 const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { |
|
6102 if (isInserterOpen) { |
|
6103 // Focusing the inserter button closes the inserter popover. |
|
6104 inserterButton.current.focus(); |
|
6105 } else { |
|
6106 setIsInserterOpened(true); |
|
6107 } |
|
6108 }, [isInserterOpen, setIsInserterOpened]); |
|
6109 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); |
|
6110 const isFocusMode = templateType === 'wp_template_part'; |
|
6111 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6112 className: "edit-site-header" |
|
6113 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6114 className: "edit-site-header_start" |
|
6115 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6116 className: "edit-site-header__toolbar" |
|
6117 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6118 ref: inserterButton, |
|
6119 variant: "primary", |
|
6120 isPressed: isInserterOpen, |
|
6121 className: "edit-site-header-toolbar__inserter-toggle", |
|
6122 disabled: !isVisualMode, |
|
6123 onMouseDown: preventDefault, |
|
6124 onClick: openInserter, |
|
6125 icon: library_plus, |
|
6126 label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button') |
|
6127 }, showIconLabels && (!isInserterOpen ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
6128 as: external_wp_blockEditor_namespaceObject.ToolSelector, |
|
6129 disabled: !isVisualMode |
|
6130 }), (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, { |
|
6131 className: "edit-site-header-toolbar__list-view-toggle", |
|
6132 disabled: !isVisualMode, |
|
6133 icon: list_view, |
|
6134 isPressed: isListViewOpen |
|
6135 /* translators: button label text should, if possible, be under 16 characters. */ |
|
6136 , |
|
6137 label: (0,external_wp_i18n_namespaceObject.__)('List View'), |
|
6138 onClick: toggleListView, |
|
6139 shortcut: listViewShortcut |
|
6140 })))), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6141 className: "edit-site-header_center" |
|
6142 }, (0,external_wp_element_namespaceObject.createElement)(DocumentActions, { |
|
6143 entityTitle: entityTitle, |
|
6144 entityLabel: templateType === 'wp_template_part' ? 'template part' : 'template', |
|
6145 isLoaded: isLoaded, |
|
6146 showIconLabels: showIconLabels |
|
6147 }, _ref2 => { |
|
6148 let { |
|
6149 onClose |
|
6150 } = _ref2; |
|
6151 return (0,external_wp_element_namespaceObject.createElement)(TemplateDetails, { |
|
6152 template: template, |
|
6153 onClose: onClose |
|
6154 }); |
|
6155 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6156 className: "edit-site-header_end" |
|
6157 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6158 className: "edit-site-header__actions" |
|
6159 }, !isFocusMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, { |
|
6160 deviceType: deviceType, |
|
6161 setDeviceType: setPreviewDeviceType |
|
6162 }), (0,external_wp_element_namespaceObject.createElement)(SaveButton, { |
|
6163 openEntitiesSavedStates: openEntitiesSavedStates, |
|
6164 isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen |
|
6165 }), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { |
|
6166 scope: "core/edit-site" |
|
6167 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null)))); |
|
6168 } |
|
6169 |
|
6170 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js |
|
6171 |
|
6172 |
|
6173 /** |
|
6174 * WordPress dependencies |
|
6175 */ |
|
6176 |
|
6177 const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6178 xmlns: "http://www.w3.org/2000/svg", |
|
6179 viewBox: "0 0 24 24" |
|
6180 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6181 fillRule: "evenodd", |
|
6182 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", |
|
6183 clipRule: "evenodd" |
|
6184 })); |
|
6185 /* harmony default export */ var library_cog = (cog); |
|
6186 |
|
6187 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/default-sidebar.js |
|
6188 |
|
6189 |
|
6190 /** |
|
6191 * WordPress dependencies |
|
6192 */ |
|
6193 |
|
6194 function default_sidebar_DefaultSidebar(_ref) { |
|
6195 let { |
|
6196 className, |
|
6197 identifier, |
|
6198 title, |
|
6199 icon, |
|
6200 children, |
|
6201 closeLabel, |
|
6202 header, |
|
6203 headerClassName, |
|
6204 panelClassName |
|
6205 } = _ref; |
|
6206 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(complementary_area, { |
|
6207 className: className, |
|
6208 scope: "core/edit-site", |
|
6209 identifier: identifier, |
|
6210 title: title, |
|
6211 icon: icon, |
|
6212 closeLabel: closeLabel, |
|
6213 header: header, |
|
6214 headerClassName: headerClassName, |
|
6215 panelClassName: panelClassName |
|
6216 }, children), (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { |
|
6217 scope: "core/edit-site", |
|
6218 identifier: identifier, |
|
6219 icon: icon |
|
6220 }, title)); |
|
6221 } |
|
6222 |
|
6223 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js |
|
6224 |
|
6225 |
|
6226 /** |
|
6227 * WordPress dependencies |
|
6228 */ |
|
6229 |
|
6230 const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6231 viewBox: "0 0 24 24", |
|
6232 xmlns: "http://www.w3.org/2000/svg" |
|
6233 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6234 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" |
|
6235 })); |
|
6236 /* harmony default export */ var library_styles = (styles); |
|
6237 |
|
6238 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js |
|
6239 |
|
6240 |
|
6241 |
|
6242 /** |
|
6243 * External dependencies |
|
6244 */ |
|
6245 |
|
6246 /** |
|
6247 * WordPress dependencies |
|
6248 */ |
|
6249 |
|
6250 |
|
6251 function IconWithCurrentColor(_ref) { |
|
6252 let { |
|
6253 className, |
|
6254 ...props |
|
6255 } = _ref; |
|
6256 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, extends_extends({ |
|
6257 className: classnames_default()(className, 'edit-site-global-styles-icon-with-current-color') |
|
6258 }, props)); |
|
6259 } |
|
6260 |
|
6261 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js |
|
6262 |
|
6263 |
|
6264 |
|
6265 /** |
|
6266 * WordPress dependencies |
|
6267 */ |
|
6268 |
|
6269 /** |
|
6270 * Internal dependencies |
|
6271 */ |
|
6272 |
|
6273 |
|
6274 |
|
6275 function GenericNavigationButton(_ref) { |
|
6276 let { |
|
6277 icon, |
|
6278 children, |
|
6279 ...props |
|
6280 } = _ref; |
|
6281 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, { |
|
6282 justify: "flex-start" |
|
6283 }, (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { |
|
6284 icon: icon, |
|
6285 size: 24 |
|
6286 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children); |
|
6287 } |
|
6288 |
|
6289 function NavigationButton(props) { |
|
6290 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, extends_extends({ |
|
6291 as: GenericNavigationButton |
|
6292 }, props)); |
|
6293 } |
|
6294 |
|
6295 function NavigationBackButton(props) { |
|
6296 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, extends_extends({ |
|
6297 as: GenericNavigationButton |
|
6298 }, props)); |
|
6299 } |
|
6300 |
|
6301 |
|
6302 |
|
6303 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js |
|
6304 |
|
6305 |
|
6306 /** |
|
6307 * WordPress dependencies |
|
6308 */ |
|
6309 |
|
6310 const typography = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6311 xmlns: "http://www.w3.org/2000/svg", |
|
6312 viewBox: "0 0 24 24" |
|
6313 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6314 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" |
|
6315 })); |
|
6316 /* harmony default export */ var library_typography = (typography); |
|
6317 |
|
6318 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js |
|
6319 |
|
6320 |
|
6321 /** |
|
6322 * WordPress dependencies |
|
6323 */ |
|
6324 |
|
6325 const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6326 viewBox: "0 0 24 24", |
|
6327 xmlns: "http://www.w3.org/2000/svg" |
|
6328 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6329 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" |
|
6330 })); |
|
6331 /* harmony default export */ var library_color = (color); |
|
6332 |
|
6333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js |
|
6334 |
|
6335 |
|
6336 /** |
|
6337 * WordPress dependencies |
|
6338 */ |
|
6339 |
|
6340 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6341 xmlns: "http://www.w3.org/2000/svg", |
|
6342 viewBox: "0 0 24 24" |
|
6343 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6344 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" |
|
6345 })); |
|
6346 /* harmony default export */ var library_layout = (layout); |
|
6347 |
|
6348 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js |
|
6349 /** |
|
6350 * External dependencies |
|
6351 */ |
|
6352 |
|
6353 /* Supporting data. */ |
|
6354 |
|
6355 const ROOT_BLOCK_NAME = 'root'; |
|
6356 const ROOT_BLOCK_SELECTOR = 'body'; |
|
6357 const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'])); |
|
6358 const PRESET_METADATA = [{ |
|
6359 path: ['color', 'palette'], |
|
6360 valueKey: 'color', |
|
6361 cssVarInfix: 'color', |
|
6362 classes: [{ |
|
6363 classSuffix: 'color', |
|
6364 propertyName: 'color' |
|
6365 }, { |
|
6366 classSuffix: 'background-color', |
|
6367 propertyName: 'background-color' |
|
6368 }, { |
|
6369 classSuffix: 'border-color', |
|
6370 propertyName: 'border-color' |
|
6371 }] |
|
6372 }, { |
|
6373 path: ['color', 'gradients'], |
|
6374 valueKey: 'gradient', |
|
6375 cssVarInfix: 'gradient', |
|
6376 classes: [{ |
|
6377 classSuffix: 'gradient-background', |
|
6378 propertyName: 'background' |
|
6379 }] |
|
6380 }, { |
|
6381 path: ['color', 'duotone'], |
|
6382 cssVarInfix: 'duotone', |
|
6383 valueFunc: _ref => { |
|
6384 let { |
|
6385 slug |
|
6386 } = _ref; |
|
6387 return `url( '#wp-duotone-${slug}' )`; |
|
6388 }, |
|
6389 classes: [] |
|
6390 }, { |
|
6391 path: ['typography', 'fontSizes'], |
|
6392 valueKey: 'size', |
|
6393 cssVarInfix: 'font-size', |
|
6394 classes: [{ |
|
6395 classSuffix: 'font-size', |
|
6396 propertyName: 'font-size' |
|
6397 }] |
|
6398 }, { |
|
6399 path: ['typography', 'fontFamilies'], |
|
6400 valueKey: 'fontFamily', |
|
6401 cssVarInfix: 'font-family', |
|
6402 classes: [{ |
|
6403 classSuffix: 'font-family', |
|
6404 propertyName: 'font-family' |
|
6405 }] |
|
6406 }]; |
|
6407 const STYLE_PATH_TO_CSS_VAR_INFIX = { |
|
6408 'color.background': 'color', |
|
6409 'color.text': 'color', |
|
6410 'elements.link.color.text': 'color', |
|
6411 'color.gradient': 'gradient', |
|
6412 'typography.fontSize': 'font-size', |
|
6413 'typography.fontFamily': 'font-family' |
|
6414 }; |
|
6415 |
|
6416 function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { |
|
6417 // Block presets take priority above root level presets. |
|
6418 const orderedPresetsByOrigin = [(0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, ...presetPath]), (0,external_lodash_namespaceObject.get)(features, presetPath)]; |
|
6419 |
|
6420 for (const presetByOrigin of orderedPresetsByOrigin) { |
|
6421 if (presetByOrigin) { |
|
6422 // Preset origins ordered by priority. |
|
6423 const origins = ['custom', 'theme', 'default']; |
|
6424 |
|
6425 for (const origin of origins) { |
|
6426 const presets = presetByOrigin[origin]; |
|
6427 |
|
6428 if (presets) { |
|
6429 const presetObject = (0,external_lodash_namespaceObject.find)(presets, preset => preset[presetProperty] === presetValueValue); |
|
6430 |
|
6431 if (presetObject) { |
|
6432 if (presetProperty === 'slug') { |
|
6433 return presetObject; |
|
6434 } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored. |
|
6435 |
|
6436 |
|
6437 const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug); |
|
6438 |
|
6439 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { |
|
6440 return presetObject; |
|
6441 } |
|
6442 |
|
6443 return undefined; |
|
6444 } |
|
6445 } |
|
6446 } |
|
6447 } |
|
6448 } |
|
6449 } |
|
6450 |
|
6451 function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { |
|
6452 if (!presetPropertyValue) { |
|
6453 return presetPropertyValue; |
|
6454 } |
|
6455 |
|
6456 const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; |
|
6457 const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', cssVarInfix]); |
|
6458 |
|
6459 if (!metadata) { |
|
6460 // The property doesn't have preset data |
|
6461 // so the value should be returned as it is. |
|
6462 return presetPropertyValue; |
|
6463 } |
|
6464 |
|
6465 const { |
|
6466 valueKey, |
|
6467 path |
|
6468 } = metadata; |
|
6469 const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue); |
|
6470 |
|
6471 if (!presetObject) { |
|
6472 // Value wasn't found in the presets, |
|
6473 // so it must be a custom value. |
|
6474 return presetPropertyValue; |
|
6475 } |
|
6476 |
|
6477 return `var:preset|${cssVarInfix}|${presetObject.slug}`; |
|
6478 } |
|
6479 |
|
6480 function getValueFromPresetVariable(features, blockName, variable, _ref2) { |
|
6481 let [presetType, slug] = _ref2; |
|
6482 const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', presetType]); |
|
6483 |
|
6484 if (!metadata) { |
|
6485 return variable; |
|
6486 } |
|
6487 |
|
6488 const presetObject = findInPresetsBy(features, blockName, metadata.path, 'slug', slug); |
|
6489 |
|
6490 if (presetObject) { |
|
6491 const { |
|
6492 valueKey |
|
6493 } = metadata; |
|
6494 const result = presetObject[valueKey]; |
|
6495 return getValueFromVariable(features, blockName, result); |
|
6496 } |
|
6497 |
|
6498 return variable; |
|
6499 } |
|
6500 |
|
6501 function getValueFromCustomVariable(features, blockName, variable, path) { |
|
6502 var _get; |
|
6503 |
|
6504 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]); |
|
6505 |
|
6506 if (!result) { |
|
6507 return variable; |
|
6508 } // A variable may reference another variable so we need recursion until we find the value. |
|
6509 |
|
6510 |
|
6511 return getValueFromVariable(features, blockName, result); |
|
6512 } |
|
6513 |
|
6514 function getValueFromVariable(features, blockName, variable) { |
|
6515 if (!variable || !(0,external_lodash_namespaceObject.isString)(variable)) { |
|
6516 return variable; |
|
6517 } |
|
6518 |
|
6519 const USER_VALUE_PREFIX = 'var:'; |
|
6520 const THEME_VALUE_PREFIX = 'var(--wp--'; |
|
6521 const THEME_VALUE_SUFFIX = ')'; |
|
6522 let parsedVar; |
|
6523 |
|
6524 if (variable.startsWith(USER_VALUE_PREFIX)) { |
|
6525 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|'); |
|
6526 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { |
|
6527 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--'); |
|
6528 } else { |
|
6529 // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )` |
|
6530 return variable; |
|
6531 } |
|
6532 |
|
6533 const [type, ...path] = parsedVar; |
|
6534 |
|
6535 if (type === 'preset') { |
|
6536 return getValueFromPresetVariable(features, blockName, variable, path); |
|
6537 } |
|
6538 |
|
6539 if (type === 'custom') { |
|
6540 return getValueFromCustomVariable(features, blockName, variable, path); |
|
6541 } |
|
6542 |
|
6543 return variable; |
|
6544 } |
|
6545 |
|
6546 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context.js |
|
6547 /** |
|
6548 * WordPress dependencies |
|
6549 */ |
|
6550 |
|
6551 const DEFAULT_GLOBAL_STYLES_CONTEXT = { |
|
6552 user: {}, |
|
6553 base: {}, |
|
6554 merged: {}, |
|
6555 setUserConfig: () => {} |
|
6556 }; |
|
6557 const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT); |
|
6558 |
|
6559 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js |
|
6560 /** |
|
6561 * External dependencies |
|
6562 */ |
|
6563 |
|
6564 /** |
|
6565 * WordPress dependencies |
|
6566 */ |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 /** |
|
6572 * Internal dependencies |
|
6573 */ |
|
6574 |
|
6575 |
|
6576 |
|
6577 const EMPTY_CONFIG = { |
|
6578 settings: {}, |
|
6579 styles: {} |
|
6580 }; |
|
6581 const useGlobalStylesReset = () => { |
|
6582 const { |
|
6583 user: config, |
|
6584 setUserConfig |
|
6585 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
|
6586 const canReset = !!config && !(0,external_lodash_namespaceObject.isEqual)(config, EMPTY_CONFIG); |
|
6587 return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])]; |
|
6588 }; |
|
6589 function useSetting(path, blockName) { |
|
6590 var _getSettingValueForCo; |
|
6591 |
|
6592 let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; |
|
6593 const { |
|
6594 merged: mergedConfig, |
|
6595 base: baseConfig, |
|
6596 user: userConfig, |
|
6597 setUserConfig |
|
6598 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
|
6599 const fullPath = !blockName ? `settings.${path}` : `settings.blocks.${blockName}.${path}`; |
|
6600 |
|
6601 const setSetting = newValue => { |
|
6602 setUserConfig(currentConfig => { |
|
6603 const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); |
|
6604 const pathToSet = external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path] ? fullPath + '.custom' : fullPath; |
|
6605 (0,external_lodash_namespaceObject.set)(newUserConfig, pathToSet, newValue); |
|
6606 return newUserConfig; |
|
6607 }); |
|
6608 }; |
|
6609 |
|
6610 const getSettingValueForContext = name => { |
|
6611 const currentPath = !name ? `settings.${path}` : `settings.blocks.${name}.${path}`; |
|
6612 |
|
6613 const getSettingValue = configToUse => { |
|
6614 const result = (0,external_lodash_namespaceObject.get)(configToUse, currentPath); |
|
6615 |
|
6616 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path]) { |
|
6617 var _ref, _result$custom; |
|
6618 |
|
6619 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; |
|
6620 } |
|
6621 |
|
6622 return result; |
|
6623 }; |
|
6624 |
|
6625 let result; |
|
6626 |
|
6627 switch (source) { |
|
6628 case 'all': |
|
6629 result = getSettingValue(mergedConfig); |
|
6630 break; |
|
6631 |
|
6632 case 'user': |
|
6633 result = getSettingValue(userConfig); |
|
6634 break; |
|
6635 |
|
6636 case 'base': |
|
6637 result = getSettingValue(baseConfig); |
|
6638 break; |
|
6639 |
|
6640 default: |
|
6641 throw 'Unsupported source'; |
|
6642 } |
|
6643 |
|
6644 return result; |
|
6645 }; // Unlike styles settings get inherited from top level settings. |
|
6646 |
|
6647 |
|
6648 const resultWithFallback = (_getSettingValueForCo = getSettingValueForContext(blockName)) !== null && _getSettingValueForCo !== void 0 ? _getSettingValueForCo : getSettingValueForContext(); |
|
6649 return [resultWithFallback, setSetting]; |
|
6650 } |
|
6651 function useStyle(path, blockName) { |
|
6652 var _get; |
|
6653 |
|
6654 let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all'; |
|
6655 const { |
|
6656 merged: mergedConfig, |
|
6657 base: baseConfig, |
|
6658 user: userConfig, |
|
6659 setUserConfig |
|
6660 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
|
6661 const finalPath = !blockName ? `styles.${path}` : `styles.blocks.${blockName}.${path}`; |
|
6662 |
|
6663 const setStyle = newValue => { |
|
6664 setUserConfig(currentConfig => { |
|
6665 const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig); |
|
6666 (0,external_lodash_namespaceObject.set)(newUserConfig, finalPath, getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue)); |
|
6667 return newUserConfig; |
|
6668 }); |
|
6669 }; |
|
6670 |
|
6671 let result; |
|
6672 |
|
6673 switch (source) { |
|
6674 case 'all': |
|
6675 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)); |
|
6676 break; |
|
6677 |
|
6678 case 'user': |
|
6679 result = getValueFromVariable(mergedConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(userConfig, finalPath)); |
|
6680 break; |
|
6681 |
|
6682 case 'base': |
|
6683 result = getValueFromVariable(baseConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(baseConfig, finalPath)); |
|
6684 break; |
|
6685 |
|
6686 default: |
|
6687 throw 'Unsupported source'; |
|
6688 } |
|
6689 |
|
6690 return [result, setStyle]; |
|
6691 } |
|
6692 const hooks_ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']; |
|
6693 function getSupportedGlobalStylesPanels(name) { |
|
6694 if (!name) { |
|
6695 return hooks_ROOT_BLOCK_SUPPORTS; |
|
6696 } |
|
6697 |
|
6698 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); |
|
6699 |
|
6700 if (!blockType) { |
|
6701 return []; |
|
6702 } |
|
6703 |
|
6704 const supportKeys = []; |
|
6705 Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => { |
|
6706 if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { |
|
6707 return; |
|
6708 } // Opting out means that, for certain support keys like background color, |
|
6709 // blocks have to explicitly set the support value false. If the key is |
|
6710 // unset, we still enable it. |
|
6711 |
|
6712 |
|
6713 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { |
|
6714 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) { |
|
6715 return supportKeys.push(styleName); |
|
6716 } |
|
6717 } |
|
6718 |
|
6719 if ((0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) { |
|
6720 return supportKeys.push(styleName); |
|
6721 } |
|
6722 }); |
|
6723 return supportKeys; |
|
6724 } |
|
6725 function useColorsPerOrigin(name) { |
|
6726 const [customColors] = useSetting('color.palette.custom', name); |
|
6727 const [themeColors] = useSetting('color.palette.theme', name); |
|
6728 const [defaultColors] = useSetting('color.palette.default', name); |
|
6729 const [shouldDisplayDefaultColors] = useSetting('color.defaultPalette'); |
|
6730 return (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
6731 const result = []; |
|
6732 |
|
6733 if (themeColors && themeColors.length) { |
|
6734 result.push({ |
|
6735 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), |
|
6736 colors: themeColors |
|
6737 }); |
|
6738 } |
|
6739 |
|
6740 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { |
|
6741 result.push({ |
|
6742 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), |
|
6743 colors: defaultColors |
|
6744 }); |
|
6745 } |
|
6746 |
|
6747 if (customColors && customColors.length) { |
|
6748 result.push({ |
|
6749 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), |
|
6750 colors: customColors |
|
6751 }); |
|
6752 } |
|
6753 |
|
6754 return result; |
|
6755 }, [customColors, themeColors, defaultColors]); |
|
6756 } |
|
6757 function useGradientsPerOrigin(name) { |
|
6758 const [customGradients] = useSetting('color.gradients.custom', name); |
|
6759 const [themeGradients] = useSetting('color.gradients.theme', name); |
|
6760 const [defaultGradients] = useSetting('color.gradients.default', name); |
|
6761 const [shouldDisplayDefaultGradients] = useSetting('color.defaultGradients'); |
|
6762 return (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
6763 const result = []; |
|
6764 |
|
6765 if (themeGradients && themeGradients.length) { |
|
6766 result.push({ |
|
6767 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), |
|
6768 gradients: themeGradients |
|
6769 }); |
|
6770 } |
|
6771 |
|
6772 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { |
|
6773 result.push({ |
|
6774 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), |
|
6775 gradients: defaultGradients |
|
6776 }); |
|
6777 } |
|
6778 |
|
6779 if (customGradients && customGradients.length) { |
|
6780 result.push({ |
|
6781 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), |
|
6782 gradients: customGradients |
|
6783 }); |
|
6784 } |
|
6785 |
|
6786 return result; |
|
6787 }, [customGradients, themeGradients, defaultGradients]); |
|
6788 } |
|
6789 |
|
6790 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/border-panel.js |
|
6791 |
|
6792 |
|
6793 /** |
|
6794 * WordPress dependencies |
|
6795 */ |
|
6796 |
|
6797 |
|
6798 |
|
6799 /** |
|
6800 * Internal dependencies |
|
6801 */ |
|
6802 |
|
6803 |
|
6804 const MIN_BORDER_WIDTH = 0; |
|
6805 function useHasBorderPanel(name) { |
|
6806 const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)]; |
|
6807 return controls.some(Boolean); |
|
6808 } |
|
6809 |
|
6810 function useHasBorderColorControl(name) { |
|
6811 const supports = getSupportedGlobalStylesPanels(name); |
|
6812 return useSetting('border.color', name)[0] && supports.includes('borderColor'); |
|
6813 } |
|
6814 |
|
6815 function useHasBorderRadiusControl(name) { |
|
6816 const supports = getSupportedGlobalStylesPanels(name); |
|
6817 return useSetting('border.radius', name)[0] && supports.includes('borderRadius'); |
|
6818 } |
|
6819 |
|
6820 function useHasBorderStyleControl(name) { |
|
6821 const supports = getSupportedGlobalStylesPanels(name); |
|
6822 return useSetting('border.style', name)[0] && supports.includes('borderStyle'); |
|
6823 } |
|
6824 |
|
6825 function useHasBorderWidthControl(name) { |
|
6826 const supports = getSupportedGlobalStylesPanels(name); |
|
6827 return useSetting('border.width', name)[0] && supports.includes('borderWidth'); |
|
6828 } |
|
6829 |
|
6830 function BorderPanel(_ref) { |
|
6831 let { |
|
6832 name |
|
6833 } = _ref; |
|
6834 // To better reflect if the user has customized a value we need to |
|
6835 // ensure the style value being checked is from the `user` origin. |
|
6836 const [userBorderStyles] = useStyle('border', name, 'user'); |
|
6837 |
|
6838 const createHasValueCallback = feature => () => !!(userBorderStyles !== null && userBorderStyles !== void 0 && userBorderStyles[feature]); |
|
6839 |
|
6840 const createResetCallback = setStyle => () => setStyle(undefined); |
|
6841 |
|
6842 const handleOnChange = setStyle => value => { |
|
6843 setStyle(value || undefined); |
|
6844 }; |
|
6845 |
|
6846 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ |
|
6847 availableUnits: useSetting('spacing.units')[0] || ['px', 'em', 'rem'] |
|
6848 }); // Border width. |
|
6849 |
|
6850 const showBorderWidth = useHasBorderWidthControl(name); |
|
6851 const [borderWidthValue, setBorderWidth] = useStyle('border.width', name); // Border style. |
|
6852 |
|
6853 const showBorderStyle = useHasBorderStyleControl(name); |
|
6854 const [borderStyle, setBorderStyle] = useStyle('border.style', name); // When we set a border color or width ensure we have a style so the user |
|
6855 // can see a visible border. |
|
6856 |
|
6857 const handleOnChangeWithStyle = setStyle => value => { |
|
6858 if (!!value && !borderStyle) { |
|
6859 setBorderStyle('solid'); |
|
6860 } |
|
6861 |
|
6862 setStyle(value || undefined); |
|
6863 }; // Border color. |
|
6864 |
|
6865 |
|
6866 const showBorderColor = useHasBorderColorControl(name); |
|
6867 const [borderColor, setBorderColor] = useStyle('border.color', name); |
|
6868 const disableCustomColors = !useSetting('color.custom')[0]; |
|
6869 const disableCustomGradients = !useSetting('color.customGradient')[0]; |
|
6870 const borderColorSettings = [{ |
|
6871 label: (0,external_wp_i18n_namespaceObject.__)('Color'), |
|
6872 colors: useColorsPerOrigin(name), |
|
6873 colorValue: borderColor, |
|
6874 onColorChange: handleOnChangeWithStyle(setBorderColor), |
|
6875 clearable: false |
|
6876 }]; // Border radius. |
|
6877 |
|
6878 const showBorderRadius = useHasBorderRadiusControl(name); |
|
6879 const [borderRadiusValues, setBorderRadius] = useStyle('border.radius', name); |
|
6880 |
|
6881 const hasBorderRadius = () => { |
|
6882 const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius; |
|
6883 |
|
6884 if (typeof borderValues === 'object') { |
|
6885 return Object.entries(borderValues).some(Boolean); |
|
6886 } |
|
6887 |
|
6888 return !!borderValues; |
|
6889 }; |
|
6890 |
|
6891 const resetAll = () => { |
|
6892 setBorderColor(undefined); |
|
6893 setBorderRadius(undefined); |
|
6894 setBorderStyle(undefined); |
|
6895 setBorderWidth(undefined); |
|
6896 }; |
|
6897 |
|
6898 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { |
|
6899 label: (0,external_wp_i18n_namespaceObject.__)('Border'), |
|
6900 resetAll: resetAll |
|
6901 }, showBorderWidth && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
6902 className: "single-column", |
|
6903 hasValue: createHasValueCallback('width'), |
|
6904 label: (0,external_wp_i18n_namespaceObject.__)('Width'), |
|
6905 onDeselect: createResetCallback(setBorderWidth), |
|
6906 isShownByDefault: true |
|
6907 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { |
|
6908 value: borderWidthValue, |
|
6909 label: (0,external_wp_i18n_namespaceObject.__)('Width'), |
|
6910 min: MIN_BORDER_WIDTH, |
|
6911 onChange: handleOnChangeWithStyle(setBorderWidth), |
|
6912 units: units |
|
6913 })), showBorderStyle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
6914 className: "single-column", |
|
6915 hasValue: createHasValueCallback('style'), |
|
6916 label: (0,external_wp_i18n_namespaceObject.__)('Style'), |
|
6917 onDeselect: createResetCallback(setBorderStyle), |
|
6918 isShownByDefault: true |
|
6919 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderStyleControl, { |
|
6920 value: borderStyle, |
|
6921 onChange: handleOnChange(setBorderStyle) |
|
6922 })), showBorderColor && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
6923 hasValue: createHasValueCallback('color'), |
|
6924 label: (0,external_wp_i18n_namespaceObject.__)('Color'), |
|
6925 onDeselect: createResetCallback(setBorderColor), |
|
6926 isShownByDefault: true |
|
6927 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, { |
|
6928 __experimentalHasMultipleOrigins: true, |
|
6929 __experimentalIsRenderedInSidebar: true, |
|
6930 disableCustomColors: disableCustomColors, |
|
6931 disableCustomGradients: disableCustomGradients, |
|
6932 enableAlpha: true, |
|
6933 settings: borderColorSettings |
|
6934 })), showBorderRadius && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
6935 hasValue: hasBorderRadius, |
|
6936 label: (0,external_wp_i18n_namespaceObject.__)('Radius'), |
|
6937 onDeselect: createResetCallback(setBorderRadius), |
|
6938 isShownByDefault: true |
|
6939 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderRadiusControl, { |
|
6940 values: borderRadiusValues, |
|
6941 onChange: handleOnChange(setBorderRadius) |
|
6942 }))); |
|
6943 } |
|
6944 |
|
6945 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-utils.js |
|
6946 /** |
|
6947 * Internal dependencies |
|
6948 */ |
|
6949 |
|
6950 function useHasColorPanel(name) { |
|
6951 const supports = getSupportedGlobalStylesPanels(name); |
|
6952 return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor'); |
|
6953 } |
|
6954 |
|
6955 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js |
|
6956 |
|
6957 |
|
6958 /** |
|
6959 * WordPress dependencies |
|
6960 */ |
|
6961 |
|
6962 |
|
6963 |
|
6964 /** |
|
6965 * Internal dependencies |
|
6966 */ |
|
6967 |
|
6968 |
|
6969 const AXIAL_SIDES = ['horizontal', 'vertical']; |
|
6970 function useHasDimensionsPanel(name) { |
|
6971 const hasPadding = useHasPadding(name); |
|
6972 const hasMargin = useHasMargin(name); |
|
6973 const hasGap = useHasGap(name); |
|
6974 return hasPadding || hasMargin || hasGap; |
|
6975 } |
|
6976 |
|
6977 function useHasPadding(name) { |
|
6978 const supports = getSupportedGlobalStylesPanels(name); |
|
6979 const [settings] = useSetting('spacing.padding', name); |
|
6980 return settings && supports.includes('padding'); |
|
6981 } |
|
6982 |
|
6983 function useHasMargin(name) { |
|
6984 const supports = getSupportedGlobalStylesPanels(name); |
|
6985 const [settings] = useSetting('spacing.margin', name); |
|
6986 return settings && supports.includes('margin'); |
|
6987 } |
|
6988 |
|
6989 function useHasGap(name) { |
|
6990 const supports = getSupportedGlobalStylesPanels(name); |
|
6991 const [settings] = useSetting('spacing.blockGap', name); // Do not show the gap control panel for block-level global styles |
|
6992 // as they do not work on the frontend. |
|
6993 // See: https://github.com/WordPress/gutenberg/pull/39845. |
|
6994 // We can revert this condition when they're working again. |
|
6995 |
|
6996 return !!name ? false : settings && supports.includes('--wp--style--block-gap'); |
|
6997 } |
|
6998 |
|
6999 function filterValuesBySides(values, sides) { |
|
7000 if (!sides) { |
|
7001 // If no custom side configuration all sides are opted into by default. |
|
7002 return values; |
|
7003 } // Only include sides opted into within filtered values. |
|
7004 |
|
7005 |
|
7006 const filteredValues = {}; |
|
7007 sides.forEach(side => { |
|
7008 if (side === 'vertical') { |
|
7009 filteredValues.top = values.top; |
|
7010 filteredValues.bottom = values.bottom; |
|
7011 } |
|
7012 |
|
7013 if (side === 'horizontal') { |
|
7014 filteredValues.left = values.left; |
|
7015 filteredValues.right = values.right; |
|
7016 } |
|
7017 |
|
7018 filteredValues[side] = values[side]; |
|
7019 }); |
|
7020 return filteredValues; |
|
7021 } |
|
7022 |
|
7023 function splitStyleValue(value) { |
|
7024 // Check for shorthand value ( a string value ). |
|
7025 if (value && typeof value === 'string') { |
|
7026 // Convert to value for individual sides for BoxControl. |
|
7027 return { |
|
7028 top: value, |
|
7029 right: value, |
|
7030 bottom: value, |
|
7031 left: value |
|
7032 }; |
|
7033 } |
|
7034 |
|
7035 return value; |
|
7036 } |
|
7037 |
|
7038 function DimensionsPanel(_ref) { |
|
7039 let { |
|
7040 name |
|
7041 } = _ref; |
|
7042 const showPaddingControl = useHasPadding(name); |
|
7043 const showMarginControl = useHasMargin(name); |
|
7044 const showGapControl = useHasGap(name); |
|
7045 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ |
|
7046 availableUnits: useSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw'] |
|
7047 }); |
|
7048 const [rawPadding, setRawPadding] = useStyle('spacing.padding', name); |
|
7049 const paddingValues = splitStyleValue(rawPadding); |
|
7050 const paddingSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'padding'); |
|
7051 const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side)); |
|
7052 |
|
7053 const setPaddingValues = newPaddingValues => { |
|
7054 const padding = filterValuesBySides(newPaddingValues, paddingSides); |
|
7055 setRawPadding(padding); |
|
7056 }; |
|
7057 |
|
7058 const resetPaddingValue = () => setPaddingValues({}); |
|
7059 |
|
7060 const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length; |
|
7061 |
|
7062 const [rawMargin, setRawMargin] = useStyle('spacing.margin', name); |
|
7063 const marginValues = splitStyleValue(rawMargin); |
|
7064 const marginSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'margin'); |
|
7065 const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side)); |
|
7066 |
|
7067 const setMarginValues = newMarginValues => { |
|
7068 const margin = filterValuesBySides(newMarginValues, marginSides); |
|
7069 setRawMargin(margin); |
|
7070 }; |
|
7071 |
|
7072 const resetMarginValue = () => setMarginValues({}); |
|
7073 |
|
7074 const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length; |
|
7075 |
|
7076 const [gapValue, setGapValue] = useStyle('spacing.blockGap', name); |
|
7077 |
|
7078 const resetGapValue = () => setGapValue(undefined); |
|
7079 |
|
7080 const hasGapValue = () => !!gapValue; |
|
7081 |
|
7082 const resetAll = () => { |
|
7083 resetPaddingValue(); |
|
7084 resetMarginValue(); |
|
7085 resetGapValue(); |
|
7086 }; |
|
7087 |
|
7088 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { |
|
7089 label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'), |
|
7090 resetAll: resetAll |
|
7091 }, showPaddingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
7092 hasValue: hasPaddingValue, |
|
7093 label: (0,external_wp_i18n_namespaceObject.__)('Padding'), |
|
7094 onDeselect: resetPaddingValue, |
|
7095 isShownByDefault: true |
|
7096 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { |
|
7097 values: paddingValues, |
|
7098 onChange: setPaddingValues, |
|
7099 label: (0,external_wp_i18n_namespaceObject.__)('Padding'), |
|
7100 sides: paddingSides, |
|
7101 units: units, |
|
7102 allowReset: false, |
|
7103 splitOnAxis: isAxialPadding |
|
7104 })), showMarginControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
7105 hasValue: hasMarginValue, |
|
7106 label: (0,external_wp_i18n_namespaceObject.__)('Margin'), |
|
7107 onDeselect: resetMarginValue, |
|
7108 isShownByDefault: true |
|
7109 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { |
|
7110 values: marginValues, |
|
7111 onChange: setMarginValues, |
|
7112 label: (0,external_wp_i18n_namespaceObject.__)('Margin'), |
|
7113 sides: marginSides, |
|
7114 units: units, |
|
7115 allowReset: false, |
|
7116 splitOnAxis: isAxialMargin |
|
7117 })), showGapControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { |
|
7118 hasValue: hasGapValue, |
|
7119 label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), |
|
7120 onDeselect: resetGapValue, |
|
7121 isShownByDefault: true |
|
7122 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { |
|
7123 label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), |
|
7124 __unstableInputWidth: "80px", |
|
7125 min: 0, |
|
7126 onChange: setGapValue, |
|
7127 units: units, |
|
7128 value: gapValue |
|
7129 }))); |
|
7130 } |
|
7131 |
|
7132 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js |
|
7133 |
|
7134 |
|
7135 /** |
|
7136 * WordPress dependencies |
|
7137 */ |
|
7138 |
|
7139 |
|
7140 /** |
|
7141 * Internal dependencies |
|
7142 */ |
|
7143 |
|
7144 |
|
7145 function useHasTypographyPanel(name) { |
|
7146 const hasLineHeight = useHasLineHeightControl(name); |
|
7147 const hasFontAppearance = useHasAppearanceControl(name); |
|
7148 const hasLetterSpacing = useHasLetterSpacingControl(name); |
|
7149 const supports = getSupportedGlobalStylesPanels(name); |
|
7150 return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize'); |
|
7151 } |
|
7152 |
|
7153 function useHasLineHeightControl(name) { |
|
7154 const supports = getSupportedGlobalStylesPanels(name); |
|
7155 return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight'); |
|
7156 } |
|
7157 |
|
7158 function useHasAppearanceControl(name) { |
|
7159 const supports = getSupportedGlobalStylesPanels(name); |
|
7160 const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); |
|
7161 const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); |
|
7162 return hasFontStyles || hasFontWeights; |
|
7163 } |
|
7164 |
|
7165 function useHasLetterSpacingControl(name) { |
|
7166 const supports = getSupportedGlobalStylesPanels(name); |
|
7167 return useSetting('typography.letterSpacing', name)[0] && supports.includes('letterSpacing'); |
|
7168 } |
|
7169 |
|
7170 function TypographyPanel(_ref) { |
|
7171 let { |
|
7172 name, |
|
7173 element |
|
7174 } = _ref; |
|
7175 const supports = getSupportedGlobalStylesPanels(name); |
|
7176 const prefix = element === 'text' || !element ? '' : `elements.${element}.`; |
|
7177 const [fontSizes] = useSetting('typography.fontSizes', name); |
|
7178 const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0]; |
|
7179 const [fontFamilies] = useSetting('typography.fontFamilies', name); |
|
7180 const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle'); |
|
7181 const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight'); |
|
7182 const hasLineHeightEnabled = useHasLineHeightControl(name); |
|
7183 const hasAppearanceControl = useHasAppearanceControl(name); |
|
7184 const hasLetterSpacingControl = useHasLetterSpacingControl(name); |
|
7185 const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name); |
|
7186 const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name); |
|
7187 const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name); |
|
7188 const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name); |
|
7189 const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name); |
|
7190 const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); |
|
7191 const [backgroundColor] = useStyle(prefix + 'color.background', name); |
|
7192 const [gradientValue] = useStyle(prefix + 'color.gradient', name); |
|
7193 const [color] = useStyle(prefix + 'color.text', name); |
|
7194 const extraStyles = element === 'link' ? { |
|
7195 textDecoration: 'underline' |
|
7196 } : {}; |
|
7197 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
7198 className: "edit-site-typography-panel", |
|
7199 initialOpen: true |
|
7200 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
7201 className: "edit-site-typography-panel__preview", |
|
7202 style: { |
|
7203 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', |
|
7204 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
|
7205 color, |
|
7206 fontSize, |
|
7207 fontStyle, |
|
7208 fontWeight, |
|
7209 letterSpacing, |
|
7210 ...extraStyles |
|
7211 } |
|
7212 }, "Aa"), supports.includes('fontFamily') && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontFamilyControl, { |
|
7213 fontFamilies: fontFamilies, |
|
7214 value: fontFamily, |
|
7215 onChange: setFontFamily |
|
7216 }), supports.includes('fontSize') && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, { |
|
7217 value: fontSize, |
|
7218 onChange: setFontSize, |
|
7219 fontSizes: fontSizes, |
|
7220 disableCustomFontSizes: disableCustomFontSizes |
|
7221 }), hasLineHeightEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { |
|
7222 marginBottom: 6 |
|
7223 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.LineHeightControl, { |
|
7224 __nextHasNoMarginBottom: true, |
|
7225 value: lineHeight, |
|
7226 onChange: setLineHeight |
|
7227 })), hasAppearanceControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontAppearanceControl, { |
|
7228 value: { |
|
7229 fontStyle, |
|
7230 fontWeight |
|
7231 }, |
|
7232 onChange: _ref2 => { |
|
7233 let { |
|
7234 fontStyle: newFontStyle, |
|
7235 fontWeight: newFontWeight |
|
7236 } = _ref2; |
|
7237 setFontStyle(newFontStyle); |
|
7238 setFontWeight(newFontWeight); |
|
7239 }, |
|
7240 hasFontStyles: hasFontStyles, |
|
7241 hasFontWeights: hasFontWeights |
|
7242 }), hasLetterSpacingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLetterSpacingControl, { |
|
7243 value: letterSpacing, |
|
7244 onChange: setLetterSpacing |
|
7245 })); |
|
7246 } |
|
7247 |
|
7248 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context-menu.js |
|
7249 |
|
7250 |
|
7251 /** |
|
7252 * WordPress dependencies |
|
7253 */ |
|
7254 |
|
7255 |
|
7256 |
|
7257 /** |
|
7258 * Internal dependencies |
|
7259 */ |
|
7260 |
|
7261 |
|
7262 |
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 function ContextMenu(_ref) { |
|
7268 let { |
|
7269 name, |
|
7270 parentMenu = '' |
|
7271 } = _ref; |
|
7272 const hasTypographyPanel = useHasTypographyPanel(name); |
|
7273 const hasColorPanel = useHasColorPanel(name); |
|
7274 const hasBorderPanel = useHasBorderPanel(name); |
|
7275 const hasDimensionsPanel = useHasDimensionsPanel(name); |
|
7276 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; |
|
7277 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
7278 icon: library_typography, |
|
7279 path: parentMenu + '/typography' |
|
7280 }, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
7281 icon: library_color, |
|
7282 path: parentMenu + '/colors' |
|
7283 }, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
7284 icon: library_layout, |
|
7285 path: parentMenu + '/layout' |
|
7286 }, (0,external_wp_i18n_namespaceObject.__)('Layout'))); |
|
7287 } |
|
7288 |
|
7289 /* harmony default export */ var context_menu = (ContextMenu); |
|
7290 |
|
7291 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/utils.js |
|
7292 /** |
|
7293 * External dependencies |
|
7294 */ |
|
7295 |
|
7296 /** |
|
7297 * Internal dependencies |
|
7298 */ |
|
7299 |
|
7300 function generateBoxRules(style, options, path, ruleKey) { |
|
7301 const boxStyle = (0,external_lodash_namespaceObject.get)(style, path); |
|
7302 |
|
7303 if (!boxStyle) { |
|
7304 return []; |
|
7305 } |
|
7306 |
|
7307 const rules = []; |
|
7308 |
|
7309 if (typeof boxStyle === 'string') { |
|
7310 rules.push({ |
|
7311 selector: options.selector, |
|
7312 key: ruleKey, |
|
7313 value: boxStyle |
|
7314 }); |
|
7315 } else { |
|
7316 const sideRules = ['top', 'right', 'bottom', 'left'].reduce((acc, side) => { |
|
7317 const value = (0,external_lodash_namespaceObject.get)(boxStyle, [side]); |
|
7318 |
|
7319 if (value) { |
|
7320 acc.push({ |
|
7321 selector: options.selector, |
|
7322 key: `${ruleKey}${(0,external_lodash_namespaceObject.upperFirst)(side)}`, |
|
7323 value |
|
7324 }); |
|
7325 } |
|
7326 |
|
7327 return acc; |
|
7328 }, []); |
|
7329 rules.push(...sideRules); |
|
7330 } |
|
7331 |
|
7332 return rules; |
|
7333 } |
|
7334 |
|
7335 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/padding.js |
|
7336 /** |
|
7337 * Internal dependencies |
|
7338 */ |
|
7339 |
|
7340 const padding = { |
|
7341 name: 'padding', |
|
7342 generate: (style, options) => { |
|
7343 return generateBoxRules(style, options, ['spacing', 'padding'], 'padding'); |
|
7344 } |
|
7345 }; |
|
7346 /* harmony default export */ var styles_padding = (padding); |
|
7347 |
|
7348 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/margin.js |
|
7349 /** |
|
7350 * Internal dependencies |
|
7351 */ |
|
7352 |
|
7353 const margin = { |
|
7354 name: 'margin', |
|
7355 generate: (style, options) => { |
|
7356 return generateBoxRules(style, options, ['spacing', 'margin'], 'margin'); |
|
7357 } |
|
7358 }; |
|
7359 /* harmony default export */ var styles_margin = (margin); |
|
7360 |
|
7361 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/index.js |
|
7362 /** |
|
7363 * Internal dependencies |
|
7364 */ |
|
7365 |
|
7366 |
|
7367 const styleDefinitions = [styles_margin, styles_padding]; |
|
7368 |
|
7369 ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/index.js |
|
7370 /** |
|
7371 * External dependencies |
|
7372 */ |
|
7373 |
|
7374 /** |
|
7375 * Internal dependencies |
|
7376 */ |
|
7377 |
|
7378 |
|
7379 /** |
|
7380 * Generates a stylesheet for a given style object and selector. |
|
7381 * |
|
7382 * @param style Style object. |
|
7383 * @param options Options object with settings to adjust how the styles are generated. |
|
7384 * |
|
7385 * @return generated stylesheet. |
|
7386 */ |
|
7387 |
|
7388 function generate(style, options) { |
|
7389 const rules = getCSSRules(style, options); |
|
7390 const groupedRules = groupBy(rules, 'selector'); |
|
7391 const selectorRules = Object.keys(groupedRules).reduce((acc, subSelector) => { |
|
7392 acc.push(`${subSelector} { ${groupedRules[subSelector].map(rule => `${kebabCase(rule.key)}: ${rule.value};`).join(' ')} }`); |
|
7393 return acc; |
|
7394 }, []); |
|
7395 return selectorRules.join('\n'); |
|
7396 } |
|
7397 /** |
|
7398 * Returns a JSON representation of the generated CSS rules. |
|
7399 * |
|
7400 * @param style Style object. |
|
7401 * @param options Options object with settings to adjust how the styles are generated. |
|
7402 * |
|
7403 * @return generated styles. |
|
7404 */ |
|
7405 |
|
7406 function getCSSRules(style, options) { |
|
7407 const rules = []; |
|
7408 styleDefinitions.forEach(definition => { |
|
7409 rules.push(...definition.generate(style, options)); |
|
7410 }); |
|
7411 return rules; |
|
7412 } |
|
7413 |
|
7414 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/use-global-styles-output.js |
|
7415 |
|
7416 |
|
7417 /** |
|
7418 * External dependencies |
|
7419 */ |
|
7420 |
|
7421 /** |
|
7422 * WordPress dependencies |
|
7423 */ |
|
7424 |
|
7425 |
|
7426 |
|
7427 |
|
7428 |
|
7429 /** |
|
7430 * Internal dependencies |
|
7431 */ |
|
7432 |
|
7433 /** |
|
7434 * Internal dependencies |
|
7435 */ |
|
7436 |
|
7437 |
|
7438 |
|
7439 |
|
7440 function compileStyleValue(uncompiledValue) { |
|
7441 const VARIABLE_REFERENCE_PREFIX = 'var:'; |
|
7442 const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; |
|
7443 const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; |
|
7444 |
|
7445 if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { |
|
7446 const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); |
|
7447 return `var(--wp--${variable})`; |
|
7448 } |
|
7449 |
|
7450 return uncompiledValue; |
|
7451 } |
|
7452 /** |
|
7453 * Transform given preset tree into a set of style declarations. |
|
7454 * |
|
7455 * @param {Object} blockPresets |
|
7456 * |
|
7457 * @return {Array} An array of style declarations. |
|
7458 */ |
|
7459 |
|
7460 |
|
7461 function getPresetsDeclarations() { |
|
7462 let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
7463 return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref) => { |
|
7464 let { |
|
7465 path, |
|
7466 valueKey, |
|
7467 valueFunc, |
|
7468 cssVarInfix |
|
7469 } = _ref; |
|
7470 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); |
|
7471 ['default', 'theme', 'custom'].forEach(origin => { |
|
7472 if (presetByOrigin[origin]) { |
|
7473 presetByOrigin[origin].forEach(value => { |
|
7474 if (valueKey) { |
|
7475 declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${value[valueKey]}`); |
|
7476 } else if (valueFunc && typeof valueFunc === 'function') { |
|
7477 declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${valueFunc(value)}`); |
|
7478 } |
|
7479 }); |
|
7480 } |
|
7481 }); |
|
7482 return declarations; |
|
7483 }, []); |
|
7484 } |
|
7485 /** |
|
7486 * Transform given preset tree into a set of preset class declarations. |
|
7487 * |
|
7488 * @param {string} blockSelector |
|
7489 * @param {Object} blockPresets |
|
7490 * @return {string} CSS declarations for the preset classes. |
|
7491 */ |
|
7492 |
|
7493 |
|
7494 function getPresetsClasses(blockSelector) { |
|
7495 let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
7496 return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref2) => { |
|
7497 let { |
|
7498 path, |
|
7499 cssVarInfix, |
|
7500 classes |
|
7501 } = _ref2; |
|
7502 |
|
7503 if (!classes) { |
|
7504 return declarations; |
|
7505 } |
|
7506 |
|
7507 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []); |
|
7508 ['default', 'theme', 'custom'].forEach(origin => { |
|
7509 if (presetByOrigin[origin]) { |
|
7510 presetByOrigin[origin].forEach(_ref3 => { |
|
7511 let { |
|
7512 slug |
|
7513 } = _ref3; |
|
7514 classes.forEach(_ref4 => { |
|
7515 let { |
|
7516 classSuffix, |
|
7517 propertyName |
|
7518 } = _ref4; |
|
7519 const classSelectorToUse = `.has-${(0,external_lodash_namespaceObject.kebabCase)(slug)}-${classSuffix}`; |
|
7520 const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" |
|
7521 .map(selector => `${selector}${classSelectorToUse}`).join(','); |
|
7522 const value = `var(--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(slug)})`; |
|
7523 declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; |
|
7524 }); |
|
7525 }); |
|
7526 } |
|
7527 }); |
|
7528 return declarations; |
|
7529 }, ''); |
|
7530 } |
|
7531 |
|
7532 function getPresetsSvgFilters() { |
|
7533 let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
7534 return PRESET_METADATA.filter( // Duotone are the only type of filters for now. |
|
7535 metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => { |
|
7536 const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, metadata.path, {}); |
|
7537 return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstablePresetDuotoneFilter, { |
|
7538 preset: preset, |
|
7539 key: preset.slug |
|
7540 }))); |
|
7541 }); |
|
7542 } |
|
7543 |
|
7544 function flattenTree() { |
|
7545 let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
7546 let prefix = arguments.length > 1 ? arguments[1] : undefined; |
|
7547 let token = arguments.length > 2 ? arguments[2] : undefined; |
|
7548 let result = []; |
|
7549 Object.keys(input).forEach(key => { |
|
7550 const newKey = prefix + (0,external_lodash_namespaceObject.kebabCase)(key.replace('/', '-')); |
|
7551 const newLeaf = input[key]; |
|
7552 |
|
7553 if (newLeaf instanceof Object) { |
|
7554 const newPrefix = newKey + token; |
|
7555 result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; |
|
7556 } else { |
|
7557 result.push(`${newKey}: ${newLeaf}`); |
|
7558 } |
|
7559 }); |
|
7560 return result; |
|
7561 } |
|
7562 /** |
|
7563 * Transform given style tree into a set of style declarations. |
|
7564 * |
|
7565 * @param {Object} blockStyles Block styles. |
|
7566 * |
|
7567 * @return {Array} An array of style declarations. |
|
7568 */ |
|
7569 |
|
7570 |
|
7571 function getStylesDeclarations() { |
|
7572 let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
7573 const output = (0,external_lodash_namespaceObject.reduce)(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => { |
|
7574 let { |
|
7575 value, |
|
7576 properties, |
|
7577 useEngine |
|
7578 } = _ref5; |
|
7579 const pathToValue = value; |
|
7580 |
|
7581 if ((0,external_lodash_namespaceObject.first)(pathToValue) === 'elements' || useEngine) { |
|
7582 return declarations; |
|
7583 } |
|
7584 |
|
7585 const styleValue = (0,external_lodash_namespaceObject.get)(blockStyles, pathToValue); |
|
7586 |
|
7587 if (!!properties && !(0,external_lodash_namespaceObject.isString)(styleValue)) { |
|
7588 Object.entries(properties).forEach(entry => { |
|
7589 const [name, prop] = entry; |
|
7590 |
|
7591 if (!(0,external_lodash_namespaceObject.get)(styleValue, [prop], false)) { |
|
7592 // Do not create a declaration |
|
7593 // for sub-properties that don't have any value. |
|
7594 return; |
|
7595 } |
|
7596 |
|
7597 const cssProperty = (0,external_lodash_namespaceObject.kebabCase)(name); |
|
7598 declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(styleValue, [prop]))}`); |
|
7599 }); |
|
7600 } else if ((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue, false)) { |
|
7601 const cssProperty = key.startsWith('--') ? key : (0,external_lodash_namespaceObject.kebabCase)(key); |
|
7602 declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue))}`); |
|
7603 } |
|
7604 |
|
7605 return declarations; |
|
7606 }, []); // The goal is to move everything to server side generated engine styles |
|
7607 // This is temporary as we absorb more and more styles into the engine. |
|
7608 |
|
7609 const extraRules = getCSSRules(blockStyles, { |
|
7610 selector: 'self' |
|
7611 }); |
|
7612 extraRules.forEach(rule => { |
|
7613 if (rule.selector !== 'self') { |
|
7614 throw "This style can't be added as inline style"; |
|
7615 } |
|
7616 |
|
7617 const cssProperty = rule.key.startsWith('--') ? rule.key : (0,external_lodash_namespaceObject.kebabCase)(rule.key); |
|
7618 output.push(`${cssProperty}: ${compileStyleValue(rule.value)}`); |
|
7619 }); |
|
7620 return output; |
|
7621 } |
|
7622 |
|
7623 const getNodesWithStyles = (tree, blockSelectors) => { |
|
7624 var _tree$styles, _tree$styles2; |
|
7625 |
|
7626 const nodes = []; |
|
7627 |
|
7628 if (!(tree !== null && tree !== void 0 && tree.styles)) { |
|
7629 return nodes; |
|
7630 } |
|
7631 |
|
7632 const pickStyleKeys = treeToPickFrom => (0,external_lodash_namespaceObject.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter'].includes(key)); // Top-level. |
|
7633 |
|
7634 |
|
7635 const styles = pickStyleKeys(tree.styles); |
|
7636 |
|
7637 if (!!styles) { |
|
7638 nodes.push({ |
|
7639 styles, |
|
7640 selector: ROOT_BLOCK_SELECTOR |
|
7641 }); |
|
7642 } |
|
7643 |
|
7644 (0,external_lodash_namespaceObject.forEach)((_tree$styles = tree.styles) === null || _tree$styles === void 0 ? void 0 : _tree$styles.elements, (value, key) => { |
|
7645 if (!!value && !!external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key]) { |
|
7646 nodes.push({ |
|
7647 styles: value, |
|
7648 selector: external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key] |
|
7649 }); |
|
7650 } |
|
7651 }); // Iterate over blocks: they can have styles & elements. |
|
7652 |
|
7653 (0,external_lodash_namespaceObject.forEach)((_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.blocks, (node, blockName) => { |
|
7654 var _blockSelectors$block; |
|
7655 |
|
7656 const blockStyles = pickStyleKeys(node); |
|
7657 |
|
7658 if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) { |
|
7659 nodes.push({ |
|
7660 styles: blockStyles, |
|
7661 selector: blockSelectors[blockName].selector, |
|
7662 duotoneSelector: blockSelectors[blockName].duotoneSelector |
|
7663 }); |
|
7664 } |
|
7665 |
|
7666 (0,external_lodash_namespaceObject.forEach)(node === null || node === void 0 ? void 0 : node.elements, (value, elementName) => { |
|
7667 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])) { |
|
7668 nodes.push({ |
|
7669 styles: value, |
|
7670 selector: blockSelectors[blockName].selector.split(',').map(sel => sel + ' ' + external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]).join(',') |
|
7671 }); |
|
7672 } |
|
7673 }); |
|
7674 }); |
|
7675 return nodes; |
|
7676 }; |
|
7677 const getNodesWithSettings = (tree, blockSelectors) => { |
|
7678 var _tree$settings, _tree$settings2; |
|
7679 |
|
7680 const nodes = []; |
|
7681 |
|
7682 if (!(tree !== null && tree !== void 0 && tree.settings)) { |
|
7683 return nodes; |
|
7684 } |
|
7685 |
|
7686 const pickPresets = treeToPickFrom => { |
|
7687 const presets = {}; |
|
7688 PRESET_METADATA.forEach(_ref6 => { |
|
7689 let { |
|
7690 path |
|
7691 } = _ref6; |
|
7692 const value = (0,external_lodash_namespaceObject.get)(treeToPickFrom, path, false); |
|
7693 |
|
7694 if (value !== false) { |
|
7695 (0,external_lodash_namespaceObject.set)(presets, path, value); |
|
7696 } |
|
7697 }); |
|
7698 return presets; |
|
7699 }; // Top-level. |
|
7700 |
|
7701 |
|
7702 const presets = pickPresets(tree.settings); |
|
7703 const custom = (_tree$settings = tree.settings) === null || _tree$settings === void 0 ? void 0 : _tree$settings.custom; |
|
7704 |
|
7705 if (!(0,external_lodash_namespaceObject.isEmpty)(presets) || !!custom) { |
|
7706 nodes.push({ |
|
7707 presets, |
|
7708 custom, |
|
7709 selector: ROOT_BLOCK_SELECTOR |
|
7710 }); |
|
7711 } // Blocks. |
|
7712 |
|
7713 |
|
7714 (0,external_lodash_namespaceObject.forEach)((_tree$settings2 = tree.settings) === null || _tree$settings2 === void 0 ? void 0 : _tree$settings2.blocks, (node, blockName) => { |
|
7715 const blockPresets = pickPresets(node); |
|
7716 const blockCustom = node.custom; |
|
7717 |
|
7718 if (!(0,external_lodash_namespaceObject.isEmpty)(blockPresets) || !!blockCustom) { |
|
7719 nodes.push({ |
|
7720 presets: blockPresets, |
|
7721 custom: blockCustom, |
|
7722 selector: blockSelectors[blockName].selector |
|
7723 }); |
|
7724 } |
|
7725 }); |
|
7726 return nodes; |
|
7727 }; |
|
7728 const toCustomProperties = (tree, blockSelectors) => { |
|
7729 const settings = getNodesWithSettings(tree, blockSelectors); |
|
7730 let ruleset = ''; |
|
7731 settings.forEach(_ref7 => { |
|
7732 let { |
|
7733 presets, |
|
7734 custom, |
|
7735 selector |
|
7736 } = _ref7; |
|
7737 const declarations = getPresetsDeclarations(presets); |
|
7738 const customProps = flattenTree(custom, '--wp--custom--', '--'); |
|
7739 |
|
7740 if (customProps.length > 0) { |
|
7741 declarations.push(...customProps); |
|
7742 } |
|
7743 |
|
7744 if (declarations.length > 0) { |
|
7745 ruleset = ruleset + `${selector}{${declarations.join(';')};}`; |
|
7746 } |
|
7747 }); |
|
7748 return ruleset; |
|
7749 }; |
|
7750 const toStyles = (tree, blockSelectors) => { |
|
7751 const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); |
|
7752 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); |
|
7753 /* |
|
7754 * Reset default browser margin on the root body element. |
|
7755 * This is set on the root selector **before** generating the ruleset |
|
7756 * from the `theme.json`. This is to ensure that if the `theme.json` declares |
|
7757 * `margin` in its `spacing` declaration for the `body` element then these |
|
7758 * user-generated values take precedence in the CSS cascade. |
|
7759 * @link https://github.com/WordPress/gutenberg/issues/36147. |
|
7760 */ |
|
7761 |
|
7762 let ruleset = 'body {margin: 0;}'; |
|
7763 nodesWithStyles.forEach(_ref8 => { |
|
7764 let { |
|
7765 selector, |
|
7766 duotoneSelector, |
|
7767 styles |
|
7768 } = _ref8; |
|
7769 const duotoneStyles = {}; |
|
7770 |
|
7771 if (styles !== null && styles !== void 0 && styles.filter) { |
|
7772 duotoneStyles.filter = styles.filter; |
|
7773 delete styles.filter; |
|
7774 } // Process duotone styles (they use color.__experimentalDuotone selector). |
|
7775 |
|
7776 |
|
7777 if (duotoneSelector) { |
|
7778 const duotoneDeclarations = getStylesDeclarations(duotoneStyles); |
|
7779 |
|
7780 if (duotoneDeclarations.length === 0) { |
|
7781 return; |
|
7782 } |
|
7783 |
|
7784 ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`; |
|
7785 } // Process the remaning block styles (they use either normal block class or __experimentalSelector). |
|
7786 |
|
7787 |
|
7788 const declarations = getStylesDeclarations(styles); |
|
7789 |
|
7790 if (declarations.length === 0) { |
|
7791 return; |
|
7792 } |
|
7793 |
|
7794 ruleset = ruleset + `${selector}{${declarations.join(';')};}`; |
|
7795 }); |
|
7796 nodesWithSettings.forEach(_ref9 => { |
|
7797 let { |
|
7798 selector, |
|
7799 presets |
|
7800 } = _ref9; |
|
7801 |
|
7802 if (ROOT_BLOCK_SELECTOR === selector) { |
|
7803 // Do not add extra specificity for top-level classes. |
|
7804 selector = ''; |
|
7805 } |
|
7806 |
|
7807 const classes = getPresetsClasses(selector, presets); |
|
7808 |
|
7809 if (!(0,external_lodash_namespaceObject.isEmpty)(classes)) { |
|
7810 ruleset = ruleset + classes; |
|
7811 } |
|
7812 }); |
|
7813 return ruleset; |
|
7814 }; |
|
7815 function toSvgFilters(tree, blockSelectors) { |
|
7816 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); |
|
7817 return nodesWithSettings.flatMap(_ref10 => { |
|
7818 let { |
|
7819 presets |
|
7820 } = _ref10; |
|
7821 return getPresetsSvgFilters(presets); |
|
7822 }); |
|
7823 } |
|
7824 |
|
7825 const getBlockSelectors = blockTypes => { |
|
7826 const result = {}; |
|
7827 blockTypes.forEach(blockType => { |
|
7828 var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$; |
|
7829 |
|
7830 const name = blockType.name; |
|
7831 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('/', '-'); |
|
7832 const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null; |
|
7833 result[name] = { |
|
7834 name, |
|
7835 selector, |
|
7836 duotoneSelector |
|
7837 }; |
|
7838 }); |
|
7839 return result; |
|
7840 }; |
|
7841 |
|
7842 function useGlobalStylesOutput() { |
|
7843 const [stylesheets, setStylesheets] = (0,external_wp_element_namespaceObject.useState)([]); |
|
7844 const [settings, setSettings] = (0,external_wp_element_namespaceObject.useState)({}); |
|
7845 const [svgFilters, setSvgFilters] = (0,external_wp_element_namespaceObject.useState)({}); |
|
7846 const { |
|
7847 merged: mergedConfig |
|
7848 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
|
7849 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
7850 if (!(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.styles) || !(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.settings)) { |
|
7851 return; |
|
7852 } |
|
7853 |
|
7854 const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)()); |
|
7855 const customProperties = toCustomProperties(mergedConfig, blockSelectors); |
|
7856 const globalStyles = toStyles(mergedConfig, blockSelectors); |
|
7857 const filters = toSvgFilters(mergedConfig, blockSelectors); |
|
7858 setStylesheets([{ |
|
7859 css: customProperties, |
|
7860 isGlobalStyles: true |
|
7861 }, { |
|
7862 css: globalStyles, |
|
7863 isGlobalStyles: true |
|
7864 }]); |
|
7865 setSettings(mergedConfig.settings); |
|
7866 setSvgFilters(filters); |
|
7867 }, [mergedConfig]); |
|
7868 return [stylesheets, settings, svgFilters]; |
|
7869 } |
|
7870 |
|
7871 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview.js |
|
7872 |
|
7873 |
|
7874 /** |
|
7875 * WordPress dependencies |
|
7876 */ |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 /** |
|
7882 * Internal dependencies |
|
7883 */ |
|
7884 |
|
7885 |
|
7886 |
|
7887 const firstFrame = { |
|
7888 start: { |
|
7889 opacity: 1, |
|
7890 display: 'block' |
|
7891 }, |
|
7892 hover: { |
|
7893 opacity: 0, |
|
7894 display: 'none' |
|
7895 } |
|
7896 }; |
|
7897 const secondFrame = { |
|
7898 hover: { |
|
7899 opacity: 1, |
|
7900 display: 'block' |
|
7901 }, |
|
7902 start: { |
|
7903 opacity: 0, |
|
7904 display: 'none' |
|
7905 } |
|
7906 }; |
|
7907 const normalizedWidth = 248; |
|
7908 const normalizedHeight = 152; |
|
7909 const normalizedColorSwatchSize = 32; |
|
7910 |
|
7911 const StylesPreview = _ref => { |
|
7912 let { |
|
7913 label, |
|
7914 isFocused |
|
7915 } = _ref; |
|
7916 const [fontWeight] = useStyle('typography.fontWeight'); |
|
7917 const [fontFamily = 'serif'] = useStyle('typography.fontFamily'); |
|
7918 const [headingFontFamily = fontFamily] = useStyle('elements.h1.typography.fontFamily'); |
|
7919 const [headingFontWeight = fontWeight] = useStyle('elements.h1.typography.fontWeight'); |
|
7920 const [textColor = 'black'] = useStyle('color.text'); |
|
7921 const [headingColor = textColor] = useStyle('elements.h1.color.text'); |
|
7922 const [linkColor = 'blue'] = useStyle('elements.link.color.text'); |
|
7923 const [backgroundColor = 'white'] = useStyle('color.background'); |
|
7924 const [gradientValue] = useStyle('color.gradient'); |
|
7925 const [styles] = useGlobalStylesOutput(); |
|
7926 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); |
|
7927 const [coreColors] = useSetting('color.palette.core'); |
|
7928 const [themeColors] = useSetting('color.palette.theme'); |
|
7929 const [customColors] = useSetting('color.palette.custom'); |
|
7930 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); |
|
7931 const [containerResizeListener, { |
|
7932 width |
|
7933 }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); |
|
7934 const ratio = width ? width / normalizedWidth : 1; |
|
7935 const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); |
|
7936 const highlightedColors = paletteColors.filter( // we exclude these two colors because they are already visible in the preview. |
|
7937 _ref2 => { |
|
7938 let { |
|
7939 color |
|
7940 } = _ref2; |
|
7941 return color !== backgroundColor && color !== headingColor; |
|
7942 }).slice(0, 2); // Reset leaked styles from WP common.css. |
|
7943 |
|
7944 const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
7945 if (styles) { |
|
7946 return [...styles, { |
|
7947 css: 'body{min-width: 0;}', |
|
7948 isGlobalStyles: true |
|
7949 }]; |
|
7950 } |
|
7951 |
|
7952 return styles; |
|
7953 }, [styles]); |
|
7954 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, { |
|
7955 className: "edit-site-global-styles-preview__iframe", |
|
7956 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
|
7957 styles: editorStyles |
|
7958 }), |
|
7959 style: { |
|
7960 height: normalizedHeight * ratio, |
|
7961 visibility: !width ? 'hidden' : 'visible' |
|
7962 }, |
|
7963 onMouseEnter: () => setIsHovered(true), |
|
7964 onMouseLeave: () => setIsHovered(false), |
|
7965 tabIndex: -1 |
|
7966 }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
7967 style: { |
|
7968 height: normalizedHeight * ratio, |
|
7969 width: '100%', |
|
7970 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
|
7971 cursor: 'pointer' |
|
7972 }, |
|
7973 initial: "start", |
|
7974 animate: (isHovered || isFocused) && !disableMotion ? 'hover' : 'start' |
|
7975 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
7976 variants: firstFrame, |
|
7977 style: { |
|
7978 height: '100%', |
|
7979 overflow: 'hidden' |
|
7980 } |
|
7981 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
7982 spacing: 10 * ratio, |
|
7983 justify: "center", |
|
7984 style: { |
|
7985 height: '100%', |
|
7986 overflow: 'hidden' |
|
7987 } |
|
7988 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
7989 style: { |
|
7990 fontFamily: headingFontFamily, |
|
7991 fontSize: 65 * ratio, |
|
7992 color: headingColor, |
|
7993 fontWeight: headingFontWeight |
|
7994 } |
|
7995 }, "Aa"), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
7996 spacing: 4 * ratio |
|
7997 }, highlightedColors.map(_ref3 => { |
|
7998 let { |
|
7999 slug, |
|
8000 color |
|
8001 } = _ref3; |
|
8002 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8003 key: slug, |
|
8004 style: { |
|
8005 height: normalizedColorSwatchSize * ratio, |
|
8006 width: normalizedColorSwatchSize * ratio, |
|
8007 background: color, |
|
8008 borderRadius: normalizedColorSwatchSize * ratio / 2 |
|
8009 } |
|
8010 }); |
|
8011 })))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
8012 variants: secondFrame, |
|
8013 style: { |
|
8014 height: '100%', |
|
8015 overflow: 'hidden' |
|
8016 } |
|
8017 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8018 spacing: 3 * ratio, |
|
8019 justify: "center", |
|
8020 style: { |
|
8021 height: '100%', |
|
8022 overflow: 'hidden', |
|
8023 padding: 10 * ratio, |
|
8024 boxSizing: 'border-box' |
|
8025 } |
|
8026 }, label && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8027 style: { |
|
8028 fontSize: 35 * ratio, |
|
8029 fontFamily: headingFontFamily, |
|
8030 color: headingColor, |
|
8031 fontWeight: headingFontWeight, |
|
8032 lineHeight: '1em' |
|
8033 } |
|
8034 }, label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8035 spacing: 2 * ratio, |
|
8036 justify: "flex-start" |
|
8037 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8038 style: { |
|
8039 fontFamily, |
|
8040 fontSize: 24 * ratio, |
|
8041 color: textColor |
|
8042 } |
|
8043 }, "Aa"), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8044 style: { |
|
8045 fontFamily, |
|
8046 fontSize: 24 * ratio, |
|
8047 color: linkColor |
|
8048 } |
|
8049 }, "Aa")), paletteColors && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8050 spacing: 0 |
|
8051 }, paletteColors.slice(0, 4).map((_ref4, index) => { |
|
8052 let { |
|
8053 color |
|
8054 } = _ref4; |
|
8055 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8056 key: index, |
|
8057 style: { |
|
8058 height: 10 * ratio, |
|
8059 width: 30 * ratio, |
|
8060 background: color, |
|
8061 flexGrow: 1 |
|
8062 } |
|
8063 }); |
|
8064 })))))); |
|
8065 }; |
|
8066 |
|
8067 /* harmony default export */ var preview = (StylesPreview); |
|
8068 |
|
8069 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js |
|
8070 |
|
8071 |
|
8072 /** |
|
8073 * WordPress dependencies |
|
8074 */ |
|
8075 |
|
8076 |
|
8077 |
|
8078 |
|
8079 |
|
8080 /** |
|
8081 * Internal dependencies |
|
8082 */ |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 function ScreenRoot() { |
|
8090 const { |
|
8091 variations |
|
8092 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
8093 return { |
|
8094 variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() |
|
8095 }; |
|
8096 }, []); |
|
8097 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
8098 size: "small" |
|
8099 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8100 spacing: 2 |
|
8101 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardMedia, null, (0,external_wp_element_namespaceObject.createElement)(preview, null))), !!(variations !== null && variations !== void 0 && variations.length) && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8102 path: "/variations" |
|
8103 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8104 justify: "space-between" |
|
8105 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Browse styles')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { |
|
8106 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
|
8107 }))))), (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, { |
|
8108 path: "/blocks" |
|
8109 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8110 justify: "space-between" |
|
8111 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, { |
|
8112 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
|
8113 })))))); |
|
8114 } |
|
8115 |
|
8116 /* harmony default export */ var screen_root = (ScreenRoot); |
|
8117 |
|
8118 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js |
|
8119 |
|
8120 |
|
8121 /** |
|
8122 * WordPress dependencies |
|
8123 */ |
|
8124 |
|
8125 |
|
8126 |
|
8127 /** |
|
8128 * Internal dependencies |
|
8129 */ |
|
8130 |
|
8131 |
|
8132 |
|
8133 function ScreenHeader(_ref) { |
|
8134 let { |
|
8135 title, |
|
8136 description |
|
8137 } = _ref; |
|
8138 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8139 spacing: 2 |
|
8140 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8141 spacing: 2 |
|
8142 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(NavigationBackButton, { |
|
8143 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, |
|
8144 size: "small", |
|
8145 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') |
|
8146 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
8147 level: 5 |
|
8148 }, title))), description && (0,external_wp_element_namespaceObject.createElement)("p", { |
|
8149 className: "edit-site-global-styles-header__description" |
|
8150 }, description)); |
|
8151 } |
|
8152 |
|
8153 /* harmony default export */ var header = (ScreenHeader); |
|
8154 |
|
8155 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js |
|
8156 |
|
8157 |
|
8158 /** |
|
8159 * WordPress dependencies |
|
8160 */ |
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 /** |
|
8170 * Internal dependencies |
|
8171 */ |
|
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 function useSortedBlockTypes() { |
|
8181 const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // Ensure core blocks are prioritized in the returned results, |
|
8182 // because third party blocks can be registered earlier than |
|
8183 // the core blocks (usually by using the `init` action), |
|
8184 // thus affecting the display order. |
|
8185 // We don't sort reusable blocks as they are handled differently. |
|
8186 |
|
8187 const groupByType = (blocks, block) => { |
|
8188 const { |
|
8189 core, |
|
8190 noncore |
|
8191 } = blocks; |
|
8192 const type = block.name.startsWith('core/') ? core : noncore; |
|
8193 type.push(block); |
|
8194 return blocks; |
|
8195 }; |
|
8196 |
|
8197 const { |
|
8198 core: coreItems, |
|
8199 noncore: nonCoreItems |
|
8200 } = blockItems.reduce(groupByType, { |
|
8201 core: [], |
|
8202 noncore: [] |
|
8203 }); |
|
8204 return [...coreItems, ...nonCoreItems]; |
|
8205 } |
|
8206 |
|
8207 function BlockMenuItem(_ref) { |
|
8208 let { |
|
8209 block |
|
8210 } = _ref; |
|
8211 const hasTypographyPanel = useHasTypographyPanel(block.name); |
|
8212 const hasColorPanel = useHasColorPanel(block.name); |
|
8213 const hasBorderPanel = useHasBorderPanel(block.name); |
|
8214 const hasDimensionsPanel = useHasDimensionsPanel(block.name); |
|
8215 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; |
|
8216 const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel; |
|
8217 |
|
8218 if (!hasBlockMenuItem) { |
|
8219 return null; |
|
8220 } |
|
8221 |
|
8222 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8223 path: '/blocks/' + block.name |
|
8224 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8225 justify: "flex-start" |
|
8226 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
|
8227 icon: block.icon |
|
8228 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title))); |
|
8229 } |
|
8230 |
|
8231 function ScreenBlockList() { |
|
8232 const sortedBlockTypes = useSortedBlockTypes(); |
|
8233 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); |
|
8234 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); |
|
8235 const isMatchingSearchTerm = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm, []); |
|
8236 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
8237 if (!filterValue) { |
|
8238 return sortedBlockTypes; |
|
8239 } |
|
8240 |
|
8241 return sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); |
|
8242 }, [filterValue, sortedBlockTypes, isMatchingSearchTerm]); |
|
8243 const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); // Announce search results on change |
|
8244 |
|
8245 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
8246 if (!filterValue) { |
|
8247 return; |
|
8248 } // We extract the results from the wrapper div's `ref` because |
|
8249 // filtered items can contain items that will eventually not |
|
8250 // render and there is no reliable way to detect when a child |
|
8251 // will return `null`. |
|
8252 // TODO: We should find a better way of handling this as it's |
|
8253 // fragile and depends on the number of rendered elements of `BlockMenuItem`, |
|
8254 // which is now one. |
|
8255 // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 |
|
8256 |
|
8257 |
|
8258 const count = blockTypesListRef.current.childElementCount; |
|
8259 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
8260 /* translators: %d: number of results. */ |
|
8261 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); |
|
8262 debouncedSpeak(resultsFoundMessage, count); |
|
8263 }, [filterValue, debouncedSpeak]); |
|
8264 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8265 title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), |
|
8266 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') |
|
8267 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { |
|
8268 className: "edit-site-block-types-search", |
|
8269 onChange: setFilterValue, |
|
8270 value: filterValue, |
|
8271 label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'), |
|
8272 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') |
|
8273 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8274 ref: blockTypesListRef, |
|
8275 className: "edit-site-block-types-item-list" |
|
8276 }, filteredBlockTypes.map(block => (0,external_wp_element_namespaceObject.createElement)(BlockMenuItem, { |
|
8277 block: block, |
|
8278 key: 'menu-itemblock-' + block.name |
|
8279 })))); |
|
8280 } |
|
8281 |
|
8282 /* harmony default export */ var screen_block_list = (ScreenBlockList); |
|
8283 |
|
8284 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js |
|
8285 |
|
8286 |
|
8287 /** |
|
8288 * WordPress dependencies |
|
8289 */ |
|
8290 |
|
8291 /** |
|
8292 * Internal dependencies |
|
8293 */ |
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 function ScreenBlock(_ref) { |
|
8299 let { |
|
8300 name |
|
8301 } = _ref; |
|
8302 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); |
|
8303 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8304 title: blockType.title |
|
8305 }), (0,external_wp_element_namespaceObject.createElement)(context_menu, { |
|
8306 parentMenu: '/blocks/' + name, |
|
8307 name: name |
|
8308 })); |
|
8309 } |
|
8310 |
|
8311 /* harmony default export */ var screen_block = (ScreenBlock); |
|
8312 |
|
8313 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js |
|
8314 |
|
8315 |
|
8316 /** |
|
8317 * WordPress dependencies |
|
8318 */ |
|
8319 |
|
8320 |
|
8321 function Subtitle(_ref) { |
|
8322 let { |
|
8323 children |
|
8324 } = _ref; |
|
8325 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
8326 className: "edit-site-global-styles-subtitle", |
|
8327 level: 2 |
|
8328 }, children); |
|
8329 } |
|
8330 |
|
8331 /* harmony default export */ var subtitle = (Subtitle); |
|
8332 |
|
8333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js |
|
8334 |
|
8335 |
|
8336 /** |
|
8337 * WordPress dependencies |
|
8338 */ |
|
8339 |
|
8340 |
|
8341 /** |
|
8342 * Internal dependencies |
|
8343 */ |
|
8344 |
|
8345 |
|
8346 |
|
8347 |
|
8348 |
|
8349 |
|
8350 |
|
8351 function Item(_ref) { |
|
8352 let { |
|
8353 name, |
|
8354 parentMenu, |
|
8355 element, |
|
8356 label |
|
8357 } = _ref; |
|
8358 const hasSupport = !name; |
|
8359 const prefix = element === 'text' || !element ? '' : `elements.${element}.`; |
|
8360 const extraStyles = element === 'link' ? { |
|
8361 textDecoration: 'underline' |
|
8362 } : {}; |
|
8363 const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name); |
|
8364 const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name); |
|
8365 const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name); |
|
8366 const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name); |
|
8367 const [backgroundColor] = useStyle(prefix + 'color.background', name); |
|
8368 const [gradientValue] = useStyle(prefix + 'color.gradient', name); |
|
8369 const [color] = useStyle(prefix + 'color.text', name); |
|
8370 |
|
8371 if (!hasSupport) { |
|
8372 return null; |
|
8373 } |
|
8374 |
|
8375 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8376 path: parentMenu + '/typography/' + element |
|
8377 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8378 justify: "flex-start" |
|
8379 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
|
8380 className: "edit-site-global-styles-screen-typography__indicator", |
|
8381 style: { |
|
8382 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', |
|
8383 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, |
|
8384 color, |
|
8385 fontStyle, |
|
8386 fontWeight, |
|
8387 letterSpacing, |
|
8388 ...extraStyles |
|
8389 } |
|
8390 }, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, label))); |
|
8391 } |
|
8392 |
|
8393 function ScreenTypography(_ref2) { |
|
8394 let { |
|
8395 name |
|
8396 } = _ref2; |
|
8397 const parentMenu = name === undefined ? '' : '/blocks/' + name; |
|
8398 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8399 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), |
|
8400 description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.') |
|
8401 }), !name && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8402 className: "edit-site-global-styles-screen-typography" |
|
8403 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8404 spacing: 3 |
|
8405 }, (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, { |
|
8406 isBordered: true, |
|
8407 isSeparated: true |
|
8408 }, (0,external_wp_element_namespaceObject.createElement)(Item, { |
|
8409 name: name, |
|
8410 parentMenu: parentMenu, |
|
8411 element: "text", |
|
8412 label: (0,external_wp_i18n_namespaceObject.__)('Text') |
|
8413 }), (0,external_wp_element_namespaceObject.createElement)(Item, { |
|
8414 name: name, |
|
8415 parentMenu: parentMenu, |
|
8416 element: "link", |
|
8417 label: (0,external_wp_i18n_namespaceObject.__)('Links') |
|
8418 })))), !!name && (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { |
|
8419 name: name, |
|
8420 element: "text" |
|
8421 })); |
|
8422 } |
|
8423 |
|
8424 /* harmony default export */ var screen_typography = (ScreenTypography); |
|
8425 |
|
8426 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js |
|
8427 |
|
8428 |
|
8429 /** |
|
8430 * WordPress dependencies |
|
8431 */ |
|
8432 |
|
8433 /** |
|
8434 * Internal dependencies |
|
8435 */ |
|
8436 |
|
8437 |
|
8438 |
|
8439 const screen_typography_element_elements = { |
|
8440 text: { |
|
8441 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), |
|
8442 title: (0,external_wp_i18n_namespaceObject.__)('Text') |
|
8443 }, |
|
8444 link: { |
|
8445 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), |
|
8446 title: (0,external_wp_i18n_namespaceObject.__)('Links') |
|
8447 } |
|
8448 }; |
|
8449 |
|
8450 function ScreenTypographyElement(_ref) { |
|
8451 let { |
|
8452 name, |
|
8453 element |
|
8454 } = _ref; |
|
8455 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8456 title: screen_typography_element_elements[element].title, |
|
8457 description: screen_typography_element_elements[element].description |
|
8458 }), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, { |
|
8459 name: name, |
|
8460 element: element |
|
8461 })); |
|
8462 } |
|
8463 |
|
8464 /* harmony default export */ var screen_typography_element = (ScreenTypographyElement); |
|
8465 |
|
8466 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js |
|
8467 |
|
8468 |
|
8469 |
|
8470 /** |
|
8471 * External dependencies |
|
8472 */ |
|
8473 |
|
8474 /** |
|
8475 * WordPress dependencies |
|
8476 */ |
|
8477 |
|
8478 |
|
8479 |
|
8480 function ColorIndicatorWrapper(_ref) { |
|
8481 let { |
|
8482 className, |
|
8483 ...props |
|
8484 } = _ref; |
|
8485 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, extends_extends({ |
|
8486 className: classnames_default()('edit-site-global-styles__color-indicator-wrapper', className) |
|
8487 }, props)); |
|
8488 } |
|
8489 |
|
8490 /* harmony default export */ var color_indicator_wrapper = (ColorIndicatorWrapper); |
|
8491 |
|
8492 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js |
|
8493 |
|
8494 |
|
8495 /** |
|
8496 * WordPress dependencies |
|
8497 */ |
|
8498 |
|
8499 |
|
8500 |
|
8501 /** |
|
8502 * Internal dependencies |
|
8503 */ |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 |
|
8509 const EMPTY_COLORS = []; |
|
8510 |
|
8511 function Palette(_ref) { |
|
8512 let { |
|
8513 name |
|
8514 } = _ref; |
|
8515 const [customColors] = useSetting('color.palette.custom'); |
|
8516 const [themeColors] = useSetting('color.palette.theme'); |
|
8517 const [defaultColors] = useSetting('color.palette.default'); |
|
8518 const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); |
|
8519 const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); |
|
8520 const screenPath = !name ? '/colors/palette' : '/blocks/' + name + '/colors/palette'; |
|
8521 const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of palette colors. |
|
8522 (0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors'); |
|
8523 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8524 spacing: 3 |
|
8525 }, (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, { |
|
8526 isBordered: true, |
|
8527 isSeparated: true |
|
8528 }, (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8529 path: screenPath |
|
8530 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8531 direction: colors.length === 0 ? 'row-reverse' : 'row' |
|
8532 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, { |
|
8533 isLayered: false, |
|
8534 offset: -8 |
|
8535 }, colors.slice(0, 5).map(_ref2 => { |
|
8536 let { |
|
8537 color |
|
8538 } = _ref2; |
|
8539 return (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { |
|
8540 key: color |
|
8541 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
|
8542 colorValue: color |
|
8543 })); |
|
8544 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText))))); |
|
8545 } |
|
8546 |
|
8547 /* harmony default export */ var palette = (Palette); |
|
8548 |
|
8549 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js |
|
8550 |
|
8551 |
|
8552 /** |
|
8553 * WordPress dependencies |
|
8554 */ |
|
8555 |
|
8556 |
|
8557 /** |
|
8558 * Internal dependencies |
|
8559 */ |
|
8560 |
|
8561 |
|
8562 |
|
8563 |
|
8564 |
|
8565 |
|
8566 |
|
8567 |
|
8568 function BackgroundColorItem(_ref) { |
|
8569 let { |
|
8570 name, |
|
8571 parentMenu |
|
8572 } = _ref; |
|
8573 const supports = getSupportedGlobalStylesPanels(name); |
|
8574 const hasSupport = supports.includes('backgroundColor') || supports.includes('background'); |
|
8575 const [backgroundColor] = useStyle('color.background', name); |
|
8576 const [gradientValue] = useStyle('color.gradient', name); |
|
8577 |
|
8578 if (!hasSupport) { |
|
8579 return null; |
|
8580 } |
|
8581 |
|
8582 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8583 path: parentMenu + '/colors/background' |
|
8584 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8585 justify: "flex-start" |
|
8586 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { |
|
8587 expanded: false |
|
8588 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
|
8589 colorValue: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor |
|
8590 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Background')))); |
|
8591 } |
|
8592 |
|
8593 function TextColorItem(_ref2) { |
|
8594 let { |
|
8595 name, |
|
8596 parentMenu |
|
8597 } = _ref2; |
|
8598 const supports = getSupportedGlobalStylesPanels(name); |
|
8599 const hasSupport = supports.includes('color'); |
|
8600 const [color] = useStyle('color.text', name); |
|
8601 |
|
8602 if (!hasSupport) { |
|
8603 return null; |
|
8604 } |
|
8605 |
|
8606 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8607 path: parentMenu + '/colors/text' |
|
8608 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8609 justify: "flex-start" |
|
8610 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { |
|
8611 expanded: false |
|
8612 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
|
8613 colorValue: color |
|
8614 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Text')))); |
|
8615 } |
|
8616 |
|
8617 function LinkColorItem(_ref3) { |
|
8618 let { |
|
8619 name, |
|
8620 parentMenu |
|
8621 } = _ref3; |
|
8622 const supports = getSupportedGlobalStylesPanels(name); |
|
8623 const hasSupport = supports.includes('linkColor'); |
|
8624 const [color] = useStyle('elements.link.color.text', name); |
|
8625 |
|
8626 if (!hasSupport) { |
|
8627 return null; |
|
8628 } |
|
8629 |
|
8630 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, { |
|
8631 path: parentMenu + '/colors/link' |
|
8632 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
8633 justify: "flex-start" |
|
8634 }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, { |
|
8635 expanded: false |
|
8636 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, { |
|
8637 colorValue: color |
|
8638 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Links')))); |
|
8639 } |
|
8640 |
|
8641 function ScreenColors(_ref4) { |
|
8642 let { |
|
8643 name |
|
8644 } = _ref4; |
|
8645 const parentMenu = name === undefined ? '' : '/blocks/' + name; |
|
8646 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8647 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), |
|
8648 description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.') |
|
8649 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8650 className: "edit-site-global-styles-screen-colors" |
|
8651 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8652 spacing: 10 |
|
8653 }, (0,external_wp_element_namespaceObject.createElement)(palette, { |
|
8654 name: name |
|
8655 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8656 spacing: 3 |
|
8657 }, (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, { |
|
8658 isBordered: true, |
|
8659 isSeparated: true |
|
8660 }, (0,external_wp_element_namespaceObject.createElement)(BackgroundColorItem, { |
|
8661 name: name, |
|
8662 parentMenu: parentMenu |
|
8663 }), (0,external_wp_element_namespaceObject.createElement)(TextColorItem, { |
|
8664 name: name, |
|
8665 parentMenu: parentMenu |
|
8666 }), (0,external_wp_element_namespaceObject.createElement)(LinkColorItem, { |
|
8667 name: name, |
|
8668 parentMenu: parentMenu |
|
8669 })))))); |
|
8670 } |
|
8671 |
|
8672 /* harmony default export */ var screen_colors = (ScreenColors); |
|
8673 |
|
8674 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js |
|
8675 |
|
8676 |
|
8677 /** |
|
8678 * WordPress dependencies |
|
8679 */ |
|
8680 |
|
8681 |
|
8682 /** |
|
8683 * Internal dependencies |
|
8684 */ |
|
8685 |
|
8686 |
|
8687 function ColorPalettePanel(_ref) { |
|
8688 let { |
|
8689 name |
|
8690 } = _ref; |
|
8691 const [themeColors, setThemeColors] = useSetting('color.palette.theme', name); |
|
8692 const [baseThemeColors] = useSetting('color.palette.theme', name, 'base'); |
|
8693 const [defaultColors, setDefaultColors] = useSetting('color.palette.default', name); |
|
8694 const [baseDefaultColors] = useSetting('color.palette.default', name, 'base'); |
|
8695 const [customColors, setCustomColors] = useSetting('color.palette.custom', name); |
|
8696 const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name); |
|
8697 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8698 className: "edit-site-global-styles-color-palette-panel", |
|
8699 spacing: 10 |
|
8700 }, !!themeColors && !!themeColors.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8701 canReset: themeColors !== baseThemeColors, |
|
8702 canOnlyChangeValues: true, |
|
8703 colors: themeColors, |
|
8704 onChange: setThemeColors, |
|
8705 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') |
|
8706 }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8707 canReset: defaultColors !== baseDefaultColors, |
|
8708 canOnlyChangeValues: true, |
|
8709 colors: defaultColors, |
|
8710 onChange: setDefaultColors, |
|
8711 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') |
|
8712 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8713 colors: customColors, |
|
8714 onChange: setCustomColors, |
|
8715 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), |
|
8716 emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'), |
|
8717 slugPrefix: "custom-" |
|
8718 })); |
|
8719 } |
|
8720 |
|
8721 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js |
|
8722 |
|
8723 |
|
8724 /** |
|
8725 * External dependencies |
|
8726 */ |
|
8727 |
|
8728 /** |
|
8729 * WordPress dependencies |
|
8730 */ |
|
8731 |
|
8732 |
|
8733 |
|
8734 /** |
|
8735 * Internal dependencies |
|
8736 */ |
|
8737 |
|
8738 |
|
8739 |
|
8740 function GradientPalettePanel(_ref) { |
|
8741 let { |
|
8742 name |
|
8743 } = _ref; |
|
8744 const [themeGradients, setThemeGradients] = useSetting('color.gradients.theme', name); |
|
8745 const [baseThemeGradients] = useSetting('color.gradients.theme', name, 'base'); |
|
8746 const [defaultGradients, setDefaultGradients] = useSetting('color.gradients.default', name); |
|
8747 const [baseDefaultGradients] = useSetting('color.gradients.default', name, 'base'); |
|
8748 const [customGradients, setCustomGradients] = useSetting('color.gradients.custom', name); |
|
8749 const [defaultPaletteEnabled] = useSetting('color.defaultGradients', name); |
|
8750 const [duotonePalette] = useSetting('color.duotone') || []; |
|
8751 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { |
|
8752 className: "edit-site-global-styles-gradient-palette-panel", |
|
8753 spacing: 10 |
|
8754 }, !!themeGradients && !!themeGradients.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8755 canReset: themeGradients !== baseThemeGradients, |
|
8756 canOnlyChangeValues: true, |
|
8757 gradients: themeGradients, |
|
8758 onChange: setThemeGradients, |
|
8759 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme') |
|
8760 }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8761 canReset: defaultGradients !== baseDefaultGradients, |
|
8762 canOnlyChangeValues: true, |
|
8763 gradients: defaultGradients, |
|
8764 onChange: setDefaultGradients, |
|
8765 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default') |
|
8766 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { |
|
8767 gradients: customGradients, |
|
8768 onChange: setCustomGradients, |
|
8769 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), |
|
8770 emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'), |
|
8771 slugPrefix: "custom-" |
|
8772 }), (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, { |
|
8773 margin: 3 |
|
8774 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, { |
|
8775 duotonePalette: duotonePalette, |
|
8776 disableCustomDuotone: true, |
|
8777 disableCustomColors: true, |
|
8778 clearable: false, |
|
8779 onChange: external_lodash_namespaceObject.noop |
|
8780 }))); |
|
8781 } |
|
8782 |
|
8783 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js |
|
8784 |
|
8785 |
|
8786 /** |
|
8787 * WordPress dependencies |
|
8788 */ |
|
8789 |
|
8790 |
|
8791 |
|
8792 /** |
|
8793 * Internal dependencies |
|
8794 */ |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 function ScreenColorPalette(_ref) { |
|
8801 let { |
|
8802 name |
|
8803 } = _ref; |
|
8804 const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('solid'); |
|
8805 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8806 title: (0,external_wp_i18n_namespaceObject.__)('Palette'), |
|
8807 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.') |
|
8808 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { |
|
8809 className: "edit-site-screen-color-palette-toggle", |
|
8810 value: currentTab, |
|
8811 onChange: setCurrentTab, |
|
8812 label: (0,external_wp_i18n_namespaceObject.__)('Select palette type'), |
|
8813 hideLabelFromVision: true, |
|
8814 isBlock: true |
|
8815 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { |
|
8816 value: "solid", |
|
8817 label: (0,external_wp_i18n_namespaceObject.__)('Solid') |
|
8818 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { |
|
8819 value: "gradient", |
|
8820 label: (0,external_wp_i18n_namespaceObject.__)('Gradient') |
|
8821 })), currentTab === 'solid' && (0,external_wp_element_namespaceObject.createElement)(ColorPalettePanel, { |
|
8822 name: name |
|
8823 }), currentTab === 'gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientPalettePanel, { |
|
8824 name: name |
|
8825 })); |
|
8826 } |
|
8827 |
|
8828 /* harmony default export */ var screen_color_palette = (ScreenColorPalette); |
|
8829 |
|
8830 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background-color.js |
|
8831 |
|
8832 |
|
8833 |
|
8834 /** |
|
8835 * WordPress dependencies |
|
8836 */ |
|
8837 |
|
8838 |
|
8839 /** |
|
8840 * Internal dependencies |
|
8841 */ |
|
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 function ScreenBackgroundColor(_ref) { |
|
8847 let { |
|
8848 name |
|
8849 } = _ref; |
|
8850 const supports = getSupportedGlobalStylesPanels(name); |
|
8851 const [solids] = useSetting('color.palette', name); |
|
8852 const [gradients] = useSetting('color.gradients', name); |
|
8853 const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
|
8854 const [areCustomGradientsEnabled] = useSetting('color.customGradient', name); |
|
8855 const colorsPerOrigin = useColorsPerOrigin(name); |
|
8856 const gradientsPerOrigin = useGradientsPerOrigin(name); |
|
8857 const [isBackgroundEnabled] = useSetting('color.background', name); |
|
8858 const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
|
8859 const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled); |
|
8860 const [backgroundColor, setBackgroundColor] = useStyle('color.background', name); |
|
8861 const [userBackgroundColor] = useStyle('color.background', name, 'user'); |
|
8862 const [gradient, setGradient] = useStyle('color.gradient', name); |
|
8863 const [userGradient] = useStyle('color.gradient', name, 'user'); |
|
8864 |
|
8865 if (!hasBackgroundColor && !hasGradientColor) { |
|
8866 return null; |
|
8867 } |
|
8868 |
|
8869 let backgroundSettings = {}; |
|
8870 |
|
8871 if (hasBackgroundColor) { |
|
8872 backgroundSettings = { |
|
8873 colorValue: backgroundColor, |
|
8874 onColorChange: setBackgroundColor |
|
8875 }; |
|
8876 |
|
8877 if (backgroundColor) { |
|
8878 backgroundSettings.clearable = backgroundColor === userBackgroundColor; |
|
8879 } |
|
8880 } |
|
8881 |
|
8882 let gradientSettings = {}; |
|
8883 |
|
8884 if (hasGradientColor) { |
|
8885 gradientSettings = { |
|
8886 gradientValue: gradient, |
|
8887 onGradientChange: setGradient |
|
8888 }; |
|
8889 |
|
8890 if (gradient) { |
|
8891 gradientSettings.clearable = gradient === userGradient; |
|
8892 } |
|
8893 } |
|
8894 |
|
8895 const controlProps = { ...backgroundSettings, |
|
8896 ...gradientSettings |
|
8897 }; |
|
8898 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8899 title: (0,external_wp_i18n_namespaceObject.__)('Background'), |
|
8900 description: (0,external_wp_i18n_namespaceObject.__)('Set a background color or gradient for the whole site.') |
|
8901 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({ |
|
8902 className: "edit-site-screen-background-color__control", |
|
8903 colors: colorsPerOrigin, |
|
8904 gradients: gradientsPerOrigin, |
|
8905 disableCustomColors: !areCustomSolidsEnabled, |
|
8906 disableCustomGradients: !areCustomGradientsEnabled, |
|
8907 __experimentalHasMultipleOrigins: true, |
|
8908 showTitle: false, |
|
8909 enableAlpha: true, |
|
8910 __experimentalIsRenderedInSidebar: true |
|
8911 }, controlProps))); |
|
8912 } |
|
8913 |
|
8914 /* harmony default export */ var screen_background_color = (ScreenBackgroundColor); |
|
8915 |
|
8916 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-text-color.js |
|
8917 |
|
8918 |
|
8919 /** |
|
8920 * WordPress dependencies |
|
8921 */ |
|
8922 |
|
8923 |
|
8924 /** |
|
8925 * Internal dependencies |
|
8926 */ |
|
8927 |
|
8928 |
|
8929 |
|
8930 |
|
8931 function ScreenTextColor(_ref) { |
|
8932 let { |
|
8933 name |
|
8934 } = _ref; |
|
8935 const supports = getSupportedGlobalStylesPanels(name); |
|
8936 const [solids] = useSetting('color.palette', name); |
|
8937 const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
|
8938 const [isTextEnabled] = useSetting('color.text', name); |
|
8939 const colorsPerOrigin = useColorsPerOrigin(name); |
|
8940 const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
|
8941 const [color, setColor] = useStyle('color.text', name); |
|
8942 const [userColor] = useStyle('color.text', name, 'user'); |
|
8943 |
|
8944 if (!hasTextColor) { |
|
8945 return null; |
|
8946 } |
|
8947 |
|
8948 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8949 title: (0,external_wp_i18n_namespaceObject.__)('Text'), |
|
8950 description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for text across the site.') |
|
8951 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { |
|
8952 className: "edit-site-screen-text-color__control", |
|
8953 colors: colorsPerOrigin, |
|
8954 disableCustomColors: !areCustomSolidsEnabled, |
|
8955 __experimentalHasMultipleOrigins: true, |
|
8956 showTitle: false, |
|
8957 enableAlpha: true, |
|
8958 __experimentalIsRenderedInSidebar: true, |
|
8959 colorValue: color, |
|
8960 onColorChange: setColor, |
|
8961 clearable: color === userColor |
|
8962 })); |
|
8963 } |
|
8964 |
|
8965 /* harmony default export */ var screen_text_color = (ScreenTextColor); |
|
8966 |
|
8967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-link-color.js |
|
8968 |
|
8969 |
|
8970 /** |
|
8971 * WordPress dependencies |
|
8972 */ |
|
8973 |
|
8974 |
|
8975 /** |
|
8976 * Internal dependencies |
|
8977 */ |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 function ScreenLinkColor(_ref) { |
|
8983 let { |
|
8984 name |
|
8985 } = _ref; |
|
8986 const supports = getSupportedGlobalStylesPanels(name); |
|
8987 const [solids] = useSetting('color.palette', name); |
|
8988 const [areCustomSolidsEnabled] = useSetting('color.custom', name); |
|
8989 const colorsPerOrigin = useColorsPerOrigin(name); |
|
8990 const [isLinkEnabled] = useSetting('color.link', name); |
|
8991 const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled); |
|
8992 const [linkColor, setLinkColor] = useStyle('elements.link.color.text', name); |
|
8993 const [userLinkColor] = useStyle('elements.link.color.text', name, 'user'); |
|
8994 |
|
8995 if (!hasLinkColor) { |
|
8996 return null; |
|
8997 } |
|
8998 |
|
8999 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
9000 title: (0,external_wp_i18n_namespaceObject.__)('Links'), |
|
9001 description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for links across the site.') |
|
9002 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, { |
|
9003 className: "edit-site-screen-link-color__control", |
|
9004 colors: colorsPerOrigin, |
|
9005 disableCustomColors: !areCustomSolidsEnabled, |
|
9006 __experimentalHasMultipleOrigins: true, |
|
9007 showTitle: false, |
|
9008 enableAlpha: true, |
|
9009 __experimentalIsRenderedInSidebar: true, |
|
9010 colorValue: linkColor, |
|
9011 onColorChange: setLinkColor, |
|
9012 clearable: linkColor === userLinkColor |
|
9013 })); |
|
9014 } |
|
9015 |
|
9016 /* harmony default export */ var screen_link_color = (ScreenLinkColor); |
|
9017 |
|
9018 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js |
|
9019 |
|
9020 |
|
9021 /** |
|
9022 * WordPress dependencies |
|
9023 */ |
|
9024 |
|
9025 /** |
|
9026 * Internal dependencies |
|
9027 */ |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 |
|
9033 function ScreenLayout(_ref) { |
|
9034 let { |
|
9035 name |
|
9036 } = _ref; |
|
9037 const hasBorderPanel = useHasBorderPanel(name); |
|
9038 const hasDimensionsPanel = useHasDimensionsPanel(name); |
|
9039 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
9040 title: (0,external_wp_i18n_namespaceObject.__)('Layout') |
|
9041 }), hasDimensionsPanel && (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, { |
|
9042 name: name |
|
9043 }), hasBorderPanel && (0,external_wp_element_namespaceObject.createElement)(BorderPanel, { |
|
9044 name: name |
|
9045 })); |
|
9046 } |
|
9047 |
|
9048 /* harmony default export */ var screen_layout = (ScreenLayout); |
|
9049 |
|
9050 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/global-styles-provider.js |
|
9051 |
|
9052 |
|
9053 /** |
|
9054 * External dependencies |
|
9055 */ |
|
9056 |
|
9057 /** |
|
9058 * WordPress dependencies |
|
9059 */ |
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 /** |
|
9065 * Internal dependencies |
|
9066 */ |
|
9067 |
|
9068 |
|
9069 |
|
9070 function mergeTreesCustomizer(_, srcValue) { |
|
9071 // We only pass as arrays the presets, |
|
9072 // in which case we want the new array of values |
|
9073 // to override the old array (no merging). |
|
9074 if (Array.isArray(srcValue)) { |
|
9075 return srcValue; |
|
9076 } |
|
9077 } |
|
9078 |
|
9079 function mergeBaseAndUserConfigs(base, user) { |
|
9080 return (0,external_lodash_namespaceObject.mergeWith)({}, base, user, mergeTreesCustomizer); |
|
9081 } |
|
9082 |
|
9083 const cleanEmptyObject = object => { |
|
9084 if (!(0,external_lodash_namespaceObject.isObject)(object) || Array.isArray(object)) { |
|
9085 return object; |
|
9086 } |
|
9087 |
|
9088 const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), external_lodash_namespaceObject.identity); |
|
9089 return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects; |
|
9090 }; |
|
9091 |
|
9092 function useGlobalStylesUserConfig() { |
|
9093 const { |
|
9094 globalStylesId, |
|
9095 settings, |
|
9096 styles |
|
9097 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9098 const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); |
|
9099 |
|
9100 const record = _globalStylesId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined; |
|
9101 return { |
|
9102 globalStylesId: _globalStylesId, |
|
9103 settings: record === null || record === void 0 ? void 0 : record.settings, |
|
9104 styles: record === null || record === void 0 ? void 0 : record.styles |
|
9105 }; |
|
9106 }, []); |
|
9107 const { |
|
9108 getEditedEntityRecord |
|
9109 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
|
9110 const { |
|
9111 editEntityRecord |
|
9112 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
9113 const config = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9114 return { |
|
9115 settings: settings !== null && settings !== void 0 ? settings : {}, |
|
9116 styles: styles !== null && styles !== void 0 ? styles : {} |
|
9117 }; |
|
9118 }, [settings, styles]); |
|
9119 const setConfig = (0,external_wp_element_namespaceObject.useCallback)(callback => { |
|
9120 var _record$styles, _record$settings; |
|
9121 |
|
9122 const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); |
|
9123 const currentConfig = { |
|
9124 styles: (_record$styles = record === null || record === void 0 ? void 0 : record.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, |
|
9125 settings: (_record$settings = record === null || record === void 0 ? void 0 : record.settings) !== null && _record$settings !== void 0 ? _record$settings : {} |
|
9126 }; |
|
9127 const updatedConfig = callback(currentConfig); |
|
9128 editEntityRecord('root', 'globalStyles', globalStylesId, { |
|
9129 styles: cleanEmptyObject(updatedConfig.styles) || {}, |
|
9130 settings: cleanEmptyObject(updatedConfig.settings) || {} |
|
9131 }); |
|
9132 }, [globalStylesId]); |
|
9133 return [!!settings || !!styles, config, setConfig]; |
|
9134 } |
|
9135 |
|
9136 function useGlobalStylesBaseConfig() { |
|
9137 const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9138 return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(); |
|
9139 }, []); |
|
9140 return [!!baseConfig, baseConfig]; |
|
9141 } |
|
9142 |
|
9143 function useGlobalStylesContext() { |
|
9144 const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); |
|
9145 const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); |
|
9146 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9147 if (!baseConfig || !userConfig) { |
|
9148 return {}; |
|
9149 } |
|
9150 |
|
9151 return mergeBaseAndUserConfigs(baseConfig, userConfig); |
|
9152 }, [userConfig, baseConfig]); |
|
9153 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9154 return { |
|
9155 isReady: isUserConfigReady && isBaseConfigReady, |
|
9156 user: userConfig, |
|
9157 base: baseConfig, |
|
9158 merged: mergedConfig, |
|
9159 setUserConfig |
|
9160 }; |
|
9161 }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); |
|
9162 return context; |
|
9163 } |
|
9164 |
|
9165 function GlobalStylesProvider(_ref) { |
|
9166 let { |
|
9167 children |
|
9168 } = _ref; |
|
9169 const context = useGlobalStylesContext(); |
|
9170 |
|
9171 if (!context.isReady) { |
|
9172 return null; |
|
9173 } |
|
9174 |
|
9175 return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { |
|
9176 value: context |
|
9177 }, children); |
|
9178 } |
|
9179 |
|
9180 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js |
|
9181 |
|
9182 |
|
9183 /** |
|
9184 * External dependencies |
|
9185 */ |
|
9186 |
|
9187 |
|
9188 /** |
|
9189 * WordPress dependencies |
|
9190 */ |
|
9191 |
|
9192 |
|
9193 |
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 /** |
|
9199 * Internal dependencies |
|
9200 */ |
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 function compareVariations(a, b) { |
|
9208 return (0,external_lodash_namespaceObject.isEqual)(a.styles, b.styles) && (0,external_lodash_namespaceObject.isEqual)(a.settings, b.settings); |
|
9209 } |
|
9210 |
|
9211 function Variation(_ref) { |
|
9212 let { |
|
9213 variation |
|
9214 } = _ref; |
|
9215 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); |
|
9216 const { |
|
9217 base, |
|
9218 user, |
|
9219 setUserConfig |
|
9220 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); |
|
9221 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9222 var _variation$settings, _variation$styles; |
|
9223 |
|
9224 return { |
|
9225 user: { |
|
9226 settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, |
|
9227 styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {} |
|
9228 }, |
|
9229 base, |
|
9230 merged: mergeBaseAndUserConfigs(base, variation), |
|
9231 setUserConfig: () => {} |
|
9232 }; |
|
9233 }, [variation, base]); |
|
9234 |
|
9235 const selectVariation = () => { |
|
9236 setUserConfig(() => { |
|
9237 return { |
|
9238 settings: variation.settings, |
|
9239 styles: variation.styles |
|
9240 }; |
|
9241 }); |
|
9242 }; |
|
9243 |
|
9244 const selectOnEnter = event => { |
|
9245 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { |
|
9246 event.preventDefault(); |
|
9247 selectVariation(); |
|
9248 } |
|
9249 }; |
|
9250 |
|
9251 const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9252 return compareVariations(user, variation); |
|
9253 }, [user, variation]); |
|
9254 return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, { |
|
9255 value: context |
|
9256 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9257 className: classnames_default()('edit-site-global-styles-variations_item', { |
|
9258 'is-active': isActive |
|
9259 }), |
|
9260 role: "button", |
|
9261 onClick: selectVariation, |
|
9262 onKeyDown: selectOnEnter, |
|
9263 tabIndex: "0", |
|
9264 "aria-label": variation === null || variation === void 0 ? void 0 : variation.title, |
|
9265 onFocus: () => setIsFocused(true), |
|
9266 onBlur: () => setIsFocused(false) |
|
9267 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9268 className: "edit-site-global-styles-variations_item-preview" |
|
9269 }, (0,external_wp_element_namespaceObject.createElement)(preview, { |
|
9270 label: variation === null || variation === void 0 ? void 0 : variation.title, |
|
9271 isFocused: isFocused |
|
9272 })))); |
|
9273 } |
|
9274 |
|
9275 function ScreenStyleVariations() { |
|
9276 const { |
|
9277 variations |
|
9278 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9279 return { |
|
9280 variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations() |
|
9281 }; |
|
9282 }, []); |
|
9283 const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9284 return [{ |
|
9285 title: (0,external_wp_i18n_namespaceObject.__)('Default'), |
|
9286 settings: {}, |
|
9287 styles: {} |
|
9288 }, ...variations]; |
|
9289 }, [variations]); |
|
9290 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, { |
|
9291 back: "/", |
|
9292 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), |
|
9293 description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles') |
|
9294 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
9295 size: "small", |
|
9296 isBorderless: true |
|
9297 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, { |
|
9298 columns: 2 |
|
9299 }, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0,external_wp_element_namespaceObject.createElement)(Variation, { |
|
9300 key: index, |
|
9301 variation: variation |
|
9302 })))))); |
|
9303 } |
|
9304 |
|
9305 /* harmony default export */ var screen_style_variations = (ScreenStyleVariations); |
|
9306 |
|
9307 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js |
|
9308 |
|
9309 |
|
9310 |
|
9311 /** |
|
9312 * WordPress dependencies |
|
9313 */ |
|
9314 |
|
9315 |
|
9316 /** |
|
9317 * Internal dependencies |
|
9318 */ |
|
9319 |
|
9320 |
|
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 |
|
9329 |
|
9330 |
|
9331 |
|
9332 |
|
9333 function GlobalStylesNavigationScreen(_ref) { |
|
9334 let { |
|
9335 className, |
|
9336 ...props |
|
9337 } = _ref; |
|
9338 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, extends_extends({ |
|
9339 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ') |
|
9340 }, props)); |
|
9341 } |
|
9342 |
|
9343 function ContextScreens(_ref2) { |
|
9344 let { |
|
9345 name |
|
9346 } = _ref2; |
|
9347 const parentMenu = name === undefined ? '' : '/blocks/' + name; |
|
9348 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9349 path: parentMenu + '/typography' |
|
9350 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography, { |
|
9351 name: name |
|
9352 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9353 path: parentMenu + '/typography/text' |
|
9354 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { |
|
9355 name: name, |
|
9356 element: "text" |
|
9357 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9358 path: parentMenu + '/typography/link' |
|
9359 }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, { |
|
9360 name: name, |
|
9361 element: "link" |
|
9362 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9363 path: parentMenu + '/colors' |
|
9364 }, (0,external_wp_element_namespaceObject.createElement)(screen_colors, { |
|
9365 name: name |
|
9366 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9367 path: parentMenu + '/colors/palette' |
|
9368 }, (0,external_wp_element_namespaceObject.createElement)(screen_color_palette, { |
|
9369 name: name |
|
9370 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9371 path: parentMenu + '/colors/background' |
|
9372 }, (0,external_wp_element_namespaceObject.createElement)(screen_background_color, { |
|
9373 name: name |
|
9374 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9375 path: parentMenu + '/colors/text' |
|
9376 }, (0,external_wp_element_namespaceObject.createElement)(screen_text_color, { |
|
9377 name: name |
|
9378 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9379 path: parentMenu + '/colors/link' |
|
9380 }, (0,external_wp_element_namespaceObject.createElement)(screen_link_color, { |
|
9381 name: name |
|
9382 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9383 path: parentMenu + '/layout' |
|
9384 }, (0,external_wp_element_namespaceObject.createElement)(screen_layout, { |
|
9385 name: name |
|
9386 }))); |
|
9387 } |
|
9388 |
|
9389 function GlobalStylesUI() { |
|
9390 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); |
|
9391 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { |
|
9392 className: "edit-site-global-styles-sidebar__navigator-provider", |
|
9393 initialPath: "/" |
|
9394 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9395 path: "/" |
|
9396 }, (0,external_wp_element_namespaceObject.createElement)(screen_root, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9397 path: "/variations" |
|
9398 }, (0,external_wp_element_namespaceObject.createElement)(screen_style_variations, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9399 path: "/blocks" |
|
9400 }, (0,external_wp_element_namespaceObject.createElement)(screen_block_list, null)), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, { |
|
9401 key: 'menu-block-' + block.name, |
|
9402 path: '/blocks/' + block.name |
|
9403 }, (0,external_wp_element_namespaceObject.createElement)(screen_block, { |
|
9404 name: block.name |
|
9405 }))), (0,external_wp_element_namespaceObject.createElement)(ContextScreens, null), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(ContextScreens, { |
|
9406 key: 'screens-block-' + block.name, |
|
9407 name: block.name |
|
9408 }))); |
|
9409 } |
|
9410 |
|
9411 /* harmony default export */ var ui = (GlobalStylesUI); |
|
9412 |
|
9413 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js |
|
9414 |
|
9415 |
|
9416 |
|
9417 |
|
9418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/global-styles-sidebar.js |
|
9419 |
|
9420 |
|
9421 /** |
|
9422 * WordPress dependencies |
|
9423 */ |
|
9424 |
|
9425 |
|
9426 |
|
9427 |
|
9428 |
|
9429 /** |
|
9430 * Internal dependencies |
|
9431 */ |
|
9432 |
|
9433 |
|
9434 |
|
9435 function GlobalStylesSidebar() { |
|
9436 const [canReset, onReset] = useGlobalStylesReset(); |
|
9437 const { |
|
9438 toggle |
|
9439 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
|
9440 return (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, { |
|
9441 className: "edit-site-global-styles-sidebar", |
|
9442 identifier: "edit-site/global-styles", |
|
9443 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), |
|
9444 icon: library_styles, |
|
9445 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'), |
|
9446 panelClassName: "edit-site-global-styles-sidebar__panel", |
|
9447 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", { |
|
9448 className: "edit-site-global-styles-sidebar__beta" |
|
9449 }, (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, { |
|
9450 icon: more_vertical, |
|
9451 label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'), |
|
9452 controls: [{ |
|
9453 title: (0,external_wp_i18n_namespaceObject.__)('Reset to defaults'), |
|
9454 onClick: onReset, |
|
9455 isDisabled: !canReset |
|
9456 }, { |
|
9457 title: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'), |
|
9458 onClick: () => toggle('core/edit-site', 'welcomeGuideStyles') |
|
9459 }] |
|
9460 }))) |
|
9461 }, (0,external_wp_element_namespaceObject.createElement)(ui, null)); |
|
9462 } |
|
9463 |
|
9464 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js |
|
9465 |
|
9466 |
|
9467 /** |
|
9468 * WordPress dependencies |
|
9469 */ |
|
9470 |
|
9471 |
|
9472 |
|
9473 const ALLOWED_BLOCKS = { |
|
9474 'core/navigation': ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'], |
|
9475 'core/social-links': ['core/social-link'], |
|
9476 'core/navigation-submenu': ['core/navigation-link', 'core/navigation-submenu'], |
|
9477 'core/navigation-link': ['core/navigation-link', 'core/navigation-submenu'] |
|
9478 }; |
|
9479 function navigation_menu_NavigationMenu(_ref) { |
|
9480 let { |
|
9481 innerBlocks, |
|
9482 id |
|
9483 } = _ref; |
|
9484 const { |
|
9485 updateBlockListSettings |
|
9486 } = useDispatch(blockEditorStore); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList |
|
9487 //Think through a better way of doing this, possible with adding allowed blocks to block library metadata |
|
9488 |
|
9489 useEffect(() => { |
|
9490 updateBlockListSettings('', { |
|
9491 allowedBlocks: ALLOWED_BLOCKS['core/navigation'] |
|
9492 }); |
|
9493 innerBlocks.forEach(block => { |
|
9494 if (ALLOWED_BLOCKS[block.name]) { |
|
9495 updateBlockListSettings(block.clientId, { |
|
9496 allowedBlocks: ALLOWED_BLOCKS[block.name] |
|
9497 }); |
|
9498 } |
|
9499 }); |
|
9500 }, [updateBlockListSettings, innerBlocks]); |
|
9501 return createElement(Fragment, null, createElement(ListView, { |
|
9502 id: id, |
|
9503 showNestedBlocks: true, |
|
9504 expandNested: false, |
|
9505 __experimentalFeatures: true, |
|
9506 __experimentalPersistentListViewFeatures: true |
|
9507 })); |
|
9508 } |
|
9509 |
|
9510 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js |
|
9511 |
|
9512 |
|
9513 /** |
|
9514 * WordPress dependencies |
|
9515 */ |
|
9516 |
|
9517 |
|
9518 |
|
9519 |
|
9520 |
|
9521 |
|
9522 |
|
9523 |
|
9524 /** |
|
9525 * Internal dependencies |
|
9526 */ |
|
9527 |
|
9528 |
|
9529 const NAVIGATION_MENUS_QUERY = [{ |
|
9530 per_page: -1, |
|
9531 status: 'publish' |
|
9532 }]; |
|
9533 function navigation_inspector_NavigationInspector() { |
|
9534 var _navigationMenus$; |
|
9535 |
|
9536 const { |
|
9537 selectedNavigationBlockId, |
|
9538 clientIdToRef, |
|
9539 navigationMenus, |
|
9540 isResolvingNavigationMenus, |
|
9541 hasResolvedNavigationMenus, |
|
9542 firstNavigationBlockId |
|
9543 } = useSelect(select => { |
|
9544 const { |
|
9545 __experimentalGetActiveBlockIdByBlockNames, |
|
9546 __experimentalGetGlobalBlocksByName, |
|
9547 getBlock |
|
9548 } = select(blockEditorStore); |
|
9549 const { |
|
9550 getEntityRecords, |
|
9551 hasFinishedResolution, |
|
9552 isResolving |
|
9553 } = select(coreStore); |
|
9554 const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY[0]]; // Get the active Navigation block (if present). |
|
9555 |
|
9556 const selectedNavId = __experimentalGetActiveBlockIdByBlockNames('core/navigation'); // Get all Navigation blocks currently within the editor canvas. |
|
9557 |
|
9558 |
|
9559 const navBlockIds = __experimentalGetGlobalBlocksByName('core/navigation'); |
|
9560 |
|
9561 const idToRef = {}; |
|
9562 navBlockIds.forEach(id => { |
|
9563 var _getBlock, _getBlock$attributes; |
|
9564 |
|
9565 idToRef[id] = (_getBlock = getBlock(id)) === null || _getBlock === void 0 ? void 0 : (_getBlock$attributes = _getBlock.attributes) === null || _getBlock$attributes === void 0 ? void 0 : _getBlock$attributes.ref; |
|
9566 }); |
|
9567 return { |
|
9568 selectedNavigationBlockId: selectedNavId, |
|
9569 firstNavigationBlockId: navBlockIds === null || navBlockIds === void 0 ? void 0 : navBlockIds[0], |
|
9570 clientIdToRef: idToRef, |
|
9571 navigationMenus: getEntityRecords(...navigationMenusQuery), |
|
9572 isResolvingNavigationMenus: isResolving('getEntityRecords', navigationMenusQuery), |
|
9573 hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery) |
|
9574 }; |
|
9575 }, []); |
|
9576 const navMenuListId = useInstanceId(NavigationMenu, 'edit-site-navigation-inspector-menu'); |
|
9577 const firstNavRefInTemplate = clientIdToRef[firstNavigationBlockId]; |
|
9578 const firstNavigationMenuRef = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id; // Default Navigation Menu is either: |
|
9579 // - the Navigation Menu referenced by the first Nav block within the template. |
|
9580 // - the first of the available Navigation Menus (`wp_navigation`) posts. |
|
9581 |
|
9582 const defaultNavigationMenuId = firstNavRefInTemplate || firstNavigationMenuRef; // The Navigation Menu manually selected by the user within the Nav inspector. |
|
9583 |
|
9584 const [currentMenuId, setCurrentMenuId] = useState(firstNavRefInTemplate); // If a Nav block is selected within the canvas then set the |
|
9585 // Navigation Menu referenced by it's `ref` attribute to be |
|
9586 // active within the Navigation sidebar. |
|
9587 |
|
9588 useEffect(() => { |
|
9589 if (selectedNavigationBlockId) { |
|
9590 setCurrentMenuId(clientIdToRef[selectedNavigationBlockId]); |
|
9591 } |
|
9592 }, [selectedNavigationBlockId]); |
|
9593 let options = []; |
|
9594 |
|
9595 if (navigationMenus) { |
|
9596 options = navigationMenus.map(_ref => { |
|
9597 let { |
|
9598 id, |
|
9599 title |
|
9600 } = _ref; |
|
9601 return { |
|
9602 value: id, |
|
9603 label: title.rendered |
|
9604 }; |
|
9605 }); |
|
9606 } |
|
9607 |
|
9608 const [innerBlocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_navigation', { |
|
9609 id: currentMenuId || defaultNavigationMenuId |
|
9610 }); |
|
9611 const { |
|
9612 isLoadingInnerBlocks, |
|
9613 hasLoadedInnerBlocks |
|
9614 } = useSelect(select => { |
|
9615 const { |
|
9616 isResolving, |
|
9617 hasFinishedResolution |
|
9618 } = select(coreStore); |
|
9619 return { |
|
9620 isLoadingInnerBlocks: isResolving('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]), |
|
9621 hasLoadedInnerBlocks: hasFinishedResolution('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]) |
|
9622 }; |
|
9623 }, [currentMenuId, defaultNavigationMenuId]); |
|
9624 const isLoading = !(hasResolvedNavigationMenus && hasLoadedInnerBlocks); |
|
9625 const hasMoreThanOneNavigationMenu = (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 1; |
|
9626 const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length); // Entity block editor will return entities that are not currently published. |
|
9627 // Guard by only allowing their usage if there are published Nav Menus. |
|
9628 |
|
9629 const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : []; |
|
9630 const hasInnerBlocks = !!(publishedInnerBlocks !== null && publishedInnerBlocks !== void 0 && publishedInnerBlocks.length); |
|
9631 useEffect(() => { |
|
9632 if (isResolvingNavigationMenus) { |
|
9633 speak('Loading Navigation sidebar menus.'); |
|
9634 } |
|
9635 |
|
9636 if (hasResolvedNavigationMenus) { |
|
9637 speak('Navigation sidebar menus have loaded.'); |
|
9638 } |
|
9639 }, [isResolvingNavigationMenus, hasResolvedNavigationMenus]); |
|
9640 useEffect(() => { |
|
9641 if (isLoadingInnerBlocks) { |
|
9642 speak('Loading Navigation sidebar selected menu items.'); |
|
9643 } |
|
9644 |
|
9645 if (hasLoadedInnerBlocks) { |
|
9646 speak('Navigation sidebar selected menu items have loaded.'); |
|
9647 } |
|
9648 }, [isLoadingInnerBlocks, hasLoadedInnerBlocks]); |
|
9649 return createElement("div", { |
|
9650 className: "edit-site-navigation-inspector" |
|
9651 }, hasResolvedNavigationMenus && !hasNavigationMenus && createElement("p", { |
|
9652 className: "edit-site-navigation-inspector__empty-msg" |
|
9653 }, __('There are no Navigation Menus.')), !hasResolvedNavigationMenus && createElement("div", { |
|
9654 className: "edit-site-navigation-inspector__placeholder" |
|
9655 }), hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && createElement(SelectControl, { |
|
9656 "aria-controls": // aria-controls should only apply when referenced element is in DOM |
|
9657 hasLoadedInnerBlocks ? navMenuListId : undefined, |
|
9658 value: currentMenuId || defaultNavigationMenuId, |
|
9659 options: options, |
|
9660 onChange: newMenuId => setCurrentMenuId(Number(newMenuId)) |
|
9661 }), isLoading && createElement(Fragment, null, createElement("div", { |
|
9662 className: "edit-site-navigation-inspector__placeholder is-child" |
|
9663 }), createElement("div", { |
|
9664 className: "edit-site-navigation-inspector__placeholder is-child" |
|
9665 }), createElement("div", { |
|
9666 className: "edit-site-navigation-inspector__placeholder is-child" |
|
9667 })), hasInnerBlocks && !isLoading && createElement(BlockEditorProvider, { |
|
9668 value: publishedInnerBlocks, |
|
9669 onChange: onChange, |
|
9670 onInput: onInput |
|
9671 }, createElement(NavigationMenu, { |
|
9672 id: navMenuListId, |
|
9673 innerBlocks: publishedInnerBlocks |
|
9674 })), !hasInnerBlocks && !isLoading && createElement("p", { |
|
9675 className: "edit-site-navigation-inspector__empty-msg" |
|
9676 }, __('Navigation Menu is empty.'))); |
|
9677 } |
|
9678 |
|
9679 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/index.js |
|
9680 |
|
9681 |
|
9682 /** |
|
9683 * WordPress dependencies |
|
9684 */ |
|
9685 |
|
9686 |
|
9687 |
|
9688 /** |
|
9689 * Internal dependencies |
|
9690 */ |
|
9691 |
|
9692 |
|
9693 |
|
9694 function NavigationMenuSidebar() { |
|
9695 return createElement(DefaultSidebar, { |
|
9696 className: "edit-site-navigation-menu-sidebar", |
|
9697 identifier: "edit-site/navigation-menu", |
|
9698 title: __('Navigation Menus'), |
|
9699 icon: navigation, |
|
9700 closeLabel: __('Close navigation menu sidebar'), |
|
9701 panelClassName: "edit-site-navigation-menu-sidebar__panel", |
|
9702 header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus')))) |
|
9703 }, createElement(NavigationInspector, null)); |
|
9704 } |
|
9705 |
|
9706 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/constants.js |
|
9707 const SIDEBAR_TEMPLATE = 'edit-site/template'; |
|
9708 const SIDEBAR_BLOCK = 'edit-site/block-inspector'; |
|
9709 |
|
9710 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/settings-header/index.js |
|
9711 |
|
9712 |
|
9713 /** |
|
9714 * WordPress dependencies |
|
9715 */ |
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 /** |
|
9721 * Internal dependencies |
|
9722 */ |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 const SettingsHeader = _ref => { |
|
9728 let { |
|
9729 sidebarName |
|
9730 } = _ref; |
|
9731 const { |
|
9732 enableComplementaryArea |
|
9733 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
9734 |
|
9735 const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); |
|
9736 |
|
9737 const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
|
9738 |
|
9739 const [templateAriaLabel, templateActiveClass] = sidebarName === SIDEBAR_TEMPLATE ? // translators: ARIA label for the Template sidebar tab, selected. |
|
9740 [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : // translators: ARIA label for the Template Settings Sidebar tab, not selected. |
|
9741 [(0,external_wp_i18n_namespaceObject.__)('Template'), '']; |
|
9742 const [blockAriaLabel, blockActiveClass] = sidebarName === SIDEBAR_BLOCK ? // translators: ARIA label for the Block Settings Sidebar tab, selected. |
|
9743 [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected. |
|
9744 [(0,external_wp_i18n_namespaceObject.__)('Block'), '']; |
|
9745 /* Use a list so screen readers will announce how many tabs there are. */ |
|
9746 |
|
9747 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, { |
|
9748 onClick: openTemplateSettings, |
|
9749 className: `edit-site-sidebar__panel-tab ${templateActiveClass}`, |
|
9750 "aria-label": templateAriaLabel // translators: Data label for the Template Settings Sidebar tab. |
|
9751 , |
|
9752 "data-label": (0,external_wp_i18n_namespaceObject.__)('Template') |
|
9753 }, // translators: Text label for the Template Settings Sidebar tab. |
|
9754 (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, { |
|
9755 onClick: openBlockSettings, |
|
9756 className: `edit-site-sidebar__panel-tab ${blockActiveClass}`, |
|
9757 "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab. |
|
9758 , |
|
9759 "data-label": (0,external_wp_i18n_namespaceObject.__)('Block') |
|
9760 }, // translators: Text label for the Block Settings Sidebar tab. |
|
9761 (0,external_wp_i18n_namespaceObject.__)('Block')))); |
|
9762 }; |
|
9763 |
|
9764 /* harmony default export */ var settings_header = (SettingsHeader); |
|
9765 |
|
9766 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/template-areas.js |
|
9767 |
|
9768 |
|
9769 /** |
|
9770 * WordPress dependencies |
|
9771 */ |
|
9772 |
|
9773 |
|
9774 |
|
9775 |
|
9776 |
|
9777 /** |
|
9778 * Internal dependencies |
|
9779 */ |
|
9780 |
|
9781 |
|
9782 |
|
9783 function TemplateAreaItem(_ref) { |
|
9784 let { |
|
9785 area, |
|
9786 clientId |
|
9787 } = _ref; |
|
9788 const { |
|
9789 selectBlock, |
|
9790 toggleBlockHighlight |
|
9791 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
9792 const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9793 const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(); |
|
9794 |
|
9795 return defaultAreas.find(defaultArea => defaultArea.area === area); |
|
9796 }, [area]); |
|
9797 |
|
9798 const highlightBlock = () => toggleBlockHighlight(clientId, true); |
|
9799 |
|
9800 const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false); |
|
9801 |
|
9802 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
9803 className: "edit-site-template-card__template-areas-item", |
|
9804 icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon, |
|
9805 onMouseOver: highlightBlock, |
|
9806 onMouseLeave: cancelHighlightBlock, |
|
9807 onFocus: highlightBlock, |
|
9808 onBlur: cancelHighlightBlock, |
|
9809 onClick: () => { |
|
9810 selectBlock(clientId); |
|
9811 } |
|
9812 }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label); |
|
9813 } |
|
9814 |
|
9815 function template_areas_TemplateAreas() { |
|
9816 const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []); |
|
9817 |
|
9818 if (!templateParts.length) { |
|
9819 return null; |
|
9820 } |
|
9821 |
|
9822 return (0,external_wp_element_namespaceObject.createElement)("section", { |
|
9823 className: "edit-site-template-card__template-areas" |
|
9824 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
9825 level: 3, |
|
9826 className: "edit-site-template-card__template-areas-title" |
|
9827 }, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_wp_element_namespaceObject.createElement)("ul", { |
|
9828 className: "edit-site-template-card__template-areas-list" |
|
9829 }, templateParts.map(_ref2 => { |
|
9830 let { |
|
9831 templatePart, |
|
9832 block |
|
9833 } = _ref2; |
|
9834 return (0,external_wp_element_namespaceObject.createElement)("li", { |
|
9835 key: templatePart.slug |
|
9836 }, (0,external_wp_element_namespaceObject.createElement)(TemplateAreaItem, { |
|
9837 area: templatePart.area, |
|
9838 clientId: block.clientId |
|
9839 })); |
|
9840 }))); |
|
9841 } |
|
9842 |
|
9843 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/index.js |
|
9844 |
|
9845 |
|
9846 /** |
|
9847 * WordPress dependencies |
|
9848 */ |
|
9849 |
|
9850 |
|
9851 |
|
9852 |
|
9853 /** |
|
9854 * Internal dependencies |
|
9855 */ |
|
9856 |
|
9857 |
|
9858 |
|
9859 function TemplateCard() { |
|
9860 const { |
|
9861 title, |
|
9862 description, |
|
9863 icon |
|
9864 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9865 const { |
|
9866 getEditedPostType, |
|
9867 getEditedPostId |
|
9868 } = select(store_store); |
|
9869 const { |
|
9870 getEntityRecord |
|
9871 } = select(external_wp_coreData_namespaceObject.store); |
|
9872 const { |
|
9873 __experimentalGetTemplateInfo: getTemplateInfo |
|
9874 } = select(external_wp_editor_namespaceObject.store); |
|
9875 const postType = getEditedPostType(); |
|
9876 const postId = getEditedPostId(); |
|
9877 const record = getEntityRecord('postType', postType, postId); |
|
9878 const info = record ? getTemplateInfo(record) : {}; |
|
9879 return info; |
|
9880 }, []); |
|
9881 |
|
9882 if (!title && !description) { |
|
9883 return null; |
|
9884 } |
|
9885 |
|
9886 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9887 className: "edit-site-template-card" |
|
9888 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
9889 className: "edit-site-template-card__icon", |
|
9890 icon: icon |
|
9891 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9892 className: "edit-site-template-card__content" |
|
9893 }, (0,external_wp_element_namespaceObject.createElement)("h2", { |
|
9894 className: "edit-site-template-card__title" |
|
9895 }, title), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9896 className: "edit-site-template-card__description" |
|
9897 }, description), (0,external_wp_element_namespaceObject.createElement)(template_areas_TemplateAreas, null))); |
|
9898 } |
|
9899 |
|
9900 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js |
|
9901 |
|
9902 |
|
9903 /** |
|
9904 * WordPress dependencies |
|
9905 */ |
|
9906 |
|
9907 |
|
9908 |
|
9909 |
|
9910 |
|
9911 |
|
9912 |
|
9913 /** |
|
9914 * Internal dependencies |
|
9915 */ |
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 const { |
|
9925 Slot: InspectorSlot, |
|
9926 Fill: InspectorFill |
|
9927 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector'); |
|
9928 const SidebarInspectorFill = InspectorFill; |
|
9929 function SidebarComplementaryAreaFills() { |
|
9930 const { |
|
9931 sidebar, |
|
9932 isEditorSidebarOpened, |
|
9933 hasBlockSelection |
|
9934 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9935 const _sidebar = select(store).getActiveComplementaryArea(STORE_NAME); |
|
9936 |
|
9937 const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar); |
|
9938 |
|
9939 return { |
|
9940 sidebar: _sidebar, |
|
9941 isEditorSidebarOpened: _isEditorSidebarOpened, |
|
9942 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() |
|
9943 }; |
|
9944 }, []); |
|
9945 const { |
|
9946 enableComplementaryArea |
|
9947 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
9948 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
9949 if (!isEditorSidebarOpened) return; |
|
9950 |
|
9951 if (hasBlockSelection) { |
|
9952 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
|
9953 } else { |
|
9954 enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE); |
|
9955 } |
|
9956 }, [hasBlockSelection, isEditorSidebarOpened]); |
|
9957 let sidebarName = sidebar; |
|
9958 |
|
9959 if (!isEditorSidebarOpened) { |
|
9960 sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE; |
|
9961 } // Conditionally include NavMenu sidebar in Plugin only. |
|
9962 // Optimise for dead code elimination. |
|
9963 // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination. |
|
9964 |
|
9965 |
|
9966 let MaybeNavigationMenuSidebar = external_wp_element_namespaceObject.Fragment; |
|
9967 |
|
9968 if (false) {} |
|
9969 |
|
9970 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, { |
|
9971 identifier: sidebarName, |
|
9972 title: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
|
9973 icon: library_cog, |
|
9974 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings sidebar'), |
|
9975 header: (0,external_wp_element_namespaceObject.createElement)(settings_header, { |
|
9976 sidebarName: sidebarName |
|
9977 }), |
|
9978 headerClassName: "edit-site-sidebar__panel-tabs" |
|
9979 }, 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, { |
|
9980 bubblesVirtually: true |
|
9981 })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesSidebar, null), (0,external_wp_element_namespaceObject.createElement)(MaybeNavigationMenuSidebar, null)); |
|
9982 } |
|
9983 |
|
9984 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
|
9985 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
|
9986 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js |
|
9987 |
|
9988 |
|
9989 /** |
|
9990 * WordPress dependencies |
|
9991 */ |
|
9992 |
|
9993 const home = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
9994 xmlns: "http://www.w3.org/2000/svg", |
|
9995 viewBox: "0 0 24 24" |
|
9996 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
9997 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" |
|
9998 })); |
|
9999 /* harmony default export */ var library_home = (home); |
|
10000 |
|
10001 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js |
|
10002 |
|
10003 |
|
10004 /** |
|
10005 * WordPress dependencies |
|
10006 */ |
|
10007 |
|
10008 const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10009 xmlns: "http://www.w3.org/2000/svg", |
|
10010 viewBox: "0 0 24 24" |
|
10011 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
10012 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" |
|
10013 })); |
|
10014 /* harmony default export */ var symbol_filled = (symbolFilled); |
|
10015 |
|
10016 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/main-dashboard-button/index.js |
|
10017 |
|
10018 |
|
10019 /** |
|
10020 * WordPress dependencies |
|
10021 */ |
|
10022 |
|
10023 const slotName = '__experimentalMainDashboardButton'; |
|
10024 const { |
|
10025 Fill, |
|
10026 Slot: MainDashboardButtonSlot |
|
10027 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); |
|
10028 const MainDashboardButton = Fill; |
|
10029 |
|
10030 const main_dashboard_button_Slot = _ref => { |
|
10031 let { |
|
10032 children |
|
10033 } = _ref; |
|
10034 const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName); |
|
10035 const hasFills = Boolean(slot.fills && slot.fills.length); |
|
10036 |
|
10037 if (!hasFills) { |
|
10038 return children; |
|
10039 } |
|
10040 |
|
10041 return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, { |
|
10042 bubblesVirtually: true |
|
10043 }); |
|
10044 }; |
|
10045 |
|
10046 MainDashboardButton.Slot = main_dashboard_button_Slot; |
|
10047 /* harmony default export */ var main_dashboard_button = (MainDashboardButton); |
|
10048 |
|
10049 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/index.js |
|
10050 |
|
10051 |
|
10052 |
|
10053 /** |
|
10054 * External dependencies |
|
10055 */ |
|
10056 |
|
10057 /** |
|
10058 * WordPress dependencies |
|
10059 */ |
|
10060 |
|
10061 |
|
10062 |
|
10063 |
|
10064 |
|
10065 |
|
10066 |
|
10067 |
|
10068 /** |
|
10069 * Internal dependencies |
|
10070 */ |
|
10071 |
|
10072 |
|
10073 |
|
10074 |
|
10075 const SITE_EDITOR_KEY = 'site-editor'; |
|
10076 |
|
10077 function NavLink(_ref) { |
|
10078 let { |
|
10079 params, |
|
10080 replace, |
|
10081 ...props |
|
10082 } = _ref; |
|
10083 const linkProps = useLink(params, replace); |
|
10084 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationItem, extends_extends({}, linkProps, props)); |
|
10085 } |
|
10086 |
|
10087 const NavigationPanel = _ref2 => { |
|
10088 let { |
|
10089 activeItem = SITE_EDITOR_KEY |
|
10090 } = _ref2; |
|
10091 const { |
|
10092 homeTemplate, |
|
10093 isNavigationOpen, |
|
10094 siteTitle |
|
10095 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10096 const { |
|
10097 getEntityRecord |
|
10098 } = select(external_wp_coreData_namespaceObject.store); |
|
10099 const { |
|
10100 getSettings, |
|
10101 isNavigationOpened |
|
10102 } = select(store_store); |
|
10103 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
|
10104 return { |
|
10105 siteTitle: siteData.name, |
|
10106 homeTemplate: getSettings().__unstableHomeTemplate, |
|
10107 isNavigationOpen: isNavigationOpened() |
|
10108 }; |
|
10109 }, []); |
|
10110 const { |
|
10111 setIsNavigationPanelOpened |
|
10112 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
10113 |
|
10114 const closeOnEscape = event => { |
|
10115 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { |
|
10116 event.preventDefault(); |
|
10117 setIsNavigationPanelOpened(false); |
|
10118 } |
|
10119 }; |
|
10120 |
|
10121 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
|
10122 (0,external_wp_element_namespaceObject.createElement)("div", { |
|
10123 className: classnames_default()(`edit-site-navigation-panel`, { |
|
10124 'is-open': isNavigationOpen |
|
10125 }), |
|
10126 onKeyDown: closeOnEscape |
|
10127 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
10128 className: "edit-site-navigation-panel__inner" |
|
10129 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
10130 className: "edit-site-navigation-panel__site-title-container" |
|
10131 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
10132 className: "edit-site-navigation-panel__site-title" |
|
10133 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
10134 className: "edit-site-navigation-panel__scroll-container" |
|
10135 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigation, { |
|
10136 activeItem: activeItem |
|
10137 }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationBackButton, { |
|
10138 backButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Dashboard'), |
|
10139 className: "edit-site-navigation-panel__back-to-dashboard", |
|
10140 href: "index.php" |
|
10141 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationMenu, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationGroup, { |
|
10142 title: (0,external_wp_i18n_namespaceObject.__)('Editor') |
|
10143 }, (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
|
10144 icon: library_home, |
|
10145 title: (0,external_wp_i18n_namespaceObject.__)('Site'), |
|
10146 item: SITE_EDITOR_KEY, |
|
10147 params: { |
|
10148 postId: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postId, |
|
10149 postType: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postType |
|
10150 } |
|
10151 }), (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
|
10152 icon: library_layout, |
|
10153 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), |
|
10154 item: "wp_template", |
|
10155 params: { |
|
10156 postId: undefined, |
|
10157 postType: 'wp_template' |
|
10158 } |
|
10159 }), (0,external_wp_element_namespaceObject.createElement)(NavLink, { |
|
10160 icon: symbol_filled, |
|
10161 title: (0,external_wp_i18n_namespaceObject.__)('Template Parts'), |
|
10162 item: "wp_template_part", |
|
10163 params: { |
|
10164 postId: undefined, |
|
10165 postType: 'wp_template_part' |
|
10166 } |
|
10167 }))))))) |
|
10168 ); |
|
10169 }; |
|
10170 |
|
10171 /* harmony default export */ var navigation_panel = (NavigationPanel); |
|
10172 |
|
10173 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js |
|
10174 |
|
10175 |
|
10176 /** |
|
10177 * WordPress dependencies |
|
10178 */ |
|
10179 |
|
10180 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10181 xmlns: "http://www.w3.org/2000/svg", |
|
10182 viewBox: "-2 -2 24 24" |
|
10183 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
10184 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" |
|
10185 })); |
|
10186 /* harmony default export */ var library_wordpress = (wordpress); |
|
10187 |
|
10188 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-toggle/index.js |
|
10189 |
|
10190 |
|
10191 /** |
|
10192 * External dependencies |
|
10193 */ |
|
10194 |
|
10195 /** |
|
10196 * WordPress dependencies |
|
10197 */ |
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 |
|
10203 |
|
10204 |
|
10205 |
|
10206 /** |
|
10207 * Internal dependencies |
|
10208 */ |
|
10209 |
|
10210 |
|
10211 |
|
10212 function NavigationToggle(_ref) { |
|
10213 let { |
|
10214 icon |
|
10215 } = _ref; |
|
10216 const { |
|
10217 isNavigationOpen, |
|
10218 isRequestingSiteIcon, |
|
10219 siteIconUrl |
|
10220 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10221 const { |
|
10222 getEntityRecord, |
|
10223 isResolving |
|
10224 } = select(external_wp_coreData_namespaceObject.store); |
|
10225 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
|
10226 return { |
|
10227 isNavigationOpen: select(store_store).isNavigationOpened(), |
|
10228 isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), |
|
10229 siteIconUrl: siteData.site_icon_url |
|
10230 }; |
|
10231 }, []); |
|
10232 const { |
|
10233 setIsNavigationPanelOpened |
|
10234 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
10235 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); |
|
10236 const navigationToggleRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
10237 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
10238 // TODO: Remove this effect when alternative solution is merged. |
|
10239 // See: https://github.com/WordPress/gutenberg/pull/37314 |
|
10240 if (!isNavigationOpen) { |
|
10241 navigationToggleRef.current.focus(); |
|
10242 } |
|
10243 }, [isNavigationOpen]); |
|
10244 |
|
10245 const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen); |
|
10246 |
|
10247 let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
10248 size: "36px", |
|
10249 icon: library_wordpress |
|
10250 }); |
|
10251 const effect = { |
|
10252 expand: { |
|
10253 scale: 1.25, |
|
10254 transition: { |
|
10255 type: 'tween', |
|
10256 duration: '0.3' |
|
10257 } |
|
10258 } |
|
10259 }; |
|
10260 |
|
10261 if (siteIconUrl) { |
|
10262 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { |
|
10263 variants: !disableMotion && effect, |
|
10264 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), |
|
10265 className: "edit-site-navigation-toggle__site-icon", |
|
10266 src: siteIconUrl |
|
10267 }); |
|
10268 } else if (isRequestingSiteIcon) { |
|
10269 buttonIcon = null; |
|
10270 } else if (icon) { |
|
10271 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
10272 size: "36px", |
|
10273 icon: icon |
|
10274 }); |
|
10275 } |
|
10276 |
|
10277 const classes = classnames_default()({ |
|
10278 'edit-site-navigation-toggle__button': true, |
|
10279 'has-icon': siteIconUrl |
|
10280 }); |
|
10281 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
10282 className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''), |
|
10283 whileHover: "expand" |
|
10284 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
10285 className: classes, |
|
10286 label: (0,external_wp_i18n_namespaceObject.__)('Toggle navigation'), |
|
10287 ref: navigationToggleRef // isPressed will add unwanted styles. |
|
10288 , |
|
10289 "aria-pressed": isNavigationOpen, |
|
10290 onClick: toggleNavigationPanel, |
|
10291 showTooltip: true |
|
10292 }, buttonIcon)); |
|
10293 } |
|
10294 |
|
10295 /* harmony default export */ var navigation_toggle = (NavigationToggle); |
|
10296 |
|
10297 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/index.js |
|
10298 |
|
10299 |
|
10300 /** |
|
10301 * WordPress dependencies |
|
10302 */ |
|
10303 |
|
10304 |
|
10305 |
|
10306 |
|
10307 /** |
|
10308 * Internal dependencies |
|
10309 */ |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 const { |
|
10315 Fill: NavigationPanelPreviewFill, |
|
10316 Slot: NavigationPanelPreviewSlot |
|
10317 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationPanelPreview'); |
|
10318 const { |
|
10319 Fill: NavigationSidebarFill, |
|
10320 Slot: NavigationSidebarSlot |
|
10321 } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationSidebar'); |
|
10322 |
|
10323 function NavigationSidebar(_ref) { |
|
10324 let { |
|
10325 isDefaultOpen = false, |
|
10326 activeTemplateType |
|
10327 } = _ref; |
|
10328 const isDesktopViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
|
10329 const { |
|
10330 setIsNavigationPanelOpened |
|
10331 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
10332 (0,external_wp_element_namespaceObject.useEffect)(function autoOpenNavigationPanelOnViewportChange() { |
|
10333 setIsNavigationPanelOpened(isDefaultOpen && isDesktopViewport); |
|
10334 }, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]); |
|
10335 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, { |
|
10336 activeItem: activeTemplateType |
|
10337 }), (0,external_wp_element_namespaceObject.createElement)(NavigationPanelPreviewSlot, null)); |
|
10338 } |
|
10339 |
|
10340 NavigationSidebar.Slot = NavigationSidebarSlot; |
|
10341 /* harmony default export */ var navigation_sidebar = (NavigationSidebar); |
|
10342 |
|
10343 ;// CONCATENATED MODULE: external ["wp","reusableBlocks"] |
|
10344 var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; |
|
10345 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js |
|
10346 |
|
10347 |
|
10348 /** |
|
10349 * WordPress dependencies |
|
10350 */ |
|
10351 |
|
10352 |
|
10353 |
|
10354 |
|
10355 function ConvertToRegularBlocks(_ref) { |
|
10356 let { |
|
10357 clientId |
|
10358 } = _ref; |
|
10359 const { |
|
10360 getBlocks |
|
10361 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); |
|
10362 const { |
|
10363 replaceBlocks |
|
10364 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
10365 const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]); |
|
10366 |
|
10367 if (!canRemove) { |
|
10368 return null; |
|
10369 } |
|
10370 |
|
10371 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => { |
|
10372 let { |
|
10373 onClose |
|
10374 } = _ref2; |
|
10375 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
10376 onClick: () => { |
|
10377 replaceBlocks(clientId, getBlocks(clientId)); |
|
10378 onClose(); |
|
10379 } |
|
10380 }, (0,external_wp_i18n_namespaceObject.__)('Detach blocks from template part')); |
|
10381 }); |
|
10382 } |
|
10383 |
|
10384 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/create-template-part-modal/index.js |
|
10385 |
|
10386 |
|
10387 /** |
|
10388 * WordPress dependencies |
|
10389 */ |
|
10390 |
|
10391 |
|
10392 |
|
10393 |
|
10394 |
|
10395 |
|
10396 |
|
10397 /** |
|
10398 * Internal dependencies |
|
10399 */ |
|
10400 |
|
10401 |
|
10402 function CreateTemplatePartModal(_ref) { |
|
10403 let { |
|
10404 closeModal, |
|
10405 onCreate |
|
10406 } = _ref; |
|
10407 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); |
|
10408 const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(TEMPLATE_PART_AREA_GENERAL); |
|
10409 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); |
|
10410 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); |
|
10411 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []); |
|
10412 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
10413 title: (0,external_wp_i18n_namespaceObject.__)('Create a template part'), |
|
10414 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
10415 onRequestClose: closeModal, |
|
10416 overlayClassName: "edit-site-create-template-part-modal" |
|
10417 }, (0,external_wp_element_namespaceObject.createElement)("form", { |
|
10418 onSubmit: async event => { |
|
10419 event.preventDefault(); |
|
10420 |
|
10421 if (!title) { |
|
10422 return; |
|
10423 } |
|
10424 |
|
10425 setIsSubmitting(true); |
|
10426 await onCreate({ |
|
10427 title, |
|
10428 area |
|
10429 }); |
|
10430 } |
|
10431 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
10432 label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
|
10433 value: title, |
|
10434 onChange: setTitle, |
|
10435 required: true |
|
10436 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, { |
|
10437 label: (0,external_wp_i18n_namespaceObject.__)('Area'), |
|
10438 id: `edit-site-create-template-part-modal__area-selection-${instanceId}`, |
|
10439 className: "edit-site-create-template-part-modal__area-base-control" |
|
10440 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, { |
|
10441 label: (0,external_wp_i18n_namespaceObject.__)('Area'), |
|
10442 className: "edit-site-create-template-part-modal__area-radio-group", |
|
10443 id: `edit-site-create-template-part-modal__area-selection-${instanceId}`, |
|
10444 onChange: setArea, |
|
10445 checked: area |
|
10446 }, templatePartAreas.map(_ref2 => { |
|
10447 let { |
|
10448 icon, |
|
10449 label, |
|
10450 area: value, |
|
10451 description |
|
10452 } = _ref2; |
|
10453 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadio, { |
|
10454 key: label, |
|
10455 value: value, |
|
10456 className: "edit-site-create-template-part-modal__area-radio" |
|
10457 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
10458 align: "start", |
|
10459 justify: "start" |
|
10460 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
10461 icon: icon |
|
10462 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, { |
|
10463 className: "edit-site-create-template-part-modal__option-label" |
|
10464 }, label, (0,external_wp_element_namespaceObject.createElement)("div", null, description)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
|
10465 className: "edit-site-create-template-part-modal__checkbox" |
|
10466 }, area === value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
10467 icon: library_check |
|
10468 })))); |
|
10469 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
10470 className: "edit-site-create-template-part-modal__modal-actions", |
|
10471 justify: "flex-end" |
|
10472 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
10473 variant: "secondary", |
|
10474 onClick: () => { |
|
10475 closeModal(); |
|
10476 } |
|
10477 }, (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, { |
|
10478 variant: "primary", |
|
10479 type: "submit", |
|
10480 disabled: !title, |
|
10481 isBusy: isSubmitting |
|
10482 }, (0,external_wp_i18n_namespaceObject.__)('Create')))))); |
|
10483 } |
|
10484 |
|
10485 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js |
|
10486 |
|
10487 |
|
10488 /** |
|
10489 * External dependencies |
|
10490 */ |
|
10491 |
|
10492 /** |
|
10493 * WordPress dependencies |
|
10494 */ |
|
10495 |
|
10496 |
|
10497 |
|
10498 |
|
10499 |
|
10500 |
|
10501 |
|
10502 |
|
10503 |
|
10504 /** |
|
10505 * Internal dependencies |
|
10506 */ |
|
10507 |
|
10508 |
|
10509 function ConvertToTemplatePart(_ref) { |
|
10510 let { |
|
10511 clientIds, |
|
10512 blocks |
|
10513 } = _ref; |
|
10514 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
10515 const { |
|
10516 replaceBlocks |
|
10517 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
10518 const { |
|
10519 saveEntityRecord |
|
10520 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
10521 const { |
|
10522 createSuccessNotice |
|
10523 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
10524 |
|
10525 const onConvert = async _ref2 => { |
|
10526 let { |
|
10527 title, |
|
10528 area |
|
10529 } = _ref2; |
|
10530 // Currently template parts only allow latin chars. |
|
10531 // Fallback slug will receive suffix by default. |
|
10532 const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; |
|
10533 const templatePart = await saveEntityRecord('postType', 'wp_template_part', { |
|
10534 slug: cleanSlug, |
|
10535 title, |
|
10536 content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), |
|
10537 area |
|
10538 }); |
|
10539 replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { |
|
10540 slug: templatePart.slug, |
|
10541 theme: templatePart.theme |
|
10542 })); |
|
10543 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { |
|
10544 type: 'snackbar' |
|
10545 }); // The modal and this component will be unmounted because of `replaceBlocks` above, |
|
10546 // so no need to call `closeModal` or `onClose`. |
|
10547 }; |
|
10548 |
|
10549 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, { |
|
10550 onClick: () => { |
|
10551 setIsModalOpen(true); |
|
10552 } |
|
10553 }, (0,external_wp_i18n_namespaceObject.__)('Make template part'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { |
|
10554 closeModal: () => { |
|
10555 setIsModalOpen(false); |
|
10556 }, |
|
10557 onCreate: onConvert |
|
10558 })); |
|
10559 } |
|
10560 |
|
10561 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js |
|
10562 |
|
10563 |
|
10564 /** |
|
10565 * WordPress dependencies |
|
10566 */ |
|
10567 |
|
10568 |
|
10569 /** |
|
10570 * Internal dependencies |
|
10571 */ |
|
10572 |
|
10573 |
|
10574 |
|
10575 function TemplatePartConverter() { |
|
10576 var _blocks$; |
|
10577 |
|
10578 const { |
|
10579 clientIds, |
|
10580 blocks |
|
10581 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10582 const { |
|
10583 getSelectedBlockClientIds, |
|
10584 getBlocksByClientId |
|
10585 } = select(external_wp_blockEditor_namespaceObject.store); |
|
10586 const selectedBlockClientIds = getSelectedBlockClientIds(); |
|
10587 return { |
|
10588 clientIds: selectedBlockClientIds, |
|
10589 blocks: getBlocksByClientId(selectedBlockClientIds) |
|
10590 }; |
|
10591 }, []); // Allow converting a single template part to standard blocks. |
|
10592 |
|
10593 if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') { |
|
10594 return (0,external_wp_element_namespaceObject.createElement)(ConvertToRegularBlocks, { |
|
10595 clientId: clientIds[0] |
|
10596 }); |
|
10597 } |
|
10598 |
|
10599 return (0,external_wp_element_namespaceObject.createElement)(ConvertToTemplatePart, { |
|
10600 clientIds: clientIds, |
|
10601 blocks: blocks |
|
10602 }); |
|
10603 } |
|
10604 |
|
10605 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js |
|
10606 |
|
10607 |
|
10608 /** |
|
10609 * WordPress dependencies |
|
10610 */ |
|
10611 |
|
10612 const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10613 xmlns: "http://www.w3.org/2000/svg", |
|
10614 viewBox: "0 0 24 24" |
|
10615 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
10616 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" |
|
10617 })); |
|
10618 /* harmony default export */ var library_pencil = (pencil); |
|
10619 |
|
10620 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js |
|
10621 /** |
|
10622 * Internal dependencies |
|
10623 */ |
|
10624 |
|
10625 /* harmony default export */ var edit = (library_pencil); |
|
10626 |
|
10627 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigate-to-link/index.js |
|
10628 |
|
10629 |
|
10630 /** |
|
10631 * WordPress dependencies |
|
10632 */ |
|
10633 |
|
10634 |
|
10635 |
|
10636 |
|
10637 |
|
10638 |
|
10639 |
|
10640 function NavigateToLink(_ref) { |
|
10641 let { |
|
10642 type, |
|
10643 id, |
|
10644 activePage, |
|
10645 onActivePageChange |
|
10646 } = _ref; |
|
10647 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]); |
|
10648 const onClick = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
10649 if (!(post !== null && post !== void 0 && post.link)) return null; |
|
10650 const path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(post.link); |
|
10651 if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null; |
|
10652 return () => onActivePageChange({ |
|
10653 type, |
|
10654 slug: post.slug, |
|
10655 path, |
|
10656 context: { |
|
10657 postType: post.type, |
|
10658 postId: post.id |
|
10659 } |
|
10660 }); |
|
10661 }, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]); |
|
10662 return onClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
10663 icon: edit, |
|
10664 label: (0,external_wp_i18n_namespaceObject.__)('Edit Page Template'), |
|
10665 onClick: onClick |
|
10666 }); |
|
10667 } |
|
10668 |
|
10669 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/block-inspector-button.js |
|
10670 |
|
10671 |
|
10672 /** |
|
10673 * WordPress dependencies |
|
10674 */ |
|
10675 |
|
10676 |
|
10677 |
|
10678 |
|
10679 |
|
10680 |
|
10681 /** |
|
10682 * Internal dependencies |
|
10683 */ |
|
10684 |
|
10685 |
|
10686 |
|
10687 |
|
10688 function BlockInspectorButton(_ref) { |
|
10689 let { |
|
10690 onClick = () => {} |
|
10691 } = _ref; |
|
10692 const { |
|
10693 shortcut, |
|
10694 isBlockInspectorOpen |
|
10695 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
10696 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-block-settings-sidebar'), |
|
10697 isBlockInspectorOpen: select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK |
|
10698 }), []); |
|
10699 const { |
|
10700 enableComplementaryArea, |
|
10701 disableComplementaryArea |
|
10702 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
10703 const label = isBlockInspectorOpen ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings'); |
|
10704 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
10705 onClick: () => { |
|
10706 if (isBlockInspectorOpen) { |
|
10707 disableComplementaryArea(STORE_NAME); |
|
10708 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed')); |
|
10709 } else { |
|
10710 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
|
10711 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar')); |
|
10712 } // Close dropdown menu. |
|
10713 |
|
10714 |
|
10715 onClick(); |
|
10716 }, |
|
10717 shortcut: shortcut |
|
10718 }, label); |
|
10719 } |
|
10720 |
|
10721 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/edit-template-part-menu-button/index.js |
|
10722 |
|
10723 |
|
10724 |
|
10725 /** |
|
10726 * WordPress dependencies |
|
10727 */ |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 /** |
|
10735 * Internal dependencies |
|
10736 */ |
|
10737 |
|
10738 |
|
10739 |
|
10740 function EditTemplatePartMenuButton() { |
|
10741 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref => { |
|
10742 let { |
|
10743 selectedClientIds, |
|
10744 onClose |
|
10745 } = _ref; |
|
10746 return (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuItem, { |
|
10747 selectedClientId: selectedClientIds[0], |
|
10748 onClose: onClose |
|
10749 }); |
|
10750 }); |
|
10751 } |
|
10752 |
|
10753 function EditTemplatePartMenuItem(_ref2) { |
|
10754 let { |
|
10755 selectedClientId, |
|
10756 onClose |
|
10757 } = _ref2; |
|
10758 const { |
|
10759 params |
|
10760 } = useLocation(); |
|
10761 const selectedTemplatePart = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10762 const block = select(external_wp_blockEditor_namespaceObject.store).getBlock(selectedClientId); |
|
10763 |
|
10764 if (block && (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { |
|
10765 const { |
|
10766 theme, |
|
10767 slug |
|
10768 } = block.attributes; |
|
10769 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API. |
|
10770 `${theme}//${slug}`); |
|
10771 } |
|
10772 }, [selectedClientId]); |
|
10773 const linkProps = useLink({ |
|
10774 postId: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.id, |
|
10775 postType: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.type |
|
10776 }, { |
|
10777 fromTemplateId: params.postId |
|
10778 }); |
|
10779 |
|
10780 if (!selectedTemplatePart) { |
|
10781 return null; |
|
10782 } |
|
10783 |
|
10784 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, linkProps, { |
|
10785 onClick: event => { |
|
10786 linkProps.onClick(event); |
|
10787 onClose(); |
|
10788 } |
|
10789 }), |
|
10790 /* translators: %s: template part title */ |
|
10791 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Edit %s'), selectedTemplatePart.slug)); |
|
10792 } |
|
10793 |
|
10794 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js |
|
10795 |
|
10796 |
|
10797 /** |
|
10798 * WordPress dependencies |
|
10799 */ |
|
10800 |
|
10801 const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10802 xmlns: "http://www.w3.org/2000/svg", |
|
10803 viewBox: "0 0 24 24" |
|
10804 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
10805 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" |
|
10806 })); |
|
10807 /* harmony default export */ var arrow_left = (arrowLeft); |
|
10808 |
|
10809 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/back-button.js |
|
10810 |
|
10811 |
|
10812 /** |
|
10813 * WordPress dependencies |
|
10814 */ |
|
10815 |
|
10816 |
|
10817 |
|
10818 /** |
|
10819 * Internal dependencies |
|
10820 */ |
|
10821 |
|
10822 |
|
10823 |
|
10824 function BackButton() { |
|
10825 var _location$state; |
|
10826 |
|
10827 const location = useLocation(); |
|
10828 const history = useHistory(); |
|
10829 const isTemplatePart = location.params.postType === 'wp_template_part'; |
|
10830 const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId; |
|
10831 |
|
10832 if (!isTemplatePart || !previousTemplateId) { |
|
10833 return null; |
|
10834 } |
|
10835 |
|
10836 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
10837 className: "edit-site-visual-editor__back-button", |
|
10838 icon: arrow_left, |
|
10839 onClick: () => { |
|
10840 history.back(); |
|
10841 } |
|
10842 }, (0,external_wp_i18n_namespaceObject.__)('Back')); |
|
10843 } |
|
10844 |
|
10845 /* harmony default export */ var back_button = (BackButton); |
|
10846 |
|
10847 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resize-handle.js |
|
10848 |
|
10849 |
|
10850 /** |
|
10851 * WordPress dependencies |
|
10852 */ |
|
10853 |
|
10854 |
|
10855 |
|
10856 const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. |
|
10857 |
|
10858 function ResizeHandle(_ref) { |
|
10859 let { |
|
10860 direction, |
|
10861 resizeWidthBy |
|
10862 } = _ref; |
|
10863 |
|
10864 function handleKeyDown(event) { |
|
10865 const { |
|
10866 keyCode |
|
10867 } = event; |
|
10868 |
|
10869 if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { |
|
10870 resizeWidthBy(DELTA_DISTANCE); |
|
10871 } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { |
|
10872 resizeWidthBy(-DELTA_DISTANCE); |
|
10873 } |
|
10874 } |
|
10875 |
|
10876 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("button", { |
|
10877 className: `resizable-editor__drag-handle is-${direction}`, |
|
10878 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), |
|
10879 "aria-describedby": `resizable-editor__resize-help-${direction}`, |
|
10880 onKeyDown: handleKeyDown |
|
10881 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
10882 id: `resizable-editor__resize-help-${direction}` |
|
10883 }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.'))); |
|
10884 } |
|
10885 |
|
10886 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resizable-editor.js |
|
10887 |
|
10888 |
|
10889 |
|
10890 /** |
|
10891 * WordPress dependencies |
|
10892 */ |
|
10893 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 /** |
|
10899 * Internal dependencies |
|
10900 */ |
|
10901 |
|
10902 |
|
10903 |
|
10904 const DEFAULT_STYLES = { |
|
10905 width: '100%', |
|
10906 height: '100%' |
|
10907 }; // Removes the inline styles in the drag handles. |
|
10908 |
|
10909 const HANDLE_STYLES_OVERRIDE = { |
|
10910 position: undefined, |
|
10911 userSelect: undefined, |
|
10912 cursor: undefined, |
|
10913 width: undefined, |
|
10914 height: undefined, |
|
10915 top: undefined, |
|
10916 right: undefined, |
|
10917 bottom: undefined, |
|
10918 left: undefined |
|
10919 }; |
|
10920 |
|
10921 function ResizableEditor(_ref) { |
|
10922 let { |
|
10923 enableResizing, |
|
10924 settings, |
|
10925 children, |
|
10926 ...props |
|
10927 } = _ref; |
|
10928 const deviceType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetPreviewDeviceType(), []); |
|
10929 const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); |
|
10930 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.width); |
|
10931 const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.height); |
|
10932 const iframeRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
10933 const mouseMoveTypingResetRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)(); |
|
10934 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, mouseMoveTypingResetRef]); |
|
10935 (0,external_wp_element_namespaceObject.useEffect)(function autoResizeIframeHeight() { |
|
10936 const iframe = iframeRef.current; |
|
10937 |
|
10938 if (!iframe || !enableResizing) { |
|
10939 return; |
|
10940 } |
|
10941 |
|
10942 let animationFrame = null; |
|
10943 |
|
10944 function resizeHeight() { |
|
10945 if (!animationFrame) { |
|
10946 // Throttle the updates on animation frame. |
|
10947 animationFrame = iframe.contentWindow.requestAnimationFrame(() => { |
|
10948 setHeight(iframe.contentDocument.documentElement.scrollHeight); |
|
10949 animationFrame = null; |
|
10950 }); |
|
10951 } |
|
10952 } |
|
10953 |
|
10954 let resizeObserver; |
|
10955 |
|
10956 function registerObserver() { |
|
10957 var _resizeObserver; |
|
10958 |
|
10959 (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect(); |
|
10960 resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter |
|
10961 // gets destroyed and remounted after initialization in <Iframe>. |
|
10962 |
|
10963 resizeObserver.observe(iframe.contentDocument.documentElement); |
|
10964 resizeHeight(); |
|
10965 } // This is only required in Firefox for some unknown reasons. |
|
10966 |
|
10967 |
|
10968 iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari. |
|
10969 |
|
10970 registerObserver(); |
|
10971 return () => { |
|
10972 var _iframe$contentWindow, _resizeObserver2; |
|
10973 |
|
10974 (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame); |
|
10975 (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect(); |
|
10976 iframe.removeEventListener('load', registerObserver); |
|
10977 }; |
|
10978 }, [enableResizing]); |
|
10979 const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { |
|
10980 if (iframeRef.current) { |
|
10981 setWidth(iframeRef.current.offsetWidth + deltaPixels); |
|
10982 } |
|
10983 }, []); |
|
10984 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, { |
|
10985 size: { |
|
10986 width, |
|
10987 height |
|
10988 }, |
|
10989 onResizeStop: (event, direction, element) => { |
|
10990 setWidth(element.style.width); |
|
10991 }, |
|
10992 minWidth: 300, |
|
10993 maxWidth: "100%", |
|
10994 maxHeight: "100%", |
|
10995 enable: { |
|
10996 right: enableResizing, |
|
10997 left: enableResizing |
|
10998 }, |
|
10999 showHandle: enableResizing // The editor is centered horizontally, resizing it only |
|
11000 // moves half the distance. Hence double the ratio to correctly |
|
11001 // align the cursor to the resizer handle. |
|
11002 , |
|
11003 resizeRatio: 2, |
|
11004 handleComponent: { |
|
11005 left: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { |
|
11006 direction: "left", |
|
11007 resizeWidthBy: resizeWidthBy |
|
11008 }), |
|
11009 right: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, { |
|
11010 direction: "right", |
|
11011 resizeWidthBy: resizeWidthBy |
|
11012 }) |
|
11013 }, |
|
11014 handleClasses: undefined, |
|
11015 handleStyles: { |
|
11016 left: HANDLE_STYLES_OVERRIDE, |
|
11017 right: HANDLE_STYLES_OVERRIDE |
|
11018 } |
|
11019 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, extends_extends({ |
|
11020 style: enableResizing ? undefined : deviceStyles, |
|
11021 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
|
11022 styles: settings.styles |
|
11023 }), (0,external_wp_element_namespaceObject.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing. |
|
11024 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context |
|
11025 `.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. |
|
11026 `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, |
|
11027 // which isn't a requirement in auto resize mode. |
|
11028 `.is-root-container { min-height: 0 !important; }`)), |
|
11029 assets: settings.__unstableResolvedAssets, |
|
11030 ref: ref, |
|
11031 name: "editor-canvas", |
|
11032 className: "edit-site-visual-editor__editor-canvas" |
|
11033 }, props), settings.svgFilters, children)); |
|
11034 } |
|
11035 |
|
11036 /* harmony default export */ var resizable_editor = (ResizableEditor); |
|
11037 |
|
11038 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/index.js |
|
11039 |
|
11040 |
|
11041 |
|
11042 /** |
|
11043 * External dependencies |
|
11044 */ |
|
11045 |
|
11046 |
|
11047 /** |
|
11048 * WordPress dependencies |
|
11049 */ |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 |
|
11055 |
|
11056 |
|
11057 |
|
11058 |
|
11059 |
|
11060 |
|
11061 /** |
|
11062 * Internal dependencies |
|
11063 */ |
|
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 |
|
11073 const LAYOUT = { |
|
11074 type: 'default', |
|
11075 // At the root level of the site editor, no alignments should be allowed. |
|
11076 alignments: [] |
|
11077 }; |
|
11078 function BlockEditor(_ref) { |
|
11079 var _storedSettings$__exp, _storedSettings$__exp2; |
|
11080 |
|
11081 let { |
|
11082 setIsInserterOpen |
|
11083 } = _ref; |
|
11084 const { |
|
11085 storedSettings, |
|
11086 templateType, |
|
11087 templateId, |
|
11088 page |
|
11089 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
11090 const { |
|
11091 getSettings, |
|
11092 getEditedPostType, |
|
11093 getEditedPostId, |
|
11094 getPage |
|
11095 } = select(store_store); |
|
11096 return { |
|
11097 storedSettings: getSettings(setIsInserterOpen), |
|
11098 templateType: getEditedPostType(), |
|
11099 templateId: getEditedPostId(), |
|
11100 page: getPage() |
|
11101 }; |
|
11102 }, [setIsInserterOpen]); |
|
11103 const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0 |
|
11104 storedSettings.__experimentalBlockPatterns; // WP 5.9 |
|
11105 |
|
11106 const settingsBlockPatternCategories = (_storedSettings$__exp2 = storedSettings.__experimentalAdditionalBlockPatternCategories) !== null && _storedSettings$__exp2 !== void 0 ? _storedSettings$__exp2 : // WP 6.0 |
|
11107 storedSettings.__experimentalBlockPatternCategories; // WP 5.9 |
|
11108 |
|
11109 const { |
|
11110 restBlockPatterns, |
|
11111 restBlockPatternCategories |
|
11112 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
11113 restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), |
|
11114 restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() |
|
11115 }), []); |
|
11116 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatterns, restBlockPatterns, 'name'), [settingsBlockPatterns, restBlockPatterns]); |
|
11117 const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatternCategories, restBlockPatternCategories, 'name'), [settingsBlockPatternCategories, restBlockPatternCategories]); |
|
11118 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.omit)(storedSettings, ['__experimentalAdditionalBlockPatterns', '__experimentalAdditionalBlockPatternCategories']), |
|
11119 __experimentalBlockPatterns: blockPatterns, |
|
11120 __experimentalBlockPatternCategories: blockPatternCategories |
|
11121 }), [storedSettings, blockPatterns, blockPatternCategories]); |
|
11122 const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); |
|
11123 const { |
|
11124 setPage |
|
11125 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11126 const { |
|
11127 enableComplementaryArea |
|
11128 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
11129 const openNavigationSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { |
|
11130 enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu'); |
|
11131 }, [enableComplementaryArea]); |
|
11132 const contentRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
11133 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)()]); |
|
11134 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); |
|
11135 const { |
|
11136 clearSelectedBlock |
|
11137 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
11138 const isTemplatePart = templateType === 'wp_template_part'; |
|
11139 const hasBlocks = blocks.length !== 0; |
|
11140 |
|
11141 const NavMenuSidebarToggle = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { |
|
11142 className: "components-toolbar__control", |
|
11143 label: (0,external_wp_i18n_namespaceObject.__)('Open list view'), |
|
11144 onClick: openNavigationSidebar, |
|
11145 icon: list_view |
|
11146 })); // Conditionally include NavMenu sidebar in Plugin only. |
|
11147 // Optimise for dead code elimination. |
|
11148 // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination. |
|
11149 |
|
11150 |
|
11151 let MaybeNavMenuSidebarToggle = external_wp_element_namespaceObject.Fragment; |
|
11152 |
|
11153 if (false) {} |
|
11154 |
|
11155 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { |
|
11156 settings: settings, |
|
11157 value: blocks, |
|
11158 onInput: onInput, |
|
11159 onChange: onChange, |
|
11160 useSubRegistry: false |
|
11161 }, (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, { |
|
11162 activePage: page, |
|
11163 onActivePageChange: setPage |
|
11164 })), [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, { |
|
11165 className: classnames_default()('edit-site-visual-editor', { |
|
11166 'is-focus-mode': isTemplatePart |
|
11167 }), |
|
11168 __unstableContentRef: contentRef, |
|
11169 onClick: event => { |
|
11170 // Clear selected block when clicking on the gray background. |
|
11171 if (event.target === event.currentTarget) { |
|
11172 clearSelectedBlock(); |
|
11173 } |
|
11174 } |
|
11175 }, (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. |
|
11176 , { |
|
11177 key: templateId, |
|
11178 enableResizing: isTemplatePart && // Disable resizing in mobile viewport. |
|
11179 !isMobileViewport, |
|
11180 settings: settings, |
|
11181 contentRef: mergedRefs |
|
11182 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { |
|
11183 className: "edit-site-block-editor__block-list wp-site-blocks", |
|
11184 __experimentalLayout: LAYOUT, |
|
11185 renderAppender: isTemplatePart && hasBlocks ? false : undefined |
|
11186 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref2 => { |
|
11187 let { |
|
11188 onClose |
|
11189 } = _ref2; |
|
11190 return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorButton, { |
|
11191 onClick: onClose |
|
11192 }); |
|
11193 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0,external_wp_element_namespaceObject.createElement)(MaybeNavMenuSidebarToggle, null)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null)); |
|
11194 } |
|
11195 |
|
11196 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
|
11197 var lib = __webpack_require__(773); |
|
11198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/code-editor-text-area.js |
|
11199 |
|
11200 |
|
11201 /** |
|
11202 * External dependencies |
|
11203 */ |
|
11204 |
|
11205 /** |
|
11206 * WordPress dependencies |
|
11207 */ |
|
11208 |
|
11209 /** |
|
11210 * WordPress dependencies |
|
11211 */ |
|
11212 |
|
11213 /** |
|
11214 * WordPress dependencies |
|
11215 */ |
|
11216 |
|
11217 |
|
11218 |
|
11219 |
|
11220 |
|
11221 function CodeEditorTextArea(_ref) { |
|
11222 let { |
|
11223 value, |
|
11224 onChange, |
|
11225 onInput |
|
11226 } = _ref; |
|
11227 const [stateValue, setStateValue] = (0,external_wp_element_namespaceObject.useState)(value); |
|
11228 const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false); |
|
11229 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditorTextArea); |
|
11230 |
|
11231 if (!isDirty && stateValue !== value) { |
|
11232 setStateValue(value); |
|
11233 } |
|
11234 /** |
|
11235 * Handles a textarea change event to notify the onChange prop callback and |
|
11236 * reflect the new value in the component's own state. This marks the start |
|
11237 * of the user's edits, if not already changed, preventing future props |
|
11238 * changes to value from replacing the rendered value. This is expected to |
|
11239 * be followed by a reset to dirty state via `stopEditing`. |
|
11240 * |
|
11241 * @see stopEditing |
|
11242 * |
|
11243 * @param {Event} event Change event. |
|
11244 */ |
|
11245 |
|
11246 |
|
11247 const onChangeHandler = event => { |
|
11248 const newValue = event.target.value; |
|
11249 onInput(newValue); |
|
11250 setStateValue(newValue); |
|
11251 setIsDirty(true); |
|
11252 }; |
|
11253 /** |
|
11254 * Function called when the user has completed their edits, responsible for |
|
11255 * ensuring that changes, if made, are surfaced to the onPersist prop |
|
11256 * callback and resetting dirty state. |
|
11257 */ |
|
11258 |
|
11259 |
|
11260 const stopEditing = () => { |
|
11261 if (isDirty) { |
|
11262 onChange(stateValue); |
|
11263 setIsDirty(false); |
|
11264 } |
|
11265 }; |
|
11266 |
|
11267 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
11268 as: "label", |
|
11269 htmlFor: `code-editor-text-area-${instanceId}` |
|
11270 }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { |
|
11271 autoComplete: "off", |
|
11272 dir: "auto", |
|
11273 value: stateValue, |
|
11274 onChange: onChangeHandler, |
|
11275 onBlur: stopEditing, |
|
11276 className: "edit-site-code-editor-text-area", |
|
11277 id: `code-editor-text-area-${instanceId}`, |
|
11278 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') |
|
11279 })); |
|
11280 } |
|
11281 |
|
11282 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/index.js |
|
11283 |
|
11284 |
|
11285 /** |
|
11286 * WordPress dependencies |
|
11287 */ |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 /** |
|
11295 * Internal dependencies |
|
11296 */ |
|
11297 |
|
11298 |
|
11299 |
|
11300 function CodeEditor() { |
|
11301 const { |
|
11302 templateType, |
|
11303 shortcut |
|
11304 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
11305 const { |
|
11306 getEditedPostType |
|
11307 } = select(store_store); |
|
11308 const { |
|
11309 getShortcutRepresentation |
|
11310 } = select(external_wp_keyboardShortcuts_namespaceObject.store); |
|
11311 return { |
|
11312 templateType: getEditedPostType(), |
|
11313 shortcut: getShortcutRepresentation('core/edit-site/toggle-mode') |
|
11314 }; |
|
11315 }, []); |
|
11316 const [contentStructure, setContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', templateType, 'content'); |
|
11317 const [blocks,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); |
|
11318 const content = contentStructure instanceof Function ? contentStructure({ |
|
11319 blocks |
|
11320 }) : contentStructure; |
|
11321 const { |
|
11322 switchEditorMode |
|
11323 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11324 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11325 className: "edit-site-code-editor" |
|
11326 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11327 className: "edit-site-code-editor__toolbar" |
|
11328 }, (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, { |
|
11329 variant: "tertiary", |
|
11330 onClick: () => switchEditorMode('visual'), |
|
11331 shortcut: shortcut |
|
11332 }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11333 className: "edit-site-code-editor__body" |
|
11334 }, (0,external_wp_element_namespaceObject.createElement)(CodeEditorTextArea, { |
|
11335 value: content, |
|
11336 onChange: newContent => { |
|
11337 onChange((0,external_wp_blocks_namespaceObject.parse)(newContent), { |
|
11338 selection: undefined |
|
11339 }); |
|
11340 }, |
|
11341 onInput: setContent |
|
11342 }))); |
|
11343 } |
|
11344 |
|
11345 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/index.js |
|
11346 /** |
|
11347 * WordPress dependencies |
|
11348 */ |
|
11349 |
|
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 |
|
11355 /** |
|
11356 * Internal dependencies |
|
11357 */ |
|
11358 |
|
11359 |
|
11360 |
|
11361 |
|
11362 |
|
11363 function KeyboardShortcuts(_ref) { |
|
11364 let { |
|
11365 openEntitiesSavedStates |
|
11366 } = _ref; |
|
11367 const { |
|
11368 __experimentalGetDirtyEntityRecords, |
|
11369 isSavingEntityRecord |
|
11370 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); |
|
11371 const { |
|
11372 getEditorMode |
|
11373 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
|
11374 const isListViewOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isListViewOpened(), []); |
|
11375 const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []); |
|
11376 const { |
|
11377 redo, |
|
11378 undo |
|
11379 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
11380 const { |
|
11381 setIsListViewOpened, |
|
11382 switchEditorMode |
|
11383 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11384 const { |
|
11385 enableComplementaryArea, |
|
11386 disableComplementaryArea |
|
11387 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
11388 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { |
|
11389 event.preventDefault(); |
|
11390 |
|
11391 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
|
11392 |
|
11393 const isDirty = !!dirtyEntityRecords.length; |
|
11394 const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); |
|
11395 |
|
11396 if (!isSaving && isDirty) { |
|
11397 openEntitiesSavedStates(); |
|
11398 } |
|
11399 }); |
|
11400 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/undo', event => { |
|
11401 undo(); |
|
11402 event.preventDefault(); |
|
11403 }); |
|
11404 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/redo', event => { |
|
11405 redo(); |
|
11406 event.preventDefault(); |
|
11407 }); |
|
11408 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-list-view', () => { |
|
11409 setIsListViewOpened(!isListViewOpen); |
|
11410 }); |
|
11411 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => { |
|
11412 // This shortcut has no known clashes, but use preventDefault to prevent any |
|
11413 // obscure shortcuts from triggering. |
|
11414 event.preventDefault(); |
|
11415 |
|
11416 if (isBlockInspectorOpen) { |
|
11417 disableComplementaryArea(STORE_NAME); |
|
11418 } else { |
|
11419 enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK); |
|
11420 } |
|
11421 }); |
|
11422 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => { |
|
11423 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); |
|
11424 }); |
|
11425 return null; |
|
11426 } |
|
11427 |
|
11428 function KeyboardShortcutsRegister() { |
|
11429 // Registering the shortcuts. |
|
11430 const { |
|
11431 registerShortcut |
|
11432 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
|
11433 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
11434 registerShortcut({ |
|
11435 name: 'core/edit-site/save', |
|
11436 category: 'global', |
|
11437 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), |
|
11438 keyCombination: { |
|
11439 modifier: 'primary', |
|
11440 character: 's' |
|
11441 } |
|
11442 }); |
|
11443 registerShortcut({ |
|
11444 name: 'core/edit-site/undo', |
|
11445 category: 'global', |
|
11446 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), |
|
11447 keyCombination: { |
|
11448 modifier: 'primary', |
|
11449 character: 'z' |
|
11450 } |
|
11451 }); |
|
11452 registerShortcut({ |
|
11453 name: 'core/edit-site/redo', |
|
11454 category: 'global', |
|
11455 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), |
|
11456 keyCombination: { |
|
11457 modifier: 'primaryShift', |
|
11458 character: 'z' |
|
11459 } |
|
11460 }); |
|
11461 registerShortcut({ |
|
11462 name: 'core/edit-site/toggle-list-view', |
|
11463 category: 'global', |
|
11464 description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'), |
|
11465 keyCombination: { |
|
11466 modifier: 'access', |
|
11467 character: 'o' |
|
11468 } |
|
11469 }); |
|
11470 registerShortcut({ |
|
11471 name: 'core/edit-site/toggle-block-settings-sidebar', |
|
11472 category: 'global', |
|
11473 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the block settings sidebar.'), |
|
11474 keyCombination: { |
|
11475 modifier: 'primaryShift', |
|
11476 character: ',' |
|
11477 } |
|
11478 }); |
|
11479 registerShortcut({ |
|
11480 name: 'core/edit-site/keyboard-shortcuts', |
|
11481 category: 'main', |
|
11482 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), |
|
11483 keyCombination: { |
|
11484 modifier: 'access', |
|
11485 character: 'h' |
|
11486 } |
|
11487 }); |
|
11488 registerShortcut({ |
|
11489 name: 'core/edit-site/next-region', |
|
11490 category: 'global', |
|
11491 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), |
|
11492 keyCombination: { |
|
11493 modifier: 'ctrl', |
|
11494 character: '`' |
|
11495 }, |
|
11496 aliases: [{ |
|
11497 modifier: 'access', |
|
11498 character: 'n' |
|
11499 }] |
|
11500 }); |
|
11501 registerShortcut({ |
|
11502 name: 'core/edit-site/previous-region', |
|
11503 category: 'global', |
|
11504 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), |
|
11505 keyCombination: { |
|
11506 modifier: 'ctrlShift', |
|
11507 character: '`' |
|
11508 }, |
|
11509 aliases: [{ |
|
11510 modifier: 'access', |
|
11511 character: 'p' |
|
11512 }] |
|
11513 }); |
|
11514 registerShortcut({ |
|
11515 name: 'core/edit-site/toggle-mode', |
|
11516 category: 'global', |
|
11517 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), |
|
11518 keyCombination: { |
|
11519 modifier: 'secondary', |
|
11520 character: 'm' |
|
11521 } |
|
11522 }); |
|
11523 }, [registerShortcut]); |
|
11524 return null; |
|
11525 } |
|
11526 |
|
11527 KeyboardShortcuts.Register = KeyboardShortcutsRegister; |
|
11528 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); |
|
11529 |
|
11530 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/url-query-controller/index.js |
|
11531 /** |
|
11532 * WordPress dependencies |
|
11533 */ |
|
11534 |
|
11535 |
|
11536 /** |
|
11537 * Internal dependencies |
|
11538 */ |
|
11539 |
|
11540 |
|
11541 |
|
11542 function URLQueryController() { |
|
11543 const { |
|
11544 setTemplate, |
|
11545 setTemplatePart, |
|
11546 setPage |
|
11547 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11548 const { |
|
11549 params: { |
|
11550 postId, |
|
11551 postType |
|
11552 } |
|
11553 } = useLocation(); // Set correct entity on page navigation. |
|
11554 |
|
11555 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
11556 if ('page' === postType || 'post' === postType) { |
|
11557 setPage({ |
|
11558 context: { |
|
11559 postType, |
|
11560 postId |
|
11561 } |
|
11562 }); // Resolves correct template based on ID. |
|
11563 } else if ('wp_template' === postType) { |
|
11564 setTemplate(postId); |
|
11565 } else if ('wp_template_part' === postType) { |
|
11566 setTemplatePart(postId); |
|
11567 } |
|
11568 }, [postId, postType]); |
|
11569 return null; |
|
11570 } |
|
11571 |
|
11572 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
|
11573 |
|
11574 |
|
11575 /** |
|
11576 * WordPress dependencies |
|
11577 */ |
|
11578 |
|
11579 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
11580 xmlns: "http://www.w3.org/2000/svg", |
|
11581 viewBox: "0 0 24 24" |
|
11582 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
11583 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" |
|
11584 })); |
|
11585 /* harmony default export */ var library_close = (close_close); |
|
11586 |
|
11587 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/inserter-sidebar.js |
|
11588 |
|
11589 |
|
11590 |
|
11591 /** |
|
11592 * WordPress dependencies |
|
11593 */ |
|
11594 |
|
11595 |
|
11596 |
|
11597 |
|
11598 |
|
11599 |
|
11600 |
|
11601 /** |
|
11602 * Internal dependencies |
|
11603 */ |
|
11604 |
|
11605 |
|
11606 function InserterSidebar() { |
|
11607 const { |
|
11608 setIsInserterOpened |
|
11609 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11610 const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetInsertionPoint(), []); |
|
11611 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); |
|
11612 const TagName = !isMobile ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; |
|
11613 const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ |
|
11614 onClose: () => setIsInserterOpened(false), |
|
11615 focusOnMount: null |
|
11616 }); |
|
11617 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
11618 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
11619 libraryRef.current.focusSearch(); |
|
11620 }, []); |
|
11621 return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({ |
|
11622 ref: inserterDialogRef |
|
11623 }, inserterDialogProps, { |
|
11624 className: "edit-site-editor__inserter-panel" |
|
11625 }), (0,external_wp_element_namespaceObject.createElement)(TagName, { |
|
11626 className: "edit-site-editor__inserter-panel-header" |
|
11627 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
11628 icon: library_close, |
|
11629 label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), |
|
11630 onClick: () => setIsInserterOpened(false) |
|
11631 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11632 className: "edit-site-editor__inserter-panel-content" |
|
11633 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { |
|
11634 showInserterHelpPanel: true, |
|
11635 shouldFocusBlock: isMobile, |
|
11636 rootClientId: insertionPoint.rootClientId, |
|
11637 __experimentalInsertionIndex: insertionPoint.insertionIndex, |
|
11638 __experimentalFilterValue: insertionPoint.filterValue, |
|
11639 ref: libraryRef |
|
11640 }))); |
|
11641 } |
|
11642 |
|
11643 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/list-view-sidebar.js |
|
11644 |
|
11645 |
|
11646 /** |
|
11647 * WordPress dependencies |
|
11648 */ |
|
11649 |
|
11650 |
|
11651 |
|
11652 |
|
11653 |
|
11654 |
|
11655 |
|
11656 /** |
|
11657 * Internal dependencies |
|
11658 */ |
|
11659 |
|
11660 |
|
11661 function ListViewSidebar() { |
|
11662 const { |
|
11663 setIsListViewOpened |
|
11664 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
11665 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); |
|
11666 const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
|
11667 const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
|
11668 |
|
11669 function closeOnEscape(event) { |
|
11670 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { |
|
11671 setIsListViewOpened(false); |
|
11672 } |
|
11673 } |
|
11674 |
|
11675 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar); |
|
11676 const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`; |
|
11677 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
|
11678 (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11679 "aria-labelledby": labelId, |
|
11680 className: "edit-site-editor__list-view-panel", |
|
11681 onKeyDown: closeOnEscape |
|
11682 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11683 className: "edit-site-editor__list-view-panel-header", |
|
11684 ref: headerFocusReturnRef |
|
11685 }, (0,external_wp_element_namespaceObject.createElement)("strong", { |
|
11686 id: labelId |
|
11687 }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
11688 icon: close_small, |
|
11689 label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'), |
|
11690 onClick: () => setIsListViewOpened(false) |
|
11691 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
11692 className: "edit-site-editor__list-view-panel-content", |
|
11693 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef]) |
|
11694 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { |
|
11695 showNestedBlocks: true, |
|
11696 __experimentalFeatures: true, |
|
11697 __experimentalPersistentListViewFeatures: true |
|
11698 }))) |
|
11699 ); |
|
11700 } |
|
11701 |
|
11702 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js |
|
11703 |
|
11704 |
|
11705 /** |
|
11706 * WordPress dependencies |
|
11707 */ |
|
11708 |
|
11709 |
|
11710 |
|
11711 |
|
11712 |
|
11713 function CopyButton(_ref) { |
|
11714 let { |
|
11715 text, |
|
11716 children |
|
11717 } = _ref; |
|
11718 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); |
|
11719 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
11720 variant: "secondary", |
|
11721 ref: ref |
|
11722 }, children); |
|
11723 } |
|
11724 |
|
11725 function ErrorBoundaryWarning(_ref2) { |
|
11726 let { |
|
11727 message, |
|
11728 error, |
|
11729 reboot, |
|
11730 dashboardLink |
|
11731 } = _ref2; |
|
11732 const actions = []; |
|
11733 |
|
11734 if (reboot) { |
|
11735 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
11736 key: "recovery", |
|
11737 onClick: reboot, |
|
11738 variant: "secondary" |
|
11739 }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery'))); |
|
11740 } |
|
11741 |
|
11742 if (error) { |
|
11743 actions.push((0,external_wp_element_namespaceObject.createElement)(CopyButton, { |
|
11744 key: "copy-error", |
|
11745 text: error.stack |
|
11746 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))); |
|
11747 } |
|
11748 |
|
11749 if (dashboardLink) { |
|
11750 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
11751 key: "back-to-dashboard", |
|
11752 variant: "secondary", |
|
11753 href: dashboardLink |
|
11754 }, (0,external_wp_i18n_namespaceObject.__)('Back to dashboard'))); |
|
11755 } |
|
11756 |
|
11757 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { |
|
11758 className: "editor-error-boundary", |
|
11759 actions: actions |
|
11760 }, message); |
|
11761 } |
|
11762 |
|
11763 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js |
|
11764 |
|
11765 |
|
11766 /** |
|
11767 * WordPress dependencies |
|
11768 */ |
|
11769 |
|
11770 |
|
11771 /** |
|
11772 * Internal dependencies |
|
11773 */ |
|
11774 |
|
11775 |
|
11776 class ErrorBoundary extends external_wp_element_namespaceObject.Component { |
|
11777 constructor() { |
|
11778 super(...arguments); |
|
11779 this.reboot = this.reboot.bind(this); |
|
11780 this.state = { |
|
11781 error: null |
|
11782 }; |
|
11783 } |
|
11784 |
|
11785 static getDerivedStateFromError(error) { |
|
11786 return { |
|
11787 error |
|
11788 }; |
|
11789 } |
|
11790 |
|
11791 reboot() { |
|
11792 this.props.onError(); |
|
11793 } |
|
11794 |
|
11795 render() { |
|
11796 const { |
|
11797 error |
|
11798 } = this.state; |
|
11799 |
|
11800 if (!error) { |
|
11801 return this.props.children; |
|
11802 } |
|
11803 |
|
11804 return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, { |
|
11805 message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'), |
|
11806 error: error, |
|
11807 reboot: this.reboot |
|
11808 }); |
|
11809 } |
|
11810 |
|
11811 } |
|
11812 |
|
11813 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js |
|
11814 |
|
11815 function WelcomeGuideImage(_ref) { |
|
11816 let { |
|
11817 nonAnimatedSrc, |
|
11818 animatedSrc |
|
11819 } = _ref; |
|
11820 return (0,external_wp_element_namespaceObject.createElement)("picture", { |
|
11821 className: "edit-site-welcome-guide__image" |
|
11822 }, (0,external_wp_element_namespaceObject.createElement)("source", { |
|
11823 srcSet: nonAnimatedSrc, |
|
11824 media: "(prefers-reduced-motion: reduce)" |
|
11825 }), (0,external_wp_element_namespaceObject.createElement)("img", { |
|
11826 src: animatedSrc, |
|
11827 width: "312", |
|
11828 height: "240", |
|
11829 alt: "" |
|
11830 })); |
|
11831 } |
|
11832 |
|
11833 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js |
|
11834 |
|
11835 |
|
11836 /** |
|
11837 * WordPress dependencies |
|
11838 */ |
|
11839 |
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 /** |
|
11845 * Internal dependencies |
|
11846 */ |
|
11847 |
|
11848 |
|
11849 function WelcomeGuideEditor() { |
|
11850 const { |
|
11851 toggle |
|
11852 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
|
11853 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), []); |
|
11854 |
|
11855 if (!isActive) { |
|
11856 return null; |
|
11857 } |
|
11858 |
|
11859 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
|
11860 className: "edit-site-welcome-guide", |
|
11861 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), |
|
11862 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), |
|
11863 onFinish: () => toggle('core/edit-site', 'welcomeGuide'), |
|
11864 pages: [{ |
|
11865 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
|
11866 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", |
|
11867 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" |
|
11868 }), |
|
11869 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
|
11870 className: "edit-site-welcome-guide__heading" |
|
11871 }, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_wp_element_namespaceObject.createElement)("p", { |
|
11872 className: "edit-site-welcome-guide__text" |
|
11873 }, (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", { |
|
11874 className: "edit-site-welcome-guide__text" |
|
11875 }, (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.'), { |
|
11876 StylesIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { |
|
11877 alt: (0,external_wp_i18n_namespaceObject.__)('styles'), |
|
11878 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" |
|
11879 }) |
|
11880 }))) |
|
11881 }] |
|
11882 }); |
|
11883 } |
|
11884 |
|
11885 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js |
|
11886 |
|
11887 |
|
11888 /** |
|
11889 * WordPress dependencies |
|
11890 */ |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 /** |
|
11897 * Internal dependencies |
|
11898 */ |
|
11899 |
|
11900 |
|
11901 |
|
11902 function WelcomeGuideStyles() { |
|
11903 const { |
|
11904 toggle |
|
11905 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
|
11906 const { |
|
11907 isActive, |
|
11908 isStylesOpen |
|
11909 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
11910 const sidebar = select(store).getActiveComplementaryArea(store_store.name); |
|
11911 return { |
|
11912 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), |
|
11913 isStylesOpen: sidebar === 'edit-site/global-styles' |
|
11914 }; |
|
11915 }, []); |
|
11916 |
|
11917 if (!isActive || !isStylesOpen) { |
|
11918 return null; |
|
11919 } |
|
11920 |
|
11921 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
|
11922 className: "edit-site-welcome-guide", |
|
11923 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to styles'), |
|
11924 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'), |
|
11925 onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), |
|
11926 pages: [{ |
|
11927 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
|
11928 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", |
|
11929 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" |
|
11930 }), |
|
11931 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
|
11932 className: "edit-site-welcome-guide__heading" |
|
11933 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles')), (0,external_wp_element_namespaceObject.createElement)("p", { |
|
11934 className: "edit-site-welcome-guide__text" |
|
11935 }, (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.'))) |
|
11936 }, { |
|
11937 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
|
11938 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", |
|
11939 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" |
|
11940 }), |
|
11941 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
|
11942 className: "edit-site-welcome-guide__heading" |
|
11943 }, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_wp_element_namespaceObject.createElement)("p", { |
|
11944 className: "edit-site-welcome-guide__text" |
|
11945 }, (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! '))) |
|
11946 }, { |
|
11947 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
|
11948 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", |
|
11949 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" |
|
11950 }), |
|
11951 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
|
11952 className: "edit-site-welcome-guide__heading" |
|
11953 }, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_wp_element_namespaceObject.createElement)("p", { |
|
11954 className: "edit-site-welcome-guide__text" |
|
11955 }, (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.'))) |
|
11956 }, { |
|
11957 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
|
11958 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
|
11959 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
|
11960 }), |
|
11961 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
|
11962 className: "edit-site-welcome-guide__heading" |
|
11963 }, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_wp_element_namespaceObject.createElement)("p", { |
|
11964 className: "edit-site-welcome-guide__text" |
|
11965 }, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
|
11966 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/styles-overview/') |
|
11967 }, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.')))) |
|
11968 }] |
|
11969 }); |
|
11970 } |
|
11971 |
|
11972 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js |
|
11973 |
|
11974 |
|
11975 /** |
|
11976 * Internal dependencies |
|
11977 */ |
|
11978 |
|
11979 |
|
11980 function WelcomeGuide() { |
|
11981 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)); |
|
11982 } |
|
11983 |
|
11984 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/global-styles-renderer.js |
|
11985 /** |
|
11986 * External dependencies |
|
11987 */ |
|
11988 |
|
11989 /** |
|
11990 * WordPress dependencies |
|
11991 */ |
|
11992 |
|
11993 |
|
11994 |
|
11995 /** |
|
11996 * Internal dependencies |
|
11997 */ |
|
11998 |
|
11999 |
|
12000 /** |
|
12001 * Internal dependencies |
|
12002 */ |
|
12003 |
|
12004 |
|
12005 |
|
12006 function useGlobalStylesRenderer() { |
|
12007 const [styles, settings, svgFilters] = useGlobalStylesOutput(); |
|
12008 const { |
|
12009 getSettings |
|
12010 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
|
12011 const { |
|
12012 updateSettings |
|
12013 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
12014 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
12015 if (!styles || !settings) { |
|
12016 return; |
|
12017 } |
|
12018 |
|
12019 const currentStoreSettings = getSettings(); |
|
12020 const nonGlobalStyles = (0,external_lodash_namespaceObject.filter)(currentStoreSettings.styles, style => !style.isGlobalStyles); |
|
12021 updateSettings({ ...currentStoreSettings, |
|
12022 styles: [...nonGlobalStyles, ...styles], |
|
12023 svgFilters, |
|
12024 __experimentalFeatures: settings |
|
12025 }); |
|
12026 }, [styles, settings]); |
|
12027 } |
|
12028 |
|
12029 function GlobalStylesRenderer() { |
|
12030 useGlobalStylesRenderer(); |
|
12031 return null; |
|
12032 } |
|
12033 |
|
12034 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js |
|
12035 /** |
|
12036 * WordPress dependencies |
|
12037 */ |
|
12038 |
|
12039 |
|
12040 |
|
12041 |
|
12042 |
|
12043 /** |
|
12044 * Internal dependencies |
|
12045 */ |
|
12046 |
|
12047 |
|
12048 function useTitle(title) { |
|
12049 const location = useLocation(); |
|
12050 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
12051 var _select$getEntityReco; |
|
12052 |
|
12053 return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title; |
|
12054 }, []); |
|
12055 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); |
|
12056 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
12057 isInitialLocationRef.current = false; |
|
12058 }, [location]); |
|
12059 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
12060 // Don't update or announce the title for initial page load. |
|
12061 if (isInitialLocationRef.current) { |
|
12062 return; |
|
12063 } |
|
12064 |
|
12065 if (title && siteTitle) { |
|
12066 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 |
|
12067 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
12068 /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ |
|
12069 (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s — WordPress'), title, siteTitle); |
|
12070 document.title = formattedTitle; // Announce title on route change for screen readers. |
|
12071 |
|
12072 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( |
|
12073 /* translators: The page title that is currently displaying. */ |
|
12074 (0,external_wp_i18n_namespaceObject.__)('Now displaying: %s'), document.title), 'assertive'); |
|
12075 } |
|
12076 }, [title, siteTitle, location]); |
|
12077 } |
|
12078 |
|
12079 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js |
|
12080 |
|
12081 |
|
12082 /** |
|
12083 * WordPress dependencies |
|
12084 */ |
|
12085 |
|
12086 |
|
12087 |
|
12088 |
|
12089 |
|
12090 |
|
12091 |
|
12092 |
|
12093 |
|
12094 |
|
12095 /** |
|
12096 * Internal dependencies |
|
12097 */ |
|
12098 |
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 const interfaceLabels = { |
|
12115 drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar') |
|
12116 }; |
|
12117 |
|
12118 function Editor(_ref) { |
|
12119 let { |
|
12120 onError |
|
12121 } = _ref; |
|
12122 const { |
|
12123 isInserterOpen, |
|
12124 isListViewOpen, |
|
12125 sidebarIsOpened, |
|
12126 settings, |
|
12127 entityId, |
|
12128 templateType, |
|
12129 page, |
|
12130 template, |
|
12131 templateResolved, |
|
12132 isNavigationOpen, |
|
12133 previousShortcut, |
|
12134 nextShortcut, |
|
12135 editorMode, |
|
12136 showIconLabels |
|
12137 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
12138 const { |
|
12139 isInserterOpened, |
|
12140 isListViewOpened, |
|
12141 getSettings, |
|
12142 getEditedPostType, |
|
12143 getEditedPostId, |
|
12144 getPage, |
|
12145 isNavigationOpened, |
|
12146 getEditorMode |
|
12147 } = select(store_store); |
|
12148 const { |
|
12149 hasFinishedResolution, |
|
12150 getEntityRecord |
|
12151 } = select(external_wp_coreData_namespaceObject.store); |
|
12152 const postType = getEditedPostType(); |
|
12153 const postId = getEditedPostId(); // The currently selected entity to display. Typically template or template part. |
|
12154 |
|
12155 return { |
|
12156 isInserterOpen: isInserterOpened(), |
|
12157 isListViewOpen: isListViewOpened(), |
|
12158 sidebarIsOpened: !!select(store).getActiveComplementaryArea(store_store.name), |
|
12159 settings: getSettings(), |
|
12160 templateType: postType, |
|
12161 page: getPage(), |
|
12162 template: postId ? getEntityRecord('postType', postType, postId) : null, |
|
12163 templateResolved: postId ? hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) : false, |
|
12164 entityId: postId, |
|
12165 isNavigationOpen: isNavigationOpened(), |
|
12166 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), |
|
12167 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), |
|
12168 editorMode: getEditorMode(), |
|
12169 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'showIconLabels') |
|
12170 }; |
|
12171 }, []); |
|
12172 const { |
|
12173 setPage, |
|
12174 setIsInserterOpened |
|
12175 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
12176 const { |
|
12177 enableComplementaryArea |
|
12178 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
12179 const [isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
12180 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setIsEntitiesSavedStatesOpen(true), []); |
|
12181 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => { |
|
12182 setIsEntitiesSavedStatesOpen(false); |
|
12183 }, []); |
|
12184 const blockContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(page === null || page === void 0 ? void 0 : page.context), |
|
12185 queryContext: [(page === null || page === void 0 ? void 0 : page.context.queryContext) || { |
|
12186 page: 1 |
|
12187 }, newQueryContext => setPage({ ...page, |
|
12188 context: { ...(page === null || page === void 0 ? void 0 : page.context), |
|
12189 queryContext: { ...(page === null || page === void 0 ? void 0 : page.context.queryContext), |
|
12190 ...newQueryContext |
|
12191 } |
|
12192 } |
|
12193 })] |
|
12194 }), [page === null || page === void 0 ? void 0 : page.context]); |
|
12195 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
12196 if (isNavigationOpen) { |
|
12197 document.body.classList.add('is-navigation-sidebar-open'); |
|
12198 } else { |
|
12199 document.body.classList.remove('is-navigation-sidebar-open'); |
|
12200 } |
|
12201 }, [isNavigationOpen]); |
|
12202 (0,external_wp_element_namespaceObject.useEffect)(function openGlobalStylesOnLoad() { |
|
12203 const searchParams = new URLSearchParams(window.location.search); |
|
12204 |
|
12205 if (searchParams.get('styles') === 'open') { |
|
12206 enableComplementaryArea('core/edit-site', 'edit-site/global-styles'); |
|
12207 } |
|
12208 }, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded. |
|
12209 |
|
12210 const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined; |
|
12211 const secondarySidebarLabel = isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); |
|
12212 |
|
12213 const secondarySidebar = () => { |
|
12214 if (editorMode === 'visual' && isInserterOpen) { |
|
12215 return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); |
|
12216 } |
|
12217 |
|
12218 if (editorMode === 'visual' && isListViewOpen) { |
|
12219 return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null); |
|
12220 } |
|
12221 |
|
12222 return null; |
|
12223 }; // Only announce the title once the editor is ready to prevent "Replace" |
|
12224 // action in <URlQueryController> from double-announcing. |
|
12225 |
|
12226 |
|
12227 useTitle(isReady && (0,external_wp_i18n_namespaceObject.__)('Editor (beta)')); |
|
12228 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, { |
|
12229 kind: "root", |
|
12230 type: "site" |
|
12231 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { |
|
12232 kind: "postType", |
|
12233 type: templateType, |
|
12234 id: entityId |
|
12235 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { |
|
12236 value: blockContext |
|
12237 }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesRenderer, null), (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, { |
|
12238 onError: onError |
|
12239 }, (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, { |
|
12240 labels: { ...interfaceLabels, |
|
12241 secondarySidebar: secondarySidebarLabel |
|
12242 }, |
|
12243 className: showIconLabels && 'show-icon-labels', |
|
12244 secondarySidebar: secondarySidebar(), |
|
12245 sidebar: sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { |
|
12246 scope: "core/edit-site" |
|
12247 }), |
|
12248 drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), |
|
12249 header: (0,external_wp_element_namespaceObject.createElement)(Header, { |
|
12250 openEntitiesSavedStates: openEntitiesSavedStates, |
|
12251 showIconLabels: showIconLabels |
|
12252 }), |
|
12253 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), |
|
12254 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, { |
|
12255 scope: "core/block-inspector" |
|
12256 }), editorMode === 'visual' && template && (0,external_wp_element_namespaceObject.createElement)(BlockEditor, { |
|
12257 setIsInserterOpen: setIsInserterOpened |
|
12258 }), 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, { |
|
12259 status: "warning", |
|
12260 isDismissible: false |
|
12261 }, (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, { |
|
12262 openEntitiesSavedStates: openEntitiesSavedStates |
|
12263 })), |
|
12264 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, { |
|
12265 close: closeEntitiesSavedStates |
|
12266 }) : (0,external_wp_element_namespaceObject.createElement)("div", { |
|
12267 className: "edit-site-editor__toggle-save-panel" |
|
12268 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
12269 variant: "secondary", |
|
12270 className: "edit-site-editor__toggle-save-panel-button", |
|
12271 onClick: openEntitiesSavedStates, |
|
12272 "aria-expanded": false |
|
12273 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')))), |
|
12274 footer: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { |
|
12275 rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Template') |
|
12276 }), |
|
12277 shortcuts: { |
|
12278 previous: previousShortcut, |
|
12279 next: nextShortcut |
|
12280 } |
|
12281 }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null)))))))); |
|
12282 } |
|
12283 |
|
12284 /* harmony default export */ var editor = (Editor); |
|
12285 |
|
12286 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/use-register-shortcuts.js |
|
12287 /** |
|
12288 * WordPress dependencies |
|
12289 */ |
|
12290 |
|
12291 |
|
12292 |
|
12293 |
|
12294 function useRegisterShortcuts() { |
|
12295 const { |
|
12296 registerShortcut |
|
12297 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
|
12298 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
12299 registerShortcut({ |
|
12300 name: 'core/edit-site/next-region', |
|
12301 category: 'global', |
|
12302 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), |
|
12303 keyCombination: { |
|
12304 modifier: 'ctrl', |
|
12305 character: '`' |
|
12306 }, |
|
12307 aliases: [{ |
|
12308 modifier: 'access', |
|
12309 character: 'n' |
|
12310 }] |
|
12311 }); |
|
12312 registerShortcut({ |
|
12313 name: 'core/edit-site/previous-region', |
|
12314 category: 'global', |
|
12315 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), |
|
12316 keyCombination: { |
|
12317 modifier: 'ctrlShift', |
|
12318 character: '`' |
|
12319 }, |
|
12320 aliases: [{ |
|
12321 modifier: 'access', |
|
12322 character: 'p' |
|
12323 }] |
|
12324 }); |
|
12325 }, []); |
|
12326 } |
|
12327 |
|
12328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js |
|
12329 |
|
12330 |
|
12331 /** |
|
12332 * WordPress dependencies |
|
12333 */ |
|
12334 |
|
12335 const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12336 xmlns: "http://www.w3.org/2000/svg", |
|
12337 viewBox: "0 0 24 24" |
|
12338 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12339 d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" |
|
12340 })); |
|
12341 /* harmony default export */ var library_post = (post); |
|
12342 |
|
12343 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js |
|
12344 |
|
12345 |
|
12346 /** |
|
12347 * WordPress dependencies |
|
12348 */ |
|
12349 |
|
12350 const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12351 xmlns: "http://www.w3.org/2000/svg", |
|
12352 viewBox: "0 0 24 24" |
|
12353 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12354 d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" |
|
12355 })); |
|
12356 /* harmony default export */ var library_page = (page); |
|
12357 |
|
12358 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js |
|
12359 |
|
12360 |
|
12361 /** |
|
12362 * WordPress dependencies |
|
12363 */ |
|
12364 |
|
12365 const archive = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12366 viewBox: "0 0 24 24", |
|
12367 xmlns: "http://www.w3.org/2000/svg" |
|
12368 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12369 d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z" |
|
12370 })); |
|
12371 /* harmony default export */ var library_archive = (archive); |
|
12372 |
|
12373 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js |
|
12374 |
|
12375 |
|
12376 /** |
|
12377 * WordPress dependencies |
|
12378 */ |
|
12379 |
|
12380 const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12381 xmlns: "http://www.w3.org/2000/svg", |
|
12382 viewBox: "0 0 24 24" |
|
12383 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12384 d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" |
|
12385 })); |
|
12386 /* harmony default export */ var library_search = (search); |
|
12387 |
|
12388 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js |
|
12389 |
|
12390 |
|
12391 /** |
|
12392 * WordPress dependencies |
|
12393 */ |
|
12394 |
|
12395 const notFound = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12396 xmlns: "http://www.w3.org/2000/svg", |
|
12397 viewBox: "0 0 24 24" |
|
12398 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12399 d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" |
|
12400 })); |
|
12401 /* harmony default export */ var not_found = (notFound); |
|
12402 |
|
12403 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js |
|
12404 |
|
12405 |
|
12406 /** |
|
12407 * WordPress dependencies |
|
12408 */ |
|
12409 |
|
12410 const list = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12411 viewBox: "0 0 24 24", |
|
12412 xmlns: "http://www.w3.org/2000/svg" |
|
12413 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12414 d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" |
|
12415 })); |
|
12416 /* harmony default export */ var library_list = (list); |
|
12417 |
|
12418 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js |
|
12419 |
|
12420 |
|
12421 /** |
|
12422 * WordPress dependencies |
|
12423 */ |
|
12424 |
|
12425 const category = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12426 viewBox: "0 0 24 24", |
|
12427 xmlns: "http://www.w3.org/2000/svg" |
|
12428 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12429 d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", |
|
12430 fillRule: "evenodd", |
|
12431 clipRule: "evenodd" |
|
12432 })); |
|
12433 /* harmony default export */ var library_category = (category); |
|
12434 |
|
12435 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js |
|
12436 |
|
12437 |
|
12438 /** |
|
12439 * WordPress dependencies |
|
12440 */ |
|
12441 |
|
12442 const postAuthor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12443 viewBox: "0 0 24 24", |
|
12444 xmlns: "http://www.w3.org/2000/svg" |
|
12445 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12446 d: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z", |
|
12447 fillRule: "evenodd", |
|
12448 clipRule: "evenodd" |
|
12449 })); |
|
12450 /* harmony default export */ var post_author = (postAuthor); |
|
12451 |
|
12452 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js |
|
12453 |
|
12454 |
|
12455 /** |
|
12456 * WordPress dependencies |
|
12457 */ |
|
12458 |
|
12459 const blockMeta = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12460 xmlns: "http://www.w3.org/2000/svg", |
|
12461 viewBox: "0 0 24 24" |
|
12462 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12463 fillRule: "evenodd", |
|
12464 d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", |
|
12465 clipRule: "evenodd" |
|
12466 })); |
|
12467 /* harmony default export */ var block_meta = (blockMeta); |
|
12468 |
|
12469 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-date.js |
|
12470 |
|
12471 |
|
12472 /** |
|
12473 * WordPress dependencies |
|
12474 */ |
|
12475 |
|
12476 const postDate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12477 xmlns: "http://www.w3.org/2000/svg", |
|
12478 viewBox: "0 0 24 24" |
|
12479 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12480 d: "M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z" |
|
12481 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12482 d: "M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z" |
|
12483 })); |
|
12484 /* harmony default export */ var post_date = (postDate); |
|
12485 |
|
12486 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js |
|
12487 |
|
12488 |
|
12489 /** |
|
12490 * WordPress dependencies |
|
12491 */ |
|
12492 |
|
12493 const tag = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12494 xmlns: "http://www.w3.org/2000/svg", |
|
12495 viewBox: "0 0 24 24" |
|
12496 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12497 d: "M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z" |
|
12498 })); |
|
12499 /* harmony default export */ var library_tag = (tag); |
|
12500 |
|
12501 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js |
|
12502 |
|
12503 |
|
12504 /** |
|
12505 * WordPress dependencies |
|
12506 */ |
|
12507 |
|
12508 const media = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
12509 xmlns: "http://www.w3.org/2000/svg", |
|
12510 viewBox: "0 0 24 24" |
|
12511 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
12512 d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" |
|
12513 })); |
|
12514 /* harmony default export */ var library_media = (media); |
|
12515 |
|
12516 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template.js |
|
12517 |
|
12518 |
|
12519 /** |
|
12520 * External dependencies |
|
12521 */ |
|
12522 |
|
12523 /** |
|
12524 * WordPress dependencies |
|
12525 */ |
|
12526 |
|
12527 |
|
12528 |
|
12529 |
|
12530 |
|
12531 |
|
12532 |
|
12533 |
|
12534 /** |
|
12535 * Internal dependencies |
|
12536 */ |
|
12537 |
|
12538 |
|
12539 |
|
12540 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404']; |
|
12541 const TEMPLATE_ICONS = { |
|
12542 'front-page': library_home, |
|
12543 'single-post': library_post, |
|
12544 page: library_page, |
|
12545 archive: library_archive, |
|
12546 search: library_search, |
|
12547 404: not_found, |
|
12548 index: library_list, |
|
12549 category: library_category, |
|
12550 author: post_author, |
|
12551 taxonomy: block_meta, |
|
12552 date: post_date, |
|
12553 tag: library_tag, |
|
12554 attachment: library_media |
|
12555 }; |
|
12556 function NewTemplate(_ref) { |
|
12557 let { |
|
12558 postType |
|
12559 } = _ref; |
|
12560 const history = useHistory(); |
|
12561 const { |
|
12562 templates, |
|
12563 defaultTemplateTypes |
|
12564 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
12565 templates: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { |
|
12566 per_page: -1 |
|
12567 }), |
|
12568 defaultTemplateTypes: select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes() |
|
12569 }), []); |
|
12570 const { |
|
12571 saveEntityRecord |
|
12572 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
12573 const { |
|
12574 createErrorNotice |
|
12575 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
12576 const { |
|
12577 setTemplate |
|
12578 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
12579 |
|
12580 async function createTemplate(_ref2) { |
|
12581 let { |
|
12582 slug |
|
12583 } = _ref2; |
|
12584 |
|
12585 try { |
|
12586 const { |
|
12587 title, |
|
12588 description |
|
12589 } = (0,external_lodash_namespaceObject.find)(defaultTemplateTypes, { |
|
12590 slug |
|
12591 }); |
|
12592 const template = await saveEntityRecord('postType', 'wp_template', { |
|
12593 excerpt: description, |
|
12594 // Slugs need to be strings, so this is for template `404` |
|
12595 slug: slug.toString(), |
|
12596 status: 'publish', |
|
12597 title |
|
12598 }, { |
|
12599 throwOnError: true |
|
12600 }); // Set template before navigating away to avoid initial stale value. |
|
12601 |
|
12602 setTemplate(template.id, template.slug); // Navigate to the created template editor. |
|
12603 |
|
12604 history.push({ |
|
12605 postId: template.id, |
|
12606 postType: template.type |
|
12607 }); // TODO: Add a success notice? |
|
12608 } catch (error) { |
|
12609 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); |
|
12610 createErrorNotice(errorMessage, { |
|
12611 type: 'snackbar' |
|
12612 }); |
|
12613 } |
|
12614 } |
|
12615 |
|
12616 const existingTemplateSlugs = (0,external_lodash_namespaceObject.map)(templates, 'slug'); |
|
12617 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)); |
|
12618 |
|
12619 if (!missingTemplates.length) { |
|
12620 return null; |
|
12621 } // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. |
|
12622 |
|
12623 |
|
12624 missingTemplates.sort((template1, template2) => { |
|
12625 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); |
|
12626 }); |
|
12627 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
|
12628 className: "edit-site-new-template-dropdown", |
|
12629 icon: null, |
|
12630 text: postType.labels.add_new, |
|
12631 label: postType.labels.add_new_item, |
|
12632 popoverProps: { |
|
12633 noArrow: false |
|
12634 }, |
|
12635 toggleProps: { |
|
12636 variant: 'primary' |
|
12637 } |
|
12638 }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, { |
|
12639 className: "edit-site-new-template-dropdown__popover" |
|
12640 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
12641 label: postType.labels.add_new_item |
|
12642 }, (0,external_lodash_namespaceObject.map)(missingTemplates, _ref3 => { |
|
12643 let { |
|
12644 title, |
|
12645 description, |
|
12646 slug |
|
12647 } = _ref3; |
|
12648 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
12649 icon: TEMPLATE_ICONS[slug], |
|
12650 iconPosition: "left", |
|
12651 info: description, |
|
12652 key: slug, |
|
12653 onClick: () => { |
|
12654 createTemplate({ |
|
12655 slug |
|
12656 }); // We will be navigated way so no need to close the dropdown. |
|
12657 } |
|
12658 }, title); |
|
12659 })))); |
|
12660 } |
|
12661 |
|
12662 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template-part.js |
|
12663 |
|
12664 |
|
12665 /** |
|
12666 * External dependencies |
|
12667 */ |
|
12668 |
|
12669 /** |
|
12670 * WordPress dependencies |
|
12671 */ |
|
12672 |
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 |
|
12678 |
|
12679 /** |
|
12680 * Internal dependencies |
|
12681 */ |
|
12682 |
|
12683 |
|
12684 |
|
12685 function NewTemplatePart(_ref) { |
|
12686 let { |
|
12687 postType |
|
12688 } = _ref; |
|
12689 const history = useHistory(); |
|
12690 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
12691 const { |
|
12692 createErrorNotice |
|
12693 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
12694 const { |
|
12695 saveEntityRecord |
|
12696 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
12697 |
|
12698 async function createTemplatePart(_ref2) { |
|
12699 let { |
|
12700 title, |
|
12701 area |
|
12702 } = _ref2; |
|
12703 |
|
12704 if (!title) { |
|
12705 createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Title is not defined.'), { |
|
12706 type: 'snackbar' |
|
12707 }); |
|
12708 return; |
|
12709 } |
|
12710 |
|
12711 try { |
|
12712 // Currently template parts only allow latin chars. |
|
12713 // Fallback slug will receive suffix by default. |
|
12714 const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; |
|
12715 const templatePart = await saveEntityRecord('postType', 'wp_template_part', { |
|
12716 slug: cleanSlug, |
|
12717 title, |
|
12718 content: '', |
|
12719 area |
|
12720 }, { |
|
12721 throwOnError: true |
|
12722 }); |
|
12723 setIsModalOpen(false); // Navigate to the created template part editor. |
|
12724 |
|
12725 history.push({ |
|
12726 postId: templatePart.id, |
|
12727 postType: templatePart.type |
|
12728 }); // TODO: Add a success notice? |
|
12729 } catch (error) { |
|
12730 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); |
|
12731 createErrorNotice(errorMessage, { |
|
12732 type: 'snackbar' |
|
12733 }); |
|
12734 setIsModalOpen(false); |
|
12735 } |
|
12736 } |
|
12737 |
|
12738 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
12739 variant: "primary", |
|
12740 onClick: () => { |
|
12741 setIsModalOpen(true); |
|
12742 } |
|
12743 }, postType.labels.add_new), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, { |
|
12744 closeModal: () => setIsModalOpen(false), |
|
12745 onCreate: createTemplatePart |
|
12746 })); |
|
12747 } |
|
12748 |
|
12749 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js |
|
12750 |
|
12751 |
|
12752 /** |
|
12753 * WordPress dependencies |
|
12754 */ |
|
12755 |
|
12756 |
|
12757 /** |
|
12758 * Internal dependencies |
|
12759 */ |
|
12760 |
|
12761 |
|
12762 |
|
12763 function AddNewTemplate(_ref) { |
|
12764 let { |
|
12765 templateType = 'wp_template' |
|
12766 } = _ref; |
|
12767 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
|
12768 |
|
12769 if (!postType) { |
|
12770 return null; |
|
12771 } |
|
12772 |
|
12773 if (templateType === 'wp_template') { |
|
12774 return (0,external_wp_element_namespaceObject.createElement)(NewTemplate, { |
|
12775 postType: postType |
|
12776 }); |
|
12777 } else if (templateType === 'wp_template_part') { |
|
12778 return (0,external_wp_element_namespaceObject.createElement)(NewTemplatePart, { |
|
12779 postType: postType |
|
12780 }); |
|
12781 } |
|
12782 |
|
12783 return null; |
|
12784 } |
|
12785 |
|
12786 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/header.js |
|
12787 |
|
12788 |
|
12789 /** |
|
12790 * WordPress dependencies |
|
12791 */ |
|
12792 |
|
12793 |
|
12794 |
|
12795 /** |
|
12796 * Internal dependencies |
|
12797 */ |
|
12798 |
|
12799 |
|
12800 function header_Header(_ref) { |
|
12801 var _postType$labels; |
|
12802 |
|
12803 let { |
|
12804 templateType |
|
12805 } = _ref; |
|
12806 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
|
12807 |
|
12808 if (!postType) { |
|
12809 return null; |
|
12810 } |
|
12811 |
|
12812 return (0,external_wp_element_namespaceObject.createElement)("header", { |
|
12813 className: "edit-site-list-header" |
|
12814 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
12815 level: 1, |
|
12816 className: "edit-site-list-header__title" |
|
12817 }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
12818 className: "edit-site-list-header__right" |
|
12819 }, (0,external_wp_element_namespaceObject.createElement)(AddNewTemplate, { |
|
12820 templateType: templateType |
|
12821 }))); |
|
12822 } |
|
12823 |
|
12824 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js |
|
12825 /** |
|
12826 * Check if a template is removable. |
|
12827 * |
|
12828 * @param {Object} template The template entity to check. |
|
12829 * @return {boolean} Whether the template is revertable. |
|
12830 */ |
|
12831 function isTemplateRemovable(template) { |
|
12832 if (!template) { |
|
12833 return false; |
|
12834 } |
|
12835 |
|
12836 return template.source === 'custom' && !template.has_theme_file; |
|
12837 } |
|
12838 |
|
12839 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/rename-menu-item.js |
|
12840 |
|
12841 |
|
12842 /** |
|
12843 * WordPress dependencies |
|
12844 */ |
|
12845 |
|
12846 |
|
12847 |
|
12848 |
|
12849 |
|
12850 |
|
12851 function RenameMenuItem(_ref) { |
|
12852 let { |
|
12853 template, |
|
12854 onClose |
|
12855 } = _ref; |
|
12856 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => template.title.rendered); |
|
12857 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
12858 const { |
|
12859 editEntityRecord, |
|
12860 saveEditedEntityRecord |
|
12861 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
12862 const { |
|
12863 createSuccessNotice, |
|
12864 createErrorNotice |
|
12865 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
12866 |
|
12867 if (!template.is_custom) { |
|
12868 return null; |
|
12869 } |
|
12870 |
|
12871 async function onTemplateRename(event) { |
|
12872 event.preventDefault(); |
|
12873 |
|
12874 try { |
|
12875 await editEntityRecord('postType', template.type, template.id, { |
|
12876 title |
|
12877 }); // Update state before saving rerenders the list. |
|
12878 |
|
12879 setTitle(''); |
|
12880 setIsModalOpen(false); |
|
12881 onClose(); // Persist edited entity. |
|
12882 |
|
12883 await saveEditedEntityRecord('postType', template.type, template.id, { |
|
12884 throwOnError: true |
|
12885 }); |
|
12886 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity renamed.'), { |
|
12887 type: 'snackbar' |
|
12888 }); |
|
12889 } catch (error) { |
|
12890 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the entity.'); |
|
12891 createErrorNotice(errorMessage, { |
|
12892 type: 'snackbar' |
|
12893 }); |
|
12894 } |
|
12895 } |
|
12896 |
|
12897 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
12898 onClick: () => { |
|
12899 setIsModalOpen(true); |
|
12900 setTitle(template.title.rendered); |
|
12901 } |
|
12902 }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
12903 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), |
|
12904 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
12905 onRequestClose: () => { |
|
12906 setIsModalOpen(false); |
|
12907 }, |
|
12908 overlayClassName: "edit-site-list__rename-modal" |
|
12909 }, (0,external_wp_element_namespaceObject.createElement)("form", { |
|
12910 onSubmit: onTemplateRename |
|
12911 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
12912 align: "flex-start", |
|
12913 gap: 8 |
|
12914 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
12915 label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
|
12916 value: title, |
|
12917 onChange: setTitle, |
|
12918 required: true |
|
12919 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
12920 className: "edit-site-list__rename-modal-actions", |
|
12921 justify: "flex-end", |
|
12922 expanded: false |
|
12923 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
12924 variant: "tertiary", |
|
12925 onClick: () => { |
|
12926 setIsModalOpen(false); |
|
12927 } |
|
12928 }, (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, { |
|
12929 variant: "primary", |
|
12930 type: "submit" |
|
12931 }, (0,external_wp_i18n_namespaceObject.__)('Save'))))))); |
|
12932 } |
|
12933 |
|
12934 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/index.js |
|
12935 |
|
12936 |
|
12937 /** |
|
12938 * WordPress dependencies |
|
12939 */ |
|
12940 |
|
12941 |
|
12942 |
|
12943 |
|
12944 |
|
12945 |
|
12946 /** |
|
12947 * Internal dependencies |
|
12948 */ |
|
12949 |
|
12950 |
|
12951 |
|
12952 |
|
12953 |
|
12954 function Actions(_ref) { |
|
12955 let { |
|
12956 template |
|
12957 } = _ref; |
|
12958 const { |
|
12959 removeTemplate, |
|
12960 revertTemplate |
|
12961 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
12962 const { |
|
12963 saveEditedEntityRecord |
|
12964 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
12965 const { |
|
12966 createSuccessNotice, |
|
12967 createErrorNotice |
|
12968 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
12969 const isRemovable = isTemplateRemovable(template); |
|
12970 const isRevertable = isTemplateRevertable(template); |
|
12971 |
|
12972 if (!isRemovable && !isRevertable) { |
|
12973 return null; |
|
12974 } |
|
12975 |
|
12976 async function revertAndSaveTemplate() { |
|
12977 try { |
|
12978 await revertTemplate(template, { |
|
12979 allowUndo: false |
|
12980 }); |
|
12981 await saveEditedEntityRecord('postType', template.type, template.id); |
|
12982 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity reverted.'), { |
|
12983 type: 'snackbar' |
|
12984 }); |
|
12985 } catch (error) { |
|
12986 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the entity.'); |
|
12987 createErrorNotice(errorMessage, { |
|
12988 type: 'snackbar' |
|
12989 }); |
|
12990 } |
|
12991 } |
|
12992 |
|
12993 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
|
12994 icon: more_vertical, |
|
12995 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), |
|
12996 className: "edit-site-list-table__actions" |
|
12997 }, _ref2 => { |
|
12998 let { |
|
12999 onClose |
|
13000 } = _ref2; |
|
13001 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, { |
|
13002 template: template, |
|
13003 onClose: onClose |
|
13004 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
13005 isDestructive: true, |
|
13006 isTertiary: true, |
|
13007 onClick: () => { |
|
13008 removeTemplate(template); |
|
13009 onClose(); |
|
13010 } |
|
13011 }, (0,external_wp_i18n_namespaceObject.__)('Delete'))), isRevertable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
13012 info: (0,external_wp_i18n_namespaceObject.__)('Restore to default state'), |
|
13013 onClick: () => { |
|
13014 revertAndSaveTemplate(); |
|
13015 onClose(); |
|
13016 } |
|
13017 }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))); |
|
13018 }); |
|
13019 } |
|
13020 |
|
13021 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js |
|
13022 |
|
13023 |
|
13024 /** |
|
13025 * WordPress dependencies |
|
13026 */ |
|
13027 |
|
13028 const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
13029 xmlns: "http://www.w3.org/2000/svg", |
|
13030 viewBox: "0 0 24 24" |
|
13031 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
13032 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" |
|
13033 })); |
|
13034 /* harmony default export */ var library_plugins = (plugins); |
|
13035 |
|
13036 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js |
|
13037 |
|
13038 |
|
13039 /** |
|
13040 * WordPress dependencies |
|
13041 */ |
|
13042 |
|
13043 const commentAuthorAvatar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
13044 xmlns: "http://www.w3.org/2000/svg", |
|
13045 viewBox: "0 0 24 24" |
|
13046 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
13047 fillRule: "evenodd", |
|
13048 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", |
|
13049 clipRule: "evenodd" |
|
13050 })); |
|
13051 /* harmony default export */ var comment_author_avatar = (commentAuthorAvatar); |
|
13052 |
|
13053 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js |
|
13054 |
|
13055 |
|
13056 /** |
|
13057 * WordPress dependencies |
|
13058 */ |
|
13059 |
|
13060 const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
13061 xmlns: "http://www.w3.org/2000/svg", |
|
13062 viewBox: "0 0 24 24" |
|
13063 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
13064 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" |
|
13065 })); |
|
13066 /* harmony default export */ var library_globe = (globe); |
|
13067 |
|
13068 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/added-by.js |
|
13069 |
|
13070 |
|
13071 /** |
|
13072 * External dependencies |
|
13073 */ |
|
13074 |
|
13075 /** |
|
13076 * WordPress dependencies |
|
13077 */ |
|
13078 |
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 |
|
13084 |
|
13085 const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part']; |
|
13086 |
|
13087 function CustomizedTooltip(_ref) { |
|
13088 let { |
|
13089 isCustomized, |
|
13090 children |
|
13091 } = _ref; |
|
13092 |
|
13093 if (!isCustomized) { |
|
13094 return children; |
|
13095 } |
|
13096 |
|
13097 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, { |
|
13098 text: (0,external_wp_i18n_namespaceObject.__)('This template has been customized') |
|
13099 }, children); |
|
13100 } |
|
13101 |
|
13102 function BaseAddedBy(_ref2) { |
|
13103 let { |
|
13104 text, |
|
13105 icon, |
|
13106 imageUrl, |
|
13107 isCustomized |
|
13108 } = _ref2; |
|
13109 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); |
|
13110 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
13111 alignment: "left" |
|
13112 }, (0,external_wp_element_namespaceObject.createElement)(CustomizedTooltip, { |
|
13113 isCustomized: isCustomized |
|
13114 }, imageUrl ? (0,external_wp_element_namespaceObject.createElement)("div", { |
|
13115 className: classnames_default()('edit-site-list-added-by__avatar', { |
|
13116 'is-loaded': isImageLoaded |
|
13117 }) |
|
13118 }, (0,external_wp_element_namespaceObject.createElement)("img", { |
|
13119 onLoad: () => setIsImageLoaded(true), |
|
13120 alt: "", |
|
13121 src: imageUrl |
|
13122 })) : (0,external_wp_element_namespaceObject.createElement)("div", { |
|
13123 className: classnames_default()('edit-site-list-added-by__icon', { |
|
13124 'is-customized': isCustomized |
|
13125 }) |
|
13126 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
13127 icon: icon |
|
13128 }))), (0,external_wp_element_namespaceObject.createElement)("span", null, text)); |
|
13129 } |
|
13130 |
|
13131 function AddedByTheme(_ref3) { |
|
13132 var _theme$name; |
|
13133 |
|
13134 let { |
|
13135 slug, |
|
13136 isCustomized |
|
13137 } = _ref3; |
|
13138 const theme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTheme(slug), [slug]); |
|
13139 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
|
13140 icon: library_layout, |
|
13141 text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug, |
|
13142 isCustomized: isCustomized |
|
13143 }); |
|
13144 } |
|
13145 |
|
13146 function AddedByPlugin(_ref4) { |
|
13147 let { |
|
13148 slug, |
|
13149 isCustomized |
|
13150 } = _ref4; |
|
13151 const plugin = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPlugin(slug), [slug]); |
|
13152 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
|
13153 icon: library_plugins, |
|
13154 text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug, |
|
13155 isCustomized: isCustomized |
|
13156 }); |
|
13157 } |
|
13158 |
|
13159 function AddedByAuthor(_ref5) { |
|
13160 var _user$avatar_urls; |
|
13161 |
|
13162 let { |
|
13163 id |
|
13164 } = _ref5; |
|
13165 const user = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getUser(id), [id]); |
|
13166 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
|
13167 icon: comment_author_avatar, |
|
13168 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], |
|
13169 text: user === null || user === void 0 ? void 0 : user.nickname |
|
13170 }); |
|
13171 } |
|
13172 |
|
13173 function AddedBySite() { |
|
13174 const { |
|
13175 name, |
|
13176 logoURL |
|
13177 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
13178 var _getMedia; |
|
13179 |
|
13180 const { |
|
13181 getEntityRecord, |
|
13182 getMedia |
|
13183 } = select(external_wp_coreData_namespaceObject.store); |
|
13184 const siteData = getEntityRecord('root', '__unstableBase'); |
|
13185 return { |
|
13186 name: siteData === null || siteData === void 0 ? void 0 : siteData.name, |
|
13187 logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined |
|
13188 }; |
|
13189 }, []); |
|
13190 return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, { |
|
13191 icon: library_globe, |
|
13192 imageUrl: logoURL, |
|
13193 text: name |
|
13194 }); |
|
13195 } |
|
13196 |
|
13197 function AddedBy(_ref6) { |
|
13198 let { |
|
13199 templateType, |
|
13200 template |
|
13201 } = _ref6; |
|
13202 |
|
13203 if (!template) { |
|
13204 return; |
|
13205 } |
|
13206 |
|
13207 if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) { |
|
13208 // Template originally provided by a theme, but customized by a user. |
|
13209 // Templates originally didn't have the 'origin' field so identify |
|
13210 // older customized templates by checking for no origin and a 'theme' |
|
13211 // or 'custom' source. |
|
13212 if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) { |
|
13213 return (0,external_wp_element_namespaceObject.createElement)(AddedByTheme, { |
|
13214 slug: template.theme, |
|
13215 isCustomized: template.source === 'custom' |
|
13216 }); |
|
13217 } // Template originally provided by a plugin, but customized by a user. |
|
13218 |
|
13219 |
|
13220 if (template.has_theme_file && template.origin === 'plugin') { |
|
13221 return (0,external_wp_element_namespaceObject.createElement)(AddedByPlugin, { |
|
13222 slug: template.theme, |
|
13223 isCustomized: template.source === 'custom' |
|
13224 }); |
|
13225 } // Template was created from scratch, but has no author. Author support |
|
13226 // was only added to templates in WordPress 5.9. Fallback to showing the |
|
13227 // site logo and title. |
|
13228 |
|
13229 |
|
13230 if (!template.has_theme_file && template.source === 'custom' && !template.author) { |
|
13231 return (0,external_wp_element_namespaceObject.createElement)(AddedBySite, null); |
|
13232 } |
|
13233 } // Simply show the author for templates created from scratch that have an |
|
13234 // author or for any other post type. |
|
13235 |
|
13236 |
|
13237 return (0,external_wp_element_namespaceObject.createElement)(AddedByAuthor, { |
|
13238 id: template.author |
|
13239 }); |
|
13240 } |
|
13241 |
|
13242 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/table.js |
|
13243 |
|
13244 |
|
13245 /** |
|
13246 * WordPress dependencies |
|
13247 */ |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 /** |
|
13254 * Internal dependencies |
|
13255 */ |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 function Table(_ref) { |
|
13261 let { |
|
13262 templateType |
|
13263 } = _ref; |
|
13264 const { |
|
13265 records: templates, |
|
13266 isResolving: isLoading |
|
13267 } = (0,external_wp_coreData_namespaceObject.__experimentalUseEntityRecords)('postType', templateType, { |
|
13268 per_page: -1 |
|
13269 }); |
|
13270 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
|
13271 |
|
13272 if (!templates || isLoading) { |
|
13273 return null; |
|
13274 } |
|
13275 |
|
13276 if (!templates.length) { |
|
13277 var _postType$labels, _postType$labels$name; |
|
13278 |
|
13279 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". |
|
13280 (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())); |
|
13281 } |
|
13282 |
|
13283 return (// These explicit aria roles are needed for Safari. |
|
13284 // See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables |
|
13285 (0,external_wp_element_namespaceObject.createElement)("table", { |
|
13286 className: "edit-site-list-table", |
|
13287 role: "table" |
|
13288 }, (0,external_wp_element_namespaceObject.createElement)("thead", null, (0,external_wp_element_namespaceObject.createElement)("tr", { |
|
13289 className: "edit-site-list-table-head", |
|
13290 role: "row" |
|
13291 }, (0,external_wp_element_namespaceObject.createElement)("th", { |
|
13292 className: "edit-site-list-table-column", |
|
13293 role: "columnheader" |
|
13294 }, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)("th", { |
|
13295 className: "edit-site-list-table-column", |
|
13296 role: "columnheader" |
|
13297 }, (0,external_wp_i18n_namespaceObject.__)('Added by')), (0,external_wp_element_namespaceObject.createElement)("th", { |
|
13298 className: "edit-site-list-table-column", |
|
13299 role: "columnheader" |
|
13300 }, (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 => { |
|
13301 var _template$title; |
|
13302 |
|
13303 return (0,external_wp_element_namespaceObject.createElement)("tr", { |
|
13304 key: template.id, |
|
13305 className: "edit-site-list-table-row", |
|
13306 role: "row" |
|
13307 }, (0,external_wp_element_namespaceObject.createElement)("td", { |
|
13308 className: "edit-site-list-table-column", |
|
13309 role: "cell" |
|
13310 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
13311 level: 4 |
|
13312 }, (0,external_wp_element_namespaceObject.createElement)(Link, { |
|
13313 params: { |
|
13314 postId: template.id, |
|
13315 postType: template.type |
|
13316 } |
|
13317 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug))), template.description), (0,external_wp_element_namespaceObject.createElement)("td", { |
|
13318 className: "edit-site-list-table-column", |
|
13319 role: "cell" |
|
13320 }, (0,external_wp_element_namespaceObject.createElement)(AddedBy, { |
|
13321 templateType: templateType, |
|
13322 template: template |
|
13323 })), (0,external_wp_element_namespaceObject.createElement)("td", { |
|
13324 className: "edit-site-list-table-column", |
|
13325 role: "cell" |
|
13326 }, (0,external_wp_element_namespaceObject.createElement)(Actions, { |
|
13327 template: template |
|
13328 }))); |
|
13329 }))) |
|
13330 ); |
|
13331 } |
|
13332 |
|
13333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/index.js |
|
13334 |
|
13335 |
|
13336 /** |
|
13337 * External dependencies |
|
13338 */ |
|
13339 |
|
13340 /** |
|
13341 * WordPress dependencies |
|
13342 */ |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 /** |
|
13351 * Internal dependencies |
|
13352 */ |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 function List() { |
|
13362 var _postType$labels, _postType$labels2; |
|
13363 |
|
13364 const { |
|
13365 params: { |
|
13366 postType: templateType |
|
13367 } |
|
13368 } = useLocation(); |
|
13369 useRegisterShortcuts(); |
|
13370 const { |
|
13371 previousShortcut, |
|
13372 nextShortcut, |
|
13373 isNavigationOpen |
|
13374 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
13375 return { |
|
13376 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'), |
|
13377 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'), |
|
13378 isNavigationOpen: select(store_store).isNavigationOpened() |
|
13379 }; |
|
13380 }, []); |
|
13381 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]); |
|
13382 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 |
|
13383 // the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults. |
|
13384 |
|
13385 const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list; |
|
13386 const detailedRegionLabels = postType ? { |
|
13387 header: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page. |
|
13388 (0,external_wp_i18n_namespaceObject.__)('%s - Header'), itemsListLabel), |
|
13389 body: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Content' as in the content area of that page. |
|
13390 (0,external_wp_i18n_namespaceObject.__)('%s - Content'), itemsListLabel) |
|
13391 } : undefined; |
|
13392 return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { |
|
13393 className: classnames_default()('edit-site-list', { |
|
13394 'is-navigation-open': isNavigationOpen |
|
13395 }), |
|
13396 labels: { |
|
13397 drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar'), |
|
13398 ...detailedRegionLabels |
|
13399 }, |
|
13400 header: (0,external_wp_element_namespaceObject.createElement)(header_Header, { |
|
13401 templateType: templateType |
|
13402 }), |
|
13403 drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null), |
|
13404 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), |
|
13405 content: (0,external_wp_element_namespaceObject.createElement)(Table, { |
|
13406 templateType: templateType |
|
13407 }), |
|
13408 shortcuts: { |
|
13409 previous: previousShortcut, |
|
13410 next: nextShortcut |
|
13411 } |
|
13412 }); |
|
13413 } |
|
13414 |
|
13415 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-is-list-page.js |
|
13416 /** |
|
13417 * Returns if the params match the list page route. |
|
13418 * |
|
13419 * @param {Object} params The search params. |
|
13420 * @param {string} params.postId The post ID. |
|
13421 * @param {string} params.postType The post type. |
|
13422 * @return {boolean} Is list page or not. |
|
13423 */ |
|
13424 function getIsListPage(_ref) { |
|
13425 let { |
|
13426 postId, |
|
13427 postType |
|
13428 } = _ref; |
|
13429 return !!(!postId && postType); |
|
13430 } |
|
13431 |
|
13432 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js |
|
13433 |
|
13434 |
|
13435 /** |
|
13436 * WordPress dependencies |
|
13437 */ |
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 /** |
|
13445 * Internal dependencies |
|
13446 */ |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 function EditSiteApp(_ref) { |
|
13454 let { |
|
13455 reboot |
|
13456 } = _ref; |
|
13457 const { |
|
13458 createErrorNotice |
|
13459 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
13460 |
|
13461 function onPluginAreaError(name) { |
|
13462 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
|
13463 /* translators: %s: plugin name */ |
|
13464 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); |
|
13465 } |
|
13466 |
|
13467 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 => { |
|
13468 let { |
|
13469 params |
|
13470 } = _ref2; |
|
13471 const isListPage = getIsListPage(params); |
|
13472 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, { |
|
13473 onError: reboot |
|
13474 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { |
|
13475 onError: onPluginAreaError |
|
13476 }), (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar // Open the navigation sidebar by default when in the list page. |
|
13477 , { |
|
13478 isDefaultOpen: !!isListPage, |
|
13479 activeTemplateType: isListPage ? params.postType : undefined |
|
13480 })); |
|
13481 })); |
|
13482 } |
|
13483 |
|
13484 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/plugin-sidebar/index.js |
|
13485 |
|
13486 |
|
13487 |
|
13488 /** |
|
13489 * WordPress dependencies |
|
13490 */ |
|
13491 |
|
13492 /** |
|
13493 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. |
|
13494 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. |
|
13495 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: |
|
13496 * |
|
13497 * ```js |
|
13498 * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); |
|
13499 * ``` |
|
13500 * |
|
13501 * @see PluginSidebarMoreMenuItem |
|
13502 * |
|
13503 * @param {Object} props Element props. |
|
13504 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. |
|
13505 * @param {string} [props.className] An optional class name added to the sidebar body. |
|
13506 * @param {string} props.title Title displayed at the top of the sidebar. |
|
13507 * @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. |
|
13508 * @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. |
|
13509 * |
|
13510 * @example |
|
13511 * ```js |
|
13512 * // Using ES5 syntax |
|
13513 * var __ = wp.i18n.__; |
|
13514 * var el = wp.element.createElement; |
|
13515 * var PanelBody = wp.components.PanelBody; |
|
13516 * var PluginSidebar = wp.editSite.PluginSidebar; |
|
13517 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
13518 * |
|
13519 * function MyPluginSidebar() { |
|
13520 * return el( |
|
13521 * PluginSidebar, |
|
13522 * { |
|
13523 * name: 'my-sidebar', |
|
13524 * title: 'My sidebar title', |
|
13525 * icon: moreIcon, |
|
13526 * }, |
|
13527 * el( |
|
13528 * PanelBody, |
|
13529 * {}, |
|
13530 * __( 'My sidebar content' ) |
|
13531 * ) |
|
13532 * ); |
|
13533 * } |
|
13534 * ``` |
|
13535 * |
|
13536 * @example |
|
13537 * ```jsx |
|
13538 * // Using ESNext syntax |
|
13539 * import { __ } from '@wordpress/i18n'; |
|
13540 * import { PanelBody } from '@wordpress/components'; |
|
13541 * import { PluginSidebar } from '@wordpress/edit-site'; |
|
13542 * import { more } from '@wordpress/icons'; |
|
13543 * |
|
13544 * const MyPluginSidebar = () => ( |
|
13545 * <PluginSidebar |
|
13546 * name="my-sidebar" |
|
13547 * title="My sidebar title" |
|
13548 * icon={ more } |
|
13549 * > |
|
13550 * <PanelBody> |
|
13551 * { __( 'My sidebar content' ) } |
|
13552 * </PanelBody> |
|
13553 * </PluginSidebar> |
|
13554 * ); |
|
13555 * ``` |
|
13556 */ |
|
13557 |
|
13558 function PluginSidebarEditSite(_ref) { |
|
13559 let { |
|
13560 className, |
|
13561 ...props |
|
13562 } = _ref; |
|
13563 return (0,external_wp_element_namespaceObject.createElement)(complementary_area, extends_extends({ |
|
13564 panelClassName: className, |
|
13565 className: "edit-site-sidebar", |
|
13566 scope: "core/edit-site" |
|
13567 }, props)); |
|
13568 } |
|
13569 |
|
13570 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-sidebar-more-menu-item/index.js |
|
13571 |
|
13572 |
|
13573 |
|
13574 /** |
|
13575 * WordPress dependencies |
|
13576 */ |
|
13577 |
|
13578 /** |
|
13579 * Renders a menu item in `Plugins` group in `More Menu` drop down, |
|
13580 * and can be used to activate the corresponding `PluginSidebar` component. |
|
13581 * The text within the component appears as the menu item label. |
|
13582 * |
|
13583 * @param {Object} props Component props. |
|
13584 * @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. |
|
13585 * @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. |
|
13586 * |
|
13587 * @example |
|
13588 * ```js |
|
13589 * // Using ES5 syntax |
|
13590 * var __ = wp.i18n.__; |
|
13591 * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem; |
|
13592 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
13593 * |
|
13594 * function MySidebarMoreMenuItem() { |
|
13595 * return wp.element.createElement( |
|
13596 * PluginSidebarMoreMenuItem, |
|
13597 * { |
|
13598 * target: 'my-sidebar', |
|
13599 * icon: moreIcon, |
|
13600 * }, |
|
13601 * __( 'My sidebar title' ) |
|
13602 * ) |
|
13603 * } |
|
13604 * ``` |
|
13605 * |
|
13606 * @example |
|
13607 * ```jsx |
|
13608 * // Using ESNext syntax |
|
13609 * import { __ } from '@wordpress/i18n'; |
|
13610 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site'; |
|
13611 * import { more } from '@wordpress/icons'; |
|
13612 * |
|
13613 * const MySidebarMoreMenuItem = () => ( |
|
13614 * <PluginSidebarMoreMenuItem |
|
13615 * target="my-sidebar" |
|
13616 * icon={ more } |
|
13617 * > |
|
13618 * { __( 'My sidebar title' ) } |
|
13619 * </PluginSidebarMoreMenuItem> |
|
13620 * ); |
|
13621 * ``` |
|
13622 * |
|
13623 * @return {WPComponent} The component to be rendered. |
|
13624 */ |
|
13625 |
|
13626 function PluginSidebarMoreMenuItem(props) { |
|
13627 return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. |
|
13628 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
13629 , extends_extends({ |
|
13630 __unstableExplicitMenuItem: true, |
|
13631 scope: "core/edit-site" |
|
13632 }, props)); |
|
13633 } |
|
13634 |
|
13635 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-more-menu-item/index.js |
|
13636 /** |
|
13637 * WordPress dependencies |
|
13638 */ |
|
13639 |
|
13640 |
|
13641 |
|
13642 |
|
13643 /** |
|
13644 * 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. |
|
13645 * The text within the component appears as the menu item label. |
|
13646 * |
|
13647 * @param {Object} props Component properties. |
|
13648 * @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. |
|
13649 * @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. |
|
13650 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. |
|
13651 * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. |
|
13652 * |
|
13653 * @example |
|
13654 * ```js |
|
13655 * // Using ES5 syntax |
|
13656 * var __ = wp.i18n.__; |
|
13657 * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem; |
|
13658 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
13659 * |
|
13660 * function onButtonClick() { |
|
13661 * alert( 'Button clicked.' ); |
|
13662 * } |
|
13663 * |
|
13664 * function MyButtonMoreMenuItem() { |
|
13665 * return wp.element.createElement( |
|
13666 * PluginMoreMenuItem, |
|
13667 * { |
|
13668 * icon: moreIcon, |
|
13669 * onClick: onButtonClick, |
|
13670 * }, |
|
13671 * __( 'My button title' ) |
|
13672 * ); |
|
13673 * } |
|
13674 * ``` |
|
13675 * |
|
13676 * @example |
|
13677 * ```jsx |
|
13678 * // Using ESNext syntax |
|
13679 * import { __ } from '@wordpress/i18n'; |
|
13680 * import { PluginMoreMenuItem } from '@wordpress/edit-site'; |
|
13681 * import { more } from '@wordpress/icons'; |
|
13682 * |
|
13683 * function onButtonClick() { |
|
13684 * alert( 'Button clicked.' ); |
|
13685 * } |
|
13686 * |
|
13687 * const MyButtonMoreMenuItem = () => ( |
|
13688 * <PluginMoreMenuItem |
|
13689 * icon={ more } |
|
13690 * onClick={ onButtonClick } |
|
13691 * > |
|
13692 * { __( 'My button title' ) } |
|
13693 * </PluginMoreMenuItem> |
|
13694 * ); |
|
13695 * ``` |
|
13696 * |
|
13697 * @return {WPComponent} The component to be rendered. |
|
13698 */ |
|
13699 |
|
13700 /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
13701 var _ownProps$as; |
|
13702 |
|
13703 return { |
|
13704 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, |
|
13705 icon: ownProps.icon || context.icon, |
|
13706 name: 'core/edit-site/plugin-more-menu' |
|
13707 }; |
|
13708 }))(action_item)); |
|
13709 |
|
13710 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js |
|
13711 |
|
13712 |
|
13713 /** |
|
13714 * WordPress dependencies |
|
13715 */ |
|
13716 |
|
13717 |
|
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 |
|
13723 |
|
13724 |
|
13725 |
|
13726 /** |
|
13727 * Internal dependencies |
|
13728 */ |
|
13729 |
|
13730 |
|
13731 |
|
13732 |
|
13733 |
|
13734 |
|
13735 /** |
|
13736 * Reinitializes the editor after the user chooses to reboot the editor after |
|
13737 * an unhandled error occurs, replacing previously mounted editor element using |
|
13738 * an initial state from prior to the crash. |
|
13739 * |
|
13740 * @param {Element} target DOM node in which editor is rendered. |
|
13741 * @param {?Object} settings Editor settings object. |
|
13742 */ |
|
13743 |
|
13744 function reinitializeEditor(target, settings) { |
|
13745 // Display warning if editor wasn't able to resolve homepage template. |
|
13746 if (!settings.__unstableHomeTemplate) { |
|
13747 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, { |
|
13748 message: (0,external_wp_i18n_namespaceObject.__)('The editor is unable to find a block template for the homepage.'), |
|
13749 dashboardLink: "index.php" |
|
13750 }), target); |
|
13751 return; |
|
13752 } // This will be a no-op if the target doesn't have any React nodes. |
|
13753 |
|
13754 |
|
13755 (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target); |
|
13756 const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering |
|
13757 // so that we won't trigger unnecessary re-renders with useEffect. |
|
13758 |
|
13759 { |
|
13760 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { |
|
13761 editorMode: 'visual', |
|
13762 fixedToolbar: false, |
|
13763 focusMode: false, |
|
13764 keepCaretInsideBlock: false, |
|
13765 welcomeGuide: true, |
|
13766 welcomeGuideStyles: true |
|
13767 }); |
|
13768 (0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too, |
|
13769 // so that they can be selected with core/editor selectors in any editor. |
|
13770 // This is needed because edit-site doesn't initialize with EditorProvider, |
|
13771 // which internally uses updateEditorSettings as well. |
|
13772 |
|
13773 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({ |
|
13774 defaultTemplateTypes: settings.defaultTemplateTypes, |
|
13775 defaultTemplatePartAreas: settings.defaultTemplatePartAreas |
|
13776 }); |
|
13777 const isLandingOnListPage = getIsListPage((0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href)); |
|
13778 |
|
13779 if (isLandingOnListPage) { |
|
13780 // Default the navigation panel to be opened when we're in a bigger |
|
13781 // screen and land in the list screen. |
|
13782 (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsNavigationPanelOpened((0,external_wp_data_namespaceObject.select)(external_wp_viewport_namespaceObject.store).isViewportMatch('medium')); |
|
13783 } |
|
13784 } |
|
13785 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(EditSiteApp, { |
|
13786 reboot: reboot |
|
13787 }), target); |
|
13788 } |
|
13789 /** |
|
13790 * Initializes the site editor screen. |
|
13791 * |
|
13792 * @param {string} id ID of the root element to render the screen in. |
|
13793 * @param {Object} settings Editor settings. |
|
13794 */ |
|
13795 |
|
13796 function initializeEditor(id, settings) { |
|
13797 settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); |
|
13798 |
|
13799 settings.__experimentalFetchRichUrlData = external_wp_coreData_namespaceObject.__experimentalFetchUrlData; |
|
13800 settings.__experimentalSpotlightEntityBlocks = ['core/template-part']; |
|
13801 const target = document.getElementById(id); |
|
13802 |
|
13803 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); |
|
13804 |
|
13805 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); |
|
13806 |
|
13807 if (false) {} |
|
13808 |
|
13809 reinitializeEditor(target, settings); |
|
13810 } |
|
13811 |
|
13812 |
|
13813 |
|
13814 |
|
13815 |
|
13816 |
|
13817 }(); |
|
13818 (window.wp = window.wp || {}).editSite = __webpack_exports__; |
|
13819 /******/ })() |
|
13820 ; |