summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/dist/edit-site.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wp-includes/js/dist/edit-site.js38644
1 files changed, 16782 insertions, 21862 deletions
diff --git a/wp-includes/js/dist/edit-site.js b/wp-includes/js/dist/edit-site.js
index c29d3d9..d38affa 100644
--- a/wp-includes/js/dist/edit-site.js
+++ b/wp-includes/js/dist/edit-site.js
@@ -6748,932 +6748,6 @@
/***/ }),
-/***/ 4306:
-/***/ (function(module, exports) {
-
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- autosize 4.0.4
- license: MIT
- http://www.jacklmoore.com/autosize
-*/
-(function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
-})(this, function (module, exports) {
- 'use strict';
-
- var map = typeof Map === "function" ? new Map() : function () {
- var keys = [];
- var values = [];
-
- return {
- has: function has(key) {
- return keys.indexOf(key) > -1;
- },
- get: function get(key) {
- return values[keys.indexOf(key)];
- },
- set: function set(key, value) {
- if (keys.indexOf(key) === -1) {
- keys.push(key);
- values.push(value);
- }
- },
- delete: function _delete(key) {
- var index = keys.indexOf(key);
- if (index > -1) {
- keys.splice(index, 1);
- values.splice(index, 1);
- }
- }
- };
- }();
-
- var createEvent = function createEvent(name) {
- return new Event(name, { bubbles: true });
- };
- try {
- new Event('test');
- } catch (e) {
- // IE does not support `new Event()`
- createEvent = function createEvent(name) {
- var evt = document.createEvent('Event');
- evt.initEvent(name, true, false);
- return evt;
- };
- }
-
- function assign(ta) {
- if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
-
- var heightOffset = null;
- var clientWidth = null;
- var cachedHeight = null;
-
- function init() {
- var style = window.getComputedStyle(ta, null);
-
- if (style.resize === 'vertical') {
- ta.style.resize = 'none';
- } else if (style.resize === 'both') {
- ta.style.resize = 'horizontal';
- }
-
- if (style.boxSizing === 'content-box') {
- heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
- } else {
- heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
- }
- // Fix when a textarea is not on document body and heightOffset is Not a Number
- if (isNaN(heightOffset)) {
- heightOffset = 0;
- }
-
- update();
- }
-
- function changeOverflow(value) {
- {
- // Chrome/Safari-specific fix:
- // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
- // made available by removing the scrollbar. The following forces the necessary text reflow.
- var width = ta.style.width;
- ta.style.width = '0px';
- // Force reflow:
- /* jshint ignore:start */
- ta.offsetWidth;
- /* jshint ignore:end */
- ta.style.width = width;
- }
-
- ta.style.overflowY = value;
- }
-
- function getParentOverflows(el) {
- var arr = [];
-
- while (el && el.parentNode && el.parentNode instanceof Element) {
- if (el.parentNode.scrollTop) {
- arr.push({
- node: el.parentNode,
- scrollTop: el.parentNode.scrollTop
- });
- }
- el = el.parentNode;
- }
-
- return arr;
- }
-
- function resize() {
- if (ta.scrollHeight === 0) {
- // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
- return;
- }
-
- var overflows = getParentOverflows(ta);
- var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
-
- ta.style.height = '';
- ta.style.height = ta.scrollHeight + heightOffset + 'px';
-
- // used to check if an update is actually necessary on window.resize
- clientWidth = ta.clientWidth;
-
- // prevents scroll-position jumping
- overflows.forEach(function (el) {
- el.node.scrollTop = el.scrollTop;
- });
-
- if (docTop) {
- document.documentElement.scrollTop = docTop;
- }
- }
-
- function update() {
- resize();
-
- var styleHeight = Math.round(parseFloat(ta.style.height));
- var computed = window.getComputedStyle(ta, null);
-
- // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
- var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
-
- // The actual height not matching the style height (set via the resize method) indicates that
- // the max-height has been exceeded, in which case the overflow should be allowed.
- if (actualHeight < styleHeight) {
- if (computed.overflowY === 'hidden') {
- changeOverflow('scroll');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- } else {
- // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
- if (computed.overflowY !== 'hidden') {
- changeOverflow('hidden');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- }
-
- if (cachedHeight !== actualHeight) {
- cachedHeight = actualHeight;
- var evt = createEvent('autosize:resized');
- try {
- ta.dispatchEvent(evt);
- } catch (err) {
- // Firefox will throw an error on dispatchEvent for a detached element
- // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
- }
- }
- }
-
- var pageResize = function pageResize() {
- if (ta.clientWidth !== clientWidth) {
- update();
- }
- };
-
- var destroy = function (style) {
- window.removeEventListener('resize', pageResize, false);
- ta.removeEventListener('input', update, false);
- ta.removeEventListener('keyup', update, false);
- ta.removeEventListener('autosize:destroy', destroy, false);
- ta.removeEventListener('autosize:update', update, false);
-
- Object.keys(style).forEach(function (key) {
- ta.style[key] = style[key];
- });
-
- map.delete(ta);
- }.bind(ta, {
- height: ta.style.height,
- resize: ta.style.resize,
- overflowY: ta.style.overflowY,
- overflowX: ta.style.overflowX,
- wordWrap: ta.style.wordWrap
- });
-
- ta.addEventListener('autosize:destroy', destroy, false);
-
- // IE9 does not fire onpropertychange or oninput for deletions,
- // so binding to onkeyup to catch most of those events.
- // There is no way that I know of to detect something like 'cut' in IE9.
- if ('onpropertychange' in ta && 'oninput' in ta) {
- ta.addEventListener('keyup', update, false);
- }
-
- window.addEventListener('resize', pageResize, false);
- ta.addEventListener('input', update, false);
- ta.addEventListener('autosize:update', update, false);
- ta.style.overflowX = 'hidden';
- ta.style.wordWrap = 'break-word';
-
- map.set(ta, {
- destroy: destroy,
- update: update
- });
-
- init();
- }
-
- function destroy(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.destroy();
- }
- }
-
- function update(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.update();
- }
- }
-
- var autosize = null;
-
- // Do nothing in Node.js environment and IE8 (or lower)
- if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
- autosize = function autosize(el) {
- return el;
- };
- autosize.destroy = function (el) {
- return el;
- };
- autosize.update = function (el) {
- return el;
- };
- } else {
- autosize = function autosize(el, options) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], function (x) {
- return assign(x, options);
- });
- }
- return el;
- };
- autosize.destroy = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], destroy);
- }
- return el;
- };
- autosize.update = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], update);
- }
- return el;
- };
- }
-
- exports.default = autosize;
- module.exports = exports['default'];
-});
-
-/***/ }),
-
-/***/ 5755:
-/***/ ((module, exports) => {
-
-var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
-*/
-/* global define */
-
-(function () {
- 'use strict';
-
- var hasOwn = {}.hasOwnProperty;
- var nativeCodeString = '[native code]';
-
- function classNames() {
- var classes = [];
-
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if (!arg) continue;
-
- var argType = typeof arg;
-
- if (argType === 'string' || argType === 'number') {
- classes.push(arg);
- } else if (Array.isArray(arg)) {
- if (arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- }
- } else if (argType === 'object') {
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
- classes.push(arg.toString());
- continue;
- }
-
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- }
- }
-
- return classes.join(' ');
- }
-
- if ( true && module.exports) {
- classNames.default = classNames;
- module.exports = classNames;
- } else if (true) {
- // register as 'classnames', consistent with npm package name
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return classNames;
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-}());
-
-
-/***/ }),
-
-/***/ 6109:
-/***/ ((module) => {
-
-// This code has been refactored for 140 bytes
-// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
-var computedStyle = function (el, prop, getComputedStyle) {
- getComputedStyle = window.getComputedStyle;
-
- // In one fell swoop
- return (
- // If we have getComputedStyle
- getComputedStyle ?
- // Query it
- // TODO: From CSS-Query notes, we might need (node, null) for FF
- getComputedStyle(el) :
-
- // Otherwise, we are in IE and use currentStyle
- el.currentStyle
- )[
- // Switch to camelCase for CSSOM
- // DEV: Grabbed from jQuery
- // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
- // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
- prop.replace(/-(\w)/gi, function (word, letter) {
- return letter.toUpperCase();
- })
- ];
-};
-
-module.exports = computedStyle;
-
-
-/***/ }),
-
-/***/ 66:
-/***/ ((module) => {
-
-"use strict";
-
-
-var isMergeableObject = function isMergeableObject(value) {
- return isNonNullObject(value)
- && !isSpecial(value)
-};
-
-function isNonNullObject(value) {
- return !!value && typeof value === 'object'
-}
-
-function isSpecial(value) {
- var stringValue = Object.prototype.toString.call(value);
-
- return stringValue === '[object RegExp]'
- || stringValue === '[object Date]'
- || isReactElement(value)
-}
-
-// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
-var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
-
-function isReactElement(value) {
- return value.$$typeof === REACT_ELEMENT_TYPE
-}
-
-function emptyTarget(val) {
- return Array.isArray(val) ? [] : {}
-}
-
-function cloneUnlessOtherwiseSpecified(value, options) {
- return (options.clone !== false && options.isMergeableObject(value))
- ? deepmerge(emptyTarget(value), value, options)
- : value
-}
-
-function defaultArrayMerge(target, source, options) {
- return target.concat(source).map(function(element) {
- return cloneUnlessOtherwiseSpecified(element, options)
- })
-}
-
-function getMergeFunction(key, options) {
- if (!options.customMerge) {
- return deepmerge
- }
- var customMerge = options.customMerge(key);
- return typeof customMerge === 'function' ? customMerge : deepmerge
-}
-
-function getEnumerableOwnPropertySymbols(target) {
- return Object.getOwnPropertySymbols
- ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
- return Object.propertyIsEnumerable.call(target, symbol)
- })
- : []
-}
-
-function getKeys(target) {
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
-}
-
-function propertyIsOnObject(object, property) {
- try {
- return property in object
- } catch(_) {
- return false
- }
-}
-
-// Protects from prototype poisoning and unexpected merging up the prototype chain.
-function propertyIsUnsafe(target, key) {
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
- && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
-}
-
-function mergeObject(target, source, options) {
- var destination = {};
- if (options.isMergeableObject(target)) {
- getKeys(target).forEach(function(key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
- });
- }
- getKeys(source).forEach(function(key) {
- if (propertyIsUnsafe(target, key)) {
- return
- }
-
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
- } else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
- }
- });
- return destination
-}
-
-function deepmerge(target, source, options) {
- options = options || {};
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
- // implementations can use it. The caller may not replace it.
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
-
- var sourceIsArray = Array.isArray(source);
- var targetIsArray = Array.isArray(target);
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
-
- if (!sourceAndTargetTypesMatch) {
- return cloneUnlessOtherwiseSpecified(source, options)
- } else if (sourceIsArray) {
- return options.arrayMerge(target, source, options)
- } else {
- return mergeObject(target, source, options)
- }
-}
-
-deepmerge.all = function deepmergeAll(array, options) {
- if (!Array.isArray(array)) {
- throw new Error('first argument should be an array')
- }
-
- return array.reduce(function(prev, next) {
- return deepmerge(prev, next, options)
- }, {})
-};
-
-var deepmerge_1 = deepmerge;
-
-module.exports = deepmerge_1;
-
-
-/***/ }),
-
-/***/ 461:
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-// Load in dependencies
-var computedStyle = __webpack_require__(6109);
-
-/**
- * Calculate the `line-height` of a given node
- * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
- * @returns {Number} `line-height` of the element in pixels
- */
-function lineHeight(node) {
- // Grab the line-height via style
- var lnHeightStr = computedStyle(node, 'line-height');
- var lnHeight = parseFloat(lnHeightStr, 10);
-
- // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
- if (lnHeightStr === lnHeight + '') {
- // Save the old lineHeight style and update the em unit to the element
- var _lnHeightStyle = node.style.lineHeight;
- node.style.lineHeight = lnHeightStr + 'em';
-
- // Calculate the em based height
- lnHeightStr = computedStyle(node, 'line-height');
- lnHeight = parseFloat(lnHeightStr, 10);
-
- // Revert the lineHeight style
- if (_lnHeightStyle) {
- node.style.lineHeight = _lnHeightStyle;
- } else {
- delete node.style.lineHeight;
- }
- }
-
- // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
- // DEV: `em` units are converted to `pt` in IE6
- // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
- if (lnHeightStr.indexOf('pt') !== -1) {
- lnHeight *= 4;
- lnHeight /= 3;
- // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
- } else if (lnHeightStr.indexOf('mm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 25.4;
- // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
- } else if (lnHeightStr.indexOf('cm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 2.54;
- // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
- } else if (lnHeightStr.indexOf('in') !== -1) {
- lnHeight *= 96;
- // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
- } else if (lnHeightStr.indexOf('pc') !== -1) {
- lnHeight *= 16;
- }
-
- // Continue our computation
- lnHeight = Math.round(lnHeight);
-
- // If the line-height is "normal", calculate by font-size
- if (lnHeightStr === 'normal') {
- // Create a temporary node
- var nodeName = node.nodeName;
- var _node = document.createElement(nodeName);
- _node.innerHTML = '&nbsp;';
-
- // If we have a text area, reset it to only 1 row
- // https://github.com/twolfson/line-height/issues/4
- if (nodeName.toUpperCase() === 'TEXTAREA') {
- _node.setAttribute('rows', '1');
- }
-
- // Set the font-size of the element
- var fontSizeStr = computedStyle(node, 'font-size');
- _node.style.fontSize = fontSizeStr;
-
- // Remove default padding/border which can affect offset height
- // https://github.com/twolfson/line-height/issues/4
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
- _node.style.padding = '0px';
- _node.style.border = '0px';
-
- // Append it to the body
- var body = document.body;
- body.appendChild(_node);
-
- // Assume the line height of the element is the height
- var height = _node.offsetHeight;
- lnHeight = height;
-
- // Remove our child from the DOM
- body.removeChild(_node);
- }
-
- // Return the calculated height
- return lnHeight;
-}
-
-// Export lineHeight
-module.exports = lineHeight;
-
-
-/***/ }),
-
-/***/ 628:
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-"use strict";
-/**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-
-
-var ReactPropTypesSecret = __webpack_require__(4067);
-
-function emptyFunction() {}
-function emptyFunctionWithReset() {}
-emptyFunctionWithReset.resetWarningCache = emptyFunction;
-
-module.exports = function() {
- function shim(props, propName, componentName, location, propFullName, secret) {
- if (secret === ReactPropTypesSecret) {
- // It is still safe when called from React.
- return;
- }
- var err = new Error(
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
- 'Use PropTypes.checkPropTypes() to call them. ' +
- 'Read more at http://fb.me/use-check-prop-types'
- );
- err.name = 'Invariant Violation';
- throw err;
- };
- shim.isRequired = shim;
- function getShim() {
- return shim;
- };
- // Important!
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
- var ReactPropTypes = {
- array: shim,
- bigint: shim,
- bool: shim,
- func: shim,
- number: shim,
- object: shim,
- string: shim,
- symbol: shim,
-
- any: shim,
- arrayOf: getShim,
- element: shim,
- elementType: shim,
- instanceOf: getShim,
- node: shim,
- objectOf: getShim,
- oneOf: getShim,
- oneOfType: getShim,
- shape: getShim,
- exact: getShim,
-
- checkPropTypes: emptyFunctionWithReset,
- resetWarningCache: emptyFunction
- };
-
- ReactPropTypes.PropTypes = ReactPropTypes;
-
- return ReactPropTypes;
-};
-
-
-/***/ }),
-
-/***/ 5826:
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-/**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-if (false) { var throwOnDirectAccess, ReactIs; } else {
- // By explicitly using `prop-types` you are opting into new production behavior.
- // http://fb.me/prop-types-in-prod
- module.exports = __webpack_require__(628)();
-}
-
-
-/***/ }),
-
-/***/ 4067:
-/***/ ((module) => {
-
-"use strict";
-/**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-
-
-var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
-
-module.exports = ReactPropTypesSecret;
-
-
-/***/ }),
-
-/***/ 4462:
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __extends = (this && this.__extends) || (function () {
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
-})();
-var __assign = (this && this.__assign) || Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
-};
-var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
- t[p[i]] = s[p[i]];
- return t;
-};
-exports.__esModule = true;
-var React = __webpack_require__(1609);
-var PropTypes = __webpack_require__(5826);
-var autosize = __webpack_require__(4306);
-var _getLineHeight = __webpack_require__(461);
-var getLineHeight = _getLineHeight;
-var RESIZED = "autosize:resized";
-/**
- * A light replacement for built-in textarea component
- * which automaticaly adjusts its height to match the content
- */
-var TextareaAutosizeClass = /** @class */ (function (_super) {
- __extends(TextareaAutosizeClass, _super);
- function TextareaAutosizeClass() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.state = {
- lineHeight: null
- };
- _this.textarea = null;
- _this.onResize = function (e) {
- if (_this.props.onResize) {
- _this.props.onResize(e);
- }
- };
- _this.updateLineHeight = function () {
- if (_this.textarea) {
- _this.setState({
- lineHeight: getLineHeight(_this.textarea)
- });
- }
- };
- _this.onChange = function (e) {
- var onChange = _this.props.onChange;
- _this.currentValue = e.currentTarget.value;
- onChange && onChange(e);
- };
- return _this;
- }
- TextareaAutosizeClass.prototype.componentDidMount = function () {
- var _this = this;
- var _a = this.props, maxRows = _a.maxRows, async = _a.async;
- if (typeof maxRows === "number") {
- this.updateLineHeight();
- }
- if (typeof maxRows === "number" || async) {
- /*
- the defer is needed to:
- - force "autosize" to activate the scrollbar when this.props.maxRows is passed
- - support StyledComponents (see #71)
- */
- setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
- }
- else {
- this.textarea && autosize(this.textarea);
- }
- if (this.textarea) {
- this.textarea.addEventListener(RESIZED, this.onResize);
- }
- };
- TextareaAutosizeClass.prototype.componentWillUnmount = function () {
- if (this.textarea) {
- this.textarea.removeEventListener(RESIZED, this.onResize);
- autosize.destroy(this.textarea);
- }
- };
- TextareaAutosizeClass.prototype.render = function () {
- var _this = this;
- 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;
- var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
- return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
- _this.textarea = element;
- if (typeof _this.props.innerRef === 'function') {
- _this.props.innerRef(element);
- }
- else if (_this.props.innerRef) {
- _this.props.innerRef.current = element;
- }
- } }), children));
- };
- TextareaAutosizeClass.prototype.componentDidUpdate = function () {
- this.textarea && autosize.update(this.textarea);
- };
- TextareaAutosizeClass.defaultProps = {
- rows: 1,
- async: false
- };
- TextareaAutosizeClass.propTypes = {
- rows: PropTypes.number,
- maxRows: PropTypes.number,
- onResize: PropTypes.func,
- innerRef: PropTypes.any,
- async: PropTypes.bool
- };
- return TextareaAutosizeClass;
-}(React.Component));
-exports.TextareaAutosize = React.forwardRef(function (props, ref) {
- return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
-});
-
-
-/***/ }),
-
-/***/ 4132:
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-var __webpack_unused_export__;
-
-__webpack_unused_export__ = true;
-var TextareaAutosize_1 = __webpack_require__(4462);
-exports.A = TextareaAutosize_1.TextareaAutosize;
-
-
-/***/ }),
-
-/***/ 3394:
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-var __webpack_unused_export__;
-/**
- * @license React
- * react-jsx-runtime.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-var f=__webpack_require__(1609),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
-function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__webpack_unused_export__=l;exports.jsx=q;__webpack_unused_export__=q;
-
-
-/***/ }),
-
-/***/ 4922:
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-"use strict";
-
-
-if (true) {
- module.exports = __webpack_require__(3394);
-} else {}
-
-
-/***/ }),
-
/***/ 9681:
/***/ ((module) => {
@@ -8222,7 +7296,7 @@ module.exports = window["React"];
/******/ };
/******/
/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
@@ -8309,55 +7383,19 @@ __webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
- PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item),
- PluginSidebar: () => (/* reexport */ PluginSidebarEditSite),
+ PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem),
+ PluginSidebar: () => (/* reexport */ PluginSidebar),
PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem),
PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel),
initializeEditor: () => (/* binding */ initializeEditor),
reinitializeEditor: () => (/* binding */ reinitializeEditor),
- store: () => (/* reexport */ store_store)
+ store: () => (/* reexport */ store)
});
-// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
+// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
- closeModal: () => (closeModal),
- disableComplementaryArea: () => (disableComplementaryArea),
- enableComplementaryArea: () => (enableComplementaryArea),
- openModal: () => (openModal),
- pinItem: () => (pinItem),
- setDefaultComplementaryArea: () => (setDefaultComplementaryArea),
- setFeatureDefaults: () => (setFeatureDefaults),
- setFeatureValue: () => (setFeatureValue),
- toggleFeature: () => (toggleFeature),
- unpinItem: () => (unpinItem)
-});
-
-// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
-var selectors_namespaceObject = {};
-__webpack_require__.r(selectors_namespaceObject);
-__webpack_require__.d(selectors_namespaceObject, {
- getActiveComplementaryArea: () => (getActiveComplementaryArea),
- isComplementaryAreaLoading: () => (isComplementaryAreaLoading),
- isFeatureActive: () => (isFeatureActive),
- isItemPinned: () => (isItemPinned),
- isModalActive: () => (isModalActive)
-});
-
-// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
-var private_actions_namespaceObject = {};
-__webpack_require__.r(private_actions_namespaceObject);
-__webpack_require__.d(private_actions_namespaceObject, {
- removeTemplates: () => (removeTemplates),
- setCanvasMode: () => (setCanvasMode),
- setEditorCanvasContainerView: () => (setEditorCanvasContainerView)
-});
-
-// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
-var store_actions_namespaceObject = {};
-__webpack_require__.r(store_actions_namespaceObject);
-__webpack_require__.d(store_actions_namespaceObject, {
__experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType),
addTemplate: () => (addTemplate),
closeGeneralSidebar: () => (closeGeneralSidebar),
@@ -8380,14 +7418,22 @@ __webpack_require__.d(store_actions_namespaceObject, {
setTemplatePart: () => (setTemplatePart),
switchEditorMode: () => (switchEditorMode),
toggleDistractionFree: () => (toggleDistractionFree),
- toggleFeature: () => (actions_toggleFeature),
+ toggleFeature: () => (toggleFeature),
updateSettings: () => (updateSettings)
});
+// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
+var private_actions_namespaceObject = {};
+__webpack_require__.r(private_actions_namespaceObject);
+__webpack_require__.d(private_actions_namespaceObject, {
+ setCanvasMode: () => (setCanvasMode),
+ setEditorCanvasContainerView: () => (setEditorCanvasContainerView)
+});
+
// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
-var store_selectors_namespaceObject = {};
-__webpack_require__.r(store_selectors_namespaceObject);
-__webpack_require__.d(store_selectors_namespaceObject, {
+var selectors_namespaceObject = {};
+__webpack_require__.r(selectors_namespaceObject);
+__webpack_require__.d(selectors_namespaceObject, {
__experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint),
__experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType),
getCanUserCreateMedia: () => (getCanUserCreateMedia),
@@ -8403,7 +7449,7 @@ __webpack_require__.d(store_selectors_namespaceObject, {
getReusableBlocks: () => (getReusableBlocks),
getSettings: () => (getSettings),
hasPageContentFocus: () => (hasPageContentFocus),
- isFeatureActive: () => (selectors_isFeatureActive),
+ isFeatureActive: () => (isFeatureActive),
isInserterOpened: () => (isInserterOpened),
isListViewOpened: () => (isListViewOpened),
isNavigationOpened: () => (isNavigationOpened),
@@ -8419,9 +7465,6 @@ __webpack_require__.d(private_selectors_namespaceObject, {
getEditorCanvasContainerView: () => (getEditorCanvasContainerView)
});
-// EXTERNAL MODULE: external "React"
-var external_React_ = __webpack_require__(1609);
-var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2);
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: external ["wp","blockLibrary"]
@@ -8435,1154 +7478,177 @@ var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","editor"]
const external_wp_editor_namespaceObject = window["wp"]["editor"];
-// EXTERNAL MODULE: ./node_modules/classnames/index.js
-var classnames = __webpack_require__(5755);
-var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
+;// CONCATENATED MODULE: external ["wp","preferences"]
+const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
+;// CONCATENATED MODULE: external ["wp","widgets"]
+const external_wp_widgets_namespaceObject = window["wp"]["widgets"];
+;// CONCATENATED MODULE: external ["wp","hooks"]
+const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
+;// CONCATENATED MODULE: external ["wp","compose"]
+const external_wp_compose_namespaceObject = window["wp"]["compose"];
+;// CONCATENATED MODULE: external ["wp","blockEditor"]
+const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
-;// CONCATENATED MODULE: external ["wp","primitives"]
-const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
-
-/**
- * WordPress dependencies
- */
-
-const check = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
-}));
-/* harmony default export */ const library_check = (check);
+;// CONCATENATED MODULE: external ["wp","notices"]
+const external_wp_notices_namespaceObject = window["wp"]["notices"];
+;// CONCATENATED MODULE: external ["wp","coreData"]
+const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
+;// CONCATENATED MODULE: ./node_modules/colord/index.mjs
+var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
+;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
+var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/clone-deep.js
/**
- * WordPress dependencies
+ * Makes a copy of an object without storing any references to the original object.
+ * @param {Object} object
+ * @return {Object} The cloned object.
*/
+function cloneDeep(object) {
+ return !object ? {} : JSON.parse(JSON.stringify(object));
+}
-const starFilled = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const star_filled = (starFilled);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
-
+;// CONCATENATED MODULE: external ["wp","privateApis"]
+const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
-const starEmpty = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- 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",
- clipRule: "evenodd"
-}));
-/* harmony default export */ const star_empty = (starEmpty);
-
-;// CONCATENATED MODULE: external ["wp","viewport"]
-const external_wp_viewport_namespaceObject = window["wp"]["viewport"];
-;// CONCATENATED MODULE: external ["wp","preferences"]
-const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
+const {
+ lock,
+ unlock: lock_unlock_unlock
+} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site');
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js
/**
* WordPress dependencies
*/
-const closeSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const close_small = (closeSmall);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
-/**
- * WordPress dependencies
- */
-/**
- * Set a default complementary area.
- *
- * @param {string} scope Complementary area scope.
- * @param {string} area Area identifier.
- *
- * @return {Object} Action object.
- */
-const setDefaultComplementaryArea = (scope, area) => ({
- type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
- scope,
- area
-});
-/**
- * Enable the complementary area.
- *
- * @param {string} scope Complementary area scope.
- * @param {string} area Area identifier.
- */
-const enableComplementaryArea = (scope, area) => ({
- registry,
- dispatch
-}) => {
- // Return early if there's no area.
- if (!area) {
- return;
- }
- const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
- if (!isComplementaryAreaVisible) {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
- }
- dispatch({
- type: 'ENABLE_COMPLEMENTARY_AREA',
- scope,
- area
- });
-};
-
-/**
- * Disable the complementary area.
- *
- * @param {string} scope Complementary area scope.
- */
-const disableComplementaryArea = scope => ({
- registry
-}) => {
- const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
- if (isComplementaryAreaVisible) {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
- }
-};
-
-/**
- * Pins an item.
- *
- * @param {string} scope Item scope.
- * @param {string} item Item identifier.
- *
- * @return {Object} Action object.
- */
-const pinItem = (scope, item) => ({
- registry
-}) => {
- // Return early if there's no item.
- if (!item) {
- return;
- }
- const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
-
- // The item is already pinned, there's nothing to do.
- if (pinnedItems?.[item] === true) {
- return;
- }
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
- ...pinnedItems,
- [item]: true
- });
-};
-
-/**
- * Unpins an item.
- *
- * @param {string} scope Item scope.
- * @param {string} item Item identifier.
- */
-const unpinItem = (scope, item) => ({
- registry
-}) => {
- // Return early if there's no item.
- if (!item) {
- return;
- }
- const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
- ...pinnedItems,
- [item]: false
- });
-};
-
-/**
- * Returns an action object used in signalling that a feature should be toggled.
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {string} featureName The feature name.
- */
-function toggleFeature(scope, featureName) {
- return function ({
- registry
- }) {
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).toggle`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
- };
-}
-
-/**
- * Returns an action object used in signalling that a feature should be set to
- * a true or false value
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {string} featureName The feature name.
- * @param {boolean} value The value to set.
- *
- * @return {Object} Action object.
- */
-function setFeatureValue(scope, featureName, value) {
- return function ({
- registry
- }) {
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).set`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
- };
-}
-
-/**
- * Returns an action object used in signalling that defaults should be set for features.
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
- *
- * @return {Object} Action object.
- */
-function setFeatureDefaults(scope, defaults) {
- return function ({
- registry
- }) {
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).setDefaults`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
- };
-}
/**
- * Returns an action object used in signalling that the user opened a modal.
- *
- * @param {string} name A string that uniquely identifies the modal.
- *
- * @return {Object} Action object.
- */
-function openModal(name) {
- return {
- type: 'OPEN_MODAL',
- name
- };
-}
-
-/**
- * Returns an action object signalling that the user closed a modal.
- *
- * @return {Object} Action object.
- */
-function closeModal() {
- return {
- type: 'CLOSE_MODAL'
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
-/**
- * WordPress dependencies
+ * Internal dependencies
*/
-
+const {
+ GlobalStylesContext
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ mergeBaseAndUserConfigs
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
/**
- * Returns the complementary area that is active in a given scope.
- *
- * @param {Object} state Global application state.
- * @param {string} scope Item scope.
+ * Removes all instances of a property from an object.
*
- * @return {string | null | undefined} The complementary area that is active in the given scope.
+ * @param {Object} object The object to remove the property from.
+ * @param {string} property The property to remove.
+ * @return {Object} The modified object.
*/
-const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
- const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
-
- // Return `undefined` to indicate that the user has never toggled
- // visibility, this is the vanilla default. Other code relies on this
- // nuance in the return value.
- if (isComplementaryAreaVisible === undefined) {
- return undefined;
- }
-
- // Return `null` to indicate the user hid the complementary area.
- if (isComplementaryAreaVisible === false) {
- return null;
+function removePropertyFromObject(object, property) {
+ if (!property || typeof property !== 'string') {
+ return object;
}
- return state?.complementaryAreas?.[scope];
-});
-const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
- const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
- const identifier = state?.complementaryAreas?.[scope];
- return isVisible && identifier === undefined;
-});
-
-/**
- * Returns a boolean indicating if an item is pinned or not.
- *
- * @param {Object} state Global application state.
- * @param {string} scope Scope.
- * @param {string} item Item to check.
- *
- * @return {boolean} True if the item is pinned and false otherwise.
- */
-const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
- var _pinnedItems$item;
- const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
- return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
-});
-
-/**
- * Returns a boolean indicating whether a feature is active for a particular
- * scope.
- *
- * @param {Object} state The store state.
- * @param {string} scope The scope of the feature (e.g. core/edit-post).
- * @param {string} featureName The name of the feature.
- *
- * @return {boolean} Is the feature enabled?
- */
-const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
- external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
- since: '6.0',
- alternative: `select( 'core/preferences' ).get( scope, featureName )`
- });
- return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
-});
-
-/**
- * Returns true if a modal is active, or false otherwise.
- *
- * @param {Object} state Global application state.
- * @param {string} modalName A string that uniquely identifies the modal.
- *
- * @return {boolean} Whether the modal is active.
- */
-function isModalActive(state, modalName) {
- return state.activeModal === modalName;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
-/**
- * WordPress dependencies
- */
-
-function complementaryAreas(state = {}, action) {
- switch (action.type) {
- case 'SET_DEFAULT_COMPLEMENTARY_AREA':
- {
- const {
- scope,
- area
- } = action;
-
- // If there's already an area, don't overwrite it.
- if (state[scope]) {
- return state;
- }
- return {
- ...state,
- [scope]: area
- };
- }
- case 'ENABLE_COMPLEMENTARY_AREA':
- {
- const {
- scope,
- area
- } = action;
- return {
- ...state,
- [scope]: area
- };
- }
+ if (typeof object !== 'object' || !object || !Object.keys(object).length) {
+ return object;
}
- return state;
-}
-
-/**
- * Reducer for storing the name of the open modal, or null if no modal is open.
- *
- * @param {Object} state Previous state.
- * @param {Object} action Action object containing the `name` of the modal
- *
- * @return {Object} Updated state
- */
-function activeModal(state = null, action) {
- switch (action.type) {
- case 'OPEN_MODAL':
- return action.name;
- case 'CLOSE_MODAL':
- return null;
+ for (const key in object) {
+ if (key === property) {
+ delete object[key];
+ } else if (typeof object[key] === 'object') {
+ removePropertyFromObject(object[key], property);
+ }
}
- return state;
+ return object;
}
-/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
- complementaryAreas,
- activeModal
-}));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
-/**
- * The identifier for the data store.
- *
- * @type {string}
- */
-const STORE_NAME = 'core/interface';
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
-/**
- * WordPress dependencies
- */
-
/**
- * Internal dependencies
- */
-
-
-
-
-
-/**
- * Store definition for the interface namespace.
- *
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
+ * Fetches the current theme style variations that contain only the specified property
+ * and merges them with the user config.
*
- * @type {Object}
- */
-const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
- reducer: reducer,
- actions: actions_namespaceObject,
- selectors: selectors_namespaceObject
-});
-
-// Once we build a more generic persistence plugin that works across types of stores
-// we'd be able to replace this with a register call.
-(0,external_wp_data_namespaceObject.register)(store);
-
-;// CONCATENATED MODULE: external ["wp","plugins"]
-const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
-/**
- * WordPress dependencies
- */
-
-/* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
- return {
- icon: ownProps.icon || context.icon,
- identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
- };
-}));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function ComplementaryAreaToggle({
- as = external_wp_components_namespaceObject.Button,
- scope,
- identifier,
- icon,
- selectedIcon,
- name,
- ...props
-}) {
- const ComponentToUse = as;
- const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- return (0,external_React_.createElement)(ComponentToUse, {
- icon: selectedIcon && isSelected ? selectedIcon : icon,
- "aria-controls": identifier.replace('/', ':'),
- onClick: () => {
- if (isSelected) {
- disableComplementaryArea(scope);
- } else {
- enableComplementaryArea(scope, identifier);
- }
- },
- ...props
- });
-}
-/* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-const ComplementaryAreaHeader = ({
- smallScreenTitle,
- children,
- className,
- toggleButtonProps
-}) => {
- const toggleButton = (0,external_React_.createElement)(complementary_area_toggle, {
- icon: close_small,
- ...toggleButtonProps
- });
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "components-panel__header interface-complementary-area-header__small"
- }, smallScreenTitle && (0,external_React_.createElement)("span", {
- className: "interface-complementary-area-header__small-title"
- }, smallScreenTitle), toggleButton), (0,external_React_.createElement)("div", {
- className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
- tabIndex: -1
- }, children, toggleButton));
-};
-/* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-const noop = () => {};
-function ActionItemSlot({
- name,
- as: Component = external_wp_components_namespaceObject.ButtonGroup,
- fillProps = {},
- bubblesVirtually,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, {
- name: name,
- bubblesVirtually: bubblesVirtually,
- fillProps: fillProps
- }, fills => {
- if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
- return null;
- }
-
- // Special handling exists for backward compatibility.
- // It ensures that menu items created by plugin authors aren't
- // duplicated with automatically injected menu items coming
- // from pinnable plugin sidebars.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- const initializedByPlugins = [];
- external_wp_element_namespaceObject.Children.forEach(fills, ({
- props: {
- __unstableExplicitMenuItem,
- __unstableTarget
- }
- }) => {
- if (__unstableTarget && __unstableExplicitMenuItem) {
- initializedByPlugins.push(__unstableTarget);
- }
- });
- const children = external_wp_element_namespaceObject.Children.map(fills, child => {
- if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
- return null;
- }
- return child;
- });
- return (0,external_React_.createElement)(Component, {
- ...props
- }, children);
- });
-}
-function ActionItem({
- name,
- as: Component = external_wp_components_namespaceObject.Button,
- onClick,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Fill, {
- name: name
- }, ({
- onClick: fpOnClick
- }) => {
- return (0,external_React_.createElement)(Component, {
- onClick: onClick || fpOnClick ? (...args) => {
- (onClick || noop)(...args);
- (fpOnClick || noop)(...args);
- } : undefined,
- ...props
- });
- });
-}
-ActionItem.Slot = ActionItemSlot;
-/* harmony default export */ const action_item = (ActionItem);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
-
-/**
- * WordPress dependencies
+ * @param {Object} props Object of hook args.
+ * @param {string} props.property The property to filter by.
+ * @return {Object[]|*} The merged object.
*/
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const PluginsMenuItem = ({
- // Menu item is marked with unstable prop for backward compatibility.
- // They are removed so they don't leak to DOM elements.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- __unstableExplicitMenuItem,
- __unstableTarget,
- ...restProps
-}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- ...restProps
-});
-function ComplementaryAreaMoreMenuItem({
- scope,
- target,
- __unstableExplicitMenuItem,
- ...props
-}) {
- return (0,external_React_.createElement)(complementary_area_toggle, {
- as: toggleProps => {
- return (0,external_React_.createElement)(action_item, {
- __unstableExplicitMenuItem: __unstableExplicitMenuItem,
- __unstableTarget: `${scope}/${target}`,
- as: PluginsMenuItem,
- name: `${scope}/plugin-more-menu`,
- ...toggleProps
- });
- },
- role: "menuitemcheckbox",
- selectedIcon: library_check,
- name: target,
- scope: scope,
- ...props
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-function PinnedItems({
- scope,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Fill, {
- name: `PinnedItems/${scope}`,
- ...props
- });
-}
-function PinnedItemsSlot({
- scope,
- className,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, {
- name: `PinnedItems/${scope}`,
- ...props
- }, fills => fills?.length > 0 && (0,external_React_.createElement)("div", {
- className: classnames_default()(className, 'interface-pinned-items')
- }, fills));
-}
-PinnedItems.Slot = PinnedItemsSlot;
-/* harmony default export */ const pinned_items = (PinnedItems);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-function ComplementaryAreaSlot({
- scope,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, {
- name: `ComplementaryArea/${scope}`,
- ...props
- });
-}
-function ComplementaryAreaFill({
- scope,
- children,
- className,
- id
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Fill, {
- name: `ComplementaryArea/${scope}`
- }, (0,external_React_.createElement)("div", {
- id: id,
- className: className
- }, children));
-}
-function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
- const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
- const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // If the complementary area is active and the editor is switching from
- // a big to a small window size.
- if (isActive && isSmall && !previousIsSmall.current) {
- disableComplementaryArea(scope);
- // Flag the complementary area to be reopened when the window size
- // goes from small to big.
- shouldOpenWhenNotSmall.current = true;
- } else if (
- // If there is a flag indicating the complementary area should be
- // enabled when we go from small to big window size and we are going
- // from a small to big window size.
- shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
- // Remove the flag indicating the complementary area should be
- // enabled.
- shouldOpenWhenNotSmall.current = false;
- enableComplementaryArea(scope, identifier);
- } else if (
- // If the flag is indicating the current complementary should be
- // reopened but another complementary area becomes active, remove
- // the flag.
- shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
- shouldOpenWhenNotSmall.current = false;
- }
- if (isSmall !== previousIsSmall.current) {
- previousIsSmall.current = isSmall;
- }
- }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]);
-}
-function ComplementaryArea({
- children,
- className,
- closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
- identifier,
- header,
- headerClassName,
- icon,
- isPinnable = true,
- panelClassName,
- scope,
- name,
- smallScreenTitle,
- title,
- toggleShortcut,
- isActiveByDefault
+function useCurrentMergeThemeStyleVariationsWithUserConfig({
+ property
}) {
const {
- isLoading,
- isActive,
- isPinned,
- activeArea,
- isSmall,
- isLarge,
- showIconLabels
+ variationsFromTheme
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getActiveComplementaryArea,
- isComplementaryAreaLoading,
- isItemPinned
- } = select(store);
- const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
- const _activeArea = getActiveComplementaryArea(scope);
+ const _variationsFromTheme = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations();
return {
- isLoading: isComplementaryAreaLoading(scope),
- isActive: _activeArea === identifier,
- isPinned: isItemPinned(scope, identifier),
- activeArea: _activeArea,
- isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
- isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'),
- showIconLabels: get('core', 'showIconLabels')
+ variationsFromTheme: _variationsFromTheme || []
};
- }, [identifier, scope]);
- useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
+ }, []);
const {
- enableComplementaryArea,
- disableComplementaryArea,
- pinItem,
- unpinItem
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // Set initial visibility: For large screens, enable if it's active by
- // default. For small screens, always initially disable.
- if (isActiveByDefault && activeArea === undefined && !isSmall) {
- enableComplementaryArea(scope, identifier);
- } else if (activeArea === undefined && isSmall) {
- disableComplementaryArea(scope, identifier);
- }
- }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]);
- return (0,external_React_.createElement)(external_React_.Fragment, null, isPinnable && (0,external_React_.createElement)(pinned_items, {
- scope: scope
- }, isPinned && (0,external_React_.createElement)(complementary_area_toggle, {
- scope: scope,
- identifier: identifier,
- isPressed: isActive && (!showIconLabels || isLarge),
- "aria-expanded": isActive,
- "aria-disabled": isLoading,
- label: title,
- icon: showIconLabels ? library_check : icon,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined,
- size: "compact"
- })), name && isPinnable && (0,external_React_.createElement)(ComplementaryAreaMoreMenuItem, {
- target: name,
- scope: scope,
- icon: icon
- }, title), isActive && (0,external_React_.createElement)(ComplementaryAreaFill, {
- className: classnames_default()('interface-complementary-area', className),
- scope: scope,
- id: identifier.replace('/', ':')
- }, (0,external_React_.createElement)(complementary_area_header, {
- className: headerClassName,
- closeLabel: closeLabel,
- onClose: () => disableComplementaryArea(scope),
- smallScreenTitle: smallScreenTitle,
- toggleButtonProps: {
- label: closeLabel,
- shortcut: toggleShortcut,
- scope,
- identifier
- }
- }, header || (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("strong", null, title), isPinnable && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "interface-complementary-area__pin-unpin-item",
- icon: isPinned ? star_filled : star_empty,
- label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
- onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
- isPressed: isPinned,
- "aria-expanded": isPinned
- }))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Panel, {
- className: panelClassName
- }, children)));
-}
-const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
-ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
-/* harmony default export */ const complementary_area = (ComplementaryAreaWrapped);
-
-;// CONCATENATED MODULE: external ["wp","compose"]
-const external_wp_compose_namespaceObject = window["wp"]["compose"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js
-
-/**
- * External dependencies
- */
-
-function NavigableRegion({
- children,
- className,
- ariaLabel,
- as: Tag = 'div',
- ...props
-}) {
- return (0,external_React_.createElement)(Tag, {
- className: classnames_default()('interface-navigable-region', className),
- "aria-label": ariaLabel,
- role: "region",
- tabIndex: "-1",
- ...props
- }, children);
+ user: userVariation
+ } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const clonedUserVariation = cloneDeep(userVariation);
+
+ // Get user variation and remove the settings for the given property.
+ const userVariationWithoutProperty = removePropertyFromObject(clonedUserVariation, property);
+ userVariationWithoutProperty.title = (0,external_wp_i18n_namespaceObject.__)('Default');
+ const variationsWithSinglePropertyAndBase = variationsFromTheme.filter(variation => {
+ return isVariationWithSingleProperty(variation, property);
+ }).map(variation => {
+ return mergeBaseAndUserConfigs(userVariationWithoutProperty, variation);
+ });
+ return [userVariationWithoutProperty, ...variationsWithSinglePropertyAndBase];
+ }, [property, userVariation, variationsFromTheme]);
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
-
-/**
- * External dependencies
- */
-
-
/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
+ * Returns a new object, with properties specified in `property`,
+ * maintain the original object tree structure.
+ * The function is recursive, so it will perform a deep search for the given property.
+ * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.
+ *
+ * @param {Object} object The object to filter
+ * @param {Object} property The property to filter by
+ * @return {Object} The merged object.
*/
-
-function useHTMLClass(className) {
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- const element = document && document.querySelector(`html:not(.${className})`);
- if (!element) {
- return;
- }
- element.classList.toggle(className);
- return () => {
- element.classList.toggle(className);
- };
- }, [className]);
-}
-const headerVariants = {
- hidden: {
- opacity: 0
- },
- hover: {
- opacity: 1,
- transition: {
- type: 'tween',
- delay: 0.2,
- delayChildren: 0.2
- }
- },
- distractionFreeInactive: {
- opacity: 1,
- transition: {
- delay: 0
- }
+const filterObjectByProperty = (object, property) => {
+ if (!object) {
+ return {};
}
+ const newObject = {};
+ Object.keys(object).forEach(key => {
+ if (key === property) {
+ newObject[key] = object[key];
+ } else if (typeof object[key] === 'object') {
+ const newFilter = filterObjectByProperty(object[key], property);
+ if (Object.keys(newFilter).length) {
+ newObject[key] = newFilter;
+ }
+ }
+ });
+ return newObject;
};
-function InterfaceSkeleton({
- isDistractionFree,
- footer,
- header,
- editorNotices,
- sidebar,
- secondarySidebar,
- notices,
- content,
- actions,
- labels,
- className,
- enableRegionNavigation = true,
- // Todo: does this need to be a prop.
- // Can we use a dependency to keyboard-shortcuts directly?
- shortcuts
-}, ref) {
- const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
- useHTMLClass('interface-interface-skeleton__html-container');
- const defaultLabels = {
- /* translators: accessibility text for the top bar landmark region. */
- header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'),
- /* translators: accessibility text for the content landmark region. */
- body: (0,external_wp_i18n_namespaceObject.__)('Content'),
- /* translators: accessibility text for the secondary sidebar landmark region. */
- secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
- /* translators: accessibility text for the settings landmark region. */
- sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
- /* translators: accessibility text for the publish landmark region. */
- actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
- /* translators: accessibility text for the footer landmark region. */
- footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
- };
- const mergedLabels = {
- ...defaultLabels,
- ...labels
- };
- return (0,external_React_.createElement)("div", {
- ...(enableRegionNavigation ? navigateRegionsProps : {}),
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
- className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
- }, (0,external_React_.createElement)("div", {
- className: "interface-interface-skeleton__editor"
- }, !!header && (0,external_React_.createElement)(NavigableRegion, {
- as: external_wp_components_namespaceObject.__unstableMotion.div,
- className: "interface-interface-skeleton__header",
- "aria-label": mergedLabels.header,
- initial: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
- whileHover: isDistractionFree ? 'hover' : 'distractionFreeInactive',
- animate: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
- variants: headerVariants,
- transition: isDistractionFree ? {
- type: 'tween',
- delay: 0.8
- } : undefined
- }, header), isDistractionFree && (0,external_React_.createElement)("div", {
- className: "interface-interface-skeleton__header"
- }, editorNotices), (0,external_React_.createElement)("div", {
- className: "interface-interface-skeleton__body"
- }, !!secondarySidebar && (0,external_React_.createElement)(NavigableRegion, {
- className: "interface-interface-skeleton__secondary-sidebar",
- ariaLabel: mergedLabels.secondarySidebar
- }, secondarySidebar), !!notices && (0,external_React_.createElement)("div", {
- className: "interface-interface-skeleton__notices"
- }, notices), (0,external_React_.createElement)(NavigableRegion, {
- className: "interface-interface-skeleton__content",
- ariaLabel: mergedLabels.body
- }, content), !!sidebar && (0,external_React_.createElement)(NavigableRegion, {
- className: "interface-interface-skeleton__sidebar",
- ariaLabel: mergedLabels.sidebar
- }, sidebar), !!actions && (0,external_React_.createElement)(NavigableRegion, {
- className: "interface-interface-skeleton__actions",
- ariaLabel: mergedLabels.actions
- }, actions))), !!footer && (0,external_React_.createElement)(NavigableRegion, {
- className: "interface-interface-skeleton__footer",
- ariaLabel: mergedLabels.footer
- }, footer));
-}
-/* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
/**
- * WordPress dependencies
- */
-
-const moreVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
-}));
-/* harmony default export */ const more_vertical = (moreVertical);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
+ * Compares a style variation to the same variation filtered by a single property.
+ * Returns true if the variation contains only the property specified.
+ *
+ * @param {Object} variation The variation to compare.
+ * @param {string} property The property to compare.
+ * @return {boolean} Whether the variation contains only a single property.
*/
-
-
-
-function MoreMenuDropdown({
- as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
- className,
- /* translators: button label text should, if possible, be under 16 characters. */
- label = (0,external_wp_i18n_namespaceObject.__)('Options'),
- popoverProps,
- toggleProps,
- children
-}) {
- return (0,external_React_.createElement)(DropdownComponent, {
- className: classnames_default()('interface-more-menu-dropdown', className),
- icon: more_vertical,
- label: label,
- popoverProps: {
- placement: 'bottom-end',
- ...popoverProps,
- className: classnames_default()('interface-more-menu-dropdown__content', popoverProps?.className)
- },
- toggleProps: {
- tooltipPosition: 'bottom',
- ...toggleProps,
- size: 'compact'
- }
- }, onClose => children(onClose));
+function isVariationWithSingleProperty(variation, property) {
+ const variationWithProperty = filterObjectByProperty(cloneDeep(variation), property);
+ return JSON.stringify(variationWithProperty?.styles) === JSON.stringify(variation?.styles) && JSON.stringify(variationWithProperty?.settings) === JSON.stringify(variation?.settings);
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
-
-
-
-
-
-
-
-
-
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
-
-
-
-;// CONCATENATED MODULE: external ["wp","widgets"]
-const external_wp_widgets_namespaceObject = window["wp"]["widgets"];
-;// CONCATENATED MODULE: external ["wp","hooks"]
-const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
-;// CONCATENATED MODULE: external ["wp","mediaUtils"]
-const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/components.js
-/**
- * WordPress dependencies
- */
-
-
-(0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload);
-
-;// CONCATENATED MODULE: external ["wp","blockEditor"]
-const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
-;// CONCATENATED MODULE: external ["wp","notices"]
-const external_wp_notices_namespaceObject = window["wp"]["notices"];
-;// CONCATENATED MODULE: external ["wp","coreData"]
-const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
-;// CONCATENATED MODULE: ./node_modules/colord/index.mjs
-var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
-
-;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
-var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
-
-;// CONCATENATED MODULE: external ["wp","privateApis"]
-const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js
-/**
- * WordPress dependencies
- */
-
-const {
- lock,
- unlock
-} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-site');
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js
/**
* External dependencies
@@ -9596,15 +7662,17 @@ const {
+
/**
* Internal dependencies
*/
+
const {
useGlobalSetting,
useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
// Enable colord's a11y plugin.
k([a11y]);
@@ -9633,15 +7701,23 @@ function useStylesPreviewColors() {
const [textColor = 'black'] = useGlobalStyle('color.text');
const [backgroundColor = 'white'] = useGlobalStyle('color.background');
const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text');
+ const [linkColor = headingColor] = useGlobalStyle('elements.link.color.text');
+ const [buttonBackgroundColor = linkColor] = useGlobalStyle('elements.button.color.background');
const [coreColors] = useGlobalSetting('color.palette.core');
const [themeColors] = useGlobalSetting('color.palette.theme');
const [customColors] = useGlobalSetting('color.palette.custom');
const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []);
- const highlightedColors = paletteColors.filter(
- // we exclude these two colors because they are already visible in the preview.
+ const textColorObject = paletteColors.filter(({
+ color
+ }) => color === textColor);
+ const buttonBackgroundColorObject = paletteColors.filter(({
+ color
+ }) => color === buttonBackgroundColor);
+ const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter(
+ // we exclude these background color because it is already visible in the preview.
({
color
- }) => color !== backgroundColor && color !== headingColor).slice(0, 2);
+ }) => color !== backgroundColor).slice(0, 2);
return {
paletteColors,
highlightedColors
@@ -9652,11 +7728,47 @@ function useSupportedStyles(name, element) {
supportedPanels
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
return {
- supportedPanels: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element)
+ supportedPanels: lock_unlock_unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element)
};
}, [name, element]);
return supportedPanels;
}
+function useColorVariations() {
+ const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig({
+ property: 'color'
+ });
+ /*
+ * Filter out variations with no settings or styles.
+ */
+ return colorVariations?.length ? colorVariations.filter(variation => {
+ const {
+ settings,
+ styles,
+ title
+ } = variation;
+ return title === (0,external_wp_i18n_namespaceObject.__)('Default') ||
+ // Always preseve the default variation.
+ Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
+ }) : [];
+}
+function useTypographyVariations() {
+ const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig({
+ property: 'typography'
+ });
+ /*
+ * Filter out variations with no settings or styles.
+ */
+ return typographyVariations?.length ? typographyVariations.filter(variation => {
+ const {
+ settings,
+ styles,
+ title
+ } = variation;
+ return title === (0,external_wp_i18n_namespaceObject.__)('Default') ||
+ // Always preseve the default variation.
+ Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
+ }) : [];
+}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js
/**
@@ -9697,8 +7809,9 @@ function setNestedValue(object, path, value) {
return object;
}
+;// CONCATENATED MODULE: external "ReactJSXRuntime"
+const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js
-
/**
* WordPress dependencies
*/
@@ -9719,10 +7832,14 @@ function setNestedValue(object, path, value) {
+
+
+
+
const {
cleanEmptyObject,
- GlobalStylesContext
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+ GlobalStylesContext: push_changes_to_global_styles_GlobalStylesContext
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
// Block Gap is a special case and isn't defined within the blocks
// style properties config. We'll add it here to allow it to be pushed
@@ -9917,9 +8034,6 @@ function useChangesToPush(name, attributes, userConfig) {
return changes;
}, [supports, attributes, blockUserConfig]);
}
-function cloneDeep(object) {
- return !object ? {} : JSON.parse(JSON.stringify(object));
-}
function PushChangesToGlobalStylesControl({
name,
attributes,
@@ -9928,7 +8042,7 @@ function PushChangesToGlobalStylesControl({
const {
user: userConfig,
setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
+ } = (0,external_wp_element_namespaceObject.useContext)(push_changes_to_global_styles_GlobalStylesContext);
const changes = useChangesToPush(name, attributes, userConfig);
const {
__unstableMarkNextChangeAsNotPersistent
@@ -9969,7 +8083,7 @@ function PushChangesToGlobalStylesControl({
// notification.
__unstableMarkNextChangeAsNotPersistent();
setAttributes(newBlockAttributes);
- setUserConfig(() => newUserConfig, {
+ setUserConfig(newUserConfig, {
undoIgnore: true
});
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
@@ -9981,7 +8095,7 @@ function PushChangesToGlobalStylesControl({
onClick() {
__unstableMarkNextChangeAsNotPersistent();
setAttributes(attributes);
- setUserConfig(() => userConfig, {
+ setUserConfig(userConfig, {
undoIgnore: true
});
}
@@ -9989,16 +8103,22 @@ function PushChangesToGlobalStylesControl({
});
}
}, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, {
className: "edit-site-push-changes-to-global-styles-control",
help: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Title of the block e.g. 'Heading'.
- (0,external_wp_i18n_namespaceObject.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title)
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- disabled: changes.length === 0,
- onClick: pushChanges
- }, (0,external_wp_i18n_namespaceObject.__)('Apply globally')));
+ (0,external_wp_i18n_namespaceObject.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Styles')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "secondary",
+ __experimentalIsFocusable: true,
+ disabled: changes.length === 0,
+ onClick: pushChanges,
+ children: (0,external_wp_i18n_namespaceObject.__)('Apply globally')
+ })]
+ });
}
function PushChangesToGlobalStyles(props) {
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
@@ -10008,298 +8128,20 @@ function PushChangesToGlobalStyles(props) {
if (!isDisplayed) {
return null;
}
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, null, (0,external_React_.createElement)(PushChangesToGlobalStylesControl, {
- ...props
- }));
-}
-const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(BlockEdit, {
- ...props
-}), props.isSelected && (0,external_React_.createElement)(PushChangesToGlobalStyles, {
- ...props
-})));
-(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
-
-;// CONCATENATED MODULE: external ["wp","router"]
-const external_wp_router_namespaceObject = window["wp"]["router"];
-;// CONCATENATED MODULE: external ["wp","url"]
-const external_wp_url_namespaceObject = window["wp"]["url"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js
-/**
- * WordPress dependencies
- */
-
-function isPreviewingTheme() {
- return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview') !== undefined;
-}
-function currentlyPreviewingTheme() {
- if (isPreviewingTheme()) {
- return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview');
- }
- return null;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function useLink(params, state, shouldReplace = false) {
- const history = useHistory();
- function onClick(event) {
- event?.preventDefault();
- if (shouldReplace) {
- history.replace(params, state);
- } else {
- history.push(params, state);
- }
- }
- const currentArgs = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const currentUrlWithoutArgs = (0,external_wp_url_namespaceObject.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs));
- if (isPreviewingTheme()) {
- params = {
- ...params,
- wp_theme_preview: currentlyPreviewingTheme()
- };
- }
- const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params);
- return {
- href: newUrl,
- onClick
- };
-}
-function Link({
- params = {},
- state,
- replace: shouldReplace = false,
- children,
- ...props
-}) {
- const {
- href,
- onClick
- } = useLink(params, state, shouldReplace);
- return (0,external_React_.createElement)("a", {
- href: href,
- onClick: onClick,
- ...props
- }, children);
-}
-
-;// CONCATENATED MODULE: external ["wp","patterns"]
-const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/constants.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-// Navigation
-const NAVIGATION_POST_TYPE = 'wp_navigation';
-
-// Templates.
-const constants_TEMPLATE_POST_TYPE = 'wp_template';
-const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
-const TEMPLATE_ORIGINS = {
- custom: 'custom',
- theme: 'theme',
- plugin: 'plugin'
-};
-const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
-
-// Patterns.
-const {
- PATTERN_TYPES,
- PATTERN_DEFAULT_CATEGORY,
- PATTERN_USER_CATEGORY,
- EXCLUDED_PATTERN_SOURCES,
- PATTERN_SYNC_TYPES
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
-
-// Entities that are editable in focus mode.
-const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
-const POST_TYPE_LABELS = {
- [constants_TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'),
- [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'),
- [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'),
- [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation')
-};
-
-// DataViews constants
-const LAYOUT_GRID = 'grid';
-const LAYOUT_TABLE = 'table';
-const LAYOUT_LIST = 'list';
-const ENUMERATION_TYPE = 'enumeration';
-const OPERATOR_IN = 'in';
-const OPERATOR_NOT_IN = 'notIn';
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/template-part-edit.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function EditTemplatePartMenuItem({
- attributes
-}) {
- const {
- theme,
- slug
- } = attributes;
- const {
- params
- } = useLocation();
- const templatePart = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getCurrentTheme,
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- return getEntityRecord('postType', TEMPLATE_PART_POST_TYPE,
- // Ideally this should be an official public API.
- `${theme || getCurrentTheme()?.stylesheet}//${slug}`);
- }, [theme, slug]);
- const linkProps = useLink({
- postId: templatePart?.id,
- postType: templatePart?.type,
- canvas: 'edit'
- }, {
- fromTemplateId: params.postId || templatePart?.id
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, {
+ ...props
+ })
});
- if (!templatePart) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
- ...linkProps,
- onClick: event => {
- linkProps.onClick(event);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Edit'));
}
-const withEditBlockControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
- const {
- attributes,
- name
- } = props;
- const isDisplayed = name === 'core/template-part' && attributes.slug;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(BlockEdit, {
- key: "edit",
+const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
...props
- }), isDisplayed && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
- group: "other"
- }, (0,external_React_.createElement)(EditTemplatePartMenuItem, {
- attributes: attributes
- })));
-}, 'withEditBlockControls');
-(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/template-part-edit-button', withEditBlockControls);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/navigation-menu-edit.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useLocation: navigation_menu_edit_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function NavigationMenuEdit({
- attributes
-}) {
- const {
- ref
- } = attributes;
- const {
- params
- } = navigation_menu_edit_useLocation();
- const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
- const navigationMenu = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', NAVIGATION_POST_TYPE,
- // Ideally this should be an official public API.
- ref);
- }, [ref]);
- const linkProps = useLink({
- postId: navigationMenu?.id,
- postType: navigationMenu?.type,
- canvas: 'edit'
- }, {
- // this applies to Navigation Menus as well.
- fromTemplateId: params.postId || navigationMenu?.id
- });
-
- // A non-default setting for block editing mode indicates that the
- // editor should restrict "editing" actions. Therefore the `Edit` button
- // should not be displayed.
- if (!navigationMenu || blockEditingMode !== 'default') {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
- group: "other"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
- ...linkProps,
- onClick: event => {
- linkProps.onClick(event);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Edit')));
-}
-const navigation_menu_edit_withEditBlockControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
- const {
- attributes,
- name
- } = props;
- const isDisplayed = name === 'core/navigation' && attributes.ref;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(BlockEdit, {
+ }), props.isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, {
...props
- }), isDisplayed && (0,external_React_.createElement)(NavigationMenuEdit, {
- attributes: attributes
- }));
-}, 'withEditBlockControls');
-(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/navigation-edit-button', navigation_menu_edit_withEditBlockControls);
+ })]
+}));
+(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js
/**
@@ -10307,9 +8149,6 @@ const navigation_menu_edit_withEditBlockControls = (0,external_wp_compose_namesp
*/
-
-
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js
/**
* WordPress dependencies
@@ -10406,7 +8245,7 @@ function editorCanvasContainerView(state = undefined, action) {
}
return state;
}
-/* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
+/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
settings,
editedPost,
saveViewPanel,
@@ -10414,173 +8253,61 @@ function editorCanvasContainerView(state = undefined, action) {
editorCanvasContainerView
}));
-;// CONCATENATED MODULE: external ["wp","apiFetch"]
-const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
-var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
-;// CONCATENATED MODULE: external ["wp","a11y"]
-const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js
-/**
- * The identifier for the data store.
- *
- * @type {string}
- */
-const constants_STORE_NAME = 'core/edit-site';
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js
-/**
- * Internal dependencies
- */
-
-
-/**
- * Check if a template is revertable to its original theme-provided template file.
- *
- * @param {Object} template The template entity to check.
- * @return {boolean} Whether the template is revertable.
- */
-function isTemplateRevertable(template) {
- if (!template) {
- return false;
- }
- /* eslint-disable camelcase */
- return template?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file;
- /* eslint-enable camelcase */
-}
-
-;// CONCATENATED MODULE: external ["wp","htmlEntities"]
-const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
+;// CONCATENATED MODULE: external ["wp","patterns"]
+const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/constants.js
/**
* WordPress dependencies
*/
-
-
-
-
-
/**
* Internal dependencies
*/
-/**
- * Action that switches the canvas mode.
- *
- * @param {?string} mode Canvas mode.
- */
-const setCanvasMode = mode => ({
- registry,
- dispatch
-}) => {
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
- registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableSetEditorMode('edit');
- dispatch({
- type: 'SET_CANVAS_MODE',
- mode
- });
- // Check if the block list view should be open by default.
- // If `distractionFree` mode is enabled, the block list view should not be open.
- // This behavior is disabled for small viewports.
- if (isMediumOrBigger && mode === 'edit' && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
- registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
- } else {
- registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false);
- }
- registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false);
-};
+// Navigation
+const NAVIGATION_POST_TYPE = 'wp_navigation';
-/**
- * Action that switches the editor canvas container view.
- *
- * @param {?string} view Editor canvas container view.
- */
-const setEditorCanvasContainerView = view => ({
- dispatch
-}) => {
- dispatch({
- type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',
- view
- });
+// Templates.
+const TEMPLATE_POST_TYPE = 'wp_template';
+const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
+const TEMPLATE_ORIGINS = {
+ custom: 'custom',
+ theme: 'theme',
+ plugin: 'plugin'
};
+const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
+const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts';
-/**
- * Action that removes an array of templates.
- *
- * @param {Array} items An array of template or template part objects to remove.
- */
-const removeTemplates = items => async ({
- registry
-}) => {
- const isTemplate = items[0].type === constants_TEMPLATE_POST_TYPE;
- const promiseResult = await Promise.allSettled(items.map(item => {
- return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, {
- force: true
- }, {
- throwOnError: true
- });
- }));
+// Patterns.
+const {
+ PATTERN_TYPES,
+ PATTERN_DEFAULT_CATEGORY,
+ PATTERN_USER_CATEGORY,
+ EXCLUDED_PATTERN_SOURCES,
+ PATTERN_SYNC_TYPES
+} = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis);
- // If all the promises were fulfilled with sucess.
- if (promiseResult.every(({
- status
- }) => status === 'fulfilled')) {
- let successMessage;
- if (items.length === 1) {
- // Depending on how the entity was retrieved its title might be
- // an object or simple string.
- const title = typeof items[0].title === 'string' ? items[0].title : items[0].title?.rendered;
- successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
- } else {
- successMessage = isTemplate ? (0,external_wp_i18n_namespaceObject.__)('Templates deleted.') : (0,external_wp_i18n_namespaceObject.__)('Template parts deleted.');
- }
- registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, {
- type: 'snackbar',
- id: 'site-editor-template-deleted-success'
- });
- } else {
- // If there was at lease one failure.
- let errorMessage;
- // If we were trying to delete a single template.
- if (promiseResult.length === 1) {
- if (promiseResult[0].reason?.message) {
- errorMessage = promiseResult[0].reason.message;
- } else {
- errorMessage = isTemplate ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template part.');
- }
- // If we were trying to delete a multiple templates
- } else {
- const errorMessages = new Set();
- const failedPromises = promiseResult.filter(({
- status
- }) => status === 'rejected');
- for (const failedPromise of failedPromises) {
- if (failedPromise.reason?.message) {
- errorMessages.add(failedPromise.reason.message);
- }
- }
- if (errorMessages.size === 0) {
- errorMessage = isTemplate ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the templates.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template parts.');
- } else if (errorMessages.size === 1) {
- errorMessage = isTemplate ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
- (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the templates: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
- (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template parts: %s'), [...errorMessages][0]);
- } else {
- errorMessage = isTemplate ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
- (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the templates: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
- (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the template parts: %s'), [...errorMessages].join(','));
- }
- }
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
+// Entities that are editable in focus mode.
+const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
+const POST_TYPE_LABELS = {
+ [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'),
+ [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'),
+ [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation')
};
+// DataViews constants
+const LAYOUT_GRID = 'grid';
+const LAYOUT_TABLE = 'table';
+const LAYOUT_LIST = 'list';
+const OPERATOR_IS = 'is';
+const OPERATOR_IS_NOT = 'isNot';
+const OPERATOR_IS_ANY = 'isAny';
+const OPERATOR_IS_NONE = 'isNone';
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
/**
* WordPress dependencies
@@ -10592,26 +8319,21 @@ const removeTemplates = items => async ({
-
-
-
-
-
-
/**
* Internal dependencies
*/
-
-
+const {
+ interfaceStore
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
/**
* Dispatches an action that toggles a feature flag.
*
* @param {string} featureName Feature name.
*/
-function actions_toggleFeature(featureName) {
+function toggleFeature(featureName) {
return function ({
registry
}) {
@@ -10677,9 +8399,9 @@ const addTemplate = template => async ({
version: '6.8',
hint: 'use saveEntityRecord directly'
});
- const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', constants_TEMPLATE_POST_TYPE, template);
+ const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template);
if (template.content) {
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', constants_TEMPLATE_POST_TYPE, newTemplate.id, {
+ registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, {
blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content)
}, {
undoIgnore: true
@@ -10687,7 +8409,7 @@ const addTemplate = template => async ({
}
dispatch({
type: 'SET_EDITED_POST',
- postType: constants_TEMPLATE_POST_TYPE,
+ postType: TEMPLATE_POST_TYPE,
id: newTemplate.id
});
};
@@ -10697,8 +8419,10 @@ const addTemplate = template => async ({
*
* @param {Object} template The template object.
*/
-const removeTemplate = template => {
- return removeTemplates([template]);
+const removeTemplate = template => ({
+ registry
+}) => {
+ return lock_unlock_unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([template]);
};
/**
@@ -10782,7 +8506,7 @@ function setEditedPostContext(context) {
*
* @deprecated
*
- * @return {number} The resolved template ID for the page route.
+ * @return {Object} Action object.
*/
function setPage() {
external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", {
@@ -10911,100 +8635,21 @@ function setIsSaveViewOpened(isOpen) {
* @param {boolean} [options.allowUndo] Whether to allow the user to undo
* reverting the template. Default true.
*/
-const revertTemplate = (template, {
- allowUndo = true
-} = {}) => async ({
+const revertTemplate = (template, options) => ({
registry
}) => {
- const noticeId = 'edit-site-template-reverted';
- registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId);
- if (!isTemplateRevertable(template)) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), {
- type: 'snackbar'
- });
- return;
- }
- try {
- const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type);
- if (!templateEntityConfig) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
- type: 'snackbar'
- });
- return;
- }
- const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
- context: 'edit',
- source: 'theme'
- });
- const fileTemplate = await external_wp_apiFetch_default()({
- path: fileTemplatePath
- });
- if (!fileTemplate) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
- type: 'snackbar'
- });
- return;
- }
- const serializeBlocks = ({
- blocks: blocksForSerialization = []
- }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
- 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
- // the revert in the header toolbar correctly.
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, {
- content: serializeBlocks,
- // Required to make the `undo` behave correctly.
- blocks: edited.blocks,
- // Required to revert the blocks in the editor.
- source: 'custom' // required to avoid turning the editor into a dirty state
- }, {
- undoIgnore: true // Required to merge this edit with the last undo level.
- });
- const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw);
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, {
- content: serializeBlocks,
- blocks,
- source: 'theme'
- });
- if (allowUndo) {
- const undoRevert = () => {
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, {
- content: serializeBlocks,
- blocks: edited.blocks,
- source: 'custom'
- });
- };
- registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'), {
- type: 'snackbar',
- id: noticeId,
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- onClick: undoRevert
- }]
- });
- }
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.');
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
+ return lock_unlock_unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(template, options);
};
+
/**
* Action that opens an editor sidebar.
*
* @param {?string} name Sidebar name to be opened.
*/
const openGeneralSidebar = name => ({
- dispatch,
registry
}) => {
- const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
- if (isDistractionFree) {
- dispatch.toggleDistractionFree();
- }
- registry.dispatch(store).enableComplementaryArea(constants_STORE_NAME, name);
+ registry.dispatch(interfaceStore).enableComplementaryArea('core', name);
};
/**
@@ -11013,27 +8658,24 @@ const openGeneralSidebar = name => ({
const closeGeneralSidebar = () => ({
registry
}) => {
- registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME);
+ registry.dispatch(interfaceStore).disableComplementaryArea('core');
};
+
+/**
+ * Triggers an action used to switch editor mode.
+ *
+ * @deprecated
+ *
+ * @param {string} mode The editor mode.
+ */
const switchEditorMode = mode => ({
- dispatch,
registry
}) => {
- registry.dispatch('core/preferences').set('core', 'editorMode', mode);
-
- // Unselect blocks when we switch to a non visual mode.
- if (mode !== 'visual') {
- registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
- }
- if (mode === 'visual') {
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive');
- } else if (mode === 'text') {
- const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
- if (isDistractionFree) {
- dispatch.toggleDistractionFree();
- }
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive');
- }
+ external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", {
+ since: '6.6',
+ alternative: "dispatch( 'core/editor').switchEditorMode"
+ });
+ registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode);
};
/**
@@ -11063,267 +8705,92 @@ const setHasPageContentFocus = hasPageContentFocus => ({
* Action that toggles Distraction free mode.
* Distraction free mode expects there are no sidebars, as due to the
* z-index values set, you can't close sidebars.
+ *
+ * @deprecated
*/
const toggleDistractionFree = () => ({
- dispatch,
registry
}) => {
- const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
- if (isDistractionFree) {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false);
- }
- if (!isDistractionFree) {
- registry.batch(() => {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true);
- registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false);
- registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false);
- dispatch.closeGeneralSidebar();
- });
- }
- registry.batch(() => {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree);
- registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), {
- id: 'core/edit-site/distraction-free-mode/notice',
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- onClick: () => {
- registry.batch(() => {
- registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false);
- registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree');
- });
- }
- }]
- });
+ external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", {
+ since: '6.6',
+ alternative: "dispatch( 'core/editor').toggleDistractionFree"
});
+ registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree();
};
-;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
-/**
- * Memize options object.
- *
- * @typedef MemizeOptions
- *
- * @property {number} [maxSize] Maximum size of the cache.
- */
-
-/**
- * Internal cache entry.
- *
- * @typedef MemizeCacheNode
- *
- * @property {?MemizeCacheNode|undefined} [prev] Previous node.
- * @property {?MemizeCacheNode|undefined} [next] Next node.
- * @property {Array<*>} args Function arguments for cache
- * entry.
- * @property {*} val Function result.
- */
-
-/**
- * Properties of the enhanced function for controlling cache.
- *
- * @typedef MemizeMemoizedFunction
- *
- * @property {()=>void} clear Clear the cache.
- */
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
/**
- * Accepts a function to be memoized, and returns a new memoized function, with
- * optional options.
- *
- * @template {(...args: any[]) => any} F
- *
- * @param {F} fn Function to memoize.
- * @param {MemizeOptions} [options] Options object.
- *
- * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
+ * WordPress dependencies
*/
-function memize(fn, options) {
- var size = 0;
-
- /** @type {?MemizeCacheNode|undefined} */
- var head;
-
- /** @type {?MemizeCacheNode|undefined} */
- var tail;
-
- options = options || {};
-
- function memoized(/* ...args */) {
- var node = head,
- len = arguments.length,
- args,
- i;
-
- searchCache: while (node) {
- // Perform a shallow equality test to confirm that whether the node
- // under test is a candidate for the arguments passed. Two arrays
- // are shallowly equal if their length matches and each entry is
- // strictly equal between the two sets. Avoid abstracting to a
- // function which could incur an arguments leaking deoptimization.
-
- // Check whether node arguments match arguments length
- if (node.args.length !== arguments.length) {
- node = node.next;
- continue;
- }
-
- // Check whether node arguments match arguments values
- for (i = 0; i < len; i++) {
- if (node.args[i] !== arguments[i]) {
- node = node.next;
- continue searchCache;
- }
- }
-
- // At this point we can assume we've found a match
-
- // Surface matched node to head if not already
- if (node !== head) {
- // As tail, shift to previous. Must only shift if not also
- // head, since if both head and tail, there is no previous.
- if (node === tail) {
- tail = node.prev;
- }
-
- // Adjust siblings to point to each other. If node was tail,
- // this also handles new tail's empty `next` assignment.
- /** @type {MemizeCacheNode} */ (node.prev).next = node.next;
- if (node.next) {
- node.next.prev = node.prev;
- }
-
- node.next = head;
- node.prev = null;
- /** @type {MemizeCacheNode} */ (head).prev = node;
- head = node;
- }
-
- // Return immediately
- return node.val;
- }
-
- // No cached value found. Continue to insertion phase:
-
- // Create a copy of arguments (avoid leaking deoptimization)
- args = new Array(len);
- for (i = 0; i < len; i++) {
- args[i] = arguments[i];
- }
- node = {
- args: args,
- // Generate the result from original function
- val: fn.apply(null, args),
- };
-
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
-
- // Shift existing head down list
- if (head) {
- head.prev = node;
- node.next = head;
- } else {
- // If no head, follows that there's no tail (at initial or reset)
- tail = node;
- }
-
- // Trim tail if we're reached max size and are pending cache insertion
- if (size === /** @type {MemizeOptions} */ (options).maxSize) {
- tail = /** @type {MemizeCacheNode} */ (tail).prev;
- /** @type {MemizeCacheNode} */ (tail).next = null;
- } else {
- size++;
- }
-
- head = node;
-
- return node.val;
- }
-
- memoized.clear = function () {
- head = null;
- tail = null;
- size = 0;
- };
-
- // Ignore reason: There's not a clear solution to create an intersection of
- // the function with additional properties, where the goal is to retain the
- // function signature of the incoming argument and add control properties
- // on the return value.
-
- // @ts-ignore
- return memoized;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/utils.js
/**
- * External dependencies
+ * Action that switches the canvas mode.
+ *
+ * @param {?string} mode Canvas mode.
*/
+const setCanvasMode = mode => ({
+ registry,
+ dispatch
+}) => {
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
+ const switchCanvasMode = () => {
+ registry.batch(() => {
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
+ registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType('Desktop');
+ registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableSetEditorMode('edit');
+ const isPublishSidebarOpened = registry.select(external_wp_editor_namespaceObject.store).isPublishSidebarOpened();
+ dispatch({
+ type: 'SET_CANVAS_MODE',
+ mode
+ });
+ const isEditMode = mode === 'edit';
+ if (isPublishSidebarOpened && !isEditMode) {
+ registry.dispatch(external_wp_editor_namespaceObject.store).closePublishSidebar();
+ }
+ // Check if the block list view should be open by default.
+ // If `distractionFree` mode is enabled, the block list view should not be open.
+ // This behavior is disabled for small viewports.
+ if (isMediumOrBigger && isEditMode && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
+ registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
+ } else {
+ registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false);
+ }
+ registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false);
+ });
+ };
-/**
- * WordPress dependencies
- */
-
-const EMPTY_ARRAY = [];
+ /*
+ * Skip transition in mobile, otherwise it crashes the browser.
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
+ */
+ if (!isMediumOrBigger || !document.startViewTransition) {
+ switchCanvasMode();
+ } else {
+ document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
+ const transition = document.startViewTransition(() => switchCanvasMode());
+ transition.finished.finally(() => {
+ document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
+ });
+ }
+};
/**
- * Get a flattened and filtered list of template parts and the matching block for that template part.
- *
- * Takes a list of blocks defined within a template, and a list of template parts, and returns a
- * flattened list of template parts and the matching block for that template part.
+ * Action that switches the editor canvas container view.
*
- * @param {Array} blocks Blocks to flatten.
- * @param {?Array} templateParts Available template parts.
- * @return {Array} An array of template parts and their blocks.
- */
-function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
- const templatePartsById = templateParts ?
- // Key template parts by their ID.
- templateParts.reduce((newTemplateParts, part) => ({
- ...newTemplateParts,
- [part.id]: part
- }), {}) : {};
- const result = [];
-
- // Iterate over all blocks, recursing into inner blocks.
- // Output will be based on a depth-first traversal.
- const stack = [...blocks];
- while (stack.length) {
- const {
- innerBlocks,
- ...block
- } = stack.shift();
- // Place inner blocks at the beginning of the stack to preserve order.
- stack.unshift(...innerBlocks);
- if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) {
- const {
- attributes: {
- theme,
- slug
- }
- } = block;
- const templatePartId = `${theme}//${slug}`;
- const templatePart = templatePartsById[templatePartId];
-
- // Only add to output if the found template part block is in the list of available template parts.
- if (templatePart) {
- result.push({
- templatePart,
- block
- });
- }
- }
- }
- return result;
-}
-const memoizedGetFilteredTemplatePartBlocks = memize(getFilteredTemplatePartBlocks);
-
+ * @param {?string} view Editor canvas container view.
+ */
+const setEditorCanvasContainerView = view => ({
+ dispatch
+}) => {
+ dispatch({
+ type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',
+ view
+ });
+};
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
/**
@@ -11336,14 +8803,11 @@ const memoizedGetFilteredTemplatePartBlocks = memize(getFilteredTemplatePartBloc
-
/**
* Internal dependencies
*/
-
-
/**
* @typedef {'template'|'template_type'} TemplateType Template type.
*/
@@ -11357,7 +8821,7 @@ const memoizedGetFilteredTemplatePartBlocks = memize(getFilteredTemplatePartBloc
*
* @return {boolean} Is active.
*/
-const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => {
+const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => {
external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, {
since: '6.0',
alternative: `select( 'core/preferences' ).get`
@@ -11439,7 +8903,7 @@ function getHomeTemplateId() {
*
* @param {Object} state Global application state.
*
- * @return {TemplateType?} Template type.
+ * @return {?TemplateType} Template type.
*/
function getEditedPostType(state) {
return state.editedPost.postType;
@@ -11450,7 +8914,7 @@ function getEditedPostType(state) {
*
* @param {Object} state Global application state.
*
- * @return {string?} Post ID.
+ * @return {?string} Post ID.
*/
function getEditedPostId(state) {
return state.editedPost.id;
@@ -11513,7 +8977,7 @@ const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.crea
since: '6.5',
version: '6.7'
});
- return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint();
+ return lock_unlock_unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint();
});
/**
@@ -11549,12 +9013,7 @@ function isSaveViewOpened(state) {
* @return {Array} Template parts and their blocks in an array.
*/
const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
- const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
- per_page: -1
- });
- const clientIds = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/template-part');
- const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds);
- return memoizedGetFilteredTemplatePartBlocks(blocks, templateParts);
+ return lock_unlock_unlock(select(external_wp_editor_namespaceObject.store)).getCurrentTemplateTemplateParts();
});
/**
@@ -11648,6 +9107,14 @@ function getEditorCanvasContainerView(state) {
return state.editorCanvasContainerView;
}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js
+/**
+ * The identifier for the data store.
+ *
+ * @type {string}
+ */
+const STORE_NAME = 'core/edit-site';
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js
/**
* WordPress dependencies
@@ -11665,3591 +9132,28 @@ function getEditorCanvasContainerView(state) {
const storeConfig = {
- reducer: store_reducer,
- actions: store_actions_namespaceObject,
- selectors: store_selectors_namespaceObject
+ reducer: reducer,
+ actions: actions_namespaceObject,
+ selectors: selectors_namespaceObject
};
-const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig);
-(0,external_wp_data_namespaceObject.register)(store_store);
-unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject);
-unlock(store_store).registerPrivateActions(private_actions_namespaceObject);
+const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig);
+(0,external_wp_data_namespaceObject.register)(store);
+lock_unlock_unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
+lock_unlock_unlock(store).registerPrivateActions(private_actions_namespaceObject);
+;// CONCATENATED MODULE: external ["wp","plugins"]
+const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
+;// CONCATENATED MODULE: external ["wp","router"]
+const external_wp_router_namespaceObject = window["wp"]["router"];
+;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
+function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// CONCATENATED MODULE: external ["wp","commands"]
const external_wp_commands_namespaceObject = window["wp"]["commands"];
;// CONCATENATED MODULE: external ["wp","coreCommands"]
const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
-
-/**
- * WordPress dependencies
- */
-
-const navigation = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
-}));
-/* harmony default export */ const library_navigation = (navigation);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
-
-/**
- * WordPress dependencies
- */
-
-const styles = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_styles = (styles);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
-
-/**
- * WordPress dependencies
- */
-
-const page = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
-}));
-/* harmony default export */ const library_page = (page);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
-
-/**
- * WordPress dependencies
- */
-
-const layout = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_layout = (layout);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
-
-/**
- * WordPress dependencies
- */
-
-const symbol = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 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"
-}));
-/* harmony default export */ const library_symbol = (symbol);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
-
-/**
- * WordPress dependencies
- */
-
-const chevronRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
-}));
-/* harmony default export */ const chevron_right = (chevronRight);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
-
-/**
- * WordPress dependencies
- */
-
-const chevronLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
-}));
-/* harmony default export */ const chevron_left = (chevronLeft);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-function SidebarButton(props) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- ...props,
- className: classnames_default()('edit-site-sidebar-button', props.className)
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-const {
- useLocation: sidebar_navigation_screen_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function SidebarNavigationScreen({
- isRoot,
- title,
- actions,
- meta,
- content,
- footer,
- description,
- backPath: backPathProp
-}) {
- const {
- dashboardLink,
- dashboardLinkText,
- previewingThemeName
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSettings
- } = unlock(select(store_store));
- const currentlyPreviewingThemeId = currentlyPreviewingTheme();
- return {
- dashboardLink: getSettings().__experimentalDashboardLink,
- dashboardLinkText: getSettings().__experimentalDashboardLinkText,
- // Do not call `getTheme` with null, it will cause a request to
- // the server.
- previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined
- };
- }, []);
- const location = sidebar_navigation_screen_useLocation();
- const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: classnames_default()('edit-site-sidebar-navigation-screen__main', {
- 'has-footer': !!footer
- }),
- spacing: 0,
- justify: "flex-start"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 4,
- alignment: "flex-start",
- className: "edit-site-sidebar-navigation-screen__title-icon"
- }, !isRoot && (0,external_React_.createElement)(SidebarButton, {
- onClick: () => {
- const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath;
- if (backPath) {
- navigator.goTo(backPath, {
- isBack: true
- });
- } else {
- navigator.goToParent();
- }
- },
- icon: icon,
- label: (0,external_wp_i18n_namespaceObject.__)('Back'),
- showTooltip: false
- }), isRoot && (0,external_React_.createElement)(SidebarButton, {
- icon: icon,
- label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'),
- href: dashboardLink || 'index.php'
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-sidebar-navigation-screen__title",
- color: '#e0e0e0' /* $gray-200 */,
- level: 1,
- size: 20
- }, !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)('Previewing %1$s: %2$s', previewingThemeName, title)), actions && (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen__actions"
- }, actions)), meta && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen__meta"
- }, meta)), (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen__content"
- }, description && (0,external_React_.createElement)("p", {
- className: "edit-site-sidebar-navigation-screen__description"
- }, description), content)), footer && (0,external_React_.createElement)("footer", {
- className: "edit-site-sidebar-navigation-screen__footer"
- }, footer));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
-/**
- * WordPress dependencies
- */
-
-
-/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
-
-/**
- * Return an SVG icon.
- *
- * @param {IconProps} props icon is the SVG component to render
- * size is a number specifiying the icon size in pixels
- * Other props will be passed to wrapped SVG component
- * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
- *
- * @return {JSX.Element} Icon component
- */
-function icon_Icon({
- icon,
- size = 24,
- ...props
-}, ref) {
- return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
- width: size,
- height: size,
- ...props,
- ref
- });
-}
-/* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(icon_Icon));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
-
-/**
- * WordPress dependencies
- */
-
-const chevronLeftSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
-}));
-/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
-
-/**
- * WordPress dependencies
- */
-
-const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"
-}));
-/* harmony default export */ const chevron_right_small = (chevronRightSmall);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-function SidebarNavigationItem({
- className,
- icon,
- withChevron = false,
- suffix,
- children,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
- className: classnames_default()('edit-site-sidebar-navigation-item', {
- 'with-suffix': !withChevron && suffix
- }, className),
- ...props
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, icon && (0,external_React_.createElement)(build_module_icon, {
- style: {
- fill: 'currentcolor'
- },
- icon: icon,
- size: 24
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, children), withChevron && (0,external_React_.createElement)(build_module_icon, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small,
- className: "edit-site-sidebar-navigation-item__drilldown-indicator",
- size: 24
- }), !withChevron && suffix));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/seen.js
-
-/**
- * WordPress dependencies
- */
-
-const seen = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"
-}));
-/* harmony default export */ const library_seen = (seen);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
-
-/**
- * WordPress dependencies
- */
-
-const pencil = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"
-}));
-/* harmony default export */ const library_pencil = (pencil);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
-/**
- * Internal dependencies
- */
-
-
-/* harmony default export */ const edit = (library_pencil);
-
-;// CONCATENATED MODULE: external ["wp","keycodes"]
-const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
-// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
-var cjs = __webpack_require__(66);
-var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
-;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
-/*!
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
-
-function isObject(o) {
- return Object.prototype.toString.call(o) === '[object Object]';
-}
-
-function isPlainObject(o) {
- var ctor,prot;
-
- if (isObject(o) === false) return false;
-
- // If has modified constructor
- ctor = o.constructor;
- if (ctor === undefined) return true;
-
- // If has modified prototype
- prot = ctor.prototype;
- if (isObject(prot) === false) return false;
-
- // If constructor does not have an Object-specific method
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
- return false;
- }
-
- // Most likely a plain Object
- return true;
-}
-
-
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/global-styles-provider.js
-
-/**
- * External dependencies
- */
-
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const {
- GlobalStylesContext: global_styles_provider_GlobalStylesContext,
- cleanEmptyObject: global_styles_provider_cleanEmptyObject
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function mergeBaseAndUserConfigs(base, user) {
- return cjs_default()(base, user, {
- // We only pass as arrays the presets,
- // in which case we want the new array of values
- // to override the old array (no merging).
- isMergeableObject: isPlainObject
- });
-}
-function useGlobalStylesUserConfig() {
- const {
- globalStylesId,
- isReady,
- settings,
- styles
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedEntityRecord,
- hasFinishedResolution
- } = select(external_wp_coreData_namespaceObject.store);
- const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId();
- const record = _globalStylesId ? getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
- let hasResolved = false;
- if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) {
- hasResolved = _globalStylesId ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : true;
- }
- return {
- globalStylesId: _globalStylesId,
- isReady: hasResolved,
- settings: record?.settings,
- styles: record?.styles
- };
- }, []);
- const {
- getEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return {
- settings: settings !== null && settings !== void 0 ? settings : {},
- styles: styles !== null && styles !== void 0 ? styles : {}
- };
- }, [settings, styles]);
- const setConfig = (0,external_wp_element_namespaceObject.useCallback)((callback, options = {}) => {
- var _record$styles, _record$settings;
- const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
- const currentConfig = {
- styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
- settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}
- };
- const updatedConfig = callback(currentConfig);
- editEntityRecord('root', 'globalStyles', globalStylesId, {
- styles: global_styles_provider_cleanEmptyObject(updatedConfig.styles) || {},
- settings: global_styles_provider_cleanEmptyObject(updatedConfig.settings) || {}
- }, options);
- }, [globalStylesId]);
- return [isReady, config, setConfig];
-}
-function useGlobalStylesBaseConfig() {
- const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles();
- }, []);
- return [!!baseConfig, baseConfig];
-}
-function useGlobalStylesContext() {
- const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
- const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
- const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!baseConfig || !userConfig) {
- return {};
- }
- return mergeBaseAndUserConfigs(baseConfig, userConfig);
- }, [userConfig, baseConfig]);
- const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return {
- isReady: isUserConfigReady && isBaseConfigReady,
- user: userConfig,
- base: baseConfig,
- merged: mergedConfig,
- setUserConfig
- };
- }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
- return context;
-}
-function GlobalStylesProvider({
- children
-}) {
- const context = useGlobalStylesContext();
- if (!context.isReady) {
- return null;
- }
- return (0,external_React_.createElement)(global_styles_provider_GlobalStylesContext.Provider, {
- value: context
- }, children);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- useGlobalStyle: preview_useGlobalStyle,
- useGlobalStylesOutput
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const firstFrame = {
- start: {
- scale: 1,
- opacity: 1
- },
- hover: {
- scale: 0,
- opacity: 0
- }
-};
-const midFrame = {
- hover: {
- opacity: 1
- },
- start: {
- opacity: 0.5
- }
-};
-const secondFrame = {
- hover: {
- scale: 1,
- opacity: 1
- },
- start: {
- scale: 0,
- opacity: 0
- }
-};
-const normalizedWidth = 248;
-const normalizedHeight = 152;
-const normalizedColorSwatchSize = 32;
-
-// Throttle options for useThrottle. Must be defined outside of the component,
-// so that the object reference is the same on each render.
-const THROTTLE_OPTIONS = {
- leading: true,
- trailing: true
-};
-const StylesPreview = ({
- label,
- isFocused,
- withHoverView
-}) => {
- const [fontWeight] = preview_useGlobalStyle('typography.fontWeight');
- const [fontFamily = 'serif'] = preview_useGlobalStyle('typography.fontFamily');
- const [headingFontFamily = fontFamily] = preview_useGlobalStyle('elements.h1.typography.fontFamily');
- const [headingFontWeight = fontWeight] = preview_useGlobalStyle('elements.h1.typography.fontWeight');
- const [textColor = 'black'] = preview_useGlobalStyle('color.text');
- const [headingColor = textColor] = preview_useGlobalStyle('elements.h1.color.text');
- const [backgroundColor = 'white'] = preview_useGlobalStyle('color.background');
- const [gradientValue] = preview_useGlobalStyle('color.gradient');
- const [styles] = useGlobalStylesOutput();
- const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
- const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
- const [containerResizeListener, {
- width
- }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
- const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width);
- const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)();
- const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS);
-
- // Must use useLayoutEffect to avoid a flash of the iframe at the wrong
- // size before the width is set.
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
- if (width) {
- setThrottledWidth(width);
- }
- }, [width, setThrottledWidth]);
-
- // Must use useLayoutEffect to avoid a flash of the iframe at the wrong
- // size before the width is set.
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
- const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
- const ratioDiff = newRatio - (ratioState || 0);
-
- // Only update the ratio state if the difference is big enough
- // or if the ratio state is not yet set. This is to avoid an
- // endless loop of updates at particular viewport heights when the
- // presence of a scrollbar causes the width to change slightly.
- const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
- if (isRatioDiffBigEnough || !ratioState) {
- setRatioState(newRatio);
- }
- }, [throttledWidth, ratioState]);
-
- // Set a fallbackRatio to use before the throttled ratio has been set.
- const fallbackRatio = width ? width / normalizedWidth : 1;
- // Use the throttled ratio if it has been calculated, otherwise
- // use the fallback ratio. The throttled ratio is used to avoid
- // an endless loop of updates at particular viewport heights.
- // See: https://github.com/WordPress/gutenberg/issues/55112
- const ratio = ratioState ? ratioState : fallbackRatio;
- const {
- paletteColors,
- highlightedColors
- } = useStylesPreviewColors();
-
- // Reset leaked styles from WP common.css and remove main content layout padding and border.
- const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (styles) {
- return [...styles, {
- css: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}',
- isGlobalStyles: true
- }];
- }
- return styles;
- }, [styles]);
- const isReady = !!width;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- style: {
- position: 'relative'
- }
- }, containerResizeListener), isReady && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
- className: "edit-site-global-styles-preview__iframe",
- style: {
- width: '100%',
- height: normalizedHeight * ratio
- },
- onMouseEnter: () => setIsHovered(true),
- onMouseLeave: () => setIsHovered(false),
- tabIndex: -1
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
- styles: editorStyles
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- style: {
- height: normalizedHeight * ratio,
- width: '100%',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
- cursor: withHoverView ? 'pointer' : undefined
- },
- initial: "start",
- animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start'
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- variants: firstFrame,
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 10 * ratio,
- justify: "center",
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- style: {
- fontFamily: headingFontFamily,
- fontSize: 65 * ratio,
- color: headingColor,
- fontWeight: headingFontWeight
- },
- animate: {
- scale: 1,
- opacity: 1
- },
- initial: {
- scale: 0.1,
- opacity: 0
- },
- transition: {
- delay: 0.3,
- type: 'tween'
- }
- }, "Aa"), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 4 * ratio
- }, highlightedColors.map(({
- slug,
- color
- }, index) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- key: slug,
- style: {
- height: normalizedColorSwatchSize * ratio,
- width: normalizedColorSwatchSize * ratio,
- background: color,
- borderRadius: normalizedColorSwatchSize * ratio / 2
- },
- animate: {
- scale: 1,
- opacity: 1
- },
- initial: {
- scale: 0.1,
- opacity: 0
- },
- transition: {
- delay: index === 1 ? 0.2 : 0.1
- }
- }))))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- variants: withHoverView && midFrame,
- style: {
- height: '100%',
- width: '100%',
- position: 'absolute',
- top: 0,
- overflow: 'hidden',
- filter: 'blur(60px)',
- opacity: 0.1
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 0,
- justify: "flex-start",
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, paletteColors.slice(0, 4).map(({
- color
- }, index) => (0,external_React_.createElement)("div", {
- key: index,
- style: {
- height: '100%',
- background: color,
- flexGrow: 1
- }
- })))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- variants: secondFrame,
- style: {
- height: '100%',
- width: '100%',
- overflow: 'hidden',
- position: 'absolute',
- top: 0
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3 * ratio,
- justify: "center",
- style: {
- height: '100%',
- overflow: 'hidden',
- padding: 10 * ratio,
- boxSizing: 'border-box'
- }
- }, label && (0,external_React_.createElement)("div", {
- style: {
- fontSize: 40 * ratio,
- fontFamily: headingFontFamily,
- color: headingColor,
- fontWeight: headingFontWeight,
- lineHeight: '1em',
- textAlign: 'center'
- }
- }, label))))));
-};
-/* harmony default export */ const preview = (StylesPreview);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- GlobalStylesContext: style_variations_container_GlobalStylesContext,
- areGlobalStyleConfigsEqual
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function Variation({
- variation
-}) {
- const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- base,
- user,
- setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext);
- const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
- var _variation$settings, _variation$styles;
- return {
- user: {
- settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
- styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
- },
- base,
- merged: mergeBaseAndUserConfigs(base, variation),
- setUserConfig: () => {}
- };
- }, [variation, base]);
- const selectVariation = () => {
- setUserConfig(() => {
- return {
- settings: variation.settings,
- styles: variation.styles
- };
- });
- };
- const selectOnEnter = event => {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
- event.preventDefault();
- selectVariation();
- }
- };
- const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return areGlobalStyleConfigsEqual(user, variation);
- }, [user, variation]);
- let label = variation?.title;
- if (variation?.description) {
- label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: variation title. %2$s variation description. */
- (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), variation?.title, variation?.description);
- }
- return (0,external_React_.createElement)(style_variations_container_GlobalStylesContext.Provider, {
- value: context
- }, (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-global-styles-variations_item', {
- 'is-active': isActive
- }),
- role: "button",
- onClick: selectVariation,
- onKeyDown: selectOnEnter,
- tabIndex: "0",
- "aria-label": label,
- "aria-current": isActive,
- onFocus: () => setIsFocused(true),
- onBlur: () => setIsFocused(false)
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-variations_item-preview"
- }, (0,external_React_.createElement)(preview, {
- label: variation?.title,
- isFocused: isFocused,
- withHoverView: true
- }))));
-}
-function StyleVariationsContainer() {
- const variations = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations();
- }, []);
- const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return [{
- title: (0,external_wp_i18n_namespaceObject.__)('Default'),
- settings: {},
- styles: {}
- }, ...(variations !== null && variations !== void 0 ? variations : []).map(variation => {
- var _variation$settings2, _variation$styles2;
- return {
- ...variation,
- settings: (_variation$settings2 = variation.settings) !== null && _variation$settings2 !== void 0 ? _variation$settings2 : {},
- styles: (_variation$styles2 = variation.styles) !== null && _variation$styles2 !== void 0 ? _variation$styles2 : {}
- };
- })];
- }, [variations]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
- columns: 2,
- className: "edit-site-global-styles-style-variations-container"
- }, withEmptyVariation.map((variation, index) => (0,external_React_.createElement)(Variation, {
- key: index,
- variation: variation
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resize-handle.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
-
-function ResizeHandle({
- variation = 'default',
- direction,
- resizeWidthBy
-}) {
- function handleKeyDown(event) {
- const {
- keyCode
- } = event;
- if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
- resizeWidthBy(DELTA_DISTANCE);
- } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) {
- resizeWidthBy(-DELTA_DISTANCE);
- }
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("button", {
- className: `resizable-editor__drag-handle is-${direction} is-variation-${variation}`,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
- "aria-describedby": `resizable-editor__resize-help-${direction}`,
- onKeyDown: handleKeyDown,
- type: "button"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- id: `resizable-editor__resize-help-${direction}`
- }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.')));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resizable-editor.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-// Removes the inline styles in the drag handles.
-const HANDLE_STYLES_OVERRIDE = {
- position: undefined,
- userSelect: undefined,
- cursor: undefined,
- width: undefined,
- height: undefined,
- top: undefined,
- right: undefined,
- bottom: undefined,
- left: undefined
-};
-function ResizableEditor({
- enableResizing,
- height,
- children
-}) {
- const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)('100%');
- const resizableRef = (0,external_wp_element_namespaceObject.useRef)();
- const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => {
- if (resizableRef.current) {
- setWidth(resizableRef.current.offsetWidth + deltaPixels);
- }
- }, []);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.ResizableBox, {
- ref: api => {
- resizableRef.current = api?.resizable;
- },
- size: {
- width: enableResizing ? width : '100%',
- height: enableResizing && height ? height : '100%'
- },
- onResizeStop: (event, direction, element) => {
- setWidth(element.style.width);
- },
- minWidth: 300,
- maxWidth: "100%",
- maxHeight: "100%",
- enable: {
- left: enableResizing,
- right: enableResizing
- },
- showHandle: enableResizing
- // The editor is centered horizontally, resizing it only
- // moves half the distance. Hence double the ratio to correctly
- // align the cursor to the resizer handle.
- ,
- resizeRatio: 2,
- handleComponent: {
- left: (0,external_React_.createElement)(ResizeHandle, {
- direction: "left",
- resizeWidthBy: resizeWidthBy
- }),
- right: (0,external_React_.createElement)(ResizeHandle, {
- direction: "right",
- resizeWidthBy: resizeWidthBy
- })
- },
- handleClasses: undefined,
- handleStyles: {
- left: HANDLE_STYLES_OVERRIDE,
- right: HANDLE_STYLES_OVERRIDE
- }
- }, children);
-}
-/* harmony default export */ const resizable_editor = (ResizableEditor);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-/**
- * Returns a translated string for the title of the editor canvas container.
- *
- * @param {string} view Editor canvas container view.
- *
- * @return {string} Translated string corresponding to value of view. Default is ''.
- */
-function getEditorCanvasContainerTitle(view) {
- switch (view) {
- case 'style-book':
- return (0,external_wp_i18n_namespaceObject.__)('Style Book');
- case 'global-styles-revisions':
- case 'global-styles-revisions:style-book':
- return (0,external_wp_i18n_namespaceObject.__)('Style Revisions');
- default:
- return '';
- }
-}
-
-// Creates a private slot fill.
-const {
- createPrivateSlotFill
-} = unlock(external_wp_components_namespaceObject.privateApis);
-const SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';
-const {
- privateKey,
- Slot: EditorCanvasContainerSlot,
- Fill: EditorCanvasContainerFill
-} = createPrivateSlotFill(SLOT_FILL_NAME);
-function EditorCanvasContainer({
- children,
- closeButtonLabel,
- onClose,
- enableResizing = false
-}) {
- const {
- editorCanvasContainerView,
- showListViewByDefault
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const _editorCanvasContainerView = unlock(select(store_store)).getEditorCanvasContainerView();
- const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault');
- return {
- editorCanvasContainerView: _editorCanvasContainerView,
- showListViewByDefault: _showListViewByDefault
- };
- }, []);
- const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const {
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
- const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
- const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
- const title = (0,external_wp_element_namespaceObject.useMemo)(() => getEditorCanvasContainerTitle(editorCanvasContainerView), [editorCanvasContainerView]);
- function onCloseContainer() {
- setIsListViewOpened(showListViewByDefault);
- setEditorCanvasContainerView(undefined);
- setIsClosed(true);
- if (typeof onClose === 'function') {
- onClose();
- }
- }
- function closeOnEscape(event) {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
- event.preventDefault();
- onCloseContainer();
- }
- }
- const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, {
- ref: sectionFocusReturnRef
- }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, {
- ref: sectionFocusReturnRef
- });
- if (isClosed) {
- return null;
- }
- const shouldShowCloseButton = onClose || closeButtonLabel;
- return (0,external_React_.createElement)(EditorCanvasContainerFill, null, (0,external_React_.createElement)(resizable_editor, {
- enableResizing: enableResizing
- }, (0,external_React_.createElement)("section", {
- className: "edit-site-editor-canvas-container",
- ref: shouldShowCloseButton ? focusOnMountRef : null,
- onKeyDown: closeOnEscape,
- "aria-label": title
- }, shouldShowCloseButton && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-editor-canvas-container__close-button",
- icon: close_small,
- label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'),
- onClick: onCloseContainer,
- showTooltip: false
- }), childrenWithProps)));
-}
-function useHasEditorCanvasContainer() {
- const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(privateKey);
- return !!fills?.length;
-}
-EditorCanvasContainer.Slot = EditorCanvasContainerSlot;
-/* harmony default export */ const editor_canvas_container = (EditorCanvasContainer);
-
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- ExperimentalBlockEditorProvider,
- useGlobalStyle: style_book_useGlobalStyle,
- GlobalStylesContext: style_book_GlobalStylesContext,
- useGlobalStylesOutputWithConfig
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const {
- CompositeV2: Composite,
- CompositeItemV2: CompositeItem,
- useCompositeStoreV2: useCompositeStore,
- Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
-
-// The content area of the Style Book is rendered within an iframe so that global styles
-// are applied to elements within the entire content area. To support elements that are
-// not part of the block previews, such as headings and layout for the block previews,
-// additional CSS rules need to be passed into the iframe. These are hard-coded below.
-// Note that button styles are unset, and then focus rules from the `Button` component are
-// applied to the `button` element, targeted via `.edit-site-style-book__example`.
-// This is to ensure that browser default styles for buttons are not applied to the previews.
-const STYLE_BOOK_IFRAME_STYLES = `
- .edit-site-style-book__examples {
- max-width: 900px;
- margin: 0 auto;
- }
-
- .edit-site-style-book__example {
- border-radius: 2px;
- cursor: pointer;
- display: flex;
- flex-direction: column;
- gap: 40px;
- margin-bottom: 40px;
- padding: 16px;
- width: 100%;
- box-sizing: border-box;
- scroll-margin-top: 32px;
- scroll-margin-bottom: 32px;
- }
-
- .edit-site-style-book__example.is-selected {
- box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
- }
-
- .edit-site-style-book__example:focus:not(:disabled) {
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
- outline: 3px solid transparent;
- }
-
- .edit-site-style-book__examples.is-wide .edit-site-style-book__example {
- flex-direction: row;
- }
-
- .edit-site-style-book__example-title {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
- font-size: 11px;
- font-weight: 500;
- line-height: normal;
- margin: 0;
- text-align: left;
- text-transform: uppercase;
- }
-
- .edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {
- text-align: right;
- width: 120px;
- }
-
- .edit-site-style-book__example-preview {
- width: 100%;
- }
-
- .edit-site-style-book__example-preview .block-editor-block-list__insertion-point,
- .edit-site-style-book__example-preview .block-list-appender {
- display: none;
- }
-
- .edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {
- margin-top: 0;
- }
- .edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {
- margin-bottom: 0;
- }
-`;
-function isObjectEmpty(object) {
- return !object || Object.keys(object).length === 0;
-}
-function getExamples() {
- // Use our own example for the Heading block so that we can show multiple
- // heading levels.
- const headingsExample = {
- name: 'core/heading',
- title: (0,external_wp_i18n_namespaceObject.__)('Headings'),
- category: 'text',
- blocks: [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
- content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
- level: 1
- }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
- content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
- level: 2
- }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
- content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
- level: 3
- }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
- content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
- level: 4
- }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
- content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
- level: 5
- })]
- };
- const otherExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => {
- const {
- name,
- example,
- supports
- } = blockType;
- return name !== 'core/heading' && !!example && supports.inserter !== false;
- }).map(blockType => ({
- name: blockType.name,
- title: blockType.title,
- category: blockType.category,
- blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, blockType.example)
- }));
- return [headingsExample, ...otherExamples];
-}
-function StyleBook({
- enableResizing = true,
- isSelected,
- onClick,
- onSelect,
- showCloseButton = true,
- onClose,
- showTabs = true,
- userConfig = {}
-}) {
- const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
- const [textColor] = style_book_useGlobalStyle('color.text');
- const [backgroundColor] = style_book_useGlobalStyle('color.background');
- const examples = (0,external_wp_element_namespaceObject.useMemo)(getExamples, []);
- const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_blocks_namespaceObject.getCategories)().filter(category => examples.some(example => example.category === category.slug)).map(category => ({
- name: category.slug,
- title: category.title,
- icon: category.icon
- })), [examples]);
- const {
- base: baseConfig
- } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext);
- const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
- return mergeBaseAndUserConfigs(baseConfig, userConfig);
- }
- return {};
- }, [baseConfig, userConfig]);
-
- // Copied from packages/edit-site/src/components/revisions/index.js
- // could we create a shared hook?
- const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []);
- const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
- ...originalSettings,
- __unstableIsPreviewMode: true
- }), [originalSettings]);
- const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
- settings.styles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles;
- return (0,external_React_.createElement)(editor_canvas_container, {
- onClose: onClose,
- enableResizing: enableResizing,
- closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close Style Book') : null
- }, (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-style-book', {
- 'is-wide': sizes.width > 600,
- 'is-button': !!onClick
- }),
- style: {
- color: textColor,
- background: backgroundColor
- }
- }, resizeObserver, showTabs ? (0,external_React_.createElement)("div", {
- className: "edit-site-style-book__tabs"
- }, (0,external_React_.createElement)(Tabs, null, (0,external_React_.createElement)(Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(Tabs.Tab, {
- tabId: tab.name,
- key: tab.name
- }, tab.title))), tabs.map(tab => (0,external_React_.createElement)(Tabs.TabPanel, {
- key: tab.name,
- tabId: tab.name,
- focusable: false
- }, (0,external_React_.createElement)(StyleBookBody, {
- category: tab.name,
- examples: examples,
- isSelected: isSelected,
- onSelect: onSelect,
- settings: settings,
- sizes: sizes,
- title: tab.title
- }))))) : (0,external_React_.createElement)(StyleBookBody, {
- examples: examples,
- isSelected: isSelected,
- onClick: onClick,
- onSelect: onSelect,
- settings: settings,
- sizes: sizes
- })));
-}
-const StyleBookBody = ({
- category,
- examples,
- isSelected,
- onClick,
- onSelect,
- settings,
- sizes,
- title
-}) => {
- const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
-
- // The presence of an `onClick` prop indicates that the Style Book is being used as a button.
- // In this case, add additional props to the iframe to make it behave like a button.
- const buttonModeProps = {
- role: 'button',
- onFocus: () => setIsFocused(true),
- onBlur: () => setIsFocused(false),
- onKeyDown: event => {
- if (event.defaultPrevented) {
- return;
- }
- const {
- keyCode
- } = event;
- if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) {
- event.preventDefault();
- onClick(event);
- }
- },
- onClick: event => {
- if (event.defaultPrevented) {
- return;
- }
- if (onClick) {
- event.preventDefault();
- onClick(event);
- }
- },
- readonly: true
- };
- const buttonModeStyles = onClick ? 'body { cursor: pointer; } body * { pointer-events: none; }' : '';
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
- className: classnames_default()('edit-site-style-book__iframe', {
- 'is-focused': isFocused && !!onClick,
- 'is-button': !!onClick
- }),
- name: "style-book-canvas",
- tabIndex: 0,
- ...(onClick ? buttonModeProps : {})
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
- styles: settings.styles
- }), (0,external_React_.createElement)("style", null,
- // Forming a "block formatting context" to prevent margin collapsing.
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
- `.is-root-container { display: flow-root; }
- body { position: relative; padding: 32px !important; }` + STYLE_BOOK_IFRAME_STYLES + buttonModeStyles), (0,external_React_.createElement)(Examples, {
- className: classnames_default()('edit-site-style-book__examples', {
- 'is-wide': sizes.width > 600
- }),
- examples: examples,
- category: category,
- label: title ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Category of blocks, e.g. Text.
- (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'),
- isSelected: isSelected,
- onSelect: onSelect,
- key: category
- }));
-};
-const Examples = (0,external_wp_element_namespaceObject.memo)(({
- className,
- examples,
- category,
- label,
- isSelected,
- onSelect
-}) => {
- const compositeStore = useCompositeStore({
- orientation: 'vertical'
- });
- return (0,external_React_.createElement)(Composite, {
- store: compositeStore,
- className: className,
- "aria-label": label,
- role: "grid"
- }, examples.filter(example => category ? example.category === category : true).map(example => (0,external_React_.createElement)(Example, {
- key: example.name,
- id: `example-${example.name}`,
- title: example.title,
- blocks: example.blocks,
- isSelected: isSelected(example.name),
- onClick: () => {
- onSelect?.(example.name);
- }
- })));
-});
-const Example = ({
- id,
- title,
- blocks,
- isSelected,
- onClick
-}) => {
- const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []);
- const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
- ...originalSettings,
- focusMode: false,
- // Disable "Spotlight mode".
- __unstableIsPreviewMode: true
- }), [originalSettings]);
-
- // Cache the list of blocks to avoid additional processing when the component is re-rendered.
- const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
- return (0,external_React_.createElement)("div", {
- role: "row"
- }, (0,external_React_.createElement)("div", {
- role: "gridcell"
- }, (0,external_React_.createElement)(CompositeItem, {
- className: classnames_default()('edit-site-style-book__example', {
- 'is-selected': isSelected
- }),
- id: id,
- "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Title of a block, e.g. Heading.
- (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title),
- render: (0,external_React_.createElement)("div", null),
- role: "button",
- onClick: onClick
- }, (0,external_React_.createElement)("span", {
- className: "edit-site-style-book__example-title"
- }, title), (0,external_React_.createElement)("div", {
- className: "edit-site-style-book__example-preview",
- "aria-hidden": true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Disabled, {
- className: "edit-site-style-book__example-preview__content"
- }, (0,external_React_.createElement)(ExperimentalBlockEditorProvider, {
- value: renderedBlocks,
- settings: settings
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
- renderAppender: false
- })))))));
-};
-/* harmony default export */ const style_book = (StyleBook);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const SITE_EDITOR_AUTHORS_QUERY = {
- per_page: -1,
- _fields: 'id,name,avatar_urls',
- context: 'view',
- capabilities: ['edit_theme_options']
-};
-const DEFAULT_QUERY = {
- per_page: 100,
- page: 1
-};
-const use_global_styles_revisions_EMPTY_ARRAY = [];
-const {
- GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function useGlobalStylesRevisions({
- query
-} = {}) {
- const {
- user: userConfig
- } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext);
- const _query = {
- ...DEFAULT_QUERY,
- ...query
- };
- const {
- authors,
- currentUser,
- isDirty,
- revisions,
- isLoadingGlobalStylesRevisions,
- revisionsCount
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _globalStyles$_links$;
- const {
- __experimentalGetDirtyEntityRecords,
- getCurrentUser,
- getUsers,
- getRevisions,
- __experimentalGetCurrentGlobalStylesId,
- getEntityRecord,
- isResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- const _currentUser = getCurrentUser();
- const _isDirty = dirtyEntityRecords.length > 0;
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
- const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
- const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0;
- const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY;
- const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY;
- const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]);
- return {
- authors: _authors,
- currentUser: _currentUser,
- isDirty: _isDirty,
- revisions: globalStylesRevisions,
- isLoadingGlobalStylesRevisions: _isResolving,
- revisionsCount: _revisionsCount
- };
- }, [query]);
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!authors.length || isLoadingGlobalStylesRevisions) {
- return {
- revisions: use_global_styles_revisions_EMPTY_ARRAY,
- hasUnsavedChanges: isDirty,
- isLoading: true,
- revisionsCount
- };
- }
-
- // Adds author details to each revision.
- const _modifiedRevisions = revisions.map(revision => {
- return {
- ...revision,
- author: authors.find(author => author.id === revision.author)
- };
- });
- const fetchedRevisionsCount = revisions.length;
- if (fetchedRevisionsCount) {
- // Flags the most current saved revision.
- if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) {
- _modifiedRevisions[0].isLatest = true;
- }
-
- // Adds an item for unsaved changes.
- if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
- const unsavedRevision = {
- id: 'unsaved',
- styles: userConfig?.styles,
- settings: userConfig?.settings,
- author: {
- name: currentUser?.name,
- avatar_urls: currentUser?.avatar_urls
- },
- modified: new Date()
- };
- _modifiedRevisions.unshift(unsavedRevision);
- }
- if (_query.page === Math.ceil(revisionsCount / _query.per_page)) {
- // Adds an item for the default theme styles.
- _modifiedRevisions.push({
- id: 'parent',
- styles: {},
- settings: {}
- });
- }
- }
- return {
- revisions: _modifiedRevisions,
- hasUnsavedChanges: isDirty,
- isLoading: false,
- revisionsCount
- };
- }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]);
-}
-
-;// CONCATENATED MODULE: external ["wp","date"]
-const external_wp_date_namespaceObject = window["wp"]["date"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
-
-/**
- * WordPress dependencies
- */
-
-const backup = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
-}));
-/* harmony default export */ const library_backup = (backup);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
-
-/**
- * WordPress dependencies
- */
-
-function SidebarNavigationScreenDetailsPanelLabel({
- children
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "edit-site-sidebar-navigation-details-screen-panel__label"
- }, children);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-function SidebarNavigationScreenDetailsPanelRow({
- label,
- children,
- className,
- ...extraProps
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- key: label,
- spacing: 5,
- alignment: "left",
- className: classnames_default()('edit-site-sidebar-navigation-details-screen-panel__row', className),
- ...extraProps
- }, children);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
-
-/**
- * WordPress dependencies
- */
-
-function SidebarNavigationScreenDetailsPanelValue({
- children
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "edit-site-sidebar-navigation-details-screen-panel__value"
- }, children);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-function SidebarNavigationScreenDetailsPanel({
- title,
- children,
- spacing
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-sidebar-navigation-details-screen-panel",
- spacing: spacing
- }, title && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-sidebar-navigation-details-screen-panel__heading",
- level: 2
- }, title), children);
-}
-
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function SidebarNavigationScreenDetailsFooter({
- record,
- ...otherProps
-}) {
- /*
- * There might be other items in the future,
- * but for now it's just modified date.
- * Later we might render a list of items and isolate
- * the following logic.
- */
- const hrefProps = {};
- if (record?._links?.['predecessor-version']?.[0]?.id) {
- hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
- revision: record?._links['predecessor-version'][0].id
- });
- hrefProps.as = 'a';
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- className: "edit-site-sidebar-navigation-screen-details-footer"
- }, (0,external_React_.createElement)(SidebarNavigationItem, {
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Revisions'),
- ...hrefProps,
- ...otherProps
- }, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, {
- justify: "space-between"
- }, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelLabel, null, (0,external_wp_i18n_namespaceObject.__)('Last modified')), (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelValue, null, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the relative time when the post was last modified. */
- (0,external_wp_i18n_namespaceObject.__)('<time>%s</time>'), (0,external_wp_date_namespaceObject.humanTimeDiff)(record.modified)), {
- time: (0,external_React_.createElement)("time", {
- dateTime: record.modified
- })
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- className: "edit-site-sidebar-navigation-screen-details-footer__icon",
- icon: library_backup
- }))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-
-const sidebar_navigation_screen_global_styles_noop = () => {};
-function SidebarNavigationItemGlobalStyles(props) {
- const {
- openGeneralSidebar
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const hasGlobalStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
- if (hasGlobalStyleVariations) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- ...props,
- as: SidebarNavigationItem,
- path: "/wp_global_styles"
- });
- }
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- ...props,
- onClick: () => {
- // Switch to edit mode.
- setCanvasMode('edit');
- // Open global styles sidebar.
- openGeneralSidebar('edit-site/global-styles');
- }
- });
-}
-function SidebarNavigationScreenGlobalStylesContent() {
- const {
- storedSettings
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSettings
- } = unlock(select(store_store));
- return {
- storedSettings: getSettings()
- };
- }, []);
-
- // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
- // loaded. This is necessary because the Iframe component waits until
- // the block editor store's `__internalIsInitialized` is true before
- // rendering the iframe. Without this, the iframe previews will not render
- // in mobile viewport sizes, where the editor canvas is hidden.
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
- settings: storedSettings,
- onChange: sidebar_navigation_screen_global_styles_noop,
- onInput: sidebar_navigation_screen_global_styles_noop
- }, (0,external_React_.createElement)(StyleVariationsContainer, null));
-}
-function SidebarNavigationScreenGlobalStyles() {
- const {
- revisions,
- isLoading: isLoadingRevisions
- } = useGlobalStylesRevisions();
- const {
- openGeneralSidebar
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const {
- setCanvasMode,
- setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const {
- isViewMode,
- isStyleBookOpened,
- revisionsCount
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _globalStyles$_links$;
- const {
- getCanvasMode,
- getEditorCanvasContainerView
- } = unlock(select(store_store));
- const {
- getEntityRecord,
- __experimentalGetCurrentGlobalStylesId
- } = select(external_wp_coreData_namespaceObject.store);
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
- const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
- return {
- isViewMode: 'view' === getCanvasMode(),
- isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
- revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
- };
- }, []);
- const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => {
- return Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
- }, [setCanvasMode, openGeneralSidebar]);
- const openStyleBook = (0,external_wp_element_namespaceObject.useCallback)(async () => {
- await openGlobalStyles();
- // Open the Style Book once the canvas mode is set to edit,
- // and the global styles sidebar is open. This ensures that
- // the Style Book is not prematurely closed.
- setEditorCanvasContainerView('style-book');
- setIsListViewOpened(false);
- }, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]);
- const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => {
- await openGlobalStyles();
- // Open the global styles revisions once the canvas mode is set to edit,
- // and the global styles sidebar is open. The global styles UI is responsible
- // for redirecting to the revisions screen once the editor canvas container
- // has been set to 'global-styles-revisions'.
- setEditorCanvasContainerView('global-styles-revisions');
- }, [openGlobalStyles, setEditorCanvasContainerView]);
-
- // If there are no revisions, do not render a footer.
- const hasRevisions = revisionsCount > 0;
- const modifiedDateTime = revisions?.[0]?.modified;
- const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
- description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'),
- content: (0,external_React_.createElement)(SidebarNavigationScreenGlobalStylesContent, null),
- footer: shouldShowGlobalStylesFooter && (0,external_React_.createElement)(SidebarNavigationScreenDetailsFooter, {
- record: revisions?.[0],
- onClick: openRevisions
- }),
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, !isMobileViewport && (0,external_React_.createElement)(SidebarButton, {
- icon: library_seen,
- label: (0,external_wp_i18n_namespaceObject.__)('Style Book'),
- onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
- isPressed: isStyleBookOpened
- }), (0,external_React_.createElement)(SidebarButton, {
- icon: edit,
- label: (0,external_wp_i18n_namespaceObject.__)('Edit styles'),
- onClick: async () => await openGlobalStyles()
- }))
- }), isStyleBookOpened && !isMobileViewport && isViewMode && (0,external_React_.createElement)(style_book, {
- enableResizing: false,
- isSelected: () => false,
- onClick: openStyleBook,
- onSelect: openStyleBook,
- showCloseButton: false,
- showTabs: false
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/template-part-hint.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-const PREFERENCE_NAME = 'isTemplatePartMoveHintVisible';
-function TemplatePartHint() {
- const showTemplatePartHint = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _select$get;
- return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
- }, []);
- const {
- set: setPreference
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- if (!showTemplatePartHint) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- politeness: "polite",
- className: "edit-site-sidebar__notice",
- onRemove: () => {
- setPreference('core', PREFERENCE_NAME, false);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Looking for template parts? Find them in "Patterns".'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-function SidebarNavigationScreenMain() {
- const {
- location
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
-
- // Clear the editor canvas container view when accessing the main navigation screen.
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (location?.path === '/') {
- setEditorCanvasContainerView(undefined);
- }
- }, [setEditorCanvasContainerView, location?.path]);
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- isRoot: true,
- title: (0,external_wp_i18n_namespaceObject.__)('Design'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- as: SidebarNavigationItem,
- path: "/navigation",
- withChevron: true,
- icon: library_navigation
- }, (0,external_wp_i18n_namespaceObject.__)('Navigation')), (0,external_React_.createElement)(SidebarNavigationItemGlobalStyles, {
- withChevron: true,
- icon: library_styles
- }, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- as: SidebarNavigationItem,
- path: "/page",
- withChevron: true,
- icon: library_page
- }, (0,external_wp_i18n_namespaceObject.__)('Pages')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- as: SidebarNavigationItem,
- path: "/wp_template",
- withChevron: true,
- icon: library_layout
- }, (0,external_wp_i18n_namespaceObject.__)('Templates')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- as: SidebarNavigationItem,
- path: "/patterns",
- withChevron: true,
- icon: library_symbol
- }, (0,external_wp_i18n_namespaceObject.__)('Patterns'))), (0,external_React_.createElement)(TemplatePartHint, null))
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
-
-/**
- * WordPress dependencies
- */
-
-const home = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
-}));
-/* harmony default export */ const library_home = (home);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
-
-/**
- * WordPress dependencies
- */
-
-const verse = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
-}));
-/* harmony default export */ const library_verse = (verse);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin.js
-
-/**
- * WordPress dependencies
- */
-
-const pin = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"
-}));
-/* harmony default export */ const library_pin = (pin);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js
-
-/**
- * WordPress dependencies
- */
-
-const archive = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"
-}));
-/* harmony default export */ const library_archive = (archive);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
-
-/**
- * WordPress dependencies
- */
-
-const search = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
-}));
-/* harmony default export */ const library_search = (search);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js
-
-/**
- * WordPress dependencies
- */
-
-const notFound = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const not_found = (notFound);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js
-
-/**
- * WordPress dependencies
- */
-
-const list = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_list = (list);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
-
-/**
- * WordPress dependencies
- */
-
-const category = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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",
- fillRule: "evenodd",
- clipRule: "evenodd"
-}));
-/* harmony default export */ const library_category = (category);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
-
-/**
- * WordPress dependencies
- */
-
-const commentAuthorAvatar = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- 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",
- clipRule: "evenodd"
-}));
-/* harmony default export */ const comment_author_avatar = (commentAuthorAvatar);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js
-
-/**
- * WordPress dependencies
- */
-
-const blockMeta = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- 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",
- clipRule: "evenodd"
-}));
-/* harmony default export */ const block_meta = (blockMeta);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js
-
-/**
- * WordPress dependencies
- */
-
-const calendar = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"
-}));
-/* harmony default export */ const library_calendar = (calendar);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
-
-/**
- * WordPress dependencies
- */
-
-const tag = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
-}));
-/* harmony default export */ const library_tag = (tag);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
-
-/**
- * WordPress dependencies
- */
-
-const media = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m7 6.5 4 2.5-4 2.5z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"
-}));
-/* harmony default export */ const library_media = (media);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
-
-/**
- * WordPress dependencies
- */
-
-const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
-}));
-/* harmony default export */ const library_plus = (plus);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
-
-/**
- * WordPress dependencies
- */
-
-const post = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_post = (post);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-/**
- * @typedef IHasNameAndId
- * @property {string|number} id The entity's id.
- * @property {string} name The entity's name.
- */
-
-const utils_getValueFromObjectPath = (object, path) => {
- let value = object;
- path.split('.').forEach(fieldName => {
- value = value?.[fieldName];
- });
- return value;
-};
-
-/**
- * Helper util to map records to add a `name` prop from a
- * provided path, in order to handle all entities in the same
- * fashion(implementing`IHasNameAndId` interface).
- *
- * @param {Object[]} entities The array of entities.
- * @param {string} path The path to map a `name` property from the entity.
- * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
- */
-const mapToIHasNameAndId = (entities, path) => {
- return (entities || []).map(entity => ({
- ...entity,
- name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path))
- }));
-};
-
-/**
- * @typedef {Object} EntitiesInfo
- * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).
- * @property {number[]} existingEntitiesIds An array of the existing entities ids.
- */
-
-const useExistingTemplates = () => {
- return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', constants_TEMPLATE_POST_TYPE, {
- per_page: -1
- }), []);
-};
-const useDefaultTemplateTypes = () => {
- return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes(), []);
-};
-const usePublicPostTypes = () => {
- const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({
- per_page: -1
- }), []);
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- const excludedPostTypes = ['attachment'];
- return postTypes?.filter(({
- viewable,
- slug
- }) => viewable && !excludedPostTypes.includes(slug));
- }, [postTypes]);
-};
-const usePublicTaxonomies = () => {
- const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({
- per_page: -1
- }), []);
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- return taxonomies?.filter(({
- visibility
- }) => visibility?.publicly_queryable);
- }, [taxonomies]);
-};
-function usePostTypeNeedsUniqueIdentifier(publicPostTypes) {
- const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, {
- labels
- }) => {
- const singularName = labels.singular_name.toLowerCase();
- accumulator[singularName] = (accumulator[singularName] || 0) + 1;
- return accumulator;
- }, {}));
- return (0,external_wp_element_namespaceObject.useCallback)(({
- labels,
- slug
- }) => {
- const singularName = labels.singular_name.toLowerCase();
- return postTypeLabels[singularName] > 1 && singularName !== slug;
- }, [postTypeLabels]);
-}
-function usePostTypeArchiveMenuItems() {
- const publicPostTypes = usePublicPostTypes();
- const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]);
- const existingTemplates = useExistingTemplates();
- const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(postTypesWithArchives);
- return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => {
- let title;
- if (needsUniqueIdentifier(postType)) {
- title = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
- (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug);
- } else {
- title = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the post type e.g: "Post".
- (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name);
- }
- return {
- slug: 'archive-' + postType.slug,
- description: (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the post type e.g: "Post".
- (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name),
- title,
- // `icon` is the `menu_icon` property of a post type. We
- // only handle `dashicons` for now, even if the `menu_icon`
- // also supports urls and svg as values.
- icon: postType.icon?.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive,
- templatePrefix: 'archive'
- };
- }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]);
-}
-const usePostTypeMenuItems = onClickMenuItem => {
- const publicPostTypes = usePublicPostTypes();
- const existingTemplates = useExistingTemplates();
- const defaultTemplateTypes = useDefaultTemplateTypes();
- const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(publicPostTypes);
- // `page`is a special case in template hierarchy.
- const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, {
- slug
- }) => {
- let suffix = slug;
- if (slug !== 'page') {
- suffix = `single-${suffix}`;
- }
- accumulator[slug] = suffix;
- return accumulator;
- }, {}), [publicPostTypes]);
- const postTypesInfo = useEntitiesInfo('postType', templatePrefixes);
- const existingTemplateSlugs = (existingTemplates || []).map(({
- slug
- }) => slug);
- const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => {
- const {
- slug,
- labels,
- icon
- } = postType;
- // We need to check if the general template is part of the
- // defaultTemplateTypes. If it is, just use that info and
- // augment it with the specific template functionality.
- const generalTemplateSlug = templatePrefixes[slug];
- const defaultTemplateType = defaultTemplateTypes?.find(({
- slug: _slug
- }) => _slug === generalTemplateSlug);
- const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
- const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
- let menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the post type e.g: "Post".
- (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name);
- if (_needsUniqueIdentifier) {
- menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
- (0,external_wp_i18n_namespaceObject.__)('Single item: %1$s (%2$s)'), labels.singular_name, slug);
- }
- const menuItem = defaultTemplateType ? {
- ...defaultTemplateType,
- templatePrefix: templatePrefixes[slug]
- } : {
- slug: generalTemplateSlug,
- title: menuItemTitle,
- description: (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the post type e.g: "Post".
- (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name),
- // `icon` is the `menu_icon` property of a post type. We
- // only handle `dashicons` for now, even if the `menu_icon`
- // also supports urls and svg as values.
- icon: icon?.startsWith('dashicons-') ? icon.slice(10) : library_post,
- templatePrefix: templatePrefixes[slug]
- };
- const hasEntities = postTypesInfo?.[slug]?.hasEntities;
- // We have a different template creation flow only if they have entities.
- if (hasEntities) {
- menuItem.onClick = template => {
- onClickMenuItem({
- type: 'postType',
- slug,
- config: {
- recordNamePath: 'title.rendered',
- queryArgs: ({
- search
- }) => {
- return {
- _fields: 'id,title,slug,link',
- orderBy: search ? 'relevance' : 'modified',
- exclude: postTypesInfo[slug].existingEntitiesIds
- };
- },
- getSpecificTemplate: suggestion => {
- const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
- return {
- title: templateSlug,
- slug: templateSlug,
- templatePrefix: templatePrefixes[slug]
- };
- }
- },
- labels,
- hasGeneralTemplate,
- template
- });
- };
- }
- // We don't need to add the menu item if there are no
- // entities and the general template exists.
- if (!hasGeneralTemplate || hasEntities) {
- accumulator.push(menuItem);
- }
- return accumulator;
- }, []);
- // Split menu items into two groups: one for the default post types
- // and one for the rest.
- const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => {
- const {
- slug
- } = postType;
- let key = 'postTypesMenuItems';
- if (slug === 'page') {
- key = 'defaultPostTypesMenuItems';
- }
- accumulator[key].push(postType);
- return accumulator;
- }, {
- defaultPostTypesMenuItems: [],
- postTypesMenuItems: []
- }), [menuItems]);
- return postTypesMenuItems;
-};
-const useTaxonomiesMenuItems = onClickMenuItem => {
- const publicTaxonomies = usePublicTaxonomies();
- const existingTemplates = useExistingTemplates();
- const defaultTemplateTypes = useDefaultTemplateTypes();
- // `category` and `post_tag` are special cases in template hierarchy.
- const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, {
- slug
- }) => {
- let suffix = slug;
- if (!['category', 'post_tag'].includes(slug)) {
- suffix = `taxonomy-${suffix}`;
- }
- if (slug === 'post_tag') {
- suffix = `tag`;
- }
- accumulator[slug] = suffix;
- return accumulator;
- }, {}), [publicTaxonomies]);
- // We need to keep track of naming conflicts. If a conflict
- // occurs, we need to add slug.
- const taxonomyLabels = publicTaxonomies?.reduce((accumulator, {
- labels
- }) => {
- const singularName = labels.singular_name.toLowerCase();
- accumulator[singularName] = (accumulator[singularName] || 0) + 1;
- return accumulator;
- }, {});
- const needsUniqueIdentifier = (labels, slug) => {
- if (['category', 'post_tag'].includes(slug)) {
- return false;
- }
- const singularName = labels.singular_name.toLowerCase();
- return taxonomyLabels[singularName] > 1 && singularName !== slug;
- };
- const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes);
- const existingTemplateSlugs = (existingTemplates || []).map(({
- slug
- }) => slug);
- const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => {
- const {
- slug,
- labels
- } = taxonomy;
- // We need to check if the general template is part of the
- // defaultTemplateTypes. If it is, just use that info and
- // augment it with the specific template functionality.
- const generalTemplateSlug = templatePrefixes[slug];
- const defaultTemplateType = defaultTemplateTypes?.find(({
- slug: _slug
- }) => _slug === generalTemplateSlug);
- const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
- const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug);
- let menuItemTitle = labels.singular_name;
- if (_needsUniqueIdentifier) {
- menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
- (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.singular_name, slug);
- }
- const menuItem = defaultTemplateType ? {
- ...defaultTemplateType,
- templatePrefix: templatePrefixes[slug]
- } : {
- slug: generalTemplateSlug,
- title: menuItemTitle,
- description: (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the taxonomy e.g: "Product Categories".
- (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name),
- icon: block_meta,
- templatePrefix: templatePrefixes[slug]
- };
- const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
- // We have a different template creation flow only if they have entities.
- if (hasEntities) {
- menuItem.onClick = template => {
- onClickMenuItem({
- type: 'taxonomy',
- slug,
- config: {
- queryArgs: ({
- search
- }) => {
- return {
- _fields: 'id,name,slug,link',
- orderBy: search ? 'name' : 'count',
- exclude: taxonomiesInfo[slug].existingEntitiesIds
- };
- },
- getSpecificTemplate: suggestion => {
- const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
- return {
- title: templateSlug,
- slug: templateSlug,
- templatePrefix: templatePrefixes[slug]
- };
- }
- },
- labels,
- hasGeneralTemplate,
- template
- });
- };
- }
- // We don't need to add the menu item if there are no
- // entities and the general template exists.
- if (!hasGeneralTemplate || hasEntities) {
- accumulator.push(menuItem);
- }
- return accumulator;
- }, []);
- // Split menu items into two groups: one for the default taxonomies
- // and one for the rest.
- const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => {
- const {
- slug
- } = taxonomy;
- let key = 'taxonomiesMenuItems';
- if (['category', 'tag'].includes(slug)) {
- key = 'defaultTaxonomiesMenuItems';
- }
- accumulator[key].push(taxonomy);
- return accumulator;
- }, {
- defaultTaxonomiesMenuItems: [],
- taxonomiesMenuItems: []
- }), [menuItems]);
- return taxonomiesMenuItems;
-};
-const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = {
- user: 'author'
-};
-const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = {
- user: {
- who: 'authors'
- }
-};
-function useAuthorMenuItem(onClickMenuItem) {
- const existingTemplates = useExistingTemplates();
- const defaultTemplateTypes = useDefaultTemplateTypes();
- const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS);
- let authorMenuItem = defaultTemplateTypes?.find(({
- slug
- }) => slug === 'author');
- if (!authorMenuItem) {
- authorMenuItem = {
- description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'),
- slug: 'author',
- title: 'Author'
- };
- }
- const hasGeneralTemplate = !!existingTemplates?.find(({
- slug
- }) => slug === 'author');
- if (authorInfo.user?.hasEntities) {
- authorMenuItem = {
- ...authorMenuItem,
- templatePrefix: 'author'
- };
- authorMenuItem.onClick = template => {
- onClickMenuItem({
- type: 'root',
- slug: 'user',
- config: {
- queryArgs: ({
- search
- }) => {
- return {
- _fields: 'id,name,slug,link',
- orderBy: search ? 'name' : 'registered_date',
- exclude: authorInfo.user.existingEntitiesIds,
- who: 'authors'
- };
- },
- getSpecificTemplate: suggestion => {
- const templateSlug = `author-${suggestion.slug}`;
- return {
- title: templateSlug,
- slug: templateSlug,
- templatePrefix: 'author'
- };
- }
- },
- labels: {
- singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'),
- search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'),
- not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'),
- all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors')
- },
- hasGeneralTemplate,
- template
- });
- };
- }
- if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
- return authorMenuItem;
- }
-}
-
-/**
- * Helper hook that filters all the existing templates by the given
- * object with the entity's slug as key and the template prefix as value.
- *
- * Example:
- * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]
- * `templatePrefixes` is: { post_tag: 'tag' }
- * It will return: { post_tag: ['apple'] }
- *
- * Note: We append the `-` to the given template prefix in this function for our checks.
- *
- * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
- * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.
- */
-const useExistingTemplateSlugs = templatePrefixes => {
- const existingTemplates = useExistingTemplates();
- const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => {
- const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => {
- const _prefix = `${prefix}-`;
- if (existingTemplate.slug.startsWith(_prefix)) {
- _accumulator.push(existingTemplate.slug.substring(_prefix.length));
- }
- return _accumulator;
- }, []);
- if (slugsWithTemplates.length) {
- accumulator[slug] = slugsWithTemplates;
- }
- return accumulator;
- }, {});
- }, [templatePrefixes, existingTemplates]);
- return existingSlugs;
-};
-
-/**
- * Helper hook that finds the existing records with an associated template,
- * as they need to be excluded from the template suggestions.
- *
- * @param {string} entityName The entity's name.
- * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
- * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
- * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.
- */
-const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
- const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
- const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => {
- const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
- _fields: 'id',
- context: 'view',
- slug: slugsWithTemplates,
- ...additionalQueryParameters[slug]
- });
- if (entitiesWithTemplates?.length) {
- accumulator[slug] = entitiesWithTemplates;
- }
- return accumulator;
- }, {});
- }, [slugsToExcludePerEntity]);
- return recordsToExcludePerEntity;
-};
-
-/**
- * Helper hook that returns information about an entity having
- * records that we can create a specific template for.
- *
- * For example we can search for `terms` in `taxonomy` entity or
- * `posts` in `postType` entity.
- *
- * First we need to find the existing records with an associated template,
- * to query afterwards for any remaining record, by excluding them.
- *
- * @param {string} entityName The entity's name.
- * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
- * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
- * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.
- */
-const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
- const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters);
- const entitiesInfo = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => {
- const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({
- id
- }) => id) || [];
- accumulator[slug] = {
- hasEntities: !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
- per_page: 1,
- _fields: 'id',
- context: 'view',
- exclude: existingEntitiesIds,
- ...additionalQueryParameters[slug]
- })?.length,
- existingEntitiesIds
- };
- return accumulator;
- }, {});
- }, [templatePrefixes, recordsToExcludePerEntity]);
- return entitiesInfo;
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- CompositeV2: add_custom_template_modal_content_Composite,
- CompositeItemV2: add_custom_template_modal_content_CompositeItem,
- useCompositeStoreV2: add_custom_template_modal_content_useCompositeStore
-} = unlock(external_wp_components_namespaceObject.privateApis);
-const add_custom_template_modal_content_EMPTY_ARRAY = [];
-function SuggestionListItem({
- suggestion,
- search,
- onSelect,
- entityForSuggestions
-}) {
- const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item';
- return (0,external_React_.createElement)(add_custom_template_modal_content_CompositeItem, {
- render: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- role: "option",
- className: baseCssClass,
- onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion))
- })
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- lineHeight: 1.53846153846 // 20px
- ,
- weight: 500,
- className: `${baseCssClass}__title`
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextHighlight, {
- text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name),
- highlight: search
- })), suggestion.link && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- lineHeight: 1.53846153846 // 20px
- ,
- className: `${baseCssClass}__info`
- }, suggestion.link));
-}
-function useSearchSuggestions(entityForSuggestions, search) {
- const {
- config
- } = entityForSuggestions;
- const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({
- order: 'asc',
- context: 'view',
- search,
- per_page: search ? 20 : 10,
- ...config.queryArgs(search)
- }), [search, config]);
- const {
- records: searchResults,
- hasResolved: searchHasResolved
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query);
- const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!searchHasResolved) return;
- let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY;
- if (searchResults?.length) {
- newSuggestions = searchResults;
- if (config.recordNamePath) {
- newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath);
- }
- }
- // Update suggestions only when the query has resolved, so as to keep
- // the previous results in the UI.
- setSuggestions(newSuggestions);
- }, [searchResults, searchHasResolved]);
- return suggestions;
-}
-function SuggestionList({
- entityForSuggestions,
- onSelect
-}) {
- const composite = add_custom_template_modal_content_useCompositeStore({
- orientation: 'vertical'
- });
- const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
- const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch);
- const {
- labels
- } = entityForSuggestions;
- const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false);
- if (!showSearchControl && suggestions?.length > 9) {
- setShowSearchControl(true);
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, showSearchControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
- __nextHasNoMarginBottom: true,
- onChange: setSearch,
- value: search,
- label: labels.search_items,
- placeholder: labels.search_items
- }), !!suggestions?.length && (0,external_React_.createElement)(add_custom_template_modal_content_Composite, {
- store: composite,
- role: "listbox",
- className: "edit-site-custom-template-modal__suggestions_list",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list')
- }, suggestions.map(suggestion => (0,external_React_.createElement)(SuggestionListItem, {
- key: suggestion.slug,
- suggestion: suggestion,
- search: debouncedSearch,
- onSelect: onSelect,
- entityForSuggestions: entityForSuggestions
- }))), debouncedSearch && !suggestions?.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p",
- className: "edit-site-custom-template-modal__no-results"
- }, labels.not_found));
-}
-function AddCustomTemplateModalContent({
- onSelect,
- entityForSuggestions
-}) {
- const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 4,
- className: "edit-site-custom-template-modal__contents-wrapper",
- alignment: "left"
- }, !showSearchEntities && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p"
- }, (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "edit-site-custom-template-modal__contents",
- gap: "4",
- align: "initial"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- isBlock: true,
- as: external_wp_components_namespaceObject.Button,
- onClick: () => {
- const {
- slug,
- title,
- description,
- templatePrefix
- } = entityForSuggestions.template;
- onSelect({
- slug,
- title,
- description,
- templatePrefix
- });
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "span",
- weight: 500,
- lineHeight: 1.53846153846 // 20px
- }, entityForSuggestions.labels.all_items), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "span",
- lineHeight: 1.53846153846 // 20px
- },
- // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
- (0,external_wp_i18n_namespaceObject.__)('For all items'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- isBlock: true,
- as: external_wp_components_namespaceObject.Button,
- onClick: () => {
- setShowSearchEntities(true);
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "span",
- weight: 500,
- lineHeight: 1.53846153846 // 20px
- }, entityForSuggestions.labels.singular_name), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "span",
- lineHeight: 1.53846153846 // 20px
- },
- // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
- (0,external_wp_i18n_namespaceObject.__)('For a specific item'))))), showSearchEntities && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p"
- }, (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.')), (0,external_React_.createElement)(SuggestionList, {
- entityForSuggestions: entityForSuggestions,
- onSelect: onSelect
- })));
-}
-/* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent);
-
-;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
-/******************************************************************************
-Copyright (c) Microsoft Corporation.
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-***************************************************************************** */
-/* global Reflect, Promise, SuppressedError, Symbol */
-
-var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
-};
-
-function __extends(d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-}
-
-var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- }
- return __assign.apply(this, arguments);
-}
-
-function __rest(s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
- t[p[i]] = s[p[i]];
- }
- return t;
-}
-
-function __decorate(decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-}
-
-function __param(paramIndex, decorator) {
- return function (target, key) { decorator(target, key, paramIndex); }
-}
-
-function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
- var _, done = false;
- for (var i = decorators.length - 1; i >= 0; i--) {
- var context = {};
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
- if (kind === "accessor") {
- if (result === void 0) continue;
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
- if (_ = accept(result.get)) descriptor.get = _;
- if (_ = accept(result.set)) descriptor.set = _;
- if (_ = accept(result.init)) initializers.unshift(_);
- }
- else if (_ = accept(result)) {
- if (kind === "field") initializers.unshift(_);
- else descriptor[key] = _;
- }
- }
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
- done = true;
-};
-
-function __runInitializers(thisArg, initializers, value) {
- var useValue = arguments.length > 2;
- for (var i = 0; i < initializers.length; i++) {
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
- }
- return useValue ? value : void 0;
-};
-
-function __propKey(x) {
- return typeof x === "symbol" ? x : "".concat(x);
-};
-
-function __setFunctionName(f, name, prefix) {
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
-};
-
-function __metadata(metadataKey, metadataValue) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
-}
-
-function __awaiter(thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-}
-
-function __generator(thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
- function verb(n) { return function (v) { return step([n, v]); }; }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0: case 1: t = op; break;
- case 4: _.label++; return { value: op[1], done: false };
- case 5: _.label++; y = op[1]; op = [0]; continue;
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
- if (t[2]) _.ops.pop();
- _.trys.pop(); continue;
- }
- op = body.call(thisArg, _);
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
- }
-}
-
-var __createBinding = Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-});
-
-function __exportStar(m, o) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
-}
-
-function __values(o) {
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function () {
- if (o && i >= o.length) o = void 0;
- return { value: o && o[i++], done: !o };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
-}
-
-function __read(o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o), r, ar = [], e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
- }
- catch (error) { e = { error: error }; }
- finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- }
- finally { if (e) throw e.error; }
- }
- return ar;
-}
-
-/** @deprecated */
-function __spread() {
- for (var ar = [], i = 0; i < arguments.length; i++)
- ar = ar.concat(__read(arguments[i]));
- return ar;
-}
-
-/** @deprecated */
-function __spreadArrays() {
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
- r[k] = a[j];
- return r;
-}
-
-function __spreadArray(to, from, pack) {
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
- if (ar || !(i in from)) {
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
- ar[i] = from[i];
- }
- }
- return to.concat(ar || Array.prototype.slice.call(from));
-}
-
-function __await(v) {
- return this instanceof __await ? (this.v = v, this) : new __await(v);
-}
-
-function __asyncGenerator(thisArg, _arguments, generator) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
- function fulfill(value) { resume("next", value); }
- function reject(value) { resume("throw", value); }
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
-}
-
-function __asyncDelegator(o) {
- var i, p;
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
-}
-
-function __asyncValues(o) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var m = o[Symbol.asyncIterator], i;
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
-}
-
-function __makeTemplateObject(cooked, raw) {
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
- return cooked;
-};
-
-var __setModuleDefault = Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-};
-
-function __importStar(mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-}
-
-function __importDefault(mod) {
- return (mod && mod.__esModule) ? mod : { default: mod };
-}
-
-function __classPrivateFieldGet(receiver, state, kind, f) {
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
-}
-
-function __classPrivateFieldSet(receiver, state, value, kind, f) {
- if (kind === "m") throw new TypeError("Private method is not writable");
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
-}
-
-function __classPrivateFieldIn(state, receiver) {
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
- return typeof state === "function" ? receiver === state : state.has(receiver);
-}
-
-function __addDisposableResource(env, value, async) {
- if (value !== null && value !== void 0) {
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
- var dispose;
- if (async) {
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
- dispose = value[Symbol.asyncDispose];
- }
- if (dispose === void 0) {
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
- dispose = value[Symbol.dispose];
- }
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
- env.stack.push({ value: value, dispose: dispose, async: async });
- }
- else if (async) {
- env.stack.push({ async: true });
- }
- return value;
-}
-
-var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
- var e = new Error(message);
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
-};
-
-function __disposeResources(env) {
- function fail(e) {
- env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
- env.hasError = true;
- }
- function next() {
- while (env.stack.length) {
- var rec = env.stack.pop();
- try {
- var result = rec.dispose && rec.dispose.call(rec.value);
- if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
- }
- catch (e) {
- fail(e);
- }
- }
- if (env.hasError) throw env.error;
- }
- return next();
-}
-
-/* harmony default export */ const tslib_es6 = ({
- __extends,
- __assign,
- __rest,
- __decorate,
- __param,
- __metadata,
- __awaiter,
- __generator,
- __createBinding,
- __exportStar,
- __values,
- __read,
- __spread,
- __spreadArrays,
- __spreadArray,
- __await,
- __asyncGenerator,
- __asyncDelegator,
- __asyncValues,
- __makeTemplateObject,
- __importStar,
- __importDefault,
- __classPrivateFieldGet,
- __classPrivateFieldSet,
- __classPrivateFieldIn,
- __addDisposableResource,
- __disposeResources,
-});
-
-;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
-/**
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
- */
-var SUPPORTED_LOCALE = {
- tr: {
- regexp: /\u0130|\u0049|\u0049\u0307/g,
- map: {
- İ: "\u0069",
- I: "\u0131",
- İ: "\u0069",
- },
- },
- az: {
- regexp: /\u0130/g,
- map: {
- İ: "\u0069",
- I: "\u0131",
- İ: "\u0069",
- },
- },
- lt: {
- regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
- map: {
- I: "\u0069\u0307",
- J: "\u006A\u0307",
- Į: "\u012F\u0307",
- Ì: "\u0069\u0307\u0300",
- Í: "\u0069\u0307\u0301",
- Ĩ: "\u0069\u0307\u0303",
- },
- },
-};
-/**
- * Localized lower case.
- */
-function localeLowerCase(str, locale) {
- var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
- if (lang)
- return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
- return lowerCase(str);
-}
-/**
- * Lower case as a function.
- */
-function lowerCase(str) {
- return str.toLowerCase();
-}
-
-;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
-
-// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
-var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
-// Remove all non-word characters.
-var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
-/**
- * Normalize the string into something other libraries can manipulate easier.
- */
-function noCase(input, options) {
- if (options === void 0) { options = {}; }
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
- var start = 0;
- var end = result.length;
- // Trim the delimiter from around the output string.
- while (result.charAt(start) === "\0")
- start++;
- while (result.charAt(end - 1) === "\0")
- end--;
- // Transform each token independently.
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
-}
-/**
- * Replace `re` in the input string with the replacement value.
- */
-function replace(input, re, value) {
- if (re instanceof RegExp)
- return input.replace(re, value);
- return re.reduce(function (input, re) { return input.replace(re, value); }, input);
-}
-
-;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
-
-
-function dotCase(input, options) {
- if (options === void 0) { options = {}; }
- return noCase(input, __assign({ delimiter: "." }, options));
-}
-
-;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
-
-
-function paramCase(input, options) {
- if (options === void 0) { options = {}; }
- return dotCase(input, __assign({ delimiter: "-" }, options));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-function AddCustomGenericTemplateModalContent({
- onClose,
- createTemplate
-}) {
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
- const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
- const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
- async function onCreateTemplate(event) {
- event.preventDefault();
- if (isBusy) {
- return;
- }
- setIsBusy(true);
- try {
- await createTemplate({
- slug: 'wp-custom-template-' + paramCase(title || defaultTitle),
- title: title || defaultTitle
- }, false);
- } finally {
- setIsBusy(false);
- }
- }
- return (0,external_React_.createElement)("form", {
- onSubmit: onCreateTemplate
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 6
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- placeholder: defaultTitle,
- disabled: isBusy,
- help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "edit-site-custom-generic-template__modal-actions",
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- isBusy: isBusy,
- "aria-disabled": isBusy
- }, (0,external_wp_i18n_namespaceObject.__)('Create')))));
-}
-/* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/template-actions-loading-screen.js
-
-/**
- * WordPress dependencies
- */
-
-function TemplateActionsLoadingScreen() {
- const baseCssClass = 'edit-site-template-actions-loading-screen-modal';
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- isFullScreen: true,
- isDismissible: false,
- shouldCloseOnClickOutside: false,
- shouldCloseOnEsc: false,
- onRequestClose: () => {},
- __experimentalHideHeader: true,
- className: baseCssClass
- }, (0,external_React_.createElement)("div", {
- className: `${baseCssClass}__content`
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template.js
-
-/**
- * External dependencies
- */
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js
/**
* WordPress dependencies
*/
@@ -15258,439 +9162,33 @@ function TemplateActionsLoadingScreen() {
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-const {
- useHistory: new_template_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404'];
-const TEMPLATE_ICONS = {
- 'front-page': library_home,
- home: library_verse,
- single: library_pin,
- page: library_page,
- archive: library_archive,
- search: library_search,
- 404: not_found,
- index: library_list,
- category: library_category,
- author: comment_author_avatar,
- taxonomy: block_meta,
- date: library_calendar,
- tag: library_tag,
- attachment: library_media
-};
-function TemplateListItem({
- title,
- direction,
- className,
- description,
- icon,
- onClick,
+function CopyButton({
+ text,
children
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: className,
- onClick: onClick,
- label: description,
- showTooltip: !!description
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- as: "span",
- spacing: 2,
- align: "center",
- justify: "center",
- style: {
- width: '100%'
- },
- direction: direction
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-add-new-template__template-icon"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: icon
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-add-new-template__template-name",
- alignment: "center",
- spacing: 0
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- weight: 500,
- lineHeight: 1.53846153846 // 20px
- }, title), children)));
-}
-const modalContentMap = {
- templatesList: 1,
- customTemplate: 2,
- customGenericTemplate: 3
-};
-function NewTemplate({
- postType,
- toggleProps,
- showIcon = true
-}) {
- const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList);
- const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({});
- const [isCreatingTemplate, setIsCreatingTemplate] = (0,external_wp_element_namespaceObject.useState)(false);
- const history = new_template_useHistory();
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createErrorNotice,
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- homeUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getUnstableBase // Site index.
- } = select(external_wp_coreData_namespaceObject.store);
- return {
- homeUrl: getUnstableBase()?.home
- };
- }, []);
- const TEMPLATE_SHORT_DESCRIPTIONS = {
- 'front-page': homeUrl,
- date: (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The homepage url.
- (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear())
- };
- async function createTemplate(template, isWPSuggestion = true) {
- if (isCreatingTemplate) {
- return;
- }
- setIsCreatingTemplate(true);
- try {
- const {
- title,
- description,
- slug
- } = template;
- const newTemplate = await saveEntityRecord('postType', constants_TEMPLATE_POST_TYPE, {
- description,
- // Slugs need to be strings, so this is for template `404`
- slug: slug.toString(),
- status: 'publish',
- title,
- // This adds a post meta field in template that is part of `is_custom` value calculation.
- is_wp_suggestion: isWPSuggestion
- }, {
- throwOnError: true
- });
-
- // Navigate to the created template editor.
- history.push({
- postId: newTemplate.id,
- postType: newTemplate.type,
- canvas: 'edit'
- });
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Title of the created template e.g: "Category".
- (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), {
- type: 'snackbar'
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- } finally {
- setIsCreatingTemplate(false);
- }
- }
- const onModalClose = () => {
- setShowModal(false);
- setModalContent(modalContentMap.templatesList);
- };
- const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate));
- if (!missingTemplates.length) {
- return null;
- }
- const {
- as: Toggle = external_wp_components_namespaceObject.Button,
- ...restToggleProps
- } = toggleProps !== null && toggleProps !== void 0 ? toggleProps : {};
- let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template');
- if (modalContent === modalContentMap.customTemplate) {
- modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Name of the post type e.g: "Post".
- (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name);
- } else if (modalContent === modalContentMap.customGenericTemplate) {
- modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template');
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, isCreatingTemplate && (0,external_React_.createElement)(TemplateActionsLoadingScreen, null), (0,external_React_.createElement)(Toggle, {
- ...restToggleProps,
- onClick: () => setShowModal(true),
- icon: showIcon ? library_plus : null,
- label: postType.labels.add_new_item
- }, showIcon ? null : postType.labels.add_new_item), showModal && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: modalTitle,
- className: classnames_default()('edit-site-add-new-template__modal', {
- 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList,
- 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate
- }),
- onRequestClose: onModalClose,
- overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined
- }, modalContent === modalContentMap.templatesList && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
- columns: 3,
- gap: 4,
- align: "flex-start",
- justify: "center",
- className: "edit-site-add-new-template__template-list__contents"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "edit-site-add-new-template__template-list__prompt"
- }, (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:')), missingTemplates.map(template => {
- const {
- title,
- slug,
- onClick
- } = template;
- return (0,external_React_.createElement)(TemplateListItem, {
- key: slug,
- title: title,
- direction: "column",
- className: "edit-site-add-new-template__template-button",
- description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
- icon: TEMPLATE_ICONS[slug] || library_layout,
- onClick: () => onClick ? onClick(template) : createTemplate(template)
- });
- }), (0,external_React_.createElement)(TemplateListItem, {
- title: (0,external_wp_i18n_namespaceObject.__)('Custom template'),
- direction: "row",
- className: "edit-site-add-new-template__custom-template-button",
- icon: edit,
- onClick: () => setModalContent(modalContentMap.customGenericTemplate)
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- lineHeight: 1.53846153846 // 20px
- }, (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.')))), modalContent === modalContentMap.customTemplate && (0,external_React_.createElement)(add_custom_template_modal_content, {
- onSelect: createTemplate,
- entityForSuggestions: entityForSuggestions
- }), modalContent === modalContentMap.customGenericTemplate && (0,external_React_.createElement)(add_custom_generic_template_modal_content, {
- onClose: onModalClose,
- createTemplate: createTemplate
- })));
-}
-function useMissingTemplates(setEntityForSuggestions, onClick) {
- const existingTemplates = useExistingTemplates();
- const defaultTemplateTypes = useDefaultTemplateTypes();
- const existingTemplateSlugs = (existingTemplates || []).map(({
- slug
- }) => slug);
- const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug));
- const onClickMenuItem = _entityForSuggestions => {
- onClick?.();
- setEntityForSuggestions(_entityForSuggestions);
- };
- // We need to replace existing default template types with
- // the create specific template functionality. The original
- // info (title, description, etc.) is preserved in the
- // used hooks.
- const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
- const {
- defaultTaxonomiesMenuItems,
- taxonomiesMenuItems
- } = useTaxonomiesMenuItems(onClickMenuItem);
- const {
- defaultPostTypesMenuItems,
- postTypesMenuItems
- } = usePostTypeMenuItems(onClickMenuItem);
- const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
- [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => {
- if (!menuItem) {
- return;
- }
- const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug);
- // Some default template types might have been filtered above from
- // `missingDefaultTemplates` because they only check for the general
- // template. So here we either replace or append the item, augmented
- // with the check if it has available specific item to create a
- // template for.
- if (matchIndex > -1) {
- enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
- } else {
- enhancedMissingDefaultTemplateTypes.push(menuItem);
- }
- });
- // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
- enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
- return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
+ const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "secondary",
+ ref: ref,
+ children: children
});
- const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems];
- return missingTemplates;
}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function AddNewTemplate({
- templateType = constants_TEMPLATE_POST_TYPE,
- ...props
+function ErrorBoundaryWarning({
+ message,
+ error
}) {
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
- if (!postType) {
- return null;
- }
- if (templateType === constants_TEMPLATE_POST_TYPE) {
- return (0,external_React_.createElement)(NewTemplate, {
- ...props,
- postType: postType
- });
- }
- return null;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-const TemplateItem = ({
- postType,
- postId,
- ...props
-}) => {
- const linkInfo = useLink({
- postType,
- postId
- });
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- ...linkInfo,
- ...props
- });
-};
-function SidebarNavigationScreenTemplates() {
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const {
- records: templates,
- isResolving: isLoading
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', constants_TEMPLATE_POST_TYPE, {
- per_page: -1
- });
- const browseAllLink = useLink({
- path: '/wp_template/all'
- });
- const canCreate = !isMobileViewport;
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: (0,external_wp_i18n_namespaceObject.__)('Templates'),
- description: (0,external_wp_i18n_namespaceObject.__)('Express the layout of your site with templates.'),
- actions: canCreate && (0,external_React_.createElement)(AddNewTemplate, {
- templateType: constants_TEMPLATE_POST_TYPE,
- toggleProps: {
- as: SidebarButton
- }
- }),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading templates…'), !isLoading && (0,external_React_.createElement)(SidebarTemplatesList, {
- templates: templates
- })),
- footer: !isMobileViewport && (0,external_React_.createElement)(SidebarNavigationItem, {
- withChevron: true,
- ...browseAllLink
- }, (0,external_wp_i18n_namespaceObject.__)('Manage all templates'))
+ const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
+ text: error.stack,
+ children: (0,external_wp_i18n_namespaceObject.__)('Copy Error')
+ }, "copy-error")];
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
+ className: "editor-error-boundary",
+ actions: actions,
+ children: message
});
}
-function TemplatesGroup({
- title,
- templates
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, !!title && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
- className: "edit-site-sidebar-navigation-screen-templates__templates-group-title"
- }, title), templates.map(template => (0,external_React_.createElement)(TemplateItem, {
- postType: constants_TEMPLATE_POST_TYPE,
- postId: template.id,
- key: template.id,
- withChevron: true
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title?.rendered || template.slug))));
-}
-function SidebarTemplatesList({
- templates
-}) {
- if (!templates?.length) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('No templates found')));
- }
- const sortedTemplates = templates ? [...templates] : [];
- sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
- const {
- hierarchyTemplates,
- customTemplates,
- ...plugins
- } = sortedTemplates.reduce((accumulator, template) => {
- const {
- original_source: originalSource,
- author_text: authorText
- } = template;
- if (originalSource === 'plugin') {
- if (!accumulator[authorText]) {
- accumulator[authorText] = [];
- }
- accumulator[authorText].push(template);
- } else if (template.is_custom) {
- accumulator.customTemplates.push(template);
- } else {
- accumulator.hierarchyTemplates.push(template);
- }
- return accumulator;
- }, {
- hierarchyTemplates: [],
- customTemplates: []
- });
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, !!hierarchyTemplates.length && (0,external_React_.createElement)(TemplatesGroup, {
- templates: hierarchyTemplates
- }), !!customTemplates.length && (0,external_React_.createElement)(TemplatesGroup, {
- title: (0,external_wp_i18n_namespaceObject.__)('Custom'),
- templates: customTemplates
- }), Object.entries(plugins).map(([plugin, pluginTemplates]) => {
- return (0,external_React_.createElement)(TemplatesGroup, {
- key: plugin,
- title: plugin,
- templates: pluginTemplates
- });
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-template/template-areas.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js
/**
* WordPress dependencies
*/
@@ -15698,2198 +9196,35 @@ function SidebarTemplatesList({
-
-
-
/**
* Internal dependencies
*/
-
-
-
-
-function TemplateAreaButton({
- postId,
- area,
- title
-}) {
- const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
- return defaultAreas.find(defaultArea => defaultArea.area === area);
- }, [area]);
- const linkInfo = useLink({
- postType: TEMPLATE_PART_POST_TYPE,
- postId
- });
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- className: "edit-site-sidebar-navigation-screen-template__template-area-button",
- ...linkInfo,
- icon: templatePartArea?.icon,
- withChevron: true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- limit: 20,
- ellipsizeMode: "tail",
- numberOfLines: 1,
- className: "edit-site-sidebar-navigation-screen-template__template-area-label-text"
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)));
-}
-function TemplateAreas() {
- const {
- templatePartAreas,
- currentTemplateParts
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSettings,
- getCurrentTemplateTemplateParts
- } = unlock(select(store_store));
- return {
- templatePartAreas: getSettings()?.defaultTemplatePartAreas,
- currentTemplateParts: getCurrentTemplateTemplateParts()
- };
- }, []);
-
- /*
- * Merge data in currentTemplateParts with templatePartAreas,
- * which contains the template icon and fallback labels
- */
- const templateAreas = (0,external_wp_element_namespaceObject.useMemo)(() => {
- // Keep track of template part IDs that have already been added to the array.
- const templatePartIds = new Set();
- const filterOutDuplicateTemplateParts = currentTemplatePart => {
- // If the template part has already been added to the array, skip it.
- if (templatePartIds.has(currentTemplatePart.templatePart.id)) {
- return;
- }
- // Add to the array of template part IDs.
- templatePartIds.add(currentTemplatePart.templatePart.id);
- return currentTemplatePart;
- };
- return currentTemplateParts.length && templatePartAreas ? currentTemplateParts.filter(filterOutDuplicateTemplateParts).map(({
- templatePart,
- block
- }) => ({
- ...templatePartAreas?.find(({
- area
- }) => area === templatePart?.area),
- ...templatePart,
- clientId: block.clientId
- })) : [];
- }, [currentTemplateParts, templatePartAreas]);
- if (!templateAreas.length) {
- return null;
- }
- return (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanel, {
- title: (0,external_wp_i18n_namespaceObject.__)('Areas'),
- spacing: 3
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, templateAreas.map(({
- clientId,
- label,
- area,
- theme,
- slug,
- title
- }) => (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, {
- key: clientId
- }, (0,external_React_.createElement)(TemplateAreaButton, {
- postId: `${theme}//${slug}`,
- title: title?.rendered || label,
- area: area
- })))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/use-edited-entity-record/index.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-function useEditedEntityRecord(postType, postId) {
- const {
- record,
- title,
- description,
- isLoaded,
- icon
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const {
- getEditedEntityRecord,
- hasFinishedResolution
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- __experimentalGetTemplateInfo: getTemplateInfo
- } = select(external_wp_editor_namespaceObject.store);
- const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
- const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
- const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
- const _isLoaded = usedPostId && hasFinishedResolution('getEditedEntityRecord', ['postType', usedPostType, usedPostId]);
- const templateInfo = getTemplateInfo(_record);
- return {
- record: _record,
- title: templateInfo.title,
- description: templateInfo.description,
- isLoaded: _isLoaded,
- icon: templateInfo.icon
+class ErrorBoundary extends external_wp_element_namespaceObject.Component {
+ constructor() {
+ super(...arguments);
+ this.state = {
+ error: null
};
- }, [postType, postId]);
- return {
- isLoaded,
- icon,
- record,
- getTitle: () => title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : null,
- getDescription: () => description ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) : null
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
-
-/**
- * WordPress dependencies
- */
-
-const plugins = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_plugins = (plugins);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js
-
-/**
- * WordPress dependencies
- */
-
-const globe = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_globe = (globe);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/added-by.js
-
-// @ts-check
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-/** @typedef {'wp_template'|'wp_template_part'} TemplateType */
-
-/**
- * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType
- *
- * @typedef AddedByData
- * @type {Object}
- * @property {AddedByType} type The type of the data.
- * @property {JSX.Element} icon The icon to display.
- * @property {string} [imageUrl] The optional image URL to display.
- * @property {string} [text] The text to display.
- * @property {boolean} isCustomized Whether the template has been customized.
- *
- * @param {TemplateType} postType The template post type.
- * @param {number} postId The template post id.
- * @return {AddedByData} The added by object or null.
- */
-function useAddedBy(postType, postId) {
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord,
- getMedia,
- getUser,
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const template = getEditedEntityRecord('postType', postType, postId);
- const originalSource = template?.original_source;
- const authorText = template?.author_text;
- switch (originalSource) {
- case 'theme':
- {
- return {
- type: originalSource,
- icon: library_layout,
- text: authorText,
- isCustomized: template.source === TEMPLATE_ORIGINS.custom
- };
- }
- case 'plugin':
- {
- return {
- type: originalSource,
- icon: library_plugins,
- text: authorText,
- isCustomized: template.source === TEMPLATE_ORIGINS.custom
- };
- }
- case 'site':
- {
- const siteData = getEntityRecord('root', '__unstableBase');
- return {
- type: originalSource,
- icon: library_globe,
- imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined,
- text: authorText,
- isCustomized: false
- };
- }
- default:
- {
- const user = getUser(template.author);
- return {
- type: 'user',
- icon: comment_author_avatar,
- imageUrl: user?.avatar_urls?.[48],
- text: authorText,
- isCustomized: false
- };
- }
- }
- }, [postType, postId]);
-}
-
-/**
- * @param {Object} props
- * @param {string} props.imageUrl
- */
-function AvatarImage({
- imageUrl
-}) {
- const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-list-added-by__avatar', {
- 'is-loaded': isImageLoaded
- })
- }, (0,external_React_.createElement)("img", {
- onLoad: () => setIsImageLoaded(true),
- alt: "",
- src: imageUrl
- }));
-}
-
-/**
- * @param {Object} props
- * @param {TemplateType} props.postType The template post type.
- * @param {number} props.postId The template post id.
- */
-function AddedBy({
- postType,
- postId
-}) {
- const {
- text,
- icon,
- imageUrl,
- isCustomized
- } = useAddedBy(postType, postId);
- return createElement(HStack, {
- alignment: "left"
- }, imageUrl ? createElement(AvatarImage, {
- imageUrl: imageUrl
- }) : createElement("div", {
- className: "edit-site-list-added-by__icon"
- }, createElement(Icon, {
- icon: icon
- })), createElement("span", null, text, isCustomized && createElement("span", {
- className: "edit-site-list-added-by__customized-info"
- }, postType === TEMPLATE_POST_TYPE ? _x('Customized', 'template') : _x('Customized', 'template part'))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js
-/**
- * Internal dependencies
- */
-
-
-/**
- * Check if a template is removable.
- *
- * @param {Object} template The template entity to check.
- * @return {boolean} Whether the template is revertable.
- */
-function isTemplateRemovable(template) {
- if (!template) {
- return false;
- }
- return template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-actions/rename-menu-item.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-function RenameMenuItem({
- template,
- onClose
-}) {
- const title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered);
- const [editedTitle, setEditedTitle] = (0,external_wp_element_namespaceObject.useState)(title);
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- editEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- if (template.type === constants_TEMPLATE_POST_TYPE && !template.is_custom) {
- return null;
}
- async function onTemplateRename(event) {
- event.preventDefault();
- try {
- await editEntityRecord('postType', template.type, template.id, {
- title: editedTitle
- });
-
- // Update state before saving rerenders the list.
- setEditedTitle('');
- setIsModalOpen(false);
- onClose();
-
- // Persist edited entity.
- await saveSpecifiedEntityEdits('postType', template.type, template.id, ['title'],
- // Only save title to avoid persisting other edits.
- {
- throwOnError: true
- });
- createSuccessNotice(template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Template renamed.') : (0,external_wp_i18n_namespaceObject.__)('Template part renamed.'), {
- type: 'snackbar'
- });
- } catch (error) {
- const fallbackErrorMessage = template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the template part.');
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- setIsModalOpen(true);
- setEditedTitle(title);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
- onRequestClose: () => {
- setIsModalOpen(false);
- },
- overlayClassName: "edit-site-list__rename-modal"
- }, (0,external_React_.createElement)("form", {
- onSubmit: onTemplateRename
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- __next40pxDefaultSize: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: editedTitle,
- onChange: setEditedTitle,
- required: true
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- variant: "tertiary",
- onClick: () => {
- setIsModalOpen(false);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- variant: "primary",
- type: "submit"
- }, (0,external_wp_i18n_namespaceObject.__)('Save')))))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-actions/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-function TemplateActions({
- postType,
- postId,
- className,
- toggleProps,
- onRemove
-}) {
- const template = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, postId), [postType, postId]);
- const {
- removeTemplate,
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const isRemovable = isTemplateRemovable(template);
- const isRevertable = isTemplateRevertable(template);
- if (!isRemovable && !isRevertable) {
- return null;
- }
- async function revertAndSaveTemplate() {
- try {
- await revertTemplate(template, {
- allowUndo: false
- });
- await saveEditedEntityRecord('postType', template.type, template.id);
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" reverted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered)), {
- type: 'snackbar',
- id: 'edit-site-template-reverted'
- });
- } catch (error) {
- const fallbackErrorMessage = template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.');
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
+ componentDidCatch(error) {
+ (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- className: className,
- toggleProps: toggleProps
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRemovable && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(RenameMenuItem, {
- template: template,
- onClose: onClose
- }), (0,external_React_.createElement)(DeleteMenuItem, {
- onRemove: () => {
- removeTemplate(template);
- onRemove?.();
- onClose();
- },
- title: template.title.rendered
- })), isRevertable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- info: (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.'),
- onClick: () => {
- revertAndSaveTemplate();
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))));
-}
-function DeleteMenuItem({
- onRemove,
- title
-}) {
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- isDestructive: true,
- onClick: () => setIsModalOpen(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Delete')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: isModalOpen,
- onConfirm: onRemove,
- onCancel: () => setIsModalOpen(false),
- confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete')
- }, (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The template or template part's title.
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-template/home-template-details.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const EMPTY_OBJECT = {};
-function HomeTemplateDetails() {
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- allowCommentsOnNewPosts,
- postsPerPage,
- postsPageTitle,
- postsPageId
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const siteSettings = getEntityRecord('root', 'site');
- const _postsPageRecord = siteSettings?.page_for_posts ? getEntityRecord('postType', 'page', siteSettings?.page_for_posts) : EMPTY_OBJECT;
+ static getDerivedStateFromError(error) {
return {
- allowCommentsOnNewPosts: siteSettings?.default_comment_status === 'open',
- postsPageTitle: _postsPageRecord?.title?.rendered,
- postsPageId: _postsPageRecord?.id,
- postsPerPage: siteSettings?.posts_per_page
+ error
};
- }, []);
- const [commentsOnNewPostsValue, setCommentsOnNewPostsValue] = (0,external_wp_element_namespaceObject.useState)('');
- const [postsCountValue, setPostsCountValue] = (0,external_wp_element_namespaceObject.useState)(1);
- const [postsPageTitleValue, setPostsPageTitleValue] = (0,external_wp_element_namespaceObject.useState)('');
-
- /*
- * This hook serves to set the server-retrieved values,
- * postsPageTitle, allowCommentsOnNewPosts, postsPerPage,
- * to local state.
- */
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- setCommentsOnNewPostsValue(allowCommentsOnNewPosts);
- setPostsPageTitleValue(postsPageTitle);
- setPostsCountValue(postsPerPage);
- }, [postsPageTitle, allowCommentsOnNewPosts, postsPerPage]);
- const setAllowCommentsOnNewPosts = newValue => {
- setCommentsOnNewPostsValue(newValue);
- editEntityRecord('root', 'site', undefined, {
- default_comment_status: newValue ? 'open' : null
- });
- };
- const setPostsPageTitle = newValue => {
- setPostsPageTitleValue(newValue);
- editEntityRecord('postType', 'page', postsPageId, {
- title: newValue
- });
- };
- const setPostsPerPage = newValue => {
- setPostsCountValue(newValue);
- editEntityRecord('root', 'site', undefined, {
- posts_per_page: newValue
- });
- };
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanel, {
- spacing: 6
- }, postsPageId && (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalInputControl, {
- className: "edit-site-sidebar-navigation-screen__input-control",
- placeholder: (0,external_wp_i18n_namespaceObject.__)('No Title'),
- size: '__unstable-large',
- value: postsPageTitleValue,
- onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300),
- label: (0,external_wp_i18n_namespaceObject.__)('Blog title'),
- help: (0,external_wp_i18n_namespaceObject.__)('Set the Posts Page title. Appears in search results, and when the page is shared on social media.')
- })), (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
- className: "edit-site-sidebar-navigation-screen__input-control",
- placeholder: 0,
- value: postsCountValue,
- size: '__unstable-large',
- spinControls: "custom",
- step: "1",
- min: "1",
- onChange: setPostsPerPage,
- label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'),
- help: (0,external_wp_i18n_namespaceObject.__)('Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.')
- }))), (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanel, {
- title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
- spacing: 3
- }, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- className: "edit-site-sidebar-navigation-screen__input-control",
- label: (0,external_wp_i18n_namespaceObject.__)('Allow comments on new posts'),
- help: (0,external_wp_i18n_namespaceObject.__)('Changes will apply to new posts only. Individual posts may override these settings.'),
- checked: commentsOnNewPostsValue,
- onChange: setAllowCommentsOnNewPosts
- }))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-template/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-
-
-function useTemplateDetails(postType, postId) {
- const {
- getDescription,
- getTitle,
- record
- } = useEditedEntityRecord(postType, postId);
- const currentTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []);
- const addedBy = useAddedBy(postType, postId);
- const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
- const title = getTitle();
- let descriptionText = getDescription();
- if (!descriptionText && addedBy.text) {
- descriptionText = (0,external_wp_i18n_namespaceObject.__)('This is a custom template that can be applied manually to any Post or Page.');
- }
- const content = record?.slug === 'home' || record?.slug === 'index' ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(HomeTemplateDetails, null), (0,external_React_.createElement)(TemplateAreas, null)) : (0,external_React_.createElement)(TemplateAreas, null);
- const footer = record?.modified ? (0,external_React_.createElement)(SidebarNavigationScreenDetailsFooter, {
- record: record
- }) : null;
- const description = (0,external_React_.createElement)(external_React_.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-template__added-by-description"
- }, (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-template__added-by-description-author"
- }, (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"
- }, addedBy.imageUrl ? (0,external_React_.createElement)("img", {
- src: addedBy.imageUrl,
- alt: "",
- width: "24",
- height: "24"
- }) : (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: addedBy.icon
- })), addedBy.text), addedBy.isCustomized && (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-template__added-by-description-customized"
- }, (0,external_wp_i18n_namespaceObject._x)('(Customized)', 'template'))));
- return {
- title,
- description,
- content,
- footer
- };
-}
-function SidebarNavigationScreenTemplate() {
- const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- params: {
- postType,
- postId
- }
- } = navigator;
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const {
- title,
- content,
- description,
- footer
- } = useTemplateDetails(postType, postId);
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: title,
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(TemplateActions, {
- postType: postType,
- postId: postId,
- toggleProps: {
- as: SidebarButton
- },
- onRemove: () => {
- navigator.goTo(`/${postType}/all`);
- }
- }), (0,external_React_.createElement)(SidebarButton, {
- onClick: () => setCanvasMode('edit'),
- label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
- icon: library_pencil
- })),
- description: description,
- content: content,
- footer: footer
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js
-
-/**
- * WordPress dependencies
- */
-
-const file = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
-}));
-/* harmony default export */ const library_file = (file);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
-
-/**
- * WordPress dependencies
- */
-
-const symbolFilled = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const symbol_filled = (symbolFilled);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
-
-/**
- * WordPress dependencies
- */
-
-const upload = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
-}));
-/* harmony default export */ const library_upload = (upload);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/template-part-create.js
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-const useExistingTemplateParts = () => {
- return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
- per_page: -1
- }), []);
-};
-
-/**
- * Return a unique template part title based on
- * the given title and existing template parts.
- *
- * @param {string} title The original template part title.
- * @param {Object} templateParts The array of template part entities.
- * @return {string} A unique template part title.
- */
-const getUniqueTemplatePartTitle = (title, templateParts) => {
- const lowercaseTitle = title.toLowerCase();
- const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase());
- if (!existingTitles.includes(lowercaseTitle)) {
- return title;
- }
- let suffix = 2;
- while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) {
- suffix++;
- }
- return `${title} ${suffix}`;
-};
-
-/**
- * Get a valid slug for a template part.
- * Currently template parts only allow latin chars.
- * The fallback slug will receive suffix by default.
- *
- * @param {string} title The template part title.
- * @return {string} A valid template part slug.
- */
-const getCleanTemplatePartSlug = title => {
- return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/create-template-part-modal/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function CreateTemplatePartModal({
- modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create template part'),
- ...restProps
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: modalTitle,
- onRequestClose: restProps.closeModal,
- overlayClassName: "edit-site-create-template-part-modal"
- }, (0,external_React_.createElement)(CreateTemplatePartModalContents, {
- ...restProps
- }));
-}
-function CreateTemplatePartModalContents({
- defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
- blocks = [],
- confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Create'),
- closeModal,
- onCreate,
- onError,
- defaultTitle = ''
-}) {
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const existingTemplateParts = useExistingTemplateParts();
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle);
- const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea);
- const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
- const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
- async function createTemplatePart() {
- if (!title || isSubmitting) {
- return;
- }
- try {
- setIsSubmitting(true);
- const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts);
- const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
- const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, {
- slug: cleanSlug,
- title: uniqueTitle,
- content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
- area
- }, {
- throwOnError: true
- });
- await onCreate(templatePart);
-
- // TODO: Add a success notice?
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- onError?.();
- } finally {
- setIsSubmitting(false);
- }
- }
- return (0,external_React_.createElement)("form", {
- onSubmit: async event => {
- event.preventDefault();
- await createTemplatePart();
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "4"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- required: true
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Area'),
- id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
- className: "edit-site-create-template-part-modal__area-base-control"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Area'),
- className: "edit-site-create-template-part-modal__area-radio-group",
- id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
- onChange: setArea,
- checked: area
- }, templatePartAreas.map(({
- icon,
- label,
- area: value,
- description
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalRadio, {
- key: label,
- value: value,
- className: "edit-site-create-template-part-modal__area-radio"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- align: "start",
- justify: "start"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: icon
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, {
- className: "edit-site-create-template-part-modal__option-label"
- }, label, (0,external_React_.createElement)("div", null, description)), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-create-template-part-modal__checkbox"
- }, area === value && (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_check
- }))))))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- closeModal();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- "aria-disabled": !title || isSubmitting,
- isBusy: isSubmitting
- }, confirmLabel))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-const {
- useHistory: add_new_pattern_useHistory,
- useLocation: add_new_pattern_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const {
- CreatePatternModal,
- useAddPatternCategory
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
-function AddNewPattern() {
- const history = add_new_pattern_useHistory();
- const {
- params
- } = add_new_pattern_useLocation();
- const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme;
- }, []);
- const {
- createPatternFromFile
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store));
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)();
- function handleCreatePattern({
- pattern,
- categoryId
- }) {
- setShowPatternModal(false);
- history.push({
- postId: pattern.id,
- postType: PATTERN_TYPES.user,
- categoryType: PATTERN_TYPES.theme,
- categoryId,
- canvas: 'edit'
- });
- }
- function handleCreateTemplatePart(templatePart) {
- setShowTemplatePartModal(false);
-
- // Navigate to the created template part editor.
- history.push({
- postId: templatePart.id,
- postType: TEMPLATE_PART_POST_TYPE,
- canvas: 'edit'
- });
- }
- function handleError() {
- setShowPatternModal(false);
- setShowTemplatePartModal(false);
- }
- const controls = [{
- icon: library_symbol,
- onClick: () => setShowPatternModal(true),
- title: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
- }];
- if (isBlockBasedTheme) {
- controls.push({
- icon: symbol_filled,
- onClick: () => setShowTemplatePartModal(true),
- title: (0,external_wp_i18n_namespaceObject.__)('Create template part')
- });
- }
- controls.push({
- icon: library_upload,
- onClick: () => {
- patternUploadInputRef.current.click();
- },
- title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON')
- });
- const {
- categoryMap,
- findOrCreateTerm
- } = useAddPatternCategory();
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- controls: controls,
- toggleProps: {
- as: SidebarButton
- },
- icon: library_plus,
- label: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
- }), showPatternModal && (0,external_React_.createElement)(CreatePatternModal, {
- onClose: () => setShowPatternModal(false),
- onSuccess: handleCreatePattern,
- onError: handleError
- }), showTemplatePartModal && (0,external_React_.createElement)(CreateTemplatePartModal, {
- closeModal: () => setShowTemplatePartModal(false),
- blocks: [],
- onCreate: handleCreateTemplatePart,
- onError: handleError
- }), (0,external_React_.createElement)("input", {
- type: "file",
- accept: ".json",
- hidden: true,
- ref: patternUploadInputRef,
- onChange: async event => {
- const file = event.target.files?.[0];
- if (!file) return;
- try {
- let currentCategoryId;
- // When we're not handling template parts, we should
- // add or create the proper pattern category.
- if (params.categoryType !== TEMPLATE_PART_POST_TYPE) {
- const currentCategory = categoryMap.values().find(term => term.name === params.categoryId);
- if (!!currentCategory) {
- currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label));
- }
- }
- const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined);
-
- // Navigate to the All patterns category for the newly created pattern
- // if we're not on that page already and if we're not in the `my-patterns`
- // category.
- if (!currentCategoryId && params.categoryId !== 'my-patterns') {
- history.push({
- path: `/patterns`,
- categoryType: PATTERN_TYPES.theme,
- categoryId: PATTERN_DEFAULT_CATEGORY
- });
- }
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The imported pattern's title.
- (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), {
- type: 'snackbar',
- id: 'import-pattern-success'
- });
- } catch (err) {
- createErrorNotice(err.message, {
- type: 'snackbar',
- id: 'import-pattern-error'
- });
- } finally {
- event.target.value = '';
- }
- }
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js
-
-/**
- * Internal dependencies
- */
-
-
-function CategoryItem({
- count,
- icon,
- id,
- isActive,
- label,
- type
-}) {
- const linkInfo = useLink({
- path: '/patterns',
- categoryType: type,
- categoryId: id
- });
- if (!count) {
- return;
- }
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- ...linkInfo,
- icon: icon,
- suffix: (0,external_React_.createElement)("span", null, count),
- "aria-current": isActive ? 'true' : undefined
- }, label);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function useDefaultPatternCategories() {
- const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _settings$__experimen;
- const {
- getSettings
- } = unlock(select(store_store));
- const settings = getSettings();
- return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories;
- });
- const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories());
- return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])];
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js
-const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-function useThemePatterns() {
- const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _getSettings$__experi;
- const {
- getSettings
- } = unlock(select(store_store));
- return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns;
- });
- const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns());
- const patterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]);
- return patterns;
-}
-
-;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
-
-
-/** @typedef {(...args: any[]) => *[]} GetDependants */
-
-/** @typedef {() => void} Clear */
-
-/**
- * @typedef {{
- * getDependants: GetDependants,
- * clear: Clear
- * }} EnhancedSelector
- */
-
-/**
- * Internal cache entry.
- *
- * @typedef CacheNode
- *
- * @property {?CacheNode|undefined} [prev] Previous node.
- * @property {?CacheNode|undefined} [next] Next node.
- * @property {*[]} args Function arguments for cache entry.
- * @property {*} val Function result.
- */
-
-/**
- * @typedef Cache
- *
- * @property {Clear} clear Function to clear cache.
- * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
- * considering cache uniqueness. A cache is unique if dependents are all arrays
- * or objects.
- * @property {CacheNode?} [head] Cache head.
- * @property {*[]} [lastDependants] Dependants from previous invocation.
- */
-
-/**
- * Arbitrary value used as key for referencing cache object in WeakMap tree.
- *
- * @type {{}}
- */
-var LEAF_KEY = {};
-
-/**
- * Returns the first argument as the sole entry in an array.
- *
- * @template T
- *
- * @param {T} value Value to return.
- *
- * @return {[T]} Value returned as entry in array.
- */
-function arrayOf(value) {
- return [value];
-}
-
-/**
- * Returns true if the value passed is object-like, or false otherwise. A value
- * is object-like if it can support property assignment, e.g. object or array.
- *
- * @param {*} value Value to test.
- *
- * @return {boolean} Whether value is object-like.
- */
-function isObjectLike(value) {
- return !!value && 'object' === typeof value;
-}
-
-/**
- * Creates and returns a new cache object.
- *
- * @return {Cache} Cache object.
- */
-function createCache() {
- /** @type {Cache} */
- var cache = {
- clear: function () {
- cache.head = null;
- },
- };
-
- return cache;
-}
-
-/**
- * Returns true if entries within the two arrays are strictly equal by
- * reference from a starting index.
- *
- * @param {*[]} a First array.
- * @param {*[]} b Second array.
- * @param {number} fromIndex Index from which to start comparison.
- *
- * @return {boolean} Whether arrays are shallowly equal.
- */
-function isShallowEqual(a, b, fromIndex) {
- var i;
-
- if (a.length !== b.length) {
- return false;
- }
-
- for (i = fromIndex; i < a.length; i++) {
- if (a[i] !== b[i]) {
- return false;
- }
- }
-
- return true;
-}
-
-/**
- * Returns a memoized selector function. The getDependants function argument is
- * called before the memoized selector and is expected to return an immutable
- * reference or array of references on which the selector depends for computing
- * its own return value. The memoize cache is preserved only as long as those
- * dependant references remain the same. If getDependants returns a different
- * reference(s), the cache is cleared and the selector value regenerated.
- *
- * @template {(...args: *[]) => *} S
- *
- * @param {S} selector Selector function.
- * @param {GetDependants=} getDependants Dependant getter returning an array of
- * references used in cache bust consideration.
- */
-/* harmony default export */ function rememo(selector, getDependants) {
- /** @type {WeakMap<*,*>} */
- var rootCache;
-
- /** @type {GetDependants} */
- var normalizedGetDependants = getDependants ? getDependants : arrayOf;
-
- /**
- * Returns the cache for a given dependants array. When possible, a WeakMap
- * will be used to create a unique cache for each set of dependants. This
- * is feasible due to the nature of WeakMap in allowing garbage collection
- * to occur on entries where the key object is no longer referenced. Since
- * WeakMap requires the key to be an object, this is only possible when the
- * dependant is object-like. The root cache is created as a hierarchy where
- * each top-level key is the first entry in a dependants set, the value a
- * WeakMap where each key is the next dependant, and so on. This continues
- * so long as the dependants are object-like. If no dependants are object-
- * like, then the cache is shared across all invocations.
- *
- * @see isObjectLike
- *
- * @param {*[]} dependants Selector dependants.
- *
- * @return {Cache} Cache object.
- */
- function getCache(dependants) {
- var caches = rootCache,
- isUniqueByDependants = true,
- i,
- dependant,
- map,
- cache;
-
- for (i = 0; i < dependants.length; i++) {
- dependant = dependants[i];
-
- // Can only compose WeakMap from object-like key.
- if (!isObjectLike(dependant)) {
- isUniqueByDependants = false;
- break;
- }
-
- // Does current segment of cache already have a WeakMap?
- if (caches.has(dependant)) {
- // Traverse into nested WeakMap.
- caches = caches.get(dependant);
- } else {
- // Create, set, and traverse into a new one.
- map = new WeakMap();
- caches.set(dependant, map);
- caches = map;
- }
- }
-
- // We use an arbitrary (but consistent) object as key for the last item
- // in the WeakMap to serve as our running cache.
- if (!caches.has(LEAF_KEY)) {
- cache = createCache();
- cache.isUniqueByDependants = isUniqueByDependants;
- caches.set(LEAF_KEY, cache);
- }
-
- return caches.get(LEAF_KEY);
- }
-
- /**
- * Resets root memoization cache.
- */
- function clear() {
- rootCache = new WeakMap();
- }
-
- /* eslint-disable jsdoc/check-param-names */
- /**
- * The augmented selector call, considering first whether dependants have
- * changed before passing it to underlying memoize function.
- *
- * @param {*} source Source object for derivation.
- * @param {...*} extraArgs Additional arguments to pass to selector.
- *
- * @return {*} Selector result.
- */
- /* eslint-enable jsdoc/check-param-names */
- function callSelector(/* source, ...extraArgs */) {
- var len = arguments.length,
- cache,
- node,
- i,
- args,
- dependants;
-
- // Create copy of arguments (avoid leaking deoptimization).
- args = new Array(len);
- for (i = 0; i < len; i++) {
- args[i] = arguments[i];
- }
-
- dependants = normalizedGetDependants.apply(null, args);
- cache = getCache(dependants);
-
- // If not guaranteed uniqueness by dependants (primitive type), shallow
- // compare against last dependants and, if references have changed,
- // destroy cache to recalculate result.
- if (!cache.isUniqueByDependants) {
- if (
- cache.lastDependants &&
- !isShallowEqual(dependants, cache.lastDependants, 0)
- ) {
- cache.clear();
- }
-
- cache.lastDependants = dependants;
- }
-
- node = cache.head;
- while (node) {
- // Check whether node arguments match arguments
- if (!isShallowEqual(node.args, args, 1)) {
- node = node.next;
- continue;
- }
-
- // At this point we can assume we've found a match
-
- // Surface matched node to head if not already
- if (node !== cache.head) {
- // Adjust siblings to point to each other.
- /** @type {CacheNode} */ (node.prev).next = node.next;
- if (node.next) {
- node.next.prev = node.prev;
- }
-
- node.next = cache.head;
- node.prev = null;
- /** @type {CacheNode} */ (cache.head).prev = node;
- cache.head = node;
- }
-
- // Return immediately
- return node.val;
- }
-
- // No cached value found. Continue to insertion phase:
-
- node = /** @type {CacheNode} */ ({
- // Generate the result from original function
- val: selector.apply(null, args),
- });
-
- // Avoid including the source object in the cache.
- args[0] = null;
- node.args = args;
-
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
-
- // Shift existing head down list
- if (cache.head) {
- cache.head.prev = node;
- node.next = cache.head;
- }
-
- cache.head = node;
-
- return node.val;
- }
-
- callSelector.getDependants = normalizedGetDependants;
- callSelector.clear = clear;
- clear();
-
- return /** @type {S & EnhancedSelector} */ (callSelector);
-}
-
-// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
-var remove_accents = __webpack_require__(9681);
-var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js
-/**
- * External dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-// Default search helpers.
-const defaultGetName = item => item.name || '';
-const defaultGetTitle = item => item.title;
-const defaultGetDescription = item => item.description || '';
-const defaultGetKeywords = item => item.keywords || [];
-const defaultHasCategory = () => false;
-
-/**
- * Extracts words from an input string.
- *
- * @param {string} input The input string.
- *
- * @return {Array} Words, extracted from the input string.
- */
-function extractWords(input = '') {
- return noCase(input, {
- splitRegexp: [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,
- // One lowercase or digit, followed by one uppercase.
- /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase.
- ],
- stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu // Anything that's not a punctuation, symbol or control/format character.
- }).split(' ').filter(Boolean);
-}
-
-/**
- * Sanitizes the search input string.
- *
- * @param {string} input The search input to normalize.
- *
- * @return {string} The normalized search input.
- */
-function normalizeSearchInput(input = '') {
- // Disregard diacritics.
- // Input: "média"
- input = remove_accents_default()(input);
-
- // Accommodate leading slash, matching autocomplete expectations.
- // Input: "/media"
- input = input.replace(/^\//, '');
-
- // Lowercase.
- // Input: "MEDIA"
- input = input.toLowerCase();
- return input;
-}
-
-/**
- * Converts the search term into a list of normalized terms.
- *
- * @param {string} input The search term to normalize.
- *
- * @return {string[]} The normalized list of search terms.
- */
-const getNormalizedSearchTerms = (input = '') => {
- return extractWords(normalizeSearchInput(input));
-};
-const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
- return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
-};
-
-/**
- * Filters an item list given a search term.
- *
- * @param {Array} items Item list
- * @param {string} searchInput Search input.
- * @param {Object} config Search Config.
- *
- * @return {Array} Filtered item list.
- */
-const searchItems = (items = [], searchInput = '', config = {}) => {
- const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
- // Filter patterns by category: the default category indicates that all patterns will be shown.
- const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length;
- const searchRankConfig = {
- ...config,
- onlyFilterByCategory
- };
-
- // If we aren't filtering on search terms, matching on category is satisfactory.
- // If we are, then we need more than a category match.
- const threshold = onlyFilterByCategory ? 0 : 1;
- const rankedItems = items.map(item => {
- return [item, getItemSearchRank(item, searchInput, searchRankConfig)];
- }).filter(([, rank]) => rank > threshold);
-
- // If we didn't have terms to search on, there's no point sorting.
- if (normalizedSearchTerms.length === 0) {
- return rankedItems.map(([item]) => item);
}
- rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
- return rankedItems.map(([item]) => item);
-};
-
-/**
- * Get the search rank for a given item and a specific search term.
- * The better the match, the higher the rank.
- * If the rank equals 0, it should be excluded from the results.
- *
- * @param {Object} item Item to filter.
- * @param {string} searchTerm Search term.
- * @param {Object} config Search Config.
- *
- * @return {number} Search Rank.
- */
-function getItemSearchRank(item, searchTerm, config) {
- const {
- categoryId,
- getName = defaultGetName,
- getTitle = defaultGetTitle,
- getDescription = defaultGetDescription,
- getKeywords = defaultGetKeywords,
- hasCategory = defaultHasCategory,
- onlyFilterByCategory
- } = config;
- let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0;
-
- // If an item doesn't belong to the current category or we don't have
- // search terms to filter by, return the initial rank value.
- if (!rank || onlyFilterByCategory) {
- return rank;
- }
- const name = getName(item);
- const title = getTitle(item);
- const description = getDescription(item);
- const keywords = getKeywords(item);
- const normalizedSearchInput = normalizeSearchInput(searchTerm);
- const normalizedTitle = normalizeSearchInput(title);
-
- // Prefers exact matches
- // Then prefers if the beginning of the title matches the search term
- // name, keywords, description matches come later.
- if (normalizedSearchInput === normalizedTitle) {
- rank += 30;
- } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
- rank += 20;
- } else {
- const terms = [name, title, description, ...keywords].join(' ');
- const normalizedSearchTerms = extractWords(normalizedSearchInput);
- const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
- if (unmatchedTerms.length === 0) {
- rank += 10;
- }
- }
- return rank;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-const EMPTY_PATTERN_LIST = [];
-const createTemplatePartId = (theme, slug) => theme && slug ? theme + '//' + slug : null;
-const templatePartToPattern = templatePart => ({
- blocks: (0,external_wp_blocks_namespaceObject.parse)(templatePart.content.raw, {
- __unstableSkipMigrationLogs: true
- }),
- categories: [templatePart.area],
- description: templatePart.description || '',
- isCustom: templatePart.source === TEMPLATE_ORIGINS.custom,
- keywords: templatePart.keywords || [],
- id: createTemplatePartId(templatePart.theme, templatePart.slug),
- name: createTemplatePartId(templatePart.theme, templatePart.slug),
- title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(templatePart.title.rendered),
- type: templatePart.type,
- templatePart
-});
-const selectTemplatePartsAsPatterns = rememo((select, categoryId, search = '') => {
- var _getEntityRecords;
- const {
- getEntityRecords,
- getIsResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- __experimentalGetDefaultTemplatePartAreas
- } = select(external_wp_editor_namespaceObject.store);
- const query = {
- per_page: -1
- };
- const rawTemplateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST;
- const templateParts = rawTemplateParts.map(templatePart => templatePartToPattern(templatePart));
-
- // In the case where a custom template part area has been removed we need
- // the current list of areas to cross check against so orphaned template
- // parts can be treated as uncategorized.
- const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
- const templatePartAreas = knownAreas.map(area => area.area);
- const templatePartHasCategory = (item, category) => {
- if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) {
- return item.templatePart.area === category;
+ render() {
+ if (!this.state.error) {
+ return this.props.children;
}
- return item.templatePart.area === category || !templatePartAreas.includes(item.templatePart.area);
- };
- const isResolving = getIsResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]);
- const patterns = searchItems(templateParts, search, {
- categoryId,
- hasCategory: templatePartHasCategory
- });
- return {
- patterns,
- isResolving
- };
-}, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
- per_page: -1
-}), select(external_wp_coreData_namespaceObject.store).getIsResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, {
- per_page: -1
-}]), select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas()]);
-const selectThemePatterns = rememo(select => {
- var _settings$__experimen;
- const {
- getSettings
- } = unlock(select(store_store));
- const {
- getIsResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const settings = getSettings();
- const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
- const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
- const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({
- ...pattern,
- keywords: pattern.keywords || [],
- type: PATTERN_TYPES.theme,
- blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
- __unstableSkipMigrationLogs: true
- })
- }));
- return {
- patterns,
- isResolving: getIsResolving('getBlockPatterns')
- };
-}, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).getIsResolving('getBlockPatterns'), unlock(select(store_store)).getSettings()]);
-const selectPatterns = rememo((select, categoryId, syncStatus, search = '') => {
- const {
- patterns: themePatterns,
- isResolving: isResolvingThemePatterns
- } = selectThemePatterns(select);
- const {
- patterns: userPatterns,
- isResolving: isResolvingUserPatterns
- } = selectUserPatterns(select);
- let patterns = [...(themePatterns || []), ...(userPatterns || [])];
- if (syncStatus) {
- // User patterns can have their sync statuses checked directly
- // Non-user patterns are all unsynced for the time being.
- patterns = patterns.filter(pattern => {
- return pattern.type === PATTERN_TYPES.user ? pattern.syncStatus === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced;
- });
- }
- if (categoryId) {
- patterns = searchItems(patterns, search, {
- categoryId,
- hasCategory: (item, currentCategory) => item.categories?.includes(currentCategory)
- });
- } else {
- patterns = searchItems(patterns, search, {
- hasCategory: item => !item.hasOwnProperty('categories')
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundaryWarning, {
+ message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'),
+ error: this.state.error
});
}
- return {
- patterns,
- isResolving: isResolvingThemePatterns || isResolvingUserPatterns
- };
-}, select => [selectThemePatterns(select), selectUserPatterns(select)]);
-
-/**
- * Converts a post of type `wp_block` to a 'pattern item' that more closely
- * matches the structure of theme provided patterns.
- *
- * @param {Object} patternPost The `wp_block` record being normalized.
- * @param {Map} categories A Map of user created categories.
- *
- * @return {Object} The normalized item.
- */
-const convertPatternPostToItem = (patternPost, categories) => ({
- blocks: (0,external_wp_blocks_namespaceObject.parse)(patternPost.content.raw, {
- __unstableSkipMigrationLogs: true
- }),
- ...(patternPost.wp_pattern_category.length > 0 && {
- categories: patternPost.wp_pattern_category.map(patternCategoryId => categories && categories.get(patternCategoryId) ? categories.get(patternCategoryId).slug : patternCategoryId)
- }),
- termLabels: patternPost.wp_pattern_category.map(patternCategoryId => categories?.get(patternCategoryId) ? categories.get(patternCategoryId).label : patternCategoryId),
- id: patternPost.id,
- name: patternPost.slug,
- syncStatus: patternPost.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full,
- title: patternPost.title.raw,
- type: patternPost.type,
- patternPost
-});
-const selectUserPatterns = rememo((select, syncStatus, search = '') => {
- const {
- getEntityRecords,
- getIsResolving,
- getUserPatternCategories
- } = select(external_wp_coreData_namespaceObject.store);
- const query = {
- per_page: -1
- };
- const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query);
- const userPatternCategories = getUserPatternCategories();
- const categories = new Map();
- userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory));
- let patterns = patternPosts ? patternPosts.map(record => convertPatternPostToItem(record, categories)) : EMPTY_PATTERN_LIST;
- const isResolving = getIsResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, query]);
- if (syncStatus) {
- patterns = patterns.filter(pattern => pattern.syncStatus === syncStatus);
- }
- patterns = searchItems(patterns, search, {
- // We exit user pattern retrieval early if we aren't in the
- // catch-all category for user created patterns, so it has
- // to be in the category.
- hasCategory: () => true
- });
- return {
- patterns,
- isResolving,
- categories: userPatternCategories
- };
-}, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, {
- per_page: -1
-}), select(external_wp_coreData_namespaceObject.store).getIsResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, {
- per_page: -1
-}]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]);
-const usePatterns = (categoryType, categoryId, {
- search = '',
- syncStatus
-} = {}) => {
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
- if (categoryType === TEMPLATE_PART_POST_TYPE) {
- return selectTemplatePartsAsPatterns(select, categoryId, search);
- } else if (categoryType === PATTERN_TYPES.theme) {
- return selectPatterns(select, categoryId, syncStatus, search);
- } else if (categoryType === PATTERN_TYPES.user) {
- return selectUserPatterns(select, syncStatus, search);
- }
- return {
- patterns: EMPTY_PATTERN_LIST,
- isResolving: false
- };
- }, [categoryId, categoryType, search, syncStatus]);
-};
-/* harmony default export */ const use_patterns = (usePatterns);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-function usePatternCategories() {
- const defaultCategories = useDefaultPatternCategories();
- defaultCategories.push({
- name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
- label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
- });
- const themePatterns = useThemePatterns();
- const {
- patterns: userPatterns,
- categories: userPatternCategories
- } = use_patterns(PATTERN_TYPES.user);
- const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const categoryMap = {};
- const categoriesWithCounts = [];
-
- // Create a map for easier counting of patterns in categories.
- defaultCategories.forEach(category => {
- if (!categoryMap[category.name]) {
- categoryMap[category.name] = {
- ...category,
- count: 0
- };
- }
- });
- userPatternCategories.forEach(category => {
- if (!categoryMap[category.name]) {
- categoryMap[category.name] = {
- ...category,
- count: 0
- };
- }
- });
-
- // Update the category counts to reflect theme registered patterns.
- themePatterns.forEach(pattern => {
- pattern.categories?.forEach(category => {
- if (categoryMap[category]) {
- categoryMap[category].count += 1;
- }
- });
- // If the pattern has no categories, add it to uncategorized.
- if (!pattern.categories?.length) {
- categoryMap.uncategorized.count += 1;
- }
- });
-
- // Update the category counts to reflect user registered patterns.
- userPatterns.forEach(pattern => {
- pattern.categories?.forEach(category => {
- if (categoryMap[category]) {
- categoryMap[category].count += 1;
- }
- });
- // If the pattern has no categories, add it to uncategorized.
- if (!pattern.categories?.length) {
- categoryMap.uncategorized.count += 1;
- }
- });
-
- // Filter categories so we only have those containing patterns.
- [...defaultCategories, ...userPatternCategories].forEach(category => {
- if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) {
- categoriesWithCounts.push(categoryMap[category.name]);
- }
- });
- const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label));
- sortedCategories.unshift({
- name: PATTERN_USER_CATEGORY,
- label: (0,external_wp_i18n_namespaceObject.__)('My patterns'),
- count: userPatterns.length
- });
- sortedCategories.unshift({
- name: PATTERN_DEFAULT_CATEGORY,
- label: (0,external_wp_i18n_namespaceObject.__)('All patterns'),
- description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'),
- count: themePatterns.length + userPatterns.length
- });
- return sortedCategories;
- }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]);
- return {
- patternCategories,
- hasPatterns: !!patternCategories.length
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const useTemplatePartsGroupedByArea = items => {
- const allItems = items || [];
- const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
-
- // Create map of template areas ensuring that default areas are displayed before
- // any custom registered template part areas.
- const knownAreas = {
- header: {},
- footer: {},
- sidebar: {},
- uncategorized: {}
- };
- templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = {
- ...templatePartArea,
- templateParts: []
- });
- const groupedByArea = allItems.reduce((accumulator, item) => {
- const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
- accumulator[key].templateParts.push(item);
- return accumulator;
- }, knownAreas);
- return groupedByArea;
-};
-function useTemplatePartAreas() {
- const {
- records: templateParts,
- isResolving: isLoading
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, {
- per_page: -1
- });
- return {
- hasTemplateParts: templateParts ? !!templateParts.length : false,
- isLoading,
- templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-
-function TemplatePartGroup({
- areas,
- currentArea,
- currentType
-}) {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen-patterns__group-header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 2
- }, (0,external_wp_i18n_namespaceObject.__)('Template parts'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- className: "edit-site-sidebar-navigation-screen-patterns__group"
- }, Object.entries(areas).map(([area, {
- label,
- templateParts
- }]) => (0,external_React_.createElement)(CategoryItem, {
- key: area,
- count: templateParts?.length,
- icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area),
- label: label,
- id: area,
- type: TEMPLATE_PART_POST_TYPE,
- isActive: currentArea === area && currentType === TEMPLATE_PART_POST_TYPE
- }))));
-}
-function PatternCategoriesGroup({
- categories,
- currentCategory,
- currentType
-}) {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- className: "edit-site-sidebar-navigation-screen-patterns__group"
- }, categories.map(category => (0,external_React_.createElement)(CategoryItem, {
- key: category.name,
- count: category.count,
- label: category.label,
- icon: library_file,
- id: category.name,
- type: "pattern",
- isActive: currentCategory === `${category.name}` && (currentType === PATTERN_TYPES.theme || currentType === PATTERN_TYPES.user)
- }))));
-}
-function SidebarNavigationScreenPatterns() {
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const {
- categoryType,
- categoryId
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
- const currentType = categoryType || PATTERN_TYPES.theme;
- const {
- templatePartAreas,
- hasTemplateParts,
- isLoading
- } = useTemplatePartAreas();
- const {
- patternCategories,
- hasPatterns
- } = usePatternCategories();
- const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []);
- const isTemplatePartsMode = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const settings = select(store_store).getSettings();
- return !!settings.supportsTemplatePartsMode;
- }, []);
- const templatePartsLink = useLink({
- path: '/wp_template_part/all',
- // If a classic theme that supports template parts accessed
- // the Patterns page directly, preserve that state in the URL.
- didAccessPatternsPage: !isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined
- });
- const footer = !isMobileViewport ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(SidebarNavigationItem, {
- as: "a",
- href: "edit.php?post_type=wp_block",
- withChevron: true
- }, (0,external_wp_i18n_namespaceObject.__)('Manage all of my patterns')), (isBlockBasedTheme || isTemplatePartsMode) && (0,external_React_.createElement)(SidebarNavigationItem, {
- withChevron: true,
- ...templatePartsLink
- }, (0,external_wp_i18n_namespaceObject.__)('Manage all template parts'))) : undefined;
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- isRoot: !isBlockBasedTheme,
- title: (0,external_wp_i18n_namespaceObject.__)('Patterns'),
- description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'),
- actions: (0,external_React_.createElement)(AddNewPattern, null),
- footer: footer,
- content: (0,external_React_.createElement)(external_React_.Fragment, null, isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading patterns…'), !isLoading && (0,external_React_.createElement)(external_React_.Fragment, null, !hasTemplateParts && !hasPatterns && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- className: "edit-site-sidebar-navigation-screen-patterns__group"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('No template parts or patterns found'))), hasPatterns && (0,external_React_.createElement)(PatternCategoriesGroup, {
- categories: patternCategories,
- currentCategory: currentCategory,
- currentType: currentType
- }), hasTemplateParts && (0,external_React_.createElement)(TemplatePartGroup, {
- areas: templatePartAreas,
- currentArea: currentCategory,
- currentType: currentType
- })))
- });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js
@@ -17908,11 +9243,11 @@ function SidebarNavigationScreenPatterns() {
const {
- useLocation: use_init_edited_entity_from_url_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const postTypesWithoutParentTemplate = [constants_TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
+ useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
+const authorizedPostTypes = ['page'];
function useResolveEditedEntityAndContext({
- path,
postId,
postType
}) {
@@ -17930,7 +9265,7 @@ function useResolveEditedEntityAndContext({
} = select(external_wp_coreData_namespaceObject.store);
const siteData = getSite();
const base = getUnstableBase();
- const templates = getEntityRecords('postType', constants_TEMPLATE_POST_TYPE, {
+ const templates = getEntityRecords('postType', TEMPLATE_POST_TYPE, {
per_page: -1
});
const _homepageId = siteData?.show_on_front === 'page' && ['number', 'string'].includes(typeof siteData.page_on_front) && !!+siteData.page_on_front // We also need to check if it's not zero(`0`).
@@ -17959,7 +9294,7 @@ function useResolveEditedEntityAndContext({
const resolvedTemplateId = (0,external_wp_data_namespaceObject.useSelect)(select => {
// If we're rendering a post type that doesn't have a template
// no need to resolve its template.
- if (postTypesWithoutParentTemplate.includes(postType)) {
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
return undefined;
}
const {
@@ -17991,7 +9326,7 @@ function useResolveEditedEntityAndContext({
// First see if the post/page has an assigned template and fetch it.
const currentTemplateSlug = editedEntity.template;
if (currentTemplateSlug) {
- const currentTemplate = getEntityRecords('postType', constants_TEMPLATE_POST_TYPE, {
+ const currentTemplate = getEntityRecords('postType', TEMPLATE_POST_TYPE, {
per_page: -1
})?.find(({
slug
@@ -18019,16 +9354,12 @@ function useResolveEditedEntityAndContext({
return undefined;
}
- // If we're rendering a specific page, post... we need to resolve its template.
- if (postType && postId) {
+ // If we're rendering a specific page, we need to resolve its template.
+ // The site editor only supports pages for now, not other CPTs.
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
return resolveTemplateForPostTypeAndId(postType, postId);
}
- // Some URLs in list views are different
- if (path === '/pages' && postId) {
- return resolveTemplateForPostTypeAndId('page', postId);
- }
-
// If we're rendering the home page, and we have a static home page, resolve its template.
if (homepageId) {
return resolveTemplateForPostTypeAndId('page', homepageId);
@@ -18039,25 +9370,17 @@ function useResolveEditedEntityAndContext({
const template = __experimentalGetTemplateForLink(url);
return template?.id;
}
- }, [homepageId, postsPageId, hasLoadedAllDependencies, url, postId, postType, path, frontPageTemplateId]);
+ }, [homepageId, postsPageId, hasLoadedAllDependencies, url, postId, postType, frontPageTemplateId]);
const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (postTypesWithoutParentTemplate.includes(postType)) {
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
return {};
}
- if (postType && postId) {
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
return {
postType,
postId
};
}
-
- // Some URLs in list views are different
- if (path === '/pages' && postId) {
- return {
- postType: 'page',
- postId
- };
- }
if (homepageId) {
return {
postType: 'page',
@@ -18065,24 +9388,8 @@ function useResolveEditedEntityAndContext({
};
}
return {};
- }, [homepageId, postType, postId, path]);
- if (path === '/wp_template/all' && postId) {
- return {
- isReady: true,
- postType: 'wp_template',
- postId,
- context
- };
- }
- if (path === '/wp_template_part/all' && postId) {
- return {
- isReady: true,
- postType: 'wp_template_part',
- postId,
- context
- };
- }
- if (postTypesWithoutParentTemplate.includes(postType)) {
+ }, [homepageId, postType, postId]);
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
return {
isReady: true,
postType,
@@ -18093,7 +9400,7 @@ function useResolveEditedEntityAndContext({
if (hasLoadedAllDependencies) {
return {
isReady: resolvedTemplateId !== undefined,
- postType: constants_TEMPLATE_POST_TYPE,
+ postType: TEMPLATE_POST_TYPE,
postId: resolvedTemplateId,
context
};
@@ -18105,7 +9412,7 @@ function useResolveEditedEntityAndContext({
function useInitEditedEntityFromURL() {
const {
params = {}
- } = use_init_edited_entity_from_url_useLocation();
+ } = useLocation();
const {
postType,
postId,
@@ -18114,7 +9421,7 @@ function useInitEditedEntityFromURL() {
} = useResolveEditedEntityAndContext(params);
const {
setEditedEntity
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isReady) {
setEditedEntity(postType, postId, context);
@@ -18122,669 +9429,45 @@ function useInitEditedEntityFromURL() {
}, [isReady, postType, postId, context, setEditedEntity]);
}
-;// CONCATENATED MODULE: ./node_modules/upper-case-first/dist.es2015/index.js
-/**
- * Upper case the first character of an input string.
- */
-function upperCaseFirst(input) {
- return input.charAt(0).toUpperCase() + input.substr(1);
-}
-
-;// CONCATENATED MODULE: ./node_modules/sentence-case/dist.es2015/index.js
-
-
-
-function sentenceCaseTransform(input, index) {
- var result = input.toLowerCase();
- if (index === 0)
- return upperCaseFirst(result);
- return result;
-}
-function sentenceCase(input, options) {
- if (options === void 0) { options = {}; }
- return noCase(input, __assign({ delimiter: " ", transform: sentenceCaseTransform }, options));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
-
+;// CONCATENATED MODULE: external ["wp","htmlEntities"]
+const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
+;// CONCATENATED MODULE: external ["wp","primitives"]
+const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
/**
* WordPress dependencies
*/
-const chevronUp = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
-}));
-/* harmony default export */ const chevron_up = (chevronUp);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
-
-/**
- * WordPress dependencies
- */
-const chevronDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
-}));
-/* harmony default export */ const chevron_down = (chevronDown);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sync-state-with-url/use-sync-path-with-url.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- useLocation: use_sync_path_with_url_useLocation,
- useHistory: use_sync_path_with_url_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function getPathFromURL(urlParams) {
- var _urlParams$path;
- let path = (_urlParams$path = urlParams?.path) !== null && _urlParams$path !== void 0 ? _urlParams$path : '/';
-
- // Compute the navigator path based on the URL params.
- if (urlParams?.postType && urlParams?.postId) {
- switch (urlParams.postType) {
- case PATTERN_TYPES.user:
- case constants_TEMPLATE_POST_TYPE:
- case TEMPLATE_PART_POST_TYPE:
- case 'page':
- path = `/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
- break;
- default:
- path = `/navigation/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
- }
- }
- return path;
-}
-function isSubset(subset, superset) {
- return Object.entries(subset).every(([key, value]) => {
- return superset[key] === value;
- });
-}
-function useSyncPathWithURL() {
- const history = use_sync_path_with_url_useHistory();
- const {
- params: urlParams
- } = use_sync_path_with_url_useLocation();
- const {
- location: navigatorLocation,
- params: navigatorParams,
- goTo
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const isMounting = (0,external_wp_element_namespaceObject.useRef)(true);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // The navigatorParams are only initially filled properly when the
- // navigator screens mount. so we ignore the first synchronisation.
- if (isMounting.current) {
- isMounting.current = false;
- return;
- }
- function updateUrlParams(newUrlParams) {
- if (isSubset(newUrlParams, urlParams)) {
- return;
- }
- const updatedParams = {
- ...urlParams,
- ...newUrlParams
- };
- history.push(updatedParams);
- }
- if (navigatorParams?.postType && navigatorParams?.postId) {
- updateUrlParams({
- postType: navigatorParams?.postType,
- postId: navigatorParams?.postId,
- path: undefined,
- layout: undefined
- });
- } else if (navigatorLocation.path.startsWith('/page/') && navigatorParams?.postId) {
- updateUrlParams({
- postType: 'page',
- postId: navigatorParams?.postId,
- path: undefined,
- layout: undefined
- });
- } else if (navigatorLocation.path === '/patterns') {
- updateUrlParams({
- postType: undefined,
- postId: undefined,
- canvas: undefined,
- path: navigatorLocation.path
- });
- } else if (navigatorLocation.path === '/wp_template/all' && !window?.__experimentalAdminViews) {
- // When the experiment is disabled, we only support table layout.
- // Clear it out from the URL, so layouts other than table cannot be accessed.
- updateUrlParams({
- postType: undefined,
- categoryType: undefined,
- categoryId: undefined,
- path: navigatorLocation.path,
- layout: undefined
- });
- } else if (
- // These sidebar paths are special in the sense that the url in these pages may or may not have a postId and we need to retain it if it has.
- // The "type" property should be kept as well.
- navigatorLocation.path === '/pages' && window?.__experimentalAdminViews || navigatorLocation.path === '/wp_template/all' && window?.__experimentalAdminViews || navigatorLocation.path === '/wp_template_part/all' && window?.__experimentalAdminViews) {
- updateUrlParams({
- postType: undefined,
- categoryType: undefined,
- categoryId: undefined,
- path: navigatorLocation.path
- });
- } else {
- updateUrlParams({
- postType: undefined,
- postId: undefined,
- categoryType: undefined,
- categoryId: undefined,
- layout: undefined,
- path: navigatorLocation.path === '/' ? undefined : navigatorLocation.path
- });
- }
- },
- // Trigger only when navigator changes to prevent infinite loops.
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [navigatorLocation?.path, navigatorParams]);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- const path = getPathFromURL(urlParams);
- if (navigatorLocation.path !== path) {
- goTo(path);
- }
- },
- // Trigger only when URL changes to prevent infinite loops.
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [urlParams]);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-const POPOVER_PROPS = {
- className: 'block-editor-block-settings-menu__popover',
- placement: 'bottom-start'
-};
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useLocation: leaf_more_menu_useLocation,
- useHistory: leaf_more_menu_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function LeafMoreMenu(props) {
- const location = leaf_more_menu_useLocation();
- const history = leaf_more_menu_useHistory();
- const {
- block
- } = props;
- const {
- clientId
- } = block;
- const {
- moveBlocksDown,
- moveBlocksUp,
- removeBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
- (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({
- clientId,
- maximumLength: 25
- }));
- const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
- (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({
- clientId,
- maximumLength: 25
- }));
- const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getBlockRootClientId
- } = select(external_wp_blockEditor_namespaceObject.store);
- return getBlockRootClientId(clientId);
- }, [clientId]);
- const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => {
- const {
- attributes,
- name
- } = selectedBlock;
- if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
- history.push({
- postType: attributes.type,
- postId: attributes.id,
- ...(isPreviewingTheme() && {
- wp_theme_preview: currentlyPreviewingTheme()
- })
- }, {
- backPath: getPathFromURL(location.params)
- });
- }
- if (name === 'core/page-list-item' && attributes.id && history) {
- history.push({
- postType: 'page',
- postId: attributes.id,
- ...(isPreviewingTheme() && {
- wp_theme_preview: currentlyPreviewingTheme()
- })
- }, {
- backPath: getPathFromURL(location.params)
- });
- }
- }, [history]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Options'),
- className: "block-editor-block-settings-menu",
- popoverProps: POPOVER_PROPS,
- noIcons: true,
- ...props
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: chevron_up,
- onClick: () => {
- moveBlocksUp([clientId], rootClientId);
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Move up')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: chevron_down,
- onClick: () => {
- moveBlocksDown([clientId], rootClientId);
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Move down')), block.attributes?.type === 'page' && block.attributes?.id && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- onGoToPage(block);
- onClose();
- }
- }, goToLabel)), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- removeBlocks([clientId], false);
- onClose();
- }
- }, removeLabel))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- PrivateListView
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-
-// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
-const MAX_PAGE_COUNT = 100;
-const PAGES_QUERY = ['postType', 'page', {
- per_page: MAX_PAGE_COUNT,
- _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'],
- // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
- // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
- // sort.
- orderby: 'menu_order',
- order: 'asc'
-}];
-function NavigationMenuContent({
- rootClientId
-}) {
- const {
- listViewRootClientId,
- isLoading
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- areInnerBlocksControlled,
- getBlockName,
- getBlockCount,
- getBlockOrder
- } = select(external_wp_blockEditor_namespaceObject.store);
- const {
- isResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const blockClientIds = getBlockOrder(rootClientId);
- const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list';
- const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0;
- const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY);
- return {
- listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId,
- // This is a small hack to wait for the navigation block
- // to actually load its inner blocks.
- isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages
- };
- }, [rootClientId]);
- const {
- replaceBlock,
- __unstableMarkNextChangeAsNotPersistent
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => {
- if (block.name === 'core/navigation-link' && !block.attributes.url) {
- __unstableMarkNextChangeAsNotPersistent();
- replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes));
- }
- }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]);
-
- // The hidden block is needed because it makes block edit side effects trigger.
- // For example a navigation page list load its items has an effect on edit to load its items.
- return (0,external_React_.createElement)(external_React_.Fragment, null, !isLoading && (0,external_React_.createElement)(PrivateListView, {
- rootClientId: listViewRootClientId,
- onSelect: offCanvasOnselect,
- blockSettingsMenu: LeafMoreMenu,
- showAppender: false
- }), (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, null)));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const navigation_menu_editor_noop = () => {};
-function NavigationMenuEditor({
- navigationMenuId
-}) {
- const {
- storedSettings
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSettings
- } = unlock(select(store_store));
- return {
- storedSettings: getSettings()
- };
- }, []);
- const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!navigationMenuId) {
- return [];
- }
- return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', {
- ref: navigationMenuId
- })];
- }, [navigationMenuId]);
- if (!navigationMenuId || !blocks?.length) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
- settings: storedSettings,
- value: blocks,
- onChange: navigation_menu_editor_noop,
- onInput: navigation_menu_editor_noop
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
- }, (0,external_React_.createElement)(NavigationMenuContent, {
- rootClientId: blocks[0].clientId
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-function useNavigationMenuTitle(id) {
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
- if (!id) {
- return undefined;
- }
- const editedRecord = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, id);
-
- // Do not display a 'trashed' navigation menu.
- return editedRecord.status === 'trash' ? undefined : editedRecord.title;
- }, [id]);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function TemplatePartNavigationMenu({
- id
-}) {
- const title = useNavigationMenuTitle(id);
- if (!id || title === undefined) {
- return null;
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
- size: "11",
- upperCase: true,
- weight: 500
- }, title || (0,external_wp_i18n_namespaceObject.__)('Navigation')), (0,external_React_.createElement)(NavigationMenuEditor, {
- navigationMenuId: id
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-function TemplatePartNavigationMenuListItem({
- id
-}) {
- const title = useNavigationMenuTitle(id);
- const linkInfo = useLink({
- postId: id,
- postType: NAVIGATION_POST_TYPE
- });
- if (!id || title === undefined) {
- return null;
- }
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- withChevron: true,
- ...linkInfo
- }, title || (0,external_wp_i18n_namespaceObject.__)('(no title)'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js
-
-/**
- * WordPress dependencies
- */
-
-/**
- * Internal dependencies
- */
-
-function TemplatePartNavigationMenuList({
- menus
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu-list"
- }, menus.map(menuId => (0,external_React_.createElement)(TemplatePartNavigationMenuListItem, {
- key: menuId,
- id: menuId
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-function TemplatePartNavigationMenus({
- menus
-}) {
- if (!menus.length) return null;
-
- // if there is a single menu then render TemplatePartNavigationMenu
- if (menus.length === 1) {
- return (0,external_React_.createElement)(TemplatePartNavigationMenu, {
- id: menus[0]
- });
- }
-
- // if there are multiple menus then render TemplatePartNavigationMenuList
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
- size: "11",
- upperCase: true,
- weight: 500
- }, (0,external_wp_i18n_namespaceObject.__)('Navigation')), (0,external_React_.createElement)(TemplatePartNavigationMenuList, {
- menus: menus
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
+ })
+});
+/* harmony default export */ const library_search = (search);
+;// CONCATENATED MODULE: external ["wp","keycodes"]
+const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
+;// CONCATENATED MODULE: external ["wp","url"]
+const external_wp_url_namespaceObject = window["wp"]["url"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
/**
* WordPress dependencies
*/
-/**
- * Internal dependencies
- */
-
-
-
-function getBlocksFromRecord(record) {
- if (record?.blocks) {
- return record?.blocks;
- }
- return record?.content && typeof record.content !== 'function' ? (0,external_wp_blocks_namespaceObject.parse)(record.content) : [];
-}
-
-/**
- * Retrieves a list of specific blocks from a given tree of blocks.
- *
- * @param {string} targetBlockType The name of the block type to find.
- * @param {Array} blocks A list of blocks from a template part entity.
- *
- * @return {Array} A list of any navigation blocks found in the blocks.
- */
-function getBlocksOfTypeFromBlocks(targetBlockType, blocks) {
- if (!targetBlockType || !blocks?.length) {
- return [];
- }
- const findInBlocks = _blocks => {
- if (!_blocks) {
- return [];
- }
- const navigationBlocks = [];
- for (const block of _blocks) {
- if (block.name === targetBlockType) {
- navigationBlocks.push(block);
- }
- if (block?.innerBlocks) {
- const innerNavigationBlocks = findInBlocks(block.innerBlocks);
- if (innerNavigationBlocks.length) {
- navigationBlocks.push(...innerNavigationBlocks);
- }
- }
- }
- return navigationBlocks;
- };
- return findInBlocks(blocks);
-}
-function useNavigationMenuContent(postType, postId) {
- const {
- record
- } = useEditedEntityRecord(postType, postId);
-
- // Only managing navigation menus in template parts is supported
- // to match previous behaviour. This could potentially be expanded
- // to patterns as well.
- if (postType !== TEMPLATE_PART_POST_TYPE) {
- return;
- }
- const blocks = getBlocksFromRecord(record);
- const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', blocks);
- if (!navigationBlocks.length) {
- return;
- }
- const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref);
-
- // Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
- // Also, filter out undefined values, as blocks don't have an id when initially added.
- const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
- if (!uniqueNavigationMenuIds?.length) {
- return;
- }
- return (0,external_React_.createElement)(TemplatePartNavigationMenus, {
- menus: uniqueNavigationMenuIds
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js
+const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "-2 -2 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_wordpress = (wordpress);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js
/**
* External dependencies
*/
@@ -18798,2016 +9481,134 @@ function useNavigationMenuContent(postType, postId) {
-/**
- * Internal dependencies
- */
-
-
-
-
-
-function usePatternDetails(postType, postId) {
- const {
- getDescription,
- getTitle,
- record
- } = useEditedEntityRecord(postType, postId);
- const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
+function SiteIcon({
+ className
+}) {
const {
- currentTheme,
- userPatternCategories
+ isRequestingSite,
+ siteIconUrl
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getCurrentTheme,
- getUserPatternCategories
+ getEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
+ const siteData = getEntityRecord('root', '__unstableBase', undefined);
return {
- currentTheme: getCurrentTheme(),
- userPatternCategories: getUserPatternCategories()
+ isRequestingSite: !siteData,
+ siteIconUrl: siteData?.site_icon_url
};
}, []);
- const addedBy = useAddedBy(postType, postId);
- const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
- const title = getTitle();
- let description = getDescription();
- if (!description && addedBy.text) {
- description = postType === PATTERN_TYPES.user ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: pattern title e.g: "Header".
- (0,external_wp_i18n_namespaceObject.__)('This is the %s pattern.'), getTitle()) : (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: template part title e.g: "Header".
- (0,external_wp_i18n_namespaceObject.__)('This is the %s template part.'), getTitle());
- }
- if (!description && postType === PATTERN_TYPES.user && record?.title) {
- description = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: user created pattern title e.g. "Footer".
- (0,external_wp_i18n_namespaceObject.__)('This is the %s pattern.'), record.title);
- }
- const footer = record?.modified ? (0,external_React_.createElement)(SidebarNavigationScreenDetailsFooter, {
- record: record
- }) : null;
- const details = [];
- if (postType === PATTERN_TYPES.user || postType === TEMPLATE_PART_POST_TYPE) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Syncing'),
- value: record.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'Text that indicates that the pattern is not synchronized') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'Text that indicates that the pattern is synchronized')
- });
- if (record.wp_pattern_category?.length === 0) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Categories'),
- value: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
- });
- }
- if (record.wp_pattern_category?.length > 0) {
- const patternCategories = new Map();
- userPatternCategories.forEach(userCategory => patternCategories.set(userCategory.id, userCategory));
- const categories = record.wp_pattern_category.filter(category => patternCategories.get(category)).map(category => patternCategories.get(category).label);
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Categories'),
- value: categories.length > 0 ? categories.join(', ') : ''
- });
- }
- }
- if (postType === TEMPLATE_PART_POST_TYPE) {
- const templatePartArea = templatePartAreas.find(area => area.area === record.area);
- let areaDetailValue = templatePartArea?.label;
- if (!areaDetailValue) {
- areaDetailValue = record.area ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Sentenced cased template part area e.g: "My custom area".
- (0,external_wp_i18n_namespaceObject.__)('%s (removed)'), sentenceCase(record.area)) : (0,external_wp_i18n_namespaceObject.__)('None');
- }
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Area'),
- value: areaDetailValue
- });
- }
- if (postType === TEMPLATE_PART_POST_TYPE && addedBy.text && !isAddedByActiveTheme) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Added by'),
- value: (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
- }, addedBy.text)
- });
- }
- if (postType === TEMPLATE_PART_POST_TYPE && addedBy.text && (record.origin === TEMPLATE_ORIGINS.plugin || record.has_theme_file === true)) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Customized'),
- value: (0,external_React_.createElement)("span", {
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
- }, addedBy.isCustomized ? (0,external_wp_i18n_namespaceObject.__)('Yes') : (0,external_wp_i18n_namespaceObject.__)('No'))
+ if (isRequestingSite && !siteIconUrl) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-site-icon__image"
});
}
- const content = (0,external_React_.createElement)(external_React_.Fragment, null, useNavigationMenuContent(postType, postId), !!details.length && (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanel, {
- spacing: 5,
- title: (0,external_wp_i18n_namespaceObject.__)('Details')
- }, details.map(({
- label,
- value
- }) => (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, {
- key: label
- }, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelLabel, null, label), (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelValue, null, value)))));
- return {
- title,
- description,
- content,
- footer
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pattern/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-function SidebarNavigationScreenPattern() {
- const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- params: {
- postType,
- postId
- }
- } = navigator;
- const {
- categoryType
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- useInitEditedEntityFromURL();
- const patternDetails = usePatternDetails(postType, postId);
-
- // The absence of a category type in the query params for template parts
- // indicates the user has arrived at the template part via the "manage all"
- // page and the back button should return them to that list page.
- const backPath = !categoryType && postType === TEMPLATE_PART_POST_TYPE ? '/wp_template_part/all' : '/patterns';
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(TemplateActions, {
- postType: postType,
- postId: postId,
- toggleProps: {
- as: SidebarButton
- },
- onRemove: () => {
- navigator.goTo(backPath);
- }
- }), (0,external_React_.createElement)(SidebarButton, {
- onClick: () => setCanvasMode('edit'),
- label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
- icon: library_pencil
- })),
- backPath: backPath,
- ...patternDetails
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js
-// This requested is preloaded in `gutenberg_preload_navigation_posts`.
-// As unbounded queries are limited to 100 by `fetchAllMiddleware`
-// on apiFetch this query is limited to 100.
-// These parameters must be kept aligned with those in
-// lib/compat/wordpress-6.3/navigation-block-preloading.php
-// and
-// block-library/src/navigation/constants.js
-const PRELOADED_NAVIGATION_MENUS_QUERY = {
- per_page: 100,
- status: ['publish', 'draft'],
- order: 'desc',
- orderby: 'date'
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-const notEmptyString = testString => testString?.trim()?.length > 0;
-function RenameModal({
- menuTitle,
- onClose,
- onSave
-}) {
- const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle);
- const titleHasChanged = editedMenuTitle !== menuTitle;
- const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
- onRequestClose: onClose
- }, (0,external_React_.createElement)("form", {
- className: "sidebar-navigation__rename-modal-form"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "3"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- __next40pxDefaultSize: true,
- value: editedMenuTitle,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'),
- onChange: setEditedMenuTitle
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- variant: "tertiary",
- onClick: onClose
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- disabled: !isEditedMenuTitleValid,
- variant: "primary",
- type: "submit",
- onClick: e => {
- e.preventDefault();
- if (!isEditedMenuTitleValid) {
- return;
- }
- onSave({
- title: editedMenuTitle
- });
-
- // Immediate close avoids ability to hit save multiple times.
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Save'))))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js
-
-/**
- * WordPress dependencies
- */
-
-
-function delete_modal_RenameModal({
- onClose,
- onConfirm
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: true,
- onConfirm: e => {
- e.preventDefault();
- onConfirm();
-
- // Immediate close avoids ability to hit delete multiple times.
- onClose();
- },
- onCancel: onClose,
- confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete')
- }, (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation menu?'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const more_menu_POPOVER_PROPS = {
- position: 'bottom right'
-};
-function ScreenNavigationMoreMenu(props) {
- const {
- onDelete,
- onSave,
- onDuplicate,
- menuTitle
- } = props;
- const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const [deleteModalOpen, setDeleteModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const closeModals = () => {
- setRenameModalOpen(false);
- setDeleteModalOpen(false);
- };
- const openRenameModal = () => setRenameModalOpen(true);
- const openDeleteModal = () => setDeleteModalOpen(true);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- className: "sidebar-navigation__more-menu",
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- icon: more_vertical,
- popoverProps: more_menu_POPOVER_PROPS
- }, ({
- onClose
- }) => (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- openRenameModal();
- // Close the dropdown after opening the modal.
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- onDuplicate();
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Duplicate')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- isDestructive: true,
- onClick: () => {
- openDeleteModal();
-
- // Close the dropdown after opening the modal.
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))))), deleteModalOpen && (0,external_React_.createElement)(delete_modal_RenameModal, {
- onClose: closeModals,
- onConfirm: onDelete
- }), renameModalOpen && (0,external_React_.createElement)(RenameModal, {
- onClose: closeModals,
- menuTitle: menuTitle,
- onSave: onSave
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js
-/**
- * WordPress dependencies
- */
-
-
-
-// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
-function buildNavigationLabel(title, id, status) {
- if (!title?.rendered) {
- /* translators: %s is the index of the menu in the list of menus. */
- return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id);
- }
- if (status === 'publish') {
- return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered);
- }
- return (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
- (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-function EditButton({
- postId
-}) {
- const linkInfo = useLink({
- postId,
- postType: NAVIGATION_POST_TYPE,
- canvas: 'edit'
+ const icon = siteIconUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ className: "edit-site-site-icon__image",
+ alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
+ src: siteIconUrl
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ className: "edit-site-site-icon__icon",
+ icon: library_wordpress,
+ size: 48
});
- return (0,external_React_.createElement)(SidebarButton, {
- ...linkInfo,
- label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
- icon: library_pencil
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx(className, 'edit-site-site-icon'),
+ children: icon
});
}
+/* harmony default export */ const site_icon = (SiteIcon);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
-
+;// CONCATENATED MODULE: external ["wp","dom"]
+const external_wp_dom_namespaceObject = window["wp"]["dom"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js
/**
- * WordPress dependencies
+ * External dependencies
*/
/**
- * Internal dependencies
- */
-
-
-
-
-
-function SingleNavigationMenu({
- navigationMenu,
- handleDelete,
- handleDuplicate,
- handleSave
-}) {
- const menuTitle = navigationMenu?.title?.rendered;
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, {
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(ScreenNavigationMoreMenu, {
- menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
- onDelete: handleDelete,
- onSave: handleSave,
- onDuplicate: handleDuplicate
- }), (0,external_React_.createElement)(EditButton, {
- postId: navigationMenu?.id
- })),
- title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
- description: (0,external_wp_i18n_namespaceObject.__)('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
- }, (0,external_React_.createElement)(NavigationMenuEditor, {
- navigationMenuId: navigationMenu?.id
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js
-
-/**
* WordPress dependencies
*/
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-const postType = `wp_navigation`;
-function SidebarNavigationScreenNavigationMenu() {
- const {
- params: {
- postId
- }
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- record: navigationMenu,
- isResolving
- } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId);
- const {
- isSaving,
- isDeleting
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- isSavingEntityRecord,
- isDeletingEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- return {
- isSaving: isSavingEntityRecord('postType', postType, postId),
- isDeleting: isDeletingEntityRecord('postType', postType, postId)
- };
- }, [postId]);
- const isLoading = isResolving || isSaving || isDeleting;
- const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
- const {
- handleSave,
- handleDelete,
- handleDuplicate
- } = useNavigationMenuHandlers();
- const _handleDelete = () => handleDelete(navigationMenu);
- const _handleSave = edits => handleSave(navigationMenu, edits);
- const _handleDuplicate = () => handleDuplicate(navigationMenu);
- if (isLoading) {
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, {
- description: (0,external_wp_i18n_namespaceObject.__)('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, {
- className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
- }));
- }
- if (!isLoading && !navigationMenu) {
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, {
- description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.')
- });
+const SidebarNavigationContext = (0,external_wp_element_namespaceObject.createContext)(() => {});
+// Focus a sidebar element after a navigation. The element to focus is either
+// specified by `focusSelector` (when navigating back) or it is the first
+// tabbable element (usually the "Back" button).
+function focusSidebarElement(el, direction, focusSelector) {
+ let elementToFocus;
+ if (direction === 'back' && focusSelector) {
+ elementToFocus = el.querySelector(focusSelector);
}
- if (!navigationMenu?.content?.raw) {
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, {
- actions: (0,external_React_.createElement)(ScreenNavigationMoreMenu, {
- menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
- onDelete: _handleDelete,
- onSave: _handleSave,
- onDuplicate: _handleDuplicate
- }),
- title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
- description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.')
- });
+ if (direction !== null && !elementToFocus) {
+ const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el);
+ elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : el;
}
- return (0,external_React_.createElement)(SingleNavigationMenu, {
- navigationMenu: navigationMenu,
- handleDelete: _handleDelete,
- handleSave: _handleSave,
- handleDuplicate: _handleDuplicate
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function useDeleteNavigationMenu() {
- const {
- goTo
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- deleteEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const handleDelete = async navigationMenu => {
- const postId = navigationMenu?.id;
- try {
- await deleteEntityRecord('postType', postType, postId, {
- force: true
- }, {
- throwOnError: true
- });
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Deleted Navigation menu'), {
- type: 'snackbar'
- });
- goTo('/navigation');
- } catch (error) {
- createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */
- (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation menu (%s).`), error?.message), {
- type: 'snackbar'
- });
- }
- };
- return handleDelete;
+ elementToFocus?.focus();
}
-function useSaveNavigationMenu() {
- const {
- getEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedEntityRecord: getEditedEntityRecordSelector
- } = select(external_wp_coreData_namespaceObject.store);
- return {
- getEditedEntityRecord: getEditedEntityRecordSelector
- };
- }, []);
- const {
- editEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const handleSave = async (navigationMenu, edits) => {
- if (!edits) {
- return;
- }
- const postId = navigationMenu?.id;
- // Prepare for revert in case of error.
- const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId);
-
- // Apply the edits.
- editEntityRecord('postType', postType, postId, edits);
- const recordPropertiesToSave = Object.keys(edits);
- // Attempt to persist.
- try {
- await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, {
- throwOnError: true
- });
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation menu'), {
- type: 'snackbar'
- });
- } catch (error) {
- // Revert to original in case of error.
- editEntityRecord('postType', postType, postId, originalRecord);
- createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be renamed. */
- (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation menu (%s).`), error?.message), {
- type: 'snackbar'
- });
- }
- };
- return handleSave;
-}
-function useDuplicateNavigationMenu() {
- const {
- goTo
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const handleDuplicate = async navigationMenu => {
- const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
- try {
- const savedRecord = await saveEntityRecord('postType', postType, {
- title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Navigation menu title */
- (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), menuTitle),
- content: navigationMenu?.content?.raw,
- status: 'publish'
- }, {
- throwOnError: true
- });
- if (savedRecord) {
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation menu'), {
- type: 'snackbar'
- });
- goTo(`/navigation/${postType}/${savedRecord.id}`);
- }
- } catch (error) {
- createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */
- (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation menu (%s).`), error?.message), {
- type: 'snackbar'
- });
- }
+// Navigation state that is updated when navigating back or forward. Helps us
+// manage the animations and also focus.
+function createNavState() {
+ let state = {
+ direction: null,
+ focusSelector: null
};
- return handleDuplicate;
-}
-function useNavigationMenuHandlers() {
return {
- handleDelete: useDeleteNavigationMenu(),
- handleSave: useSaveNavigationMenu(),
- handleDuplicate: useDuplicateNavigationMenu()
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-
-// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
-function buildMenuLabel(title, id, status) {
- if (!title) {
- /* translators: %s is the index of the menu in the list of menus. */
- return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id);
- }
- if (status === 'publish') {
- return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title);
- }
- return (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
- (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status);
-}
-
-// Save a boolean to prevent us creating a fallback more than once per session.
-let hasCreatedFallback = false;
-function SidebarNavigationScreenNavigationMenus() {
- const {
- records: navigationMenus,
- isResolving: isResolvingNavigationMenus,
- hasResolved: hasResolvedNavigationMenus
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY);
- const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
- const {
- getNavigationFallbackId
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store));
- const firstNavigationMenu = navigationMenus?.[0];
-
- // Save a boolean to prevent us creating a fallback more than once per session.
- if (firstNavigationMenu) {
- hasCreatedFallback = true;
- }
-
- // If there is no navigation menu found
- // then trigger fallback algorithm to create one.
- if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) {
- getNavigationFallbackId();
- }
- const {
- handleSave,
- handleDelete,
- handleDuplicate
- } = useNavigationMenuHandlers();
- const hasNavigationMenus = !!navigationMenus?.length;
- if (isLoading) {
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, {
- className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
- }));
- }
- if (!isLoading && !hasNavigationMenus) {
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, {
- description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.')
- });
- }
-
- // if single menu then render it
- if (navigationMenus?.length === 1) {
- return (0,external_React_.createElement)(SingleNavigationMenu, {
- navigationMenu: firstNavigationMenu,
- handleDelete: () => handleDelete(firstNavigationMenu),
- handleDuplicate: () => handleDuplicate(firstNavigationMenu),
- handleSave: edits => handleSave(firstNavigationMenu, edits)
- });
- }
- return (0,external_React_.createElement)(SidebarNavigationScreenWrapper, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, navigationMenus?.map(({
- id,
- title,
- status
- }, index) => (0,external_React_.createElement)(NavMenuItem, {
- postId: id,
- key: id,
- withChevron: true,
- icon: library_navigation
- }, buildMenuLabel(title?.rendered, index + 1, status)))));
-}
-function SidebarNavigationScreenWrapper({
- children,
- actions,
- title,
- description
-}) {
- return (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'),
- actions: actions,
- description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation menus.'),
- content: children
- });
-}
-const NavMenuItem = ({
- postId,
- ...props
-}) => {
- const linkInfo = useLink({
- postId,
- postType: NAVIGATION_POST_TYPE
- });
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- ...linkInfo,
- ...props
- });
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-table.js
-
-/**
- * WordPress dependencies
- */
-
-const blockTable = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"
-}));
-/* harmony default export */ const block_table = (blockTable);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js
-
-/**
- * WordPress dependencies
- */
-
-const formatListBulletsRTL = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"
-}));
-/* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js
-
-/**
- * WordPress dependencies
- */
-
-const formatListBullets = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
-}));
-/* harmony default export */ const format_list_bullets = (formatListBullets);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/funnel.js
-
-/**
- * WordPress dependencies
- */
-
-const funnel = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"
-}));
-/* harmony default export */ const library_funnel = (funnel);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unseen.js
-
-/**
- * WordPress dependencies
- */
-
-const unseen = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4.67 10.664s-2.09 1.11-2.917 1.582l.494.87 1.608-.914.002.002c.343.502.86 1.17 1.563 1.84.348.33.742.663 1.185.976L5.57 16.744l.858.515 1.02-1.701a9.1 9.1 0 0 0 4.051 1.18V19h1v-2.263a9.1 9.1 0 0 0 4.05-1.18l1.021 1.7.858-.514-1.034-1.723c.442-.313.837-.646 1.184-.977.703-.669 1.22-1.337 1.563-1.839l.002-.003 1.61.914.493-.87c-1.75-.994-2.918-1.58-2.918-1.58l-.003.005a8.29 8.29 0 0 1-.422.689 10.097 10.097 0 0 1-1.36 1.598c-1.218 1.16-3.042 2.293-5.544 2.293-2.503 0-4.327-1.132-5.546-2.293a10.099 10.099 0 0 1-1.359-1.599 8.267 8.267 0 0 1-.422-.689l-.003-.005Z"
-}));
-/* harmony default export */ const library_unseen = (unseen);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/single-selection-checkbox.js
-
-/**
- * WordPress dependencies
- */
-
-
-function SingleSelectionCheckbox({
- selection,
- onSelectionChange,
- item,
- data,
- getItemId,
- primaryField,
- disabled
-}) {
- const id = getItemId(item);
- const isSelected = selection.includes(id);
- let selectionLabel;
- if (primaryField?.getValue && item) {
- // eslint-disable-next-line @wordpress/valid-sprintf
- selectionLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: item title. */
- isSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect item: %s') : (0,external_wp_i18n_namespaceObject.__)('Select item: %s'), primaryField.getValue({
- item
- }));
- } else {
- selectionLabel = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Select a new item') : (0,external_wp_i18n_namespaceObject.__)('Deselect item');
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- className: "dataviews-view-table-selection-checkbox",
- __nextHasNoMarginBottom: true,
- label: selectionLabel,
- "aria-disabled": disabled,
- checked: isSelected,
- onChange: () => {
- if (disabled) {
- return;
- }
- if (!isSelected) {
- onSelectionChange(data.filter(_item => {
- const itemId = getItemId?.(_item);
- return itemId === id || selection.includes(itemId);
- }));
- } else {
- onSelectionChange(data.filter(_item => {
- const itemId = getItemId?.(_item);
- return itemId !== id && selection.includes(itemId);
- }));
- }
- }
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js
-/**
- * WordPress dependencies
- */
-
-const {
- lock: lock_unlock_lock,
- unlock: lock_unlock_unlock
-} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/dataviews');
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/item-actions.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const {
- DropdownMenuV2: DropdownMenu,
- DropdownMenuGroupV2: DropdownMenuGroup,
- DropdownMenuItemV2: DropdownMenuItem,
- DropdownMenuItemLabelV2: DropdownMenuItemLabel,
- kebabCase
-} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
-function ButtonTrigger({
- action,
- onClick
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: action.label,
- icon: action.icon,
- isDestructive: action.isDestructive,
- size: "compact",
- onClick: onClick
- });
-}
-function DropdownMenuItemTrigger({
- action,
- onClick
-}) {
- return (0,external_React_.createElement)(DropdownMenuItem, {
- onClick: onClick,
- hideOnClick: !action.RenderModal
- }, (0,external_React_.createElement)(DropdownMenuItemLabel, null, action.label));
-}
-function ActionWithModal({
- action,
- item,
- ActionTrigger
-}) {
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const actionTriggerProps = {
- action,
- onClick: () => setIsModalOpen(true)
- };
- const {
- RenderModal,
- hideModalHeader
- } = action;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(ActionTrigger, {
- ...actionTriggerProps
- }), isModalOpen && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: action.modalHeader || action.label,
- __experimentalHideHeader: !!hideModalHeader,
- onRequestClose: () => {
- setIsModalOpen(false);
+ get() {
+ return state;
},
- overlayClassName: `dataviews-action-modal dataviews-action-modal__${kebabCase(action.id)}`
- }, (0,external_React_.createElement)(RenderModal, {
- items: [item],
- closeModal: () => setIsModalOpen(false)
- })));
-}
-function ActionsDropdownMenuGroup({
- actions,
- item
-}) {
- return (0,external_React_.createElement)(DropdownMenuGroup, null, actions.map(action => {
- if (!!action.RenderModal) {
- return (0,external_React_.createElement)(ActionWithModal, {
- key: action.id,
- action: action,
- item: item,
- ActionTrigger: DropdownMenuItemTrigger
- });
- }
- return (0,external_React_.createElement)(DropdownMenuItemTrigger, {
- key: action.id,
- action: action,
- onClick: () => action.callback([item])
- });
- }));
-}
-function ItemActions({
- item,
- actions,
- isCompact
-}) {
- const {
- primaryActions,
- secondaryActions
- } = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return actions.reduce((accumulator, action) => {
- // If an action is eligible for all items, doesn't need
- // to provide the `isEligible` function.
- if (action.isEligible && !action.isEligible(item)) {
- return accumulator;
- }
- if (action.isPrimary && !!action.icon) {
- accumulator.primaryActions.push(action);
- } else {
- accumulator.secondaryActions.push(action);
- }
- return accumulator;
- }, {
- primaryActions: [],
- secondaryActions: []
- });
- }, [actions, item]);
- if (isCompact) {
- return (0,external_React_.createElement)(CompactItemActions, {
- item: item,
- primaryActions: primaryActions,
- secondaryActions: secondaryActions
- });
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 1,
- justify: "flex-end",
- style: {
- flexShrink: '0',
- width: 'auto'
- }
- }, !!primaryActions.length && primaryActions.map(action => {
- if (!!action.RenderModal) {
- return (0,external_React_.createElement)(ActionWithModal, {
- key: action.id,
- action: action,
- item: item,
- ActionTrigger: ButtonTrigger
- });
- }
- return (0,external_React_.createElement)(ButtonTrigger, {
- key: action.id,
- action: action,
- onClick: () => action.callback([item])
- });
- }), (0,external_React_.createElement)(DropdownMenu, {
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- size: "compact",
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- disabled: !secondaryActions.length
- }),
- placement: "bottom-end"
- }, (0,external_React_.createElement)(ActionsDropdownMenuGroup, {
- actions: secondaryActions,
- item: item
- })));
-}
-function CompactItemActions({
- item,
- primaryActions,
- secondaryActions
-}) {
- return (0,external_React_.createElement)(DropdownMenu, {
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- size: "compact",
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- disabled: !primaryActions.length && !secondaryActions.length
- }),
- placement: "bottom-end"
- }, !!primaryActions.length && (0,external_React_.createElement)(ActionsDropdownMenuGroup, {
- actions: primaryActions,
- item: item
- }), !!secondaryActions.length && (0,external_React_.createElement)(ActionsDropdownMenuGroup, {
- actions: secondaryActions,
- item: item
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/utils.js
-/**
- * Internal dependencies
- */
-
-
-/**
- * Helper util to sort data by text fields, when sorting is done client side.
- *
- * @param {Object} params Function params.
- * @param {Object[]} params.data Data to sort.
- * @param {Object} params.view Current view object.
- * @param {Object[]} params.fields Array of available fields.
- * @param {string[]} params.textFields Array of the field ids to sort.
- *
- * @return {Object[]} Sorted data.
- */
-const sortByTextFields = ({
- data,
- view,
- fields,
- textFields
-}) => {
- const sortedData = [...data];
- const fieldId = view.sort.field;
- if (textFields.includes(fieldId)) {
- const fieldToSort = fields.find(field => {
- return field.id === fieldId;
- });
- sortedData.sort((a, b) => {
- var _fieldToSort$getValue, _fieldToSort$getValue2;
- const valueA = (_fieldToSort$getValue = fieldToSort.getValue({
- item: a
- })) !== null && _fieldToSort$getValue !== void 0 ? _fieldToSort$getValue : '';
- const valueB = (_fieldToSort$getValue2 = fieldToSort.getValue({
- item: b
- })) !== null && _fieldToSort$getValue2 !== void 0 ? _fieldToSort$getValue2 : '';
- return view.sort.direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
- });
- }
- return sortedData;
-};
-
-/**
- * Helper util to get the paginated data and the paginateInfo needed,
- * when pagination is done client side.
- *
- * @param {Object} params Function params.
- * @param {Object[]} params.data Available data.
- * @param {Object} params.view Current view object.
- *
- * @return {Object} Paginated data and paginationInfo.
- */
-function getPaginationResults({
- data,
- view
-}) {
- const start = (view.page - 1) * view.perPage;
- const totalItems = data?.length || 0;
- data = data?.slice(start, start + view.perPage);
- return {
- data,
- paginationInfo: {
- totalItems,
- totalPages: Math.ceil(totalItems / view.perPage)
+ navigate(direction, focusSelector = null) {
+ state = {
+ direction,
+ focusSelector: direction === 'forward' && focusSelector ? focusSelector : state.focusSelector
+ };
}
};
}
-const sanitizeOperators = field => {
- let operators = field.filterBy?.operators;
- if (!operators || !Array.isArray(operators)) {
- operators = Object.keys(OPERATORS);
- }
- return operators.filter(operator => Object.keys(OPERATORS).includes(operator));
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/bulk-actions.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const {
- DropdownMenuV2: bulk_actions_DropdownMenu,
- DropdownMenuGroupV2: bulk_actions_DropdownMenuGroup,
- DropdownMenuItemV2: bulk_actions_DropdownMenuItem,
- DropdownMenuSeparatorV2: DropdownMenuSeparator
-} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
-function useHasAPossibleBulkAction(actions, item) {
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- return actions.some(action => {
- return action.supportsBulk && action.isEligible(item);
- });
- }, [actions, item]);
-}
-function useSomeItemHasAPossibleBulkAction(actions, data) {
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- return data.some(item => {
- return actions.some(action => {
- return action.supportsBulk && action.isEligible(item);
- });
- });
- }, [actions, data]);
-}
-function bulk_actions_ActionWithModal({
- action,
- selectedItems,
- setActionWithModal,
- onMenuOpenChange
-}) {
- const eligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return selectedItems.filter(item => action.isEligible(item));
- }, [action, selectedItems]);
- const {
- RenderModal,
- hideModalHeader
- } = action;
- const onCloseModal = (0,external_wp_element_namespaceObject.useCallback)(() => {
- setActionWithModal(undefined);
- }, [setActionWithModal]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: !hideModalHeader && action.label,
- __experimentalHideHeader: !!hideModalHeader,
- onRequestClose: onCloseModal,
- overlayClassName: "dataviews-action-modal"
- }, (0,external_React_.createElement)(RenderModal, {
- items: eligibleItems,
- closeModal: onCloseModal,
- onPerform: () => onMenuOpenChange(false)
- }));
-}
-function BulkActionItem({
- action,
- selectedItems,
- setActionWithModal
-}) {
- const eligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return selectedItems.filter(item => action.isEligible(item));
- }, [action, selectedItems]);
- const shouldShowModal = !!action.RenderModal;
- return (0,external_React_.createElement)(bulk_actions_DropdownMenuItem, {
- key: action.id,
- disabled: eligibleItems.length === 0,
- hideOnClick: !shouldShowModal,
- onClick: async () => {
- if (shouldShowModal) {
- setActionWithModal(action);
- } else {
- await action.callback(eligibleItems);
- }
- },
- suffix: eligibleItems.length > 0 ? eligibleItems.length : undefined
- }, action.label);
-}
-function ActionsMenuGroup({
- actions,
- selectedItems,
- setActionWithModal
-}) {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(bulk_actions_DropdownMenuGroup, null, actions.map(action => (0,external_React_.createElement)(BulkActionItem, {
- key: action.id,
- action: action,
- selectedItems: selectedItems,
- setActionWithModal: setActionWithModal
- }))), (0,external_React_.createElement)(DropdownMenuSeparator, null));
-}
-function BulkActions({
- data,
- actions,
- selection,
- onSelectionChange,
- getItemId
-}) {
- const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]);
- const [isMenuOpen, onMenuOpenChange] = (0,external_wp_element_namespaceObject.useState)(false);
- const [actionWithModal, setActionWithModal] = (0,external_wp_element_namespaceObject.useState)();
- const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return data.filter(item => {
- return bulkActions.some(action => action.isEligible(item));
- });
- }, [data, bulkActions]);
- const numberSelectableItems = selectableItems.length;
- const areAllSelected = selection && selection.length === numberSelectableItems;
- const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return data.filter(item => selection.includes(getItemId(item)));
- }, [selection, data, getItemId]);
- const hasNonSelectableItemSelected = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return selectedItems.some(item => {
- return !selectableItems.includes(item);
- });
- }, [selectedItems, selectableItems]);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (hasNonSelectableItemSelected) {
- onSelectionChange(selectedItems.filter(selectedItem => {
- return selectableItems.some(item => {
- return getItemId(selectedItem) === getItemId(item);
- });
- }));
- }
- }, [hasNonSelectableItemSelected, selectedItems, selectableItems, getItemId, onSelectionChange]);
- if (bulkActions.length === 0) {
- return null;
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(bulk_actions_DropdownMenu, {
- open: isMenuOpen,
- onOpenChange: onMenuOpenChange,
- label: (0,external_wp_i18n_namespaceObject.__)('Bulk actions'),
- style: {
- minWidth: '240px'
- },
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "dataviews-bulk-edit-button",
- __next40pxDefaultSize: true,
- variant: "tertiary",
- size: "compact"
- }, selection.length ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of items. */
- (0,external_wp_i18n_namespaceObject._n)('Edit %d item', 'Edit %d items', selection.length), selection.length) : (0,external_wp_i18n_namespaceObject.__)('Bulk edit'))
- }, (0,external_React_.createElement)(ActionsMenuGroup, {
- actions: bulkActions,
- setActionWithModal: setActionWithModal,
- selectedItems: selectedItems
- }), (0,external_React_.createElement)(bulk_actions_DropdownMenuGroup, null, (0,external_React_.createElement)(bulk_actions_DropdownMenuItem, {
- disabled: areAllSelected,
- hideOnClick: false,
- onClick: () => {
- onSelectionChange(selectableItems);
- },
- suffix: numberSelectableItems
- }, (0,external_wp_i18n_namespaceObject.__)('Select all')), (0,external_React_.createElement)(bulk_actions_DropdownMenuItem, {
- disabled: selection.length === 0,
- hideOnClick: false,
- onClick: () => {
- onSelectionChange([]);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Deselect')))), actionWithModal && (0,external_React_.createElement)(bulk_actions_ActionWithModal, {
- action: actionWithModal,
- selectedItems: selectedItems,
- setActionWithModal: setActionWithModal,
- onMenuOpenChange: onMenuOpenChange
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-table.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-const {
- DropdownMenuV2: view_table_DropdownMenu,
- DropdownMenuGroupV2: view_table_DropdownMenuGroup,
- DropdownMenuItemV2: view_table_DropdownMenuItem,
- DropdownMenuRadioItemV2: DropdownMenuRadioItem,
- DropdownMenuItemLabelV2: view_table_DropdownMenuItemLabel,
- DropdownMenuSeparatorV2: view_table_DropdownMenuSeparator
-} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
-function WithSeparators({
+function SidebarContentWrapper({
children
}) {
- return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, {
- key: i
- }, i > 0 && (0,external_React_.createElement)(view_table_DropdownMenuSeparator, null), child));
-}
-const sortArrows = {
- asc: '↑',
- desc: '↓'
-};
-const HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({
- field,
- view,
- onChangeView,
- onHide,
- setOpenedFilter
-}, ref) {
- const isHidable = field.enableHiding !== false;
- const isSortable = field.enableSorting !== false;
- const isSorted = view.sort?.field === field.id;
- const operators = sanitizeOperators(field);
- // Filter can be added:
- // 1. If the field is not already part of a view's filters.
- // 2. If the field meets the type and operator requirements.
- // 3. If it's not primary. If it is, it should be already visible.
- const canAddFilter = !view.filters?.some(_filter => field.id === _filter.field) && field.type === constants_ENUMERATION_TYPE && !!operators.length && !field.filterBy?.isPrimary;
- if (!isSortable && !isHidable && !canAddFilter) {
- return field.header;
- }
- return (0,external_React_.createElement)(view_table_DropdownMenu, {
- align: "start",
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- size: "compact",
- className: "dataviews-view-table-header-button",
- ref: ref,
- variant: "tertiary"
- }, field.header, isSorted && (0,external_React_.createElement)("span", {
- "aria-hidden": "true"
- }, isSorted && sortArrows[view.sort.direction])),
- style: {
- minWidth: '240px'
- }
- }, (0,external_React_.createElement)(WithSeparators, null, isSortable && (0,external_React_.createElement)(view_table_DropdownMenuGroup, null, Object.entries(SORTING_DIRECTIONS).map(([direction, info]) => {
- const isChecked = isSorted && view.sort.direction === direction;
- const value = `${field.id}-${direction}`;
- return (0,external_React_.createElement)(DropdownMenuRadioItem, {
- key: value
- // All sorting radio items share the same name, so that
- // selecting a sorting option automatically deselects the
- // previously selected one, even if it is displayed in
- // another submenu. The field and direction are passed via
- // the `value` prop.
- ,
- name: "view-table-sorting",
- value: value,
- checked: isChecked,
- onChange: () => {
- onChangeView({
- ...view,
- sort: {
- field: field.id,
- direction
- }
- });
- }
- }, (0,external_React_.createElement)(view_table_DropdownMenuItemLabel, null, info.label));
- })), canAddFilter && (0,external_React_.createElement)(view_table_DropdownMenuGroup, null, (0,external_React_.createElement)(view_table_DropdownMenuItem, {
- prefix: (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_funnel
- }),
- onClick: () => {
- setOpenedFilter(field.id);
- onChangeView({
- ...view,
- page: 1,
- filters: [...(view.filters || []), {
- field: field.id,
- value: undefined,
- operator: operators[0]
- }]
- });
- }
- }, (0,external_React_.createElement)(view_table_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Add filter')))), isHidable && (0,external_React_.createElement)(view_table_DropdownMenuItem, {
- prefix: (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_unseen
- }),
- onClick: () => {
- onHide(field);
- onChangeView({
- ...view,
- hiddenFields: view.hiddenFields.concat(field.id)
- });
- }
- }, (0,external_React_.createElement)(view_table_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Hide')))));
-});
-function BulkSelectionCheckbox({
- selection,
- onSelectionChange,
- data,
- actions
-}) {
- const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return data.filter(item => {
- return actions.some(action => action.supportsBulk && action.isEligible(item));
- });
- }, [data, actions]);
- const areAllSelected = selection.length === selectableItems.length;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- className: "dataviews-view-table-selection-checkbox",
- __nextHasNoMarginBottom: true,
- checked: areAllSelected,
- indeterminate: !areAllSelected && selection.length,
- onChange: () => {
- if (areAllSelected) {
- onSelectionChange([]);
- } else {
- onSelectionChange(selectableItems);
- }
- },
- label: areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all')
+ const navState = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext);
+ const wrapperRef = (0,external_wp_element_namespaceObject.useRef)();
+ const [navAnimation, setNavAnimation] = (0,external_wp_element_namespaceObject.useState)(null);
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
+ const {
+ direction,
+ focusSelector
+ } = navState.get();
+ focusSidebarElement(wrapperRef.current, direction, focusSelector);
+ setNavAnimation(direction);
+ }, [navState]);
+ const wrapperCls = dist_clsx('edit-site-sidebar__screen-wrapper', {
+ 'slide-from-left': navAnimation === 'back',
+ 'slide-from-right': navAnimation === 'forward'
});
-}
-function TableRow({
- hasBulkActions,
- item,
- actions,
- id,
- visibleFields,
- primaryField,
- selection,
- getItemId,
- onSelectionChange,
- data
-}) {
- const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
- return (0,external_React_.createElement)("tr", {
- className: classnames_default()('dataviews-view-table__row', {
- 'is-selected': hasPossibleBulkAction && selection.includes(id)
- })
- }, hasBulkActions && (0,external_React_.createElement)("td", {
- className: "dataviews-view-table__checkbox-column",
- style: {
- width: 20,
- minWidth: 20
- }
- }, (0,external_React_.createElement)("div", {
- className: "dataviews-view-table__cell-content-wrapper"
- }, (0,external_React_.createElement)(SingleSelectionCheckbox, {
- id: id,
- item: item,
- selection: selection,
- onSelectionChange: onSelectionChange,
- getItemId: getItemId,
- data: data,
- primaryField: primaryField,
- disabled: !hasPossibleBulkAction
- }))), visibleFields.map(field => (0,external_React_.createElement)("td", {
- key: field.id,
- style: {
- width: field.width || undefined,
- minWidth: field.minWidth || undefined,
- maxWidth: field.maxWidth || undefined
- }
- }, (0,external_React_.createElement)("div", {
- className: classnames_default()('dataviews-view-table__cell-content-wrapper', {
- 'dataviews-view-table__primary-field': primaryField?.id === field.id
- })
- }, field.render({
- item
- })))), !!actions?.length && (0,external_React_.createElement)("td", {
- className: "dataviews-view-table__actions-column"
- }, (0,external_React_.createElement)(ItemActions, {
- item: item,
- actions: actions
- })));
-}
-function ViewTable({
- view,
- onChangeView,
- fields,
- actions,
- data,
- getItemId,
- isLoading = false,
- deferredRendering,
- selection,
- onSelectionChange,
- setOpenedFilter
-}) {
- const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map());
- const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)();
- const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)();
- const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (headerMenuToFocusRef.current) {
- headerMenuToFocusRef.current.focus();
- headerMenuToFocusRef.current = undefined;
- }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ref: wrapperRef,
+ className: wrapperCls,
+ children: children
});
- const asyncData = (0,external_wp_compose_namespaceObject.useAsyncList)(data);
- const tableNoticeId = (0,external_wp_element_namespaceObject.useId)();
- if (nextHeaderMenuToFocus) {
- // If we need to force focus, we short-circuit rendering here
- // to prevent any additional work while we handle that.
- // Clearing out the focus directive is necessary to make sure
- // future renders don't cause unexpected focus jumps.
- headerMenuToFocusRef.current = nextHeaderMenuToFocus;
- setNextHeaderMenuToFocus();
- return;
- }
- const onHide = field => {
- const hidden = headerMenuRefs.current.get(field.id);
- const fallback = headerMenuRefs.current.get(hidden.fallback);
- setNextHeaderMenuToFocus(fallback?.node);
- };
- const visibleFields = fields.filter(field => !view.hiddenFields.includes(field.id) && ![view.layout.mediaField].includes(field.id));
- const usedData = deferredRendering ? asyncData : data;
- const hasData = !!usedData?.length;
- const sortValues = {
- asc: 'ascending',
- desc: 'descending'
- };
- const primaryField = fields.find(field => field.id === view.layout.primaryField);
- return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_.createElement)("table", {
- className: "dataviews-view-table",
- "aria-busy": isLoading,
- "aria-describedby": tableNoticeId
- }, (0,external_React_.createElement)("thead", null, (0,external_React_.createElement)("tr", {
- className: "dataviews-view-table__row"
- }, hasBulkActions && (0,external_React_.createElement)("th", {
- className: "dataviews-view-table__checkbox-column",
- style: {
- width: 20,
- minWidth: 20
- },
- "data-field-id": "selection",
- scope: "col"
- }, (0,external_React_.createElement)(BulkSelectionCheckbox, {
- selection: selection,
- onSelectionChange: onSelectionChange,
- data: data,
- actions: actions
- })), visibleFields.map((field, index) => (0,external_React_.createElement)("th", {
- key: field.id,
- style: {
- width: field.width || undefined,
- minWidth: field.minWidth || undefined,
- maxWidth: field.maxWidth || undefined
- },
- "data-field-id": field.id,
- "aria-sort": view.sort?.field === field.id && sortValues[view.sort.direction],
- scope: "col"
- }, (0,external_React_.createElement)(HeaderMenu, {
- ref: node => {
- if (node) {
- headerMenuRefs.current.set(field.id, {
- node,
- fallback: visibleFields[index > 0 ? index - 1 : 1]?.id
- });
- } else {
- headerMenuRefs.current.delete(field.id);
- }
- },
- field: field,
- view: view,
- onChangeView: onChangeView,
- onHide: onHide,
- setOpenedFilter: setOpenedFilter
- }))), !!actions?.length && (0,external_React_.createElement)("th", {
- "data-field-id": "actions",
- className: "dataviews-view-table__actions-column"
- }, (0,external_React_.createElement)("span", {
- className: "dataviews-view-table-header"
- }, (0,external_wp_i18n_namespaceObject.__)('Actions'))))), (0,external_React_.createElement)("tbody", null, hasData && usedData.map((item, index) => (0,external_React_.createElement)(TableRow, {
- key: getItemId(item),
- item: item,
- hasBulkActions: hasBulkActions,
- actions: actions,
- id: getItemId(item) || index,
- visibleFields: visibleFields,
- primaryField: primaryField,
- selection: selection,
- getItemId: getItemId,
- onSelectionChange: onSelectionChange,
- data: data
- })))), (0,external_React_.createElement)("div", {
- className: classnames_default()({
- 'dataviews-loading': isLoading,
- 'dataviews-no-results': !hasData && !isLoading
- }),
- id: tableNoticeId
- }, !hasData && (0,external_React_.createElement)("p", null, isLoading ? (0,external_wp_i18n_namespaceObject.__)('Loading…') : (0,external_wp_i18n_namespaceObject.__)('No results'))));
}
-/* harmony default export */ const view_table = (ViewTable);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-grid.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-function GridItem({
- selection,
- data,
- onSelectionChange,
- getItemId,
- item,
- actions,
- mediaField,
- primaryField,
- visibleFields
-}) {
- const [hasNoPointerEvents, setHasNoPointerEvents] = (0,external_wp_element_namespaceObject.useState)(false);
- const hasBulkAction = useHasAPossibleBulkAction(actions, item);
- const id = getItemId(item);
- const isSelected = selection.includes(id);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0,
- key: id,
- className: classnames_default()('dataviews-view-grid__card', {
- 'is-selected': hasBulkAction && isSelected,
- 'has-no-pointer-events': hasNoPointerEvents
- }),
- onMouseDown: event => {
- if (hasBulkAction && (event.ctrlKey || event.metaKey)) {
- setHasNoPointerEvents(true);
- if (!isSelected) {
- onSelectionChange(data.filter(_item => {
- const itemId = getItemId?.(_item);
- return itemId === id || selection.includes(itemId);
- }));
- } else {
- onSelectionChange(data.filter(_item => {
- const itemId = getItemId?.(_item);
- return itemId !== id && selection.includes(itemId);
- }));
- }
- }
- },
- onClick: () => {
- if (hasNoPointerEvents) {
- setHasNoPointerEvents(false);
- }
- }
- }, (0,external_React_.createElement)("div", {
- className: "dataviews-view-grid__media"
- }, mediaField?.render({
- item
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between",
- className: "dataviews-view-grid__title-actions"
- }, (0,external_React_.createElement)(SingleSelectionCheckbox, {
- id: id,
- item: item,
- selection: selection,
- onSelectionChange: onSelectionChange,
- getItemId: getItemId,
- data: data,
- primaryField: primaryField,
- disabled: !hasBulkAction
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "dataviews-view-grid__primary-field"
- }, primaryField?.render({
- item
- })), (0,external_React_.createElement)(ItemActions, {
- item: item,
- actions: actions,
- isCompact: true
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "dataviews-view-grid__fields",
- spacing: 3
- }, visibleFields.map(field => {
- const renderedValue = field.render({
- item
- });
- if (!renderedValue) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "dataviews-view-grid__field",
- key: field.id,
- spacing: 1
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: field.header,
- placement: "left"
- }, (0,external_React_.createElement)("div", {
- className: "dataviews-view-grid__field-value"
- }, renderedValue)));
- })));
-}
-function ViewGrid({
- data,
- fields,
- view,
- actions,
- isLoading,
- getItemId,
- deferredRendering,
- selection,
- onSelectionChange
+function SidebarContent({
+ routeKey,
+ children
}) {
- const mediaField = fields.find(field => field.id === view.layout.mediaField);
- const primaryField = fields.find(field => field.id === view.layout.primaryField);
- const visibleFields = fields.filter(field => !view.hiddenFields.includes(field.id) && ![view.layout.mediaField, view.layout.primaryField].includes(field.id));
- const shownData = (0,external_wp_compose_namespaceObject.useAsyncList)(data, {
- step: 3
- });
- const usedData = deferredRendering ? shownData : data;
- const hasData = !!usedData?.length;
- return (0,external_React_.createElement)(external_React_.Fragment, null, hasData && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
- gap: 6,
- columns: 2,
- alignment: "top",
- className: "dataviews-view-grid",
- "aria-busy": isLoading
- }, usedData.map(item => {
- return (0,external_React_.createElement)(GridItem, {
- key: getItemId(item),
- selection: selection,
- data: data,
- onSelectionChange: onSelectionChange,
- getItemId: getItemId,
- item: item,
- actions: actions,
- mediaField: mediaField,
- primaryField: primaryField,
- visibleFields: visibleFields
- });
- })), !hasData && (0,external_React_.createElement)("div", {
- className: classnames_default()({
- 'dataviews-loading': isLoading,
- 'dataviews-no-results': !isLoading
+ const [navState] = (0,external_wp_element_namespaceObject.useState)(createNavState);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, {
+ value: navState,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar__content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContentWrapper, {
+ children: children
+ }, routeKey)
})
- }, (0,external_React_.createElement)("p", null, isLoading ? (0,external_wp_i18n_namespaceObject.__)('Loading…') : (0,external_wp_i18n_namespaceObject.__)('No results'))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
-
-/**
- * WordPress dependencies
- */
-
-const info = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 3.2c-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.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
-}));
-/* harmony default export */ const library_info = (info);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-list.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-function ViewList({
- view,
- fields,
- data,
- isLoading,
- getItemId,
- onSelectionChange,
- onDetailsChange,
- selection,
- deferredRendering
-}) {
- const shownData = (0,external_wp_compose_namespaceObject.useAsyncList)(data, {
- step: 3
});
- const usedData = deferredRendering ? shownData : data;
- const mediaField = fields.find(field => field.id === view.layout.mediaField);
- const primaryField = fields.find(field => field.id === view.layout.primaryField);
- const visibleFields = fields.filter(field => !view.hiddenFields.includes(field.id) && ![view.layout.primaryField, view.layout.mediaField].includes(field.id));
- const onEnter = item => event => {
- const {
- keyCode
- } = event;
- if ([external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.SPACE].includes(keyCode)) {
- onSelectionChange([item]);
- }
- };
- const hasData = usedData?.length;
- if (!hasData) {
- return (0,external_React_.createElement)("div", {
- className: classnames_default()({
- 'dataviews-loading': isLoading,
- 'dataviews-no-results': !hasData && !isLoading
- })
- }, !hasData && (0,external_React_.createElement)("p", null, isLoading ? (0,external_wp_i18n_namespaceObject.__)('Loading…') : (0,external_wp_i18n_namespaceObject.__)('No results')));
- }
- return (0,external_React_.createElement)("ul", {
- className: "dataviews-view-list"
- }, usedData.map(item => {
- return (0,external_React_.createElement)("li", {
- key: getItemId(item),
- className: classnames_default()({
- 'is-selected': selection.includes(item.id)
- })
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "dataviews-view-list__item-wrapper"
- }, (0,external_React_.createElement)("div", {
- role: "button",
- tabIndex: 0,
- "aria-pressed": selection.includes(item.id),
- onKeyDown: onEnter(item),
- className: "dataviews-view-list__item",
- onClick: () => onSelectionChange([item])
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 3,
- justify: "start",
- alignment: "flex-start"
- }, (0,external_React_.createElement)("div", {
- className: "dataviews-view-list__media-wrapper"
- }, mediaField?.render({
- item
- }) || (0,external_React_.createElement)("div", {
- className: "dataviews-view-list__media-placeholder"
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 1
- }, (0,external_React_.createElement)("span", {
- className: "dataviews-view-list__primary-field"
- }, primaryField?.render({
- item
- })), (0,external_React_.createElement)("div", {
- className: "dataviews-view-list__fields"
- }, visibleFields.map(field => {
- return (0,external_React_.createElement)("span", {
- key: field.id,
- className: "dataviews-view-list__field"
- }, field.render({
- item
- }));
- }))))), onDetailsChange && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "dataviews-view-list__details-button",
- onClick: () => onDetailsChange([item]),
- icon: library_info,
- label: (0,external_wp_i18n_namespaceObject.__)('View details'),
- size: "compact"
- })));
- }));
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/constants.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-// Field types.
-const constants_ENUMERATION_TYPE = 'enumeration';
-
-// Filter operators.
-const constants_OPERATOR_IN = 'in';
-const constants_OPERATOR_NOT_IN = 'notIn';
-const OPERATORS = {
- [constants_OPERATOR_IN]: {
- key: 'in-filter',
- label: (0,external_wp_i18n_namespaceObject.__)('Is')
- },
- [constants_OPERATOR_NOT_IN]: {
- key: 'not-in-filter',
- label: (0,external_wp_i18n_namespaceObject.__)('Is not')
- }
-};
-
-// Sorting
-const SORTING_DIRECTIONS = {
- asc: {
- label: (0,external_wp_i18n_namespaceObject.__)('Sort ascending')
- },
- desc: {
- label: (0,external_wp_i18n_namespaceObject.__)('Sort descending')
- }
-};
-
-// View layouts.
-const constants_LAYOUT_TABLE = 'table';
-const constants_LAYOUT_GRID = 'grid';
-const constants_LAYOUT_LIST = 'list';
-const VIEW_LAYOUTS = [{
- type: constants_LAYOUT_TABLE,
- label: (0,external_wp_i18n_namespaceObject.__)('Table'),
- component: view_table,
- icon: block_table
-}, {
- type: constants_LAYOUT_GRID,
- label: (0,external_wp_i18n_namespaceObject.__)('Grid'),
- component: ViewGrid,
- icon: library_category
-}, {
- type: constants_LAYOUT_LIST,
- label: (0,external_wp_i18n_namespaceObject.__)('List'),
- component: ViewList,
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets
-}];
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js
/**
* External dependencies
*/
@@ -20820,55 +9621,10 @@ const VIEW_LAYOUTS = [{
-/**
- * Internal dependencies
- */
-const {
- useLocation: dataview_item_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function DataViewItem({
- title,
- slug,
- customViewId,
- type,
- icon,
- isActive,
- isCustom,
- suffix
-}) {
- const {
- params: {
- path,
- layout
- }
- } = dataview_item_useLocation();
- const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon;
- const linkInfo = useLink({
- path,
- layout,
- activeView: isCustom === 'true' ? customViewId : slug,
- isCustom
- });
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start",
- className: classnames_default()('edit-site-sidebar-dataviews-dataview-item', {
- 'is-selected': isActive
- })
- }, (0,external_React_.createElement)(SidebarNavigationItem, {
- icon: iconToUse,
- ...linkInfo,
- "aria-current": isActive ? 'true' : undefined
- }, title), suffix);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js
-/**
- * WordPress dependencies
- */
@@ -20879,2776 +9635,163 @@ function DataViewItem({
-const content_EMPTY_ARRAY = [];
-function TemplateDataviewItem({
- template,
- isActive
-}) {
- const {
- text,
- icon
- } = useAddedBy(template.type, template.id);
- return (0,external_React_.createElement)(DataViewItem, {
- key: text,
- slug: text,
- title: text,
- icon: icon,
- isActive: isActive,
- isCustom: "false"
- });
-}
-function DataviewsTemplatesSidebarContent({
- activeView,
- postType,
- title
-}) {
- const {
- records
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', postType, {
- per_page: -1
- });
- const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => {
- var _ref;
- const firstItemPerAuthor = records?.reduce((acc, template) => {
- const author = template.author_text;
- if (author && !acc[author]) {
- acc[author] = template;
- }
- return acc;
- }, {});
- return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY;
- }, [records]);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(DataViewItem, {
- slug: 'all',
- title: title,
- icon: library_layout,
- isActive: activeView === 'all',
- isCustom: "false"
- }), firstItemPerAuthorText.map(template => {
- return (0,external_React_.createElement)(TemplateDataviewItem, {
- key: template.author_text,
- template: template,
- isActive: activeView === template.author_text
- });
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-const config = {
- [constants_TEMPLATE_POST_TYPE]: {
- title: (0,external_wp_i18n_namespaceObject.__)('Manage templates'),
- description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
- contentTitle: (0,external_wp_i18n_namespaceObject.__)('All templates')
- },
- [TEMPLATE_PART_POST_TYPE]: {
- title: (0,external_wp_i18n_namespaceObject.__)('Manage template parts'),
- description: (0,external_wp_i18n_namespaceObject.__)('Create new template parts, or reset any customizations made to the template parts supplied by your theme.'),
- backPath: '/patterns',
- contentTitle: (0,external_wp_i18n_namespaceObject.__)('All template parts')
- }
-};
const {
- useLocation: sidebar_navigation_screen_templates_browse_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function SidebarNavigationScreenTemplatesBrowse() {
- const {
- params: {
- postType
- }
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- params: {
- didAccessPatternsPage,
- activeView = 'all'
- }
- } = sidebar_navigation_screen_templates_browse_useLocation();
- const isTemplatePartsMode = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return !!select(store_store).getSettings().supportsTemplatePartsMode;
- }, []);
- return (0,external_React_.createElement)(SidebarNavigationScreen
- // If a classic theme that supports template parts has never
- // accessed the Patterns page, return to the dashboard.
- , {
- isRoot: isTemplatePartsMode && !didAccessPatternsPage,
- title: config[postType].title,
- description: config[postType].description,
- backPath: config[postType].backPath,
- content: (0,external_React_.createElement)(DataviewsTemplatesSidebarContent, {
- activeView: activeView,
- postType: postType,
- title: config[postType].contentTitle
- })
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-function SaveButton({
- className = 'edit-site-save-button__button',
- variant = 'primary',
- showTooltip = true,
- defaultLabel,
- icon,
- __next40pxDefaultSize = false
-}) {
- const {
- isDirty,
- isSaving,
- isSaveViewOpen,
- previewingThemeName
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- __experimentalGetDirtyEntityRecords,
- isSavingEntityRecord,
- isResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- const {
- isSaveViewOpened
- } = select(store_store);
- const isActivatingTheme = isResolving('activateTheme');
- const currentlyPreviewingThemeId = currentlyPreviewingTheme();
- return {
- isDirty: dirtyEntityRecords.length > 0,
- isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme,
- isSaveViewOpen: isSaveViewOpened(),
- // Do not call `getTheme` with null, it will cause a request to
- // the server.
- previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined
- };
- }, []);
- const {
- setIsSaveViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const activateSaveEnabled = isPreviewingTheme() || isDirty;
- const disabled = isSaving || !activateSaveEnabled;
- const getLabel = () => {
- if (isPreviewingTheme()) {
- if (isSaving) {
- return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
- (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName);
- } else if (disabled) {
- return (0,external_wp_i18n_namespaceObject.__)('Saved');
- } else if (isDirty) {
- return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
- (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName);
- }
- return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
- (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName);
- }
- if (isSaving) {
- return (0,external_wp_i18n_namespaceObject.__)('Saving');
- } else if (disabled) {
- return (0,external_wp_i18n_namespaceObject.__)('Saved');
- } else if (defaultLabel) {
- return defaultLabel;
- }
- return (0,external_wp_i18n_namespaceObject.__)('Save');
- };
- const label = getLabel();
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: variant,
- className: className,
- "aria-disabled": disabled,
- "aria-expanded": isSaveViewOpen,
- isBusy: isSaving,
- onClick: disabled ? undefined : () => setIsSaveViewOpened(true),
- label: label
- /*
- * We want the tooltip to show the keyboard shortcut only when the
- * button does something, i.e. when it's not disabled.
- */,
- shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s')
- /*
- * Displaying the keyboard shortcut conditionally makes the tooltip
- * itself show conditionally. This would trigger a full-rerendering
- * of the button that we want to avoid. By setting `showTooltip`,
- * the tooltip is always rendered even when there's no keyboard shortcut.
- */,
- showTooltip: showTooltip,
- icon: icon,
- __next40pxDefaultSize: __next40pxDefaultSize,
- size: "compact"
- }, label);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
+ useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
-const {
- useLocation: save_hub_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const PUBLISH_ON_SAVE_ENTITIES = [{
- kind: 'postType',
- name: NAVIGATION_POST_TYPE
-}];
-function SaveHub() {
- const saveNoticeId = 'site-edit-save-notice';
+const SiteHub = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({
+ isTransparent
+}, ref) => {
const {
- params
- } = save_hub_useLocation();
- const {
- __unstableMarkLastChangeAsPersistent
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice,
- removeNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- dirtyCurrentEntity,
- countUnsavedChanges,
- isDirty,
- isSaving
+ dashboardLink,
+ homeUrl,
+ siteTitle
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- __experimentalGetDirtyEntityRecords,
- isSavingEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- let calcDirtyCurrentEntity = null;
- if (dirtyEntityRecords.length === 1) {
- // if we are on global styles
- if (params.path?.includes('wp_global_styles')) {
- calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === 'globalStyles');
- }
- // if we are on pages
- else if (params.postId) {
- calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === params.postType && String(record.key) === params.postId);
- }
- }
- return {
- dirtyCurrentEntity: calcDirtyCurrentEntity,
- isDirty: dirtyEntityRecords.length > 0,
- isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)),
- countUnsavedChanges: dirtyEntityRecords.length
- };
- }, [params.path, params.postType, params.postId]);
- const {
- editEntityRecord,
- saveEditedEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const disabled = isSaving || !isDirty && !isPreviewingTheme();
-
- // if we have only one unsaved change and it matches current context, we can show a more specific label
- let label = dirtyCurrentEntity ? (0,external_wp_i18n_namespaceObject.__)('Save') : (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %d: number of unsaved changes (number).
- (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', countUnsavedChanges), countUnsavedChanges);
- if (isSaving) {
- label = (0,external_wp_i18n_namespaceObject.__)('Saving');
- }
- const {
- homeUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ getSettings
+ } = lock_unlock_unlock(select(store));
const {
+ getSite,
getUnstableBase // Site index.
} = select(external_wp_coreData_namespaceObject.store);
+ const _site = getSite();
return {
- homeUrl: getUnstableBase()?.home
- };
- }, []);
- const saveCurrentEntity = async () => {
- if (!dirtyCurrentEntity) return;
- removeNotice(saveNoticeId);
- const {
- kind,
- name,
- key,
- property
- } = dirtyCurrentEntity;
- try {
- if ('root' === dirtyCurrentEntity.kind && 'site' === name) {
- await saveSpecifiedEntityEdits('root', 'site', undefined, [property]);
- } else {
- if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
- editEntityRecord(kind, name, key, {
- status: 'publish'
- });
- }
- await saveEditedEntityRecord(kind, name, key);
- }
- __unstableMarkLastChangeAsPersistent();
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('View site'),
- url: homeUrl
- }],
- id: saveNoticeId
- });
- } catch (error) {
- createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`);
- }
- };
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- className: "edit-site-save-hub",
- alignment: "right",
- spacing: 4
- }, dirtyCurrentEntity ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: saveCurrentEntity,
- isBusy: isSaving,
- disabled: isSaving,
- "aria-disabled": isSaving,
- className: "edit-site-save-hub__button",
- __next40pxDefaultSize: true
- }, label) : (0,external_React_.createElement)(SaveButton, {
- className: "edit-site-save-hub__button",
- variant: disabled ? null : 'primary',
- showTooltip: false,
- icon: disabled && !isSaving ? library_check : null,
- defaultLabel: label,
- __next40pxDefaultSize: true
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-page/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-function AddNewPageModal({
- onSave,
- onClose
-}) {
- const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false);
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createErrorNotice,
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- async function createPage(event) {
- event.preventDefault();
- if (isCreatingPage) {
- return;
- }
- setIsCreatingPage(true);
- try {
- const newPage = await saveEntityRecord('postType', 'page', {
- status: 'draft',
- title,
- slug: title || (0,external_wp_i18n_namespaceObject.__)('No title')
- }, {
- throwOnError: true
- });
- onSave(newPage);
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Title of the created template e.g: "Category".
- (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), newPage.title?.rendered || title), {
- type: 'snackbar'
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the page.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- } finally {
- setIsCreatingPage(false);
- }
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Draft a new page'),
- onRequestClose: onClose
- }, (0,external_React_.createElement)("form", {
- onSubmit: createPage
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Page title'),
- onChange: setTitle,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'),
- value: title
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 2,
- justify: "end"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: onClose
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- isBusy: isCreatingPage,
- "aria-disabled": isCreatingPage
- }, (0,external_wp_i18n_namespaceObject.__)('Create draft'))))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-pages/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-const {
- useHistory: sidebar_navigation_screen_pages_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const PageItem = ({
- postType = 'page',
- postId,
- ...props
-}) => {
- const linkInfo = useLink({
- postType,
- postId
- }, {
- backPath: '/page'
- });
- return (0,external_React_.createElement)(SidebarNavigationItem, {
- ...linkInfo,
- ...props
- });
-};
-function SidebarNavigationScreenPages() {
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const {
- records: pages,
- isResolving: isLoadingPages
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'page', {
- status: 'any',
- per_page: -1
- });
- const {
- records: templates,
- isResolving: isLoadingTemplates
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', constants_TEMPLATE_POST_TYPE, {
- per_page: -1
- });
- const dynamicPageTemplates = templates?.filter(({
- slug
- }) => ['404', 'search'].includes(slug));
- const homeTemplate = templates?.find(template => template.slug === 'front-page') || templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
- const getPostsPageTemplate = () => templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
- const pagesAndTemplates = pages?.concat(dynamicPageTemplates, [homeTemplate]);
- const {
- frontPage,
- postsPage
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const siteSettings = getEntityRecord('root', 'site');
- return {
- frontPage: siteSettings?.page_on_front,
- postsPage: siteSettings?.page_for_posts
+ dashboardLink: getSettings().__experimentalDashboardLink || 'index.php',
+ homeUrl: getUnstableBase()?.home,
+ siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title
};
}, []);
- const isHomePageBlog = frontPage === postsPage;
- const reorderedPages = pages && [...pages];
- if (!isHomePageBlog && reorderedPages?.length) {
- const homePageIndex = reorderedPages.findIndex(item => item.id === frontPage);
- const homePage = reorderedPages.splice(homePageIndex, 1);
- reorderedPages?.splice(0, 0, ...homePage);
- const postsPageIndex = reorderedPages.findIndex(item => item.id === postsPage);
- const blogPage = reorderedPages.splice(postsPageIndex, 1);
- reorderedPages.splice(1, 0, ...blogPage);
- }
- const [showAddPage, setShowAddPage] = (0,external_wp_element_namespaceObject.useState)(false);
- const history = sidebar_navigation_screen_pages_useHistory();
- const handleNewPage = ({
- type,
- id
- }) => {
- // Navigate to the created template editor.
- history.push({
- postId: id,
- postType: type,
- canvas: 'edit'
- });
- setShowAddPage(false);
- };
- const getPageProps = id => {
- let itemIcon = library_page;
- const postsPageTemplateId = postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
- switch (id) {
- case frontPage:
- itemIcon = library_home;
- break;
- case postsPage:
- itemIcon = library_verse;
- break;
- }
- return {
- icon: itemIcon,
- postType: postsPageTemplateId ? constants_TEMPLATE_POST_TYPE : 'page',
- postId: postsPageTemplateId || id
- };
- };
- const pagesLink = useLink({
- path: '/pages'
- });
- return (0,external_React_.createElement)(external_React_.Fragment, null, showAddPage && (0,external_React_.createElement)(AddNewPageModal, {
- onSave: handleNewPage,
- onClose: () => setShowAddPage(false)
- }), (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: (0,external_wp_i18n_namespaceObject.__)('Pages'),
- description: (0,external_wp_i18n_namespaceObject.__)('Browse and manage pages.'),
- actions: (0,external_React_.createElement)(SidebarButton, {
- icon: library_plus,
- label: (0,external_wp_i18n_namespaceObject.__)('Draft a new page'),
- onClick: () => setShowAddPage(true)
- }),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (isLoadingPages || isLoadingTemplates) && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('Loading pages…'))), !(isLoadingPages || isLoadingTemplates) && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, !pagesAndTemplates?.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('No page found')), isHomePageBlog && homeTemplate && (0,external_React_.createElement)(PageItem, {
- postType: constants_TEMPLATE_POST_TYPE,
- postId: homeTemplate.id,
- key: homeTemplate.id,
- icon: library_home,
- withChevron: true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- numberOfLines: 1
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(homeTemplate.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)')))), reorderedPages?.map(({
- id,
- title
- }) => (0,external_React_.createElement)(PageItem, {
- ...getPageProps(id),
- key: id,
- withChevron: true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- numberOfLines: 1
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'))))))),
- footer: (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0
- }, dynamicPageTemplates?.map(item => (0,external_React_.createElement)(PageItem, {
- postType: constants_TEMPLATE_POST_TYPE,
- postId: item.id,
- key: item.id,
- icon: library_layout,
- withChevron: true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- numberOfLines: 1
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'))))), !isMobileViewport && (0,external_React_.createElement)(SidebarNavigationItem, {
- className: "edit-site-sidebar-navigation-screen-pages__see-all",
- ...pagesLink
- }, (0,external_wp_i18n_namespaceObject.__)('Manage all pages')))
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js
-
-/**
- * WordPress dependencies
- */
-
-const pages = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"
-}));
-/* harmony default export */ const library_pages = (pages);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drafts.js
-
-/**
- * WordPress dependencies
- */
-
-const drafts = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M8 2H6a2 2 0 0 0-2 2v2.4h1.5V4a.5.5 0 0 1 .5-.5h2V2ZM4 13.6V16a2 2 0 0 0 2 2h2v-1.5H6a.5.5 0 0 1-.5-.5v-2.4H4Zm0-1.2h1.5V7.6H4v4.8ZM9 2v1.5h4V2H9Zm5 0v1.5h2a.5.5 0 0 1 .5.5v2.4H18V4a2 2 0 0 0-2-2h-2Zm4 5.6h-1.5v4.8H18V7.6Zm0 6h-1.5V16a.5.5 0 0 1-.5.5h-2V18h2a2 2 0 0 0 2-2v-2.4ZM13 18v-1.5H9V18h4ZM7 7.25h8v-1.5H7v1.5Zm0 3.25h6V9H7v1.5ZM21.75 19V6h-1.5v13c0 .69-.56 1.25-1.25 1.25H8v1.5h11A2.75 2.75 0 0 0 21.75 19Z"
-}));
-/* harmony default export */ const library_drafts = (drafts);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
-
-/**
- * WordPress dependencies
- */
-
-const trash = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
-}));
-/* harmony default export */ const library_trash = (trash);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-const DEFAULT_CONFIG_PER_VIEW_TYPE = {
- [LAYOUT_TABLE]: {
- primaryField: 'title'
- },
- [LAYOUT_GRID]: {
- mediaField: 'featured-image',
- primaryField: 'title'
- },
- [LAYOUT_LIST]: {
- primaryField: 'title',
- mediaField: 'featured-image'
- }
-};
-const DEFAULT_PAGE_BASE = {
- type: LAYOUT_TABLE,
- search: '',
- filters: [],
- page: 1,
- perPage: 20,
- sort: {
- field: 'date',
- direction: 'desc'
- },
- // All fields are visible by default, so it's
- // better to keep track of the hidden ones.
- hiddenFields: ['date', 'featured-image'],
- layout: {
- ...DEFAULT_CONFIG_PER_VIEW_TYPE[LAYOUT_TABLE]
- }
-};
-const DEFAULT_VIEWS = {
- page: [{
- title: (0,external_wp_i18n_namespaceObject.__)('All pages'),
- slug: 'all',
- icon: library_pages,
- view: DEFAULT_PAGE_BASE
- }, {
- title: (0,external_wp_i18n_namespaceObject.__)('Drafts'),
- slug: 'drafts',
- icon: library_drafts,
- view: {
- ...DEFAULT_PAGE_BASE,
- filters: [{
- field: 'status',
- operator: OPERATOR_IN,
- value: 'draft'
- }]
- }
- }, {
- title: (0,external_wp_i18n_namespaceObject.__)('Trash'),
- slug: 'trash',
- icon: library_trash,
- view: {
- ...DEFAULT_PAGE_BASE,
- filters: [{
- field: 'status',
- operator: OPERATOR_IN,
- value: 'trash'
- }]
- }
- }]
-};
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useHistory: add_new_view_useHistory,
- useLocation: add_new_view_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function AddNewItemModalContent({
- type,
- setIsAdding
-}) {
- const {
- params: {
- path
- }
- } = add_new_view_useLocation();
- const history = add_new_view_useHistory();
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
- const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)("form", {
- onSubmit: async event => {
- event.preventDefault();
- setIsSaving(true);
- const {
- getEntityRecords
- } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store);
- let dataViewTaxonomyId;
- const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', {
- slug: type
- });
- if (dataViewTypeRecords && dataViewTypeRecords.length > 0) {
- dataViewTaxonomyId = dataViewTypeRecords[0].id;
- } else {
- const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', {
- name: type
- });
- if (record && record.id) {
- dataViewTaxonomyId = record.id;
- }
- }
- const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', {
- title,
- status: 'publish',
- wp_dataviews_type: dataViewTaxonomyId,
- content: JSON.stringify(DEFAULT_VIEWS[type][0].view)
- });
- history.push({
- path,
- activeView: savedRecord.id,
- isCustom: 'true'
- });
- setIsSaving(false);
- setIsAdding(false);
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'),
- className: "patterns-create-modal__name-input"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- setIsAdding(false);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- "aria-disabled": !title || isSaving,
- isBusy: isSaving
- }, (0,external_wp_i18n_namespaceObject.__)('Create')))));
-}
-function AddNewItem({
- type
-}) {
- const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarNavigationItem, {
- icon: library_plus,
- onClick: () => {
- setIsAdding(true);
- },
- className: "dataviews__siderbar-content-add-new-item"
- }, (0,external_wp_i18n_namespaceObject.__)('New view')), isAdding && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Add new view'),
- onRequestClose: () => {
- setIsAdding(false);
- }
- }, (0,external_React_.createElement)(AddNewItemModalContent, {
- type: type,
- setIsAdding: setIsAdding
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useHistory: custom_dataviews_list_useHistory,
- useLocation: custom_dataviews_list_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const custom_dataviews_list_EMPTY_ARRAY = [];
-function RenameItemModalContent({
- dataviewId,
- currentTitle,
- setIsRenaming
-}) {
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle);
- return (0,external_React_.createElement)("form", {
- onSubmit: async event => {
- event.preventDefault();
- await editEntityRecord('postType', 'wp_dataviews', dataviewId, {
- title
- });
- setIsRenaming(false);
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'),
- className: "patterns-create-modal__name-input"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- setIsRenaming(false);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- "aria-disabled": !title
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')))));
-}
-function CustomDataViewItem({
- dataviewId,
- isActive
-}) {
- const {
- params: {
- path
- }
- } = custom_dataviews_list_useLocation();
- const history = custom_dataviews_list_useHistory();
const {
- dataview
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- return {
- dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId)
- };
- }, [dataviewId]);
- const {
- deleteEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const type = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const viewContent = JSON.parse(dataview.content);
- return viewContent.type;
- }, [dataview.content]);
- const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(DataViewItem, {
- title: dataview.title,
- type: type,
- isActive: isActive,
- isCustom: "true",
- customViewId: dataviewId,
- suffix: (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu",
- toggleProps: {
- style: {
- color: 'inherit'
- },
- size: 'small'
- }
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- setIsRenaming(true);
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: async () => {
- await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, {
- force: true
- });
- if (isActive) {
- history.replace({
- path
- });
- }
- onClose();
- },
- isDestructive: true
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))))
- }), isRenaming && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Rename view'),
- onRequestClose: () => {
- setIsRenaming(false);
- }
- }, (0,external_React_.createElement)(RenameItemModalContent, {
- dataviewId: dataviewId,
- setIsRenaming: setIsRenaming,
- currentTitle: dataview.title
- })));
-}
-function useCustomDataViews(type) {
- const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecords
- } = select(external_wp_coreData_namespaceObject.store);
- const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', {
- slug: type
- });
- if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) {
- return custom_dataviews_list_EMPTY_ARRAY;
- }
- const dataViews = getEntityRecords('postType', 'wp_dataviews', {
- wp_dataviews_type: dataViewTypeRecords[0].id,
- orderby: 'date',
- order: 'asc'
- });
- if (!dataViews) {
- return custom_dataviews_list_EMPTY_ARRAY;
- }
- return dataViews;
- });
- return customDataViews;
-}
-function CustomDataViewsList({
- type,
- activeView,
- isCustom
-}) {
- const customDataViews = useCustomDataViews(type);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen-dataviews__group-header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 2
- }, (0,external_wp_i18n_namespaceObject.__)('Custom Views'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, customDataViews.map(customViewRecord => {
- return (0,external_React_.createElement)(CustomDataViewItem, {
- key: customViewRecord.id,
- dataviewId: customViewRecord.id,
- isActive: isCustom === 'true' && Number(activeView) === customViewRecord.id
- });
- }), (0,external_React_.createElement)(AddNewItem, {
- type: type
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const {
- useLocation: sidebar_dataviews_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-
-
-const PATH_TO_TYPE = {
- '/pages': 'page'
-};
-function DataViewsSidebarContent() {
- const {
- params: {
- path,
- activeView = 'all',
- isCustom = 'false'
- }
- } = sidebar_dataviews_useLocation();
- if (!path || !PATH_TO_TYPE[path]) {
- return null;
- }
- const type = PATH_TO_TYPE[path];
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, DEFAULT_VIEWS[type].map(dataview => {
- return (0,external_React_.createElement)(DataViewItem, {
- key: dataview.slug,
- slug: dataview.slug,
- title: dataview.title,
- icon: dataview.icon,
- type: dataview.view.type,
- isActive: isCustom === 'false' && dataview.slug === activeView,
- isCustom: "false"
- });
- })), window?.__experimentalAdminViews && (0,external_React_.createElement)(CustomDataViewsList, {
- activeView: activeView,
- type: type,
- isCustom: "true"
- }));
-}
-
-;// CONCATENATED MODULE: external ["wp","dom"]
-const external_wp_dom_namespaceObject = window["wp"]["dom"];
-;// CONCATENATED MODULE: external ["wp","escapeHtml"]
-const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
-;// CONCATENATED MODULE: external ["wp","wordcount"]
-const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-page/status-label.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-function StatusLabel({
- status,
- date,
- short
-}) {
- const relateToNow = (0,external_wp_date_namespaceObject.humanTimeDiff)(date);
- let statusLabel = status;
- switch (status) {
- case 'publish':
- statusLabel = date ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the relative time when the post was published. */
- (0,external_wp_i18n_namespaceObject.__)('Published <time>%s</time>'), relateToNow), {
- time: (0,external_React_.createElement)("time", {
- dateTime: date
- })
- }) : (0,external_wp_i18n_namespaceObject.__)('Published');
- break;
- case 'future':
- const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)(short ? 'M j' : 'F j', (0,external_wp_date_namespaceObject.getDate)(date));
- statusLabel = date ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the formatted date and time on which the post is scheduled to be published. */
- (0,external_wp_i18n_namespaceObject.__)('Scheduled: <time>%s</time>'), formattedDate), {
- time: (0,external_React_.createElement)("time", {
- dateTime: date
+ open: openCommandCenter
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-site-hub",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ spacing: "0",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', {
+ 'has-transparent-background': isTransparent
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ ref: ref,
+ href: dashboardLink,
+ label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'),
+ className: "edit-site-layout__view-mode-toggle",
+ style: {
+ transform: 'scale(0.5)',
+ borderRadius: 4
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, {
+ className: "edit-site-layout__view-mode-toggle-icon"
+ })
})
- }) : (0,external_wp_i18n_namespaceObject.__)('Scheduled');
- break;
- case 'draft':
- statusLabel = (0,external_wp_i18n_namespaceObject.__)('Draft');
- break;
- case 'pending':
- statusLabel = (0,external_wp_i18n_namespaceObject.__)('Pending');
- break;
- case 'private':
- statusLabel = (0,external_wp_i18n_namespaceObject.__)('Private');
- break;
- case 'protected':
- statusLabel = (0,external_wp_i18n_namespaceObject.__)('Password protected');
- break;
- }
- return (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-sidebar-navigation-screen-page__status', {
- [`has-status has-${status}-status`]: !!status
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-site-hub__title",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ href: homeUrl,
+ target: "_blank",
+ label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'),
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 0,
+ expanded: false,
+ className: "edit-site-site-hub__actions",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "edit-site-site-hub_toggle-command-center",
+ icon: library_search,
+ onClick: () => openCommandCenter(),
+ label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'),
+ shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k')
+ })
+ })]
+ })]
})
- }, statusLabel);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-page/page-details.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-// Taken from packages/editor/src/components/time-to-read/index.js.
-const AVERAGE_READING_RATE = 189;
-function getPageDetails(page) {
- if (!page) {
- return [];
- }
- const details = [{
- label: (0,external_wp_i18n_namespaceObject.__)('Status'),
- value: (0,external_React_.createElement)(StatusLabel, {
- status: page?.password ? 'protected' : page.status,
- date: page?.date,
- short: true
- })
- }, {
- label: (0,external_wp_i18n_namespaceObject.__)('Slug'),
- value: (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- numberOfLines: 1
- }, (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(page.slug || page.generated_slug))
- }];
- if (page?.templateTitle) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Template'),
- value: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(page.templateTitle)
- });
- }
- if (page?.parentTitle) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
- value: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(page.parentTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'))
- });
- }
-
- /*
- * translators: If your word count is based on single characters (e.g. East Asian characters),
- * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
- * Do not translate into your own language.
- */
- const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
- const wordsCounted = page?.content?.rendered ? (0,external_wp_wordcount_namespaceObject.count)(page.content.rendered, wordCountType) : 0;
- const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
- if (wordsCounted && !page?.isPostsPage) {
- details.push({
- label: (0,external_wp_i18n_namespaceObject.__)('Words'),
- value: wordsCounted.toLocaleString() || (0,external_wp_i18n_namespaceObject.__)('Unknown')
- }, {
- label: (0,external_wp_i18n_namespaceObject.__)('Time to read'),
- value: readingTime > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the number of minutes. */
- (0,external_wp_i18n_namespaceObject.__)('%s mins'), readingTime.toLocaleString()) : (0,external_wp_i18n_namespaceObject.__)('< 1 min')
- });
- }
- return details;
-}
-function PageDetails({
- id
-}) {
- const {
- record
- } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'page', id);
- const {
- parentTitle,
- templateTitle,
- isPostsPage
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostId
- } = unlock(select(store_store));
- const template = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', constants_TEMPLATE_POST_TYPE, getEditedPostId());
- const _templateTitle = template?.title?.rendered;
-
- // Parent page title.
- const _parentTitle = record?.parent ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'page', record.parent, {
- _fields: ['title']
- })?.title?.rendered : null;
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const siteSettings = getEntityRecord('root', 'site');
- return {
- parentTitle: _parentTitle,
- templateTitle: _templateTitle,
- isPostsPage: record?.id === siteSettings?.page_for_posts
- };
- }, [record?.parent, record?.id]);
- return (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanel, {
- spacing: 5,
- title: (0,external_wp_i18n_namespaceObject.__)('Details')
- }, getPageDetails({
- parentTitle,
- templateTitle,
- isPostsPage,
- ...record
- }).map(({
- label,
- value
- }) => (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelRow, {
- key: label
- }, (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelLabel, null, label), (0,external_React_.createElement)(SidebarNavigationScreenDetailsPanelValue, null, value))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-actions/trash-page-menu-item.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-function TrashPageMenuItem({
- postId,
- onRemove
-}) {
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- deleteEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const page = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'page', postId), [postId]);
- async function removePage() {
- try {
- await deleteEntityRecord('postType', 'page', postId, {}, {
- throwOnError: true
- });
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The page's title. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the Trash.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(page.title.rendered)), {
- type: 'snackbar',
- id: 'edit-site-page-trashed'
- });
- onRemove?.();
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the page to the trash.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => removePage(),
- isDestructive: true,
- variant: "secondary"
- }, (0,external_wp_i18n_namespaceObject.__)('Move to Trash')));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-actions/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-function PageActions({
- postId,
- toggleProps,
- onRemove
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- toggleProps: toggleProps
- }, () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(TrashPageMenuItem, {
- postId: postId,
- onRemove: onRemove
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-page/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-const {
- useHistory: sidebar_navigation_screen_page_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function SidebarNavigationScreenPage({
- backPath
-}) {
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const history = sidebar_navigation_screen_page_useHistory();
- const {
- params: {
- postId
- },
- goTo
- } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const {
- record,
- hasResolved
- } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'page', postId);
- const {
- featuredMediaAltText,
- featuredMediaSourceUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- // Featured image.
- const attachedMedia = record?.featured_media ? getEntityRecord('postType', 'attachment', record?.featured_media) : null;
- return {
- featuredMediaSourceUrl: attachedMedia?.media_details.sizes?.medium?.source_url || attachedMedia?.source_url,
- featuredMediaAltText: (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(attachedMedia?.alt_text || attachedMedia?.description?.raw || '')
- };
- }, [record]);
-
- // Redirect to the main pages navigation screen if the page is not found or has been deleted.
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (hasResolved && !record) {
- history.push({
- path: '/page',
- postId: undefined,
- postType: undefined,
- canvas: 'view'
- });
- }
- }, [hasResolved, history]);
- const featureImageAltText = featuredMediaAltText ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(featuredMediaAltText) : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(record?.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('Featured image'));
- return record ? (0,external_React_.createElement)(SidebarNavigationScreen, {
- backPath: backPath,
- title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(record?.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)')),
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(PageActions, {
- postId: postId,
- toggleProps: {
- as: SidebarButton
- },
- onRemove: () => {
- goTo('/page');
- }
- }), (0,external_React_.createElement)(SidebarButton, {
- onClick: () => setCanvasMode('edit'),
- label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
- icon: library_pencil
- })),
- meta: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- className: "edit-site-sidebar-navigation-screen__page-link",
- href: record.link
- }, (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(record.link))),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, !!featuredMediaSourceUrl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-sidebar-navigation-screen-page__featured-image-wrapper",
- alignment: "left",
- spacing: 2
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-navigation-screen-page__featured-image has-image"
- }, (0,external_React_.createElement)("img", {
- alt: featureImageAltText,
- src: featuredMediaSourceUrl
- }))), !!record?.excerpt?.rendered && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
- className: "edit-site-sidebar-navigation-screen-page__excerpt",
- numberOfLines: 3
- }, (0,external_wp_dom_namespaceObject.__unstableStripHTML)(record.excerpt.rendered)), (0,external_React_.createElement)(PageDetails, {
- id: postId
- })),
- footer: record?.modified ? (0,external_React_.createElement)(SidebarNavigationScreenDetailsFooter, {
- record: record
- }) : null
- }) : null;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const {
- useLocation: sidebar_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function SidebarScreenWrapper({
- className,
- ...props
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- className: classnames_default()('edit-site-sidebar__screen-wrapper', className),
- ...props
- });
-}
-function SidebarScreens() {
- useSyncPathWithURL();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/"
- }, (0,external_React_.createElement)(SidebarNavigationScreenMain, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/navigation"
- }, (0,external_React_.createElement)(SidebarNavigationScreenNavigationMenus, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/navigation/:postType/:postId"
- }, (0,external_React_.createElement)(SidebarNavigationScreenNavigationMenu, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/wp_global_styles"
- }, (0,external_React_.createElement)(SidebarNavigationScreenGlobalStyles, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/page"
- }, (0,external_React_.createElement)(SidebarNavigationScreenPages, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/pages"
- }, (0,external_React_.createElement)(SidebarNavigationScreen, {
- title: (0,external_wp_i18n_namespaceObject.__)('Manage pages'),
- content: (0,external_React_.createElement)(DataViewsSidebarContent, null),
- backPath: "/page"
- })), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/page/:postId"
- }, (0,external_React_.createElement)(SidebarNavigationScreenPage, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/:postType(wp_template)"
- }, (0,external_React_.createElement)(SidebarNavigationScreenTemplates, null)), !isMobileViewport && (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/patterns"
- }, (0,external_React_.createElement)(SidebarNavigationScreenPatterns, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/:postType(wp_template|wp_template_part)/all"
- }, (0,external_React_.createElement)(SidebarNavigationScreenTemplatesBrowse, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/:postType(wp_template_part|wp_block)/:postId"
- }, (0,external_React_.createElement)(SidebarNavigationScreenPattern, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
- path: "/:postType(wp_template)/:postId"
- }, (0,external_React_.createElement)(SidebarNavigationScreenTemplate, null)));
-}
-function Sidebar() {
- const {
- params: urlParams
- } = sidebar_useLocation();
- const initialPath = (0,external_wp_element_namespaceObject.useRef)(getPathFromURL(urlParams));
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
- className: "edit-site-sidebar__content",
- initialPath: initialPath.current
- }, (0,external_React_.createElement)(SidebarScreens, null)), (0,external_React_.createElement)(SaveHub, null));
-}
-/* harmony default export */ const sidebar = ((0,external_wp_element_namespaceObject.memo)(Sidebar));
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-function CopyButton({
- text,
- children
-}) {
- const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- ref: ref
- }, children);
-}
-function ErrorBoundaryWarning({
- message,
- error
-}) {
- const actions = [(0,external_React_.createElement)(CopyButton, {
- key: "copy-error",
- text: error.stack
- }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))];
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
- className: "editor-error-boundary",
- actions: actions
- }, message);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-class ErrorBoundary extends external_wp_element_namespaceObject.Component {
- constructor() {
- super(...arguments);
- this.state = {
- error: null
- };
- }
- componentDidCatch(error) {
- (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
- }
- static getDerivedStateFromError(error) {
- return {
- error
- };
- }
- render() {
- if (!this.state.error) {
- return this.props.children;
- }
- return (0,external_React_.createElement)(ErrorBoundaryWarning, {
- message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'),
- error: this.state.error
- });
- }
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
-
-/**
- * WordPress dependencies
- */
-
-const next = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
-}));
-/* harmony default export */ const library_next = (next);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
-
-/**
- * WordPress dependencies
- */
-
-const previous = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
-}));
-/* harmony default export */ const library_previous = (previous);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
-
-/**
- * WordPress dependencies
- */
-
-const external = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
-}));
-/* harmony default export */ const library_external = (external);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js
-/**
- * WordPress dependencies
- */
-
-const textFormattingShortcuts = [{
- keyCombination: {
- modifier: 'primary',
- character: 'b'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
-}, {
- keyCombination: {
- modifier: 'primary',
- character: 'i'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
-}, {
- keyCombination: {
- modifier: 'primary',
- character: 'k'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
-}, {
- keyCombination: {
- modifier: 'primaryShift',
- character: 'k'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
-}, {
- keyCombination: {
- character: '[['
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.')
-}, {
- keyCombination: {
- modifier: 'primary',
- character: 'u'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
-}, {
- keyCombination: {
- modifier: 'access',
- character: 'd'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
-}, {
- keyCombination: {
- modifier: 'access',
- character: 'x'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
-}, {
- keyCombination: {
- modifier: 'access',
- character: '0'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.')
-}, {
- keyCombination: {
- modifier: 'access',
- character: '1-6'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.')
-}];
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js
-
-/**
- * WordPress dependencies
- */
-
-
-function KeyCombination({
- keyCombination,
- forceAriaLabel
-}) {
- const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
- const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
- return (0,external_React_.createElement)("kbd", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination",
- "aria-label": forceAriaLabel || ariaLabel
- }, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
- if (character === '+') {
- return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, {
- key: index
- }, character);
- }
- return (0,external_React_.createElement)("kbd", {
- key: index,
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-key"
- }, character);
- }));
-}
-function Shortcut({
- description,
- keyCombination,
- aliases = [],
- ariaLabel
-}) {
- return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_.createElement)("div", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-description"
- }, description), (0,external_React_.createElement)("div", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-term"
- }, (0,external_React_.createElement)(KeyCombination, {
- keyCombination: keyCombination,
- forceAriaLabel: ariaLabel
- }), aliases.map((alias, index) => (0,external_React_.createElement)(KeyCombination, {
- keyCombination: alias,
- forceAriaLabel: ariaLabel,
- key: index
- }))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-/**
- * Internal dependencies
- */
-
-function DynamicShortcut({
- name
-}) {
- const {
- keyCombination,
- description,
- aliases
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getShortcutKeyCombination,
- getShortcutDescription,
- getShortcutAliases
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
- return {
- keyCombination: getShortcutKeyCombination(name),
- aliases: getShortcutAliases(name),
- description: getShortcutDescription(name)
- };
- }, [name]);
- if (!keyCombination) {
- return null;
- }
- return (0,external_React_.createElement)(Shortcut, {
- keyCombination: keyCombination,
- description: description,
- aliases: aliases
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'edit-site/keyboard-shortcut-help';
-const ShortcutList = ({
- shortcuts
-}) =>
-/*
- * Disable reason: The `list` ARIA role is redundant but
- * Safari+VoiceOver won't announce the list otherwise.
- */
-/* eslint-disable jsx-a11y/no-redundant-roles */
-(0,external_React_.createElement)("ul", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-list",
- role: "list"
-}, shortcuts.map((shortcut, index) => (0,external_React_.createElement)("li", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut",
- key: index
-}, typeof shortcut === 'string' ? (0,external_React_.createElement)(DynamicShortcut, {
- name: shortcut
-}) : (0,external_React_.createElement)(Shortcut, {
- ...shortcut
-}))))
-/* eslint-enable jsx-a11y/no-redundant-roles */;
-const ShortcutSection = ({
- title,
- shortcuts,
- className
-}) => (0,external_React_.createElement)("section", {
- className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className)
-}, !!title && (0,external_React_.createElement)("h2", {
- className: "edit-site-keyboard-shortcut-help-modal__section-title"
-}, title), (0,external_React_.createElement)(ShortcutList, {
- shortcuts: shortcuts
-}));
-const ShortcutCategorySection = ({
- title,
- categoryName,
- additionalShortcuts = []
-}) => {
- const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
- }, [categoryName]);
- return (0,external_React_.createElement)(ShortcutSection, {
- title: title,
- shortcuts: categoryShortcuts.concat(additionalShortcuts)
- });
-};
-function KeyboardShortcutHelpModal() {
- const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME));
- const {
- closeModal,
- openModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const toggleModal = () => isModalActive ? closeModal() : openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal);
- if (!isModalActive) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- className: "edit-site-keyboard-shortcut-help-modal",
- title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
- onRequestClose: toggleModal
- }, (0,external_React_.createElement)(ShortcutSection, {
- className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts",
- shortcuts: ['core/edit-site/keyboard-shortcuts']
- }), (0,external_React_.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
- categoryName: "global"
- }), (0,external_React_.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
- categoryName: "selection"
- }), (0,external_React_.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
- categoryName: "block",
- additionalShortcuts: [{
- keyCombination: {
- character: '/'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
- /* translators: The forward-slash character. e.g. '/'. */
- ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
- }]
- }), (0,external_React_.createElement)(ShortcutSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
- shortcuts: textFormattingShortcuts
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-const {
- PreferencesModal
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-const PREFERENCES_MODAL_NAME = 'edit-site/preferences';
-function EditSitePreferencesModal() {
- const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(PREFERENCES_MODAL_NAME));
- const {
- closeModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- if (!isModalActive) {
- return null;
- }
- return (0,external_React_.createElement)(PreferencesModal, {
- isActive: isModalActive,
- onClose: closeModal
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/tools-more-menu-group/index.js
-
-/**
- * WordPress dependencies
- */
-
-const {
- Fill: ToolsMoreMenuGroup,
- Slot
-} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup');
-ToolsMoreMenuGroup.Slot = ({
- fillProps
-}) => (0,external_React_.createElement)(Slot, {
- fillProps: fillProps
-}, fills => fills && fills.length > 0);
-/* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js
-
-/**
- * WordPress dependencies
- */
-
-const download = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_download = (download);
-
-;// CONCATENATED MODULE: external ["wp","blob"]
-const external_wp_blob_namespaceObject = window["wp"]["blob"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/more-menu/site-export.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-function SiteExport() {
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- async function handleExport() {
- try {
- const response = await external_wp_apiFetch_default()({
- path: '/wp-block-editor/v1/export',
- parse: false,
- headers: {
- Accept: 'application/zip'
- }
- });
- const blob = await response.blob();
- const contentDisposition = response.headers.get('content-disposition');
- const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
- const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export';
- (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip');
- } catch (errorResponse) {
- let error = {};
- try {
- error = await errorResponse.json();
- } catch (e) {}
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- role: "menuitem",
- icon: library_download,
- onClick: handleExport,
- info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.')
- }, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-function WelcomeGuideMenuItem() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => toggle('core/edit-site', 'welcomeGuide')
- }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-function CopyContentMenuItem() {
- const {
- createNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- getEditedPostId,
- getEditedPostType
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const {
- getEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
- function getText() {
- const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
- if (!record) {
- return '';
- }
- if (typeof record.content === 'function') {
- return record.content(record);
- } else if (record.blocks) {
- return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
- } else if (record.content) {
- return record.content;
- }
- }
- function onSuccess() {
- createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
- isDismissible: true,
- type: 'snackbar'
- });
- }
- const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- ref: ref
- }, (0,external_wp_i18n_namespaceObject.__)('Copy all blocks'));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/mode-switcher/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-/**
- * Set of available mode options.
- *
- * @type {Array}
- */
-const MODES = [{
- value: 'visual',
- label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
-}, {
- value: 'text',
- label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
-}];
-function ModeSwitcher() {
- const {
- shortcut,
- mode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'),
- mode: select(store_store).getEditorMode()
- }), []);
- const {
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const choices = MODES.map(choice => {
- if (choice.value !== mode) {
- return {
- ...choice,
- shortcut
- };
- }
- return choice;
});
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Editor')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
- choices: choices,
- value: mode,
- onSelect: switchEditorMode
- }));
-}
-/* harmony default export */ const mode_switcher = (ModeSwitcher);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/more-menu/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-
-function MoreMenu({
- showIconLabels
-}) {
- const {
- openModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const {
- set: setPreference
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme;
- }, []);
- const {
- toggleDistractionFree
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const turnOffDistractionFree = () => {
- setPreference('core', 'distractionFree', false);
- };
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(MoreMenuDropdown, {
- toggleProps: {
- showTooltip: !showIconLabels,
- ...(showIconLabels && {
- variant: 'tertiary'
- })
- }
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
- }, (0,external_React_.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
- scope: "core",
- name: "fixedToolbar",
- onToggle: turnOffDistractionFree,
- label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
- info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
- messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
- messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
- }), (0,external_React_.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
- scope: "core",
- name: "distractionFree",
- label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'),
- info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'),
- handleToggling: false,
- onToggle: toggleDistractionFree,
- messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'),
- messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'),
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\')
- }), (0,external_React_.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
- scope: "core",
- name: "focusMode",
- label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
- info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
- messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
- messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
- })), (0,external_React_.createElement)(mode_switcher, null), (0,external_React_.createElement)(action_item.Slot, {
- name: "core/edit-site/plugin-more-menu",
- label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
- as: external_wp_components_namespaceObject.MenuGroup,
- fillProps: {
- onClick: onClose
- }
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Tools')
- }, isBlockBasedTheme && (0,external_React_.createElement)(SiteExport, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME),
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
- }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_React_.createElement)(WelcomeGuideMenuItem, null), (0,external_React_.createElement)(CopyContentMenuItem, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: library_external,
- role: "menuitem",
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/site-editor/'),
- target: "_blank",
- rel: "noopener noreferrer"
- }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "span"
- }, /* translators: accessibility text */
- (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_React_.createElement)(tools_more_menu_group.Slot, {
- fillProps: {
- onClose
- }
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => openModal(PREFERENCES_MODAL_NAME)
- }, (0,external_wp_i18n_namespaceObject.__)('Preferences'))))), (0,external_React_.createElement)(KeyboardShortcutHelpModal, null), (0,external_React_.createElement)(EditSitePreferencesModal, null));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up-down.js
-
-/**
- * WordPress dependencies
- */
-
-const chevronUpDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"
}));
-/* harmony default export */ const chevron_up_down = (chevronUpDown);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/document-tools/index.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- DocumentTools: EditorDocumentTools
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-function DocumentTools({
- blockEditorMode,
- hasFixedToolbar,
- isDistractionFree
-}) {
- const {
- isVisualMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditorMode
- } = select(store_store);
- return {
- isVisualMode: getEditorMode() === 'visual'
- };
- }, []);
- const {
- __unstableSetEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- setDeviceType
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const isZoomedOutViewExperimentEnabled = window?.__experimentalEnableZoomedOutView && isVisualMode;
- const isZoomedOutView = blockEditorMode === 'zoom-out';
- return (0,external_React_.createElement)(EditorDocumentTools, {
- disableBlockTools: !isVisualMode,
- listViewLabel: (0,external_wp_i18n_namespaceObject.__)('List View')
- }, isZoomedOutViewExperimentEnabled && isLargeViewport && !isDistractionFree && !hasFixedToolbar && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: external_wp_components_namespaceObject.Button,
- className: "edit-site-header-edit-mode__zoom-out-view-toggle",
- icon: chevron_up_down,
- isPressed: isZoomedOutView
- /* translators: button label text should, if possible, be under 16 characters. */,
- label: (0,external_wp_i18n_namespaceObject.__)('Zoom-out View'),
- onClick: () => {
- setDeviceType('Desktop');
- __unstableSetEditorMode(isZoomedOutView ? 'edit' : 'zoom-out');
- },
- size: "compact"
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-
-
-const {
- PostViewLink,
- PreviewDropdown
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-function HeaderEditMode() {
- const {
- templateType,
- isDistractionFree,
- blockEditorMode,
- blockSelectionStart,
- showIconLabels,
- editorCanvasView,
- hasFixedToolbar,
- isZoomOutMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType
- } = select(store_store);
- const {
- getBlockSelectionStart,
- __unstableGetEditorMode
- } = select(external_wp_blockEditor_namespaceObject.store);
- const {
- get: getPreference
- } = select(external_wp_preferences_namespaceObject.store);
- const {
- getDeviceType
- } = select(external_wp_editor_namespaceObject.store);
- return {
- deviceType: getDeviceType(),
- templateType: getEditedPostType(),
- blockEditorMode: __unstableGetEditorMode(),
- blockSelectionStart: getBlockSelectionStart(),
- showIconLabels: getPreference('core', 'showIconLabels'),
- editorCanvasView: unlock(select(store_store)).getEditorCanvasContainerView(),
- hasFixedToolbar: getPreference('core', 'fixedToolbar'),
- isDistractionFree: getPreference('core', 'distractionFree'),
- isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
- };
- }, []);
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const isTopToolbar = !isZoomOutMode && hasFixedToolbar && isLargeViewport;
- const blockToolbarRef = (0,external_wp_element_namespaceObject.useRef)();
- const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
- const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
- const isFocusMode = FOCUSABLE_ENTITIES.includes(templateType);
- const isZoomedOutView = blockEditorMode === 'zoom-out';
- const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true);
- const hasBlockSelected = !!blockSelectionStart;
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // If we have a new block selection, show the block tools
- if (blockSelectionStart) {
- setIsBlockToolsCollapsed(false);
- }
- }, [blockSelectionStart]);
- const toolbarVariants = {
- isDistractionFree: {
- y: '-50px'
- },
- isDistractionFreeHovering: {
- y: 0
- },
- view: {
- y: 0
- },
- edit: {
- y: 0
- }
- };
- const toolbarTransition = {
- type: 'tween',
- duration: disableMotion ? 0 : 0.2,
- ease: 'easeOut'
- };
- return (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-header-edit-mode', {
- 'show-icon-labels': showIconLabels
- })
- }, hasDefaultEditorCanvasView && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: "edit-site-header-edit-mode__start",
- variants: toolbarVariants,
- transition: toolbarTransition
- }, (0,external_React_.createElement)(DocumentTools, {
- blockEditorMode: blockEditorMode,
- isDistractionFree: isDistractionFree
- }), isTopToolbar && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
- className: classnames_default()('selected-block-tools-wrapper', {
- 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelected
- })
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
- hideDragHandle: true
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.Slot, {
- ref: blockToolbarRef,
- name: "block-toolbar"
- }), hasBlockSelected && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-header-edit-mode__block-tools-toggle",
- icon: isBlockToolsCollapsed ? library_next : library_previous,
- onClick: () => {
- setIsBlockToolsCollapsed(collapsed => !collapsed);
- },
- label: isBlockToolsCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools')
- }))), !isDistractionFree && (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-header-edit-mode__center', {
- 'is-collapsed': !isBlockToolsCollapsed && isLargeViewport
- })
- }, !hasDefaultEditorCanvasView ? getEditorCanvasContainerTitle(editorCanvasView) : (0,external_React_.createElement)(external_wp_editor_namespaceObject.DocumentBar, null)), (0,external_React_.createElement)("div", {
- className: "edit-site-header-edit-mode__end"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: "edit-site-header-edit-mode__actions",
- variants: toolbarVariants,
- transition: toolbarTransition
- }, isLargeViewport && (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-header-edit-mode__preview-options', {
- 'is-zoomed-out': isZoomedOutView
- })
- }, (0,external_React_.createElement)(PreviewDropdown, {
- disabled: isFocusMode || !hasDefaultEditorCanvasView
- })), (0,external_React_.createElement)(PostViewLink, null), (0,external_React_.createElement)(SaveButton, null), !isDistractionFree && (0,external_React_.createElement)(pinned_items.Slot, {
- scope: "core/edit-site"
- }), (0,external_React_.createElement)(MoreMenu, {
- showIconLabels: showIconLabels
- }))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
-
-/**
- * WordPress dependencies
- */
-
-const wordpress = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "-2 -2 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
-/* harmony default export */ const library_wordpress = (wordpress);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-function SiteIcon({
- className
-}) {
+/* harmony default export */ const site_hub = (SiteHub);
+const SiteHubMobile = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({
+ isTransparent
+}, ref) => {
+ const history = useHistory();
const {
- isRequestingSite,
- siteIconUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const siteData = getEntityRecord('root', '__unstableBase', undefined);
- return {
- isRequestingSite: !siteData,
- siteIconUrl: siteData?.site_icon_url
- };
- }, []);
- if (isRequestingSite && !siteIconUrl) {
- return (0,external_React_.createElement)("div", {
- className: "edit-site-site-icon__image"
- });
- }
- const icon = siteIconUrl ? (0,external_React_.createElement)("img", {
- className: "edit-site-site-icon__image",
- alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
- src: siteIconUrl
- }) : (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- className: "edit-site-site-icon__icon",
- icon: library_wordpress,
- size: 48
- });
- return (0,external_React_.createElement)("div", {
- className: classnames_default()(className, 'edit-site-site-icon')
- }, icon);
-}
-/* harmony default export */ const site_icon = (SiteIcon);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-const HUB_ANIMATION_DURATION = 0.3;
-const SiteHub = (0,external_wp_element_namespaceObject.memo)(({
- isTransparent,
- className
-}) => {
+ navigate
+ } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext);
const {
- canvasMode,
- dashboardLink,
homeUrl,
siteTitle
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getCanvasMode,
- getSettings
- } = unlock(select(store_store));
- const {
getSite,
getUnstableBase // Site index.
} = select(external_wp_coreData_namespaceObject.store);
+ const _site = getSite();
return {
- canvasMode: getCanvasMode(),
- dashboardLink: getSettings().__experimentalDashboardLink || 'index.php',
homeUrl: getUnstableBase()?.home,
- siteTitle: getSite()?.title
+ siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title
};
}, []);
const {
open: openCommandCenter
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store);
- const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const {
- clearSelectedBlock
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- setDeviceType
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
- const isBackToDashboardButton = canvasMode === 'view';
- const siteIconButtonProps = isBackToDashboardButton ? {
- href: dashboardLink,
- label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard')
- } : {
- href: dashboardLink,
- // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
- role: 'button',
- label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'),
- onClick: event => {
- event.preventDefault();
- if (canvasMode === 'edit') {
- clearSelectedBlock();
- setDeviceType('Desktop');
- setCanvasMode('view');
- }
- }
- };
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: classnames_default()('edit-site-site-hub', className),
- variants: {
- isDistractionFree: {
- x: '-100%'
- },
- isDistractionFreeHovering: {
- x: 0
- },
- view: {
- x: 0
- },
- edit: {
- x: 0
- }
- },
- initial: false,
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
- ease: 'easeOut'
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between",
- alignment: "center",
- className: "edit-site-site-hub__container"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start",
- className: "edit-site-site-hub__text-content",
- spacing: "0"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: classnames_default()('edit-site-site-hub__view-mode-toggle-container', {
- 'has-transparent-background': isTransparent
- }),
- layout: true,
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
- ease: 'easeOut'
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- ...siteIconButtonProps,
- className: "edit-site-layout__view-mode-toggle"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- initial: false,
- animate: {
- scale: canvasMode === 'view' ? 0.5 : 1
- },
- whileHover: {
- scale: canvasMode === 'view' ? 0.5 : 0.96
- },
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
- ease: 'easeOut'
- }
- }, (0,external_React_.createElement)(site_icon, {
- className: "edit-site-layout__view-mode-toggle-icon"
- })))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- layout: canvasMode === 'edit',
- animate: {
- opacity: canvasMode === 'view' ? 1 : 0
- },
- exit: {
- opacity: 0
- },
- className: classnames_default()('edit-site-site-hub__site-title', {
- 'is-transparent': isTransparent
- }),
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : 0.2,
- ease: 'easeOut',
- delay: canvasMode === 'view' ? 0.1 : 0
- }
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), canvasMode === 'view' && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- href: homeUrl,
- target: "_blank",
- label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'),
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'),
- icon: library_external,
- className: classnames_default()('edit-site-site-hub__site-view-link', {
- 'is-transparent': isTransparent
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-site-hub",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ spacing: "0",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', {
+ 'has-transparent-background': isTransparent
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ ref: ref,
+ label: (0,external_wp_i18n_namespaceObject.__)('Go to Site Editor'),
+ className: "edit-site-layout__view-mode-toggle",
+ style: {
+ transform: 'scale(0.5)',
+ borderRadius: 4
+ },
+ onClick: () => {
+ history.push({});
+ navigate('back');
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, {
+ className: "edit-site-layout__view-mode-toggle-icon"
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-site-hub__title",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ href: homeUrl,
+ target: "_blank",
+ label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'),
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 0,
+ expanded: false,
+ className: "edit-site-site-hub__actions",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "edit-site-site-hub_toggle-command-center",
+ icon: library_search,
+ onClick: () => openCommandCenter(),
+ label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'),
+ shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k')
+ })
+ })]
+ })]
})
- })), canvasMode === 'view' && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: classnames_default()('edit-site-site-hub_toggle-command-center', {
- 'is-transparent': isTransparent
- }),
- icon: library_search,
- onClick: () => openCommandCenter(),
- label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'),
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k')
- })));
-});
-/* harmony default export */ const site_hub = (SiteHub);
+ });
+}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js
-
/**
* External dependencies
*/
@@ -23670,7 +9813,10 @@ const SiteHub = (0,external_wp_element_namespaceObject.memo)(({
// Removes the inline styles in the drag handles.
-const resizable_frame_HANDLE_STYLES_OVERRIDE = {
+
+
+
+const HANDLE_STYLES_OVERRIDE = {
position: undefined,
userSelect: undefined,
cursor: undefined,
@@ -23720,16 +9866,17 @@ function ResizableFrame({
defaultSize,
innerContentStyle
}) {
+ const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
const [frameSize, setFrameSize] = (0,external_wp_element_namespaceObject.useState)(INITIAL_FRAME_SIZE);
// The width of the resizable frame when a new resize gesture starts.
const [startingWidth, setStartingWidth] = (0,external_wp_element_namespaceObject.useState)();
const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false);
const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_namespaceObject.useState)(false);
const [resizeRatio, setResizeRatio] = (0,external_wp_element_namespaceObject.useState)(1);
- const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store_store)).getCanvasMode(), []);
+ const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => lock_unlock_unlock(select(store)).getCanvasMode(), []);
const {
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const FRAME_TRANSITION = {
type: 'tween',
duration: isResizing ? 0 : 0.5
@@ -23811,11 +9958,12 @@ function ResizableFrame({
},
visible: {
opacity: 1,
- left: -16
+ left: -14 // Account for the handle's width.
},
active: {
opacity: 1,
- left: -16,
+ left: -14,
+ // Account for the handle's width.
scaleY: 1.3
}
};
@@ -23825,18 +9973,27 @@ function ResizableFrame({
}
return shouldShowHandle ? 'visible' : 'hidden';
})();
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.ResizableBox, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, {
as: external_wp_components_namespaceObject.__unstableMotion.div,
ref: frameRef,
initial: false,
variants: frameAnimationVariants,
animate: isFullWidth ? 'fullWidth' : 'default',
onAnimationComplete: definition => {
- if (definition === 'fullWidth') setFrameSize({
- width: '100%',
- height: '100%'
- });
+ if (definition === 'fullWidth') {
+ setFrameSize({
+ width: '100%',
+ height: '100%'
+ });
+ }
},
+ whileHover: canvasMode === 'view' ? {
+ scale: 1.005,
+ transition: {
+ duration: disableMotion ? 0 : 0.5,
+ ease: 'easeOut'
+ }
+ } : {},
transition: FRAME_TRANSITION,
size: frameSize,
enable: {
@@ -23853,58 +10010,60 @@ function ResizableFrame({
resizeRatio: resizeRatio,
handleClasses: undefined,
handleStyles: {
- left: resizable_frame_HANDLE_STYLES_OVERRIDE,
- right: resizable_frame_HANDLE_STYLES_OVERRIDE
+ left: HANDLE_STYLES_OVERRIDE,
+ right: HANDLE_STYLES_OVERRIDE
},
minWidth: FRAME_MIN_WIDTH,
maxWidth: isFullWidth ? '100%' : '150%',
- maxHeight: '100%',
+ maxHeight: "100%",
onFocus: () => setShouldShowHandle(true),
onBlur: () => setShouldShowHandle(false),
onMouseOver: () => setShouldShowHandle(true),
onMouseOut: () => setShouldShowHandle(false),
handleComponent: {
- left: canvasMode === 'view' && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.button, {
- key: "handle",
- role: "separator",
- "aria-orientation": "vertical",
- className: classnames_default()('edit-site-resizable-frame__handle', {
- 'is-resizing': isResizing
- }),
- variants: resizeHandleVariants,
- animate: currentResizeHandleVariant,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
- "aria-describedby": resizableHandleHelpId,
- "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined,
- "aria-valuemin": FRAME_MIN_WIDTH,
- "aria-valuemax": defaultSize.width,
- onKeyDown: handleResizableHandleKeyDown,
- initial: "hidden",
- exit: "hidden",
- whileFocus: "active",
- whileHover: "active"
- })), (0,external_React_.createElement)("div", {
- hidden: true,
- id: resizableHandleHelpId
- }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.')))
+ left: canvasMode === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
+ text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, {
+ role: "separator",
+ "aria-orientation": "vertical",
+ className: dist_clsx('edit-site-resizable-frame__handle', {
+ 'is-resizing': isResizing
+ }),
+ variants: resizeHandleVariants,
+ animate: currentResizeHandleVariant,
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
+ "aria-describedby": resizableHandleHelpId,
+ "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined,
+ "aria-valuemin": FRAME_MIN_WIDTH,
+ "aria-valuemax": defaultSize.width,
+ onKeyDown: handleResizableHandleKeyDown,
+ initial: "hidden",
+ exit: "hidden",
+ whileFocus: "active",
+ whileHover: "active"
+ }, "handle")
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ hidden: true,
+ id: resizableHandleHelpId,
+ children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.')
+ })]
+ })
},
onResizeStart: handleResizeStart,
onResize: handleResize,
onResizeStop: handleResizeStop,
- className: classnames_default()('edit-site-resizable-frame__inner', {
+ className: dist_clsx('edit-site-resizable-frame__inner', {
'is-resizing': isResizing
}),
showHandle: false // Do not show the default handle, as we're using a custom one.
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: "edit-site-resizable-frame__inner-content",
- animate: {
- borderRadius: isFullWidth ? 0 : 8
- },
- transition: FRAME_TRANSITION,
- style: innerContentStyle
- }, children));
+ ,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-resizable-frame__inner-content",
+ style: innerContentStyle,
+ children: children
+ })
+ });
}
/* harmony default export */ const resizable_frame = (ResizableFrame);
@@ -23924,16 +10083,16 @@ function ResizableFrame({
const {
useLocation: use_sync_canvas_mode_with_url_useLocation,
useHistory: use_sync_canvas_mode_with_url_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
function useSyncCanvasModeWithURL() {
const history = use_sync_canvas_mode_with_url_useHistory();
const {
params
} = use_sync_canvas_mode_with_url_useLocation();
- const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store_store)).getCanvasMode(), []);
+ const canvasMode = (0,external_wp_data_namespaceObject.useSelect)(select => lock_unlock_unlock(select(store)).getCanvasMode(), []);
const {
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const currentCanvasMode = (0,external_wp_element_namespaceObject.useRef)(canvasMode);
const {
canvas: canvasInUrl
@@ -23971,193 +10130,6 @@ function useSyncCanvasModeWithURL() {
}, [canvasInUrl, setCanvasMode]);
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-const {
- useHistory: use_activate_theme_useHistory,
- useLocation: use_activate_theme_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-
-/**
- * This should be refactored to use the REST API, once the REST API can activate themes.
- *
- * @return {Function} A function that activates the theme.
- */
-function useActivateTheme() {
- const history = use_activate_theme_useHistory();
- const location = use_activate_theme_useLocation();
- const {
- startResolution,
- finishResolution
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return async () => {
- if (isPreviewingTheme()) {
- const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
- startResolution('activateTheme');
- await window.fetch(activationURL);
- finishResolution('activateTheme');
- const {
- wp_theme_preview: themePreview,
- ...params
- } = location.params;
- history.replace(params);
- }
- };
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js
-/**
- * WordPress dependencies
- */
-
-
-
-const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';
-function useActualCurrentTheme() {
- const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)();
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.
- const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, {
- context: 'edit',
- wp_theme_preview: ''
- });
- external_wp_apiFetch_default()({
- path
- }).then(activeThemes => setCurrentTheme(activeThemes[0]))
- // Do nothing
- .catch(() => {});
- }, []);
- return currentTheme;
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-const {
- EntitiesSavedStatesExtensible
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-const EntitiesSavedStatesForPreview = ({
- onClose
-}) => {
- var _currentTheme$name$re, _previewingTheme$name;
- const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
- let activateSaveLabel;
- if (isDirtyProps.isDirty) {
- activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save');
- } else {
- activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate');
- }
- const currentTheme = useActualCurrentTheme();
- const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []);
- const additionalPrompt = (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */
- (0,external_wp_i18n_namespaceObject.__)('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...'));
- const activateTheme = useActivateTheme();
- const onSave = async values => {
- await activateTheme();
- return values;
- };
- return (0,external_React_.createElement)(EntitiesSavedStatesExtensible, {
- ...isDirtyProps,
- additionalPrompt,
- close: onClose,
- onSave,
- saveEnabled: true,
- saveLabel: activateSaveLabel
- });
-};
-const _EntitiesSavedStates = ({
- onClose
-}) => {
- if (isPreviewingTheme()) {
- return (0,external_React_.createElement)(EntitiesSavedStatesForPreview, {
- onClose: onClose
- });
- }
- return (0,external_React_.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
- close: onClose
- });
-};
-function SavePanel() {
- const {
- isSaveViewOpen,
- canvasMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- isSaveViewOpened,
- getCanvasMode
- } = unlock(select(store_store));
-
- // The currently selected entity to display.
- // Typically template or template part in the site editor.
- return {
- isSaveViewOpen: isSaveViewOpened(),
- canvasMode: getCanvasMode()
- };
- }, []);
- const {
- setIsSaveViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const onClose = () => setIsSaveViewOpened(false);
- if (canvasMode === 'view') {
- return isSaveViewOpen ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- className: "edit-site-save-panel__modal",
- onRequestClose: onClose,
- __experimentalHideHeader: true,
- contentLabel: (0,external_wp_i18n_namespaceObject.__)('Save site, content, and template changes')
- }, (0,external_React_.createElement)(_EntitiesSavedStates, {
- onClose: onClose
- })) : null;
- }
- return (0,external_React_.createElement)(NavigableRegion, {
- className: classnames_default()('edit-site-layout__actions', {
- 'is-entity-save-view-open': isSaveViewOpen
- }),
- ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel')
- }, isSaveViewOpen ? (0,external_React_.createElement)(_EntitiesSavedStates, {
- onClose: onClose
- }) : (0,external_React_.createElement)("div", {
- className: "edit-site-editor__toggle-save-panel"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- className: "edit-site-editor__toggle-save-panel-button",
- onClick: () => setIsSaveViewOpened(true),
- "aria-expanded": false
- }, (0,external_wp_i18n_namespaceObject.__)('Open save panel'))));
-}
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/register.js
/**
* WordPress dependencies
@@ -24181,91 +10153,6 @@ function KeyboardShortcutsRegister() {
character: 's'
}
});
- registerShortcut({
- name: 'core/edit-site/toggle-block-settings-sidebar',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'),
- keyCombination: {
- modifier: 'primaryShift',
- character: ','
- }
- });
- registerShortcut({
- name: 'core/edit-site/keyboard-shortcuts',
- category: 'main',
- description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
- keyCombination: {
- modifier: 'access',
- character: 'h'
- }
- });
- registerShortcut({
- name: 'core/edit-site/next-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
- keyCombination: {
- modifier: 'ctrl',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'n'
- }]
- });
- registerShortcut({
- name: 'core/edit-site/previous-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
- keyCombination: {
- modifier: 'ctrlShift',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'p'
- }, {
- modifier: 'ctrlShift',
- character: '~'
- }]
- });
- registerShortcut({
- name: 'core/edit-site/toggle-mode',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
- keyCombination: {
- modifier: 'secondary',
- character: 'm'
- }
- });
- registerShortcut({
- name: 'core/edit-site/transform-heading-to-paragraph',
- category: 'block-library',
- description: (0,external_wp_i18n_namespaceObject.__)('Transform heading to paragraph.'),
- keyCombination: {
- modifier: 'access',
- character: `0`
- }
- });
- [1, 2, 3, 4, 5, 6].forEach(level => {
- registerShortcut({
- name: `core/edit-site/transform-paragraph-to-heading-${level}`,
- category: 'block-library',
- description: (0,external_wp_i18n_namespaceObject.__)('Transform paragraph to heading.'),
- keyCombination: {
- modifier: 'access',
- character: `${level}`
- }
- });
- });
- registerShortcut({
- name: 'core/edit-site/toggle-distraction-free',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'),
- keyCombination: {
- modifier: 'primaryShift',
- character: '\\'
- }
- });
}, [registerShortcut]);
return null;
}
@@ -24295,10 +10182,10 @@ function KeyboardShortcutsGlobal() {
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
const {
getCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const {
setIsSaveViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => {
event.preventDefault();
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
@@ -24318,91 +10205,116 @@ function KeyboardShortcutsGlobal() {
}
/* harmony default export */ const global = (KeyboardShortcutsGlobal);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
+/**
+ * WordPress dependencies
+ */
+
+const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_styles = (styles);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js
/**
* WordPress dependencies
*/
-const help = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"
+ })
+});
/* harmony default export */ const library_help = (help);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js
-
/**
* WordPress dependencies
*/
-const rotateRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"
+ })
+});
/* harmony default export */ const rotate_right = (rotateRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-left.js
-
/**
* WordPress dependencies
*/
-const rotateLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"
+ })
+});
/* harmony default export */ const rotate_left = (rotateLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js
-
/**
* WordPress dependencies
*/
-const brush = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"
+ })
+});
/* harmony default export */ const library_brush = (brush);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-is-list-page.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
/**
- * Returns if the params match the list page route.
- *
- * @param {Object} params The url params.
- * @param {string} params.path The current path.
- * @param {string} [params.categoryType] The current category type.
- * @param {string} [params.categoryId] The current category id.
- * @param {boolean} isMobileViewport Is mobile viewport.
- *
- * @return {boolean} Is list page or not.
+ * WordPress dependencies
*/
-function getIsListPage({
- path,
- categoryType,
- categoryId
-}, isMobileViewport) {
- return ['/wp_template/all', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
- // Don't treat "/patterns" without categoryType and categoryId as a
- // list page in mobile because the sidebar covers the whole page.
- !isMobileViewport || !!categoryType && !!categoryId);
-}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js
+
+const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
+ })
+});
+/* harmony default export */ const library_backup = (backup);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
/**
* WordPress dependencies
*/
+const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
+ })
+});
+/* harmony default export */ const library_external = (external);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js
+/**
+ * WordPress dependencies
+ */
+
@@ -24417,27 +10329,24 @@ function getIsListPage({
*/
-
const {
useGlobalStylesReset
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const {
useHistory: use_common_commands_useHistory,
useLocation: use_common_commands_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
function useGlobalStylesOpenStylesCommands() {
const {
openGeneralSidebar,
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const {
params
} = use_common_commands_useLocation();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const isEditorPage = !getIsListPage(params, isMobileViewport);
const {
getCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const history = use_common_commands_useHistory();
const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme;
@@ -24453,20 +10362,20 @@ function useGlobalStylesOpenStylesCommands() {
close
}) => {
close();
- if (!isEditorPage) {
+ if (!params.postId) {
history.push({
path: '/wp_global_styles',
canvas: 'edit'
});
}
- if (isEditorPage && getCanvasMode() !== 'edit') {
+ if (params.postId && getCanvasMode() !== 'edit') {
setCanvasMode('edit');
}
openGeneralSidebar('edit-site/global-styles');
},
icon: library_styles
}];
- }, [history, openGeneralSidebar, setCanvasMode, isEditorPage, getCanvasMode, isBlockBasedTheme]);
+ }, [history, openGeneralSidebar, setCanvasMode, getCanvasMode, isBlockBasedTheme, params.postId]);
return {
isLoading: false,
commands
@@ -24476,15 +10385,13 @@ function useGlobalStylesToggleWelcomeGuideCommands() {
const {
openGeneralSidebar,
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const {
params
} = use_common_commands_useLocation();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const isEditorPage = !getIsListPage(params, isMobileViewport);
const {
getCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const {
set
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
@@ -24503,13 +10410,13 @@ function useGlobalStylesToggleWelcomeGuideCommands() {
close
}) => {
close();
- if (!isEditorPage) {
+ if (!params.postId) {
history.push({
path: '/wp_global_styles',
canvas: 'edit'
});
}
- if (isEditorPage && getCanvasMode() !== 'edit') {
+ if (params.postId && getCanvasMode() !== 'edit') {
setCanvasMode('edit');
}
openGeneralSidebar('edit-site/global-styles');
@@ -24522,7 +10429,7 @@ function useGlobalStylesToggleWelcomeGuideCommands() {
},
icon: library_help
}];
- }, [history, openGeneralSidebar, setCanvasMode, isEditorPage, getCanvasMode, isBlockBasedTheme, set]);
+ }, [history, openGeneralSidebar, setCanvasMode, getCanvasMode, isBlockBasedTheme, set, params.postId]);
return {
isLoading: false,
commands
@@ -24556,13 +10463,10 @@ function useGlobalStylesOpenCssCommands() {
openGeneralSidebar,
setEditorCanvasContainerView,
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const {
params
} = use_common_commands_useLocation();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const isListPage = getIsListPage(params, isMobileViewport);
- const isEditorPage = !isListPage;
const history = use_common_commands_useHistory();
const {
canEditCSS
@@ -24579,7 +10483,7 @@ function useGlobalStylesOpenCssCommands() {
}, []);
const {
getCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!canEditCSS) {
return [];
@@ -24592,20 +10496,20 @@ function useGlobalStylesOpenCssCommands() {
close
}) => {
close();
- if (!isEditorPage) {
+ if (!params.postId) {
history.push({
path: '/wp_global_styles',
canvas: 'edit'
});
}
- if (isEditorPage && getCanvasMode() !== 'edit') {
+ if (params.postId && getCanvasMode() !== 'edit') {
setCanvasMode('edit');
}
openGeneralSidebar('edit-site/global-styles');
setEditorCanvasContainerView('global-styles-css');
}
}];
- }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, isEditorPage, getCanvasMode, setCanvasMode]);
+ }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, getCanvasMode, setCanvasMode, params.postId]);
return {
isLoading: false,
commands
@@ -24616,15 +10520,13 @@ function useGlobalStylesOpenRevisionsCommands() {
openGeneralSidebar,
setEditorCanvasContainerView,
setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const {
getCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const {
params
} = use_common_commands_useLocation();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const isEditorPage = !getIsListPage(params, isMobileViewport);
const history = use_common_commands_useHistory();
const hasRevisions = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
@@ -24647,20 +10549,20 @@ function useGlobalStylesOpenRevisionsCommands() {
close
}) => {
close();
- if (!isEditorPage) {
+ if (!params.postId) {
history.push({
path: '/wp_global_styles',
canvas: 'edit'
});
}
- if (isEditorPage && getCanvasMode() !== 'edit') {
+ if (params.postId && getCanvasMode() !== 'edit') {
setCanvasMode('edit');
}
openGeneralSidebar('edit-site/global-styles');
setEditorCanvasContainerView('global-styles-revisions');
}
}];
- }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, isEditorPage, getCanvasMode, setCanvasMode]);
+ }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, getCanvasMode, setCanvasMode, params.postId]);
return {
isLoading: false,
commands
@@ -24706,143 +10608,169 @@ function useCommonCommands() {
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
/**
* WordPress dependencies
*/
-const code = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
-}));
-/* harmony default export */ const library_code = (code);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-left.js
+const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_layout = (layout);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
/**
* WordPress dependencies
*/
-const drawerLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- width: "24",
- height: "24",
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"
-}));
-/* harmony default export */ const drawer_left = (drawerLeft);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js
-/**
- * WordPress dependencies
- */
-const drawerRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- width: "24",
- height: "24",
+const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"
-}));
-/* harmony default export */ const drawer_right = (drawerRight);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
+ })]
+});
+/* harmony default export */ const library_page = (page);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
/**
* WordPress dependencies
*/
-const blockDefault = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
-}));
-/* harmony default export */ const block_default = (blockDefault);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard.js
+const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
+ })
+});
+/* harmony default export */ const library_trash = (trash);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/use-edited-entity-record/index.js
/**
* WordPress dependencies
*/
-const keyboard = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"
-}));
-/* harmony default export */ const library_keyboard = (keyboard);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
+
+
/**
- * WordPress dependencies
+ * Internal dependencies
*/
-const listView = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"
-}));
-/* harmony default export */ const list_view = (listView);
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pattern-modal/rename.js
+function useEditedEntityRecord(postType, postId) {
+ const {
+ record,
+ title,
+ description,
+ isLoaded,
+ icon
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostType,
+ getEditedPostId
+ } = select(store);
+ const {
+ getEditedEntityRecord,
+ hasFinishedResolution
+ } = select(external_wp_coreData_namespaceObject.store);
+ const {
+ __experimentalGetTemplateInfo: getTemplateInfo
+ } = select(external_wp_editor_namespaceObject.store);
+ const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
+ const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
+ const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
+ const _isLoaded = usedPostId && hasFinishedResolution('getEditedEntityRecord', ['postType', usedPostType, usedPostId]);
+ const templateInfo = getTemplateInfo(_record);
+ return {
+ record: _record,
+ title: templateInfo.title,
+ description: templateInfo.description,
+ isLoaded: _isLoaded,
+ icon: templateInfo.icon
+ };
+ }, [postType, postId]);
+ return {
+ isLoaded,
+ icon,
+ record,
+ getTitle: () => title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : null,
+ getDescription: () => description ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) : null
+ };
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js
/**
- * WordPress dependencies
+ * Internal dependencies
*/
+/**
+ * Check if a template is removable.
+ *
+ * @param {Object} template The template entity to check.
+ * @return {boolean} Whether the template is revertable.
+ */
+function isTemplateRemovable(template) {
+ if (!template) {
+ return false;
+ }
+ return template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file;
+}
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js
/**
* Internal dependencies
*/
-
-const {
- RenamePatternModal
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
-function PatternRenameModal() {
- const {
- record: pattern
- } = useEditedEntityRecord();
- const {
- closeModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(PATTERN_MODALS.rename));
- if (!isActive) {
- return null;
+/**
+ * Check if a template is revertable to its original theme-provided template file.
+ *
+ * @param {Object} template The template entity to check.
+ * @return {boolean} Whether the template is revertable.
+ */
+function isTemplateRevertable(template) {
+ if (!template) {
+ return false;
}
- return (0,external_React_.createElement)(RenamePatternModal, {
- onClose: closeModal,
- pattern: pattern
- });
+ /* eslint-disable camelcase */
+ return template?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file;
+ /* eslint-enable camelcase */
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pattern-modal/duplicate.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js
/**
* WordPress dependencies
*/
+function isPreviewingTheme() {
+ return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview') !== undefined;
+}
+function currentlyPreviewingTheme() {
+ if (isPreviewingTheme()) {
+ return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview');
+ }
+ return null;
+}
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js
+/**
+ * WordPress dependencies
+ */
@@ -24852,60 +10780,50 @@ function PatternRenameModal() {
-
const {
- DuplicatePatternModal
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
-const {
- useHistory: duplicate_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function PatternDuplicateModal() {
- const {
- record
- } = useEditedEntityRecord();
- const {
- categoryType,
- categoryId
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const {
- closeModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const history = duplicate_useHistory();
- const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(PATTERN_MODALS.duplicate));
- if (!isActive) {
- return null;
+ useHistory: link_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useLink(params, state, shouldReplace = false) {
+ const history = link_useHistory();
+ function onClick(event) {
+ event?.preventDefault();
+ if (shouldReplace) {
+ history.replace(params, state);
+ } else {
+ history.push(params, state);
+ }
}
- function onSuccess({
- pattern: newPattern
- }) {
- history.push({
- categoryType,
- categoryId,
- postType: PATTERN_TYPES.user,
- postId: newPattern.id
- });
- closeModal();
+ const currentArgs = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
+ const currentUrlWithoutArgs = (0,external_wp_url_namespaceObject.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs));
+ if (isPreviewingTheme()) {
+ params = {
+ ...params,
+ wp_theme_preview: currentlyPreviewingTheme()
+ };
}
- return (0,external_React_.createElement)(DuplicatePatternModal, {
- onClose: closeModal,
- onSuccess: onSuccess,
- pattern: record
- });
+ const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params);
+ return {
+ href: newUrl,
+ onClick
+ };
}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pattern-modal/index.js
-
-/**
- * Internal dependencies
- */
-
-
-const PATTERN_MODALS = {
- rename: 'edit-site/pattern-rename',
- duplicate: 'edit-site/pattern-duplicate'
-};
-function PatternModal() {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(PatternDuplicateModal, null), (0,external_React_.createElement)(PatternRenameModal, null));
+function Link({
+ params = {},
+ state,
+ replace: shouldReplace = false,
+ children,
+ ...props
+}) {
+ const {
+ href,
+ onClick
+ } = useLink(params, state, shouldReplace);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
+ href: href,
+ onClick: onClick,
+ ...props,
+ children: children
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-edit-mode-commands.js
@@ -24920,9 +10838,6 @@ function PatternModal() {
-
-
-
/**
* Internal dependencies
*/
@@ -24933,12 +10848,9 @@ function PatternModal() {
-
-
-
const {
useHistory: use_edit_mode_commands_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
function usePageContentFocusCommands() {
const {
record: template
@@ -24952,7 +10864,7 @@ function usePageContentFocusCommands() {
const {
isPage: _isPage,
getCanvasMode
- } = unlock(select(store_store));
+ } = lock_unlock_unlock(select(store));
const {
getCurrentPostType,
getCurrentTemplateId
@@ -25011,42 +10923,6 @@ function usePageContentFocusCommands() {
commands
};
}
-function useEditorModeCommands() {
- const {
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- canvasMode,
- editorMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- canvasMode: unlock(select(store_store)).getCanvasMode(),
- editorMode: select(store_store).getEditorMode()
- }), []);
- if (canvasMode !== 'edit' || editorMode !== 'text') {
- return {
- isLoading: false,
- commands: []
- };
- }
- const commands = [];
- if (editorMode === 'text') {
- commands.push({
- name: 'core/exit-code-editor',
- label: (0,external_wp_i18n_namespaceObject.__)('Exit code editor'),
- icon: library_code,
- callback: ({
- close
- }) => {
- switchEditorMode('visual');
- close();
- }
- });
- }
- return {
- isLoading: false,
- commands
- };
-}
function useManipulateDocumentCommands() {
const {
isLoaded,
@@ -25055,9 +10931,9 @@ function useManipulateDocumentCommands() {
const {
removeTemplate,
revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
const history = use_edit_mode_commands_useHistory();
- const isEditingPage = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isPage() && select(external_wp_editor_namespaceObject.store).getCurrentPostType() !== 'wp_template', []);
+ const isEditingPage = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isPage() && select(external_wp_editor_namespaceObject.store).getCurrentPostType() !== 'wp_template', []);
if (!isLoaded) {
return {
isLoading: true,
@@ -25066,7 +10942,7 @@ function useManipulateDocumentCommands() {
}
const commands = [];
if (isTemplateRevertable(template) && !isEditingPage) {
- const label = template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */
+ const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */
(0,external_wp_i18n_namespaceObject.__)('Reset template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title */
(0,external_wp_i18n_namespaceObject.__)('Reset template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title));
commands.push({
@@ -25082,10 +10958,9 @@ function useManipulateDocumentCommands() {
});
}
if (isTemplateRemovable(template) && !isEditingPage) {
- const label = template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */
+ const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */
(0,external_wp_i18n_namespaceObject.__)('Delete template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title */
(0,external_wp_i18n_namespaceObject.__)('Delete template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title));
- const path = template.type === constants_TEMPLATE_POST_TYPE ? '/wp_template' : '/wp_template_part/all';
commands.push({
name: 'core/remove-template',
label,
@@ -25096,7 +10971,7 @@ function useManipulateDocumentCommands() {
removeTemplate(template);
// Navigate to the template list
history.push({
- path
+ postType: template.type
});
close();
}
@@ -25107,273 +10982,16 @@ function useManipulateDocumentCommands() {
commands
};
}
-function useEditUICommands() {
- const {
- openGeneralSidebar,
- closeGeneralSidebar,
- toggleDistractionFree,
- setIsListViewOpened,
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- canvasMode,
- editorMode,
- activeSidebar,
- showBlockBreadcrumbs,
- isListViewOpen,
- isDistractionFree,
- isTopToolbar,
- isFocusMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
- const {
- getEditorMode
- } = select(store_store);
- const {
- isListViewOpened
- } = select(external_wp_editor_namespaceObject.store);
- return {
- canvasMode: unlock(select(store_store)).getCanvasMode(),
- editorMode: getEditorMode(),
- activeSidebar: select(store).getActiveComplementaryArea(store_store.name),
- showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
- isListViewOpen: isListViewOpened(),
- isDistractionFree: get('core', 'distractionFree'),
- isFocusMode: get('core', 'focusMode'),
- isTopToolbar: get('core', 'fixedToolbar')
- };
- }, []);
- const {
- openModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const {
- createInfoNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- if (canvasMode !== 'edit') {
- return {
- isLoading: false,
- commands: []
- };
- }
- const commands = [];
- commands.push({
- name: 'core/open-settings-sidebar',
- label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'),
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right,
- callback: ({
- close
- }) => {
- close();
- if (activeSidebar === 'edit-site/template') {
- closeGeneralSidebar();
- } else {
- openGeneralSidebar('edit-site/template');
- }
- }
- });
- commands.push({
- name: 'core/open-block-inspector',
- label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'),
- icon: block_default,
- callback: ({
- close
- }) => {
- close();
- if (activeSidebar === 'edit-site/block-inspector') {
- closeGeneralSidebar();
- } else {
- openGeneralSidebar('edit-site/block-inspector');
- }
- }
- });
- commands.push({
- name: 'core/toggle-spotlight-mode',
- label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight'),
- callback: ({
- close
- }) => {
- toggle('core', 'focusMode');
- close();
- createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight off.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight on.'), {
- id: 'core/edit-site/toggle-spotlight-mode/notice',
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- onClick: () => {
- toggle('core', 'focusMode');
- }
- }]
- });
- }
- });
- commands.push({
- name: 'core/toggle-distraction-free',
- label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction Free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction Free '),
- callback: ({
- close
- }) => {
- toggleDistractionFree();
- close();
- }
- });
- commands.push({
- name: 'core/toggle-top-toolbar',
- label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'),
- callback: ({
- close
- }) => {
- toggle('core', 'fixedToolbar');
- if (isDistractionFree) {
- toggleDistractionFree();
- }
- close();
- createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar off.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar on.'), {
- id: 'core/edit-site/toggle-top-toolbar/notice',
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- onClick: () => {
- toggle('core', 'fixedToolbar');
- }
- }]
- });
- }
- });
- if (editorMode === 'visual') {
- commands.push({
- name: 'core/toggle-code-editor',
- label: (0,external_wp_i18n_namespaceObject.__)('Open code editor'),
- icon: library_code,
- callback: ({
- close
- }) => {
- switchEditorMode('text');
- close();
- }
- });
- }
- commands.push({
- name: 'core/open-preferences',
- label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'),
- callback: () => {
- openModal(PREFERENCES_MODAL_NAME);
- }
- });
- commands.push({
- name: 'core/open-shortcut-help',
- label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
- icon: library_keyboard,
- callback: () => {
- openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
- }
- });
- commands.push({
- name: 'core/toggle-breadcrumbs',
- label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'),
- callback: ({
- close
- }) => {
- toggle('core', 'showBlockBreadcrumbs');
- close();
- createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), {
- id: 'core/edit-site/toggle-breadcrumbs/notice',
- type: 'snackbar'
- });
- }
- });
- commands.push({
- name: 'core/toggle-list-view',
- label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'),
- icon: list_view,
- callback: ({
- close
- }) => {
- setIsListViewOpened(!isListViewOpen);
- close();
- createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), {
- id: 'core/edit-site/toggle-list-view/notice',
- type: 'snackbar'
- });
- }
- });
- return {
- isLoading: false,
- commands
- };
-}
-function usePatternCommands() {
- const {
- isLoaded,
- record: pattern
- } = useEditedEntityRecord();
- const {
- openModal
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- if (!isLoaded) {
- return {
- isLoading: true,
- commands: []
- };
- }
- const commands = [];
- if (pattern?.type === 'wp_block') {
- commands.push({
- name: 'core/rename-pattern',
- label: (0,external_wp_i18n_namespaceObject.__)('Rename pattern'),
- icon: edit,
- callback: ({
- close
- }) => {
- openModal(PATTERN_MODALS.rename);
- close();
- }
- });
- commands.push({
- name: 'core/duplicate-pattern',
- label: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'),
- icon: library_symbol,
- callback: ({
- close
- }) => {
- openModal(PATTERN_MODALS.duplicate);
- close();
- }
- });
- }
- return {
- isLoading: false,
- commands
- };
-}
function useEditModeCommands() {
(0,external_wp_commands_namespaceObject.useCommandLoader)({
- name: 'core/exit-code-editor',
- hook: useEditorModeCommands,
- context: 'site-editor-edit'
- });
- (0,external_wp_commands_namespaceObject.useCommandLoader)({
name: 'core/edit-site/page-content-focus',
hook: usePageContentFocusCommands,
- context: 'site-editor-edit'
+ context: 'entity-edit'
});
(0,external_wp_commands_namespaceObject.useCommandLoader)({
name: 'core/edit-site/manipulate-document',
hook: useManipulateDocumentCommands
});
- (0,external_wp_commands_namespaceObject.useCommandLoader)({
- name: 'core/edit-site/patterns',
- hook: usePatternCommands,
- context: 'site-editor-edit'
- });
- (0,external_wp_commands_namespaceObject.useCommandLoader)({
- name: 'core/edit-site/edit-ui',
- hook: useEditUICommands
- });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js
@@ -25438,44 +11056,959 @@ function useIsSiteEditorLoading() {
return !loaded || !hasLoadedPost;
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/default-sidebar.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js
+
+function WelcomeGuideImage({
+ nonAnimatedSrc,
+ animatedSrc
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", {
+ className: "edit-site-welcome-guide__image",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", {
+ srcSet: nonAnimatedSrc,
+ media: "(prefers-reduced-motion: reduce)"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ src: animatedSrc,
+ width: "312",
+ height: "240",
+ alt: ""
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js
/**
* WordPress dependencies
*/
-function DefaultSidebar({
- className,
- identifier,
- title,
- icon,
- children,
- closeLabel,
- header,
- headerClassName,
- panelClassName
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function WelcomeGuideEditor() {
+ const {
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const {
+ isActive,
+ isBlockBasedTheme
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return {
+ isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'),
+ isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme
+ };
+ }, []);
+ if (!isActive || !isBlockBasedTheme) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, {
+ className: "edit-site-welcome-guide guide-editor",
+ contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'),
+ finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
+ onFinish: () => toggle('core/edit-site', 'welcomeGuide'),
+ pages: [{
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, {
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
+ animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: (0,external_wp_i18n_namespaceObject.__)('Edit your site')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (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.'), {
+ StylesIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ alt: (0,external_wp_i18n_namespaceObject.__)('styles'),
+ 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"
+ })
+ })
+ })]
+ })
+ }]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ interfaceStore: styles_interfaceStore
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function WelcomeGuideStyles() {
+ const {
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const {
+ isActive,
+ isStylesOpen
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const sidebar = select(styles_interfaceStore).getActiveComplementaryArea('core');
+ return {
+ isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'),
+ isStylesOpen: sidebar === 'edit-site/global-styles'
+ };
+ }, []);
+ if (!isActive || !isStylesOpen) {
+ return null;
+ }
+ const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, {
+ className: "edit-site-welcome-guide guide-styles",
+ contentLabel: welcomeLabel,
+ finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
+ onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'),
+ pages: [{
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, {
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
+ animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: welcomeLabel
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (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.')
+ })]
+ })
+ }, {
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, {
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
+ animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: (0,external_wp_i18n_namespaceObject.__)('Set the design')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (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!')
+ })]
+ })
+ }, {
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, {
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
+ animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (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.')
+ })]
+ })
+ }, {
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, {
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
+ animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: [(0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site?'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.')
+ })]
+ })]
+ })
+ }]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function WelcomeGuidePage() {
+ const {
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage');
+ const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide');
+ const {
+ isPage
+ } = select(store);
+ return isPageActive && !isEditorActive && isPage();
+ }, []);
+ if (!isVisible) {
+ return null;
+ }
+ const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, {
+ className: "edit-site-welcome-guide guide-page",
+ contentLabel: heading,
+ finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'),
+ onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'),
+ pages: [{
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", {
+ className: "edit-site-welcome-guide__video",
+ autoPlay: true,
+ loop: true,
+ muted: true,
+ width: "312",
+ height: "240",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", {
+ src: "https://s.w.org/images/block-editor/editing-your-page.mp4",
+ type: "video/mp4"
+ })
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: heading
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (0,external_wp_i18n_namespaceObject.__)('It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.')
+ })]
+ })
+ }]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function WelcomeGuideTemplate() {
+ const {
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const isTemplateActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideTemplate');
+ const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide');
+ const {
+ isPage
+ } = select(store);
+ const {
+ getCurrentPostType
+ } = select(external_wp_editor_namespaceObject.store);
+ return isTemplateActive && !isEditorActive && isPage() && getCurrentPostType() === 'wp_template';
+ }, []);
+ if (!isVisible) {
+ return null;
+ }
+ const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, {
+ className: "edit-site-welcome-guide guide-template",
+ contentLabel: heading,
+ finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'),
+ onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'),
+ pages: [{
+ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", {
+ className: "edit-site-welcome-guide__video",
+ autoPlay: true,
+ loop: true,
+ muted: true,
+ width: "312",
+ height: "240",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", {
+ src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
+ type: "video/mp4"
+ })
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", {
+ className: "edit-site-welcome-guide__heading",
+ children: heading
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-welcome-guide__text",
+ children: (0,external_wp_i18n_namespaceObject.__)('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.')
+ })]
+ })
+ }]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+function WelcomeGuide() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ useGlobalStylesOutput
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function useGlobalStylesRenderer() {
+ const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(store).getEditedPostType();
+ });
+ const [styles, settings] = useGlobalStylesOutput(postType !== TEMPLATE_POST_TYPE);
+ const {
+ getSettings
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
+ const {
+ updateSettings
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ var _currentStoreSettings;
+ if (!styles || !settings) {
+ return;
+ }
+ const currentStoreSettings = getSettings();
+ const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles);
+ updateSettings({
+ ...currentStoreSettings,
+ styles: [...nonGlobalStyles, ...styles],
+ __experimentalFeatures: settings
+ });
+ }, [styles, settings, updateSettings, getSettings]);
+}
+function GlobalStylesRenderer() {
+ useGlobalStylesRenderer();
+ return null;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ Theme
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+const {
+ useGlobalStyle: canvas_loader_useGlobalStyle
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function CanvasLoader({
+ id
}) {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(complementary_area, {
- className: className,
- scope: "core/edit-site",
- identifier: identifier,
- title: title,
- smallScreenTitle: title,
- icon: icon,
- closeLabel: closeLabel,
- header: header,
- headerClassName: headerClassName,
- panelClassName: panelClassName
- }, children), (0,external_React_.createElement)(ComplementaryAreaMoreMenuItem, {
- scope: "core/edit-site",
- identifier: identifier,
- icon: icon
- }, title));
+ var _highlightedColors$0$;
+ const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text');
+ const [backgroundColor] = canvas_loader_useGlobalStyle('color.background');
+ const {
+ highlightedColors
+ } = useStylesPreviewColors();
+ const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor;
+ const {
+ elapsed,
+ total
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _selectorsByStatus$re, _selectorsByStatus$fi;
+ const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus();
+ const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0;
+ const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0;
+ return {
+ elapsed: finished,
+ total: finished + resolving
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-canvas-loader",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, {
+ accent: indicatorColor,
+ background: backgroundColor,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {
+ id: id,
+ max: total,
+ value: elapsed
+ })
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+function ConvertToRegularBlocks({
+ clientId,
+ onClose
+}) {
+ const {
+ getBlocks
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
+ const {
+ replaceBlocks
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]);
+ if (!canRemove) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ replaceBlocks(clientId, getBlocks(clientId));
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Detach')
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
+/**
+ * WordPress dependencies
+ */
+
+
+const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const symbol_filled = (symbolFilled);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ CreateTemplatePartModal
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function ConvertToTemplatePart({
+ clientIds,
+ blocks
+}) {
+ const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ replaceBlocks
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const {
+ createSuccessNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ canCreate
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ supportsTemplatePartsMode
+ } = select(store).getSettings();
+ return {
+ canCreate: !supportsTemplatePartsMode
+ };
+ }, []);
+ if (!canCreate) {
+ return null;
+ }
+ const onConvert = async templatePart => {
+ replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', {
+ slug: templatePart.slug,
+ theme: templatePart.theme
+ }));
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), {
+ type: 'snackbar'
+ });
+
+ // The modal and this component will be unmounted because of `replaceBlocks` above,
+ // so no need to call `closeModal` or `onClose`.
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ icon: symbol_filled,
+ onClick: () => {
+ setIsModalOpen(true);
+ },
+ "aria-expanded": isModalOpen,
+ "aria-haspopup": "dialog",
+ children: (0,external_wp_i18n_namespaceObject.__)('Create template part')
+ }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, {
+ closeModal: () => {
+ setIsModalOpen(false);
+ },
+ blocks: blocks,
+ onCreate: onConvert
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function TemplatePartConverter() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
+ children: ({
+ selectedClientIds,
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartConverterMenuItem, {
+ clientIds: selectedClientIds,
+ onClose: onClose
+ })
+ });
+}
+function TemplatePartConverterMenuItem({
+ clientIds,
+ onClose
+}) {
+ const {
+ isContentOnly,
+ blocks
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlocksByClientId,
+ getBlockEditingMode
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return {
+ blocks: getBlocksByClientId(clientIds),
+ isContentOnly: clientIds.length === 1 && getBlockEditingMode(clientIds[0]) === 'contentOnly'
+ };
+ }, [clientIds]);
+
+ // Do not show the convert button if the block is in content-only mode.
+ if (isContentOnly) {
+ return null;
+ }
+
+ // Allow converting a single template part to standard blocks.
+ if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToRegularBlocks, {
+ clientId: clientIds[0],
+ onClose: onClose
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, {
+ clientIds: clientIds,
+ blocks: blocks
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+const {
+ useHistory: use_navigate_to_entity_record_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useNavigateToEntityRecord() {
+ const history = use_navigate_to_entity_record_useHistory();
+ const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => {
+ history.push({
+ ...params,
+ focusMode: true,
+ canvas: 'edit'
+ });
+ }, [history]);
+ return onNavigateToEntityRecord;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useBlockEditorSettings
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const {
+ useLocation: use_site_editor_settings_useLocation,
+ useHistory: use_site_editor_settings_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useArchiveLabel(templateSlug) {
+ const taxonomyMatches = templateSlug?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);
+ let taxonomy;
+ let term;
+ let isAuthor = false;
+ let authorSlug;
+ if (taxonomyMatches) {
+ // If is for a all taxonomies of a type
+ if (taxonomyMatches[1]) {
+ taxonomy = taxonomyMatches[2] ? taxonomyMatches[2] : taxonomyMatches[1];
+ }
+ // If is for a all taxonomies of a type
+ else if (taxonomyMatches[3]) {
+ taxonomy = taxonomyMatches[6] ? taxonomyMatches[6] : taxonomyMatches[4];
+ term = taxonomyMatches[7];
+ }
+ taxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;
+
+ //getTaxonomy( 'category' );
+ //wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );
+ } else {
+ const authorMatches = templateSlug?.match(/^(author)$|^author-(.+)$/);
+ if (authorMatches) {
+ isAuthor = true;
+ if (authorMatches[2]) {
+ authorSlug = authorMatches[2];
+ }
+ }
+ }
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecords,
+ getTaxonomy,
+ getAuthors
+ } = select(external_wp_coreData_namespaceObject.store);
+ let archiveTypeLabel;
+ let archiveNameLabel;
+ if (taxonomy) {
+ archiveTypeLabel = getTaxonomy(taxonomy)?.labels?.singular_name;
+ }
+ if (term) {
+ const records = getEntityRecords('taxonomy', taxonomy, {
+ slug: term,
+ per_page: 1
+ });
+ if (records && records[0]) {
+ archiveNameLabel = records[0].name;
+ }
+ }
+ if (isAuthor) {
+ archiveTypeLabel = 'Author';
+ if (authorSlug) {
+ const authorRecords = getAuthors({
+ slug: authorSlug
+ });
+ if (authorRecords && authorRecords[0]) {
+ archiveNameLabel = authorRecords[0].name;
+ }
+ }
+ }
+ return {
+ archiveTypeLabel,
+ archiveNameLabel
+ };
+ }, [authorSlug, isAuthor, taxonomy, term]);
+}
+function useNavigateToPreviousEntityRecord() {
+ const location = use_site_editor_settings_useLocation();
+ const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
+ const history = use_site_editor_settings_useHistory();
+ const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType);
+ const didComeFromEditorCanvas = previousLocation?.params.canvas === 'edit';
+ const showBackButton = isFocusMode && didComeFromEditorCanvas;
+ return showBackButton ? () => history.back() : undefined;
+ // Disable reason: previousLocation changes when the component updates for any reason, not
+ // just when location changes. Until this is fixed we can't add it to deps. See
+ // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [location, history]);
+ return goBack;
+}
+function useSpecificEditorSettings() {
+ const onNavigateToEntityRecord = useNavigateToEntityRecord();
+ const {
+ templateSlug,
+ canvasMode,
+ settings,
+ postWithTemplate
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedPostType,
+ getEditedPostId,
+ getEditedPostContext,
+ getCanvasMode,
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const usedPostType = getEditedPostType();
+ const usedPostId = getEditedPostId();
+ const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
+ const _context = getEditedPostContext();
+ return {
+ templateSlug: _record.slug,
+ canvasMode: getCanvasMode(),
+ settings: getSettings(),
+ postWithTemplate: _context?.postId
+ };
+ }, []);
+ const archiveLabels = useArchiveLabel(templateSlug);
+ const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'post-only';
+ const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
+ const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return {
+ ...settings,
+ richEditingEnabled: true,
+ supportsTemplateMode: true,
+ focusMode: canvasMode !== 'view',
+ defaultRenderingMode,
+ onNavigateToEntityRecord,
+ onNavigateToPreviousEntityRecord,
+ // I wonder if they should be set in the post editor too
+ __experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
+ __experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,
+ __unstableIsPreviewMode: canvasMode === 'view'
+ };
+ }, [settings, canvasMode, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel]);
+ return defaultEditorSettings;
+}
+function useSiteEditorSettings() {
+ const defaultEditorSettings = useSpecificEditorSettings();
+ const {
+ postType,
+ postId
+ } = useSelect(select => {
+ const {
+ getEditedPostType,
+ getEditedPostId
+ } = unlock(select(editSiteStore));
+ const usedPostType = getEditedPostType();
+ const usedPostId = getEditedPostId();
+ return {
+ postType: usedPostType,
+ postId: usedPostId
+ };
+ }, []);
+ return useBlockEditorSettings(defaultEditorSettings, postType, postId);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js
+/**
+ * Defines an extensibility slot for the Template sidebar.
+ */
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+const {
+ Fill,
+ Slot
+} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel');
+const PluginTemplateSettingPanel = ({
+ children
+}) => {
+ external_wp_deprecated_default()('wp.editSite.PluginTemplateSettingPanel', {
+ since: '6.6',
+ version: '6.8',
+ alternative: 'wp.editor.PluginDocumentSettingPanel'
+ });
+ const isCurrentEntityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []);
+ if (!isCurrentEntityTemplate) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, {
+ children: children
+ });
+};
+PluginTemplateSettingPanel.Slot = Slot;
+
+/**
+ * Renders items in the Template Sidebar below the main information
+ * like the Template Card.
+ *
+ * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead.
+ *
+ * @example
+ * ```jsx
+ * // Using ESNext syntax
+ * import { PluginTemplateSettingPanel } from '@wordpress/edit-site';
+ *
+ * const MyTemplateSettingTest = () => (
+ * <PluginTemplateSettingPanel>
+ * <p>Hello, World!</p>
+ * </PluginTemplateSettingPanel>
+ * );
+ * ```
+ *
+ * @return {Component} The component to be rendered.
+ */
+/* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/seen.js
+/**
+ * WordPress dependencies
+ */
+
+
+const seen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"
+ })
+});
+/* harmony default export */ const library_seen = (seen);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
+/**
+ * WordPress dependencies
+ */
+
+
+const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
+ })
+});
+/* harmony default export */ const more_vertical = (moreVertical);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
+ })
+});
+/* harmony default export */ const chevron_left = (chevronLeft);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
+ })
+});
+/* harmony default export */ const chevron_right = (chevronRight);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js
+/**
* External dependencies
*/
@@ -25484,18 +12017,18 @@ function DefaultSidebar({
* WordPress dependencies
*/
+
function IconWithCurrentColor({
className,
...props
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- className: classnames_default()(className, 'edit-site-global-styles-icon-with-current-color'),
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ className: dist_clsx(className, 'edit-site-global-styles-icon-with-current-color'),
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js
-
/**
* WordPress dependencies
*/
@@ -25505,28 +12038,34 @@ function IconWithCurrentColor({
* Internal dependencies
*/
+
+
function GenericNavigationButton({
icon,
children,
...props
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
- ...props
- }, icon && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_React_.createElement)(IconWithCurrentColor, {
- icon: icon,
- size: 24
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, {
+ ...props,
+ children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, {
+ icon: icon,
+ size: 24
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: children
+ })]
+ }), !icon && children]
+ });
}
function NavigationButtonAsItem(props) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
as: GenericNavigationButton,
...props
});
}
function NavigationBackButtonAsItem(props) {
- return createElement(NavigatorToParentButton, {
+ return /*#__PURE__*/_jsx(NavigatorToParentButton, {
as: GenericNavigationButton,
...props
});
@@ -25534,35 +12073,51 @@ function NavigationBackButtonAsItem(props) {
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js
-
/**
* WordPress dependencies
*/
-const typography = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const typography = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
/* harmony default export */ const library_typography = (typography);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js
-
/**
* WordPress dependencies
*/
-const color = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- 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"
-}));
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
/* harmony default export */ const library_color = (color);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shadow.js
+/**
+ * WordPress dependencies
+ */
+
+const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"
+ })
+});
+/* harmony default export */ const library_shadow = (shadow);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js
/**
* WordPress dependencies
*/
@@ -25576,38 +12131,647 @@ const color = (0,external_React_.createElement)(external_wp_primitives_namespace
*/
+
+
+
const {
useHasDimensionsPanel,
useHasTypographyPanel,
useHasColorPanel,
useGlobalSetting: root_menu_useGlobalSetting,
useSettingsForBlockElement
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function RootMenu() {
const [rawSettings] = root_menu_useGlobalSetting('');
const settings = useSettingsForBlockElement(rawSettings);
const hasTypographyPanel = useHasTypographyPanel(settings);
const hasColorPanel = useHasColorPanel(settings);
+ const hasShadowPanel = true; // useHasShadowPanel( settings );
const hasDimensionsPanel = useHasDimensionsPanel(settings);
const hasLayoutPanel = hasDimensionsPanel;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_React_.createElement)(NavigationButtonAsItem, {
- icon: library_typography,
- path: "/typography",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Typography styles')
- }, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_React_.createElement)(NavigationButtonAsItem, {
- icon: library_color,
- path: "/colors",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors styles')
- }, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_React_.createElement)(NavigationButtonAsItem, {
- icon: library_layout,
- path: "/layout",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Layout styles')
- }, (0,external_wp_i18n_namespaceObject.__)('Layout'))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: [hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ icon: library_typography,
+ path: "/typography",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Typography styles'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Typography')
+ }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ icon: library_color,
+ path: "/colors",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors styles'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Colors')
+ }), hasShadowPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ icon: library_shadow,
+ path: "/shadows",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Shadow styles'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Shadows')
+ }), hasLayoutPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ icon: library_layout,
+ path: "/layout",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Layout styles'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Layout')
+ })]
+ })
+ });
}
/* harmony default export */ const root_menu = (RootMenu);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js
+function findNearest(input, numbers) {
+ // If the numbers array is empty, return null
+ if (numbers.length === 0) {
+ return null;
+ }
+ // Sort the array based on the absolute difference with the input
+ numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b));
+ // Return the first element (which will be the nearest) from the sorted array
+ return numbers[0];
+}
+function extractFontWeights(fontFaces) {
+ const result = [];
+ fontFaces.forEach(face => {
+ const weights = String(face.fontWeight).split(' ');
+ if (weights.length === 2) {
+ const start = parseInt(weights[0]);
+ const end = parseInt(weights[1]);
+ for (let i = start; i <= end; i += 100) {
+ result.push(i);
+ }
+ } else if (weights.length === 1) {
+ result.push(parseInt(weights[0]));
+ }
+ });
+ return result;
+}
+
+/*
+ * Format the font family to use in the CSS font-family property of a CSS rule.
+ *
+ * The input can be a string with the font family name or a string with multiple font family names separated by commas.
+ * It follows the recommendations from the CSS Fonts Module Level 4.
+ * https://www.w3.org/TR/css-fonts-4/#font-family-prop
+ *
+ * @param {string} input - The font family.
+ * @return {string} The formatted font family.
+ *
+ * Example:
+ * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif'
+ * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif'
+ * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif'
+ * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"`
+ */
+function formatFontFamily(input) {
+ // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens).
+ const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
+ const output = input.trim();
+ const formatItem = item => {
+ item = item.trim();
+ if (item.match(regex)) {
+ // removes leading and trailing quotes.
+ item = item.replace(/^["']|["']$/g, '');
+ return `"${item}"`;
+ }
+ return item;
+ };
+ if (output.includes(',')) {
+ return output.split(',').map(formatItem).filter(item => item !== '').join(', ');
+ }
+ return formatItem(output);
+}
+
+/*
+ * Format the font face name to use in the font-family property of a font face.
+ *
+ * The input can be a string with the font face name or a string with multiple font face names separated by commas.
+ * It removes the leading and trailing quotes from the font face name.
+ *
+ * @param {string} input - The font face name.
+ * @return {string} The formatted font face name.
+ *
+ * Example:
+ * formatFontFaceName("Open Sans") => "Open Sans"
+ * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans"
+ * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans"
+ */
+function formatFontFaceName(input) {
+ if (!input) {
+ return '';
+ }
+ let output = input.trim();
+ if (output.includes(',')) {
+ output = output.split(',')
+ // finds the first item that is not an empty string.
+ .find(item => item.trim() !== '').trim();
+ }
+ // removes leading and trailing quotes.
+ output = output.replace(/^["']|["']$/g, '');
+
+ // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't.
+ if (window.navigator.userAgent.toLowerCase().includes('firefox')) {
+ output = `"${output}"`;
+ }
+ return output;
+}
+function getFamilyPreviewStyle(family) {
+ const style = {
+ fontFamily: formatFontFamily(family.fontFamily)
+ };
+ if (!Array.isArray(family.fontFace)) {
+ style.fontWeight = '400';
+ style.fontStyle = 'normal';
+ return style;
+ }
+ if (family.fontFace) {
+ //get all the font faces with normal style
+ const normalFaces = family.fontFace.filter(face => face?.fontStyle && face.fontStyle.toLowerCase() === 'normal');
+ if (normalFaces.length > 0) {
+ style.fontStyle = 'normal';
+ const normalWeights = extractFontWeights(normalFaces);
+ const nearestWeight = findNearest(400, normalWeights);
+ style.fontWeight = String(nearestWeight) || '400';
+ } else {
+ style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal';
+ style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400';
+ }
+ }
+ return style;
+}
+function getFacePreviewStyle(face) {
+ return {
+ fontFamily: formatFontFamily(face.fontFamily),
+ fontStyle: face.fontStyle || 'normal',
+ fontWeight: face.fontWeight || '400'
+ };
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js
+/**
+ *
+ * @param {string} variation The variation name.
+ *
+ * @return {string} The variation class name.
+ */
+function getVariationClassName(variation) {
+ if (!variation) {
+ return '';
+ }
+ return `is-style-${variation}`;
+}
+
+/**
+ * Iterates through the presets array and searches for slugs that start with the specified
+ * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found
+ * and returns one greater than the highest found suffix, ensuring that the new index is unique.
+ *
+ * @param {Array} presets The array of preset objects, each potentially containing a slug property.
+ * @param {string} slugPrefix The prefix to look for in the preset slugs.
+ *
+ * @return {number} The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found.
+ */
+function getNewIndexFromPresets(presets, slugPrefix) {
+ const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`);
+ const highestPresetValue = presets.reduce((currentHighest, preset) => {
+ if (typeof preset?.slug === 'string') {
+ const matches = preset?.slug.match(nameRegex);
+ if (matches) {
+ const id = parseInt(matches[1], 10);
+ if (id > currentHighest) {
+ return id;
+ }
+ }
+ }
+ return currentHighest;
+ }, 0);
+ return highestPresetValue + 1;
+}
+function getFontFamilyFromSetting(fontFamilies, setting) {
+ if (!Array.isArray(fontFamilies) || !setting) {
+ return null;
+ }
+ const fontFamilyVariable = setting.replace('var(', '').replace(')', '');
+ const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0];
+ return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug);
+}
+function getFontFamilies(themeJson) {
+ const fontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; // TODO this could not be under theme.
+ const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
+ const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting);
+ const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
+ let headingFontFamily;
+ if (!headingFontFamilySetting) {
+ headingFontFamily = bodyFontFamily;
+ } else {
+ headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily);
+ }
+ return [bodyFontFamily, headingFontFamily];
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ GlobalStylesContext: typography_example_GlobalStylesContext
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ mergeBaseAndUserConfigs: typography_example_mergeBaseAndUserConfigs
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function PreviewTypography({
+ fontSize,
+ variation
+}) {
+ const {
+ base
+ } = (0,external_wp_element_namespaceObject.useContext)(typography_example_GlobalStylesContext);
+ let config = base;
+ if (variation) {
+ config = typography_example_mergeBaseAndUserConfigs(base, variation);
+ }
+ const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config);
+ const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
+ const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
+ if (fontSize) {
+ bodyPreviewStyle.fontSize = fontSize;
+ headingPreviewStyle.fontSize = fontSize;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ animate: {
+ scale: 1,
+ opacity: 1
+ },
+ initial: {
+ scale: 0.1,
+ opacity: 0
+ },
+ transition: {
+ delay: 0.3,
+ type: 'tween'
+ },
+ style: {
+ textAlign: 'center'
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ style: headingPreviewStyle,
+ children: (0,external_wp_i18n_namespaceObject._x)('A', 'Uppercase letter A')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ style: bodyPreviewStyle,
+ children: (0,external_wp_i18n_namespaceObject._x)('a', 'Lowercase letter A')
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function HighlightedColors({
+ normalizedColorSwatchSize,
+ ratio
+}) {
+ const {
+ highlightedColors
+ } = useStylesPreviewColors();
+ const scaledSwatchSize = normalizedColorSwatchSize * ratio;
+ return highlightedColors.map(({
+ slug,
+ color
+ }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ style: {
+ height: scaledSwatchSize,
+ width: scaledSwatchSize,
+ background: color,
+ borderRadius: scaledSwatchSize / 2
+ },
+ animate: {
+ scale: 1,
+ opacity: 1
+ },
+ initial: {
+ scale: 0.1,
+ opacity: 0
+ },
+ transition: {
+ delay: index === 1 ? 0.2 : 0.1
+ }
+ }, `${slug}-${index}`));
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-iframe.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useGlobalStyle: preview_iframe_useGlobalStyle,
+ useGlobalStylesOutput: preview_iframe_useGlobalStylesOutput
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const normalizedWidth = 248;
+const normalizedHeight = 152;
+
+// Throttle options for useThrottle. Must be defined outside of the component,
+// so that the object reference is the same on each render.
+const THROTTLE_OPTIONS = {
+ leading: true,
+ trailing: true
+};
+function PreviewIframe({
+ children,
+ label,
+ isFocused,
+ withHoverView
+}) {
+ const [backgroundColor = 'white'] = preview_iframe_useGlobalStyle('color.background');
+ const [gradientValue] = preview_iframe_useGlobalStyle('color.gradient');
+ const [styles] = preview_iframe_useGlobalStylesOutput();
+ const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
+ const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [containerResizeListener, {
+ width
+ }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
+ const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width);
+ const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)();
+ const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS);
+ // Must use useLayoutEffect to avoid a flash of the iframe at the wrong
+ // size before the width is set.
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
+ if (width) {
+ setThrottledWidth(width);
+ }
+ }, [width, setThrottledWidth]);
+
+ // Must use useLayoutEffect to avoid a flash of the iframe at the wrong
+ // size before the width is set.
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
+ const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
+ const ratioDiff = newRatio - (ratioState || 0);
+
+ // Only update the ratio state if the difference is big enough
+ // or if the ratio state is not yet set. This is to avoid an
+ // endless loop of updates at particular viewport heights when the
+ // presence of a scrollbar causes the width to change slightly.
+ const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
+ if (isRatioDiffBigEnough || !ratioState) {
+ setRatioState(newRatio);
+ }
+ }, [throttledWidth, ratioState]);
+
+ // Set a fallbackRatio to use before the throttled ratio has been set.
+ const fallbackRatio = width ? width / normalizedWidth : 1;
+ /*
+ * Use the throttled ratio if it has been calculated, otherwise
+ * use the fallback ratio. The throttled ratio is used to avoid
+ * an endless loop of updates at particular viewport heights.
+ * See: https://github.com/WordPress/gutenberg/issues/55112
+ */
+ const ratio = ratioState ? ratioState : fallbackRatio;
+
+ /*
+ * Reset leaked styles from WP common.css and remove main content layout padding and border.
+ * Add pointer cursor to the body to indicate the iframe is interactive,
+ * similar to Typography variation previews.
+ */
+ const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (styles) {
+ return [...styles, {
+ css: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}',
+ isGlobalStyles: true
+ }];
+ }
+ return styles;
+ }, [styles]);
+ const isReady = !!width;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ style: {
+ position: 'relative'
+ },
+ children: containerResizeListener
+ }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
+ className: "edit-site-global-styles-preview__iframe",
+ style: {
+ height: normalizedHeight * ratio
+ },
+ onMouseEnter: () => setIsHovered(true),
+ onMouseLeave: () => setIsHovered(false),
+ tabIndex: -1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
+ styles: editorStyles
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ style: {
+ height: normalizedHeight * ratio,
+ width: '100%',
+ background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
+ cursor: withHoverView ? 'pointer' : undefined
+ },
+ initial: "start",
+ animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start',
+ children: [].concat(children) // This makes sure children is always an array.
+ .map((child, key) => child({
+ ratio,
+ key
+ }))
+ })]
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+const {
+ useGlobalStyle: preview_styles_useGlobalStyle
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const firstFrameVariants = {
+ start: {
+ scale: 1,
+ opacity: 1
+ },
+ hover: {
+ scale: 0,
+ opacity: 0
+ }
+};
+const midFrameVariants = {
+ hover: {
+ opacity: 1
+ },
+ start: {
+ opacity: 0.5
+ }
+};
+const secondFrameVariants = {
+ hover: {
+ scale: 1,
+ opacity: 1
+ },
+ start: {
+ scale: 0,
+ opacity: 0
+ }
+};
+const PreviewStyles = ({
+ label,
+ isFocused,
+ withHoverView,
+ variation
+}) => {
+ const [fontWeight] = preview_styles_useGlobalStyle('typography.fontWeight');
+ const [fontFamily = 'serif'] = preview_styles_useGlobalStyle('typography.fontFamily');
+ const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle('elements.h1.typography.fontFamily');
+ const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle('elements.h1.typography.fontWeight');
+ const [textColor = 'black'] = preview_styles_useGlobalStyle('color.text');
+ const [headingColor = textColor] = preview_styles_useGlobalStyle('elements.h1.color.text');
+ const {
+ paletteColors
+ } = useStylesPreviewColors();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewIframe, {
+ label: label,
+ isFocused: isFocused,
+ withHoverView: withHoverView,
+ children: [({
+ ratio,
+ key
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: firstFrameVariants,
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 10 * ratio,
+ justify: "center",
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, {
+ fontSize: 65 * ratio,
+ variation: variation
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4 * ratio,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HighlightedColors, {
+ normalizedColorSwatchSize: 32,
+ ratio: ratio
+ })
+ })]
+ })
+ }, key), ({
+ key
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: withHoverView && midFrameVariants,
+ style: {
+ height: '100%',
+ width: '100%',
+ position: 'absolute',
+ top: 0,
+ overflow: 'hidden',
+ filter: 'blur(60px)',
+ opacity: 0.1
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 0,
+ justify: "flex-start",
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: paletteColors.slice(0, 4).map(({
+ color
+ }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ style: {
+ height: '100%',
+ background: color,
+ flexGrow: 1
+ }
+ }, index))
+ })
+ }, key), ({
+ ratio,
+ key
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: secondFrameVariants,
+ style: {
+ height: '100%',
+ width: '100%',
+ overflow: 'hidden',
+ position: 'absolute',
+ top: 0
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3 * ratio,
+ justify: "center",
+ style: {
+ height: '100%',
+ overflow: 'hidden',
+ padding: 10 * ratio,
+ boxSizing: 'border-box'
+ },
+ children: label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ style: {
+ fontSize: 40 * ratio,
+ fontFamily: headingFontFamily,
+ color: headingColor,
+ fontWeight: headingFontWeight,
+ lineHeight: '1em',
+ textAlign: 'center'
+ },
+ children: label
+ })
+ })
+ }, key)]
+ });
+};
+/* harmony default export */ const preview_styles = (PreviewStyles);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js
/**
* WordPress dependencies
*/
@@ -25626,9 +12790,12 @@ function RootMenu() {
+
+
+
const {
useGlobalStyle: screen_root_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenRoot() {
const [customCSS] = screen_root_useGlobalStyle('css');
const {
@@ -25647,66 +12814,110 @@ function ScreenRoot() {
canEditCSS: !!globalStyles?._links?.['wp:action-edit-css']
};
}, []);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, {
size: "small",
- className: "edit-site-global-styles-screen-root"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 4
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardMedia, null, (0,external_React_.createElement)(preview, null))), hasVariations && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(NavigationButtonAsItem, {
- path: "/variations",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse styles')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Browse styles')), (0,external_React_.createElement)(IconWithCurrentColor, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- })))), (0,external_React_.createElement)(root_menu, null))), (0,external_React_.createElement)(external_wp_components_namespaceObject.CardDivider, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- as: "p",
- paddingTop: 2
- /*
- * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
- * This is an ad hoc override for this instance and the Addtional CSS option below. Other options for matching the
- * the nav button inset should be looked at before reusing further.
- */,
- paddingX: "13px",
- marginBottom: 4
- }, (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(NavigationButtonAsItem, {
- path: "/blocks",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks styles')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_React_.createElement)(IconWithCurrentColor, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- }))))), canEditCSS && !!customCSS && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardDivider, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- as: "p",
- paddingTop: 2,
- paddingX: "13px",
- marginBottom: 4
- }, (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_React_.createElement)(NavigationButtonAsItem, {
- path: "/css",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Additional CSS')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Additional CSS')), (0,external_React_.createElement)(IconWithCurrentColor, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- })))))));
+ className: "edit-site-global-styles-screen-root",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {})
+ })
+ }), hasVariations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: "/variations",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse styles'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Browse styles')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, {
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
+ })]
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu, {})]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ as: "p",
+ paddingTop: 2
+ /*
+ * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
+ * This is an ad hoc override for this instance and the Addtional CSS option below. Other options for matching the
+ * the nav button inset should be looked at before reusing further.
+ */,
+ paddingX: "13px",
+ marginBottom: 4,
+ children: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: "/blocks",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks styles'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Blocks')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, {
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
+ })]
+ })
+ })
+ })]
+ }), canEditCSS && !!customCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ as: "p",
+ paddingTop: 2,
+ paddingX: "13px",
+ marginBottom: 4,
+ children: (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: "/css",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Additional CSS'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, {
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
+ })]
+ })
+ })
+ })]
+ })]
+ })]
+ });
}
/* harmony default export */ const screen_root = (ScreenRoot);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations-panel.js
-
+;// CONCATENATED MODULE: external ["wp","a11y"]
+const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js
/**
* WordPress dependencies
*/
+
+
/**
* Internal dependencies
*/
-function getCoreBlockStyles(blockStyles) {
- return blockStyles?.filter(style => style.source === 'block');
+
+const {
+ useGlobalStyle: variations_panel_useGlobalStyle
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
+// Only core block styles (source === block) or block styles with a matching
+// theme.json style variation will be configurable via Global Styles.
+function getFilteredBlockStyles(blockStyles, variations) {
+ return blockStyles?.filter(style => style.source === 'block' || variations.includes(style.name));
}
function useBlockVariations(name) {
const blockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
@@ -25715,73 +12926,84 @@ function useBlockVariations(name) {
} = select(external_wp_blocks_namespaceObject.store);
return getBlockStyles(name);
}, [name]);
- const coreBlockStyles = getCoreBlockStyles(blockStyles);
- return coreBlockStyles;
+ const [variations] = variations_panel_useGlobalStyle('variations', name);
+ const variationNames = Object.keys(variations !== null && variations !== void 0 ? variations : {});
+ return getFilteredBlockStyles(blockStyles, variationNames);
}
function VariationsPanel({
name
}) {
const coreBlockStyles = useBlockVariations(name);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
isBordered: true,
- isSeparated: true
- }, coreBlockStyles.map((style, index) => {
- if (style?.isDefault) {
- return null;
- }
- return (0,external_React_.createElement)(NavigationButtonAsItem, {
- key: index,
- path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name),
- "aria-label": style.label
- }, style.label);
- }));
+ isSeparated: true,
+ children: coreBlockStyles.map((style, index) => {
+ if (style?.isDefault) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name),
+ "aria-label": style.label,
+ children: style.label
+ }, index);
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js
-
/**
* WordPress dependencies
*/
+
+
function ScreenHeader({
title,
description,
onBack
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- marginBottom: 0,
- paddingX: 4,
- paddingY: 3
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 2
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
- style:
- // TODO: This style override is also used in ToolsPanelHeader.
- // It should be supported out-of-the-box by Button.
- {
- minWidth: 24,
- padding: 0
- },
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
- isSmall: true,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view'),
- onClick: onBack
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-global-styles-header",
- level: 2,
- size: 13
- }, title))))), description && (0,external_React_.createElement)("p", {
- className: "edit-site-global-styles-header__description"
- }, description));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginBottom: 0,
+ paddingX: 4,
+ paddingY: 3,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
+ style:
+ // TODO: This style override is also used in ToolsPanelHeader.
+ // It should be supported out-of-the-box by Button.
+ {
+ minWidth: 24,
+ padding: 0
+ },
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
+ size: "small",
+ label: (0,external_wp_i18n_namespaceObject.__)('Back'),
+ onClick: onBack
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ className: "edit-site-global-styles-header",
+ level: 2,
+ size: 13,
+ children: title
+ })
+ })]
+ })
+ })
+ }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-global-styles-header__description",
+ children: description
+ })]
+ });
}
/* harmony default export */ const header = (ScreenHeader);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js
-
/**
* WordPress dependencies
*/
@@ -25801,6 +13023,9 @@ function ScreenHeader({
+
+
+
const {
useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel,
useHasTypographyPanel: screen_block_list_useHasTypographyPanel,
@@ -25808,7 +13033,7 @@ const {
useGlobalSetting: screen_block_list_useGlobalSetting,
useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement,
useHasColorPanel: screen_block_list_useHasColorPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function useSortedBlockTypes() {
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,
@@ -25856,14 +13081,18 @@ function BlockMenuItem({
const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: is the name of a block e.g., 'Image' or 'Table'.
(0,external_wp_i18n_namespaceObject.__)('%s block styles'), block.title);
- return (0,external_React_.createElement)(NavigationButtonAsItem, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
path: '/blocks/' + encodeURIComponent(block.name),
- "aria-label": navigationButtonLabel
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
- icon: block.icon
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title)));
+ "aria-label": navigationButtonLabel,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ icon: block.icon
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: block.title
+ })]
+ })
+ });
}
function BlockList({
filterValue
@@ -25894,36 +13123,37 @@ function BlockList({
(0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
debouncedSpeak(resultsFoundMessage, count);
}, [filterValue, debouncedSpeak]);
- return (0,external_React_.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
ref: blockTypesListRef,
- className: "edit-site-block-types-item-list"
- }, filteredBlockTypes.map(block => (0,external_React_.createElement)(BlockMenuItem, {
- block: block,
- key: 'menu-itemblock-' + block.name
- })));
+ className: "edit-site-block-types-item-list",
+ children: filteredBlockTypes.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMenuItem, {
+ block: block
+ }, 'menu-itemblock-' + block.name))
+ });
}
const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList);
function ScreenBlockList() {
const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
const deferredFilterValue = (0,external_wp_element_namespaceObject.useDeferredValue)(filterValue);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
- __nextHasNoMarginBottom: true,
- className: "edit-site-block-types-search",
- onChange: setFilterValue,
- value: filterValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'),
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
- }), (0,external_React_.createElement)(MemoizedBlockList, {
- filterValue: deferredFilterValue
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, {
+ __nextHasNoMarginBottom: true,
+ className: "edit-site-block-types-search",
+ onChange: setFilterValue,
+ value: filterValue,
+ label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'),
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, {
+ filterValue: deferredFilterValue
+ })]
+ });
}
/* harmony default export */ const screen_block_list = (ScreenBlockList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js
-
/**
* WordPress dependencies
*/
@@ -25931,6 +13161,12 @@ function ScreenBlockList() {
+
+/**
+ * Internal dependencies
+ */
+
+
const BlockPreviewPanel = ({
name,
variation = ''
@@ -25947,7 +13183,7 @@ const BlockPreviewPanel = ({
...example,
attributes: {
...example.attributes,
- className: 'is-style-' + variation
+ className: getVariationClassName(variation)
}
};
}
@@ -25958,50 +13194,52 @@ const BlockPreviewPanel = ({
if (!blockExample) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginX: 4,
- marginBottom: 4
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles__block-preview-panel",
- style: {
- maxHeight: previewHeight,
- boxSizing: 'initial'
- }
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockPreview, {
- blocks: blocks,
- viewportWidth: viewportWidth,
- minHeight: previewHeight,
- additionalStyles: [{
- css: `
+ marginBottom: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles__block-preview-panel",
+ style: {
+ maxHeight: previewHeight,
+ boxSizing: 'initial'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, {
+ blocks: blocks,
+ viewportWidth: viewportWidth,
+ minHeight: previewHeight,
+ additionalStyles: [{
+ css: `
body{
min-height:${previewHeight}px;
display:flex;align-items:center;justify-content:center;
}
`
- }]
- })));
+ }]
+ })
+ })
+ });
};
/* harmony default export */ const block_preview_panel = (BlockPreviewPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js
-
/**
* WordPress dependencies
*/
+
function Subtitle({
children,
level
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
className: "edit-site-global-styles-subtitle",
- level: level !== null && level !== void 0 ? level : 2
- }, children);
+ level: level !== null && level !== void 0 ? level : 2,
+ children: children
+ });
}
/* harmony default export */ const subtitle = (Subtitle);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js
-
/**
* WordPress dependencies
*/
@@ -26021,6 +13259,9 @@ function Subtitle({
+
+
+
function applyFallbackStyle(border) {
if (!border) {
return border;
@@ -26068,7 +13309,7 @@ const {
FiltersPanel: StylesFiltersPanel,
ImageSettingsPanel,
AdvancedPanel: StylesAdvancedPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenBlock({
name,
variation
@@ -26215,63 +13456,71 @@ function ScreenBlock({
}
});
};
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: variation ? currentBlockStyle.label : blockType.title
- }), (0,external_React_.createElement)(block_preview_panel, {
- name: name,
- variation: variation
- }), hasVariationsPanel && (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-screen-variations"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_React_.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Style Variations')), (0,external_React_.createElement)(VariationsPanel, {
- name: name
- }))), hasColorPanel && (0,external_React_.createElement)(StylesColorPanel, {
- inheritedValue: inheritedStyle,
- value: style,
- onChange: setStyle,
- settings: settings
- }), hasTypographyPanel && (0,external_React_.createElement)(StylesTypographyPanel, {
- inheritedValue: inheritedStyle,
- value: style,
- onChange: setStyle,
- settings: settings
- }), hasDimensionsPanel && (0,external_React_.createElement)(StylesDimensionsPanel, {
- inheritedValue: inheritedStyleWithLayout,
- value: styleWithLayout,
- onChange: onChangeDimensions,
- settings: settings,
- includeLayoutControls: true
- }), hasBorderPanel && (0,external_React_.createElement)(StylesBorderPanel, {
- inheritedValue: inheritedStyle,
- value: style,
- onChange: onChangeBorders,
- settings: settings
- }), hasFiltersPanel && (0,external_React_.createElement)(StylesFiltersPanel, {
- inheritedValue: inheritedStyleWithLayout,
- value: styleWithLayout,
- onChange: setStyle,
- settings: settings,
- includeLayoutControls: true
- }), hasImageSettingsPanel && (0,external_React_.createElement)(ImageSettingsPanel, {
- onChange: onChangeLightbox,
- value: userSettings,
- inheritedValue: settings
- }), canEditCSS && (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (0,external_wp_i18n_namespaceObject.__)('Advanced'),
- initialOpen: false
- }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
- (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'), blockType?.title)), (0,external_React_.createElement)(StylesAdvancedPanel, {
- value: style,
- onChange: setStyle,
- inheritedValue: inheritedStyle
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: variation ? currentBlockStyle?.label : blockType.title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel, {
+ name: name,
+ variation: variation
+ }), hasVariationsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen-variations",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Style Variations')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, {
+ name: name
+ })]
+ })
+ }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesColorPanel, {
+ inheritedValue: inheritedStyle,
+ value: style,
+ onChange: setStyle,
+ settings: settings
+ }), hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesTypographyPanel, {
+ inheritedValue: inheritedStyle,
+ value: style,
+ onChange: setStyle,
+ settings: settings
+ }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesDimensionsPanel, {
+ inheritedValue: inheritedStyleWithLayout,
+ value: styleWithLayout,
+ onChange: onChangeDimensions,
+ settings: settings,
+ includeLayoutControls: true
+ }), hasBorderPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBorderPanel, {
+ inheritedValue: inheritedStyle,
+ value: style,
+ onChange: onChangeBorders,
+ settings: settings
+ }), hasFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesFiltersPanel, {
+ inheritedValue: inheritedStyleWithLayout,
+ value: styleWithLayout,
+ onChange: setStyle,
+ settings: settings,
+ includeLayoutControls: true
+ }), hasImageSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageSettingsPanel, {
+ onChange: onChangeLightbox,
+ value: userSettings,
+ inheritedValue: settings
+ }), canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Advanced'),
+ initialOpen: false,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
+ (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'), blockType?.title)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesAdvancedPanel, {
+ value: style,
+ onChange: setStyle,
+ inheritedValue: inheritedStyle
+ })]
+ })]
+ });
}
/* harmony default export */ const screen_block = (ScreenBlock);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typogrphy-elements.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js
/**
* WordPress dependencies
*/
@@ -26285,95 +13534,263 @@ function ScreenBlock({
+
+
const {
- useGlobalStyle: typogrphy_elements_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+ useGlobalStyle: typography_elements_useGlobalStyle
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ElementItem({
parentMenu,
element,
label
}) {
+ var _ref;
const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
const extraStyles = element === 'link' ? {
textDecoration: 'underline'
} : {};
- const [fontFamily] = typogrphy_elements_useGlobalStyle(prefix + 'typography.fontFamily');
- const [fontStyle] = typogrphy_elements_useGlobalStyle(prefix + 'typography.fontStyle');
- const [fontWeight] = typogrphy_elements_useGlobalStyle(prefix + 'typography.fontWeight');
- const [letterSpacing] = typogrphy_elements_useGlobalStyle(prefix + 'typography.letterSpacing');
- const [backgroundColor] = typogrphy_elements_useGlobalStyle(prefix + 'color.background');
- const [gradientValue] = typogrphy_elements_useGlobalStyle(prefix + 'color.gradient');
- const [color] = typogrphy_elements_useGlobalStyle(prefix + 'color.text');
+ const [fontFamily] = typography_elements_useGlobalStyle(prefix + 'typography.fontFamily');
+ const [fontStyle] = typography_elements_useGlobalStyle(prefix + 'typography.fontStyle');
+ const [fontWeight] = typography_elements_useGlobalStyle(prefix + 'typography.fontWeight');
+ const [letterSpacing] = typography_elements_useGlobalStyle(prefix + 'typography.letterSpacing');
+ const [backgroundColor] = typography_elements_useGlobalStyle(prefix + 'color.background');
+ const [fallbackBackgroundColor] = typography_elements_useGlobalStyle('color.background');
+ const [gradientValue] = typography_elements_useGlobalStyle(prefix + 'color.gradient');
+ const [color] = typography_elements_useGlobalStyle(prefix + 'color.text');
const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.
(0,external_wp_i18n_namespaceObject.__)('Typography %s styles'), label);
- return (0,external_React_.createElement)(NavigationButtonAsItem, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
path: parentMenu + '/typography/' + element,
- "aria-label": navigationButtonLabel
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-global-styles-screen-typography__indicator",
- style: {
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
- color,
- fontStyle,
- fontWeight,
- letterSpacing,
- ...extraStyles
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, label)));
+ "aria-label": navigationButtonLabel,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "edit-site-global-styles-screen-typography__indicator",
+ style: {
+ fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
+ background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor,
+ color,
+ fontStyle,
+ fontWeight,
+ letterSpacing,
+ ...extraStyles
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Aa')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: label
+ })]
+ })
+ });
}
function TypographyElements() {
const parentMenu = '';
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_React_.createElement)(subtitle, {
- level: 3
- }, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, (0,external_React_.createElement)(ElementItem, {
- parentMenu: parentMenu,
- element: "text",
- label: (0,external_wp_i18n_namespaceObject.__)('Text')
- }), (0,external_React_.createElement)(ElementItem, {
- parentMenu: parentMenu,
- element: "link",
- label: (0,external_wp_i18n_namespaceObject.__)('Links')
- }), (0,external_React_.createElement)(ElementItem, {
- parentMenu: parentMenu,
- element: "heading",
- label: (0,external_wp_i18n_namespaceObject.__)('Headings')
- }), (0,external_React_.createElement)(ElementItem, {
- parentMenu: parentMenu,
- element: "caption",
- label: (0,external_wp_i18n_namespaceObject.__)('Captions')
- }), (0,external_React_.createElement)(ElementItem, {
- parentMenu: parentMenu,
- element: "button",
- label: (0,external_wp_i18n_namespaceObject.__)('Buttons')
- })));
-}
-/* harmony default export */ const typogrphy_elements = (TypographyElements);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: (0,external_wp_i18n_namespaceObject.__)('Elements')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ isBordered: true,
+ isSeparated: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, {
+ parentMenu: parentMenu,
+ element: "text",
+ label: (0,external_wp_i18n_namespaceObject.__)('Text')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, {
+ parentMenu: parentMenu,
+ element: "link",
+ label: (0,external_wp_i18n_namespaceObject.__)('Links')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, {
+ parentMenu: parentMenu,
+ element: "heading",
+ label: (0,external_wp_i18n_namespaceObject.__)('Headings')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, {
+ parentMenu: parentMenu,
+ element: "caption",
+ label: (0,external_wp_i18n_namespaceObject.__)('Captions')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, {
+ parentMenu: parentMenu,
+ element: "button",
+ label: (0,external_wp_i18n_namespaceObject.__)('Buttons')
+ })]
+ })]
+ });
+}
+/* harmony default export */ const typography_elements = (TypographyElements);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js
+/**
+ * External dependencies
+ */
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const {
+ GlobalStylesContext: variation_GlobalStylesContext,
+ areGlobalStyleConfigsEqual
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function Variation({
+ variation,
+ children,
+ isPill,
+ property
+}) {
+ const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ base,
+ user,
+ setUserConfig
+ } = (0,external_wp_element_namespaceObject.useContext)(variation_GlobalStylesContext);
+ const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ let merged = variation_mergeBaseAndUserConfigs(base, variation);
+ if (property) {
+ merged = filterObjectByProperty(merged, property);
+ }
+ return {
+ user: variation,
+ base,
+ merged,
+ setUserConfig: () => {}
+ };
+ }, [variation, base, property]);
+ const selectVariation = () => setUserConfig(variation);
+ const selectOnEnter = event => {
+ if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
+ event.preventDefault();
+ selectVariation();
+ }
+ };
+ const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => areGlobalStyleConfigsEqual(user, variation), [user, variation]);
+ let label = variation?.title;
+ if (variation?.description) {
+ label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: variation title. %2$s variation description. */
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), variation?.title, variation?.description);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, {
+ value: context,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-global-styles-variations_item', {
+ 'is-active': isActive
+ }),
+ role: "button",
+ onClick: selectVariation,
+ onKeyDown: selectOnEnter,
+ tabIndex: "0",
+ "aria-label": label,
+ "aria-current": isActive,
+ onFocus: () => setIsFocused(true),
+ onBlur: () => setIsFocused(false),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-global-styles-variations_item-preview', {
+ 'is-pill': isPill
+ }),
+ children: children(isFocused)
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+function TypographyVariations({
+ title,
+ gap = 2
+}) {
+ const typographyVariations = useTypographyVariations();
+
+ // Return null if there is only one variation (the default).
+ if (typographyVariations?.length <= 1) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, {
+ columns: 3,
+ gap: gap,
+ className: "edit-site-global-styles-style-variations-container",
+ children: typographyVariations && typographyVariations.length && typographyVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, {
+ variation: variation,
+ property: "typography",
+ children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewIframe, {
+ label: variation?.title,
+ isFocused: isFocused,
+ children: ({
+ ratio,
+ key
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 10 * ratio,
+ justify: "center",
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, {
+ variation: variation,
+ fontSize: 85 * ratio
+ })
+ }, key)
+ })
+ }, index))
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
/**
* WordPress dependencies
*/
-const settings_settings = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+
+const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
-}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
-}));
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
+ })]
+});
/* harmony default export */ const library_settings = (settings_settings);
+;// CONCATENATED MODULE: external ["wp","apiFetch"]
+const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
+var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js
/**
* WordPress dependencies
@@ -26466,134 +13883,6 @@ const FONT_STYLES = {
italic: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style')
};
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js
-function findNearest(input, numbers) {
- // If the numbers array is empty, return null
- if (numbers.length === 0) {
- return null;
- }
- // Sort the array based on the absolute difference with the input
- numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b));
- // Return the first element (which will be the nearest) from the sorted array
- return numbers[0];
-}
-function extractFontWeights(fontFaces) {
- const result = [];
- fontFaces.forEach(face => {
- const weights = String(face.fontWeight).split(' ');
- if (weights.length === 2) {
- const start = parseInt(weights[0]);
- const end = parseInt(weights[1]);
- for (let i = start; i <= end; i += 100) {
- result.push(i);
- }
- } else if (weights.length === 1) {
- result.push(parseInt(weights[0]));
- }
- });
- return result;
-}
-
-/*
- * Format the font family to use in the CSS font-family property of a CSS rule.
- *
- * The input can be a string with the font family name or a string with multiple font family names separated by commas.
- * It follows the recommendations from the CSS Fonts Module Level 4.
- * https://www.w3.org/TR/css-fonts-4/#font-family-prop
- *
- * @param {string} input - The font family.
- * @return {string} The formatted font family.
- *
- * Example:
- * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif'
- * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif'
- * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif'
- * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"`
- */
-function formatFontFamily(input) {
- // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens).
- const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
- const output = input.trim();
- const formatItem = item => {
- item = item.trim();
- if (item.match(regex)) {
- // removes leading and trailing quotes.
- item = item.replace(/^["']|["']$/g, '');
- return `"${item}"`;
- }
- return item;
- };
- if (output.includes(',')) {
- return output.split(',').map(formatItem).filter(item => item !== '').join(', ');
- }
- return formatItem(output);
-}
-
-/*
- * Format the font face name to use in the font-family property of a font face.
- *
- * The input can be a string with the font face name or a string with multiple font face names separated by commas.
- * It removes the leading and trailing quotes from the font face name.
- *
- * @param {string} input - The font face name.
- * @return {string} The formatted font face name.
- *
- * Example:
- * formatFontFaceName("Open Sans") => "Open Sans"
- * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans"
- * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans"
- */
-function formatFontFaceName(input) {
- if (!input) {
- return '';
- }
- let output = input.trim();
- if (output.includes(',')) {
- output = output.split(',')
- // finds the first item that is not an empty string.
- .find(item => item.trim() !== '').trim();
- }
- // removes leading and trailing quotes.
- output = output.replace(/^["']|["']$/g, '');
-
- // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't.
- if (window.navigator.userAgent.toLowerCase().includes('firefox')) {
- output = `"${output}"`;
- }
- return output;
-}
-function getFamilyPreviewStyle(family) {
- const style = {
- fontFamily: formatFontFamily(family.fontFamily)
- };
- if (!Array.isArray(family.fontFace)) {
- style.fontWeight = '400';
- style.fontStyle = 'normal';
- return style;
- }
- if (family.fontFace) {
- //get all the font faces with normal style
- const normalFaces = family.fontFace.filter(face => face.fontStyle.toLowerCase() === 'normal');
- if (normalFaces.length > 0) {
- style.fontStyle = 'normal';
- const normalWeights = extractFontWeights(normalFaces);
- const nearestWeight = findNearest(400, normalWeights);
- style.fontWeight = String(nearestWeight) || '400';
- } else {
- style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal';
- style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400';
- }
- }
- return style;
-}
-function getFacePreviewStyle(face) {
- return {
- fontFamily: formatFontFamily(face.fontFamily),
- fontStyle: face.fontStyle || 'normal',
- fontWeight: face.fontWeight || '400'
- };
-}
-
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js
/**
* WordPress dependencies
@@ -26614,6 +13903,9 @@ function getFacePreviewStyle(face) {
const {
File
} = window;
+const {
+ kebabCase
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function setUIValuesNeeded(font, extraValues = {}) {
if (!font.name && (font.fontFamily || font.slug)) {
font.name = font.fontFamily || font.slug;
@@ -26759,9 +14051,6 @@ function getDisplaySrcFromFontFace(input) {
function makeFontFamilyFormData(fontFamily) {
const formData = new FormData();
const {
- kebabCase
- } = unlock(external_wp_components_namespaceObject.privateApis);
- const {
fontFace,
category,
...familyWithValidParameters
@@ -26976,7 +14265,6 @@ function toggleFont(font, face, initialfonts) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js
-
/**
* WordPress dependencies
*/
@@ -26993,7 +14281,8 @@ function toggleFont(font, face, initialfonts) {
const {
useGlobalSetting: context_useGlobalSetting
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
@@ -27015,7 +14304,6 @@ function FontLibraryProvider({
};
});
const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId);
- const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
const [isInstalling, setIsInstalling] = (0,external_wp_element_namespaceObject.useState)(false);
const [refreshKey, setRefreshKey] = (0,external_wp_element_namespaceObject.useState)(0);
const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(null);
@@ -27024,8 +14312,7 @@ function FontLibraryProvider({
};
const {
records: libraryPosts = [],
- isResolving: isResolvingLibrary,
- hasResolved: hasResolvedLibrary
+ isResolving: isResolvingLibrary
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'wp_font_family', {
refreshKey,
_embed: true
@@ -27040,17 +14327,15 @@ function FontLibraryProvider({
// Global Styles (settings) font families
const [fontFamilies, setFontFamilies] = context_useGlobalSetting('typography.fontFamilies');
- // theme.json file font families
- const [baseFontFamilies] = context_useGlobalSetting('typography.fontFamilies', undefined, 'base');
/*
* Save the font families to the database.
* This function is called when the user activates or deactivates a font family.
* It only updates the global styles post content in the database for new font families.
* This avoids saving other styles/settings changed by the user using other parts of the editor.
- *
+ *
* It uses the font families from the param to avoid using the font families from an outdated state.
- *
+ *
* @param {Array} fonts - The font families that will be saved to the database.
*/
const saveFontFamilies = async fonts => {
@@ -27072,18 +14357,6 @@ function FontLibraryProvider({
const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, {
source: 'theme'
})).sort((a, b) => a.name.localeCompare(b.name)) : [];
- const themeFontsSlugs = new Set(themeFonts.map(f => f.slug));
-
- /*
- * Base Theme Fonts are the fonts defined in the theme.json *file*.
- *
- * Uses the fonts from global styles + the ones from the theme.json file that hasn't repeated slugs.
- * Avoids incosistencies with the fonts listed in the font library modal as base (unactivated).
- * These inconsistencies can happen when the active theme fonts in global styles aren't defined in theme.json file as when a theme style variation is applied.
- */
- const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, {
- source: 'theme'
- })).sort((a, b) => a.name.localeCompare(b.name))) : [];
const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, {
source: 'custom'
})).sort((a, b) => a.name.localeCompare(b.name)) : [];
@@ -27113,9 +14386,6 @@ function FontLibraryProvider({
source: font.source
});
};
- const toggleModal = tabName => {
- setModalTabOpen(tabName || null);
- };
// Demo
const [loadedFontUrls] = (0,external_wp_element_namespaceObject.useState)(new Set());
@@ -27173,20 +14443,20 @@ function FontLibraryProvider({
}
// Install the fonts (upload the font files to the server and create the post in the database).
- let sucessfullyInstalledFontFaces = [];
- let unsucessfullyInstalledFontFaces = [];
+ let successfullyInstalledFontFaces = [];
+ let unsuccessfullyInstalledFontFaces = [];
if (fontFamilyToInstall?.fontFace?.length > 0) {
const response = await batchInstallFontFaces(installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall));
- sucessfullyInstalledFontFaces = response?.successes;
- unsucessfullyInstalledFontFaces = response?.errors;
+ successfullyInstalledFontFaces = response?.successes;
+ unsuccessfullyInstalledFontFaces = response?.errors;
}
- // Use the sucessfully installed font faces
+ // Use the successfully installed font faces
// As well as any font faces that were already installed (those will be activated)
- if (sucessfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) {
+ if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) {
// Use font data from REST API not from client to ensure
// correct font information is used.
- installedFontFamily.fontFace = [...sucessfullyInstalledFontFaces];
+ installedFontFamily.fontFace = [...successfullyInstalledFontFaces];
fontFamiliesToActivate.push(installedFontFamily);
}
@@ -27196,10 +14466,10 @@ function FontLibraryProvider({
}
// If the font family is new and is not a system font, delete it to avoid having font families without font faces.
- if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && sucessfullyInstalledFontFaces?.length === 0) {
+ if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) {
await fetchUninstallFontFamily(installedFontFamily.id);
}
- installationErrors = installationErrors.concat(unsucessfullyInstalledFontFaces);
+ installationErrors = installationErrors.concat(unsuccessfullyInstalledFontFaces);
}
installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []);
if (fontFamiliesToActivate.length > 0) {
@@ -27321,11 +14591,15 @@ function FontLibraryProvider({
};
const loadFontFaceAsset = async fontFace => {
// If the font doesn't have a src, don't load it.
- if (!fontFace.src) return;
+ if (!fontFace.src) {
+ return;
+ }
// Get the src of the font.
const src = getDisplaySrcFromFontFace(fontFace.src);
// If the font is already loaded, don't load it again.
- if (!src || loadedFontUrls.has(src)) return;
+ if (!src || loadedFontUrls.has(src)) {
+ return;
+ }
// Load the font in the browser.
loadFontFaceInBrowser(fontFace, src, 'document');
// Add the font to the loaded fonts list.
@@ -27341,7 +14615,9 @@ function FontLibraryProvider({
const getFontCollection = async slug => {
try {
const hasData = !!collections.find(collection => collection.slug === slug)?.font_families;
- if (hasData) return;
+ if (hasData) {
+ return;
+ }
const response = await fetchFontCollection(slug);
const updatedCollections = collections.map(collection => collection.slug === slug ? {
...collection,
@@ -27357,14 +14633,11 @@ function FontLibraryProvider({
(0,external_wp_element_namespaceObject.useEffect)(() => {
getFontCollections();
}, []);
- return (0,external_React_.createElement)(FontLibraryContext.Provider, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontLibraryContext.Provider, {
value: {
libraryFontSelected,
handleSetLibraryFontSelected,
fontFamilies,
- themeFonts,
- baseThemeFonts,
- customFonts,
baseCustomFonts,
isFontActivated,
getFontFacesActivated,
@@ -27374,24 +14647,22 @@ function FontLibraryProvider({
toggleActivateFont,
getAvailableFontsOutline,
modalTabOpen,
- toggleModal,
+ setModalTabOpen,
refreshLibrary,
notice,
setNotice,
saveFontFamilies,
- fontFamiliesHasChanges,
isResolvingLibrary,
- hasResolvedLibrary,
isInstalling,
collections,
getFontCollection
- }
- }, children);
+ },
+ children: children
+ });
}
/* harmony default export */ const context = (FontLibraryProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js
-
/**
* WordPress dependencies
*/
@@ -27403,6 +14674,7 @@ function FontLibraryProvider({
*/
+
function getPreviewUrl(fontFace) {
if (fontFace.preview) {
return fontFace.preview;
@@ -27472,22 +14744,23 @@ function FontDemo({
};
loadAsset();
}, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]);
- return (0,external_React_.createElement)("div", {
- ref: ref
- }, isPreviewImage ? (0,external_React_.createElement)("img", {
- src: previewUrl,
- loading: "lazy",
- alt: text,
- className: "font-library-modal__font-variant_demo-image"
- }) : (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- style: textDemoStyle,
- className: "font-library-modal__font-variant_demo-text"
- }, text));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ref: ref,
+ children: isPreviewImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ src: previewUrl,
+ loading: "lazy",
+ alt: text,
+ className: "font-library-modal__font-variant_demo-image"
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ style: textDemoStyle,
+ className: "font-library-modal__font-variant_demo-text",
+ children: text
+ })
+ });
}
/* harmony default export */ const font_demo = (FontDemo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js
-
/**
* WordPress dependencies
*/
@@ -27499,6 +14772,8 @@ function FontDemo({
*/
+
+
function FontCard({
font,
onClick,
@@ -27510,7 +14785,7 @@ function FontCard({
cursor: !!onClick ? 'pointer' : 'default'
};
const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
onClick: () => {
onClick();
if (navigatorPath) {
@@ -27518,25 +14793,32 @@ function FontCard({
}
},
style: style,
- className: "font-library-modal__font-card"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "space-between",
- wrap: false
- }, (0,external_React_.createElement)(font_demo, {
- font: font
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-end"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "font-library-modal__font-card__count"
- }, variantsText || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */
- (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: chevron_right
- })))));
+ className: "font-library-modal__font-card",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "space-between",
+ wrap: false,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, {
+ font: font
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-end",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ className: "font-library-modal__font-card__count",
+ children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */
+ (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount)
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: chevron_right
+ })
+ })]
+ })]
+ })
+ });
}
/* harmony default export */ const font_card = (FontCard);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js
-
/**
* WordPress dependencies
*/
@@ -27550,6 +14832,11 @@ function FontCard({
+
+
+const {
+ kebabCase: library_font_variant_kebabCase
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function LibraryFontVariant({
face,
font
@@ -27567,28 +14854,28 @@ function LibraryFontVariant({
toggleActivateFont(font);
};
const displayName = font.name + ' ' + getFontFaceVariantName(face);
- const {
- kebabCase
- } = unlock(external_wp_components_namespaceObject.privateApis);
- const checkboxId = kebabCase(`${font.slug}-${getFontFaceVariantName(face)}`);
- return (0,external_React_.createElement)("div", {
- className: "font-library-modal__font-card"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-start",
- align: "center",
- gap: "1rem"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- checked: isInstalled,
- onChange: handleToggleActivation,
- __nextHasNoMarginBottom: true,
- id: checkboxId
- }), (0,external_React_.createElement)("label", {
- htmlFor: checkboxId
- }, (0,external_React_.createElement)(font_demo, {
- font: face,
- text: displayName,
- onClick: handleToggleActivation
- }))));
+ const checkboxId = library_font_variant_kebabCase(`${font.slug}-${getFontFaceVariantName(face)}`);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__font-card",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-start",
+ align: "center",
+ gap: "1rem",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ checked: isInstalled,
+ onChange: handleToggleActivation,
+ __nextHasNoMarginBottom: true,
+ id: checkboxId
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", {
+ htmlFor: checkboxId,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, {
+ font: face,
+ text: displayName,
+ onClick: handleToggleActivation
+ })
+ })]
+ })
+ });
}
/* harmony default export */ const library_font_variant = (LibraryFontVariant);
@@ -27610,8 +14897,12 @@ function getNumericFontWeight(value) {
function sortFontFaces(faces) {
return faces.sort((a, b) => {
// Ensure 'normal' fontStyle is always first
- if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') return -1;
- if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') return 1;
+ if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') {
+ return -1;
+ }
+ if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') {
+ return 1;
+ }
// If both fontStyles are the same, sort by fontWeight
if (a.fontStyle === b.fontStyle) {
@@ -27624,7 +14915,6 @@ function sortFontFaces(faces) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js
-
/**
* WordPress dependencies
*/
@@ -27635,6 +14925,7 @@ function sortFontFaces(faces) {
+
/**
* Internal dependencies
*/
@@ -27643,14 +14934,17 @@ function sortFontFaces(faces) {
+
+
+
+
const {
- ProgressBar
-} = unlock(external_wp_components_namespaceObject.privateApis);
+ useGlobalSetting: installed_fonts_useGlobalSetting
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function InstalledFonts() {
const {
baseCustomFonts,
libraryFontSelected,
- baseThemeFonts,
handleSetLibraryFontSelected,
refreshLibrary,
uninstallFontFamily,
@@ -27658,12 +14952,27 @@ function InstalledFonts() {
isInstalling,
saveFontFamilies,
getFontFacesActivated,
- fontFamiliesHasChanges,
notice,
setNotice,
fontFamilies
} = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext);
const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [baseFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies', undefined, 'base');
+ const globalStylesId = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ __experimentalGetCurrentGlobalStylesId
+ } = select(external_wp_coreData_namespaceObject.store);
+ return __experimentalGetCurrentGlobalStylesId();
+ });
+ const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId);
+ const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
+ const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, {
+ source: 'theme'
+ })).sort((a, b) => a.name.localeCompare(b.name)) : [];
+ const themeFontsSlugs = new Set(themeFonts.map(f => f.slug));
+ const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, {
+ source: 'theme'
+ })).sort((a, b) => a.name.localeCompare(b.name))) : [];
const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id;
const canUserDelete = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
@@ -27698,103 +15007,132 @@ function InstalledFonts() {
handleSetLibraryFontSelected(libraryFontSelected);
refreshLibrary();
}, []);
- return (0,external_React_.createElement)("div", {
- className: "font-library-modal__tabpanel-layout"
- }, isResolvingLibrary && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- align: "center"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
- initialPath: libraryFontSelected ? '/fontFamily' : '/'
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- path: "/"
- }, notice && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: notice.type,
- onRemove: () => setNotice(null)
- }, notice.message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- })), baseCustomFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "font-library-modal__subtitle"
- }, (0,external_wp_i18n_namespaceObject.__)('Installed Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 2
- }), baseCustomFonts.map(font => (0,external_React_.createElement)(font_card, {
- font: font,
- key: font.slug,
- navigatorPath: '/fontFamily',
- variantsText: getFontCardVariantsText(font),
- onClick: () => {
- handleSetLibraryFontSelected(font);
- }
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 8
- })), baseThemeFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "font-library-modal__subtitle"
- }, (0,external_wp_i18n_namespaceObject.__)('Theme Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 2
- }), baseThemeFonts.map(font => (0,external_React_.createElement)(font_card, {
- font: font,
- key: font.slug,
- navigatorPath: '/fontFamily',
- variantsText: getFontCardVariantsText(font),
- onClick: () => {
- handleSetLibraryFontSelected(font);
- }
- })))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- path: "/fontFamily"
- }, (0,external_React_.createElement)(ConfirmDeleteDialog, {
- font: libraryFontSelected,
- isOpen: isConfirmDeleteOpen,
- setIsOpen: setIsConfirmDeleteOpen,
- setNotice: setNotice,
- uninstallFontFamily: uninstallFontFamily,
- handleSetLibraryFontSelected: handleSetLibraryFontSelected
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-start"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
- icon: chevron_left,
- isSmall: true,
- onClick: () => {
- handleSetLibraryFontSelected(null);
- },
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 2,
- size: 13,
- className: "edit-site-global-styles-header"
- }, libraryFontSelected?.name)), notice && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: notice.type,
- onRemove: () => setNotice(null)
- }, notice.message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 8
- }), getFontFacesToDisplay(libraryFontSelected).map((face, i) => (0,external_React_.createElement)(library_font_variant, {
- font: libraryFontSelected,
- face: face,
- key: `face${i}`
- }))))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-end",
- className: "font-library-modal__tabpanel-layout__footer"
- }, isInstalling && (0,external_React_.createElement)(ProgressBar, null), shouldDisplayDeleteButton && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- isDestructive: true,
- variant: "tertiary",
- onClick: handleUninstallClick
- }, (0,external_wp_i18n_namespaceObject.__)('Delete')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: () => {
- saveFontFamilies(fontFamilies);
- },
- disabled: !fontFamiliesHasChanges,
- __experimentalIsFocusable: true
- }, (0,external_wp_i18n_namespaceObject.__)('Update'))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "font-library-modal__tabpanel-layout",
+ children: [isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__loading",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {})
+ }), !isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
+ initialPath: libraryFontSelected ? '/fontFamily' : '/',
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
+ path: "/",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "8",
+ children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ status: notice.type,
+ onRemove: () => setNotice(null),
+ children: notice.message
+ }), baseCustomFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "font-library-modal__fonts-title",
+ children: (0,external_wp_i18n_namespaceObject.__)('Installed Fonts')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ role: "list",
+ className: "font-library-modal__fonts-list",
+ children: baseCustomFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ className: "font-library-modal__fonts-list-item",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, {
+ font: font,
+ navigatorPath: "/fontFamily",
+ variantsText: getFontCardVariantsText(font),
+ onClick: () => {
+ handleSetLibraryFontSelected(font);
+ }
+ })
+ }, font.slug))
+ })]
+ }), baseThemeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "font-library-modal__fonts-title",
+ children: (0,external_wp_i18n_namespaceObject.__)('Theme Fonts')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ role: "list",
+ className: "font-library-modal__fonts-list",
+ children: baseThemeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ className: "font-library-modal__fonts-list-item",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, {
+ font: font,
+ navigatorPath: "/fontFamily",
+ variantsText: getFontCardVariantsText(font),
+ onClick: () => {
+ handleSetLibraryFontSelected(font);
+ }
+ })
+ }, font.slug))
+ })]
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
+ path: "/fontFamily",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConfirmDeleteDialog, {
+ font: libraryFontSelected,
+ isOpen: isConfirmDeleteOpen,
+ setIsOpen: setIsConfirmDeleteOpen,
+ setNotice: setNotice,
+ uninstallFontFamily: uninstallFontFamily,
+ handleSetLibraryFontSelected: handleSetLibraryFontSelected
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
+ icon: chevron_left,
+ size: "small",
+ onClick: () => {
+ handleSetLibraryFontSelected(null);
+ },
+ label: (0,external_wp_i18n_namespaceObject.__)('Back')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 2,
+ size: 13,
+ className: "edit-site-global-styles-header",
+ children: libraryFontSelected?.name
+ })]
+ }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 1
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ status: notice.type,
+ onRemove: () => setNotice(null),
+ children: notice.message
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 1
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 8
+ }), getFontFacesToDisplay(libraryFontSelected).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(library_font_variant, {
+ font: libraryFontSelected,
+ face: face
+ }, `face${i}`))]
+ })]
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-end",
+ className: "font-library-modal__tabpanel-layout__footer",
+ children: [isInstalling && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), shouldDisplayDeleteButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ isDestructive: true,
+ variant: "tertiary",
+ onClick: handleUninstallClick,
+ children: (0,external_wp_i18n_namespaceObject.__)('Delete')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: () => {
+ saveFontFamilies(fontFamilies);
+ },
+ disabled: !fontFamiliesHasChanges,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Update')
+ })]
+ })]
+ })]
+ });
}
function ConfirmDeleteDialog({
font,
@@ -27826,14 +15164,16 @@ function ConfirmDeleteDialog({
const handleCancelUninstall = () => {
setIsOpen(false);
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
isOpen: isOpen,
cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'),
onCancel: handleCancelUninstall,
- onConfirm: handleConfirmUninstall
- }, font && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font. */
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name));
+ onConfirm: handleConfirmUninstall,
+ size: "medium",
+ children: font && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font. */
+ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name)
+ });
}
/* harmony default export */ const installed_fonts = (InstalledFonts);
@@ -27886,41 +15226,51 @@ function isFontFontFaceInOutline(slug, face, outline) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js
-
/**
* WordPress dependencies
*/
+
+
function GoogleFontsConfirmDialog() {
const handleConfirm = () => {
// eslint-disable-next-line no-undef
window.localStorage.setItem('wp-font-library-google-fonts-permission', 'true');
window.dispatchEvent(new Event('storage'));
};
- return (0,external_React_.createElement)("div", {
- className: "font-library__google-fonts-confirm"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "h3"
- }, (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 6
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p"
- }, (0,external_wp_i18n_namespaceObject.__)('To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 3
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p"
- }, (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 6
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: handleConfirm
- }, (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts')))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library__google-fonts-confirm",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 2,
+ children: (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 6
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "p",
+ children: (0,external_wp_i18n_namespaceObject.__)('To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 3
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "p",
+ children: (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 6
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "primary",
+ onClick: handleConfirm,
+ children: (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts')
+ })]
+ })
+ })
+ });
}
/* harmony default export */ const google_fonts_confirm_dialog = (GoogleFontsConfirmDialog);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js
-
/**
* WordPress dependencies
*/
@@ -27932,6 +15282,11 @@ function GoogleFontsConfirmDialog() {
+
+
+const {
+ kebabCase: collection_font_variant_kebabCase
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function CollectionFontVariant({
face,
font,
@@ -27946,33 +15301,32 @@ function CollectionFontVariant({
handleToggleVariant(font);
};
const displayName = font.name + ' ' + getFontFaceVariantName(face);
- const {
- kebabCase
- } = unlock(external_wp_components_namespaceObject.privateApis);
- const checkboxId = kebabCase(`${font.slug}-${getFontFaceVariantName(face)}`);
- return (0,external_React_.createElement)("div", {
- className: "font-library-modal__font-card"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-start",
- align: "center",
- gap: "1rem"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
- checked: selected,
- onChange: handleToggleActivation,
- __nextHasNoMarginBottom: true,
- id: checkboxId
- }), (0,external_React_.createElement)("label", {
- htmlFor: checkboxId
- }, (0,external_React_.createElement)(font_demo, {
- font: face,
- text: displayName,
- onClick: handleToggleActivation
- }))));
+ const checkboxId = collection_font_variant_kebabCase(`${font.slug}-${getFontFaceVariantName(face)}`);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__font-card",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-start",
+ align: "center",
+ gap: "1rem",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ checked: selected,
+ onChange: handleToggleActivation,
+ __nextHasNoMarginBottom: true,
+ id: checkboxId
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", {
+ htmlFor: checkboxId,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, {
+ font: face,
+ text: displayName,
+ onClick: handleToggleActivation
+ })
+ })]
+ })
+ });
}
/* harmony default export */ const collection_font_variant = (CollectionFontVariant);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js
-
/**
* WordPress dependencies
*/
@@ -27994,6 +15348,9 @@ function CollectionFontVariant({
+
+
+
const DEFAULT_CATEGORY = {
slug: 'all',
name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories')
@@ -28065,6 +15422,7 @@ function FontCollection({
const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : [];
const categories = [DEFAULT_CATEGORY, ...collectionCategories];
const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]);
+ const isLoading = !selectedCollection?.font_families && !notice;
// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px
// The height of each font family item is 61px.
@@ -28093,13 +15451,6 @@ function FontCollection({
setFilters({});
setPage(1);
};
- const resetSearch = () => {
- setFilters({
- ...filters,
- search: ''
- });
- setPage(1);
- };
const handleToggleVariant = (font, face) => {
const newFontsToInstall = toggleFont(font, face, fontsToInstall);
setFontsToInstall(newFontsToInstall);
@@ -28156,13 +15507,13 @@ function FontCollection({
return sortFontFaces(fontFamily.fontFace);
};
if (renderConfirmDialog) {
- return (0,external_React_.createElement)(google_fonts_confirm_dialog, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog, {});
}
const ActionsComponent = () => {
if (slug !== 'google-fonts' || renderConfirmDialog || selectedFont) {
return null;
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
icon: more_vertical,
label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
popoverProps: {
@@ -28174,148 +15525,198 @@ function FontCollection({
}]
});
};
- return (0,external_React_.createElement)("div", {
- className: "font-library-modal__tabpanel-layout"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
- initialPath: "/",
- className: "font-library-modal__tabpanel-layout"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- path: "/"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 2,
- size: 13
- }, selectedCollection.name), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, selectedCollection.description)), (0,external_React_.createElement)(ActionsComponent, null)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalInputControl, {
- value: filters.search,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'),
- label: (0,external_wp_i18n_namespaceObject.__)('Search'),
- onChange: debouncedUpdateSearchInput,
- prefix: (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_search
- }),
- suffix: filters?.search ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: close_small,
- onClick: resetSearch
- }) : null
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Category'),
- value: filters.category,
- onChange: handleCategoryFilter
- }, categories && categories.map(category => (0,external_React_.createElement)("option", {
- value: category.slug,
- key: category.slug
- }, category.name))))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), !selectedCollection?.font_families && !notice && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), !!selectedCollection?.font_families?.length && !fonts.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term')), (0,external_React_.createElement)("div", {
- className: "font-library-modal__fonts-grid__main"
- }, items.map(font => (0,external_React_.createElement)(font_card, {
- key: font.font_family_settings.slug,
- font: font.font_family_settings,
- navigatorPath: '/fontFamily',
- onClick: () => {
- setSelectedFont(font.font_family_settings);
- }
- })))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- path: "/fontFamily"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-start"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
- icon: chevron_left,
- isSmall: true,
- onClick: () => {
- setSelectedFont(null);
- setNotice(null);
- },
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 2,
- size: 13,
- className: "edit-site-global-styles-header"
- }, selectedFont?.name)), notice && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: notice.type,
- onRemove: () => setNotice(null)
- }, notice.message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 1
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, " ", (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.'), " "), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 4
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 8
- }), getSortedFontFaces(selectedFont).map((face, i) => (0,external_React_.createElement)(collection_font_variant, {
- font: selectedFont,
- face: face,
- key: `face${i}`,
- handleToggleVariant: handleToggleVariant,
- selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null,
- // If the font has no fontFace, we want to check if the font is in the outline
- fontToInstallOutline)
- }))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 16
- }))), selectedFont && (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "flex-end",
- className: "font-library-modal__tabpanel-layout__footer"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: handleInstall,
- isBusy: isInstalling,
- disabled: fontsToInstall.length === 0 || isInstalling,
- __experimentalIsFocusable: true
- }, (0,external_wp_i18n_namespaceObject.__)('Install'))), !selectedFont && (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- justify: "center",
- className: "font-library-modal__tabpanel-layout__footer"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: (0,external_wp_i18n_namespaceObject.__)('First page'),
- size: "compact",
- onClick: () => setPage(1),
- disabled: page === 1,
- __experimentalIsFocusable: true
- }, (0,external_React_.createElement)("span", null, "\xAB")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
- size: "compact",
- onClick: () => setPage(page - 1),
- disabled: page === 1,
- __experimentalIsFocusable: true
- }, (0,external_React_.createElement)("span", null, "\u2039")), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start",
- expanded: false,
- spacing: 2
- }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Total number of pages.
- (0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
- CurrentPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
- value: page,
- options: [...Array(totalPages)].map((e, i) => {
- return {
- label: i + 1,
- value: i + 1
- };
- }),
- onChange: newPage => setPage(parseInt(newPage)),
- size: 'compact',
- __nextHasNoMarginBottom: true
- })
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
- size: "compact",
- onClick: () => setPage(page + 1),
- disabled: page === totalPages,
- __experimentalIsFocusable: true
- }, (0,external_React_.createElement)("span", null, "\u203A")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: (0,external_wp_i18n_namespaceObject.__)('Last page'),
- size: "compact",
- onClick: () => setPage(totalPages),
- disabled: page === totalPages,
- __experimentalIsFocusable: true
- }, (0,external_React_.createElement)("span", null, "\xBB"))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "font-library-modal__tabpanel-layout",
+ children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__loading",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {})
+ }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
+ initialPath: "/",
+ className: "font-library-modal__tabpanel-layout",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
+ path: "/",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 2,
+ size: 13,
+ children: selectedCollection.name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: selectedCollection.description
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, {
+ className: "font-library-modal__search",
+ value: filters.search,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Search'),
+ onChange: debouncedUpdateSearchInput,
+ __nextHasNoMarginBottom: true,
+ hideLabelFromVision: false
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Category'),
+ value: filters.category,
+ onChange: handleCategoryFilter,
+ children: categories && categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", {
+ value: category.slug,
+ children: category.name
+ }, category.slug))
+ })
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), !!selectedCollection?.font_families?.length && !fonts.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "font-library-modal__fonts-grid__main",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ role: "list",
+ className: "font-library-modal__fonts-list",
+ children: items.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ className: "font-library-modal__fonts-list-item",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, {
+ font: font.font_family_settings,
+ navigatorPath: "/fontFamily",
+ onClick: () => {
+ setSelectedFont(font.font_family_settings);
+ }
+ })
+ }, font.font_family_settings.slug))
+ }), ' ']
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
+ path: "/fontFamily",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorToParentButton, {
+ icon: chevron_left,
+ size: "small",
+ onClick: () => {
+ setSelectedFont(null);
+ setNotice(null);
+ },
+ label: (0,external_wp_i18n_namespaceObject.__)('Back')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 2,
+ size: 13,
+ className: "edit-site-global-styles-header",
+ children: selectedFont?.name
+ })]
+ }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 1
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
+ status: notice.type,
+ onRemove: () => setNotice(null),
+ children: notice.message
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 1
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 4
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 8
+ }), getSortedFontFaces(selectedFont).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collection_font_variant, {
+ font: selectedFont,
+ face: face,
+ handleToggleVariant: handleToggleVariant,
+ selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null,
+ // If the font has no fontFace, we want to check if the font is in the outline
+ fontToInstallOutline)
+ }, `face${i}`))]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 16
+ })]
+ })]
+ }), selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ justify: "flex-end",
+ className: "font-library-modal__tabpanel-layout__footer",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: handleInstall,
+ isBusy: isInstalling,
+ disabled: fontsToInstall.length === 0 || isInstalling,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Install')
+ })
+ }), !selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ justify: "center",
+ className: "font-library-modal__tabpanel-layout__footer",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('First page'),
+ size: "compact",
+ onClick: () => setPage(1),
+ disabled: page === 1,
+ __experimentalIsFocusable: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: "\xAB"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
+ size: "compact",
+ onClick: () => setPage(page - 1),
+ disabled: page === 1,
+ __experimentalIsFocusable: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: "\u2039"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ expanded: false,
+ spacing: 2,
+ children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Total number of pages.
+ (0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
+ CurrentPageControl: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
+ value: page,
+ options: [...Array(totalPages)].map((e, i) => {
+ return {
+ label: i + 1,
+ value: i + 1
+ };
+ }),
+ onChange: newPage => setPage(parseInt(newPage)),
+ size: "compact",
+ __nextHasNoMarginBottom: true
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
+ size: "compact",
+ onClick: () => setPage(page + 1),
+ disabled: page === totalPages,
+ __experimentalIsFocusable: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: "\u203A"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Last page'),
+ size: "compact",
+ onClick: () => setPage(totalPages),
+ disabled: page === totalPages,
+ __experimentalIsFocusable: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: "\xBB"
+ })
+ })]
+ })]
+ })]
+ });
}
/* harmony default export */ const font_collection = (FontCollection);
@@ -29968,7 +17369,7 @@ class OS2 extends SimpleTable {
}
}
var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } );
-class lib_font_browser_post extends SimpleTable {
+class post extends SimpleTable {
constructor( dict, dataview ) {
const { p: p } = super( dict, dataview );
this.version = p.legacyFixed;
@@ -30290,7 +17691,7 @@ const macStrings = [
`ccaron`,
`dcroat`,
];
-var post$1 = Object.freeze( { __proto__: null, post: lib_font_browser_post } );
+var post$1 = Object.freeze( { __proto__: null, post: post } );
class BASE extends SimpleTable {
constructor( dict, dataview ) {
const { p: p } = super( dict, dataview );
@@ -32170,7 +19571,7 @@ var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } );
const {
kebabCase: make_families_from_faces_kebabCase
-} = unlock(external_wp_components_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function makeFamiliesFromFaces(fontFaces) {
const fontFamiliesObject = fontFaces.reduce((acc, item) => {
if (!acc[item.fontFamily]) {
@@ -32188,7 +19589,6 @@ function makeFamiliesFromFaces(fontFaces) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js
-
/**
* WordPress dependencies
*/
@@ -32205,9 +19605,7 @@ function makeFamiliesFromFaces(fontFaces) {
-const {
- ProgressBar: upload_fonts_ProgressBar
-} = unlock(external_wp_components_namespaceObject.privateApis);
+
function UploadFonts() {
const {
installFonts,
@@ -32359,40 +19757,49 @@ function UploadFonts() {
}
setIsUploading(false);
};
- return (0,external_React_.createElement)("div", {
- className: "font-library-modal__tabpanel-layout"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropZone, {
- onFilesDrop: handleDropZone
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "font-library-modal__local-fonts"
- }, notice && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: notice.type,
- __unstableHTML: true,
- onRemove: () => setNotice(null)
- }, notice.message, notice.errors && (0,external_React_.createElement)("ul", null, notice.errors.map((error, index) => (0,external_React_.createElement)("li", {
- key: index
- }, error)))), isUploading && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)("div", {
- className: "font-library-modal__upload-area"
- }, (0,external_React_.createElement)(upload_fonts_ProgressBar, null))), !isUploading && (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, {
- accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.${ext}`).join(','),
- multiple: true,
- onChange: onFilesUpload,
- render: ({
- openFileDialog
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "font-library-modal__upload-area",
- onClick: openFileDialog
- }, (0,external_wp_i18n_namespaceObject.__)('Upload font'))
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 2
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- className: "font-library-modal__upload-area__text"
- }, (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.'))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "font-library-modal__tabpanel-layout",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, {
+ onFilesDrop: handleDropZone
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "font-library-modal__local-fonts",
+ children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Notice, {
+ status: notice.type,
+ __unstableHTML: true,
+ onRemove: () => setNotice(null),
+ children: [notice.message, notice.errors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
+ children: notice.errors.map((error, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: error
+ }, index))
+ })]
+ }), isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__upload-area",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {})
+ })
+ }), !isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, {
+ accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.${ext}`).join(','),
+ multiple: true,
+ onChange: onFilesUpload,
+ render: ({
+ openFileDialog
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "font-library-modal__upload-area",
+ onClick: openFileDialog,
+ children: (0,external_wp_i18n_namespaceObject.__)('Upload font')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 2
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ className: "font-library-modal__upload-area__text",
+ children: (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.')
+ })]
+ })]
+ });
}
/* harmony default export */ const upload_fonts = (UploadFonts);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js
-
/**
* WordPress dependencies
*/
@@ -32410,9 +19817,11 @@ function UploadFonts() {
+
+
const {
- Tabs: font_library_modal_Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
+ Tabs
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
const DEFAULT_TAB = {
id: 'installed-fonts',
title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library')
@@ -32430,7 +19839,7 @@ const tabsFromCollections = collections => collections.map(({
}));
function FontLibraryModal({
onRequestClose,
- initialTabId = 'installed-fonts'
+ defaultTabId = 'installed-fonts'
}) {
const {
collections,
@@ -32452,49 +19861,53 @@ function FontLibraryModal({
const onSelect = () => {
setNotice(null);
};
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Fonts'),
onRequestClose: onRequestClose,
isFullScreen: true,
- className: "font-library-modal"
- }, (0,external_React_.createElement)("div", {
- className: "font-library-modal__tabs"
- }, (0,external_React_.createElement)(font_library_modal_Tabs, {
- initialTabId: initialTabId,
- onSelect: onSelect
- }, (0,external_React_.createElement)(font_library_modal_Tabs.TabList, null, tabs.map(({
- id,
- title
- }) => (0,external_React_.createElement)(font_library_modal_Tabs.Tab, {
- key: id,
- tabId: id
- }, title))), tabs.map(({
- id
- }) => {
- let contents;
- switch (id) {
- case 'upload-fonts':
- contents = (0,external_React_.createElement)(upload_fonts, null);
- break;
- case 'installed-fonts':
- contents = (0,external_React_.createElement)(installed_fonts, null);
- break;
- default:
- contents = (0,external_React_.createElement)(font_collection, {
- slug: id
- });
- }
- return (0,external_React_.createElement)(font_library_modal_Tabs.TabPanel, {
- key: id,
- tabId: id,
- focusable: false
- }, contents);
- }))));
+ className: "font-library-modal",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "font-library-modal__tabs",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, {
+ defaultTabId: defaultTabId,
+ onSelect: onSelect,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, {
+ children: tabs.map(({
+ id,
+ title
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, {
+ tabId: id,
+ children: title
+ }, id))
+ }), tabs.map(({
+ id
+ }) => {
+ let contents;
+ switch (id) {
+ case 'upload-fonts':
+ contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts, {});
+ break;
+ case 'installed-fonts':
+ contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts, {});
+ break;
+ default:
+ contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection, {
+ slug: id
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, {
+ tabId: id,
+ focusable: false,
+ children: contents
+ }, id);
+ })]
+ })
+ })
+ });
}
/* harmony default export */ const font_library_modal = (FontLibraryModal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js
-
/**
* WordPress dependencies
*/
@@ -32507,34 +19920,39 @@ function FontLibraryModal({
*/
+
+
function FontFamilyItem({
font
}) {
const {
handleSetLibraryFontSelected,
- toggleModal
+ setModalTabOpen
} = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext);
const variantsCount = font?.fontFace?.length || 1;
const handleClick = () => {
handleSetLibraryFontSelected(font);
- toggleModal('installed-fonts');
+ setModalTabOpen('installed-fonts');
};
const previewStyle = getFamilyPreviewStyle(font);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
- onClick: handleClick
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- style: previewStyle
- }, font.name), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-global-styles-screen-typography__font-variants-count"
- }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */
- (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {
+ onClick: handleClick,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ style: previewStyle,
+ children: font.name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "edit-site-global-styles-screen-typography__font-variants-count",
+ children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of font variants. */
+ (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount)
+ })]
+ })
+ });
}
/* harmony default export */ const font_family_item = (FontFamilyItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js
-
/**
* WordPress dependencies
*/
@@ -32543,6 +19961,7 @@ function FontFamilyItem({
+
/**
* Internal dependencies
*/
@@ -32550,55 +19969,72 @@ function FontFamilyItem({
+
+
+
+
+
+const {
+ useGlobalSetting: font_families_useGlobalSetting
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function FontFamilies() {
const {
modalTabOpen,
- toggleModal,
- themeFonts,
- customFonts
+ setModalTabOpen
} = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext);
+ const [fontFamilies] = font_families_useGlobalSetting('typography.fontFamilies');
+ const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, {
+ source: 'theme'
+ })).sort((a, b) => a.name.localeCompare(b.name)) : [];
+ const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, {
+ source: 'custom'
+ })).sort((a, b) => a.name.localeCompare(b.name)) : [];
const hasFonts = 0 < customFonts.length || 0 < themeFonts.length;
- return (0,external_React_.createElement)(external_React_.Fragment, null, !!modalTabOpen && (0,external_React_.createElement)(font_library_modal, {
- onRequestClose: () => toggleModal(),
- initialTabId: modalTabOpen
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(subtitle, {
- level: 3
- }, (0,external_wp_i18n_namespaceObject.__)('Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-end"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: (0,external_wp_i18n_namespaceObject.__)('Manage fonts')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: () => toggleModal('installed-fonts'),
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Manage fonts'),
- icon: library_settings,
- size: 'small'
- })))), hasFonts ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, customFonts.map(font => (0,external_React_.createElement)(font_family_item, {
- key: font.slug,
- font: font
- })), themeFonts.map(font => (0,external_React_.createElement)(font_family_item, {
- key: font.slug,
- font: font
- }))) : (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('No fonts installed.'), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-global-styles-font-families__add-fonts",
- variant: "secondary",
- onClick: () => toggleModal('upload-fonts')
- }, (0,external_wp_i18n_namespaceObject.__)('Add fonts')))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!!modalTabOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_library_modal, {
+ onRequestClose: () => setModalTabOpen(null),
+ defaultTabId: modalTabOpen
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: (0,external_wp_i18n_namespaceObject.__)('Fonts')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ onClick: () => setModalTabOpen('installed-fonts'),
+ label: (0,external_wp_i18n_namespaceObject.__)('Manage fonts'),
+ icon: library_settings,
+ size: "small"
+ })]
+ }), hasFonts ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ isBordered: true,
+ isSeparated: true,
+ children: [customFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, {
+ font: font
+ }, font.slug)), themeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, {
+ font: font
+ }, font.slug))]
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [(0,external_wp_i18n_namespaceObject.__)('No fonts installed.'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "edit-site-global-styles-font-families__add-fonts",
+ variant: "secondary",
+ onClick: () => setModalTabOpen('upload-fonts'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Add fonts')
+ })]
+ })]
+ })]
+ });
}
/* harmony default export */ const font_families = (({
...props
-}) => (0,external_React_.createElement)(context, null, (0,external_React_.createElement)(FontFamilies, {
- ...props
-})));
+}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, {
+ ...props
+ })
+}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js
-
/**
* WordPress dependencies
*/
@@ -32613,21 +20049,30 @@ function FontFamilies() {
+
+
+
+
function ScreenTypography() {
const fontLibraryEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, []);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Typography'),
- description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.')
- }), (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-screen-typography"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 6
- }, fontLibraryEnabled && (0,external_React_.createElement)(font_families, null), (0,external_React_.createElement)(typogrphy_elements, null))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Typography'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Typography styles and the application of those styles on site elements.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 7,
+ children: [!window.__experimentalDisableFontLibrary && fontLibraryEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Presets')
+ })]
+ })
+ })]
+ });
}
/* harmony default export */ const screen_typography = (ScreenTypography);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js
-
/**
* WordPress dependencies
*/
@@ -32637,12 +20082,13 @@ function ScreenTypography() {
* Internal dependencies
*/
+
const {
useGlobalStyle: typography_panel_useGlobalStyle,
useGlobalSetting: typography_panel_useGlobalSetting,
useSettingsForBlockElement: typography_panel_useSettingsForBlockElement,
TypographyPanel: typography_panel_StylesTypographyPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function TypographyPanel({
element,
headingLevel
@@ -32663,7 +20109,7 @@ function TypographyPanel({
const [rawSettings] = typography_panel_useGlobalSetting('');
const usedElement = element === 'heading' ? headingLevel : element;
const settings = typography_panel_useSettingsForBlockElement(rawSettings, undefined, usedElement);
- return (0,external_React_.createElement)(typography_panel_StylesTypographyPanel, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_panel_StylesTypographyPanel, {
inheritedValue: inheritedStyle,
value: style,
onChange: setStyle,
@@ -32672,7 +20118,6 @@ function TypographyPanel({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js
-
/**
* WordPress dependencies
*/
@@ -32682,14 +20127,16 @@ function TypographyPanel({
* Internal dependencies
*/
+
const {
useGlobalStyle: typography_preview_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function TypographyPreview({
name,
element,
headingLevel
}) {
+ var _ref;
let prefix = '';
if (element === 'heading') {
prefix = `elements.${headingLevel}.`;
@@ -32699,6 +20146,7 @@ function TypographyPreview({
const [fontFamily] = typography_preview_useGlobalStyle(prefix + 'typography.fontFamily', name);
const [gradientValue] = typography_preview_useGlobalStyle(prefix + 'color.gradient', name);
const [backgroundColor] = typography_preview_useGlobalStyle(prefix + 'color.background', name);
+ const [fallbackBackgroundColor] = typography_preview_useGlobalStyle('color.background');
const [color] = typography_preview_useGlobalStyle(prefix + 'color.text', name);
const [fontSize] = typography_preview_useGlobalStyle(prefix + 'typography.fontSize', name);
const [fontStyle] = typography_preview_useGlobalStyle(prefix + 'typography.fontStyle', name);
@@ -32707,23 +20155,23 @@ function TypographyPreview({
const extraStyles = element === 'link' ? {
textDecoration: 'underline'
} : {};
- return (0,external_React_.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "edit-site-typography-preview",
style: {
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
+ background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor,
color,
fontSize,
fontStyle,
fontWeight,
letterSpacing,
...extraStyles
- }
- }, "Aa");
+ },
+ children: "Aa"
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js
-
/**
* WordPress dependencies
*/
@@ -32737,6 +20185,9 @@ function TypographyPreview({
+
+
+
const screen_typography_element_elements = {
text: {
description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'),
@@ -32763,69 +20214,106 @@ function ScreenTypographyElement({
element
}) {
const [headingLevel, setHeadingLevel] = (0,external_wp_element_namespaceObject.useState)('heading');
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: screen_typography_element_elements[element].title,
- description: screen_typography_element_elements[element].description
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- marginX: 4
- }, (0,external_React_.createElement)(TypographyPreview, {
- element: element,
- headingLevel: headingLevel
- })), element === 'heading' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- marginX: 4,
- marginBottom: "1em"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'),
- hideLabelFromVision: true,
- value: headingLevel,
- onChange: setHeadingLevel,
- isBlock: true,
- size: "__unstable-large",
- __nextHasNoMarginBottom: true
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "heading",
- label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h1",
- label: (0,external_wp_i18n_namespaceObject.__)('H1')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h2",
- label: (0,external_wp_i18n_namespaceObject.__)('H2')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h3",
- label: (0,external_wp_i18n_namespaceObject.__)('H3')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h4",
- label: (0,external_wp_i18n_namespaceObject.__)('H4')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h5",
- label: (0,external_wp_i18n_namespaceObject.__)('H5')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "h6",
- label: (0,external_wp_i18n_namespaceObject.__)('H6')
- }))), (0,external_React_.createElement)(TypographyPanel, {
- element: element,
- headingLevel: headingLevel
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: screen_typography_element_elements[element].title,
+ description: screen_typography_element_elements[element].description
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginX: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPreview, {
+ element: element,
+ headingLevel: headingLevel
+ })
+ }), element === 'heading' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginX: 4,
+ marginBottom: "1em",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'),
+ hideLabelFromVision: true,
+ value: headingLevel,
+ onChange: setHeadingLevel,
+ isBlock: true,
+ size: "__unstable-large",
+ __nextHasNoMarginBottom: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "heading",
+ label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h1",
+ label: (0,external_wp_i18n_namespaceObject.__)('H1')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h2",
+ label: (0,external_wp_i18n_namespaceObject.__)('H2')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h3",
+ label: (0,external_wp_i18n_namespaceObject.__)('H3')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h4",
+ label: (0,external_wp_i18n_namespaceObject.__)('H4')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h5",
+ label: (0,external_wp_i18n_namespaceObject.__)('H5')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "h6",
+ label: (0,external_wp_i18n_namespaceObject.__)('H6')
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, {
+ element: element,
+ headingLevel: headingLevel
+ })]
+ });
}
/* harmony default export */ const screen_typography_element = (ScreenTypographyElement);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shuffle.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
/**
+ * Return an SVG icon.
+ *
+ * @param {IconProps} props icon is the SVG component to render
+ * size is a number specifiying the icon size in pixels
+ * Other props will be passed to wrapped SVG component
+ * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
+ *
+ * @return {JSX.Element} Icon component
+ */
+function Icon({
+ icon,
+ size = 24,
+ ...props
+}, ref) {
+ return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
+ width: size,
+ height: size,
+ ...props,
+ ref
+ });
+}
+/* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shuffle.js
+/**
* WordPress dependencies
*/
-const shuffle = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/SVG"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"
-}));
+ xmlns: "http://www.w3.org/2000/SVG",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"
+ })
+});
/* harmony default export */ const library_shuffle = (shuffle);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js
-
/**
* External dependencies
*/
@@ -32835,19 +20323,19 @@ const shuffle = (0,external_React_.createElement)(external_wp_primitives_namespa
* WordPress dependencies
*/
+
function ColorIndicatorWrapper({
className,
...props
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- className: classnames_default()('edit-site-global-styles__color-indicator-wrapper', className),
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ className: dist_clsx('edit-site-global-styles__color-indicator-wrapper', className),
...props
});
}
/* harmony default export */ const color_indicator_wrapper = (ColorIndicatorWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js
-
/**
* WordPress dependencies
*/
@@ -32865,9 +20353,11 @@ function ColorIndicatorWrapper({
+
+
const {
useGlobalSetting: palette_useGlobalSetting
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const EMPTY_COLORS = [];
function Palette({
name
@@ -32879,40 +20369,48 @@ function Palette({
const [randomizeThemeColors] = useColorRandomizer();
const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]);
const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette';
- const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // Translators: %d: Number of palette colors.
- (0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_React_.createElement)(subtitle, {
- level: 3
- }, (0,external_wp_i18n_namespaceObject.__)('Palette')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, (0,external_React_.createElement)(NavigationButtonAsItem, {
- path: screenPath,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Color palettes')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- direction: colors.length === 0 ? 'row-reverse' : 'row'
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
- isLayered: false,
- offset: -8
- }, colors.slice(0, 5).map(({
- color
- }, index) => (0,external_React_.createElement)(color_indicator_wrapper, {
- key: `${color}-${index}`
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
- colorValue: color
- })))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText)))), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- icon: library_shuffle,
- onClick: randomizeThemeColors
- }, (0,external_wp_i18n_namespaceObject.__)('Randomize colors')));
+ const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.__)('Edit palette') : (0,external_wp_i18n_namespaceObject.__)('Add colors');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: (0,external_wp_i18n_namespaceObject.__)('Palette')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ isBordered: true,
+ isSeparated: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: screenPath,
+ "aria-label": paletteButtonText,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ direction: "row",
+ children: [colors.length <= 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Add colors')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, {
+ isLayered: false,
+ offset: -8,
+ children: colors.slice(0, 5).map(({
+ color
+ }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator_wrapper, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, {
+ colorValue: color
+ })
+ }, `${color}-${index}`))
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
+ })]
+ })
+ })
+ }), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "secondary",
+ icon: library_shuffle,
+ onClick: randomizeThemeColors,
+ children: (0,external_wp_i18n_namespaceObject.__)('Randomize colors')
+ })]
+ });
}
/* harmony default export */ const palette = (Palette);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js
-
/**
* WordPress dependencies
*/
@@ -32926,12 +20424,15 @@ function Palette({
+
+
+
const {
useGlobalStyle: screen_colors_useGlobalStyle,
useGlobalSetting: screen_colors_useGlobalSetting,
useSettingsForBlockElement: screen_colors_useSettingsForBlockElement,
ColorPanel: screen_colors_StylesColorPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenColors() {
const [style] = screen_colors_useGlobalStyle('', undefined, 'user', {
shouldDecodeEncode: false
@@ -32941,24 +20442,144 @@ function ScreenColors() {
});
const [rawSettings] = screen_colors_useGlobalSetting('');
const settings = screen_colors_useSettingsForBlockElement(rawSettings);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Colors'),
- description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.')
- }), (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-screen-colors"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 10
- }, (0,external_React_.createElement)(palette, null), (0,external_React_.createElement)(screen_colors_StylesColorPanel, {
- inheritedValue: inheritedStyle,
- value: style,
- onChange: setStyle,
- settings: settings
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Colors'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Palette colors and the application of those colors on site elements.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 7,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_StylesColorPanel, {
+ inheritedValue: inheritedStyle,
+ value: style,
+ onChange: setStyle,
+ settings: settings
+ })]
+ })
+ })]
+ });
}
/* harmony default export */ const screen_colors = (ScreenColors);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js
+/**
+ * Internal dependencies
+ */
+
+
+function PresetColors() {
+ const {
+ paletteColors
+ } = useStylesPreviewColors();
+ return paletteColors.slice(0, 5).map(({
+ slug,
+ color
+ }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ style: {
+ flexGrow: 1,
+ height: '100%',
+ background: color
+ }
+ }, `${slug}-${index}`));
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const preview_colors_firstFrameVariants = {
+ start: {
+ scale: 1,
+ opacity: 1
+ },
+ hover: {
+ scale: 0,
+ opacity: 0
+ }
+};
+const StylesPreviewColors = ({
+ label,
+ isFocused,
+ withHoverView
+}) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewIframe, {
+ label: label,
+ isFocused: isFocused,
+ withHoverView: withHoverView,
+ children: ({
+ key
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ variants: preview_colors_firstFrameVariants,
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 0,
+ justify: "center",
+ style: {
+ height: '100%',
+ overflow: 'hidden'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {})
+ })
+ }, key)
+ });
+};
+/* harmony default export */ const preview_colors = (StylesPreviewColors);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+function ColorVariations({
+ title,
+ gap = 2
+}) {
+ const colorVariations = useColorVariations();
+
+ // Return null if there is only one variation (the default).
+ if (colorVariations?.length <= 1) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, {
+ spacing: gap,
+ children: colorVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, {
+ variation: variation,
+ isPill: true,
+ property: "color",
+ children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors, {})
+ }, index))
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js
/**
* WordPress dependencies
*/
@@ -32971,9 +20592,12 @@ function ScreenColors() {
* Internal dependencies
*/
+
+
+
const {
useGlobalSetting: color_palette_panel_useGlobalSetting
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const mobilePopoverProps = {
placement: 'bottom-start',
offset: 8
@@ -32989,38 +20613,39 @@ function ColorPalettePanel({
const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting('color.defaultPalette', name);
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
const popoverProps = isMobileViewport ? mobilePopoverProps : undefined;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "edit-site-global-styles-color-palette-panel",
- spacing: 10
- }, !!themeColors && !!themeColors.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: themeColors !== baseThemeColors,
- canOnlyChangeValues: true,
- colors: themeColors,
- onChange: setThemeColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'),
- paletteLabelHeadingLevel: 3,
- popoverProps: popoverProps
- }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: defaultColors !== baseDefaultColors,
- canOnlyChangeValues: true,
- colors: defaultColors,
- onChange: setDefaultColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'),
- paletteLabelHeadingLevel: 3,
- popoverProps: popoverProps
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- colors: customColors,
- onChange: setCustomColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
- paletteLabelHeadingLevel: 3,
- emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'),
- slugPrefix: "custom-",
- popoverProps: popoverProps
- }));
+ spacing: 8,
+ children: [!!themeColors && !!themeColors.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ canReset: themeColors !== baseThemeColors,
+ canOnlyChangeValues: true,
+ colors: themeColors,
+ onChange: setThemeColors,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'),
+ paletteLabelHeadingLevel: 3,
+ popoverProps: popoverProps
+ }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ canReset: defaultColors !== baseDefaultColors,
+ canOnlyChangeValues: true,
+ colors: defaultColors,
+ onChange: setDefaultColors,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'),
+ paletteLabelHeadingLevel: 3,
+ popoverProps: popoverProps
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ colors: customColors,
+ onChange: setCustomColors,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
+ paletteLabelHeadingLevel: 3,
+ slugPrefix: "custom-",
+ popoverProps: popoverProps
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Palettes')
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js
-
/**
* WordPress dependencies
*/
@@ -33034,14 +20659,16 @@ function ColorPalettePanel({
*/
+
+
const {
useGlobalSetting: gradients_palette_panel_useGlobalSetting
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const gradients_palette_panel_mobilePopoverProps = {
placement: 'bottom-start',
offset: 8
};
-const gradients_palette_panel_noop = () => {};
+const noop = () => {};
function GradientPalettePanel({
name
}) {
@@ -33058,48 +20685,50 @@ function GradientPalettePanel({
const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])];
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : undefined;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "edit-site-global-styles-gradient-palette-panel",
- spacing: 10
- }, !!themeGradients && !!themeGradients.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: themeGradients !== baseThemeGradients,
- canOnlyChangeValues: true,
- gradients: themeGradients,
- onChange: setThemeGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'),
- paletteLabelHeadingLevel: 3,
- popoverProps: popoverProps
- }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: defaultGradients !== baseDefaultGradients,
- canOnlyChangeValues: true,
- gradients: defaultGradients,
- onChange: setDefaultGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'),
- paletteLabelLevel: 3,
- popoverProps: popoverProps
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- gradients: customGradients,
- onChange: setCustomGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
- paletteLabelLevel: 3,
- emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'),
- slugPrefix: "custom-",
- popoverProps: popoverProps
- }), !!duotonePalette && !!duotonePalette.length && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(subtitle, {
- level: 3
- }, (0,external_wp_i18n_namespaceObject.__)('Duotone')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 3
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
- duotonePalette: duotonePalette,
- disableCustomDuotone: true,
- disableCustomColors: true,
- clearable: false,
- onChange: gradients_palette_panel_noop
- })));
+ spacing: 8,
+ children: [!!themeGradients && !!themeGradients.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ canReset: themeGradients !== baseThemeGradients,
+ canOnlyChangeValues: true,
+ gradients: themeGradients,
+ onChange: setThemeGradients,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'),
+ paletteLabelHeadingLevel: 3,
+ popoverProps: popoverProps
+ }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ canReset: defaultGradients !== baseDefaultGradients,
+ canOnlyChangeValues: true,
+ gradients: defaultGradients,
+ onChange: setDefaultGradients,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'),
+ paletteLabelLevel: 3,
+ popoverProps: popoverProps
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
+ gradients: customGradients,
+ onChange: setCustomGradients,
+ paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
+ paletteLabelLevel: 3,
+ slugPrefix: "custom-",
+ popoverProps: popoverProps
+ }), !!duotonePalette && !!duotonePalette.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: (0,external_wp_i18n_namespaceObject.__)('Duotone')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ margin: 3
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, {
+ duotonePalette: duotonePalette,
+ disableCustomDuotone: true,
+ disableCustomColors: true,
+ clearable: false,
+ onChange: noop
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js
-
/**
* WordPress dependencies
*/
@@ -33113,51 +20742,905 @@ function GradientPalettePanel({
+
+
+
const {
Tabs: screen_color_palette_Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ScreenColorPalette({
name
}) {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Palette'),
- 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.')
- }), (0,external_React_.createElement)(screen_color_palette_Tabs, null, (0,external_React_.createElement)(screen_color_palette_Tabs.TabList, null, (0,external_React_.createElement)(screen_color_palette_Tabs.Tab, {
- tabId: "solid"
- }, "Solid"), (0,external_React_.createElement)(screen_color_palette_Tabs.Tab, {
- tabId: "gradient"
- }, "Gradient")), (0,external_React_.createElement)(screen_color_palette_Tabs.TabPanel, {
- tabId: "solid",
- focusable: false
- }, (0,external_React_.createElement)(ColorPalettePanel, {
- name: name
- })), (0,external_React_.createElement)(screen_color_palette_Tabs.TabPanel, {
- tabId: "gradient",
- focusable: false
- }, (0,external_React_.createElement)(GradientPalettePanel, {
- name: name
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Edit palette'),
+ description: (0,external_wp_i18n_namespaceObject.__)('The combination of colors used across the site and in color pickers.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, {
+ tabId: "color",
+ children: (0,external_wp_i18n_namespaceObject.__)('Color')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, {
+ tabId: "gradient",
+ children: (0,external_wp_i18n_namespaceObject.__)('Gradient')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, {
+ tabId: "color",
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, {
+ name: name
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, {
+ tabId: "gradient",
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, {
+ name: name
+ })
+ })]
+ })]
+ });
}
/* harmony default export */ const screen_color_palette = (ScreenColorPalette);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
+/**
+ * WordPress dependencies
+ */
+
+const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
+ })
+});
+/* harmony default export */ const library_plus = (plus);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js
/**
* WordPress dependencies
*/
+
+
/**
* Internal dependencies
*/
+
+
+
+
+
+
+
+const {
+ useGlobalSetting: shadows_panel_useGlobalSetting
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)';
+function ShadowsPanel() {
+ const [defaultShadows] = shadows_panel_useGlobalSetting('shadow.presets.default');
+ const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting('shadow.defaultPresets');
+ const [themeShadows] = shadows_panel_useGlobalSetting('shadow.presets.theme');
+ const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting('shadow.presets.custom');
+ const onCreateShadow = shadow => {
+ setCustomShadows([...(customShadows || []), shadow]);
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Shadows'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Manage and create shadow styles for use across the site.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "edit-site-global-styles__shadows-panel",
+ spacing: 7,
+ children: [defaultShadowsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Default'),
+ shadows: defaultShadows || [],
+ category: "default"
+ }), themeShadows && themeShadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Theme'),
+ shadows: themeShadows || [],
+ category: "theme"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Custom'),
+ shadows: customShadows || [],
+ category: "custom",
+ canCreate: true,
+ onCreate: onCreateShadow
+ })]
+ })
+ })]
+ });
+}
+function ShadowList({
+ label,
+ shadows,
+ category,
+ canCreate,
+ onCreate
+}) {
+ const handleAddShadow = () => {
+ const newIndex = getNewIndexFromPresets(shadows, 'shadow-');
+ onCreate({
+ name: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is an index for a preset */
+ (0,external_wp_i18n_namespaceObject.__)('Shadow %s'), newIndex),
+ shadow: defaultShadow,
+ slug: `shadow-${newIndex}`
+ });
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ align: "center",
+ className: "edit-site-global-styles__shadows-panel__title",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: label
+ })
+ }), canCreate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "edit-site-global-styles__shadows-panel__options-container",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "small",
+ icon: library_plus,
+ label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'),
+ onClick: () => {
+ handleAddShadow();
+ }
+ })
+ })]
+ }), shadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ isBordered: true,
+ isSeparated: true,
+ children: shadows.map(shadow => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowItem, {
+ shadow: shadow,
+ category: category
+ }, shadow.slug))
+ })]
+ });
+}
+function ShadowItem({
+ shadow,
+ category
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, {
+ path: `/shadows/edit/${category}/${shadow.slug}`,
+ "aria-label":
+ // translators: %s: name of the shadow
+ (0,external_wp_i18n_namespaceObject.sprintf)('Edit shadow %s', shadow.name),
+ icon: library_shadow,
+ children: shadow.name
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js
+/**
+ * WordPress dependencies
+ */
+
+
+const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M7 11.5h10V13H7z"
+ })
+});
+/* harmony default export */ const library_reset = (reset_reset);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js
+const CUSTOM_VALUE_SETTINGS = {
+ px: {
+ max: 20,
+ step: 1
+ },
+ '%': {
+ max: 100,
+ step: 1
+ },
+ vw: {
+ max: 100,
+ step: 1
+ },
+ vh: {
+ max: 100,
+ step: 1
+ },
+ em: {
+ max: 10,
+ step: 0.1
+ },
+ rm: {
+ max: 10,
+ step: 0.1
+ },
+ svw: {
+ max: 100,
+ step: 1
+ },
+ lvw: {
+ max: 100,
+ step: 1
+ },
+ dvw: {
+ max: 100,
+ step: 1
+ },
+ svh: {
+ max: 100,
+ step: 1
+ },
+ lvh: {
+ max: 100,
+ step: 1
+ },
+ dvh: {
+ max: 100,
+ step: 1
+ },
+ vi: {
+ max: 100,
+ step: 1
+ },
+ svi: {
+ max: 100,
+ step: 1
+ },
+ lvi: {
+ max: 100,
+ step: 1
+ },
+ dvi: {
+ max: 100,
+ step: 1
+ },
+ vb: {
+ max: 100,
+ step: 1
+ },
+ svb: {
+ max: 100,
+ step: 1
+ },
+ lvb: {
+ max: 100,
+ step: 1
+ },
+ dvb: {
+ max: 100,
+ step: 1
+ },
+ vmin: {
+ max: 100,
+ step: 1
+ },
+ svmin: {
+ max: 100,
+ step: 1
+ },
+ lvmin: {
+ max: 100,
+ step: 1
+ },
+ dvmin: {
+ max: 100,
+ step: 1
+ },
+ vmax: {
+ max: 100,
+ step: 1
+ },
+ svmax: {
+ max: 100,
+ step: 1
+ },
+ lvmax: {
+ max: 100,
+ step: 1
+ },
+ dvmax: {
+ max: 100,
+ step: 1
+ }
+};
+function getShadowParts(shadow) {
+ const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || [];
+ return shadowValues.map(value => value.trim());
+}
+function shadowStringToObject(shadowValue) {
+ /*
+ * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
+ * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset]
+ *
+ * A shadow to be valid it must satisfy the following.
+ *
+ * 1. Should not contain "none" keyword.
+ * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values.
+ * 3. Should not contain more than one set of x, y, blur, spread values.
+ * 4. Should contain at least x and y values. Others are optional.
+ * 5. Should not contain more than one "inset" (case insensitive) keyword.
+ * 6. Should not contain more than one color value.
+ */
+
+ const defaultShadow = {
+ x: '0',
+ y: '0',
+ blur: '0',
+ spread: '0',
+ color: '#000',
+ inset: false
+ };
+ if (!shadowValue) {
+ return defaultShadow;
+ }
+
+ // Rule 1: Should not contain "none" keyword.
+ // if the shadow has "none" keyword, it is not a valid shadow string
+ if (shadowValue.includes('none')) {
+ return defaultShadow;
+ }
+
+ // Rule 2: Values x, y, blur, spread should be in the order.
+ // Color and inset can be anywhere in the string except in between x, y, blur, spread values.
+ // Extract length values (x, y, blur, spread) from shadow string
+ // Regex match groups of 1 to 4 length values.
+ const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g;
+ const matches = shadowValue.match(lengthsRegex) || [];
+
+ // Rule 3: Should not contain more than one set of x, y, blur, spread values.
+ // if the string doesn't contain exactly 1 set of x, y, blur, spread values,
+ // it is not a valid shadow string
+ if (matches.length !== 1) {
+ return defaultShadow;
+ }
+
+ // Extract length values (x, y, blur, spread) from shadow string
+ const lengths = matches[0].split(' ').map(value => value.trim()).filter(value => value);
+
+ // Rule 4: Should contain at least x and y values. Others are optional.
+ if (lengths.length < 2) {
+ return defaultShadow;
+ }
+
+ // Rule 5: Should not contain more than one "inset" (case insensitive) keyword.
+ // check if the shadow string contains "inset" keyword
+ const insets = shadowValue.match(/inset/gi) || [];
+ if (insets.length > 1) {
+ return defaultShadow;
+ }
+
+ // Strip lengths and inset from shadow string, leaving just color.
+ const hasInset = insets.length === 1;
+ let colorString = shadowValue.replace(lengthsRegex, '').trim();
+ if (hasInset) {
+ colorString = colorString.replace('inset', '').replace('INSET', '').trim();
+ }
+
+ // Rule 6: Should not contain more than one color value.
+ // validate color string with regular expression
+ // check if color has matching hex, rgb or hsl values
+ const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi;
+ let colorMatches = (colorString.match(colorRegex) || []).map(value => value?.trim()).filter(value => value);
+
+ // If color string has more than one color values, it is not a valid
+ if (colorMatches.length > 1) {
+ return defaultShadow;
+ } else if (colorMatches.length === 0) {
+ // check if color string has multiple named color values separated by space
+ colorMatches = colorString.trim().split(' ').filter(value => value);
+ // If color string has more than one color values, it is not a valid
+ if (colorMatches.length > 1) {
+ return defaultShadow;
+ }
+ }
+
+ // Return parsed shadow object.
+ const [x, y, blur, spread] = lengths;
+ return {
+ x,
+ y,
+ blur: blur || defaultShadow.blur,
+ spread: spread || defaultShadow.spread,
+ inset: hasInset,
+ color: colorString || defaultShadow.color
+ };
+}
+function shadowObjectToString(shadowObj) {
+ const shadowString = `${shadowObj.x || '0px'} ${shadowObj.y || '0px'} ${shadowObj.blur || '0px'} ${shadowObj.spread || '0px'}`;
+ return `${shadowObj.inset ? 'inset' : ''} ${shadowString} ${shadowObj.color || ''}`.trim();
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+const {
+ useGlobalSetting: shadows_edit_panel_useGlobalSetting
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ DropdownMenuV2: DropdownMenu,
+ DropdownMenuItemV2: DropdownMenuItem,
+ DropdownMenuItemLabelV2: DropdownMenuItemLabel
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+const customShadowMenuItems = [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Rename'),
+ action: 'rename'
+}, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
+ action: 'delete'
+}];
+const presetShadowMenuItems = [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Reset'),
+ action: 'reset'
+}];
+function ShadowsEditPanel() {
+ const {
+ params: {
+ category,
+ slug
+ },
+ goTo
+ } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
+ const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.${category}`);
+ const [baseShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.${category}`, undefined, 'base');
+ const [selectedShadow, setSelectedShadow] = (0,external_wp_element_namespaceObject.useState)(() => (shadows || []).find(shadow => shadow.slug === slug));
+ const baseSelectedShadow = (0,external_wp_element_namespaceObject.useMemo)(() => (baseShadows || []).find(b => b.slug === slug), [baseShadows, slug]);
+ const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [shadowName, setShadowName] = (0,external_wp_element_namespaceObject.useState)(selectedShadow.name);
+ const onShadowChange = shadow => {
+ setSelectedShadow({
+ ...selectedShadow,
+ shadow
+ });
+ const updatedShadows = shadows.map(s => s.slug === slug ? {
+ ...selectedShadow,
+ shadow
+ } : s);
+ setShadows(updatedShadows);
+ };
+ const onMenuClick = action => {
+ if (action === 'reset') {
+ const updatedShadows = shadows.map(s => s.slug === slug ? baseSelectedShadow : s);
+ setSelectedShadow(baseSelectedShadow);
+ setShadows(updatedShadows);
+ } else if (action === 'delete') {
+ setIsConfirmDialogVisible(true);
+ } else if (action === 'rename') {
+ setIsRenameModalVisible(true);
+ }
+ };
+ const handleShadowDelete = () => {
+ const updatedShadows = shadows.filter(s => s.slug !== slug);
+ setShadows(updatedShadows);
+ goTo(`/shadows`);
+ };
+ const handleShadowRename = newName => {
+ if (!newName) {
+ return;
+ }
+ const updatedShadows = shadows.map(s => s.slug === slug ? {
+ ...selectedShadow,
+ name: newName
+ } : s);
+ setSelectedShadow({
+ ...selectedShadow,
+ name: newName
+ });
+ setShadows(updatedShadows);
+ };
+ return !selectedShadow ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: ""
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: selectedShadow.name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginTop: 2,
+ marginBottom: 0,
+ paddingX: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "small",
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Menu')
+ }),
+ children: (category === 'custom' ? customShadowMenuItems : presetShadowMenuItems).map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItem, {
+ onClick: () => onMenuClick(item.action),
+ disabled: item.action === 'reset' && selectedShadow.shadow === baseSelectedShadow.shadow,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemLabel, {
+ children: item.label
+ })
+ }, item.action))
+ })
+ })
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-global-styles-screen",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, {
+ shadow: selectedShadow.shadow
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowEditor, {
+ shadow: selectedShadow.shadow,
+ onChange: onShadowChange
+ })]
+ }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: true,
+ onConfirm: () => {
+ handleShadowDelete();
+ setIsConfirmDialogVisible(false);
+ },
+ onCancel: () => {
+ setIsConfirmDialogVisible(false);
+ },
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: name of the shadow
+ 'Are you sure you want to delete "%s"?', selectedShadow.name)
+ }), isRenameModalVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
+ onRequestClose: () => setIsRenameModalVisible(false),
+ size: "small",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", {
+ onSubmit: event => {
+ event.preventDefault();
+ handleShadowRename(shadowName);
+ setIsRenameModalVisible(false);
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, {
+ autoComplete: "off",
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Shadow name'),
+ value: shadowName,
+ onChange: value => setShadowName(value)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginBottom: 6
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ className: "block-editor-shadow-edit-modal__actions",
+ justify: "flex-end",
+ expanded: false,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: () => setIsRenameModalVisible(false),
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ children: (0,external_wp_i18n_namespaceObject.__)('Save')
+ })
+ })]
+ })]
+ })
+ })]
+ });
+}
+function ShadowsPreview({
+ shadow
+}) {
+ const shadowStyle = {
+ boxShadow: shadow
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {
+ marginBottom: 4,
+ marginTop: -2,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ align: "center",
+ justify: "center",
+ className: "edit-site-global-styles__shadow-preview-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles__shadow-preview-block",
+ style: shadowStyle
+ })
+ })
+ });
+}
+function ShadowEditor({
+ shadow,
+ onChange
+}) {
+ const shadowParts = (0,external_wp_element_namespaceObject.useMemo)(() => getShadowParts(shadow), [shadow]);
+ const onChangeShadowPart = (index, part) => {
+ shadowParts[index] = part;
+ onChange(shadowParts.join(', '));
+ };
+ const onAddShadowPart = () => {
+ shadowParts.push(defaultShadow);
+ onChange(shadowParts.join(', '));
+ };
+ const onRemoveShadowPart = index => {
+ shadowParts.splice(index, 1);
+ onChange(shadowParts.join(', '));
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 2,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ align: "center",
+ className: "edit-site-global-styles__shadows-panel__title",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ level: 3,
+ children: (0,external_wp_i18n_namespaceObject.__)('Shadows')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "edit-site-global-styles__shadows-panel__options-container",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "small",
+ icon: library_plus,
+ label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'),
+ onClick: () => {
+ onAddShadowPart();
+ }
+ })
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ isBordered: true,
+ isSeparated: true,
+ children: shadowParts.map((part, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_ShadowItem, {
+ shadow: part,
+ onChange: value => onChangeShadowPart(index, value),
+ canRemove: shadowParts.length > 1,
+ onRemove: () => onRemoveShadowPart(index)
+ }, index))
+ })]
+ });
+}
+function shadows_edit_panel_ShadowItem({
+ shadow,
+ onChange,
+ canRemove,
+ onRemove
+}) {
+ const popoverProps = {
+ placement: 'left-start',
+ offset: 36,
+ shift: true
+ };
+ const shadowObj = (0,external_wp_element_namespaceObject.useMemo)(() => shadowStringToObject(shadow), [shadow]);
+ const onShadowChange = newShadow => {
+ onChange(shadowObjectToString(newShadow));
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
+ popoverProps: popoverProps,
+ className: "edit-site-global-styles__shadow-editor__dropdown",
+ renderToggle: ({
+ onToggle,
+ isOpen
+ }) => {
+ const toggleProps = {
+ onClick: onToggle,
+ className: dist_clsx('edit-site-global-styles__shadow-editor__dropdown-toggle', {
+ 'is-open': isOpen
+ }),
+ 'aria-expanded': isOpen
+ };
+ const removeButtonProps = {
+ onClick: onRemove,
+ className: dist_clsx('edit-site-global-styles__shadow-editor__remove-button', {
+ 'is-open': isOpen
+ }),
+ label: (0,external_wp_i18n_namespaceObject.__)('Remove shadow')
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ align: "center",
+ justify: "flex-start",
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ style: {
+ flexGrow: 1
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ icon: library_shadow,
+ ...toggleProps,
+ children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)('Inner shadow') : (0,external_wp_i18n_namespaceObject.__)('Drop shadow')
+ })
+ }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ icon: library_reset,
+ ...removeButtonProps
+ })
+ })]
+ });
+ },
+ renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
+ paddingSize: "none",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles__shadow-editor__dropdown-content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, {
+ shadowObj: shadowObj,
+ onChange: onShadowChange
+ })
+ })
+ })
+ });
+}
+function ShadowPopover({
+ shadowObj,
+ onChange
+}) {
+ const __experimentalIsRenderedInSidebar = true;
+ const enableAlpha = true;
+ const onShadowChange = (key, value) => {
+ const newShadow = {
+ ...shadowObj,
+ [key]: value
+ };
+ onChange(newShadow);
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles__shadow-editor-panel",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 5,
+ children: (0,external_wp_i18n_namespaceObject.__)('Shadow')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles__shadow-editor-color-palette",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, {
+ clearable: false,
+ enableAlpha: enableAlpha,
+ __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
+ value: shadowObj.color,
+ onChange: value => onShadowChange('color', value)
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
+ value: shadowObj.inset ? 'inset' : 'outset',
+ isBlock: true,
+ onChange: value => onShadowChange('inset', value === 'inset'),
+ hideLabelFromVision: true,
+ __next40pxDefaultSize: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "outset",
+ label: (0,external_wp_i18n_namespaceObject.__)('Outset')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
+ value: "inset",
+ label: (0,external_wp_i18n_namespaceObject.__)('Inset')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, {
+ columns: 2,
+ gap: 4,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('X Position'),
+ value: shadowObj.x,
+ hasNegativeRange: true,
+ onChange: value => onShadowChange('x', value)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Y Position'),
+ value: shadowObj.y,
+ hasNegativeRange: true,
+ onChange: value => onShadowChange('y', value)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Blur'),
+ value: shadowObj.blur,
+ onChange: value => onShadowChange('blur', value)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Spread'),
+ value: shadowObj.spread,
+ hasNegativeRange: true,
+ onChange: value => onShadowChange('spread', value)
+ })]
+ })]
+ })
+ });
+}
+function ShadowInputControl({
+ label,
+ value,
+ onChange,
+ hasNegativeRange
+}) {
+ var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2, _CUSTOM_VALUE_SETTING3;
+ const [isCustomInput, setIsCustomInput] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
+ const sliderOnChange = next => {
+ onChange(next !== undefined ? [next, parsedUnit || 'px'].join('') : '0px');
+ };
+ const onValueChange = next => {
+ const isNumeric = next !== undefined && !isNaN(parseFloat(next));
+ const nextValue = isNumeric ? next : '0px';
+ onChange(nextValue);
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, {
+ children: label
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Use custom size'),
+ icon: library_settings,
+ onClick: () => {
+ setIsCustomInput(!isCustomInput);
+ },
+ isPressed: isCustomInput,
+ size: "small"
+ })]
+ }), isCustomInput ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, {
+ label: label,
+ hideLabelFromVision: true,
+ __next40pxDefaultSize: true,
+ value: value,
+ onChange: onValueChange
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
+ value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
+ onChange: sliderOnChange,
+ withInputField: false,
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ min: hasNegativeRange ? -((_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10) : 0,
+ max: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 10,
+ step: (_CUSTOM_VALUE_SETTING3 = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING3 !== void 0 ? _CUSTOM_VALUE_SETTING3 : 0.1
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js
+/**
+ * Internal dependencies
+ */
+
+
+
+function ScreenShadows() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {});
+}
+function ScreenShadowsEdit() {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {});
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
const {
useGlobalStyle: dimensions_panel_useGlobalStyle,
useGlobalSetting: dimensions_panel_useGlobalSetting,
useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement,
DimensionsPanel: dimensions_panel_StylesDimensionsPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const DEFAULT_CONTROLS = {
contentSize: true,
wideSize: true,
@@ -33211,7 +21694,7 @@ function DimensionsPanel() {
setSettings(updatedSettings);
}
};
- return (0,external_React_.createElement)(dimensions_panel_StylesDimensionsPanel, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_panel_StylesDimensionsPanel, {
inheritedValue: inheritedStyleWithLayout,
value: styleWithLayout,
onChange: onChange,
@@ -33221,8 +21704,64 @@ function DimensionsPanel() {
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+// Initial control values where no block style is set.
+
+const BACKGROUND_DEFAULT_VALUES = {
+ backgroundSize: 'auto'
+};
+const {
+ useGlobalStyle: background_panel_useGlobalStyle,
+ useGlobalSetting: background_panel_useGlobalSetting,
+ useGlobalStyleLinks,
+ BackgroundPanel: StylesBackgroundPanel
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
+/**
+ * Checks if there is a current value in the background image block support
+ * attributes.
+ *
+ * @param {Object} style Style attribute.
+ * @return {boolean} Whether the block has a background image value set.
+ */
+function hasBackgroundImageValue(style) {
+ return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === 'string';
+}
+function BackgroundPanel() {
+ const [style] = background_panel_useGlobalStyle('', undefined, 'user', {
+ shouldDecodeEncode: false
+ });
+ const [inheritedStyle, setStyle] = background_panel_useGlobalStyle('', undefined, 'all', {
+ shouldDecodeEncode: false
+ });
+ const _links = useGlobalStyleLinks();
+ const [settings] = background_panel_useGlobalSetting('');
+ const defaultControls = {
+ backgroundImage: true,
+ backgroundSize: hasBackgroundImageValue(style) || hasBackgroundImageValue(inheritedStyle)
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBackgroundPanel, {
+ inheritedValue: inheritedStyle,
+ value: style,
+ onChange: setStyle,
+ settings: settings,
+ defaultValues: BACKGROUND_DEFAULT_VALUES,
+ defaultControls: defaultControls,
+ themeFileURIs: _links?.['wp:theme-file']
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js
/**
* WordPress dependencies
*/
@@ -33235,23 +21774,187 @@ function DimensionsPanel() {
+
+
+
+
const {
+ useHasBackgroundPanel,
useHasDimensionsPanel: screen_layout_useHasDimensionsPanel,
useGlobalSetting: screen_layout_useGlobalSetting,
useSettingsForBlockElement: screen_layout_useSettingsForBlockElement
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenLayout() {
const [rawSettings] = screen_layout_useGlobalSetting('');
const settings = screen_layout_useSettingsForBlockElement(rawSettings);
const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Layout')
- }), hasDimensionsPanel && (0,external_React_.createElement)(DimensionsPanel, null));
+ const hasBackgroundPanel = useHasBackgroundPanel(settings);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Layout')
+ }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {}), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})]
+ });
}
/* harmony default export */ const screen_layout = (ScreenLayout);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ GlobalStylesContext: style_variations_container_GlobalStylesContext
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function StyleVariationsContainer({
+ gap = 2
+}) {
+ const {
+ user
+ } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext);
+ const [currentUserStyles, setCurrentUserStyles] = (0,external_wp_element_namespaceObject.useState)(user);
+ const userStyles = currentUserStyles?.styles;
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ setCurrentUserStyles(user);
+ }, [user]);
+ const variations = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations();
+ }, []);
+
+ // Filter out variations that are of single property type, i.e. color or typography variations.
+ const multiplePropertyVariations = variations?.filter(variation => {
+ return !isVariationWithSingleProperty(variation, 'color') && !isVariationWithSingleProperty(variation, 'typography');
+ });
+ const themeVariations = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const withEmptyVariation = [{
+ title: (0,external_wp_i18n_namespaceObject.__)('Default'),
+ settings: {},
+ styles: {}
+ }, ...(multiplePropertyVariations !== null && multiplePropertyVariations !== void 0 ? multiplePropertyVariations : [])];
+ return [...withEmptyVariation.map(variation => {
+ var _variation$settings;
+ const blockStyles = {
+ ...variation?.styles?.blocks
+ } || {};
+
+ // We need to copy any user custom CSS to the variation to prevent it being lost
+ // when switching variations.
+ if (userStyles?.blocks) {
+ Object.keys(userStyles.blocks).forEach(blockName => {
+ // First get any block specific custom CSS from the current user styles and merge with any custom CSS for
+ // that block in the variation.
+ if (userStyles.blocks[blockName].css) {
+ const variationBlockStyles = blockStyles[blockName] || {};
+ const customCSS = {
+ css: `${blockStyles[blockName]?.css || ''} ${userStyles.blocks[blockName].css.trim() || ''}`
+ };
+ blockStyles[blockName] = {
+ ...variationBlockStyles,
+ ...customCSS
+ };
+ }
+ });
+ }
+ // Now merge any global custom CSS from current user styles with global custom CSS in the variation.
+ const css = userStyles?.css || variation.styles?.css ? {
+ css: `${variation.styles?.css || ''} ${userStyles?.css || ''}`
+ } : {};
+ const blocks = Object.keys(blockStyles).length > 0 ? {
+ blocks: blockStyles
+ } : {};
+ const styles = {
+ ...variation.styles,
+ ...css,
+ ...blocks
+ };
+ return {
+ ...variation,
+ settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
+ styles
+ };
+ })];
+ }, [multiplePropertyVariations, userStyles?.blocks, userStyles?.css]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, {
+ columns: 2,
+ className: "edit-site-global-styles-style-variations-container",
+ gap: gap,
+ children: themeVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, {
+ variation: variation,
+ children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {
+ label: variation?.title,
+ withHoverView: true,
+ isFocused: isFocused,
+ variation: variation
+ })
+ }, index))
+ });
+}
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function ScreenStyleVariations() {
+ // Move to zoom out mode when this component is mounted
+ // and back to the previous mode when unmounted.
+ (0,external_wp_blockEditor_namespaceObject.useZoomOut)();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, {
+ size: "small",
+ isBorderless: true,
+ className: "edit-site-global-styles-screen-style-variations",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, {})
+ })
+ })]
+ });
+}
+/* harmony default export */ const screen_style_variations = (ScreenStyleVariations);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
+/**
+ * WordPress dependencies
+ */
+
+
+const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const close_small = (closeSmall);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js
/**
* WordPress dependencies
*/
@@ -33261,60 +21964,512 @@ function ScreenLayout() {
+
+
+
+
/**
* Internal dependencies
*/
-function ScreenStyleVariations() {
+
+
+const {
+ EditorContentSlotFill,
+ ResizableEditor
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+
+/**
+ * Returns a translated string for the title of the editor canvas container.
+ *
+ * @param {string} view Editor canvas container view.
+ *
+ * @return {string} Translated string corresponding to value of view. Default is ''.
+ */
+function getEditorCanvasContainerTitle(view) {
+ switch (view) {
+ case 'style-book':
+ return (0,external_wp_i18n_namespaceObject.__)('Style Book');
+ case 'global-styles-revisions':
+ case 'global-styles-revisions:style-book':
+ return (0,external_wp_i18n_namespaceObject.__)('Style Revisions');
+ default:
+ return '';
+ }
+}
+function EditorCanvasContainer({
+ children,
+ closeButtonLabel,
+ onClose,
+ enableResizing = false
+}) {
const {
- mode
+ editorCanvasContainerView,
+ showListViewByDefault
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const _editorCanvasContainerView = lock_unlock_unlock(select(store)).getEditorCanvasContainerView();
+ const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault');
return {
- mode: select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode()
+ editorCanvasContainerView: _editorCanvasContainerView,
+ showListViewByDefault: _showListViewByDefault
};
}, []);
- const shouldRevertInitialMode = (0,external_wp_element_namespaceObject.useRef)(null);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // ignore changes to zoom-out mode as we explictily change to it on mount.
- if (mode !== 'zoom-out') {
- shouldRevertInitialMode.current = false;
+ const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ setEditorCanvasContainerView
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+ const {
+ setIsListViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
+ const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
+ const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
+ function onCloseContainer() {
+ setIsListViewOpened(showListViewByDefault);
+ setEditorCanvasContainerView(undefined);
+ setIsClosed(true);
+ if (typeof onClose === 'function') {
+ onClose();
}
- }, [mode]);
-
- // Intentionality left without any dependency.
- // This effect should only run the first time the component is rendered.
- // The effect opens the zoom-out view if it is not open before when applying a style variation.
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (mode !== 'zoom-out') {
- __unstableSetEditorMode('zoom-out');
- shouldRevertInitialMode.current = true;
- return () => {
- // if there were not mode changes revert to the initial mode when unmounting.
- if (shouldRevertInitialMode.current) {
- __unstableSetEditorMode(mode);
- }
- };
+ }
+ function closeOnEscape(event) {
+ if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
+ event.preventDefault();
+ onCloseContainer();
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
+ }
+ const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, {
+ ref: sectionFocusReturnRef
+ }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, {
+ ref: sectionFocusReturnRef
+ });
+ if (isClosed) {
+ return null;
+ }
+ const title = getEditorCanvasContainerTitle(editorCanvasContainerView);
+ const shouldShowCloseButton = onClose || closeButtonLabel;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-editor-canvas-container",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, {
+ enableResizing: enableResizing,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", {
+ className: "edit-site-editor-canvas-container__section",
+ ref: shouldShowCloseButton ? focusOnMountRef : null,
+ onKeyDown: closeOnEscape,
+ "aria-label": title,
+ children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "edit-site-editor-canvas-container__close-button",
+ icon: close_small,
+ label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'),
+ onClick: onCloseContainer
+ }), childrenWithProps]
+ })
+ })
+ })
+ });
+}
+function useHasEditorCanvasContainer() {
+ const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.privateKey);
+ return !!fills?.length;
+}
+/* harmony default export */ const editor_canvas_container = (EditorCanvasContainer);
+
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ ExperimentalBlockEditorProvider,
+ useGlobalStyle: style_book_useGlobalStyle,
+ GlobalStylesContext: style_book_GlobalStylesContext,
+ useGlobalStylesOutputWithConfig
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const {
+ CompositeV2: Composite,
+ CompositeItemV2: CompositeItem,
+ useCompositeStoreV2: useCompositeStore,
+ Tabs: style_book_Tabs
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+
+// The content area of the Style Book is rendered within an iframe so that global styles
+// are applied to elements within the entire content area. To support elements that are
+// not part of the block previews, such as headings and layout for the block previews,
+// additional CSS rules need to be passed into the iframe. These are hard-coded below.
+// Note that button styles are unset, and then focus rules from the `Button` component are
+// applied to the `button` element, targeted via `.edit-site-style-book__example`.
+// This is to ensure that browser default styles for buttons are not applied to the previews.
+const STYLE_BOOK_IFRAME_STYLES = `
+ .edit-site-style-book__examples {
+ max-width: 900px;
+ margin: 0 auto;
+ }
+
+ .edit-site-style-book__example {
+ border-radius: 2px;
+ cursor: pointer;
+ display: flex;
+ flex-direction: column;
+ gap: 40px;
+ margin-bottom: 40px;
+ padding: 16px;
+ width: 100%;
+ box-sizing: border-box;
+ scroll-margin-top: 32px;
+ scroll-margin-bottom: 32px;
+ }
+
+ .edit-site-style-book__example.is-selected {
+ box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
+ }
+
+ .edit-site-style-book__example:focus:not(:disabled) {
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
+ outline: 3px solid transparent;
+ }
+
+ .edit-site-style-book__examples.is-wide .edit-site-style-book__example {
+ flex-direction: row;
+ }
+
+ .edit-site-style-book__example-title {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
+ font-size: 11px;
+ font-weight: 500;
+ line-height: normal;
+ margin: 0;
+ text-align: left;
+ text-transform: uppercase;
+ }
+
+ .edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {
+ text-align: right;
+ width: 120px;
+ }
+
+ .edit-site-style-book__example-preview {
+ width: 100%;
+ }
+
+ .edit-site-style-book__example-preview .block-editor-block-list__insertion-point,
+ .edit-site-style-book__example-preview .block-list-appender {
+ display: none;
+ }
+
+ .edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {
+ margin-top: 0;
+ }
+ .edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {
+ margin-bottom: 0;
+ }
+`;
+function isObjectEmpty(object) {
+ return !object || Object.keys(object).length === 0;
+}
+function getExamples() {
+ // Use our own example for the Heading block so that we can show multiple
+ // heading levels.
+ const headingsExample = {
+ name: 'core/heading',
+ title: (0,external_wp_i18n_namespaceObject.__)('Headings'),
+ category: 'text',
+ blocks: [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
+ content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
+ level: 1
+ }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
+ content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
+ level: 2
+ }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
+ content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
+ level: 3
+ }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
+ content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
+ level: 4
+ }), (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
+ content: (0,external_wp_i18n_namespaceObject.__)('Code Is Poetry'),
+ level: 5
+ })]
+ };
+ const otherExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => {
+ const {
+ name,
+ example,
+ supports
+ } = blockType;
+ return name !== 'core/heading' && !!example && supports.inserter !== false;
+ }).map(blockType => ({
+ name: blockType.name,
+ title: blockType.title,
+ category: blockType.category,
+ blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, blockType.example)
+ }));
+ return [headingsExample, ...otherExamples];
+}
+function StyleBook({
+ enableResizing = true,
+ isSelected,
+ onClick,
+ onSelect,
+ showCloseButton = true,
+ onClose,
+ showTabs = true,
+ userConfig = {}
+}) {
+ const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
+ const [textColor] = style_book_useGlobalStyle('color.text');
+ const [backgroundColor] = style_book_useGlobalStyle('color.background');
+ const [examples] = (0,external_wp_element_namespaceObject.useState)(getExamples);
+ const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_blocks_namespaceObject.getCategories)().filter(category => examples.some(example => example.category === category.slug)).map(category => ({
+ name: category.slug,
+ title: category.title,
+ icon: category.icon
+ })), [examples]);
const {
- __unstableSetEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- back: "/",
- title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'),
- description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.')
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, {
- size: "small",
- isBorderless: true,
- className: "edit-site-global-styles-screen-style-variations"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(StyleVariationsContainer, null))));
+ base: baseConfig
+ } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext);
+ const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
+ return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig);
+ }
+ return {};
+ }, [baseConfig, userConfig]);
+
+ // Copied from packages/edit-site/src/components/revisions/index.js
+ // could we create a shared hook?
+ const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []);
+ const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ ...originalSettings,
+ __unstableIsPreviewMode: true
+ }), [originalSettings]);
+ const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
+ settings.styles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, {
+ onClose: onClose,
+ enableResizing: enableResizing,
+ closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: dist_clsx('edit-site-style-book', {
+ 'is-wide': sizes.width > 600,
+ 'is-button': !!onClick
+ }),
+ style: {
+ color: textColor,
+ background: backgroundColor
+ },
+ children: [resizeObserver, showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-style-book__tabs",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, {
+ children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, {
+ tabId: tab.name,
+ children: tab.title
+ }, tab.name))
+ }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, {
+ tabId: tab.name,
+ focusable: false,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, {
+ category: tab.name,
+ examples: examples,
+ isSelected: isSelected,
+ onSelect: onSelect,
+ settings: settings,
+ sizes: sizes,
+ title: tab.title
+ })
+ }, tab.name))]
+ })
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, {
+ examples: examples,
+ isSelected: isSelected,
+ onClick: onClick,
+ onSelect: onSelect,
+ settings: settings,
+ sizes: sizes
+ })]
+ })
+ });
}
-/* harmony default export */ const screen_style_variations = (ScreenStyleVariations);
+const StyleBookBody = ({
+ category,
+ examples,
+ isSelected,
+ onClick,
+ onSelect,
+ settings,
+ sizes,
+ title
+}) => {
+ const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js
+ // The presence of an `onClick` prop indicates that the Style Book is being used as a button.
+ // In this case, add additional props to the iframe to make it behave like a button.
+ const buttonModeProps = {
+ role: 'button',
+ onFocus: () => setIsFocused(true),
+ onBlur: () => setIsFocused(false),
+ onKeyDown: event => {
+ if (event.defaultPrevented) {
+ return;
+ }
+ const {
+ keyCode
+ } = event;
+ if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) {
+ event.preventDefault();
+ onClick(event);
+ }
+ },
+ onClick: event => {
+ if (event.defaultPrevented) {
+ return;
+ }
+ if (onClick) {
+ event.preventDefault();
+ onClick(event);
+ }
+ },
+ readonly: true
+ };
+ const buttonModeStyles = onClick ? 'body { cursor: pointer; } body * { pointer-events: none; }' : '';
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
+ className: dist_clsx('edit-site-style-book__iframe', {
+ 'is-focused': isFocused && !!onClick,
+ 'is-button': !!onClick
+ }),
+ name: "style-book-canvas",
+ tabIndex: 0,
+ ...(onClick ? buttonModeProps : {}),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
+ styles: settings.styles
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
+ children:
+ // Forming a "block formatting context" to prevent margin collapsing.
+ // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
+ `.is-root-container { display: flow-root; }
+ body { position: relative; padding: 32px !important; }` + STYLE_BOOK_IFRAME_STYLES + buttonModeStyles
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, {
+ className: dist_clsx('edit-site-style-book__examples', {
+ 'is-wide': sizes.width > 600
+ }),
+ examples: examples,
+ category: category,
+ label: title ? (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Category of blocks, e.g. Text.
+ (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'),
+ isSelected: isSelected,
+ onSelect: onSelect
+ }, category)]
+ });
+};
+const Examples = (0,external_wp_element_namespaceObject.memo)(({
+ className,
+ examples,
+ category,
+ label,
+ isSelected,
+ onSelect
+}) => {
+ const compositeStore = useCompositeStore({
+ orientation: 'vertical'
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, {
+ store: compositeStore,
+ className: className,
+ "aria-label": label,
+ role: "grid",
+ children: examples.filter(example => category ? example.category === category : true).map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, {
+ id: `example-${example.name}`,
+ title: example.title,
+ blocks: example.blocks,
+ isSelected: isSelected(example.name),
+ onClick: () => {
+ onSelect?.(example.name);
+ }
+ }, example.name))
+ });
+});
+const Example = ({
+ id,
+ title,
+ blocks,
+ isSelected,
+ onClick
+}) => {
+ const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []);
+ const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ ...originalSettings,
+ focusMode: false,
+ // Disable "Spotlight mode".
+ __unstableIsPreviewMode: true
+ }), [originalSettings]);
+ // Cache the list of blocks to avoid additional processing when the component is re-rendered.
+ const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "row",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "gridcell",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CompositeItem, {
+ className: dist_clsx('edit-site-style-book__example', {
+ 'is-selected': isSelected
+ }),
+ id: id,
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Title of a block, e.g. Heading.
+ (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title),
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
+ role: "button",
+ onClick: onClick,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "edit-site-style-book__example-title",
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-style-book__example-preview",
+ "aria-hidden": true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, {
+ className: "edit-site-style-book__example-preview__content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, {
+ value: renderedBlocks,
+ settings: settings,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {
+ renderAppender: false
+ })
+ })
+ })
+ })]
+ })
+ })
+ });
+};
+/* harmony default export */ const style_book = (StyleBook);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js
/**
* WordPress dependencies
*/
@@ -33327,10 +22482,13 @@ function ScreenStyleVariations() {
*/
+
+
+
const {
useGlobalStyle: screen_css_useGlobalStyle,
AdvancedPanel: screen_css_StylesAdvancedPanel
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenCSS() {
const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.');
const [style] = screen_css_useGlobalStyle('', undefined, 'user', {
@@ -33339,24 +22497,29 @@ function ScreenCSS() {
const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', {
shouldDecodeEncode: false
});
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('CSS'),
- description: (0,external_React_.createElement)(external_React_.Fragment, null, description, (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: "https://wordpress.org/documentation/article/css/",
- className: "edit-site-global-styles-screen-css-help-link"
- }, (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS')))
- }), (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-screen-css"
- }, (0,external_React_.createElement)(screen_css_StylesAdvancedPanel, {
- value: style,
- onChange: setStyle,
- inheritedValue: inheritedStyle
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: (0,external_wp_i18n_namespaceObject.__)('CSS'),
+ description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
+ href: "https://developer.wordpress.org/advanced-administration/wordpress/css/",
+ className: "edit-site-global-styles-screen-css-help-link",
+ children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS')
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen-css",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, {
+ value: style,
+ onChange: setStyle,
+ inheritedValue: inheritedStyle
+ })
+ })]
+ });
}
/* harmony default export */ const screen_css = (ScreenCSS);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js
-
/**
* WordPress dependencies
*/
@@ -33366,6 +22529,7 @@ function ScreenCSS() {
+
/**
* Internal dependencies
*/
@@ -33373,11 +22537,16 @@ function ScreenCSS() {
+
const {
ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider,
GlobalStylesContext: revisions_GlobalStylesContext,
- useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+ useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig,
+ __unstableBlockStyleVariationOverridesWithConfig
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
function revisions_isObjectEmpty(object) {
return !object || Object.keys(object).length === 0;
}
@@ -33390,7 +22559,7 @@ function Revisions({
} = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext);
const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) {
- return mergeBaseAndUserConfigs(baseConfig, userConfig);
+ return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig);
}
return {};
}, [baseConfig, userConfig]);
@@ -33402,33 +22571,172 @@ function Revisions({
}), [originalSettings]);
const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig);
const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles;
- return (0,external_React_.createElement)(editor_canvas_container, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, {
title: (0,external_wp_i18n_namespaceObject.__)('Revisions'),
closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'),
- enableResizing: true
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
- className: "edit-site-revisions__iframe",
- name: "revisions",
- tabIndex: 0
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
- styles: editorStyles
- }), (0,external_React_.createElement)("style", null,
- // Forming a "block formatting context" to prevent margin collapsing.
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
- `.is-root-container { display: flow-root; }`), (0,external_React_.createElement)(external_wp_components_namespaceObject.Disabled, {
- className: "edit-site-revisions__example-preview__content"
- }, (0,external_React_.createElement)(revisions_ExperimentalBlockEditorProvider, {
- value: renderedBlocksArray,
- settings: settings
- }, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
- renderAppender: false
- })))));
+ enableResizing: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
+ className: "edit-site-revisions__iframe",
+ name: "revisions",
+ tabIndex: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
+ children:
+ // Forming a "block formatting context" to prevent margin collapsing.
+ // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
+ `.is-root-container { display: flow-root; }`
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, {
+ className: "edit-site-revisions__example-preview__content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, {
+ value: renderedBlocksArray,
+ settings: settings,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {
+ renderAppender: false
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
+ styles: editorStyles
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, {
+ config: mergedConfig
+ })]
+ })
+ })]
+ })
+ });
}
/* harmony default export */ const components_revisions = (Revisions);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
/**
+ * Internal dependencies
+ */
+
+const SITE_EDITOR_AUTHORS_QUERY = {
+ per_page: -1,
+ _fields: 'id,name,avatar_urls',
+ context: 'view',
+ capabilities: ['edit_theme_options']
+};
+const DEFAULT_QUERY = {
+ per_page: 100,
+ page: 1
+};
+const EMPTY_ARRAY = [];
+const {
+ GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+function useGlobalStylesRevisions({
+ query
+} = {}) {
+ const {
+ user: userConfig
+ } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext);
+ const _query = {
+ ...DEFAULT_QUERY,
+ ...query
+ };
+ const {
+ authors,
+ currentUser,
+ isDirty,
+ revisions,
+ isLoadingGlobalStylesRevisions,
+ revisionsCount
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _globalStyles$_links$;
+ const {
+ __experimentalGetDirtyEntityRecords,
+ getCurrentUser,
+ getUsers,
+ getRevisions,
+ __experimentalGetCurrentGlobalStylesId,
+ getEntityRecord,
+ isResolving
+ } = select(external_wp_coreData_namespaceObject.store);
+ const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
+ const _currentUser = getCurrentUser();
+ const _isDirty = dirtyEntityRecords.length > 0;
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
+ const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
+ const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0;
+ const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || EMPTY_ARRAY;
+ const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || EMPTY_ARRAY;
+ const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]);
+ return {
+ authors: _authors,
+ currentUser: _currentUser,
+ isDirty: _isDirty,
+ revisions: globalStylesRevisions,
+ isLoadingGlobalStylesRevisions: _isResolving,
+ revisionsCount: _revisionsCount
+ };
+ }, [query]);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!authors.length || isLoadingGlobalStylesRevisions) {
+ return {
+ revisions: EMPTY_ARRAY,
+ hasUnsavedChanges: isDirty,
+ isLoading: true,
+ revisionsCount
+ };
+ }
+
+ // Adds author details to each revision.
+ const _modifiedRevisions = revisions.map(revision => {
+ return {
+ ...revision,
+ author: authors.find(author => author.id === revision.author)
+ };
+ });
+ const fetchedRevisionsCount = revisions.length;
+ if (fetchedRevisionsCount) {
+ // Flags the most current saved revision.
+ if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) {
+ _modifiedRevisions[0].isLatest = true;
+ }
+
+ // Adds an item for unsaved changes.
+ if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
+ const unsavedRevision = {
+ id: 'unsaved',
+ styles: userConfig?.styles,
+ settings: userConfig?.settings,
+ _links: userConfig?._links,
+ author: {
+ name: currentUser?.name,
+ avatar_urls: currentUser?.avatar_urls
+ },
+ modified: new Date()
+ };
+ _modifiedRevisions.unshift(unsavedRevision);
+ }
+ if (_query.page === Math.ceil(revisionsCount / _query.per_page)) {
+ // Adds an item for the default theme styles.
+ _modifiedRevisions.push({
+ id: 'parent',
+ styles: {},
+ settings: {}
+ });
+ }
+ }
+ return {
+ revisions: _modifiedRevisions,
+ hasUnsavedChanges: isDirty,
+ isLoading: false,
+ revisionsCount
+ };
+ }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]);
+}
+
+;// CONCATENATED MODULE: external ["wp","date"]
+const external_wp_date_namespaceObject = window["wp"]["date"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js
+/**
* External dependencies
*/
@@ -33447,10 +22755,12 @@ function Revisions({
* Internal dependencies
*/
+
+
const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;
const {
getGlobalStylesChanges
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ChangesSummary({
revision,
previousRevision
@@ -33461,12 +22771,13 @@ function ChangesSummary({
if (!changes.length) {
return null;
}
- return (0,external_React_.createElement)("ul", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
"data-testid": "global-styles-revision-changes",
- className: "edit-site-global-styles-screen-revisions__changes"
- }, changes.map(change => (0,external_React_.createElement)("li", {
- key: change
- }, change)));
+ className: "edit-site-global-styles-screen-revisions__changes",
+ children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
+ children: change
+ }, change))
+ });
}
/**
@@ -33529,77 +22840,116 @@ function RevisionsButtons({
const {
datetimeAbbreviated
} = (0,external_wp_date_namespaceObject.getSettings)().formats;
- return (0,external_React_.createElement)("ol", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ol", {
className: "edit-site-global-styles-screen-revisions__revisions-list",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'),
- role: "group"
- }, userRevisions.map((revision, index) => {
- const {
- id,
- author,
- modified
- } = revision;
- const isUnsaved = 'unsaved' === id;
- // Unsaved changes are created by the current user.
- const revisionAuthor = isUnsaved ? currentUser : author;
- const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User');
- const authorAvatar = revisionAuthor?.avatar_urls?.['48'];
- const isFirstItem = index === 0;
- const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem;
- const areStylesEqual = !canApplyRevision && isSelected;
- const isReset = 'parent' === id;
- const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified);
- const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified);
- const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual);
- return (0,external_React_.createElement)("li", {
- className: classnames_default()('edit-site-global-styles-screen-revisions__revision-item', {
- 'is-selected': isSelected,
- 'is-active': areStylesEqual,
- 'is-reset': isReset
- }),
- key: id,
- "aria-current": isSelected
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-global-styles-screen-revisions__revision-button",
- disabled: isSelected,
- onClick: () => {
- onChange(revision);
- },
- "aria-label": revisionLabel
- }, isReset ? (0,external_React_.createElement)("span", {
- className: "edit-site-global-styles-screen-revisions__description"
- }, (0,external_wp_i18n_namespaceObject.__)('Default styles'), (0,external_React_.createElement)("span", {
- className: "edit-site-global-styles-screen-revisions__meta"
- }, currentThemeName)) : (0,external_React_.createElement)("span", {
- className: "edit-site-global-styles-screen-revisions__description"
- }, isUnsaved ? (0,external_React_.createElement)("span", {
- className: "edit-site-global-styles-screen-revisions__date"
- }, (0,external_wp_i18n_namespaceObject.__)('(Unsaved)')) : (0,external_React_.createElement)("time", {
- className: "edit-site-global-styles-screen-revisions__date",
- dateTime: modified
- }, displayDate), (0,external_React_.createElement)("span", {
- className: "edit-site-global-styles-screen-revisions__meta"
- }, (0,external_React_.createElement)("img", {
- alt: authorDisplayName,
- src: authorAvatar
- }), authorDisplayName), isSelected && (0,external_React_.createElement)(ChangesSummary, {
- revision: revision,
- previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {}
- }))), isSelected && (areStylesEqual ? (0,external_React_.createElement)("p", {
- className: "edit-site-global-styles-screen-revisions__applied-text"
- }, (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.')) : (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- disabled: areStylesEqual,
- size: "compact",
- variant: "primary",
- className: "edit-site-global-styles-screen-revisions__apply-button",
- onClick: onApplyRevision
- }, isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply'))));
- }));
+ role: "group",
+ children: userRevisions.map((revision, index) => {
+ const {
+ id,
+ author,
+ modified
+ } = revision;
+ const isUnsaved = 'unsaved' === id;
+ // Unsaved changes are created by the current user.
+ const revisionAuthor = isUnsaved ? currentUser : author;
+ const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User');
+ const authorAvatar = revisionAuthor?.avatar_urls?.['48'];
+ const isFirstItem = index === 0;
+ const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem;
+ const areStylesEqual = !canApplyRevision && isSelected;
+ const isReset = 'parent' === id;
+ const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified);
+ const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified);
+ const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", {
+ className: dist_clsx('edit-site-global-styles-screen-revisions__revision-item', {
+ 'is-selected': isSelected,
+ 'is-active': areStylesEqual,
+ 'is-reset': isReset
+ }),
+ "aria-current": isSelected,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "edit-site-global-styles-screen-revisions__revision-button",
+ __experimentalIsFocusable: true,
+ disabled: isSelected,
+ onClick: () => {
+ onChange(revision);
+ },
+ "aria-label": revisionLabel,
+ children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ className: "edit-site-global-styles-screen-revisions__description",
+ children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "edit-site-global-styles-screen-revisions__meta",
+ children: currentThemeName
+ })]
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ className: "edit-site-global-styles-screen-revisions__description",
+ children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "edit-site-global-styles-screen-revisions__date",
+ children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {
+ className: "edit-site-global-styles-screen-revisions__date",
+ dateTime: modified,
+ children: displayDate
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ className: "edit-site-global-styles-screen-revisions__meta",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ alt: authorDisplayName,
+ src: authorAvatar
+ }), authorDisplayName]
+ }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, {
+ revision: revision,
+ previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {}
+ })]
+ })
+ }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-global-styles-screen-revisions__applied-text",
+ children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ variant: "primary",
+ className: "edit-site-global-styles-screen-revisions__apply-button",
+ onClick: onApplyRevision,
+ children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply')
+ }))]
+ }, id);
+ })
+ });
}
/* harmony default export */ const revisions_buttons = (RevisionsButtons);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
+/**
+ * WordPress dependencies
+ */
+
+
+const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
+ })
+});
+/* harmony default export */ const library_previous = (previous);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
+/**
+ * WordPress dependencies
+ */
+
+const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
+ })
+});
+/* harmony default export */ const library_next = (next);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js
/**
* External dependencies
*/
@@ -33610,6 +22960,9 @@ function RevisionsButtons({
*/
+
+
+
function Pagination({
currentPage,
numPages,
@@ -33620,55 +22973,71 @@ function Pagination({
buttonVariant = 'tertiary',
label = (0,external_wp_i18n_namespaceObject.__)('Pagination Navigation')
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
expanded: false,
as: "nav",
"aria-label": label,
spacing: 3,
justify: "flex-start",
- className: classnames_default()('edit-site-pagination', className)
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted",
- className: "edit-site-pagination__total"
- },
- // translators: %s: Total number of patterns.
- (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Total number of patterns.
- (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- expanded: false,
- spacing: 1
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: buttonVariant,
- onClick: () => changePage(1),
- disabled: disabled || currentPage === 1,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('First page')
- }, "\xAB"), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: buttonVariant,
- onClick: () => changePage(currentPage - 1),
- disabled: disabled || currentPage === 1,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page')
- }, "\u2039")), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %1$s: Current page number, %2$s: Total number of pages.
- (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- expanded: false,
- spacing: 1
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: buttonVariant,
- onClick: () => changePage(currentPage + 1),
- disabled: disabled || currentPage === numPages,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page')
- }, "\u203A"), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: buttonVariant,
- onClick: () => changePage(numPages),
- disabled: disabled || currentPage === numPages,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page')
- }, "\xBB")));
+ className: dist_clsx('edit-site-pagination', className),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ className: "edit-site-pagination__total",
+ children:
+ // translators: %s: Total number of patterns.
+ (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Total number of patterns.
+ (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ expanded: false,
+ spacing: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: buttonVariant,
+ onClick: () => changePage(1),
+ __experimentalIsFocusable: true,
+ disabled: disabled || currentPage === 1,
+ label: (0,external_wp_i18n_namespaceObject.__)('First page'),
+ icon: library_previous,
+ size: "compact"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: buttonVariant,
+ onClick: () => changePage(currentPage - 1),
+ __experimentalIsFocusable: true,
+ disabled: disabled || currentPage === 1,
+ label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
+ icon: chevron_left,
+ size: "compact"
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ children: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1$s: Current page number, %2$s: Total number of pages.
+ (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages)
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ expanded: false,
+ spacing: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: buttonVariant,
+ onClick: () => changePage(currentPage + 1),
+ __experimentalIsFocusable: true,
+ disabled: disabled || currentPage === numPages,
+ label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
+ icon: chevron_right,
+ size: "compact"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: buttonVariant,
+ onClick: () => changePage(numPages),
+ __experimentalIsFocusable: true,
+ disabled: disabled || currentPage === numPages,
+ label: (0,external_wp_i18n_namespaceObject.__)('Last page'),
+ icon: library_next,
+ size: "compact"
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js
-
/**
* WordPress dependencies
*/
@@ -33689,10 +23058,13 @@ function Pagination({
+
+
+
const {
GlobalStylesContext: screen_revisions_GlobalStylesContext,
areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const PAGE_SIZE = 10;
function ScreenRevisions() {
const {
@@ -33706,7 +23078,7 @@ function ScreenRevisions() {
blocks,
editorCanvasContainerView
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- editorCanvasContainerView: unlock(select(store_store)).getEditorCanvasContainerView(),
+ editorCanvasContainerView: lock_unlock_unlock(select(store)).getEditorCanvasContainerView(),
blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
}), []);
const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1);
@@ -33727,7 +23099,7 @@ function ScreenRevisions() {
const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false);
const {
setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles);
const onCloseRevisions = () => {
goTo('/'); // Return to global styles main panel.
@@ -33735,20 +23107,10 @@ function ScreenRevisions() {
setEditorCanvasContainerView(canvasContainerView);
};
const restoreRevision = revision => {
- setUserConfig(() => ({
- styles: revision?.styles,
- settings: revision?.settings
- }));
+ setUserConfig(() => revision);
setIsLoadingRevisionWithUnsavedChanges(false);
onCloseRevisions();
};
- const selectRevision = revision => {
- setCurrentlySelectedRevision({
- styles: revision?.styles || {},
- settings: revision?.settings || {},
- id: revision?.id
- });
- };
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!editorCanvasContainerView || !editorCanvasContainerView.startsWith('global-styles-revisions')) {
goTo('/'); // Return to global styles main panel.
@@ -33771,11 +23133,7 @@ function ScreenRevisions() {
* See: https://github.com/WordPress/gutenberg/issues/55866
*/
if (shouldSelectFirstItem) {
- setCurrentlySelectedRevision({
- styles: firstRevision?.styles || {},
- settings: firstRevision?.settings || {},
- id: firstRevision?.id
- });
+ setCurrentlySelectedRevision(firstRevision);
}
}, [shouldSelectFirstItem, firstRevision]);
@@ -33783,51 +23141,55 @@ function ScreenRevisions() {
// and it is different from the current editor styles.
const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles;
const hasRevisions = !!currentRevisions.length;
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(header, {
- title: revisionsCount &&
- // translators: %s: number of revisions.
- (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount),
- description: (0,external_wp_i18n_namespaceObject.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),
- onBack: onCloseRevisions
- }), !hasRevisions && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, {
- className: "edit-site-global-styles-screen-revisions__loading"
- }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? (0,external_React_.createElement)(style_book, {
- userConfig: currentlySelectedRevision,
- isSelected: () => {},
- onClose: () => {
- setEditorCanvasContainerView('global-styles-revisions');
- }
- }) : (0,external_React_.createElement)(components_revisions, {
- blocks: blocks,
- userConfig: currentlySelectedRevision,
- closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions')
- })), (0,external_React_.createElement)(revisions_buttons, {
- onChange: selectRevision,
- selectedRevisionId: currentlySelectedRevisionId,
- userRevisions: currentRevisions,
- canApplyRevision: isLoadButtonEnabled,
- onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
- }), numPages > 1 && (0,external_React_.createElement)("div", {
- className: "edit-site-global-styles-screen-revisions__footer"
- }, (0,external_React_.createElement)(Pagination, {
- className: "edit-site-global-styles-screen-revisions__pagination",
- currentPage: currentPage,
- numPages: numPages,
- changePage: setCurrentPage,
- totalItems: revisionsCount,
- disabled: isLoading,
- label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination navigation')
- })), isLoadingRevisionWithUnsavedChanges && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: isLoadingRevisionWithUnsavedChanges,
- confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'),
- onConfirm: () => restoreRevision(currentlySelectedRevision),
- onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false)
- }, (0,external_wp_i18n_namespaceObject.__)('Any unsaved changes will be lost when you apply this revision.')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {
+ title: revisionsCount &&
+ // translators: %s: number of revisions.
+ (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount),
+ description: (0,external_wp_i18n_namespaceObject.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),
+ onBack: onCloseRevisions
+ }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {
+ className: "edit-site-global-styles-screen-revisions__loading"
+ }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, {
+ userConfig: currentlySelectedRevision,
+ isSelected: () => {},
+ onClose: () => {
+ setEditorCanvasContainerView('global-styles-revisions');
+ }
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, {
+ blocks: blocks,
+ userConfig: currentlySelectedRevision,
+ closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions')
+ })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, {
+ onChange: setCurrentlySelectedRevision,
+ selectedRevisionId: currentlySelectedRevisionId,
+ userRevisions: currentRevisions,
+ canApplyRevision: isLoadButtonEnabled,
+ onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
+ }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-global-styles-screen-revisions__footer",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, {
+ className: "edit-site-global-styles-screen-revisions__pagination",
+ currentPage: currentPage,
+ numPages: numPages,
+ changePage: setCurrentPage,
+ totalItems: revisionsCount,
+ disabled: isLoading,
+ label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination navigation')
+ })
+ }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: isLoadingRevisionWithUnsavedChanges,
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'),
+ onConfirm: () => restoreRevision(currentlySelectedRevision),
+ onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.')
+ })]
+ });
}
/* harmony default export */ const screen_revisions = (ScreenRevisions);
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js
-
/**
* WordPress dependencies
*/
@@ -33858,14 +23220,18 @@ function ScreenRevisions() {
-const ui_SLOT_FILL_NAME = 'GlobalStylesMenu';
+
+
+
+
+const SLOT_FILL_NAME = 'GlobalStylesMenu';
const {
useGlobalStylesReset: ui_useGlobalStylesReset
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
const {
Slot: GlobalStylesMenuSlot,
Fill: GlobalStylesMenuFill
-} = (0,external_wp_components_namespaceObject.createSlotFill)(ui_SLOT_FILL_NAME);
+} = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME);
function GlobalStylesActionMenu() {
const [canReset, onReset] = ui_useGlobalStylesReset();
const {
@@ -33886,7 +23252,7 @@ function GlobalStylesActionMenu() {
}, []);
const {
setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const {
goTo
} = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
@@ -33894,31 +23260,46 @@ function GlobalStylesActionMenu() {
setEditorCanvasContainerView('global-styles-css');
goTo('/css');
};
- return (0,external_React_.createElement)(GlobalStylesMenuFill, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('More')
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, canEditCSS && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: loadCustomCSS
- }, (0,external_wp_i18n_namespaceObject.__)('Additional CSS')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- toggle('core/edit-site', 'welcomeGuideStyles');
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- onReset();
- onClose();
- },
- disabled: !canReset
- }, (0,external_wp_i18n_namespaceObject.__)('Reset styles'))))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('More'),
+ toggleProps: {
+ size: 'compact'
+ },
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: loadCustomCSS,
+ children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ toggle('core/edit-site', 'welcomeGuideStyles');
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ onReset();
+ onClose();
+ },
+ disabled: !canReset,
+ children: (0,external_wp_i18n_namespaceObject.__)('Reset styles')
+ })
+ })]
+ })
+ })
+ });
}
function GlobalStylesNavigationScreen({
className,
...props
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '),
...props
});
@@ -33928,13 +23309,13 @@ function BlockStylesNavigationScreens({
blockStyles,
blockName
}) {
- return blockStyles.map((style, index) => (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- key: index,
- path: parentMenu + '/variations/' + style.name
- }, (0,external_React_.createElement)(screen_block, {
- name: blockName,
- variation: style.name
- })));
+ return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: parentMenu + '/variations/' + style.name,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, {
+ name: blockName,
+ variation: style.name
+ })
+ }, index));
}
function ContextScreens({
name,
@@ -33946,22 +23327,25 @@ function ContextScreens({
} = select(external_wp_blocks_namespaceObject.store);
return getBlockStyles(name);
}, [name]);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors/palette'
- }, (0,external_React_.createElement)(screen_color_palette, {
- name: name
- })), !!blockStyleVariations?.length && (0,external_React_.createElement)(BlockStylesNavigationScreens, {
- parentMenu: parentMenu,
- blockStyles: blockStyleVariations,
- blockName: name
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: parentMenu + '/colors/palette',
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, {
+ name: name
+ })
+ }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, {
+ parentMenu: parentMenu,
+ blockStyles: blockStyleVariations,
+ blockName: name
+ })]
+ });
}
function GlobalStylesStyleBook() {
const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
const {
path
} = navigator.location;
- return (0,external_React_.createElement)(style_book, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, {
isSelected: blockName =>
// Match '/blocks/core%2Fbutton' and
// '/blocks/core%2Fbutton/typography', but not
@@ -34014,7 +23398,7 @@ function GlobalStylesEditorCanvasContainerLink() {
goTo,
location
} = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
- const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store_store)).getEditorCanvasContainerView(), []);
+ const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => lock_unlock_unlock(select(store)).getEditorCanvasContainerView(), []);
const path = location?.path;
const isRevisionsOpen = path === '/revisions';
@@ -34060,56 +23444,75 @@ function GlobalStylesEditorCanvasContainerLink() {
}
function GlobalStylesUI() {
const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)();
- const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store_store)).getEditorCanvasContainerView(), []);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
+ const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => lock_unlock_unlock(select(store)).getEditorCanvasContainerView(), []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
className: "edit-site-global-styles-sidebar__navigator-provider",
- initialPath: "/"
- }, (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/"
- }, (0,external_React_.createElement)(screen_root, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/variations"
- }, (0,external_React_.createElement)(screen_style_variations, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/blocks"
- }, (0,external_React_.createElement)(screen_block_list, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography"
- }, (0,external_React_.createElement)(screen_typography, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography/text"
- }, (0,external_React_.createElement)(screen_typography_element, {
- element: "text"
- })), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography/link"
- }, (0,external_React_.createElement)(screen_typography_element, {
- element: "link"
- })), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography/heading"
- }, (0,external_React_.createElement)(screen_typography_element, {
- element: "heading"
- })), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography/caption"
- }, (0,external_React_.createElement)(screen_typography_element, {
- element: "caption"
- })), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/typography/button"
- }, (0,external_React_.createElement)(screen_typography_element, {
- element: "button"
- })), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/colors"
- }, (0,external_React_.createElement)(screen_colors, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/layout"
- }, (0,external_React_.createElement)(screen_layout, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: "/css"
- }, (0,external_React_.createElement)(screen_css, null)), (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- path: '/revisions'
- }, (0,external_React_.createElement)(screen_revisions, null)), blocks.map(block => (0,external_React_.createElement)(GlobalStylesNavigationScreen, {
- key: 'menu-block-' + block.name,
- path: '/blocks/' + encodeURIComponent(block.name)
- }, (0,external_React_.createElement)(screen_block, {
- name: block.name
- }))), (0,external_React_.createElement)(ContextScreens, null), blocks.map(block => (0,external_React_.createElement)(ContextScreens, {
- key: 'screens-block-' + block.name,
- name: block.name,
- parentMenu: '/blocks/' + encodeURIComponent(block.name)
- })), 'style-book' === editorCanvasContainerView && (0,external_React_.createElement)(GlobalStylesStyleBook, null), (0,external_React_.createElement)(GlobalStylesActionMenu, null), (0,external_React_.createElement)(GlobalStylesBlockLink, null), (0,external_React_.createElement)(GlobalStylesEditorCanvasContainerLink, null));
+ initialPath: "/",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/variations",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/blocks",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography/text",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, {
+ element: "text"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography/link",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, {
+ element: "link"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography/heading",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, {
+ element: "heading"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography/caption",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, {
+ element: "caption"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/typography/button",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, {
+ element: "button"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/colors",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/shadows",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/shadows/edit/:category/:slug",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/layout",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/css",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: "/revisions",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {})
+ }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, {
+ path: '/blocks/' + encodeURIComponent(block.name),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, {
+ name: block.name
+ })
+ }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {
+ name: block.name,
+ parentMenu: '/blocks/' + encodeURIComponent(block.name)
+ }, 'screens-block-' + block.name)), 'style-book' === editorCanvasContainerView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})]
+ });
}
/* harmony default export */ const ui = (GlobalStylesUI);
@@ -34117,13 +23520,63 @@ function GlobalStylesUI() {
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/global-styles-sidebar.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js
/**
* WordPress dependencies
*/
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ ComplementaryArea,
+ ComplementaryAreaMoreMenuItem
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function DefaultSidebar({
+ className,
+ identifier,
+ title,
+ icon,
+ children,
+ closeLabel,
+ header,
+ headerClassName,
+ panelClassName,
+ isActiveByDefault
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, {
+ className: className,
+ scope: "core",
+ identifier: identifier,
+ title: title,
+ smallScreenTitle: title,
+ icon: icon,
+ closeLabel: closeLabel,
+ header: header,
+ headerClassName: headerClassName,
+ panelClassName: panelClassName,
+ isActiveByDefault: isActiveByDefault,
+ children: children
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, {
+ scope: "core",
+ identifier: identifier,
+ icon: icon,
+ children: title
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js
+/**
+ * WordPress dependencies
+ */
+
@@ -34140,6 +23593,11 @@ function GlobalStylesUI() {
+
+
+const {
+ interfaceStore: global_styles_sidebar_interfaceStore
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
function GlobalStylesSidebar() {
const {
shouldClearCanvasContainerView,
@@ -34151,13 +23609,13 @@ function GlobalStylesSidebar() {
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getActiveComplementaryArea
- } = select(store);
+ } = select(global_styles_sidebar_interfaceStore);
const {
getEditorCanvasContainerView,
getCanvasMode
- } = unlock(select(store_store));
+ } = lock_unlock_unlock(select(store));
const canvasContainerView = getEditorCanvasContainerView();
- const _isVisualEditorMode = 'visual' === select(store_store).getEditorMode();
+ const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode();
const _isEditCanvasMode = 'edit' === getCanvasMode();
const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault');
const {
@@ -34168,7 +23626,7 @@ function GlobalStylesSidebar() {
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
return {
isStyleBookOpened: 'style-book' === canvasContainerView,
- shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core/edit-site') || !_isVisualEditorMode || !_isEditCanvasMode,
+ shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode,
showListViewByDefault: _showListViewByDefault,
hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count,
isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView,
@@ -34177,7 +23635,7 @@ function GlobalStylesSidebar() {
}, []);
const {
setEditorCanvasContainerView
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (shouldClearCanvasContainerView) {
setEditorCanvasContainerView(undefined);
@@ -34220,43 +23678,51 @@ function GlobalStylesSidebar() {
setIsListViewOpened(isStyleBookOpened && showListViewByDefault);
setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book');
};
- return (0,external_React_.createElement)(DefaultSidebar, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, {
className: "edit-site-global-styles-sidebar",
identifier: "edit-site/global-styles",
title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
icon: library_styles,
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'),
panelClassName: "edit-site-global-styles-sidebar__panel",
- header: (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
+ header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
className: "edit-site-global-styles-sidebar__header",
- role: "menubar",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Styles actions')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, {
- style: {
- minWidth: 'min-content'
- }
- }, (0,external_React_.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- icon: library_seen,
- label: (0,external_wp_i18n_namespaceObject.__)('Style Book'),
- isPressed: isStyleBookOpened || isRevisionsStyleBookOpened,
- disabled: shouldClearCanvasContainerView,
- onClick: toggleStyleBook
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- label: (0,external_wp_i18n_namespaceObject.__)('Revisions'),
- icon: library_backup,
- onClick: toggleRevisions,
- disabled: !hasRevisions,
- isPressed: isRevisionsOpened || isRevisionsStyleBookOpened
- })), (0,external_React_.createElement)(GlobalStylesMenuSlot, null))
- }, (0,external_React_.createElement)(ui, null));
+ gap: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
+ style: {
+ minWidth: 'min-content'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
+ className: "edit-site-global-styles-sidebar__header-title",
+ children: (0,external_wp_i18n_namespaceObject.__)('Styles')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ icon: library_seen,
+ label: (0,external_wp_i18n_namespaceObject.__)('Style Book'),
+ isPressed: isStyleBookOpened || isRevisionsStyleBookOpened,
+ __experimentalIsFocusable: true,
+ disabled: shouldClearCanvasContainerView,
+ onClick: toggleStyleBook,
+ size: "compact"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Revisions'),
+ icon: library_backup,
+ onClick: toggleRevisions,
+ __experimentalIsFocusable: true,
+ disabled: !hasRevisions,
+ isPressed: isRevisionsOpened || isRevisionsStyleBookOpened,
+ size: "compact"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})]
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ui, {})
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/constants.js
-const SIDEBAR_TEMPLATE = 'edit-site/template';
-const SIDEBAR_BLOCK = 'edit-site/block-inspector';
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/settings-header/index.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js
/**
* WordPress dependencies
*/
@@ -34266,69 +23732,133 @@ const SIDEBAR_BLOCK = 'edit-site/block-inspector';
-/**
- * Internal dependencies
- */
-
-
-const {
- Tabs: settings_header_Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
-const SettingsHeader = (_, ref) => {
- const postTypeLabel = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getPostTypeLabel(), []);
- return (0,external_React_.createElement)(settings_header_Tabs.TabList, {
- ref: ref
- }, (0,external_React_.createElement)(settings_header_Tabs.Tab, {
- tabId: SIDEBAR_TEMPLATE
- // Used for focus management in the SettingsSidebar component.
- ,
- "data-tab-id": SIDEBAR_TEMPLATE
- }, postTypeLabel), (0,external_React_.createElement)(settings_header_Tabs.Tab, {
- tabId: SIDEBAR_BLOCK
- // Used for focus management in the SettingsSidebar component.
- ,
- "data-tab-id": SIDEBAR_BLOCK
- }, (0,external_wp_i18n_namespaceObject.__)('Block')));
-};
-/* harmony default export */ const settings_header = ((0,external_wp_element_namespaceObject.forwardRef)(SettingsHeader));
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/sidebar-card/index.js
/**
- * External dependencies
+ * Internal dependencies
*/
-/**
- * WordPress dependencies
- */
-function SidebarCard({
- className,
- title,
+
+const {
+ useLocation: save_button_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function SaveButton({
+ className = 'edit-site-save-button__button',
+ variant = 'primary',
+ showTooltip = true,
+ showReviewMessage,
icon,
- description,
- actions,
- children
+ size,
+ __next40pxDefaultSize = false
}) {
- return (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-sidebar-card', className)
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- className: "edit-site-sidebar-card__icon",
- icon: icon
- }), (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-card__content"
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-card__header"
- }, (0,external_React_.createElement)("h2", {
- className: "edit-site-sidebar-card__title"
- }, title), actions), (0,external_React_.createElement)("div", {
- className: "edit-site-sidebar-card__description"
- }, description), children));
+ const {
+ params
+ } = save_button_useLocation();
+ const {
+ setIsSaveViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ saveDirtyEntities
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store));
+ const {
+ dirtyEntityRecords
+ } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
+ const {
+ isSaving,
+ isSaveViewOpen,
+ previewingThemeName
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isSavingEntityRecord,
+ isResolving
+ } = select(external_wp_coreData_namespaceObject.store);
+ const {
+ isSaveViewOpened
+ } = select(store);
+ const isActivatingTheme = isResolving('activateTheme');
+ const currentlyPreviewingThemeId = currentlyPreviewingTheme();
+ return {
+ isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme,
+ isSaveViewOpen: isSaveViewOpened(),
+ // Do not call `getTheme` with null, it will cause a request to
+ // the server.
+ previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined
+ };
+ }, [dirtyEntityRecords]);
+ const hasDirtyEntities = !!dirtyEntityRecords.length;
+ let isOnlyCurrentEntityDirty;
+ // Check if the current entity is the only entity with changes.
+ // We have some extra logic for `wp_global_styles` for now, that
+ // is used in navigation sidebar.
+ if (dirtyEntityRecords.length === 1) {
+ if (params.postId) {
+ isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType;
+ } else if (params.path?.includes('wp_global_styles')) {
+ isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles';
+ }
+ }
+ const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme();
+ const getLabel = () => {
+ if (isPreviewingTheme()) {
+ if (isSaving) {
+ return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
+ (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName);
+ } else if (disabled) {
+ return (0,external_wp_i18n_namespaceObject.__)('Saved');
+ } else if (hasDirtyEntities) {
+ return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
+ (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName);
+ }
+ return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */
+ (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName);
+ }
+ if (isSaving) {
+ return (0,external_wp_i18n_namespaceObject.__)('Saving');
+ }
+ if (disabled) {
+ return (0,external_wp_i18n_namespaceObject.__)('Saved');
+ }
+ if (!isOnlyCurrentEntityDirty && showReviewMessage) {
+ return (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %d: number of unsaved changes (number).
+ (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length);
+ }
+ return (0,external_wp_i18n_namespaceObject.__)('Save');
+ };
+ const label = getLabel();
+ const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({
+ dirtyEntityRecords
+ }) : () => setIsSaveViewOpened(true);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: variant,
+ className: className,
+ "aria-disabled": disabled,
+ "aria-expanded": isSaveViewOpen,
+ isBusy: isSaving,
+ onClick: disabled ? undefined : onClick,
+ label: label
+ /*
+ * We want the tooltip to show the keyboard shortcut only when the
+ * button does something, i.e. when it's not disabled.
+ */,
+ shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s')
+ /*
+ * Displaying the keyboard shortcut conditionally makes the tooltip
+ * itself show conditionally. This would trigger a full-rerendering
+ * of the button that we want to avoid. By setting `showTooltip`,
+ * the tooltip is always rendered even when there's no keyboard shortcut.
+ */,
+ showTooltip: showTooltip,
+ icon: icon,
+ __next40pxDefaultSize: __next40pxDefaultSize,
+ size: size,
+ children: label
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/page-panels/page-content.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js
/**
* WordPress dependencies
*/
@@ -34340,231 +23870,71 @@ function SidebarCard({
* Internal dependencies
*/
-const {
- BlockQuickNavigation
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function PageContent() {
- const clientIdsTree = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(external_wp_blockEditor_namespaceObject.store)).getEnabledClientIdsTree(), []);
- const clientIds = (0,external_wp_element_namespaceObject.useMemo)(() => clientIdsTree.map(({
- clientId
- }) => clientId), [clientIdsTree]);
- return (0,external_React_.createElement)(BlockQuickNavigation, {
- clientIds: clientIds
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/page-panels/page-status.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-
-
-
+const {
+ useHistory: use_activate_theme_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
/**
- * Internal dependencies
+ * This should be refactored to use the REST API, once the REST API can activate themes.
+ *
+ * @return {Function} A function that activates the theme.
*/
-
-
-const {
- PostPanelRow
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-const STATUS_OPTIONS = [{
- label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Draft'), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.'))),
- value: 'draft'
-}, {
- label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Pending'), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.'))),
- value: 'pending'
-}, {
- label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Private'), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.'))),
- value: 'private'
-}, {
- label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Scheduled'), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.'))),
- value: 'future'
-}, {
- label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Published'), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted"
- }, (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.'))),
- value: 'publish'
-}];
-function PageStatus({
- postType,
- postId,
- status,
- password,
- date
-}) {
- const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password);
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PageStatus);
+function useActivateTheme() {
+ const history = use_activate_theme_useHistory();
const {
- editEntityRecord
+ startResolution,
+ finishResolution
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
- // Memoize popoverProps to avoid returning a new object every time.
- const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
- // Anchor the popover to the middle of the entire row so that it doesn't
- // move around when the label changes.
- anchor: popoverAnchor,
- 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Change status'),
- placement: 'bottom-end'
- }), [popoverAnchor]);
- const saveStatus = async ({
- status: newStatus = status,
- password: newPassword = password,
- date: newDate = date
- }) => {
- try {
- await editEntityRecord('postType', postType, postId, {
- status: newStatus,
- date: newDate,
- password: newPassword
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the status');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- };
- const handleTogglePassword = value => {
- setShowPassword(value);
- if (!value) {
- saveStatus({
- password: ''
+ return async () => {
+ if (isPreviewingTheme()) {
+ const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
+ startResolution('activateTheme');
+ await window.fetch(activationURL);
+ finishResolution('activateTheme');
+ // Remove the wp_theme_preview query param: we've finished activating
+ // the queue and are switching to normal Site Editor.
+ const {
+ params
+ } = history.getLocationWithParams();
+ history.replace({
+ ...params,
+ wp_theme_preview: undefined
});
}
};
- const handleStatus = value => {
- let newDate = date;
- let newPassword = password;
- if (value === 'publish') {
- if (new Date(date) > new Date()) {
- newDate = null;
- }
- } else if (value === 'future') {
- if (!date || new Date(date) < new Date()) {
- newDate = new Date();
- newDate.setDate(newDate.getDate() + 7);
- }
- } else if (value === 'private' && password) {
- setShowPassword(false);
- newPassword = '';
- }
- saveStatus({
- status: value,
- date: newDate,
- password: newPassword
- });
- };
- return (0,external_React_.createElement)(PostPanelRow, {
- label: (0,external_wp_i18n_namespaceObject.__)('Status')
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
- contentClassName: "edit-site-change-status__content",
- popoverProps: popoverProps,
- focusOnMount: true,
- ref: setPopoverAnchor,
- renderToggle: ({
- onToggle
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-summary-field__trigger",
- variant: "tertiary",
- onClick: onToggle
- }, (0,external_React_.createElement)(StatusLabel, {
- status: password ? 'protected' : status
- })),
- renderContent: ({
- onClose
- }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
- title: (0,external_wp_i18n_namespaceObject.__)('Status'),
- onClose: onClose
- }), (0,external_React_.createElement)("form", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 5
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.RadioControl, {
- className: "edit-site-change-status__options",
- hideLabelFromVision: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Status'),
- options: STATUS_OPTIONS,
- onChange: handleStatus,
- selected: status
- }), status !== 'private' && (0,external_React_.createElement)("fieldset", {
- className: "edit-site-change-status__password-fieldset"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "legend",
- className: "edit-site-change-status__password-legend",
- size: "11",
- lineHeight: 1.4,
- weight: 500,
- upperCase: true
- }, (0,external_wp_i18n_namespaceObject.__)('Password')), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Hide this page behind a password'),
- checked: showPassword,
- onChange: handleTogglePassword
- }), showPassword && (0,external_React_.createElement)("div", {
- className: "edit-site-change-status__password-input"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "label",
- htmlFor: `edit-site-change-status__password-input-${instanceId}`
- }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- onChange: value => saveStatus({
- password: value
- }),
- value: password,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'),
- type: "text",
- id: `edit-site-change-status__password-input-${instanceId}`
- }))))))
- }));
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/page-panels/page-summary.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js
/**
* WordPress dependencies
*/
+const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';
+function useActualCurrentTheme() {
+ const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)();
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.
+ const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, {
+ context: 'edit',
+ wp_theme_preview: ''
+ });
+ external_wp_apiFetch_default()({
+ path
+ }).then(activeThemes => setCurrentTheme(activeThemes[0]))
+ // Do nothing
+ .catch(() => {});
+ }, []);
+ return currentTheme;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js
/**
- * Internal dependencies
+ * External dependencies
*/
-function PageSummary({
- status,
- date,
- password,
- postId,
- postType
-}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 0
- }, (0,external_React_.createElement)(PageStatus, {
- status: status,
- date: date,
- password: password,
- postId: postId,
- postType: postType
- }), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostSchedulePanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostTemplatePanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostURLPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostAuthorPanel, null));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/page-panels/index.js
/**
* WordPress dependencies
@@ -34575,9 +23945,6 @@ function PageSummary({
-
-
-
/**
* Internal dependencies
*/
@@ -34585,72 +23952,149 @@ function PageSummary({
-function PagePanels() {
+
+
+
+const {
+ EntitiesSavedStatesExtensible,
+ NavigableRegion
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const EntitiesSavedStatesForPreview = ({
+ onClose
+}) => {
+ var _currentTheme$name$re, _previewingTheme$name;
+ const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
+ let activateSaveLabel;
+ if (isDirtyProps.isDirty) {
+ activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save');
+ } else {
+ activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate');
+ }
+ const currentTheme = useActualCurrentTheme();
+ const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []);
+ const additionalPrompt = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */
+ (0,external_wp_i18n_namespaceObject.__)('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...')
+ });
+ const activateTheme = useActivateTheme();
+ const onSave = async values => {
+ await activateTheme();
+ return values;
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, {
+ ...isDirtyProps,
+ additionalPrompt,
+ close: onClose,
+ onSave,
+ saveEnabled: true,
+ saveLabel: activateSaveLabel
+ });
+};
+const _EntitiesSavedStates = ({
+ onClose,
+ renderDialog = undefined
+}) => {
+ if (isPreviewingTheme()) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesForPreview, {
+ onClose: onClose
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
+ close: onClose,
+ renderDialog: renderDialog
+ });
+};
+function SavePanel() {
const {
- id,
- type,
- hasResolved,
- status,
- date,
- password,
- title,
- modified,
- renderingMode
+ isSaveViewOpen,
+ canvasMode,
+ isDirty,
+ isSaving
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getEditedPostContext
- } = select(store_store);
- const {
- getEditedEntityRecord,
- hasFinishedResolution
+ __experimentalGetDirtyEntityRecords,
+ isSavingEntityRecord,
+ isResolving
} = select(external_wp_coreData_namespaceObject.store);
+ const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
+ const isActivatingTheme = isResolving('activateTheme');
const {
- getRenderingMode
- } = select(external_wp_editor_namespaceObject.store);
- const context = getEditedPostContext();
- const queryArgs = ['postType', context.postType, context.postId];
- const page = getEditedEntityRecord(...queryArgs);
+ isSaveViewOpened,
+ getCanvasMode
+ } = lock_unlock_unlock(select(store));
+
+ // The currently selected entity to display.
+ // Typically template or template part in the site editor.
return {
- hasResolved: hasFinishedResolution('getEditedEntityRecord', queryArgs),
- title: page?.title,
- id: page?.id,
- type: page?.type,
- status: page?.status,
- date: page?.date,
- password: page?.password,
- modified: page?.modified,
- renderingMode: getRenderingMode()
+ isSaveViewOpen: isSaveViewOpened(),
+ canvasMode: getCanvasMode(),
+ isDirty: dirtyEntityRecords.length > 0,
+ isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme
};
}, []);
- if (!hasResolved) {
- return null;
+ const {
+ setIsSaveViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const onClose = () => setIsSaveViewOpened(false);
+ if (canvasMode === 'view') {
+ return isSaveViewOpen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ className: "edit-site-save-panel__modal",
+ onRequestClose: onClose,
+ __experimentalHideHeader: true,
+ contentLabel: (0,external_wp_i18n_namespaceObject.__)('Save site, content, and template changes'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, {
+ onClose: onClose
+ })
+ }) : null;
}
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_.createElement)(SidebarCard, {
- title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
- icon: library_page,
- description: (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Human-readable time difference, e.g. "2 days ago".
- (0,external_wp_i18n_namespaceObject.__)('Last edited %s'), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified))))
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (0,external_wp_i18n_namespaceObject.__)('Summary')
- }, (0,external_React_.createElement)(PageSummary, {
- status: status,
- date: date,
- password: password,
- postId: id,
- postType: type
- })), renderingMode !== 'post-only' && (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
- title: (0,external_wp_i18n_namespaceObject.__)('Content')
- }, (0,external_React_.createElement)(PageContent, null)), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostLastRevisionPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostFeaturedImagePanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostExcerptPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostDiscussionPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PageAttributesPanel, null));
+ const activateSaveEnabled = isPreviewingTheme() || isDirty;
+ const disabled = isSaving || !activateSaveEnabled;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigableRegion, {
+ className: dist_clsx('edit-site-layout__actions', {
+ 'is-entity-save-view-open': isSaveViewOpen
+ }),
+ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel'),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-editor__toggle-save-panel', {
+ 'screen-reader-text': isSaveViewOpen
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "secondary",
+ className: "edit-site-editor__toggle-save-panel-button",
+ onClick: () => setIsSaveViewOpened(true),
+ "aria-haspopup": "dialog",
+ disabled: disabled,
+ __experimentalIsFocusable: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Open save panel')
+ })
+ }), isSaveViewOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, {
+ onClose: onClose,
+ renderDialog: true
+ })]
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js
/**
* WordPress dependencies
*/
+const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_download = (download);
+
+;// CONCATENATED MODULE: external ["wp","blob"]
+const external_wp_blob_namespaceObject = window["wp"]["blob"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js
+/**
+ * WordPress dependencies
+ */
@@ -34658,70 +24102,46 @@ function PagePanels() {
-/**
- * Internal dependencies
- */
-function ReplaceTemplateButton({
- onClick,
- availableTemplates
-}) {
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const onClose = () => {
- setShowModal(false);
- };
+function SiteExport() {
const {
- postId,
- postType
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return {
- postId: select(store_store).getEditedPostId(),
- postType: select(store_store).getEditedPostType()
- };
- }, []);
- const onTemplateSelect = async selectedTemplate => {
- onClose(); // Close the template suggestions modal first.
- onClick();
- await editEntityRecord('postType', postType, postId, {
- blocks: selectedTemplate.blocks,
- content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks)
- });
- };
- if (!availableTemplates.length || availableTemplates.length < 1) {
- return null;
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ async function handleExport() {
+ try {
+ const response = await external_wp_apiFetch_default()({
+ path: '/wp-block-editor/v1/export',
+ parse: false,
+ headers: {
+ Accept: 'application/zip'
+ }
+ });
+ const blob = await response.blob();
+ const contentDisposition = response.headers.get('content-disposition');
+ const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
+ const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export';
+ (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip');
+ } catch (errorResponse) {
+ let error = {};
+ try {
+ error = await errorResponse.json();
+ } catch (e) {}
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ }
}
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- info: (0,external_wp_i18n_namespaceObject.__)('Replace the contents of this template with another.'),
- onClick: () => setShowModal(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Replace template')), showModal && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'),
- onRequestClose: onClose,
- overlayClassName: "edit-site-template-panel__replace-template-modal",
- isFullScreen: true
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-template-panel__replace-template-modal__content"
- }, (0,external_React_.createElement)(TemplatesList, {
- availableTemplates: availableTemplates,
- onSelect: onTemplateSelect
- }))));
-}
-function TemplatesList({
- availableTemplates,
- onSelect
-}) {
- const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(availableTemplates);
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
- label: (0,external_wp_i18n_namespaceObject.__)('Templates'),
- blockPatterns: availableTemplates,
- shownPatterns: shownTemplates,
- onClickPattern: onSelect
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ role: "menuitem",
+ icon: library_download,
+ onClick: handleExport,
+ info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'),
+ children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item')
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/template-panel/hooks.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js
/**
* WordPress dependencies
*/
@@ -34730,64 +24150,17 @@ function TemplatesList({
-/**
- * Internal dependencies
- */
-
-
-
-function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) {
- block.innerBlocks = block.innerBlocks.map(innerBlock => {
- return injectThemeAttributeInBlockTemplateContent(innerBlock, currentThemeStylesheet);
- });
- if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
- block.attributes.theme = currentThemeStylesheet;
- }
- return block;
-}
-function preparePatterns(patterns, template, currentThemeStylesheet) {
- // Filter out duplicates.
- const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
-
- // Filter out core/directory patterns not included in theme.json.
- const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source);
-
- // Filter only the patterns that are compatible with the current template.
- const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug);
- return patterns.filter((pattern, index, items) => filterOutExcludedPatternSources(pattern) && filterOutDuplicatesByName(pattern, index, items) && filterCompatiblePatterns(pattern)).map(pattern => ({
- ...pattern,
- keywords: pattern.keywords || [],
- type: PATTERN_TYPES.theme,
- blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
- __unstableSkipMigrationLogs: true
- }).map(block => injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet))
- }));
-}
-function useAvailablePatterns(template) {
+function WelcomeGuideMenuItem() {
const {
- blockPatterns,
- restBlockPatterns,
- currentThemeStylesheet
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _settings$__experimen;
- const {
- getSettings
- } = unlock(select(store_store));
- const settings = getSettings();
- return {
- blockPatterns: (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns,
- restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
- currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet
- };
- }, []);
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- const mergedPatterns = [...(blockPatterns || []), ...(restBlockPatterns || [])];
- return preparePatterns(mergedPatterns, template, currentThemeStylesheet);
- }, [blockPatterns, restBlockPatterns, template, currentThemeStylesheet]);
+ toggle
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => toggle('core/edit-site', 'welcomeGuide'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/template-panel/template-actions.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js
/**
* WordPress dependencies
*/
@@ -34795,7 +24168,6 @@ function useAvailablePatterns(template) {
-
/**
* Internal dependencies
*/
@@ -34803,104 +24175,28 @@ function useAvailablePatterns(template) {
-function Actions({
- template
-}) {
- const availablePatterns = useAvailablePatterns(template);
- const {
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const isRevertable = isTemplateRevertable(template);
- if (!isRevertable && (!availablePatterns.length || availablePatterns.length < 1)) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- className: "edit-site-template-card__actions",
- toggleProps: {
- isSmall: true
- }
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRevertable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- info: (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.'),
- onClick: () => {
- revertTemplate(template);
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')), (0,external_React_.createElement)(ReplaceTemplateButton, {
- availableTemplates: availablePatterns,
- template: template,
- onClick: onClose
- })));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/template-panel/template-areas.js
-
-/**
- * WordPress dependencies
- */
-
-
-
+const {
+ ToolsMoreMenuGroup,
+ PreferencesModal
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function MoreMenu() {
+ const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme;
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, {
+ children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})]
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js
/**
- * Internal dependencies
+ * External dependencies
*/
-function TemplateAreaItem({
- area,
- clientId
-}) {
- const {
- selectBlock,
- toggleBlockHighlight
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
- return defaultAreas.find(defaultArea => defaultArea.area === area);
- }, [area]);
- const highlightBlock = () => toggleBlockHighlight(clientId, true);
- const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-template-card__template-areas-item",
- icon: templatePartArea?.icon,
- onMouseOver: highlightBlock,
- onMouseLeave: cancelHighlightBlock,
- onFocus: highlightBlock,
- onBlur: cancelHighlightBlock,
- onClick: () => {
- selectBlock(clientId);
- }
- }, templatePartArea?.label);
-}
-function template_areas_TemplateAreas() {
- const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []);
- if (!templateParts.length) {
- return null;
- }
- return (0,external_React_.createElement)("section", {
- className: "edit-site-template-card__template-areas"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 3,
- className: "edit-site-template-card__template-areas-title"
- }, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_React_.createElement)("ul", {
- className: "edit-site-template-card__template-areas-list"
- }, templateParts.map(({
- templatePart,
- block
- }) => (0,external_React_.createElement)("li", {
- key: block.clientId
- }, (0,external_React_.createElement)(TemplateAreaItem, {
- area: templatePart.area,
- clientId: block.clientId
- })))));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/template-panel/index.js
/**
* WordPress dependencies
@@ -34911,99 +24207,73 @@ function template_areas_TemplateAreas() {
-
/**
* Internal dependencies
*/
-
-
-const CARD_ICONS = {
- wp_block: library_symbol,
- wp_navigation: library_navigation
-};
-function TemplatePanel() {
- var _CARD_ICONS$record$ty;
+function useEditorIframeProps() {
const {
- title,
- description,
- icon,
- record
+ canvasMode,
+ currentPostIsTrashed
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- __experimentalGetTemplateInfo: getTemplateInfo
- } = select(external_wp_editor_namespaceObject.store);
- const type = getEditedPostType();
- const postId = getEditedPostId();
- const _record = getEditedEntityRecord('postType', type, postId);
- const info = getTemplateInfo(_record);
+ getCanvasMode
+ } = lock_unlock_unlock(select(store));
return {
- title: info.title,
- description: info.description,
- icon: info.icon,
- record: _record
+ canvasMode: getCanvasMode(),
+ currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash'
};
}, []);
- if (!title && !description) {
- return null;
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_.createElement)(SidebarCard, {
- className: "edit-site-template-card",
- title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
- icon: (_CARD_ICONS$record$ty = CARD_ICONS[record?.type]) !== null && _CARD_ICONS$record$ty !== void 0 ? _CARD_ICONS$record$ty : icon,
- description: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description),
- actions: (0,external_React_.createElement)(Actions, {
- template: record
- })
- }, (0,external_React_.createElement)(template_areas_TemplateAreas, null))), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostLastRevisionPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostFeaturedImagePanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostExcerptPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PostDiscussionPanel, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.PageAttributesPanel, null));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js
-/**
- * Defines an extensibility slot for the Template sidebar.
- */
-
-/**
- * WordPress dependencies
- */
-
-const {
- Fill,
- Slot: plugin_template_setting_panel_Slot
-} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel');
-const PluginTemplateSettingPanel = Fill;
-PluginTemplateSettingPanel.Slot = plugin_template_setting_panel_Slot;
-
-/**
- * Renders items in the Template Sidebar below the main information
- * like the Template Card.
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { PluginTemplateSettingPanel } from '@wordpress/edit-site';
- *
- * const MyTemplateSettingTest = () => (
- * <PluginTemplateSettingPanel>
- * <p>Hello, World!</p>
- * </PluginTemplateSettingPanel>
- * );
- * ```
- *
- * @return {Component} The component to be rendered.
- */
-/* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel);
+ const {
+ setCanvasMode
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+ const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (canvasMode === 'edit') {
+ setIsFocused(false);
+ }
+ }, [canvasMode]);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/index.js
+ // In view mode, make the canvas iframe be perceived and behave as a button
+ // to switch to edit mode, with a meaningful label and no title attribute.
+ const viewModeIframeProps = {
+ 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'),
+ 'aria-disabled': currentPostIsTrashed,
+ title: null,
+ role: 'button',
+ tabIndex: 0,
+ onFocus: () => setIsFocused(true),
+ onBlur: () => setIsFocused(false),
+ onKeyDown: event => {
+ const {
+ keyCode
+ } = event;
+ if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) {
+ event.preventDefault();
+ setCanvasMode('edit');
+ }
+ },
+ onClick: () => {
+ setCanvasMode('edit');
+ },
+ onClickCapture: event => {
+ if (currentPostIsTrashed) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
+ readonly: true
+ };
+ return {
+ className: dist_clsx('edit-site-visual-editor__editor-canvas', {
+ 'is-focused': isFocused && canvasMode === 'view'
+ }),
+ ...(canvasMode === 'view' ? viewModeIframeProps : {})
+ };
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js
/**
* WordPress dependencies
*/
@@ -35015,263 +24285,75 @@ PluginTemplateSettingPanel.Slot = plugin_template_setting_panel_Slot;
-
/**
* Internal dependencies
*/
-
-
-
-
-
-
-
-
-
-const {
- Tabs: sidebar_edit_mode_Tabs
-} = unlock(external_wp_components_namespaceObject.privateApis);
const {
- Slot: InspectorSlot,
- Fill: InspectorFill
-} = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector');
-const SidebarInspectorFill = InspectorFill;
-const FillContents = ({
- sidebarName,
- isEditingPage,
- supportsGlobalStyles
-}) => {
- const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null);
- // Because `DefaultSidebar` renders a `ComplementaryArea`, we
- // need to forward the `Tabs` context so it can be passed through the
- // underlying slot/fill.
- const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_edit_mode_Tabs.Context);
-
- // This effect addresses a race condition caused by tabbing from the last
- // block in the editor into the settings sidebar. Without this effect, the
- // selected tab and browser focus can become separated in an unexpected way.
- // (e.g the "block" tab is focused, but the "post" tab is selected).
+ useLocation: use_title_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useTitle(title) {
+ const location = use_title_useLocation();
+ const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []);
+ const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true);
(0,external_wp_element_namespaceObject.useEffect)(() => {
- const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []);
- const selectedTabElement = tabsElements.find(
- // We are purposefully using a custom `data-tab-id` attribute here
- // because we don't want rely on any assumptions about `Tabs`
- // component internals.
- element => element.getAttribute('data-tab-id') === sidebarName);
- const activeElement = selectedTabElement?.ownerDocument.activeElement;
- const tabsHasFocus = tabsElements.some(element => {
- return activeElement && activeElement.id === element.id;
- });
- if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) {
- selectedTabElement?.focus();
- }
- }, [sidebarName]);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(DefaultSidebar, {
- identifier: sidebarName,
- title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right,
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings'),
- header: (0,external_React_.createElement)(sidebar_edit_mode_Tabs.Context.Provider, {
- value: tabsContextValue
- }, (0,external_React_.createElement)(settings_header, {
- ref: tabListRef
- })),
- headerClassName: "edit-site-sidebar-edit-mode__panel-tabs"
- // This classname is added so we can apply a corrective negative
- // margin to the panel.
- // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049
- ,
- className: "edit-site-sidebar__panel"
- }, (0,external_React_.createElement)(sidebar_edit_mode_Tabs.Context.Provider, {
- value: tabsContextValue
- }, (0,external_React_.createElement)(sidebar_edit_mode_Tabs.TabPanel, {
- tabId: SIDEBAR_TEMPLATE,
- focusable: false
- }, isEditingPage ? (0,external_React_.createElement)(PagePanels, null) : (0,external_React_.createElement)(TemplatePanel, null), (0,external_React_.createElement)(plugin_template_setting_panel.Slot, null)), (0,external_React_.createElement)(sidebar_edit_mode_Tabs.TabPanel, {
- tabId: SIDEBAR_BLOCK,
- focusable: false
- }, (0,external_React_.createElement)(InspectorSlot, {
- bubblesVirtually: true
- })))), supportsGlobalStyles && (0,external_React_.createElement)(GlobalStylesSidebar, null));
-};
-function SidebarComplementaryAreaFills() {
- const {
- sidebar,
- isEditorSidebarOpened,
- hasBlockSelection,
- supportsGlobalStyles,
- isEditingPage,
- isEditorOpen
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const _sidebar = select(store).getActiveComplementaryArea(constants_STORE_NAME);
- const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar);
- const {
- getCanvasMode
- } = unlock(select(store_store));
- return {
- sidebar: _sidebar,
- isEditorSidebarOpened: _isEditorSidebarOpened,
- hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
- supportsGlobalStyles: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
- isEditingPage: select(store_store).isPage(),
- isEditorOpen: getCanvasMode() === 'edit'
- };
- }, []);
- const {
- enableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ isInitialLocationRef.current = false;
+ }, [location]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
- // Don't automatically switch tab when the sidebar is closed or when we
- // are focused on page content.
- if (!isEditorSidebarOpened) {
+ // Don't update or announce the title for initial page load.
+ if (isInitialLocationRef.current) {
return;
}
- if (hasBlockSelection) {
- if (!isEditingPage) {
- enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
- }
- } else {
- enableComplementaryArea(constants_STORE_NAME, SIDEBAR_TEMPLATE);
- }
- }, [hasBlockSelection, isEditorSidebarOpened, isEditingPage, enableComplementaryArea]);
- let sidebarName = sidebar;
- if (!isEditorSidebarOpened) {
- sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;
- }
-
- // `newSelectedTabId` could technically be falsey if no tab is selected (i.e.
- // the initial render) or when we don't want a tab displayed (i.e. the
- // sidebar is closed). These cases should both be covered by the `!!` check
- // below, so we shouldn't need any additional falsey handling.
- const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => {
- if (!!newSelectedTabId) {
- enableComplementaryArea(constants_STORE_NAME, newSelectedTabId);
- }
- }, [enableComplementaryArea]);
- return (0,external_React_.createElement)(sidebar_edit_mode_Tabs
- // Due to how this component is controlled (via a value from the
- // edit-site store), when the sidebar closes the currently selected
- // tab can't be found. This causes the component to continuously reset
- // the selection to `null` in an infinite loop. Proactively setting
- // the selected tab to `null` avoids that.
- , {
- selectedTabId: isEditorOpen && isEditorSidebarOpened ? sidebarName : null,
- onSelect: onTabSelect,
- selectOnMove: false
- }, (0,external_React_.createElement)(FillContents, {
- sidebarName: sidebarName,
- isEditingPage: isEditingPage,
- supportsGlobalStyles: supportsGlobalStyles
- }));
-}
+ if (title && siteTitle) {
+ // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
+ const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
+ (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s ‹ Editor — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle));
+ document.title = formattedTitle;
-// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
-var lib = __webpack_require__(4132);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/index.js
+ // Announce title on route change for screen readers.
+ (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive');
+ }
+ }, [title, siteTitle, location]);
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js
/**
- * External dependencies
+ * WordPress dependencies
*/
/**
- * WordPress dependencies
+ * Internal dependencies
*/
+function useEditorTitle() {
+ const {
+ record: editedPost,
+ getTitle,
+ isLoaded: hasLoadedPost
+ } = useEditedEntityRecord();
+ let title;
+ if (hasLoadedPost) {
+ var _POST_TYPE_LABELS$edi;
+ title = (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
+ (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPost.type]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]);
+ }
+ // Only announce the title once the editor is ready to prevent "Replace"
+ // action in <URLQueryController> from double-announcing.
+ useTitle(hasLoadedPost && title);
+}
+/* harmony default export */ const use_editor_title = (useEditorTitle);
-
-
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js
/**
- * Internal dependencies
+ * External dependencies
*/
-function CodeEditor() {
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditor);
- const {
- shortcut,
- content,
- blocks,
- type,
- id
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const {
- getShortcutRepresentation
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
- const _type = getEditedPostType();
- const _id = getEditedPostId();
- const editedRecord = getEditedEntityRecord('postType', _type, _id);
- return {
- shortcut: getShortcutRepresentation('core/edit-site/toggle-mode'),
- content: editedRecord?.content,
- blocks: editedRecord?.blocks,
- type: _type,
- id: _id
- };
- }, []);
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- // Replicates the logic found in getEditedPostContent().
- const realContent = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (content instanceof Function) {
- return content({
- blocks
- });
- } else if (blocks) {
- // If we have parsed blocks already, they should be our source of truth.
- // Parsing applies block deprecations and legacy block conversions that
- // unparsed content will not have.
- return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks);
- }
- return content;
- }, [content, blocks]);
- const {
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)("div", {
- className: "edit-site-code-editor"
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-code-editor__toolbar"
- }, (0,external_React_.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => switchEditorMode('visual'),
- shortcut: shortcut
- }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_React_.createElement)("div", {
- className: "edit-site-code-editor__body"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "label",
- htmlFor: `code-editor-text-area-${instanceId}`
- }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_React_.createElement)(lib/* default */.A, {
- autoComplete: "off",
- dir: "auto",
- value: realContent,
- onChange: event => {
- editEntityRecord('postType', type, id, {
- content: event.target.value,
- blocks: undefined,
- selection: undefined
- });
- },
- className: "edit-site-code-editor-text-area",
- id: `code-editor-text-area-${instanceId}`,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
- })));
-}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/edit-mode.js
/**
* WordPress dependencies
*/
@@ -35281,105 +24363,15 @@ function CodeEditor() {
-/**
- * Internal dependencies
- */
-function KeyboardShortcutsEditMode() {
- const {
- getEditorMode
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []);
- const {
- switchEditorMode,
- toggleDistractionFree
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const {
- replaceBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- getBlockName,
- getSelectedBlockClientId,
- getBlockAttributes
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
- const handleTextLevelShortcut = (event, level) => {
- event.preventDefault();
- const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
- const currentClientId = getSelectedBlockClientId();
- if (currentClientId === null) {
- return;
- }
- const blockName = getBlockName(currentClientId);
- if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
- return;
- }
- const attributes = getBlockAttributes(currentClientId);
- const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
- const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
- replaceBlocks(currentClientId, (0,external_wp_blocks_namespaceObject.createBlock)(destinationBlockName, {
- level,
- content: attributes.content,
- ...{
- [destinationTextAlign]: attributes[textAlign]
- }
- }));
- };
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => {
- // This shortcut has no known clashes, but use preventDefault to prevent any
- // obscure shortcuts from triggering.
- event.preventDefault();
- if (isBlockInspectorOpen) {
- disableComplementaryArea(constants_STORE_NAME);
- } else {
- enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
- }
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => {
- switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
- [1, 2, 3, 4, 5, 6].forEach(level => {
- //the loop is based off on a constant therefore
- //the hook will execute the same way every time
- //eslint-disable-next-line react-hooks/rules-of-hooks
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)(`core/edit-site/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-distraction-free', () => {
- toggleDistractionFree();
- });
- return null;
-}
-/* harmony default export */ const edit_mode = (KeyboardShortcutsEditMode);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js
-function WelcomeGuideImage({
- nonAnimatedSrc,
- animatedSrc
-}) {
- return (0,external_React_.createElement)("picture", {
- className: "edit-site-welcome-guide__image"
- }, (0,external_React_.createElement)("source", {
- srcSet: nonAnimatedSrc,
- media: "(prefers-reduced-motion: reduce)"
- }), (0,external_React_.createElement)("img", {
- src: animatedSrc,
- width: "312",
- height: "240",
- alt: ""
- }));
-}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js
/**
- * WordPress dependencies
+ * Internal dependencies
*/
@@ -35387,131 +24379,177 @@ function WelcomeGuideImage({
-/**
- * Internal dependencies
- */
-function WelcomeGuideEditor() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), []);
- if (!isActive) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide guide-editor",
- contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'),
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuide'),
- pages: [{
- image: (0,external_React_.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
- }),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (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.'), {
- StylesIconImage: (0,external_React_.createElement)("img", {
- alt: (0,external_wp_i18n_namespaceObject.__)('styles'),
- 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"
- })
- })))
- }]
- });
-}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js
-/**
- * WordPress dependencies
- */
-/**
- * Internal dependencies
- */
-function WelcomeGuideStyles() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+
+
+
+const {
+ Editor,
+ BackButton
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const {
+ useHistory: editor_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const {
+ BlockKeyboardShortcuts
+} = lock_unlock_unlock(external_wp_blockLibrary_namespaceObject.privateApis);
+function EditSiteEditor({
+ isLoading
+}) {
const {
- isActive,
- isStylesOpen
+ editedPostType,
+ editedPostId,
+ contextPostType,
+ contextPostId,
+ editorMode,
+ canvasMode,
+ isEditingPage,
+ supportsGlobalStyles,
+ showIconLabels,
+ editorCanvasView,
+ currentPostIsTrashed
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const sidebar = select(store).getActiveComplementaryArea(store_store.name);
+ const {
+ getEditedPostContext,
+ getCanvasMode,
+ isPage,
+ getEditedPostType,
+ getEditedPostId
+ } = lock_unlock_unlock(select(store));
+ const {
+ get
+ } = select(external_wp_preferences_namespaceObject.store);
+ const {
+ getCurrentTheme
+ } = select(external_wp_coreData_namespaceObject.store);
+ const {
+ getEditorMode
+ } = select(external_wp_editor_namespaceObject.store);
+ const _context = getEditedPostContext();
+
+ // The currently selected entity to display.
+ // Typically template or template part in the site editor.
return {
- isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'),
- isStylesOpen: sidebar === 'edit-site/global-styles'
+ editedPostType: getEditedPostType(),
+ editedPostId: getEditedPostId(),
+ contextPostType: _context?.postId ? _context.postType : undefined,
+ contextPostId: _context?.postId ? _context.postId : undefined,
+ editorMode: getEditorMode(),
+ canvasMode: getCanvasMode(),
+ isEditingPage: isPage(),
+ supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
+ showIconLabels: get('core', 'showIconLabels'),
+ editorCanvasView: lock_unlock_unlock(select(store)).getEditorCanvasContainerView(),
+ currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash'
};
}, []);
- if (!isActive || !isStylesOpen) {
- return null;
- }
- const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide guide-styles",
- contentLabel: welcomeLabel,
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'),
- pages: [{
- image: (0,external_React_.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
- }),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, welcomeLabel), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (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.')))
- }, {
- image: (0,external_React_.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
- }),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (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!')))
- }, {
- image: (0,external_React_.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
+ use_editor_title();
+ const _isPreviewingTheme = isPreviewingTheme();
+ const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
+ const iframeProps = useEditorIframeProps();
+ const isViewMode = canvasMode === 'view';
+ const isEditMode = canvasMode === 'edit';
+ const showVisualEditor = isViewMode || editorMode === 'visual';
+ const postWithTemplate = !!contextPostId;
+ const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress');
+ const settings = useSpecificEditorSettings();
+ const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, {
+ // Forming a "block formatting context" to prevent margin collapsing.
+ // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
+
+ css: `body{${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
+ }], [settings.styles, canvasMode, currentPostIsTrashed]);
+ const {
+ setCanvasMode
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+ const {
+ createSuccessNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const history = editor_useHistory();
+ const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => {
+ switch (actionId) {
+ case 'move-to-trash':
+ case 'delete-post':
+ {
+ history.push({
+ postType: items[0].type
+ });
+ }
+ break;
+ case 'duplicate-post':
+ {
+ const newItem = items[0];
+ const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Title of the created post e.g: "Post 1".
+ (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), {
+ type: 'snackbar',
+ id: 'duplicate-post-action',
+ actions: [{
+ label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
+ onClick: () => {
+ history.push({
+ postId: newItem.id,
+ postType: newItem.type,
+ canvas: 'edit'
+ });
+ }
+ }]
+ });
+ }
+ break;
+ }
+ }, [history, createSuccessNotice]);
+ const isReady = !isLoading;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), showVisualEditor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartConverter, {}), !isReady ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, {
+ id: loadingProgressId
+ }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {}), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, {
+ postType: postWithTemplate ? contextPostType : editedPostType,
+ postId: postWithTemplate ? contextPostId : editedPostId,
+ templateId: postWithTemplate ? editedPostId : undefined,
+ settings: settings,
+ className: dist_clsx('edit-site-editor__editor-interface', {
+ 'show-icon-labels': showIconLabels
}),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (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.')))
- }, {
- image: (0,external_React_.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
- animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
+ styles: styles,
+ enableRegionNavigation: false,
+ customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, {
+ size: "compact"
}),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site?'), ' ', (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/')
- }, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.'))))
- }]
+ customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}),
+ forceDisableBlockTools: !hasDefaultEditorCanvasView,
+ title: !hasDefaultEditorCanvasView ? getEditorCanvasContainerTitle(editorCanvasView) : undefined,
+ iframeProps: iframeProps,
+ onActionPerformed: onActionPerformed,
+ extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}),
+ children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, {
+ children: ({
+ length
+ }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'),
+ className: "edit-site-layout__view-mode-toggle",
+ onClick: () => setCanvasMode('view'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, {
+ className: "edit-site-layout__view-mode-toggle-icon"
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})]
+ })]
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/pagination.js
/**
* WordPress dependencies
*/
@@ -35524,456 +24562,313 @@ function WelcomeGuideStyles() {
* Internal dependencies
*/
-function WelcomeGuidePage() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage');
- const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide');
- const {
- isPage
- } = select(store_store);
- return isPageActive && !isEditorActive && isPage();
- }, []);
- if (!isVisible) {
+
+const pagination_Pagination = (0,external_wp_element_namespaceObject.memo)(function Pagination({
+ view,
+ onChangeView,
+ paginationInfo: {
+ totalItems = 0,
+ totalPages
+ }
+}) {
+ var _view$page;
+ if (!totalItems || !totalPages) {
return null;
}
- const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide guide-page",
- contentLabel: heading,
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'),
- pages: [{
- image: (0,external_React_.createElement)("video", {
- className: "edit-site-welcome-guide__video",
- autoPlay: true,
- loop: true,
- muted: true,
- width: "312",
- height: "240"
- }, (0,external_React_.createElement)("source", {
- src: "https://s.w.org/images/block-editor/editing-your-page.mp4",
- type: "video/mp4"
- })),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, heading), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.')))
- }]
+ const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1;
+ return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ expanded: false,
+ spacing: 6,
+ justify: "end",
+ className: "dataviews-pagination",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ expanded: false,
+ spacing: 2,
+ className: "dataviews-pagination__page-selection",
+ children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Total number of pages.
+ (0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
+ CurrentPageControl: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
+ value: view.page?.toString(),
+ options: Array.from(Array(totalPages)).map((_, i) => {
+ const page = i + 1;
+ return {
+ value: page.toString(),
+ label: page.toString()
+ };
+ }),
+ onChange: newValue => {
+ onChangeView({
+ ...view,
+ page: +newValue
+ });
+ },
+ size: "compact",
+ __nextHasNoMarginBottom: true
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ expanded: false,
+ spacing: 1,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ onClick: () => onChangeView({
+ ...view,
+ page: currentPage - 1
+ }),
+ disabled: currentPage === 1,
+ __experimentalIsFocusable: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
+ icon: chevron_left,
+ showTooltip: true,
+ size: "compact",
+ tooltipPosition: "top"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ onClick: () => onChangeView({
+ ...view,
+ page: currentPage + 1
+ }),
+ disabled: currentPage >= totalPages,
+ __experimentalIsFocusable: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
+ icon: chevron_right,
+ showTooltip: true,
+ size: "compact",
+ tooltipPosition: "top"
+ })]
+ })]
});
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js
+});
+/* harmony default export */ const pagination = (pagination_Pagination);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
+const {
+ lock: lock_unlock_lock,
+ unlock: build_module_lock_unlock_unlock
+} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/dataviews');
-
-
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/constants.js
/**
- * Internal dependencies
+ * WordPress dependencies
*/
-function WelcomeGuideTemplate() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const isTemplateActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideTemplate');
- const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide');
- const {
- isPage
- } = select(store_store);
- const {
- getCurrentPostType
- } = select(external_wp_editor_namespaceObject.store);
- return isTemplateActive && !isEditorActive && isPage() && getCurrentPostType() === 'wp_template';
- }, []);
- if (!isVisible) {
- return null;
- }
- const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide guide-template",
- contentLabel: heading,
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'),
- pages: [{
- image: (0,external_React_.createElement)("video", {
- className: "edit-site-welcome-guide__video",
- autoPlay: true,
- loop: true,
- muted: true,
- width: "312",
- height: "240"
- }, (0,external_React_.createElement)("source", {
- src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
- type: "video/mp4"
- })),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, heading), (0,external_React_.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.')))
- }]
- });
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js
/**
* Internal dependencies
*/
+// Filter operators.
+const constants_OPERATOR_IS = 'is';
+const constants_OPERATOR_IS_NOT = 'isNot';
+const constants_OPERATOR_IS_ANY = 'isAny';
+const constants_OPERATOR_IS_NONE = 'isNone';
+const OPERATOR_IS_ALL = 'isAll';
+const OPERATOR_IS_NOT_ALL = 'isNotAll';
+const ALL_OPERATORS = [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL];
+const OPERATORS = {
+ [constants_OPERATOR_IS]: {
+ key: 'is-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is')
+ },
+ [constants_OPERATOR_IS_NOT]: {
+ key: 'is-not-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is not')
+ },
+ [constants_OPERATOR_IS_ANY]: {
+ key: 'is-any-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is any')
+ },
+ [constants_OPERATOR_IS_NONE]: {
+ key: 'is-none-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is none')
+ },
+ [OPERATOR_IS_ALL]: {
+ key: 'is-all-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is all')
+ },
+ [OPERATOR_IS_NOT_ALL]: {
+ key: 'is-not-all-filter',
+ label: (0,external_wp_i18n_namespaceObject.__)('Is not all')
+ }
+};
+const SORTING_DIRECTIONS = ['asc', 'desc'];
+const sortArrows = {
+ asc: '↑',
+ desc: '↓'
+};
+const sortValues = {
+ asc: 'ascending',
+ desc: 'descending'
+};
+const sortLabels = {
+ asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'),
+ desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending')
+};
+// View layouts.
+const constants_LAYOUT_TABLE = 'table';
+const constants_LAYOUT_GRID = 'grid';
+const constants_LAYOUT_LIST = 'list';
-
-function WelcomeGuide() {
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(WelcomeGuideEditor, null), (0,external_React_.createElement)(WelcomeGuideStyles, null), (0,external_React_.createElement)(WelcomeGuidePage, null), (0,external_React_.createElement)(WelcomeGuideTemplate, null));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/start-template-options/index.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-table.js
/**
* WordPress dependencies
*/
+const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"
+ })
+});
+/* harmony default export */ const block_table = (blockTable);
-
-
-
-
-
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
/**
- * Internal dependencies
+ * WordPress dependencies
*/
-function useFallbackTemplateContent(slug, isCustom = false) {
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord,
- getDefaultTemplateId
- } = select(external_wp_coreData_namespaceObject.store);
- const templateId = getDefaultTemplateId({
- slug,
- is_custom: isCustom,
- ignore_empty: true
- });
- return templateId ? getEntityRecord('postType', constants_TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined;
- }, [slug, isCustom]);
-}
-function useStartPatterns(fallbackContent) {
- const {
- slug,
- patterns
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const {
- getEntityRecord,
- getBlockPatterns
- } = select(external_wp_coreData_namespaceObject.store);
- const postId = getEditedPostId();
- const postType = getEditedPostType();
- const record = getEntityRecord('postType', postType, postId);
- return {
- slug: record.slug,
- patterns: getBlockPatterns()
- };
- }, []);
- const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet);
-
- // Duplicated from packages/block-library/src/pattern/edit.js.
- function injectThemeAttributeInBlockTemplateContent(block) {
- if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) {
- block.innerBlocks = block.innerBlocks.map(innerBlock => {
- if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) {
- innerBlock.attributes.theme = currentThemeStylesheet;
- }
- return innerBlock;
- });
- }
- if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
- block.attributes.theme = currentThemeStylesheet;
- }
- return block;
- }
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- // filter patterns that are supposed to be used in the current template being edited.
- return [{
- name: 'fallback',
- blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent),
- title: (0,external_wp_i18n_namespaceObject.__)('Fallback content')
- }, ...patterns.filter(pattern => {
- return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType));
- }).map(pattern => {
- return {
- ...pattern,
- blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block))
- };
- })];
- }, [fallbackContent, slug, patterns]);
-}
-function PatternSelection({
- fallbackContent,
- onChoosePattern,
- postType
-}) {
- const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType);
- const blockPatterns = useStartPatterns(fallbackContent);
- const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
- blockPatterns: blockPatterns,
- shownPatterns: shownBlockPatterns,
- onClickPattern: (pattern, blocks) => {
- onChange(blocks, {
- selection: undefined
- });
- onChoosePattern();
- }
- });
-}
-function StartModal({
- slug,
- isCustom,
- onClose,
- postType
-}) {
- const fallbackContent = useFallbackTemplateContent(slug, isCustom);
- if (!fallbackContent) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
- className: "edit-site-start-template-options__modal",
- title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
- focusOnMount: "firstElement",
- onRequestClose: onClose,
- isFullScreen: true
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-start-template-options__modal-content"
- }, (0,external_React_.createElement)(PatternSelection, {
- fallbackContent: fallbackContent,
- slug: slug,
- isCustom: isCustom,
- postType: postType,
- onChoosePattern: () => {
- onClose();
- }
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "edit-site-start-template-options__modal__actions",
- justify: "flex-end",
- expanded: false
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: onClose
- }, (0,external_wp_i18n_namespaceObject.__)('Skip')))));
-}
-const START_TEMPLATE_MODAL_STATES = {
- INITIAL: 'INITIAL',
- CLOSED: 'CLOSED'
-};
-function StartTemplateOptions() {
- const [modalState, setModalState] = (0,external_wp_element_namespaceObject.useState)(START_TEMPLATE_MODAL_STATES.INITIAL);
- const {
- shouldOpenModal,
- slug,
- isCustom,
- postType
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const _postType = getEditedPostType();
- const postId = getEditedPostId();
- const {
- getEditedEntityRecord,
- hasEditsForEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const templateRecord = getEditedEntityRecord('postType', _postType, postId);
- const hasEdits = hasEditsForEntityRecord('postType', _postType, postId);
- return {
- shouldOpenModal: !hasEdits && '' === templateRecord.content && constants_TEMPLATE_POST_TYPE === _postType && !select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'),
- slug: templateRecord.slug,
- isCustom: templateRecord.is_custom,
- postType: _postType
- };
- }, []);
- if (modalState === START_TEMPLATE_MODAL_STATES.INITIAL && !shouldOpenModal || modalState === START_TEMPLATE_MODAL_STATES.CLOSED) {
- return null;
- }
- return (0,external_React_.createElement)(StartModal, {
- slug: slug,
- isCustom: isCustom,
- postType: postType,
- onClose: () => setModalState(START_TEMPLATE_MODAL_STATES.CLOSED)
- });
-}
+const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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",
+ fillRule: "evenodd",
+ clipRule: "evenodd"
+ })
+});
+/* harmony default export */ const library_category = (category);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js
/**
* WordPress dependencies
*/
+const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"
+ })
+});
+/* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL);
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js
/**
- * Internal dependencies
+ * WordPress dependencies
*/
-const {
- useGlobalStylesOutput: global_styles_renderer_useGlobalStylesOutput
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function useGlobalStylesRenderer() {
- const [styles, settings] = global_styles_renderer_useGlobalStylesOutput();
- const {
- getSettings
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const {
- updateSettings
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- var _currentStoreSettings;
- if (!styles || !settings) {
- return;
- }
- const currentStoreSettings = getSettings();
- const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles);
- updateSettings({
- ...currentStoreSettings,
- styles: [...nonGlobalStyles, ...styles],
- __experimentalFeatures: settings
- });
- }, [styles, settings, updateSettings, getSettings]);
-}
-function GlobalStylesRenderer() {
- useGlobalStylesRenderer();
- return null;
-}
+const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
+ })
+});
+/* harmony default export */ const format_list_bullets = (formatListBullets);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/funnel.js
/**
* WordPress dependencies
*/
+const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"
+ })
+});
+/* harmony default export */ const library_funnel = (funnel);
-
-
-
-
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unseen.js
/**
- * Internal dependencies
+ * WordPress dependencies
*/
-const {
- useLocation: use_title_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function useTitle(title) {
- const location = use_title_useLocation();
- const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []);
- const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- isInitialLocationRef.current = false;
- }, [location]);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // Don't update or announce the title for initial page load.
- if (isInitialLocationRef.current) {
- return;
- }
- if (title && siteTitle) {
- // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
- const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
- (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s ‹ Editor — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle));
- document.title = formattedTitle;
- // Announce title on route change for screen readers.
- (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive');
- }
- }, [title, siteTitle, location]);
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js
+const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M4.67 10.664s-2.09 1.11-2.917 1.582l.494.87 1.608-.914.002.002c.343.502.86 1.17 1.563 1.84.348.33.742.663 1.185.976L5.57 16.744l.858.515 1.02-1.701a9.1 9.1 0 0 0 4.051 1.18V19h1v-2.263a9.1 9.1 0 0 0 4.05-1.18l1.021 1.7.858-.514-1.034-1.723c.442-.313.837-.646 1.184-.977.703-.669 1.22-1.337 1.563-1.839l.002-.003 1.61.914.493-.87c-1.75-.994-2.918-1.58-2.918-1.58l-.003.005a8.29 8.29 0 0 1-.422.689 10.097 10.097 0 0 1-1.36 1.598c-1.218 1.16-3.042 2.293-5.544 2.293-2.503 0-4.327-1.132-5.546-2.293a10.099 10.099 0 0 1-1.359-1.599 8.267 8.267 0 0 1-.422-.689l-.003-.005Z"
+ })
+});
+/* harmony default export */ const library_unseen = (unseen);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/single-selection-checkbox.js
/**
* WordPress dependencies
*/
-
-
/**
* Internal dependencies
*/
-
-const {
- ProgressBar: canvas_loader_ProgressBar,
- Theme
-} = unlock(external_wp_components_namespaceObject.privateApis);
-const {
- useGlobalStyle: canvas_loader_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-function CanvasLoader({
- id
+function SingleSelectionCheckbox({
+ selection,
+ onSelectionChange,
+ item,
+ data,
+ getItemId,
+ primaryField,
+ disabled
}) {
- var _highlightedColors$0$;
- const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text');
- const [backgroundColor] = canvas_loader_useGlobalStyle('color.background');
- const {
- highlightedColors
- } = useStylesPreviewColors();
- const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor;
- const {
- elapsed,
- total
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _selectorsByStatus$re, _selectorsByStatus$fi;
- const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus();
- const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0;
- const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0;
- return {
- elapsed: finished,
- total: finished + resolving
- };
- }, []);
- return (0,external_React_.createElement)("div", {
- className: "edit-site-canvas-loader"
- }, (0,external_React_.createElement)(Theme, {
- accent: indicatorColor,
- background: backgroundColor
- }, (0,external_React_.createElement)(canvas_loader_ProgressBar, {
- id: id,
- max: total,
- value: elapsed
- })));
+ const id = getItemId(item);
+ const isSelected = !disabled && selection.includes(id);
+ let selectionLabel;
+ if (primaryField?.getValue && item) {
+ // eslint-disable-next-line @wordpress/valid-sprintf
+ selectionLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: item title. */
+ isSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect item: %s') : (0,external_wp_i18n_namespaceObject.__)('Select item: %s'), primaryField.getValue({
+ item
+ }));
+ } else {
+ selectionLabel = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Select a new item') : (0,external_wp_i18n_namespaceObject.__)('Deselect item');
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ className: "dataviews-view-table-selection-checkbox",
+ __nextHasNoMarginBottom: true,
+ "aria-label": selectionLabel,
+ "aria-disabled": disabled,
+ checked: isSelected,
+ onChange: () => {
+ if (disabled) {
+ return;
+ }
+ if (!isSelected) {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId === id || selection.includes(itemId);
+ }));
+ } else {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId !== id && selection.includes(itemId);
+ }));
+ }
+ }
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/editor-canvas.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/item-actions.js
/**
* External dependencies
*/
-
/**
* WordPress dependencies
*/
@@ -35982,136 +24877,210 @@ function CanvasLoader({
-
-
/**
* Internal dependencies
*/
+
const {
- EditorCanvas: EditorCanvasRoot
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-function EditorCanvas({
- enableResizing,
- settings,
- children,
- ...props
+ DropdownMenuV2: item_actions_DropdownMenu,
+ DropdownMenuGroupV2: DropdownMenuGroup,
+ DropdownMenuItemV2: item_actions_DropdownMenuItem,
+ DropdownMenuItemLabelV2: item_actions_DropdownMenuItemLabel,
+ kebabCase: item_actions_kebabCase
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+function ButtonTrigger({
+ action,
+ onClick,
+ items
+}) {
+ const label = typeof action.label === 'string' ? action.label : action.label(items);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: label,
+ icon: action.icon,
+ isDestructive: action.isDestructive,
+ size: "compact",
+ onClick: onClick
+ });
+}
+function DropdownMenuItemTrigger({
+ action,
+ onClick,
+ items
+}) {
+ const label = typeof action.label === 'string' ? action.label : action.label(items);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_actions_DropdownMenuItem, {
+ onClick: onClick,
+ hideOnClick: !('RenderModal' in action),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_actions_DropdownMenuItemLabel, {
+ children: label
+ })
+ });
+}
+function ActionModal({
+ action,
+ items,
+ closeModal
+}) {
+ const label = typeof action.label === 'string' ? action.label : action.label(items);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: action.modalHeader || label,
+ __experimentalHideHeader: !!action.hideModalHeader,
+ onRequestClose: closeModal !== null && closeModal !== void 0 ? closeModal : () => {},
+ overlayClassName: `dataviews-action-modal dataviews-action-modal__${item_actions_kebabCase(action.id)}`,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, {
+ items: items,
+ closeModal: closeModal,
+ onActionStart: action.onActionStart,
+ onActionPerformed: action.onActionPerformed
+ })
+ });
+}
+function ActionWithModal({
+ action,
+ items,
+ ActionTrigger,
+ isBusy
+}) {
+ const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const actionTriggerProps = {
+ action,
+ onClick: () => {
+ setIsModalOpen(true);
+ },
+ items,
+ isBusy
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, {
+ ...actionTriggerProps
+ }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, {
+ action: action,
+ items: items,
+ closeModal: () => setIsModalOpen(false)
+ })]
+ });
+}
+function ActionsDropdownMenuGroup({
+ actions,
+ item
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuGroup, {
+ children: actions.map(action => {
+ if ('RenderModal' in action) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, {
+ action: action,
+ items: [item],
+ ActionTrigger: DropdownMenuItemTrigger
+ }, action.id);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, {
+ action: action,
+ onClick: () => action.callback([item]),
+ items: [item]
+ }, action.id);
+ })
+ });
+}
+function ItemActions({
+ item,
+ actions,
+ isCompact
}) {
const {
- hasBlocks,
- isFocusMode,
- templateType,
- canvasMode,
- isZoomOutMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getBlockCount,
- __unstableGetEditorMode
- } = select(external_wp_blockEditor_namespaceObject.store);
- const {
- getEditedPostType,
- getCanvasMode
- } = unlock(select(store_store));
- const _templateType = getEditedPostType();
+ primaryActions,
+ eligibleActions
+ } = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ // If an action is eligible for all items, doesn't need
+ // to provide the `isEligible` function.
+ const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item));
+ const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon);
return {
- templateType: _templateType,
- isFocusMode: FOCUSABLE_ENTITIES.includes(_templateType),
- isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
- canvasMode: getCanvasMode(),
- hasBlocks: !!getBlockCount()
+ primaryActions: _primaryActions,
+ eligibleActions: _eligibleActions
};
- }, []);
- const {
- setCanvasMode
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (canvasMode === 'edit') {
- setIsFocused(false);
- }
- }, [canvasMode]);
- const viewModeProps = {
- 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Editor Canvas'),
- role: 'button',
- tabIndex: 0,
- onFocus: () => setIsFocused(true),
- onBlur: () => setIsFocused(false),
- onKeyDown: event => {
- const {
- keyCode
- } = event;
- if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) {
- event.preventDefault();
- setCanvasMode('edit');
- }
+ }, [actions, item]);
+ if (isCompact) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, {
+ item: item,
+ actions: eligibleActions
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 1,
+ justify: "flex-end",
+ className: "dataviews-item-actions",
+ style: {
+ flexShrink: '0',
+ width: 'auto'
},
- onClick: () => setCanvasMode('edit'),
- readonly: true
- };
- const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
- const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;
- // Hide the appender when:
- // - In navigation focus mode (should only allow the root Nav block).
- // - In view mode (i.e. not editing).
- const showBlockAppender = isNavigationFocusMode && hasBlocks || canvasMode === 'view' ? false : undefined;
- const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, {
- // Forming a "block formatting context" to prevent margin collapsing.
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
-
- css: `.is-root-container{display:flow-root;${
- // Some themes will have `min-height: 100vh` for the root container,
- // which isn't a requirement in auto resize mode.
- enableResizing ? 'min-height:0!important;' : ''}}body{position:relative; ${canvasMode === 'view' ? 'cursor: pointer; min-height: 100vh;' : ''}}}`
- }], [settings.styles, enableResizing, canvasMode]);
- return (0,external_React_.createElement)(EditorCanvasRoot, {
- className: classnames_default()('edit-site-editor-canvas__block-list', {
- 'is-navigation-block': isTemplateTypeNavigation
+ children: [!!primaryActions.length && primaryActions.map(action => {
+ if ('RenderModal' in action) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, {
+ action: action,
+ items: [item],
+ ActionTrigger: ButtonTrigger
+ }, action.id);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, {
+ action: action,
+ onClick: () => action.callback([item]),
+ items: [item]
+ }, action.id);
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, {
+ item: item,
+ actions: eligibleActions
+ })]
+ });
+}
+function CompactItemActions({
+ item,
+ actions
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ __experimentalIsFocusable: true,
+ disabled: !actions.length,
+ className: "dataviews-all-actions-button"
}),
- renderAppender: showBlockAppender,
- styles: styles,
- iframeProps: {
- expand: isZoomOutMode,
- scale: isZoomOutMode ? 0.45 : undefined,
- frameSize: isZoomOutMode ? 100 : undefined,
- className: classnames_default()('edit-site-visual-editor__editor-canvas', {
- 'is-focused': isFocused && canvasMode === 'view'
- }),
- ...props,
- ...(canvasMode === 'view' ? viewModeProps : {})
- }
- }, children);
+ placement: "bottom-end",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, {
+ actions: actions,
+ item: item
+ })
+ });
}
-/* harmony default export */ const editor_canvas = (EditorCanvas);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/utils.js
/**
- * WordPress dependencies
+ * Internal dependencies
*/
+function sanitizeOperators(field) {
+ let operators = field.filterBy?.operators;
+ // Assign default values.
+ if (!operators || !Array.isArray(operators)) {
+ operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE];
+ }
-/**
- * Internal dependencies
- */
+ // Make sure only valid operators are used.
+ operators = operators.filter(operator => ALL_OPERATORS.includes(operator));
-const {
- useHistory: use_navigate_to_entity_record_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function useNavigateToEntityRecord() {
- const history = use_navigate_to_entity_record_useHistory();
- const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => {
- history.push({
- ...params,
- focusMode: true,
- canvas: 'edit'
- });
- }, [history]);
- return onNavigateToEntityRecord;
+ // Do not allow mixing single & multiselection operators.
+ // Remove multiselection operators if any of the single selection ones is present.
+ if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) {
+ operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator));
+ }
+ return operators;
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/bulk-actions.js
/**
* WordPress dependencies
*/
@@ -36119,9 +25088,6 @@ function useNavigateToEntityRecord() {
-
-
-
/**
* Internal dependencies
*/
@@ -36130,164 +25096,165 @@ function useNavigateToEntityRecord() {
const {
- useBlockEditorSettings
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-const {
- useLocation: use_site_editor_settings_useLocation,
- useHistory: use_site_editor_settings_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function useArchiveLabel(templateSlug) {
- const taxonomyMatches = templateSlug?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);
- let taxonomy;
- let term;
- let isAuthor = false;
- let authorSlug;
- if (taxonomyMatches) {
- // If is for a all taxonomies of a type
- if (taxonomyMatches[1]) {
- taxonomy = taxonomyMatches[2] ? taxonomyMatches[2] : taxonomyMatches[1];
- }
- // If is for a all taxonomies of a type
- else if (taxonomyMatches[3]) {
- taxonomy = taxonomyMatches[6] ? taxonomyMatches[6] : taxonomyMatches[4];
- term = taxonomyMatches[7];
- }
- taxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;
-
- //getTaxonomy( 'category' );
- //wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );
- } else {
- const authorMatches = templateSlug?.match(/^(author)$|^author-(.+)$/);
- if (authorMatches) {
- isAuthor = true;
- if (authorMatches[2]) {
- authorSlug = authorMatches[2];
- }
- }
- }
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecords,
- getTaxonomy,
- getAuthors
- } = select(external_wp_coreData_namespaceObject.store);
- let archiveTypeLabel;
- let archiveNameLabel;
- if (taxonomy) {
- archiveTypeLabel = getTaxonomy(taxonomy)?.labels?.singular_name;
- }
- if (term) {
- const records = getEntityRecords('taxonomy', taxonomy, {
- slug: term,
- per_page: 1
- });
- if (records && records[0]) {
- archiveNameLabel = records[0].name;
- }
- }
- if (isAuthor) {
- archiveTypeLabel = 'Author';
- if (authorSlug) {
- const authorRecords = getAuthors({
- slug: authorSlug
- });
- if (authorRecords && authorRecords[0]) {
- archiveNameLabel = authorRecords[0].name;
- }
- }
- }
- return {
- archiveTypeLabel,
- archiveNameLabel
- };
- }, [authorSlug, isAuthor, taxonomy, term]);
+ DropdownMenuV2: bulk_actions_DropdownMenu,
+ DropdownMenuGroupV2: bulk_actions_DropdownMenuGroup,
+ DropdownMenuItemV2: bulk_actions_DropdownMenuItem,
+ DropdownMenuSeparatorV2: DropdownMenuSeparator
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+function useHasAPossibleBulkAction(actions, item) {
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return actions.some(action => {
+ return action.supportsBulk && (!action.isEligible || action.isEligible(item));
+ });
+ }, [actions, item]);
}
-function useNavigateToPreviousEntityRecord() {
- const location = use_site_editor_settings_useLocation();
- const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
- const history = use_site_editor_settings_useHistory();
- const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType);
- const didComeFromEditorCanvas = previousLocation?.params.canvas === 'edit';
- const showBackButton = isFocusMode && didComeFromEditorCanvas;
- return showBackButton ? () => history.back() : undefined;
- // Disable reason: previousLocation changes when the component updates for any reason, not
- // just when location changes. Until this is fixed we can't add it to deps. See
- // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [location, history]);
- return goBack;
+function useSomeItemHasAPossibleBulkAction(actions, data) {
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return data.some(item => {
+ return actions.some(action => {
+ return action.supportsBulk && (!action.isEligible || action.isEligible(item));
+ });
+ });
+ }, [actions, data]);
}
-function useSpecificEditorSettings() {
- const onNavigateToEntityRecord = useNavigateToEntityRecord();
+function bulk_actions_ActionWithModal({
+ action,
+ selectedItems,
+ setActionWithModal,
+ onMenuOpenChange
+}) {
+ const eligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return selectedItems.filter(item => !action.isEligible || action.isEligible(item));
+ }, [action, selectedItems]);
const {
- templateSlug,
- canvasMode,
- settings,
- postWithTemplate
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId,
- getEditedPostContext,
- getCanvasMode,
- getSettings
- } = unlock(select(store_store));
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const usedPostType = getEditedPostType();
- const usedPostId = getEditedPostId();
- const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
- const _context = getEditedPostContext();
- return {
- templateSlug: _record.slug,
- canvasMode: getCanvasMode(),
- settings: getSettings(),
- postWithTemplate: _context?.postId
- };
- }, []);
- const archiveLabels = useArchiveLabel(templateSlug);
- const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'post-only';
- const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
- const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return {
- ...settings,
- richEditingEnabled: true,
- supportsTemplateMode: true,
- focusMode: canvasMode !== 'view',
- defaultRenderingMode,
- onNavigateToEntityRecord,
- onNavigateToPreviousEntityRecord,
- // I wonder if they should be set in the post editor too
- __experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
- __experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel
- };
- }, [settings, canvasMode, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel]);
- return defaultEditorSettings;
+ RenderModal,
+ hideModalHeader
+ } = action;
+ const onCloseModal = (0,external_wp_element_namespaceObject.useCallback)(() => {
+ setActionWithModal(undefined);
+ }, [setActionWithModal]);
+ const label = typeof action.label === 'string' ? action.label : action.label(selectedItems);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: !hideModalHeader ? label : undefined,
+ __experimentalHideHeader: !!hideModalHeader,
+ onRequestClose: onCloseModal,
+ overlayClassName: "dataviews-action-modal",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderModal, {
+ items: eligibleItems,
+ closeModal: onCloseModal,
+ onActionPerformed: () => onMenuOpenChange(false)
+ })
+ });
}
-function useSiteEditorSettings() {
- const defaultEditorSettings = useSpecificEditorSettings();
- const {
- postType,
- postId
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId
- } = unlock(select(store_store));
- const usedPostType = getEditedPostType();
- const usedPostId = getEditedPostId();
- return {
- postType: usedPostType,
- postId: usedPostId
- };
- }, []);
- return useBlockEditorSettings(defaultEditorSettings, postType, postId);
+function BulkActionItem({
+ action,
+ selectedItems,
+ setActionWithModal
+}) {
+ const eligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return selectedItems.filter(item => !action.isEligible || action.isEligible(item));
+ }, [action, selectedItems]);
+ const shouldShowModal = ('RenderModal' in action);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bulk_actions_DropdownMenuItem, {
+ disabled: eligibleItems.length === 0,
+ hideOnClick: !shouldShowModal,
+ onClick: async () => {
+ if (shouldShowModal) {
+ setActionWithModal(action);
+ } else {
+ await action.callback(eligibleItems);
+ }
+ },
+ suffix: eligibleItems.length > 0 ? eligibleItems.length : undefined,
+ children: action.label
+ }, action.id);
+}
+function ActionsMenuGroup({
+ actions,
+ selectedItems,
+ setActionWithModal
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bulk_actions_DropdownMenuGroup, {
+ children: actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionItem, {
+ action: action,
+ selectedItems: selectedItems,
+ setActionWithModal: setActionWithModal
+ }, action.id))
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuSeparator, {})]
+ });
+}
+function BulkActions({
+ data,
+ actions,
+ selection,
+ onSelectionChange,
+ getItemId
+}) {
+ const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]);
+ const [isMenuOpen, onMenuOpenChange] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [actionWithModal, setActionWithModal] = (0,external_wp_element_namespaceObject.useState)();
+ const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return data.filter(item => {
+ return bulkActions.some(action => !action.isEligible || action.isEligible(item));
+ });
+ }, [data, bulkActions]);
+ const numberSelectableItems = selectableItems.length;
+ const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item));
+ }, [selection, data, getItemId, selectableItems]);
+ const areAllSelected = selectedItems.length === numberSelectableItems;
+ if (bulkActions.length === 0) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(bulk_actions_DropdownMenu, {
+ open: isMenuOpen,
+ onOpenChange: onMenuOpenChange,
+ label: (0,external_wp_i18n_namespaceObject.__)('Bulk actions'),
+ style: {
+ minWidth: '240px'
+ },
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: "dataviews-bulk-edit-button",
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ size: "compact",
+ children: selectedItems.length ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of items. */
+ (0,external_wp_i18n_namespaceObject._n)('Edit %d item', 'Edit %d items', selectedItems.length), selectedItems.length) : (0,external_wp_i18n_namespaceObject.__)('Bulk edit')
+ }),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, {
+ actions: bulkActions,
+ setActionWithModal: setActionWithModal,
+ selectedItems: selectedItems
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(bulk_actions_DropdownMenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bulk_actions_DropdownMenuItem, {
+ disabled: areAllSelected,
+ hideOnClick: false,
+ onClick: () => {
+ onSelectionChange(selectableItems);
+ },
+ suffix: numberSelectableItems,
+ children: (0,external_wp_i18n_namespaceObject.__)('Select all')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bulk_actions_DropdownMenuItem, {
+ disabled: selection.length === 0,
+ hideOnClick: false,
+ onClick: () => {
+ onSelectionChange([]);
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Deselect')
+ })]
+ })]
+ }), actionWithModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bulk_actions_ActionWithModal, {
+ action: actionWithModal,
+ selectedItems: selectedItems,
+ setActionWithModal: setActionWithModal,
+ onMenuOpenChange: onMenuOpenChange
+ })]
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/site-editor-canvas.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-table.js
/**
* External dependencies
*/
@@ -36298,6 +25265,8 @@ function useSiteEditorSettings() {
+
+
/**
* Internal dependencies
*/
@@ -36309,204 +25278,597 @@ function useSiteEditorSettings() {
+
const {
- useLocation: site_editor_canvas_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function SiteEditorCanvas() {
- const location = site_editor_canvas_useLocation();
- const {
- templateType,
- isFocusableEntity,
- isViewMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getCanvasMode
- } = unlock(select(store_store));
- const _templateType = getEditedPostType();
- return {
- templateType: _templateType,
- isFocusableEntity: FOCUSABLE_ENTITIES.includes(_templateType),
- isViewMode: getCanvasMode() === 'view'
- };
- }, []);
- const isFocusMode = location.params.focusMode || isFocusableEntity;
- const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
- const settings = useSiteEditorSettings();
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
- const enableResizing = isFocusMode && !isViewMode &&
- // Disable resizing in mobile viewport.
- !isMobileViewport &&
- // Disable resizing when editing a template in focus mode.
- templateType !== constants_TEMPLATE_POST_TYPE;
- const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
- const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;
- const forceFullHeight = isNavigationFocusMode;
- return (0,external_React_.createElement)(editor_canvas_container.Slot, null, ([editorCanvasView]) => editorCanvasView ? (0,external_React_.createElement)("div", {
- className: "edit-site-visual-editor is-focus-mode"
- }, editorCanvasView) : (0,external_React_.createElement)("div", {
- className: classnames_default()('edit-site-visual-editor', {
- 'is-focus-mode': isFocusMode || !!editorCanvasView,
- 'is-view-mode': isViewMode
- })
- }, (0,external_React_.createElement)(resizable_editor, {
- enableResizing: enableResizing,
- height: sizes.height && !forceFullHeight ? sizes.height : '100%'
- }, (0,external_React_.createElement)(editor_canvas, {
- enableResizing: enableResizing,
- settings: settings
- }, resizeObserver))));
+ DropdownMenuV2: view_table_DropdownMenu,
+ DropdownMenuGroupV2: view_table_DropdownMenuGroup,
+ DropdownMenuItemV2: view_table_DropdownMenuItem,
+ DropdownMenuRadioItemV2: DropdownMenuRadioItem,
+ DropdownMenuItemLabelV2: view_table_DropdownMenuItemLabel,
+ DropdownMenuSeparatorV2: view_table_DropdownMenuSeparator
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+function WithDropDownMenuSeparators({
+ children
+}) {
+ return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, {
+ children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuSeparator, {}), child]
+ }, i));
}
+const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({
+ field,
+ view,
+ onChangeView,
+ onHide,
+ setOpenedFilter
+}, ref) {
+ const isHidable = field.enableHiding !== false;
+ const isSortable = field.enableSorting !== false;
+ const isSorted = view.sort?.field === field.id;
+ const operators = sanitizeOperators(field);
+ // Filter can be added:
+ // 1. If the field is not already part of a view's filters.
+ // 2. If the field meets the type and operator requirements.
+ // 3. If it's not primary. If it is, it should be already visible.
+ const canAddFilter = !view.filters?.some(_filter => field.id === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary;
+ if (!isSortable && !isHidable && !canAddFilter) {
+ return field.header;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenu, {
+ align: "start",
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ className: "dataviews-view-table-header-button",
+ ref: ref,
+ variant: "tertiary",
+ children: [field.header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ "aria-hidden": "true",
+ children: sortArrows[view.sort.direction]
+ })]
+ }),
+ style: {
+ minWidth: '240px'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithDropDownMenuSeparators, {
+ children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuGroup, {
+ children: SORTING_DIRECTIONS.map(direction => {
+ const isChecked = view.sort && isSorted && view.sort.direction === direction;
+ const value = `${field.id}-${direction}`;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuRadioItem, {
+ // All sorting radio items share the same name, so that
+ // selecting a sorting option automatically deselects the
+ // previously selected one, even if it is displayed in
+ // another submenu. The field and direction are passed via
+ // the `value` prop.
+ name: "view-table-sorting",
+ value: value,
+ checked: isChecked,
+ onChange: () => {
+ onChangeView({
+ ...view,
+ sort: {
+ field: field.id,
+ direction
+ }
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuItemLabel, {
+ children: sortLabels[direction]
+ })
+ }, value);
+ })
+ }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuItem, {
+ prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_funnel
+ }),
+ onClick: () => {
+ setOpenedFilter(field.id);
+ onChangeView({
+ ...view,
+ page: 1,
+ filters: [...(view.filters || []), {
+ field: field.id,
+ value: undefined,
+ operator: operators[0]
+ }]
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Add filter')
+ })
+ })
+ }), isHidable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuItem, {
+ prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_unseen
+ }),
+ onClick: () => {
+ onHide(field);
+ onChangeView({
+ ...view,
+ hiddenFields: view.hiddenFields.concat(field.id)
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_table_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Hide')
+ })
+ })]
+ })
+ });
+});
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js
-
-/**
- * WordPress dependencies
- */
-
-
-
-
-function ConvertToRegularBlocks({
- clientId,
- onClose
+// @ts-expect-error Lift the `Item` type argument through the forwardRef.
+const HeaderMenu = _HeaderMenu;
+function BulkSelectionCheckbox({
+ selection,
+ onSelectionChange,
+ data,
+ actions,
+ getItemId
}) {
- const {
- getBlocks
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
- const {
- replaceBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]);
- if (!canRemove) {
- return null;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
+ const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return data.filter(item => {
+ return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item)));
+ });
+ }, [data, actions]);
+ const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item));
+ const areAllSelected = selectedItems.length === selectableItems.length;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
+ className: "dataviews-view-table-selection-checkbox",
+ __nextHasNoMarginBottom: true,
+ checked: areAllSelected,
+ indeterminate: !areAllSelected && !!selectedItems.length,
+ onChange: () => {
+ if (areAllSelected) {
+ onSelectionChange([]);
+ } else {
+ onSelectionChange(selectableItems);
+ }
+ },
+ "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all')
+ });
+}
+function TableRow({
+ hasBulkActions,
+ item,
+ actions,
+ id,
+ visibleFields,
+ primaryField,
+ selection,
+ getItemId,
+ onSelectionChange,
+ data
+}) {
+ const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
+ const isSelected = hasPossibleBulkAction && selection.includes(id);
+ const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
+ const handleMouseEnter = () => {
+ setIsHovered(true);
+ };
+ const handleMouseLeave = () => {
+ setIsHovered(false);
+ };
+
+ // Will be set to true if `onTouchStart` fires. This happens before
+ // `onClick` and can be used to exclude touchscreen devices from certain
+ // behaviours.
+ const isTouchDevice = (0,external_wp_element_namespaceObject.useRef)(false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", {
+ className: dist_clsx('dataviews-view-table__row', {
+ 'is-selected': hasPossibleBulkAction && isSelected,
+ 'is-hovered': isHovered,
+ 'has-bulk-actions': hasPossibleBulkAction
+ }),
+ onMouseEnter: handleMouseEnter,
+ onMouseLeave: handleMouseLeave,
+ onTouchStart: () => {
+ isTouchDevice.current = true;
+ },
onClick: () => {
- replaceBlocks(clientId, getBlocks(clientId));
- onClose();
+ if (!hasPossibleBulkAction) {
+ return;
+ }
+ if (!isTouchDevice.current && document.getSelection()?.type !== 'Range') {
+ if (!isSelected) {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId === id || selection.includes(itemId);
+ }));
+ } else {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId !== id && selection.includes(itemId);
+ }));
+ }
+ }
+ },
+ children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", {
+ className: "dataviews-view-table__checkbox-column",
+ style: {
+ width: '1%'
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-view-table__cell-content-wrapper",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleSelectionCheckbox, {
+ item: item,
+ selection: selection,
+ onSelectionChange: onSelectionChange,
+ getItemId: getItemId,
+ data: data,
+ primaryField: primaryField,
+ disabled: !hasPossibleBulkAction
+ })
+ })
+ }), visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", {
+ style: {
+ width: field.width || undefined,
+ minWidth: field.minWidth || undefined,
+ maxWidth: field.maxWidth || undefined
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('dataviews-view-table__cell-content-wrapper', {
+ 'dataviews-view-table__primary-field': primaryField?.id === field.id
+ }),
+ children: field.render({
+ item
+ })
+ })
+ }, field.id)), !!actions?.length &&
+ /*#__PURE__*/
+ // Disable reason: we are not making the element interactive,
+ // but preventing any click events from bubbling up to the
+ // table row. This allows us to add a click handler to the row
+ // itself (to toggle row selection) without erroneously
+ // intercepting click events from ItemActions.
+ /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
+ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", {
+ className: "dataviews-view-table__actions-column",
+ onClick: e => e.stopPropagation(),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, {
+ item: item,
+ actions: actions
+ })
+ })
+ /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */]
+ });
+}
+function ViewTable({
+ actions,
+ data,
+ fields,
+ getItemId,
+ isLoading = false,
+ onChangeView,
+ onSelectionChange,
+ selection,
+ setOpenedFilter,
+ view
+}) {
+ const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map());
+ const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)();
+ const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)();
+ const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (headerMenuToFocusRef.current) {
+ headerMenuToFocusRef.current.focus();
+ headerMenuToFocusRef.current = undefined;
}
- }, (0,external_wp_i18n_namespaceObject.__)('Detach'));
+ });
+ const tableNoticeId = (0,external_wp_element_namespaceObject.useId)();
+ if (nextHeaderMenuToFocus) {
+ // If we need to force focus, we short-circuit rendering here
+ // to prevent any additional work while we handle that.
+ // Clearing out the focus directive is necessary to make sure
+ // future renders don't cause unexpected focus jumps.
+ headerMenuToFocusRef.current = nextHeaderMenuToFocus;
+ setNextHeaderMenuToFocus(undefined);
+ return;
+ }
+ const onHide = field => {
+ const hidden = headerMenuRefs.current.get(field.id);
+ const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined;
+ setNextHeaderMenuToFocus(fallback?.node);
+ };
+ const visibleFields = fields.filter(field => !view.hiddenFields.includes(field.id) && ![view.layout.mediaField].includes(field.id));
+ const hasData = !!data?.length;
+ const primaryField = fields.find(field => field.id === view.layout.primaryField);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", {
+ className: "dataviews-view-table",
+ "aria-busy": isLoading,
+ "aria-describedby": tableNoticeId,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", {
+ className: "dataviews-view-table__row",
+ children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", {
+ className: "dataviews-view-table__checkbox-column",
+ style: {
+ width: '1%'
+ },
+ "data-field-id": "selection",
+ scope: "col",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, {
+ selection: selection,
+ onSelectionChange: onSelectionChange,
+ data: data,
+ actions: actions,
+ getItemId: getItemId
+ })
+ }), visibleFields.map((field, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", {
+ style: {
+ width: field.width || undefined,
+ minWidth: field.minWidth || undefined,
+ maxWidth: field.maxWidth || undefined
+ },
+ "data-field-id": field.id,
+ "aria-sort": view.sort?.field === field.id ? sortValues[view.sort.direction] : undefined,
+ scope: "col",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeaderMenu, {
+ ref: node => {
+ if (node) {
+ headerMenuRefs.current.set(field.id, {
+ node,
+ fallback: visibleFields[index > 0 ? index - 1 : 1]?.id
+ });
+ } else {
+ headerMenuRefs.current.delete(field.id);
+ }
+ },
+ field: field,
+ view: view,
+ onChangeView: onChangeView,
+ onHide: onHide,
+ setOpenedFilter: setOpenedFilter
+ })
+ }, field.id)), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", {
+ "data-field-id": "actions",
+ className: "dataviews-view-table__actions-column",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "dataviews-view-table-header",
+ children: (0,external_wp_i18n_namespaceObject.__)('Actions')
+ })
+ })]
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", {
+ children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, {
+ item: item,
+ hasBulkActions: hasBulkActions,
+ actions: actions,
+ id: getItemId(item) || index.toString(),
+ visibleFields: visibleFields,
+ primaryField: primaryField,
+ selection: selection,
+ getItemId: getItemId,
+ onSelectionChange: onSelectionChange,
+ data: data
+ }, getItemId(item)))
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx({
+ 'dataviews-loading': isLoading,
+ 'dataviews-no-results': !hasData && !isLoading
+ }),
+ id: tableNoticeId,
+ children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results')
+ })
+ })]
+ });
}
+/* harmony default export */ const view_table = (ViewTable);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-grid.js
/**
- * WordPress dependencies
+ * External dependencies
*/
-
-
-
-
-
-
-
/**
- * Internal dependencies
+ * WordPress dependencies
*/
-function ConvertToTemplatePart({
- clientIds,
- blocks
-}) {
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- replaceBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- canCreate
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- supportsTemplatePartsMode
- } = select(store_store).getSettings();
- return {
- canCreate: !supportsTemplatePartsMode
- };
- }, []);
- if (!canCreate) {
- return null;
- }
- const onConvert = async templatePart => {
- replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', {
- slug: templatePart.slug,
- theme: templatePart.theme
- }));
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), {
- type: 'snackbar'
- });
-
- // The modal and this component will be unmounted because of `replaceBlocks` above,
- // so no need to call `closeModal` or `onClose`.
- };
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: symbol_filled,
- onClick: () => {
- setIsModalOpen(true);
- },
- "aria-expanded": isModalOpen,
- "aria-haspopup": "dialog"
- }, (0,external_wp_i18n_namespaceObject.__)('Create template part')), isModalOpen && (0,external_React_.createElement)(CreateTemplatePartModal, {
- closeModal: () => {
- setIsModalOpen(false);
- },
- blocks: blocks,
- onCreate: onConvert
- }));
-}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js
/**
- * WordPress dependencies
+ * Internal dependencies
*/
-/**
- * Internal dependencies
- */
-function TemplatePartConverter() {
- return (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({
- selectedClientIds,
- onClose
- }) => (0,external_React_.createElement)(TemplatePartConverterMenuItem, {
- clientIds: selectedClientIds,
- onClose: onClose
- }));
+
+function GridItem({
+ selection,
+ data,
+ onSelectionChange,
+ getItemId,
+ item,
+ actions,
+ mediaField,
+ primaryField,
+ visibleFields,
+ badgeFields,
+ columnFields
+}) {
+ const hasBulkAction = useHasAPossibleBulkAction(actions, item);
+ const id = getItemId(item);
+ const isSelected = selection.includes(id);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 0,
+ className: dist_clsx('dataviews-view-grid__card', {
+ 'is-selected': hasBulkAction && isSelected
+ }),
+ onClickCapture: event => {
+ if (event.ctrlKey || event.metaKey) {
+ event.stopPropagation();
+ event.preventDefault();
+ if (!hasBulkAction) {
+ return;
+ }
+ if (!isSelected) {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId === id || selection.includes(itemId);
+ }));
+ } else {
+ onSelectionChange(data.filter(_item => {
+ const itemId = getItemId?.(_item);
+ return itemId !== id && selection.includes(itemId);
+ }));
+ }
+ }
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-view-grid__media",
+ children: mediaField?.render({
+ item
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ className: "dataviews-view-grid__title-actions",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleSelectionCheckbox, {
+ item: item,
+ selection: selection,
+ onSelectionChange: onSelectionChange,
+ getItemId: getItemId,
+ data: data,
+ primaryField: primaryField,
+ disabled: !hasBulkAction
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "dataviews-view-grid__primary-field",
+ children: primaryField?.render({
+ item
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, {
+ item: item,
+ actions: actions,
+ isCompact: true
+ })]
+ }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "dataviews-view-grid__badge-fields",
+ spacing: 2,
+ wrap: true,
+ alignment: "top",
+ justify: "flex-start",
+ children: badgeFields.map(field => {
+ const renderedValue = field.render({
+ item
+ });
+ if (!renderedValue) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "dataviews-view-grid__field-value",
+ children: renderedValue
+ }, field.id);
+ })
+ }), !!visibleFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "dataviews-view-grid__fields",
+ spacing: 3,
+ children: visibleFields.map(field => {
+ const renderedValue = field.render({
+ item
+ });
+ if (!renderedValue) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ className: dist_clsx('dataviews-view-grid__field', columnFields?.includes(field.id) ? 'is-column' : 'is-row'),
+ gap: 1,
+ justify: "flex-start",
+ expanded: true,
+ style: {
+ height: 'auto'
+ },
+ direction: columnFields?.includes(field.id) ? 'column' : 'row',
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "dataviews-view-grid__field-name",
+ children: field.header
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "dataviews-view-grid__field-value",
+ style: {
+ maxHeight: 'none'
+ },
+ children: renderedValue
+ })]
+ })
+ }, field.id);
+ })
+ })]
+ }, id);
}
-function TemplatePartConverterMenuItem({
- clientIds,
- onClose
+function ViewGrid({
+ actions,
+ data,
+ fields,
+ getItemId,
+ isLoading,
+ onSelectionChange,
+ selection,
+ view
}) {
- const blocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds), [clientIds]);
-
- // Allow converting a single template part to standard blocks.
- if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') {
- return (0,external_React_.createElement)(ConvertToRegularBlocks, {
- clientId: clientIds[0],
- onClose: onClose
- });
- }
- return (0,external_React_.createElement)(ConvertToTemplatePart, {
- clientIds: clientIds,
- blocks: blocks
+ const mediaField = fields.find(field => field.id === view.layout.mediaField);
+ const primaryField = fields.find(field => field.id === view.layout.primaryField);
+ const {
+ visibleFields,
+ badgeFields
+ } = fields.reduce((accumulator, field) => {
+ if (view.hiddenFields.includes(field.id) || [view.layout.mediaField, view.layout.primaryField].includes(field.id)) {
+ return accumulator;
+ }
+ // If the field is a badge field, add it to the badgeFields array
+ // otherwise add it to the rest visibleFields array.
+ const key = view.layout.badgeFields?.includes(field.id) ? 'badgeFields' : 'visibleFields';
+ accumulator[key].push(field);
+ return accumulator;
+ }, {
+ visibleFields: [],
+ badgeFields: []
+ });
+ const hasData = !!data?.length;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, {
+ gap: 8,
+ columns: 2,
+ alignment: "top",
+ className: "dataviews-view-grid",
+ "aria-busy": isLoading,
+ children: data.map(item => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, {
+ selection: selection,
+ data: data,
+ onSelectionChange: onSelectionChange,
+ getItemId: getItemId,
+ item: item,
+ actions: actions,
+ mediaField: mediaField,
+ primaryField: primaryField,
+ visibleFields: visibleFields,
+ badgeFields: badgeFields,
+ columnFields: view.layout.columnFields
+ }, getItemId(item));
+ })
+ }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx({
+ 'dataviews-loading': isLoading,
+ 'dataviews-no-results': !isLoading
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results')
+ })
+ })]
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-list.js
/**
* External dependencies
*/
+// Import CompositeStore type, which is not exported from @wordpress/components.
+// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
@@ -36517,10 +25879,6 @@ function TemplatePartConverterMenuItem({
-
-
-
-
/**
* Internal dependencies
*/
@@ -36528,254 +25886,300 @@ function TemplatePartConverterMenuItem({
-
-
-
-
-
-
-
-
-
-
-
-
const {
- BlockRemovalWarningModal
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const {
- ExperimentalEditorProvider: EditorProvider,
- InserterSidebar,
- ListViewSidebar
-} = unlock(external_wp_editor_namespaceObject.privateApis);
-const interfaceLabels = {
- /* translators: accessibility text for the editor content landmark region. */
- body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
- /* translators: accessibility text for the editor settings landmark region. */
- sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
- /* translators: accessibility text for the editor publish landmark region. */
- actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
- /* translators: accessibility text for the editor footer landmark region. */
- footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
-};
-
-// Prevent accidental removal of certain blocks, asking the user for
-// confirmation.
-const blockRemovalRules = {
- 'core/query': (0,external_wp_i18n_namespaceObject.__)('Query Loop displays a list of posts or pages.'),
- 'core/post-content': (0,external_wp_i18n_namespaceObject.__)('Post Content displays the content of a post or page.'),
- 'core/post-template': (0,external_wp_i18n_namespaceObject.__)('Post Template displays each post or page in a Query Loop.'),
- 'bindings/core/pattern-overrides': (0,external_wp_i18n_namespaceObject.__)('Blocks from synced patterns that can have overriden content.')
-};
-function Editor({
- isLoading
+ useCompositeStoreV2: view_list_useCompositeStore,
+ CompositeV2: view_list_Composite,
+ CompositeItemV2: view_list_CompositeItem,
+ CompositeRowV2: CompositeRow,
+ DropdownMenuV2: view_list_DropdownMenu
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+function ListItem({
+ actions,
+ id,
+ isSelected,
+ item,
+ mediaField,
+ onSelect,
+ primaryField,
+ store,
+ visibleFields
}) {
+ const itemRef = (0,external_wp_element_namespaceObject.useRef)(null);
+ const labelId = `${id}-label`;
+ const descriptionId = `${id}-description`;
+ const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
+ const handleMouseEnter = () => {
+ setIsHovered(true);
+ };
+ const handleMouseLeave = () => {
+ setIsHovered(false);
+ };
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (isSelected) {
+ itemRef.current?.scrollIntoView({
+ behavior: 'auto',
+ block: 'nearest',
+ inline: 'nearest'
+ });
+ }
+ }, [isSelected]);
const {
- record: editedPost,
- getTitle,
- isLoaded: hasLoadedPost
- } = useEditedEntityRecord();
- const {
- type: editedPostType
- } = editedPost;
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const {
- context,
- contextPost,
- editorMode,
- canvasMode,
- blockEditorMode,
- isRightSidebarOpen,
- isInserterOpen,
- isListViewOpen,
- isDistractionFree,
- showIconLabels,
- showBlockBreadcrumbs,
- postTypeLabel
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- get
- } = select(external_wp_preferences_namespaceObject.store);
- const {
- getEditedPostContext,
- getEditorMode,
- getCanvasMode
- } = unlock(select(store_store));
- const {
- __unstableGetEditorMode
- } = select(external_wp_blockEditor_namespaceObject.store);
- const {
- getActiveComplementaryArea
- } = select(store);
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- isInserterOpened,
- isListViewOpened,
- getPostTypeLabel
- } = select(external_wp_editor_namespaceObject.store);
- const _context = getEditedPostContext();
-
- // The currently selected entity to display.
- // Typically template or template part in the site editor.
+ primaryAction,
+ eligibleActions
+ } = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ // If an action is eligible for all items, doesn't need
+ // to provide the `isEligible` function.
+ const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item));
+ const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon);
return {
- context: _context,
- contextPost: _context?.postId ? getEntityRecord('postType', _context.postType, _context.postId) : undefined,
- editorMode: getEditorMode(),
- canvasMode: getCanvasMode(),
- blockEditorMode: __unstableGetEditorMode(),
- isInserterOpen: isInserterOpened(),
- isListViewOpen: isListViewOpened(),
- isRightSidebarOpen: getActiveComplementaryArea(store_store.name),
- isDistractionFree: get('core', 'distractionFree'),
- showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
- showIconLabels: get('core', 'showIconLabels'),
- postTypeLabel: getPostTypeLabel()
+ primaryAction: _primaryActions?.[0],
+ eligibleActions: _eligibleActions
};
- }, []);
- const isViewMode = canvasMode === 'view';
- const isEditMode = canvasMode === 'edit';
- const showVisualEditor = isViewMode || editorMode === 'visual';
- const shouldShowBlockBreadcrumbs = !isDistractionFree && showBlockBreadcrumbs && isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
- const shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;
- const shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;
- const secondarySidebarLabel = isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
- const postWithTemplate = !!context?.postId;
- let title;
- if (hasLoadedPost) {
- var _POST_TYPE_LABELS$edi;
- title = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
- (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPostType]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[constants_TEMPLATE_POST_TYPE]);
- }
-
- // Only announce the title once the editor is ready to prevent "Replace"
- // action in <URLQueryController> from double-announcing.
- useTitle(hasLoadedPost && title);
- const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress');
- const settings = useSpecificEditorSettings();
- const isReady = !isLoading && (postWithTemplate && !!contextPost && !!editedPost || !postWithTemplate && !!editedPost);
- return (0,external_React_.createElement)(external_React_.Fragment, null, !isReady ? (0,external_React_.createElement)(CanvasLoader, {
- id: loadingProgressId
- }) : null, isEditMode && (0,external_React_.createElement)(WelcomeGuide, null), hasLoadedPost && !editedPost && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
- status: "warning",
- isDismissible: false
- }, (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), isReady && (0,external_React_.createElement)(EditorProvider, {
- post: postWithTemplate ? contextPost : editedPost,
- __unstableTemplate: postWithTemplate ? editedPost : undefined,
- settings: settings,
- useSubRegistry: false
- }, (0,external_React_.createElement)(SidebarComplementaryAreaFills, null), isEditMode && (0,external_React_.createElement)(StartTemplateOptions, null), (0,external_React_.createElement)(interface_skeleton, {
- isDistractionFree: isDistractionFree,
- enableRegionNavigation: false,
- className: classnames_default()('edit-site-editor__interface-skeleton', {
- 'show-icon-labels': showIconLabels
- }),
- notices: (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
- content: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(GlobalStylesRenderer, null), isEditMode && (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), showVisualEditor && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(TemplatePartConverter, null), (0,external_React_.createElement)(SidebarInspectorFill, null, (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), !isLargeViewport && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
- hideDragHandle: true
- }), (0,external_React_.createElement)(SiteEditorCanvas, null), (0,external_React_.createElement)(BlockRemovalWarningModal, {
- rules: blockRemovalRules
- }), (0,external_React_.createElement)(PatternModal, null)), editorMode === 'text' && isEditMode && (0,external_React_.createElement)(CodeEditor, null), isEditMode && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(edit_mode, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null))),
- secondarySidebar: isEditMode && (shouldShowInserter && (0,external_React_.createElement)(InserterSidebar, null) || shouldShowListView && (0,external_React_.createElement)(ListViewSidebar, null)),
- sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(complementary_area.Slot, {
- scope: "core/edit-site"
- })),
- footer: shouldShowBlockBreadcrumbs && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
- rootLabelText: postTypeLabel
+ }, [actions, item]);
+ const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const primaryActionLabel = primaryAction && (typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeRow, {
+ ref: itemRef,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {}),
+ role: "row",
+ className: dist_clsx({
+ 'is-selected': isSelected,
+ 'is-hovered': isHovered
}),
- labels: {
- ...interfaceLabels,
- secondarySidebar: secondarySidebarLabel
- }
- })));
+ onMouseEnter: handleMouseEnter,
+ onMouseLeave: handleMouseLeave,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "dataviews-view-list__item-wrapper",
+ alignment: "center",
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "gridcell",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_CompositeItem, {
+ store: store,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
+ role: "button",
+ id: id,
+ "aria-pressed": isSelected,
+ "aria-labelledby": labelId,
+ "aria-describedby": descriptionId,
+ className: "dataviews-view-list__item",
+ onClick: () => onSelect(item),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 3,
+ justify: "start",
+ alignment: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-view-list__media-wrapper",
+ children: mediaField?.render({
+ item
+ }) || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-view-list__media-placeholder"
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "dataviews-view-list__primary-field",
+ id: labelId,
+ children: primaryField?.render({
+ item
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-view-list__fields",
+ id: descriptionId,
+ children: visibleFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "dataviews-view-list__field",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ as: "span",
+ className: "dataviews-view-list__field-label",
+ children: field.header
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "dataviews-view-list__field-value",
+ children: field.render({
+ item
+ })
+ })]
+ }, field.id))
+ })]
+ })]
+ })
+ })
+ }), eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 1,
+ justify: "flex-end",
+ className: "dataviews-view-list__item-actions",
+ style: {
+ flexShrink: '0',
+ width: 'auto'
+ },
+ children: [primaryAction && 'RenderModal' in primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "gridcell",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_CompositeItem, {
+ store: store,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: primaryActionLabel,
+ icon: primaryAction.icon,
+ isDestructive: primaryAction.isDestructive,
+ size: "compact",
+ onClick: () => setIsModalOpen(true)
+ }),
+ children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, {
+ action: primaryAction,
+ items: [item],
+ closeModal: () => setIsModalOpen(false)
+ })
+ })
+ }), primaryAction && !('RenderModal' in primaryAction) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "gridcell",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_CompositeItem, {
+ store: store,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ label: primaryActionLabel,
+ icon: primaryAction.icon,
+ isDestructive: primaryAction.isDestructive,
+ size: "compact",
+ onClick: () => primaryAction.callback([item])
+ })
+ })
+ }, primaryAction.id), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ role: "gridcell",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_CompositeItem, {
+ store: store,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ size: "compact",
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ __experimentalIsFocusable: true,
+ disabled: !actions.length,
+ onKeyDown: event => {
+ if (event.key === 'ArrowDown') {
+ // Prevent the default behaviour (open dropdown menu) and go down.
+ event.preventDefault();
+ store.move(store.down());
+ }
+ if (event.key === 'ArrowUp') {
+ // Prevent the default behavior (open dropdown menu) and go up.
+ event.preventDefault();
+ store.move(store.up());
+ }
+ }
+ })
+ }),
+ placement: "bottom-end",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, {
+ actions: eligibleActions,
+ item: item
+ })
+ })
+ })]
+ })]
+ })
+ });
}
+function ViewList(props) {
+ const {
+ actions,
+ data,
+ fields,
+ getItemId,
+ isLoading,
+ onSelectionChange,
+ selection,
+ view
+ } = props;
+ const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list');
+ const selectedItem = data?.findLast(item => selection.includes(getItemId(item)));
+ const mediaField = fields.find(field => field.id === view.layout.mediaField);
+ const primaryField = fields.find(field => field.id === view.layout.primaryField);
+ const visibleFields = fields.filter(field => !view.hiddenFields.includes(field.id) && ![view.layout.primaryField, view.layout.mediaField].includes(field.id));
+ const onSelect = (0,external_wp_element_namespaceObject.useCallback)(item => onSelectionChange([item]), [onSelectionChange]);
+ const getItemDomId = (0,external_wp_element_namespaceObject.useCallback)(item => item ? `${baseId}-${getItemId(item)}` : undefined, [baseId, getItemId]);
+ const store = view_list_useCompositeStore({
+ defaultActiveId: getItemDomId(selectedItem)
+ });
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/pagination.js
+ // Manage focused item, when the active one is removed from the list.
+ const isActiveIdInList = store.useState(state => state.items.some(item => item.id === state.activeId));
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (!isActiveIdInList) {
+ // Prefer going down, except if there is no item below (last item), then go up (last item in list).
+ if (store.down()) {
+ store.move(store.down());
+ } else if (store.up()) {
+ store.move(store.up());
+ }
+ }
+ }, [isActiveIdInList]);
+ const hasData = data?.length;
+ if (!hasData) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx({
+ 'dataviews-loading': isLoading,
+ 'dataviews-no-results': !hasData && !isLoading
+ }),
+ children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results')
+ })
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_list_Composite, {
+ id: baseId,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {}),
+ className: "dataviews-view-list",
+ role: "grid",
+ store: store,
+ children: data.map(item => {
+ const id = getItemDomId(item);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, {
+ id: id,
+ actions: actions,
+ item: item,
+ isSelected: item === selectedItem,
+ onSelect: onSelect,
+ mediaField: mediaField,
+ primaryField: primaryField,
+ store: store,
+ visibleFields: visibleFields
+ }, id);
+ })
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/layouts.js
/**
* WordPress dependencies
*/
+/**
+ * Internal dependencies
+ */
-const pagination_Pagination = (0,external_wp_element_namespaceObject.memo)(function Pagination({
- view,
- onChangeView,
- paginationInfo: {
- totalItems = 0,
- totalPages
- }
-}) {
- if (!totalItems || !totalPages) {
- return null;
- }
- return !!totalItems && totalPages !== 1 && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- expanded: false,
- spacing: 6,
- justify: "end",
- className: "dataviews-pagination"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start",
- expanded: false,
- spacing: 2,
- className: "dataviews-pagination__page-selection"
- }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: Total number of pages.
- (0,external_wp_i18n_namespaceObject._x)('Page <CurrentPageControl /> of %s', 'paging'), totalPages), {
- CurrentPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
- value: view.page,
- options: Array.from(Array(totalPages)).map((_, i) => {
- const page = i + 1;
- return {
- value: page,
- label: page
- };
- }),
- onChange: newValue => {
- onChangeView({
- ...view,
- page: +newValue
- });
- },
- size: 'compact',
- __nextHasNoMarginBottom: true
- })
- })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- expanded: false,
- spacing: 1
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: () => onChangeView({
- ...view,
- page: view.page - 1
- }),
- disabled: view.page === 1,
- __experimentalIsFocusable: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
- icon: chevron_left,
- showTooltip: true,
- size: "compact",
- tooltipPosition: "top"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: () => onChangeView({
- ...view,
- page: view.page + 1
- }),
- disabled: view.page >= totalPages,
- __experimentalIsFocusable: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
- icon: chevron_right,
- showTooltip: true,
- size: "compact",
- tooltipPosition: "top"
- })));
-});
-/* harmony default export */ const pagination = (pagination_Pagination);
+
+
+
+const VIEW_LAYOUTS = [{
+ type: constants_LAYOUT_TABLE,
+ label: (0,external_wp_i18n_namespaceObject.__)('Table'),
+ component: view_table,
+ icon: block_table
+}, {
+ type: constants_LAYOUT_GRID,
+ label: (0,external_wp_i18n_namespaceObject.__)('Grid'),
+ component: ViewGrid,
+ icon: library_category
+}, {
+ type: constants_LAYOUT_LIST,
+ label: (0,external_wp_i18n_namespaceObject.__)('List'),
+ component: ViewList,
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets
+}];
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/view-actions.js
+/**
+ * External dependencies
+ */
/**
* WordPress dependencies
@@ -36790,6 +26194,9 @@ const pagination_Pagination = (0,external_wp_element_namespaceObject.memo)(funct
*/
+
+
+
const {
DropdownMenuV2: view_actions_DropdownMenu,
DropdownMenuGroupV2: view_actions_DropdownMenuGroup,
@@ -36797,7 +26204,7 @@ const {
DropdownMenuRadioItemV2: view_actions_DropdownMenuRadioItem,
DropdownMenuCheckboxItemV2: DropdownMenuCheckboxItem,
DropdownMenuItemLabelV2: view_actions_DropdownMenuItemLabel
-} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ViewTypeMenu({
view,
onChangeView,
@@ -36811,56 +26218,77 @@ function ViewTypeMenu({
return null;
}
const activeView = _availableViews.find(v => view.type === v.type);
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- trigger: (0,external_React_.createElement)(view_actions_DropdownMenuItem, {
- suffix: (0,external_React_.createElement)("span", {
- "aria-hidden": "true"
- }, activeView.label)
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Layout')))
- }, _availableViews.map(availableView => {
- return (0,external_React_.createElement)(view_actions_DropdownMenuRadioItem, {
- key: availableView.type,
- value: availableView.type,
- name: "view-actions-available-view",
- checked: availableView.type === view.type,
- hideOnClick: true,
- onChange: e => {
- onChangeView({
- ...view,
- type: e.target.value
- });
- }
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, availableView.label));
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItem, {
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ "aria-hidden": "true",
+ children: activeView?.label
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Layout')
+ })
+ }),
+ children: _availableViews.map(availableView => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuRadioItem, {
+ value: availableView.type,
+ name: "view-actions-available-view",
+ checked: availableView.type === view.type,
+ hideOnClick: true,
+ onChange: e => {
+ switch (e.target.value) {
+ case 'list':
+ case 'grid':
+ case 'table':
+ return onChangeView({
+ ...view,
+ type: e.target.value,
+ layout: {}
+ });
+ }
+ throw new Error('Invalid dataview');
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: availableView.label
+ })
+ }, availableView.type);
+ })
+ });
}
const PAGE_SIZE_VALUES = [10, 20, 50, 100];
function PageSizeMenu({
view,
onChangeView
}) {
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- trigger: (0,external_React_.createElement)(view_actions_DropdownMenuItem, {
- suffix: (0,external_React_.createElement)("span", {
- "aria-hidden": "true"
- }, view.perPage)
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Items per page')))
- }, PAGE_SIZE_VALUES.map(size => {
- return (0,external_React_.createElement)(view_actions_DropdownMenuRadioItem, {
- key: size,
- value: size,
- name: "view-actions-page-size",
- checked: view.perPage === size,
- onChange: () => {
- onChangeView({
- ...view,
- // `e.target.value` holds the same value as `size` but as a string,
- // so we use `size` directly to avoid parsing to int.
- perPage: size,
- page: 1
- });
- }
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, size));
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItem, {
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ "aria-hidden": "true",
+ children: view.perPage
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Items per page')
+ })
+ }),
+ children: PAGE_SIZE_VALUES.map(size => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuRadioItem, {
+ value: size,
+ name: "view-actions-page-size",
+ checked: view.perPage === size,
+ onChange: () => {
+ onChangeView({
+ ...view,
+ // `e.target.value` holds the same value as `size` but as a string,
+ // so we use `size` directly to avoid parsing to int.
+ perPage: size,
+ page: 1
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: size
+ })
+ }, size);
+ })
+ });
}
function FieldsVisibilityMenu({
view,
@@ -36871,21 +26299,28 @@ function FieldsVisibilityMenu({
if (!hidableFields?.length) {
return null;
}
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- trigger: (0,external_React_.createElement)(view_actions_DropdownMenuItem, null, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Fields')))
- }, hidableFields?.map(field => {
- return (0,external_React_.createElement)(DropdownMenuCheckboxItem, {
- key: field.id,
- value: field.id,
- checked: !view.hiddenFields?.includes(field.id),
- onChange: () => {
- onChangeView({
- ...view,
- hiddenFields: view.hiddenFields?.includes(field.id) ? view.hiddenFields.filter(id => id !== field.id) : [...(view.hiddenFields || []), field.id]
- });
- }
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, field.header));
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Fields')
+ })
+ }),
+ children: hidableFields?.map(field => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuCheckboxItem, {
+ value: field.id,
+ checked: !view.hiddenFields?.includes(field.id),
+ onChange: () => {
+ onChangeView({
+ ...view,
+ hiddenFields: view.hiddenFields?.includes(field.id) ? view.hiddenFields.filter(id => id !== field.id) : [...(view.hiddenFields || []), field.id]
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: field.header
+ })
+ }, field.id);
+ })
+ });
}
function SortMenu({
fields,
@@ -36897,78 +26332,175 @@ function SortMenu({
return null;
}
const currentSortedField = fields.find(field => field.id === view.sort?.field);
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- trigger: (0,external_React_.createElement)(view_actions_DropdownMenuItem, {
- suffix: (0,external_React_.createElement)("span", {
- "aria-hidden": "true"
- }, currentSortedField?.header)
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, (0,external_wp_i18n_namespaceObject.__)('Sort by')))
- }, sortableFields?.map(field => {
- const sortedDirection = view.sort?.direction;
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- key: field.id,
- trigger: (0,external_React_.createElement)(view_actions_DropdownMenuItem, null, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, field.header)),
- style: {
- minWidth: '220px'
- }
- }, Object.entries(SORTING_DIRECTIONS).map(([direction, info]) => {
- const isChecked = currentSortedField !== undefined && sortedDirection === direction && field.id === currentSortedField.id;
- const value = `${field.id}-${direction}`;
- return (0,external_React_.createElement)(view_actions_DropdownMenuRadioItem, {
- key: value
- // All sorting radio items share the same name, so that
- // selecting a sorting option automatically deselects the
- // previously selected one, even if it is displayed in
- // another submenu. The field and direction are passed via
- // the `value` prop.
- ,
- name: "view-actions-sorting",
- value: value,
- checked: isChecked,
- onChange: () => {
- onChangeView({
- ...view,
- sort: {
- field: field.id,
- direction
- }
- });
- }
- }, (0,external_React_.createElement)(view_actions_DropdownMenuItemLabel, null, info.label));
- }));
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItem, {
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ "aria-hidden": "true",
+ children: currentSortedField?.header
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Sort by')
+ })
+ }),
+ children: sortableFields?.map(field => {
+ const sortedDirection = view.sort?.direction;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItem, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: field.header
+ })
+ }),
+ style: {
+ minWidth: '220px'
+ },
+ children: SORTING_DIRECTIONS.map(direction => {
+ const isChecked = currentSortedField !== undefined && sortedDirection === direction && field.id === currentSortedField.id;
+ const value = `${field.id}-${direction}`;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuRadioItem, {
+ // All sorting radio items share the same name, so that
+ // selecting a sorting option automatically deselects the
+ // previously selected one, even if it is displayed in
+ // another submenu. The field and direction are passed via
+ // the `value` prop.
+ name: "view-actions-sorting",
+ value: value,
+ checked: isChecked,
+ onChange: () => {
+ onChangeView({
+ ...view,
+ sort: {
+ field: field.id,
+ direction
+ }
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenuItemLabel, {
+ children: sortLabels[direction]
+ })
+ }, value);
+ })
+ }, field.id);
+ })
+ });
}
-const ViewActions = (0,external_wp_element_namespaceObject.memo)(function ViewActions({
+function _ViewActions({
fields,
view,
onChangeView,
supportedLayouts
}) {
- return (0,external_React_.createElement)(view_actions_DropdownMenu, {
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
size: "compact",
icon: library_settings,
label: (0,external_wp_i18n_namespaceObject.__)('View options')
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(view_actions_DropdownMenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, {
+ view: view,
+ onChangeView: onChangeView,
+ supportedLayouts: supportedLayouts
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortMenu, {
+ fields: fields,
+ view: view,
+ onChangeView: onChangeView
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldsVisibilityMenu, {
+ fields: fields,
+ view: view,
+ onChangeView: onChangeView
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageSizeMenu, {
+ view: view,
+ onChangeView: onChangeView
+ })]
})
- }, (0,external_React_.createElement)(view_actions_DropdownMenuGroup, null, (0,external_React_.createElement)(ViewTypeMenu, {
- view: view,
- onChangeView: onChangeView,
- supportedLayouts: supportedLayouts
- }), (0,external_React_.createElement)(SortMenu, {
- fields: fields,
- view: view,
- onChangeView: onChangeView
- }), (0,external_React_.createElement)(FieldsVisibilityMenu, {
- fields: fields,
- view: view,
- onChangeView: onChangeView
- }), (0,external_React_.createElement)(PageSizeMenu, {
- view: view,
- onChangeView: onChangeView
- })));
-});
+ });
+}
+
+// A type assertion is used here to keep the type argument.
+const ViewActions = (0,external_wp_element_namespaceObject.memo)(_ViewActions);
/* harmony default export */ const view_actions = (ViewActions);
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3IEDWLST.js
+"use client";
+
+// src/composite/utils.ts
+
+var NULL_ITEM = { id: null };
+function flipItems(items, activeId, shouldInsertNullItem = false) {
+ const index = items.findIndex((item) => item.id === activeId);
+ return [
+ ...items.slice(index + 1),
+ ...shouldInsertNullItem ? [NULL_ITEM] : [],
+ ...items.slice(0, index)
+ ];
+}
+function findFirstEnabledItem(items, excludeId) {
+ return items.find((item) => {
+ if (excludeId) {
+ return !item.disabled && item.id !== excludeId;
+ }
+ return !item.disabled;
+ });
+}
+function getEnabledItem(store, id) {
+ if (!id)
+ return null;
+ return store.item(id) || null;
+}
+function groupItemsByRows(items) {
+ const rows = [];
+ for (const item of items) {
+ const row = rows.find((currentRow) => {
+ var _a;
+ return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
+ });
+ if (row) {
+ row.push(item);
+ } else {
+ rows.push([item]);
+ }
+ }
+ return rows;
+}
+function selectTextField(element, collapseToEnd = false) {
+ if (isTextField(element)) {
+ element.setSelectionRange(
+ collapseToEnd ? element.value.length : 0,
+ element.value.length
+ );
+ } else if (element.isContentEditable) {
+ const selection = getDocument(element).getSelection();
+ selection == null ? void 0 : selection.selectAllChildren(element);
+ if (collapseToEnd) {
+ selection == null ? void 0 : selection.collapseToEnd();
+ }
+ }
+}
+var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
+function focusSilently(element) {
+ element[FOCUS_SILENTLY] = true;
+ element.focus({ preventScroll: true });
+}
+function silentlyFocused(element) {
+ const isSilentlyFocused = element[FOCUS_SILENTLY];
+ delete element[FOCUS_SILENTLY];
+ return isSilentlyFocused;
+}
+function isItem(store, element, exclude) {
+ if (!element)
+ return false;
+ if (element === exclude)
+ return false;
+ const item = store.item(element.id);
+ if (!item)
+ return false;
+ if (exclude && item.element === exclude)
+ return false;
+ return true;
+}
+
+
+
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4R3V3JGP.js
"use client";
var __defProp = Object.defineProperty;
@@ -37005,6 +26537,9 @@ var __objRest = (source, exclude) => {
+// EXTERNAL MODULE: external "React"
+var external_React_ = __webpack_require__(1609);
+var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/4R3V3JGP.js
"use client";
var _4R3V3JGP_defProp = Object.defineProperty;
@@ -37084,13 +26619,13 @@ function isUpdater(argument) {
function isLazyValue(value) {
return typeof value === "function";
}
-function Y3OOHFCN_isObject(arg) {
+function isObject(arg) {
return typeof arg === "object" && arg != null;
}
function isEmpty(arg) {
if (Array.isArray(arg))
return !arg.length;
- if (Y3OOHFCN_isObject(arg))
+ if (isObject(arg))
return !Object.keys(arg).length;
if (arg == null)
return true;
@@ -37819,6 +27354,623 @@ function resetMouseMoving() {
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3ORBWXWF.js
+"use client";
+
+
+
+
+// src/utils/system.tsx
+
+
+
+function isRenderProp(children) {
+ return typeof children === "function";
+}
+function forwardRef2(render) {
+ const Role = React.forwardRef((props, ref) => render(__spreadProps(__spreadValues({}, props), { ref })));
+ Role.displayName = render.displayName || render.name;
+ return Role;
+}
+function memo2(Component, propsAreEqual) {
+ const Role = React.memo(Component, propsAreEqual);
+ Role.displayName = Component.displayName || Component.name;
+ return Role;
+}
+function createComponent(render) {
+ const Role = (props, ref) => render(_4R3V3JGP_spreadValues({ ref }, props));
+ return external_React_.forwardRef(Role);
+}
+function createMemoComponent(render) {
+ const Role = createComponent(render);
+ return external_React_.memo(Role);
+}
+function createElement(Type, props) {
+ const _a = props, { as: As, wrapElement, render } = _a, rest = __objRest(_a, ["as", "wrapElement", "render"]);
+ let element;
+ const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
+ if (false) {}
+ if (As && typeof As !== "string") {
+ element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(As, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, rest), { render }));
+ } else if (external_React_.isValidElement(render)) {
+ const renderProps = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, render.props), { ref: mergedRef });
+ element = external_React_.cloneElement(render, mergeProps(rest, renderProps));
+ } else if (render) {
+ element = render(rest);
+ } else if (isRenderProp(props.children)) {
+ if (false) {}
+ const _b = rest, { children } = _b, otherProps = __objRest(_b, ["children"]);
+ element = props.children(otherProps);
+ } else if (As) {
+ element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(As, _4R3V3JGP_spreadValues({}, rest));
+ } else {
+ element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _4R3V3JGP_spreadValues({}, rest));
+ }
+ if (wrapElement) {
+ return wrapElement(element);
+ }
+ return element;
+}
+function createHook(useProps) {
+ const useRole = (props = {}) => {
+ const htmlProps = useProps(props);
+ const copy = {};
+ for (const prop in htmlProps) {
+ if (Y3OOHFCN_hasOwnProperty(htmlProps, prop) && htmlProps[prop] !== void 0) {
+ copy[prop] = htmlProps[prop];
+ }
+ }
+ return copy;
+ };
+ return useRole;
+}
+function createStoreContext(providers = [], scopedProviders = []) {
+ const context = external_React_.createContext(void 0);
+ const scopedContext = external_React_.createContext(void 0);
+ const useContext2 = () => external_React_.useContext(context);
+ const useScopedContext = (onlyScoped = false) => {
+ const scoped = external_React_.useContext(scopedContext);
+ const store = useContext2();
+ if (onlyScoped)
+ return scoped;
+ return scoped || store;
+ };
+ const useProviderContext = () => {
+ const scoped = external_React_.useContext(scopedContext);
+ const store = useContext2();
+ if (scoped && scoped === store)
+ return;
+ return store;
+ };
+ const ContextProvider = (props) => {
+ return providers.reduceRight(
+ (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
+ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _4R3V3JGP_spreadValues({}, props))
+ );
+ };
+ const ScopedContextProvider = (props) => {
+ return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children: scopedProviders.reduceRight(
+ (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
+ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _4R3V3JGP_spreadValues({}, props))
+ ) }));
+ };
+ return {
+ context,
+ scopedContext,
+ useContext: useContext2,
+ useScopedContext,
+ useProviderContext,
+ ContextProvider,
+ ScopedContextProvider
+ };
+}
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4UUKJZ4V.js
+"use client";
+
+
+// src/collection/collection-context.tsx
+var ctx = createStoreContext();
+var useCollectionContext = ctx.useContext;
+var useCollectionScopedContext = ctx.useScopedContext;
+var useCollectionProviderContext = ctx.useProviderContext;
+var CollectionContextProvider = ctx.ContextProvider;
+var CollectionScopedContextProvider = ctx.ScopedContextProvider;
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/IB7YUKH5.js
+"use client";
+
+
+
+// src/composite/composite-context.tsx
+
+var IB7YUKH5_ctx = createStoreContext(
+ [CollectionContextProvider],
+ [CollectionScopedContextProvider]
+);
+var useCompositeContext = IB7YUKH5_ctx.useContext;
+var useCompositeScopedContext = IB7YUKH5_ctx.useScopedContext;
+var useCompositeProviderContext = IB7YUKH5_ctx.useProviderContext;
+var CompositeContextProvider = IB7YUKH5_ctx.ContextProvider;
+var CompositeScopedContextProvider = IB7YUKH5_ctx.ScopedContextProvider;
+var CompositeItemContext = (0,external_React_.createContext)(
+ void 0
+);
+var CompositeRowContext = (0,external_React_.createContext)(
+ void 0
+);
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/346FK57L.js
+"use client";
+
+
+
+
+
+
+// src/composite/composite-typeahead.ts
+
+
+
+
+var chars = "";
+function clearChars() {
+ chars = "";
+}
+function isValidTypeaheadEvent(event) {
+ const target = event.target;
+ if (target && DLOEKDPY_isTextField(target))
+ return false;
+ if (event.key === " " && chars.length)
+ return true;
+ return event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && /^[\p{Letter}\p{Number}]$/u.test(event.key);
+}
+function isSelfTargetOrItem(event, items) {
+ if (isSelfTarget(event))
+ return true;
+ const target = event.target;
+ if (!target)
+ return false;
+ const isItem = items.some((item) => item.element === target);
+ return isItem;
+}
+function getEnabledItems(items) {
+ return items.filter((item) => !item.disabled);
+}
+function itemTextStartsWith(item, text) {
+ var _a;
+ const itemText = ((_a = item.element) == null ? void 0 : _a.textContent) || item.children;
+ if (!itemText)
+ return false;
+ return normalizeString(itemText).trim().toLowerCase().startsWith(text.toLowerCase());
+}
+function getSameInitialItems(items, char, activeId) {
+ if (!activeId)
+ return items;
+ const activeItem = items.find((item) => item.id === activeId);
+ if (!activeItem)
+ return items;
+ if (!itemTextStartsWith(activeItem, char))
+ return items;
+ if (chars !== char && itemTextStartsWith(activeItem, chars))
+ return items;
+ chars = char;
+ return flipItems(
+ items.filter((item) => itemTextStartsWith(item, chars)),
+ activeId
+ ).filter((item) => item.id !== activeId);
+}
+var useCompositeTypeahead = createHook(
+ (_a) => {
+ var _b = _a, { store, typeahead = true } = _b, props = __objRest(_b, ["store", "typeahead"]);
+ const context = useCompositeContext();
+ store = store || context;
+ invariant(
+ store,
+ false && 0
+ );
+ const onKeyDownCaptureProp = props.onKeyDownCapture;
+ const cleanupTimeoutRef = (0,external_React_.useRef)(0);
+ const onKeyDownCapture = useEvent(
+ (event) => {
+ onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
+ if (event.defaultPrevented)
+ return;
+ if (!typeahead)
+ return;
+ if (!store)
+ return;
+ const { items, activeId } = store.getState();
+ if (!isValidTypeaheadEvent(event))
+ return clearChars();
+ let enabledItems = getEnabledItems(items);
+ if (!isSelfTargetOrItem(event, enabledItems))
+ return clearChars();
+ event.preventDefault();
+ window.clearTimeout(cleanupTimeoutRef.current);
+ cleanupTimeoutRef.current = window.setTimeout(() => {
+ chars = "";
+ }, 500);
+ const char = event.key.toLowerCase();
+ chars += char;
+ enabledItems = getSameInitialItems(enabledItems, char, activeId);
+ const item = enabledItems.find(
+ (item2) => itemTextStartsWith(item2, chars)
+ );
+ if (item) {
+ store.move(item.id);
+ } else {
+ clearChars();
+ }
+ }
+ );
+ props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
+ onKeyDownCapture
+ });
+ return props;
+ }
+);
+var CompositeTypeahead = createComponent(
+ (props) => {
+ const htmlProps = useCompositeTypeahead(props);
+ return createElement("div", htmlProps);
+ }
+);
+if (false) {}
+
+
+
+;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/focus.js
+"use client";
+
+
+
+// src/utils/focus.ts
+var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
+function hasNegativeTabIndex(element) {
+ const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
+ return tabIndex < 0;
+}
+function isFocusable(element) {
+ if (!matches(element, selector))
+ return false;
+ if (!isVisible(element))
+ return false;
+ if (DLOEKDPY_closest(element, "[inert]"))
+ return false;
+ return true;
+}
+function isTabbable(element) {
+ if (!isFocusable(element))
+ return false;
+ if (hasNegativeTabIndex(element))
+ return false;
+ if (!("form" in element))
+ return true;
+ if (!element.form)
+ return true;
+ if (element.checked)
+ return true;
+ if (element.type !== "radio")
+ return true;
+ const radioGroup = element.form.elements.namedItem(element.name);
+ if (!radioGroup)
+ return true;
+ if (!("length" in radioGroup))
+ return true;
+ const activeElement = getActiveElement(element);
+ if (!activeElement)
+ return true;
+ if (activeElement === element)
+ return true;
+ if (!("form" in activeElement))
+ return true;
+ if (activeElement.form !== element.form)
+ return true;
+ if (activeElement.name !== element.name)
+ return true;
+ return false;
+}
+function getAllFocusableIn(container, includeContainer) {
+ const elements = Array.from(
+ container.querySelectorAll(selector)
+ );
+ if (includeContainer) {
+ elements.unshift(container);
+ }
+ const focusableElements = elements.filter(isFocusable);
+ focusableElements.forEach((element, i) => {
+ if (isFrame(element) && element.contentDocument) {
+ const frameBody = element.contentDocument.body;
+ focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
+ }
+ });
+ return focusableElements;
+}
+function getAllFocusable(includeBody) {
+ return getAllFocusableIn(document.body, includeBody);
+}
+function getFirstFocusableIn(container, includeContainer) {
+ const [first] = getAllFocusableIn(container, includeContainer);
+ return first || null;
+}
+function getFirstFocusable(includeBody) {
+ return getFirstFocusableIn(document.body, includeBody);
+}
+function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
+ const elements = Array.from(
+ container.querySelectorAll(selector)
+ );
+ const tabbableElements = elements.filter(isTabbable);
+ if (includeContainer && isTabbable(container)) {
+ tabbableElements.unshift(container);
+ }
+ tabbableElements.forEach((element, i) => {
+ if (isFrame(element) && element.contentDocument) {
+ const frameBody = element.contentDocument.body;
+ const allFrameTabbable = getAllTabbableIn(
+ frameBody,
+ false,
+ fallbackToFocusable
+ );
+ tabbableElements.splice(i, 1, ...allFrameTabbable);
+ }
+ });
+ if (!tabbableElements.length && fallbackToFocusable) {
+ return elements;
+ }
+ return tabbableElements;
+}
+function getAllTabbable(fallbackToFocusable) {
+ return getAllTabbableIn(document.body, false, fallbackToFocusable);
+}
+function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
+ const [first] = getAllTabbableIn(
+ container,
+ includeContainer,
+ fallbackToFocusable
+ );
+ return first || null;
+}
+function getFirstTabbable(fallbackToFocusable) {
+ return getFirstTabbableIn(document.body, false, fallbackToFocusable);
+}
+function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
+ const allTabbable = getAllTabbableIn(
+ container,
+ includeContainer,
+ fallbackToFocusable
+ );
+ return allTabbable[allTabbable.length - 1] || null;
+}
+function getLastTabbable(fallbackToFocusable) {
+ return getLastTabbableIn(document.body, false, fallbackToFocusable);
+}
+function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
+ const activeElement = getActiveElement(container);
+ const allFocusable = getAllFocusableIn(container, includeContainer);
+ const activeIndex = allFocusable.indexOf(activeElement);
+ const nextFocusableElements = allFocusable.slice(activeIndex + 1);
+ return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
+}
+function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
+ return getNextTabbableIn(
+ document.body,
+ false,
+ fallbackToFirst,
+ fallbackToFocusable
+ );
+}
+function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
+ const activeElement = getActiveElement(container);
+ const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
+ const activeIndex = allFocusable.indexOf(activeElement);
+ const previousFocusableElements = allFocusable.slice(activeIndex + 1);
+ return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
+}
+function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
+ return getPreviousTabbableIn(
+ document.body,
+ false,
+ fallbackToFirst,
+ fallbackToFocusable
+ );
+}
+function getClosestFocusable(element) {
+ while (element && !isFocusable(element)) {
+ element = closest(element, selector);
+ }
+ return element || null;
+}
+function hasFocus(element) {
+ const activeElement = DLOEKDPY_getActiveElement(element);
+ if (!activeElement)
+ return false;
+ if (activeElement === element)
+ return true;
+ const activeDescendant = activeElement.getAttribute("aria-activedescendant");
+ if (!activeDescendant)
+ return false;
+ return activeDescendant === element.id;
+}
+function hasFocusWithin(element) {
+ const activeElement = DLOEKDPY_getActiveElement(element);
+ if (!activeElement)
+ return false;
+ if (contains(element, activeElement))
+ return true;
+ const activeDescendant = activeElement.getAttribute("aria-activedescendant");
+ if (!activeDescendant)
+ return false;
+ if (!("id" in element))
+ return false;
+ if (activeDescendant === element.id)
+ return true;
+ return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
+}
+function focusIfNeeded(element) {
+ if (!hasFocusWithin(element) && isFocusable(element)) {
+ element.focus();
+ }
+}
+function disableFocus(element) {
+ var _a;
+ const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
+ element.setAttribute("data-tabindex", currentTabindex);
+ element.setAttribute("tabindex", "-1");
+}
+function disableFocusIn(container, includeContainer) {
+ const tabbableElements = getAllTabbableIn(container, includeContainer);
+ tabbableElements.forEach(disableFocus);
+}
+function restoreFocusIn(container) {
+ const elements = container.querySelectorAll("[data-tabindex]");
+ const restoreTabIndex = (element) => {
+ const tabindex = element.getAttribute("data-tabindex");
+ element.removeAttribute("data-tabindex");
+ if (tabindex) {
+ element.setAttribute("tabindex", tabindex);
+ } else {
+ element.removeAttribute("tabindex");
+ }
+ };
+ if (container.hasAttribute("data-tabindex")) {
+ restoreTabIndex(container);
+ }
+ elements.forEach(restoreTabIndex);
+}
+function focusIntoView(element, options) {
+ if (!("scrollIntoView" in element)) {
+ element.focus();
+ } else {
+ element.focus({ preventScroll: true });
+ element.scrollIntoView(_chunks_4R3V3JGP_spreadValues({ block: "nearest", inline: "nearest" }, options));
+ }
+}
+
+
+;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/G6ONQ5EH.js
+"use client";
+
+
+
+
+
+// src/composite/composite-hover.ts
+
+
+
+
+function getMouseDestination(event) {
+ const relatedTarget = event.relatedTarget;
+ if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
+ return relatedTarget;
+ }
+ return null;
+}
+function hoveringInside(event) {
+ const nextElement = getMouseDestination(event);
+ if (!nextElement)
+ return false;
+ return contains(event.currentTarget, nextElement);
+}
+var symbol = Symbol("composite-hover");
+function movingToAnotherItem(event) {
+ let dest = getMouseDestination(event);
+ if (!dest)
+ return false;
+ do {
+ if (Y3OOHFCN_hasOwnProperty(dest, symbol) && dest[symbol])
+ return true;
+ dest = dest.parentElement;
+ } while (dest);
+ return false;
+}
+var useCompositeHover = createHook(
+ (_a) => {
+ var _b = _a, {
+ store,
+ focusOnHover = true,
+ blurOnHoverEnd = !!focusOnHover
+ } = _b, props = __objRest(_b, [
+ "store",
+ "focusOnHover",
+ "blurOnHoverEnd"
+ ]);
+ const context = useCompositeContext();
+ store = store || context;
+ invariant(
+ store,
+ false && 0
+ );
+ const isMouseMoving = useIsMouseMoving();
+ const onMouseMoveProp = props.onMouseMove;
+ const focusOnHoverProp = useBooleanEvent(focusOnHover);
+ const onMouseMove = useEvent((event) => {
+ onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
+ if (event.defaultPrevented)
+ return;
+ if (!isMouseMoving())
+ return;
+ if (!focusOnHoverProp(event))
+ return;
+ if (!hasFocusWithin(event.currentTarget)) {
+ const baseElement = store == null ? void 0 : store.getState().baseElement;
+ if (baseElement && !hasFocus(baseElement)) {
+ baseElement.focus();
+ }
+ }
+ store == null ? void 0 : store.setActiveId(event.currentTarget.id);
+ });
+ const onMouseLeaveProp = props.onMouseLeave;
+ const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
+ const onMouseLeave = useEvent((event) => {
+ var _a2;
+ onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
+ if (event.defaultPrevented)
+ return;
+ if (!isMouseMoving())
+ return;
+ if (hoveringInside(event))
+ return;
+ if (movingToAnotherItem(event))
+ return;
+ if (!focusOnHoverProp(event))
+ return;
+ if (!blurOnHoverEndProp(event))
+ return;
+ store == null ? void 0 : store.setActiveId(null);
+ (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
+ });
+ const ref = (0,external_React_.useCallback)((element) => {
+ if (!element)
+ return;
+ element[symbol] = true;
+ }, []);
+ props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
+ ref: useMergeRefs(ref, props.ref),
+ onMouseMove,
+ onMouseLeave
+ });
+ return props;
+ }
+);
+var CompositeHover = createMemoComponent(
+ (props) => {
+ const htmlProps = useCompositeHover(props);
+ return createElement("div", htmlProps);
+ }
+);
+if (false) {}
+
+
+
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/EAHJFCU4.js
"use client";
@@ -38593,8 +28745,8 @@ function reverseArray(array) {
// src/composite/composite-store.ts
-var NULL_ITEM = { id: null };
-function findFirstEnabledItem(items, excludeId) {
+var IERTEJ3A_NULL_ITEM = { id: null };
+function IERTEJ3A_findFirstEnabledItem(items, excludeId) {
return items.find((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
@@ -38602,7 +28754,7 @@ function findFirstEnabledItem(items, excludeId) {
return !item.disabled;
});
}
-function getEnabledItems(items, excludeId) {
+function IERTEJ3A_getEnabledItems(items, excludeId) {
return items.filter((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
@@ -38620,15 +28772,15 @@ function getOppositeOrientation(orientation) {
function getItemsInRow(items, rowId) {
return items.filter((item) => item.rowId === rowId);
}
-function flipItems(items, activeId, shouldInsertNullItem = false) {
+function IERTEJ3A_flipItems(items, activeId, shouldInsertNullItem = false) {
const index = items.findIndex((item) => item.id === activeId);
return [
...items.slice(index + 1),
- ...shouldInsertNullItem ? [NULL_ITEM] : [],
+ ...shouldInsertNullItem ? [IERTEJ3A_NULL_ITEM] : [],
...items.slice(0, index)
];
}
-function groupItemsByRows(items) {
+function IERTEJ3A_groupItemsByRows(items) {
const rows = [];
for (const item of items) {
const row = rows.find((currentRow) => {
@@ -38666,7 +28818,7 @@ function normalizeRows(rows, activeId, focusShift) {
const item = row[i];
if (!item || focusShift && item.disabled) {
const isFirst = i === 0;
- const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
+ const previousItem = isFirst && focusShift ? IERTEJ3A_findFirstEnabledItem(row) : row[i - 1];
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
}
}
@@ -38674,7 +28826,7 @@ function normalizeRows(rows, activeId, focusShift) {
return rows;
}
function verticalizeItems(items) {
- const rows = groupItemsByRows(items);
+ const rows = IERTEJ3A_groupItemsByRows(items);
const maxLength = getMaxRowLength(rows);
const verticalized = [];
for (let i = 0; i < maxLength; i += 1) {
@@ -38735,7 +28887,7 @@ function createCompositeStore(props = {}) {
var _a2;
if (activeId2 !== void 0)
return activeId2;
- return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
+ return (_a2 = IERTEJ3A_findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
})
);
@@ -38746,18 +28898,18 @@ function createCompositeStore(props = {}) {
const isRTL = rtl && isHorizontal;
const allItems = isRTL ? reverseArray(items) : items;
if (activeId2 == null) {
- return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
+ return (_a2 = IERTEJ3A_findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
}
const activeItem = allItems.find((item) => item.id === activeId2);
if (!activeItem) {
- return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
+ return (_b = IERTEJ3A_findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
}
const isGrid = !!activeItem.rowId;
const activeIndex = allItems.indexOf(activeItem);
const nextItems = allItems.slice(activeIndex + 1);
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
if (skip !== void 0) {
- const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
+ const nextEnabledItemsInRow = IERTEJ3A_getEnabledItems(nextItemsInRow, activeId2);
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
return nextItem2 == null ? void 0 : nextItem2.id;
@@ -38773,12 +28925,12 @@ function createCompositeStore(props = {}) {
hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
- const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
- const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
+ const sortedItems = IERTEJ3A_flipItems(loopItems, activeId2, hasNullItem);
+ const nextItem2 = IERTEJ3A_findFirstEnabledItem(sortedItems, activeId2);
return nextItem2 == null ? void 0 : nextItem2.id;
}
if (canWrap) {
- const nextItem2 = findFirstEnabledItem(
+ const nextItem2 = IERTEJ3A_findFirstEnabledItem(
// We can use nextItems, which contains all the next items, including
// items from other rows, to wrap between rows. However, if there is a
// null item (the composite container), we'll only use the next items in
@@ -38791,7 +28943,7 @@ function createCompositeStore(props = {}) {
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
return nextId;
}
- const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
+ const nextItem = IERTEJ3A_findFirstEnabledItem(nextItemsInRow, activeId2);
if (!nextItem && hasNullItem) {
return null;
}
@@ -38808,11 +28960,11 @@ function createCompositeStore(props = {}) {
},
first: () => {
var _a2;
- return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
+ return (_a2 = IERTEJ3A_findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
},
last: () => {
var _a2;
- return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
+ return (_a2 = IERTEJ3A_findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
},
next: (skip) => {
const { renderedItems, orientation } = composite.getState();
@@ -38821,7 +28973,7 @@ function createCompositeStore(props = {}) {
previous: (skip) => {
var _a2;
const { renderedItems, orientation, includesBaseElement } = composite.getState();
- const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
+ const isGrid = !!((_a2 = IERTEJ3A_findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
const hasNullItem = !isGrid && includesBaseElement;
return getNextId(
reverseArray(renderedItems),
@@ -38841,7 +28993,7 @@ function createCompositeStore(props = {}) {
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
flatten2DArray(
- normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
+ normalizeRows(IERTEJ3A_groupItemsByRows(renderedItems), activeId2, shouldShift)
)
);
const canLoop = focusLoop && focusLoop !== "horizontal";
@@ -38855,7 +29007,7 @@ function createCompositeStore(props = {}) {
reverseArray(
flatten2DArray(
normalizeRows(
- groupItemsByRows(renderedItems),
+ IERTEJ3A_groupItemsByRows(renderedItems),
activeId2,
shouldShift
)
@@ -39028,160 +29180,6 @@ function useComboboxStore(props = {}) {
-// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
-var jsx_runtime = __webpack_require__(4922);
-;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3ORBWXWF.js
-"use client";
-
-
-
-
-// src/utils/system.tsx
-
-
-
-function isRenderProp(children) {
- return typeof children === "function";
-}
-function forwardRef2(render) {
- const Role = React.forwardRef((props, ref) => render(__spreadProps(__spreadValues({}, props), { ref })));
- Role.displayName = render.displayName || render.name;
- return Role;
-}
-function memo2(Component, propsAreEqual) {
- const Role = React.memo(Component, propsAreEqual);
- Role.displayName = Component.displayName || Component.name;
- return Role;
-}
-function createComponent(render) {
- const Role = (props, ref) => render(_4R3V3JGP_spreadValues({ ref }, props));
- return external_React_.forwardRef(Role);
-}
-function createMemoComponent(render) {
- const Role = createComponent(render);
- return external_React_.memo(Role);
-}
-function _3ORBWXWF_createElement(Type, props) {
- const _a = props, { as: As, wrapElement, render } = _a, rest = __objRest(_a, ["as", "wrapElement", "render"]);
- let element;
- const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
- if (false) {}
- if (As && typeof As !== "string") {
- element = /* @__PURE__ */ (0,jsx_runtime.jsx)(As, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, rest), { render }));
- } else if (external_React_.isValidElement(render)) {
- const renderProps = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, render.props), { ref: mergedRef });
- element = external_React_.cloneElement(render, mergeProps(rest, renderProps));
- } else if (render) {
- element = render(rest);
- } else if (isRenderProp(props.children)) {
- if (false) {}
- const _b = rest, { children } = _b, otherProps = __objRest(_b, ["children"]);
- element = props.children(otherProps);
- } else if (As) {
- element = /* @__PURE__ */ (0,jsx_runtime.jsx)(As, _4R3V3JGP_spreadValues({}, rest));
- } else {
- element = /* @__PURE__ */ (0,jsx_runtime.jsx)(Type, _4R3V3JGP_spreadValues({}, rest));
- }
- if (wrapElement) {
- return wrapElement(element);
- }
- return element;
-}
-function createHook(useProps) {
- const useRole = (props = {}) => {
- const htmlProps = useProps(props);
- const copy = {};
- for (const prop in htmlProps) {
- if (Y3OOHFCN_hasOwnProperty(htmlProps, prop) && htmlProps[prop] !== void 0) {
- copy[prop] = htmlProps[prop];
- }
- }
- return copy;
- };
- return useRole;
-}
-function createStoreContext(providers = [], scopedProviders = []) {
- const context = external_React_.createContext(void 0);
- const scopedContext = external_React_.createContext(void 0);
- const useContext2 = () => external_React_.useContext(context);
- const useScopedContext = (onlyScoped = false) => {
- const scoped = external_React_.useContext(scopedContext);
- const store = useContext2();
- if (onlyScoped)
- return scoped;
- return scoped || store;
- };
- const useProviderContext = () => {
- const scoped = external_React_.useContext(scopedContext);
- const store = useContext2();
- if (scoped && scoped === store)
- return;
- return store;
- };
- const ContextProvider = (props) => {
- return providers.reduceRight(
- (children, Provider) => /* @__PURE__ */ (0,jsx_runtime.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
- /* @__PURE__ */ (0,jsx_runtime.jsx)(context.Provider, _4R3V3JGP_spreadValues({}, props))
- );
- };
- const ScopedContextProvider = (props) => {
- return /* @__PURE__ */ (0,jsx_runtime.jsx)(ContextProvider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children: scopedProviders.reduceRight(
- (children, Provider) => /* @__PURE__ */ (0,jsx_runtime.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
- /* @__PURE__ */ (0,jsx_runtime.jsx)(scopedContext.Provider, _4R3V3JGP_spreadValues({}, props))
- ) }));
- };
- return {
- context,
- scopedContext,
- useContext: useContext2,
- useScopedContext,
- useProviderContext,
- ContextProvider,
- ScopedContextProvider
- };
-}
-
-
-
-;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4UUKJZ4V.js
-"use client";
-
-
-// src/collection/collection-context.tsx
-var ctx = createStoreContext();
-var useCollectionContext = ctx.useContext;
-var useCollectionScopedContext = ctx.useScopedContext;
-var useCollectionProviderContext = ctx.useProviderContext;
-var CollectionContextProvider = ctx.ContextProvider;
-var CollectionScopedContextProvider = ctx.ScopedContextProvider;
-
-
-
-;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/IB7YUKH5.js
-"use client";
-
-
-
-// src/composite/composite-context.tsx
-
-var IB7YUKH5_ctx = createStoreContext(
- [CollectionContextProvider],
- [CollectionScopedContextProvider]
-);
-var useCompositeContext = IB7YUKH5_ctx.useContext;
-var useCompositeScopedContext = IB7YUKH5_ctx.useScopedContext;
-var useCompositeProviderContext = IB7YUKH5_ctx.useProviderContext;
-var CompositeContextProvider = IB7YUKH5_ctx.ContextProvider;
-var CompositeScopedContextProvider = IB7YUKH5_ctx.ScopedContextProvider;
-var CompositeItemContext = (0,external_React_.createContext)(
- void 0
-);
-var CompositeRowContext = (0,external_React_.createContext)(
- void 0
-);
-
-
-
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OAYFXAQ2.js
"use client";
@@ -39283,7 +29281,7 @@ var ComboboxItemCheckedContext = (0,external_React_.createContext)(false);
function ComboboxProvider(props = {}) {
const store = useComboboxStore(props);
- return /* @__PURE__ */ (0,jsx_runtime.jsx)(ComboboxContextProvider, { value: store, children: props.children });
+ return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children });
}
@@ -39324,7 +29322,7 @@ var useComboboxLabel = createHook(
var ComboboxLabel = createMemoComponent(
(props) => {
const htmlProps = useComboboxLabel(props);
- return _3ORBWXWF_createElement("label", htmlProps);
+ return createElement("label", htmlProps);
}
);
if (false) {}
@@ -39351,93 +29349,12 @@ var usePopoverAnchor = createHook(
);
var PopoverAnchor = createComponent((props) => {
const htmlProps = usePopoverAnchor(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
});
if (false) {}
-;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3IEDWLST.js
-"use client";
-
-// src/composite/utils.ts
-
-var _3IEDWLST_NULL_ITEM = { id: null };
-function _3IEDWLST_flipItems(items, activeId, shouldInsertNullItem = false) {
- const index = items.findIndex((item) => item.id === activeId);
- return [
- ...items.slice(index + 1),
- ...shouldInsertNullItem ? [_3IEDWLST_NULL_ITEM] : [],
- ...items.slice(0, index)
- ];
-}
-function _3IEDWLST_findFirstEnabledItem(items, excludeId) {
- return items.find((item) => {
- if (excludeId) {
- return !item.disabled && item.id !== excludeId;
- }
- return !item.disabled;
- });
-}
-function getEnabledItem(store, id) {
- if (!id)
- return null;
- return store.item(id) || null;
-}
-function _3IEDWLST_groupItemsByRows(items) {
- const rows = [];
- for (const item of items) {
- const row = rows.find((currentRow) => {
- var _a;
- return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
- });
- if (row) {
- row.push(item);
- } else {
- rows.push([item]);
- }
- }
- return rows;
-}
-function selectTextField(element, collapseToEnd = false) {
- if (isTextField(element)) {
- element.setSelectionRange(
- collapseToEnd ? element.value.length : 0,
- element.value.length
- );
- } else if (element.isContentEditable) {
- const selection = getDocument(element).getSelection();
- selection == null ? void 0 : selection.selectAllChildren(element);
- if (collapseToEnd) {
- selection == null ? void 0 : selection.collapseToEnd();
- }
- }
-}
-var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
-function focusSilently(element) {
- element[FOCUS_SILENTLY] = true;
- element.focus({ preventScroll: true });
-}
-function silentlyFocused(element) {
- const isSilentlyFocused = element[FOCUS_SILENTLY];
- delete element[FOCUS_SILENTLY];
- return isSilentlyFocused;
-}
-function isItem(store, element, exclude) {
- if (!element)
- return false;
- if (element === exclude)
- return false;
- const item = store.item(element.id);
- if (!item)
- return false;
- if (exclude && item.element === exclude)
- return false;
- return true;
-}
-
-
-
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SHA3WOPI.js
"use client";
@@ -39447,235 +29364,6 @@ var FocusableContext = (0,external_React_.createContext)(true);
-;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/focus.js
-"use client";
-
-
-
-// src/utils/focus.ts
-var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
-function hasNegativeTabIndex(element) {
- const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
- return tabIndex < 0;
-}
-function isFocusable(element) {
- if (!matches(element, selector))
- return false;
- if (!isVisible(element))
- return false;
- if (DLOEKDPY_closest(element, "[inert]"))
- return false;
- return true;
-}
-function isTabbable(element) {
- if (!isFocusable(element))
- return false;
- if (hasNegativeTabIndex(element))
- return false;
- if (!("form" in element))
- return true;
- if (!element.form)
- return true;
- if (element.checked)
- return true;
- if (element.type !== "radio")
- return true;
- const radioGroup = element.form.elements.namedItem(element.name);
- if (!radioGroup)
- return true;
- if (!("length" in radioGroup))
- return true;
- const activeElement = getActiveElement(element);
- if (!activeElement)
- return true;
- if (activeElement === element)
- return true;
- if (!("form" in activeElement))
- return true;
- if (activeElement.form !== element.form)
- return true;
- if (activeElement.name !== element.name)
- return true;
- return false;
-}
-function getAllFocusableIn(container, includeContainer) {
- const elements = Array.from(
- container.querySelectorAll(selector)
- );
- if (includeContainer) {
- elements.unshift(container);
- }
- const focusableElements = elements.filter(isFocusable);
- focusableElements.forEach((element, i) => {
- if (isFrame(element) && element.contentDocument) {
- const frameBody = element.contentDocument.body;
- focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
- }
- });
- return focusableElements;
-}
-function getAllFocusable(includeBody) {
- return getAllFocusableIn(document.body, includeBody);
-}
-function getFirstFocusableIn(container, includeContainer) {
- const [first] = getAllFocusableIn(container, includeContainer);
- return first || null;
-}
-function getFirstFocusable(includeBody) {
- return getFirstFocusableIn(document.body, includeBody);
-}
-function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
- const elements = Array.from(
- container.querySelectorAll(selector)
- );
- const tabbableElements = elements.filter(isTabbable);
- if (includeContainer && isTabbable(container)) {
- tabbableElements.unshift(container);
- }
- tabbableElements.forEach((element, i) => {
- if (isFrame(element) && element.contentDocument) {
- const frameBody = element.contentDocument.body;
- const allFrameTabbable = getAllTabbableIn(
- frameBody,
- false,
- fallbackToFocusable
- );
- tabbableElements.splice(i, 1, ...allFrameTabbable);
- }
- });
- if (!tabbableElements.length && fallbackToFocusable) {
- return elements;
- }
- return tabbableElements;
-}
-function getAllTabbable(fallbackToFocusable) {
- return getAllTabbableIn(document.body, false, fallbackToFocusable);
-}
-function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
- const [first] = getAllTabbableIn(
- container,
- includeContainer,
- fallbackToFocusable
- );
- return first || null;
-}
-function getFirstTabbable(fallbackToFocusable) {
- return getFirstTabbableIn(document.body, false, fallbackToFocusable);
-}
-function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
- const allTabbable = getAllTabbableIn(
- container,
- includeContainer,
- fallbackToFocusable
- );
- return allTabbable[allTabbable.length - 1] || null;
-}
-function getLastTabbable(fallbackToFocusable) {
- return getLastTabbableIn(document.body, false, fallbackToFocusable);
-}
-function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
- const activeElement = getActiveElement(container);
- const allFocusable = getAllFocusableIn(container, includeContainer);
- const activeIndex = allFocusable.indexOf(activeElement);
- const nextFocusableElements = allFocusable.slice(activeIndex + 1);
- return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
-}
-function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
- return getNextTabbableIn(
- document.body,
- false,
- fallbackToFirst,
- fallbackToFocusable
- );
-}
-function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
- const activeElement = getActiveElement(container);
- const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
- const activeIndex = allFocusable.indexOf(activeElement);
- const previousFocusableElements = allFocusable.slice(activeIndex + 1);
- return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
-}
-function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
- return getPreviousTabbableIn(
- document.body,
- false,
- fallbackToFirst,
- fallbackToFocusable
- );
-}
-function getClosestFocusable(element) {
- while (element && !isFocusable(element)) {
- element = closest(element, selector);
- }
- return element || null;
-}
-function hasFocus(element) {
- const activeElement = DLOEKDPY_getActiveElement(element);
- if (!activeElement)
- return false;
- if (activeElement === element)
- return true;
- const activeDescendant = activeElement.getAttribute("aria-activedescendant");
- if (!activeDescendant)
- return false;
- return activeDescendant === element.id;
-}
-function hasFocusWithin(element) {
- const activeElement = DLOEKDPY_getActiveElement(element);
- if (!activeElement)
- return false;
- if (contains(element, activeElement))
- return true;
- const activeDescendant = activeElement.getAttribute("aria-activedescendant");
- if (!activeDescendant)
- return false;
- if (!("id" in element))
- return false;
- if (activeDescendant === element.id)
- return true;
- return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
-}
-function focusIfNeeded(element) {
- if (!hasFocusWithin(element) && isFocusable(element)) {
- element.focus();
- }
-}
-function disableFocus(element) {
- var _a;
- const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
- element.setAttribute("data-tabindex", currentTabindex);
- element.setAttribute("tabindex", "-1");
-}
-function disableFocusIn(container, includeContainer) {
- const tabbableElements = getAllTabbableIn(container, includeContainer);
- tabbableElements.forEach(disableFocus);
-}
-function restoreFocusIn(container) {
- const elements = container.querySelectorAll("[data-tabindex]");
- const restoreTabIndex = (element) => {
- const tabindex = element.getAttribute("data-tabindex");
- element.removeAttribute("data-tabindex");
- if (tabindex) {
- element.setAttribute("tabindex", tabindex);
- } else {
- element.removeAttribute("tabindex");
- }
- };
- if (container.hasAttribute("data-tabindex")) {
- restoreTabIndex(container);
- }
- elements.forEach(restoreTabIndex);
-}
-function focusIntoView(element, options) {
- if (!("scrollIntoView" in element)) {
- element.focus();
- } else {
- element.focus({ preventScroll: true });
- element.scrollIntoView(_chunks_4R3V3JGP_spreadValues({ block: "nearest", inline: "nearest" }, options));
- }
-}
-
-
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KK7H3W2B.js
"use client";
@@ -40017,7 +29705,7 @@ var useFocusable = createHook(
);
var Focusable = createComponent((props) => {
props = useFocusable(props);
- return _3ORBWXWF_createElement("div", props);
+ return createElement("div", props);
});
if (false) {}
@@ -40084,8 +29772,8 @@ function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
});
}
function findFirstEnabledItemInTheLastRow(items) {
- return _3IEDWLST_findFirstEnabledItem(
- flatten2DArray(reverseArray(_3IEDWLST_groupItemsByRows(items)))
+ return findFirstEnabledItem(
+ flatten2DArray(reverseArray(groupItemsByRows(items)))
);
}
function useScheduleFocus(store) {
@@ -40316,7 +30004,7 @@ var useComposite = createHook(
});
props = useWrapElement(
props,
- (element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CompositeContextProvider, { value: store, children: element }),
+ (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }),
[store]
);
const activeDescendant = store.useState((state) => {
@@ -40349,7 +30037,7 @@ var useComposite = createHook(
);
var _7QTPYGNZ_Composite = createComponent((props) => {
const htmlProps = useComposite(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
});
if (false) {}
@@ -40771,7 +30459,7 @@ var useCombobox = createHook(
);
var Combobox = createComponent((props) => {
const htmlProps = useCombobox(props);
- return _3ORBWXWF_createElement("input", htmlProps);
+ return createElement("input", htmlProps);
});
if (false) {}
@@ -40868,7 +30556,7 @@ var useDisclosureContent = createHook(
}, [store, animated, contentElement, open, transition]);
props = useWrapElement(
props,
- (element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(DialogScopedContextProvider, { value: store, children: element }),
+ (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }),
[store]
);
const hidden = isHidden(mounted, props.hidden, alwaysVisible);
@@ -40888,7 +30576,7 @@ var useDisclosureContent = createHook(
var DisclosureContentImpl = createComponent(
(props) => {
const htmlProps = useDisclosureContent(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
}
);
var DisclosureContent = createComponent(
@@ -40902,7 +30590,7 @@ var DisclosureContent = createComponent(
);
if (mounted === false)
return null;
- return /* @__PURE__ */ (0,jsx_runtime.jsx)(DisclosureContentImpl, _4R3V3JGP_spreadValues({}, props));
+ return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _4R3V3JGP_spreadValues({}, props));
}
);
if (false) {}
@@ -40976,7 +30664,7 @@ var useComboboxList = createHook(
});
props = useWrapElement(
props,
- (element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(ComboboxScopedContextProvider, { value: store, children: element }),
+ (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: element }),
[store]
);
const mounted = store.useState("mounted");
@@ -41007,128 +30695,12 @@ var useComboboxList = createHook(
);
var ComboboxList = createComponent((props) => {
const htmlProps = useComboboxList(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
});
if (false) {}
-;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/G6ONQ5EH.js
-"use client";
-
-
-
-
-
-// src/composite/composite-hover.ts
-
-
-
-
-function getMouseDestination(event) {
- const relatedTarget = event.relatedTarget;
- if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
- return relatedTarget;
- }
- return null;
-}
-function hoveringInside(event) {
- const nextElement = getMouseDestination(event);
- if (!nextElement)
- return false;
- return contains(event.currentTarget, nextElement);
-}
-var G6ONQ5EH_symbol = Symbol("composite-hover");
-function movingToAnotherItem(event) {
- let dest = getMouseDestination(event);
- if (!dest)
- return false;
- do {
- if (Y3OOHFCN_hasOwnProperty(dest, G6ONQ5EH_symbol) && dest[G6ONQ5EH_symbol])
- return true;
- dest = dest.parentElement;
- } while (dest);
- return false;
-}
-var useCompositeHover = createHook(
- (_a) => {
- var _b = _a, {
- store,
- focusOnHover = true,
- blurOnHoverEnd = !!focusOnHover
- } = _b, props = __objRest(_b, [
- "store",
- "focusOnHover",
- "blurOnHoverEnd"
- ]);
- const context = useCompositeContext();
- store = store || context;
- invariant(
- store,
- false && 0
- );
- const isMouseMoving = useIsMouseMoving();
- const onMouseMoveProp = props.onMouseMove;
- const focusOnHoverProp = useBooleanEvent(focusOnHover);
- const onMouseMove = useEvent((event) => {
- onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
- if (event.defaultPrevented)
- return;
- if (!isMouseMoving())
- return;
- if (!focusOnHoverProp(event))
- return;
- if (!hasFocusWithin(event.currentTarget)) {
- const baseElement = store == null ? void 0 : store.getState().baseElement;
- if (baseElement && !hasFocus(baseElement)) {
- baseElement.focus();
- }
- }
- store == null ? void 0 : store.setActiveId(event.currentTarget.id);
- });
- const onMouseLeaveProp = props.onMouseLeave;
- const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
- const onMouseLeave = useEvent((event) => {
- var _a2;
- onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
- if (event.defaultPrevented)
- return;
- if (!isMouseMoving())
- return;
- if (hoveringInside(event))
- return;
- if (movingToAnotherItem(event))
- return;
- if (!focusOnHoverProp(event))
- return;
- if (!blurOnHoverEndProp(event))
- return;
- store == null ? void 0 : store.setActiveId(null);
- (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
- });
- const ref = (0,external_React_.useCallback)((element) => {
- if (!element)
- return;
- element[G6ONQ5EH_symbol] = true;
- }, []);
- props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
- ref: useMergeRefs(ref, props.ref),
- onMouseMove,
- onMouseLeave
- });
- return props;
- }
-);
-var CompositeHover = createMemoComponent(
- (props) => {
- const htmlProps = useCompositeHover(props);
- return _3ORBWXWF_createElement("div", htmlProps);
- }
-);
-if (false) {}
-
-
-
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/NWCBQ4CV.js
"use client";
@@ -41256,7 +30828,7 @@ var useCommand = createHook(
);
var Command = createComponent((props) => {
props = useCommand(props);
- return _3ORBWXWF_createElement("button", props);
+ return createElement("button", props);
});
if (false) {}
@@ -41310,7 +30882,7 @@ var useCollectionItem = createHook(
var CollectionItem = createComponent(
(props) => {
const htmlProps = useCollectionItem(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
}
);
if (false) {}
@@ -41606,7 +31178,7 @@ var useCompositeItem = createHook(
);
props = useWrapElement(
props,
- (element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
+ (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
const isActiveItem = useStoreState(
@@ -41684,7 +31256,7 @@ var useCompositeItem = createHook(
var QZLXIDNP_CompositeItem = createMemoComponent(
(props) => {
const htmlProps = useCompositeItem(props);
- return _3ORBWXWF_createElement("button", htmlProps);
+ return createElement("button", htmlProps);
}
);
if (false) {}
@@ -41831,7 +31403,7 @@ var useComboboxItem = createHook(
}
props = useWrapElement(
props,
- (element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
+ (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
[value, selected]
);
const contentElement = store.useState("contentElement");
@@ -41866,7 +31438,7 @@ var useComboboxItem = createHook(
var ComboboxItem = createMemoComponent(
(props) => {
const htmlProps = useComboboxItem(props);
- return _3ORBWXWF_createElement("div", htmlProps);
+ return createElement("div", htmlProps);
}
);
if (false) {}
@@ -41899,18 +31471,18 @@ function splitValue(itemValue, userValue) {
while (index !== -1) {
if (index !== 0) {
parts.push(
- /* @__PURE__ */ (0,jsx_runtime.jsx)("span", { "data-autocomplete-value": "", children: itemValue.substr(0, index) }, parts.length)
+ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "data-autocomplete-value": "", children: itemValue.substr(0, index) }, parts.length)
);
}
parts.push(
- /* @__PURE__ */ (0,jsx_runtime.jsx)("span", { "data-user-value": "", children: itemValue.substr(index, userValue.length) }, parts.length)
+ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "data-user-value": "", children: itemValue.substr(index, userValue.length) }, parts.length)
);
itemValue = itemValue.substr(index + userValue.length);
index = normalizeValue(itemValue).indexOf(userValue);
}
if (itemValue) {
parts.push(
- /* @__PURE__ */ (0,jsx_runtime.jsx)("span", { "data-autocomplete-value": "", children: itemValue }, parts.length)
+ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "data-autocomplete-value": "", children: itemValue }, parts.length)
);
}
return parts;
@@ -41942,14 +31514,31 @@ var useComboboxItemValue = createHook(
var ComboboxItemValue = createComponent(
(props) => {
const htmlProps = useComboboxItemValue(props);
- return _3ORBWXWF_createElement("span", htmlProps);
+ return createElement("span", htmlProps);
}
);
if (false) {}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/search-widget.js
+// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
+var remove_accents = __webpack_require__(9681);
+var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
+/**
+ * WordPress dependencies
+ */
+
+const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
+ })
+});
+/* harmony default export */ const library_check = (check);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/search-widget.js
/**
* External dependencies
*/
@@ -41965,34 +31554,144 @@ if (false) {}
-const radioCheck = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ CompositeV2: search_widget_Composite,
+ CompositeItemV2: search_widget_CompositeItem,
+ useCompositeStoreV2: search_widget_useCompositeStore
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Circle, {
- cx: 12,
- cy: 12,
- r: 3
-}));
-function search_widget_normalizeSearchInput(input = '') {
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, {
+ cx: 12,
+ cy: 12,
+ r: 3
+ })
+});
+function normalizeSearchInput(input = '') {
return remove_accents_default()(input.trim().toLowerCase());
}
-function SearchWidget({
+const search_widget_EMPTY_ARRAY = [];
+const getCurrentValue = (filterDefinition, currentFilter) => {
+ if (filterDefinition.singleSelection) {
+ return currentFilter?.value;
+ }
+ if (Array.isArray(currentFilter?.value)) {
+ return currentFilter.value;
+ }
+ if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
+ return [currentFilter.value];
+ }
+ return search_widget_EMPTY_ARRAY;
+};
+const getNewValue = (filterDefinition, currentFilter, value) => {
+ if (filterDefinition.singleSelection) {
+ return value;
+ }
+ if (Array.isArray(currentFilter?.value)) {
+ return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value];
+ }
+ return [value];
+};
+function ListBox({
+ view,
filter,
+ onChangeView
+}) {
+ const compositeStore = search_widget_useCompositeStore({
+ virtualFocus: true,
+ focusLoop: true,
+ // When we have no or just one operator, we can set the first item as active.
+ // We do that by passing `undefined` to `defaultActiveId`. Otherwise, we set it to `null`,
+ // so the first item is not selected, since the focus is on the operators control.
+ defaultActiveId: filter.operators?.length === 1 ? undefined : null
+ });
+ const currentFilter = view.filters.find(f => f.field === filter.field);
+ const currentValue = getCurrentValue(filter, currentFilter);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_widget_Composite, {
+ store: compositeStore,
+ role: "listbox",
+ className: "dataviews-search-widget-listbox",
+ "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
+ (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name),
+ onFocusVisible: () => {
+ if (!compositeStore.getState().activeId) {
+ compositeStore.move(compositeStore.first());
+ }
+ },
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeTypeahead, {
+ store: compositeStore
+ }),
+ children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CompositeHover, {
+ store: compositeStore,
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_widget_CompositeItem, {
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ "aria-label": element.label,
+ role: "option",
+ className: "dataviews-search-widget-listitem"
+ }),
+ onClick: () => {
+ const newFilters = currentFilter ? [...view.filters.map(_filter => {
+ if (_filter.field === filter.field) {
+ return {
+ ..._filter,
+ operator: currentFilter.operator || filter.operators[0],
+ value: getNewValue(filter, currentFilter, element.value)
+ };
+ }
+ return _filter;
+ })] : [...view.filters, {
+ field: filter.field,
+ operator: filter.operators[0],
+ value: getNewValue(filter, currentFilter, element.value)
+ }];
+ onChangeView({
+ ...view,
+ page: 1,
+ filters: newFilters
+ });
+ }
+ }),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ className: "dataviews-search-widget-listitem-check",
+ children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: radioCheck
+ }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_check
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ children: [element.label, !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "dataviews-search-widget-listitem-description",
+ children: element.description
+ })]
+ })]
+ }, element.value))
+ });
+}
+function search_widget_ComboboxList({
view,
+ filter,
onChangeView
}) {
const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)('');
const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue);
- const selectedFilter = view.filters.find(_filter => _filter.field === filter.field);
- const selectedValues = selectedFilter?.value;
+ const currentFilter = view.filters.find(_filter => _filter.field === filter.field);
+ const currentValue = getCurrentValue(filter, currentFilter);
const matches = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue);
- return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch));
+ const normalizedSearch = normalizeSearchInput(deferredSearchValue);
+ return filter.elements.filter(item => normalizeSearchInput(item.label).includes(normalizedSearch));
}, [filter.elements, deferredSearchValue]);
- return (0,external_React_.createElement)(ComboboxProvider, {
- value: searchValue,
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, {
+ resetValueOnSelect: false,
+ selectedValue: currentValue,
setSelectedValue: value => {
- const currentFilter = view.filters.find(_filter => _filter.field === filter.field);
const newFilters = currentFilter ? [...view.filters.map(_filter => {
if (_filter.field === filter.field) {
return {
@@ -42013,50 +31712,69 @@ function SearchWidget({
filters: newFilters
});
},
- setValue: setSearchValue
- }, (0,external_React_.createElement)("div", {
- className: "dataviews-search-widget-filter-combobox__wrapper"
- }, (0,external_React_.createElement)(ComboboxLabel, {
- render: (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null)
- }, (0,external_wp_i18n_namespaceObject.__)('Search items')), (0,external_React_.createElement)(Combobox, {
- autoSelect: "always",
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'),
- className: "dataviews-search-widget-filter-combobox__input"
- }), (0,external_React_.createElement)("div", {
- className: "dataviews-search-widget-filter-combobox__icon"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_search
- }))), (0,external_React_.createElement)(ComboboxList, {
- className: "dataviews-search-widget-filter-combobox-list",
- alwaysVisible: true
- }, matches.map(element => {
- return (0,external_React_.createElement)(ComboboxItem, {
- key: element.value,
- value: element.value,
- className: "dataviews-search-widget-filter-combobox-item",
- hideOnClick: false,
- setValueOnClick: false,
- focusOnHover: true
- }, (0,external_React_.createElement)("span", {
- className: "dataviews-search-widget-filter-combobox-item-check"
- }, selectedValues === element.value && (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: radioCheck
- })), (0,external_React_.createElement)("span", null, (0,external_React_.createElement)(ComboboxItemValue, {
- className: "dataviews-search-widget-filter-combobox-item-value",
- value: element.label
- }), !!element.description && (0,external_React_.createElement)("span", {
- className: "dataviews-search-widget-filter-combobox-item-description"
- }, element.description)));
- }), !matches.length && (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found'))));
+ setValue: setSearchValue,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "dataviews-search-widget-filter-combobox__wrapper",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, {
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Search items')
+ }),
+ children: (0,external_wp_i18n_namespaceObject.__)('Search items')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, {
+ autoSelect: "always",
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'),
+ className: "dataviews-search-widget-filter-combobox__input"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-search-widget-filter-combobox__icon",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_search
+ })
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, {
+ className: "dataviews-search-widget-filter-combobox-list",
+ alwaysVisible: true,
+ children: [matches.map(element => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, {
+ value: element.value,
+ className: "dataviews-search-widget-listitem",
+ hideOnClick: false,
+ setValueOnClick: false,
+ focusOnHover: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ className: "dataviews-search-widget-listitem-check",
+ children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: radioCheck
+ }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: library_check
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, {
+ className: "dataviews-search-widget-filter-combobox-item-value",
+ value: element.label
+ }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "dataviews-search-widget-listitem-description",
+ children: element.description
+ })]
+ })]
+ }, element.value);
+ }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('No results found')
+ })]
+ })]
+ });
+}
+function SearchWidget(props) {
+ const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, {
+ ...props
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/filter-summary.js
-
/**
* External dependencies
*/
-
/**
* WordPress dependencies
*/
@@ -42064,36 +31782,55 @@ function SearchWidget({
-
+const ENTER = 'Enter';
+const SPACE = ' ';
/**
* Internal dependencies
*/
+
+
const FilterText = ({
- activeElement,
+ activeElements,
filterInView,
filter
}) => {
- if (activeElement === undefined) {
+ if (activeElements === undefined || activeElements.length === 0) {
return filter.name;
}
const filterTextWrappers = {
- Span1: (0,external_React_.createElement)("span", {
+ Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "dataviews-filter-summary__filter-text-name"
}),
- Span2: (0,external_React_.createElement)("span", {
+ Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "dataviews-filter-summary__filter-text-value"
})
};
- if (activeElement !== undefined && filterInView?.operator === constants_OPERATOR_IN) {
- return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is Admin". */
- (0,external_wp_i18n_namespaceObject.__)('<Span1>%1$s </Span1><Span2>is %2$s</Span2>'), filter.name, activeElement.label), filterTextWrappers);
+ if (filterInView?.operator === constants_OPERATOR_IS_ANY) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
+ }
+ if (filterInView?.operator === constants_OPERATOR_IS_NONE) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
+ }
+ if (filterInView?.operator === OPERATOR_IS_ALL) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
}
- if (activeElement !== undefined && filterInView?.operator === constants_OPERATOR_NOT_IN) {
- return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not Admin". */
- (0,external_wp_i18n_namespaceObject.__)('<Span1>%1$s </Span1><Span2>is not %2$s</Span2>'), filter.name, activeElement.label), filterTextWrappers);
+ if (filterInView?.operator === OPERATOR_IS_NOT_ALL) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
+ }
+ if (filterInView?.operator === constants_OPERATOR_IS) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers);
+ }
+ if (filterInView?.operator === constants_OPERATOR_IS_NOT) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */
+ (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers);
}
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */
(0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name);
@@ -42109,57 +31846,66 @@ function OperatorSelector({
}));
const currentFilter = view.filters.find(_filter => _filter.field === filter.field);
const value = currentFilter?.operator || filter.operators[0];
- return operatorOptions.length > 1 && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
spacing: 2,
justify: "flex-start",
- className: "dataviews-filter-summary__operators-container"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "dataviews-filter-summary__operators-filter-name"
- }, filter.name), (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Conditions'),
- value: value,
- options: operatorOptions,
- onChange: newValue => {
- const newFilters = currentFilter ? [...view.filters.map(_filter => {
- if (_filter.field === filter.field) {
- return {
- ..._filter,
- operator: newValue
- };
- }
- return _filter;
- })] : [...view.filters, {
- field: filter.field,
- operator: newValue
- }];
- onChangeView({
- ...view,
- page: 1,
- filters: newFilters
- });
- },
- size: "small",
- __nextHasNoMarginBottom: true,
- hideLabelFromVision: true
- }));
+ className: "dataviews-filter-summary__operators-container",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "dataviews-filter-summary__operators-filter-name",
+ children: filter.name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Conditions'),
+ value: value,
+ options: operatorOptions,
+ onChange: newValue => {
+ const operator = newValue;
+ const newFilters = currentFilter ? [...view.filters.map(_filter => {
+ if (_filter.field === filter.field) {
+ return {
+ ..._filter,
+ operator
+ };
+ }
+ return _filter;
+ })] : [...view.filters, {
+ field: filter.field,
+ operator,
+ value: undefined
+ }];
+ onChangeView({
+ ...view,
+ page: 1,
+ filters: newFilters
+ });
+ },
+ size: "small",
+ __nextHasNoMarginBottom: true,
+ hideLabelFromVision: true
+ })]
+ });
}
function FilterSummary({
addFilterRef,
openedFilter,
...commonProps
}) {
- const toggleRef = (0,external_wp_element_namespaceObject.useRef)();
+ const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null);
const {
filter,
view,
onChangeView
} = commonProps;
const filterInView = view.filters.find(f => f.field === filter.field);
- const activeElement = filter.elements.find(element => element.value === filterInView?.value);
+ const activeElements = filter.elements.filter(element => {
+ if (filter.singleSelection) {
+ return element.value === filterInView?.value;
+ }
+ return filterInView?.value?.includes(element.value);
+ });
const isPrimary = filter.isPrimary;
const hasValues = filterInView?.value !== undefined;
const canResetOrRemove = !isPrimary || hasValues;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
defaultOpen: openedFilter === filter.field,
contentClassName: "dataviews-filter-summary__popover",
popoverProps: {
@@ -42172,72 +31918,81 @@ function FilterSummary({
renderToggle: ({
isOpen,
onToggle
- }) => (0,external_React_.createElement)("div", {
- className: "dataviews-filter-summary__chip-container"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. */
- (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()),
- placement: "top"
- }, (0,external_React_.createElement)("div", {
- className: classnames_default()('dataviews-filter-summary__chip', {
- 'has-reset': canResetOrRemove,
- 'has-values': hasValues
- }),
- role: "button",
- tabIndex: 0,
- onClick: onToggle,
- onKeyDown: event => {
- if ([external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.SPACE].includes(event.keyCode)) {
- onToggle();
- event.preventDefault();
- }
- },
- "aria-pressed": isOpen,
- "aria-expanded": isOpen,
- ref: toggleRef
- }, (0,external_React_.createElement)(FilterText, {
- activeElement: activeElement,
- filterInView: filterInView,
- filter: filter
- }))), canResetOrRemove && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'),
- placement: "top"
- }, (0,external_React_.createElement)("button", {
- className: classnames_default()('dataviews-filter-summary__chip-remove', {
- 'has-values': hasValues
- }),
- onClick: () => {
- onChangeView({
- ...view,
- page: 1,
- filters: view.filters.filter(_filter => _filter.field !== filter.field)
- });
- // If the filter is not primary and can be removed, it will be added
- // back to the available filters from `Add filter` component.
- if (!isPrimary) {
- addFilterRef.current?.focus();
- } else {
- // If is primary, focus the toggle button.
- toggleRef.current?.focus();
- }
- }
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: close_small
- })))),
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "dataviews-filter-summary__chip-container",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
+ text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Filter name. */
+ (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()),
+ placement: "top",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('dataviews-filter-summary__chip', {
+ 'has-reset': canResetOrRemove,
+ 'has-values': hasValues
+ }),
+ role: "button",
+ tabIndex: 0,
+ onClick: onToggle,
+ onKeyDown: event => {
+ if ([ENTER, SPACE].includes(event.key)) {
+ onToggle();
+ event.preventDefault();
+ }
+ },
+ "aria-pressed": isOpen,
+ "aria-expanded": isOpen,
+ ref: toggleRef,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, {
+ activeElements: activeElements,
+ filterInView: filterInView,
+ filter: filter
+ })
+ })
+ }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
+ text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'),
+ placement: "top",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", {
+ className: dist_clsx('dataviews-filter-summary__chip-remove', {
+ 'has-values': hasValues
+ }),
+ onClick: () => {
+ onChangeView({
+ ...view,
+ page: 1,
+ filters: view.filters.filter(_filter => _filter.field !== filter.field)
+ });
+ // If the filter is not primary and can be removed, it will be added
+ // back to the available filters from `Add filter` component.
+ if (!isPrimary) {
+ addFilterRef.current?.focus();
+ } else {
+ // If is primary, focus the toggle button.
+ toggleRef.current?.focus();
+ }
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: close_small
+ })
+ })
+ })]
+ }),
renderContent: () => {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 0,
- justify: "flex-start"
- }, (0,external_React_.createElement)(OperatorSelector, {
- ...commonProps
- }), (0,external_React_.createElement)(SearchWidget, {
- ...commonProps
- }));
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, {
+ ...commonProps
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, {
+ ...commonProps
+ })]
+ });
}
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/add-filter.js
+/**
+ * External dependencies
+ */
/**
* WordPress dependencies
@@ -42246,16 +32001,16 @@ function FilterSummary({
-
/**
* Internal dependencies
*/
+
const {
DropdownMenuV2: add_filter_DropdownMenu,
DropdownMenuItemV2: add_filter_DropdownMenuItem,
DropdownMenuItemLabelV2: add_filter_DropdownMenuItemLabel
-} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+} = build_module_lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function AddFilter({
filters,
view,
@@ -42268,43 +32023,50 @@ function AddFilter({
return null;
}
const inactiveFilters = filters.filter(filter => !filter.isVisible);
- return (0,external_React_.createElement)(add_filter_DropdownMenu, {
- trigger: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenu, {
+ trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__experimentalIsFocusable: true,
size: "compact",
- icon: library_plus,
className: "dataviews-filters-button",
variant: "tertiary",
disabled: !inactiveFilters.length,
- ref: ref
- }, (0,external_wp_i18n_namespaceObject.__)('Add filter'))
- }, inactiveFilters.map(filter => {
- return (0,external_React_.createElement)(add_filter_DropdownMenuItem, {
- key: filter.field,
- onClick: () => {
- setOpenedFilter(filter.field);
- onChangeView({
- ...view,
- page: 1,
- filters: [...(view.filters || []), {
- field: filter.field,
- value: undefined,
- operator: filter.operators[0]
- }]
- });
- }
- }, (0,external_React_.createElement)(add_filter_DropdownMenuItemLabel, null, filter.name));
- }));
+ ref: ref,
+ children: (0,external_wp_i18n_namespaceObject.__)('Add filter')
+ }),
+ children: inactiveFilters.map(filter => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuItem, {
+ onClick: () => {
+ setOpenedFilter(filter.field);
+ onChangeView({
+ ...view,
+ page: 1,
+ filters: [...(view.filters || []), {
+ field: filter.field,
+ value: undefined,
+ operator: filter.operators[0]
+ }]
+ });
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_DropdownMenuItemLabel, {
+ children: filter.name
+ })
+ }, filter.field);
+ })
+ });
}
/* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter));
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/reset-filters.js
-
/**
* WordPress dependencies
*/
+
+/**
+ * Internal dependencies
+ */
+
function ResetFilter({
filters,
view,
@@ -42312,11 +32074,12 @@ function ResetFilter({
}) {
const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary);
const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field));
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
disabled: isDisabled,
__experimentalIsFocusable: true,
size: "compact",
variant: "tertiary",
+ className: "dataviews-filters__reset-button",
onClick: () => {
onChangeView({
...view,
@@ -42324,17 +32087,18 @@ function ResetFilter({
search: '',
filters: []
});
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Reset filters'));
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Reset')
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/filters.js
-
/**
* WordPress dependencies
*/
+
/**
* Internal dependencies
*/
@@ -42344,38 +32108,33 @@ function ResetFilter({
-const Filters = (0,external_wp_element_namespaceObject.memo)(function Filters({
+function _Filters({
fields,
view,
onChangeView,
openedFilter,
setOpenedFilter
}) {
- const addFilterRef = (0,external_wp_element_namespaceObject.useRef)();
+ const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null);
const filters = [];
fields.forEach(field => {
- if (!field.type) {
+ if (!field.elements?.length) {
return;
}
const operators = sanitizeOperators(field);
if (operators.length === 0) {
return;
}
- switch (field.type) {
- case constants_ENUMERATION_TYPE:
- if (!field.elements?.length) {
- return;
- }
- const isPrimary = !!field.filterBy?.isPrimary;
- filters.push({
- field: field.id,
- name: field.header,
- elements: field.elements,
- operators,
- isVisible: isPrimary || view.filters.some(f => f.field === field.id && [constants_OPERATOR_IN, constants_OPERATOR_NOT_IN].includes(f.operator)),
- isPrimary
- });
- }
+ const isPrimary = !!field.filterBy?.isPrimary;
+ filters.push({
+ field: field.id,
+ name: field.header,
+ elements: field.elements,
+ singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)),
+ operators,
+ isVisible: isPrimary || view.filters.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)),
+ isPrimary
+ });
});
// Sort filters by primary property. We need the primary filters to be first.
// Then we sort by name.
@@ -42388,47 +32147,47 @@ const Filters = (0,external_wp_element_namespaceObject.memo)(function Filters({
}
return a.name.localeCompare(b.name);
});
- const addFilter = (0,external_React_.createElement)(add_filter, {
- key: "add-filter",
+ const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, {
filters: filters,
view: view,
onChangeView: onChangeView,
ref: addFilterRef,
setOpenedFilter: setOpenedFilter
- });
+ }, "add-filter");
const filterComponents = [...filters.map(filter => {
if (!filter.isVisible) {
return null;
}
- return (0,external_React_.createElement)(FilterSummary, {
- key: filter.field,
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, {
filter: filter,
view: view,
onChangeView: onChangeView,
addFilterRef: addFilterRef,
openedFilter: openedFilter
- });
+ }, filter.field);
}), addFilter];
if (filterComponents.length > 1) {
- filterComponents.push((0,external_React_.createElement)(ResetFilter, {
- key: "reset-filters",
+ filterComponents.push( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, {
filters: filters,
view: view,
onChangeView: onChangeView
- }));
+ }, "reset-filters"));
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start",
style: {
width: 'fit-content'
},
- wrap: true
- }, filterComponents);
-});
+ wrap: true,
+ children: filterComponents
+ });
+}
+
+// A type assertion is used here to keep the type argument.
+const Filters = (0,external_wp_element_namespaceObject.memo)(_Filters);
/* harmony default export */ const filters = (Filters);
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/search.js
-
/**
* WordPress dependencies
*/
@@ -42436,6 +32195,11 @@ const Filters = (0,external_wp_element_namespaceObject.memo)(function Filters({
+
+/**
+ * Internal dependencies
+ */
+
const Search = (0,external_wp_element_namespaceObject.memo)(function Search({
label,
view,
@@ -42443,21 +32207,24 @@ const Search = (0,external_wp_element_namespaceObject.memo)(function Search({
}) {
const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search);
(0,external_wp_element_namespaceObject.useEffect)(() => {
- setSearch(view.search);
- }, [view]);
+ var _view$search;
+ setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : '');
+ }, [view.search, setSearch]);
const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView);
+ const viewRef = (0,external_wp_element_namespaceObject.useRef)(view);
(0,external_wp_element_namespaceObject.useEffect)(() => {
onChangeViewRef.current = onChangeView;
- }, [onChangeView]);
+ viewRef.current = view;
+ }, [onChangeView, view]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
onChangeViewRef.current({
- ...view,
+ ...viewRef.current,
page: 1,
search: debouncedSearch
});
}, [debouncedSearch]);
const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search');
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
onChange: setSearch,
value: search,
@@ -42468,7 +32235,218 @@ const Search = (0,external_wp_element_namespaceObject.memo)(function Search({
});
/* harmony default export */ const build_module_search = (Search);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js
+/**
+ * Internal dependencies
+ */
+
+/**
+ * Apply default values and normalize the fields config.
+ *
+ * @param fields Fields config.
+ * @return Normalized fields config.
+ */
+function normalizeFields(fields) {
+ return fields.map(field => {
+ const getValue = field.getValue || (({
+ item
+ }) => item[field.id]);
+ return {
+ ...field,
+ header: field.header || field.id,
+ getValue,
+ render: field.render || getValue
+ };
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/bulk-actions-toolbar.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const SNACKBAR_VARIANTS = {
+ init: {
+ bottom: -48
+ },
+ open: {
+ bottom: 24,
+ transition: {
+ bottom: {
+ type: 'tween',
+ duration: 0.2,
+ ease: [0, 0, 0.2, 1]
+ }
+ }
+ },
+ exit: {
+ opacity: 0,
+ bottom: 24,
+ transition: {
+ opacity: {
+ type: 'tween',
+ duration: 0.2,
+ ease: [0, 0, 0.2, 1]
+ }
+ }
+ }
+};
+function ActionTrigger({
+ action,
+ onClick,
+ isBusy,
+ items
+}) {
+ const label = typeof action.label === 'string' ? action.label : action.label(items);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
+ disabled: isBusy,
+ label: label,
+ icon: action.icon,
+ isDestructive: action.isDestructive,
+ size: "compact",
+ onClick: onClick,
+ isBusy: isBusy,
+ __experimentalIsFocusable: true,
+ tooltipPosition: "top"
+ });
+}
+const bulk_actions_toolbar_EMPTY_ARRAY = [];
+function ActionButton({
+ action,
+ selectedItems,
+ actionInProgress,
+ setActionInProgress
+}) {
+ const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return selectedItems.filter(item => {
+ return !action.isEligible || action.isEligible(item);
+ });
+ }, [action, selectedItems]);
+ if ('RenderModal' in action) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, {
+ action: action,
+ items: selectedEligibleItems,
+ ActionTrigger: ActionTrigger
+ }, action.id);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, {
+ action: action,
+ onClick: () => {
+ setActionInProgress(action.id);
+ action.callback(selectedItems);
+ },
+ items: selectedEligibleItems,
+ isBusy: actionInProgress === action.id
+ }, action.id);
+}
+function renderToolbarContent(selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onSelectionChange) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-bulk-actions__selection-count",
+ children: selection.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('1 item selected') : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Total number of selected items.
+ (0,external_wp_i18n_namespaceObject._n)('%s item selected', '%s items selected', selection.length), selection.length)
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
+ children: actionsToShow.map(action => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, {
+ action: action,
+ selectedItems: selectedItems,
+ actionInProgress: actionInProgress,
+ setActionInProgress: setActionInProgress
+ }, action.id);
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
+ icon: close_small,
+ showTooltip: true,
+ tooltipPosition: "top",
+ label: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
+ disabled: !!actionInProgress,
+ onClick: () => {
+ onSelectionChange(bulk_actions_toolbar_EMPTY_ARRAY);
+ }
+ })
+ })]
+ });
+}
+function ToolbarContent({
+ selection,
+ actionsToShow,
+ selectedItems,
+ onSelectionChange
+}) {
+ const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null);
+ const buttons = (0,external_wp_element_namespaceObject.useRef)(null);
+ if (!actionInProgress) {
+ if (buttons.current) {
+ buttons.current = null;
+ }
+ return renderToolbarContent(selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onSelectionChange);
+ } else if (!buttons.current) {
+ buttons.current = renderToolbarContent(selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onSelectionChange);
+ }
+ return buttons.current;
+}
+function BulkActionsToolbar({
+ data,
+ selection,
+ actions = bulk_actions_toolbar_EMPTY_ARRAY,
+ onSelectionChange,
+ getItemId
+}) {
+ const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
+ const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return data.filter(item => selection.includes(getItemId(item)));
+ }, [selection, data, getItemId]);
+ const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => {
+ return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item));
+ }), [actions, selectedItems]);
+ if (selection && selection.length === 0 || actionsToShow.length === 0) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ layout: !isReducedMotion // See https://www.framer.com/docs/animation/#layout-animations
+ ,
+ initial: "init",
+ animate: "open",
+ exit: "exit",
+ variants: isReducedMotion ? undefined : SNACKBAR_VARIANTS,
+ className: "dataviews-bulk-actions",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Toolbar, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Bulk actions'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "dataviews-bulk-actions-toolbar-wrapper",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolbarContent, {
+ selection: selection,
+ actionsToShow: actionsToShow,
+ selectedItems: selectedItems,
+ onSelectionChange: onSelectionChange
+ })
+ })
+ })
+ })
+ });
+}
+
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataviews.js
+/**
+ * External dependencies
+ */
/**
* WordPress dependencies
@@ -42485,13 +32463,18 @@ const Search = (0,external_wp_element_namespaceObject.memo)(function Search({
+
+
+
+
+
const defaultGetItemId = item => item.id;
const defaultOnSelectionChange = () => {};
function dataviews_useSomeItemHasAPossibleBulkAction(actions, data) {
return (0,external_wp_element_namespaceObject.useMemo)(() => {
return data.some(item => {
return actions.some(action => {
- return action.supportsBulk && action.isEligible(item);
+ return action.supportsBulk && (!action.isEligible || action.isEligible(item));
});
});
}, [actions, data]);
@@ -42502,90 +32485,95 @@ function DataViews({
fields,
search = true,
searchLabel = undefined,
- actions,
+ actions = [],
data,
getItemId = defaultGetItemId,
isLoading = false,
paginationInfo,
supportedLayouts,
- onSelectionChange = defaultOnSelectionChange,
- onDetailsChange = null,
- deferredRendering = false
+ selection: selectionProperty,
+ setSelection: setSelectionProperty,
+ onSelectionChange = defaultOnSelectionChange
}) {
- const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([]);
+ const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]);
+ let selection, setSelection;
+ if (selectionProperty !== undefined && setSelectionProperty !== undefined) {
+ selection = selectionProperty;
+ setSelection = setSelectionProperty;
+ } else {
+ selection = selectionState;
+ setSelection = setSelectionState;
+ }
const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (selection.length > 0 && selection.some(id => !data.some(item => getItemId(item) === id))) {
- const newSelection = selection.filter(id => data.some(item => getItemId(item) === id));
- setSelection(newSelection);
- onSelectionChange(data.filter(item => newSelection.includes(getItemId(item))));
- }
- }, [selection, data, getItemId, onSelectionChange]);
const onSetSelection = (0,external_wp_element_namespaceObject.useCallback)(items => {
setSelection(items.map(item => getItemId(item)));
onSelectionChange(items);
}, [setSelection, getItemId, onSelectionChange]);
- const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type).component;
- const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return fields.map(field => ({
- ...field,
- render: field.render || field.getValue
- }));
- }, [fields]);
+ const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component;
+ const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]);
const hasPossibleBulkAction = dataviews_useSomeItemHasAPossibleBulkAction(actions, data);
- return (0,external_React_.createElement)("div", {
- className: "dataviews-wrapper"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- alignment: "top",
- justify: "start",
- className: "dataviews-filters__view-actions"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "start",
- className: "dataviews-filters__container",
- wrap: true
- }, search && (0,external_React_.createElement)(build_module_search, {
- label: searchLabel,
- view: view,
- onChangeView: onChangeView
- }), (0,external_React_.createElement)(filters, {
- fields: _fields,
- view: view,
- onChangeView: onChangeView,
- openedFilter: openedFilter,
- setOpenedFilter: setOpenedFilter
- })), [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type) && hasPossibleBulkAction && (0,external_React_.createElement)(BulkActions, {
- actions: actions,
- data: data,
- onSelectionChange: onSetSelection,
- selection: selection,
- getItemId: getItemId
- }), (0,external_React_.createElement)(view_actions, {
- fields: _fields,
- view: view,
- onChangeView: onChangeView,
- supportedLayouts: supportedLayouts
- })), (0,external_React_.createElement)(ViewComponent, {
- fields: _fields,
- view: view,
- onChangeView: onChangeView,
- actions: actions,
- data: data,
- getItemId: getItemId,
- isLoading: isLoading,
- onSelectionChange: onSetSelection,
- onDetailsChange: onDetailsChange,
- selection: selection,
- deferredRendering: deferredRendering,
- setOpenedFilter: setOpenedFilter
- }), (0,external_React_.createElement)(pagination, {
- view: view,
- onChangeView: onChangeView,
- paginationInfo: paginationInfo
- }));
+ const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return selection.filter(id => data.some(item => getItemId(item) === id));
+ }, [selection, data, getItemId]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "dataviews-wrapper",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ alignment: "top",
+ justify: "start",
+ className: "dataviews-filters__view-actions",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "start",
+ className: "dataviews-filters__container",
+ wrap: true,
+ children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_search, {
+ label: searchLabel,
+ view: view,
+ onChangeView: onChangeView
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(filters, {
+ fields: _fields,
+ view: view,
+ onChangeView: onChangeView,
+ openedFilter: openedFilter,
+ setOpenedFilter: setOpenedFilter
+ })]
+ }), [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type) && hasPossibleBulkAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActions, {
+ actions: actions,
+ data: data,
+ onSelectionChange: onSetSelection,
+ selection: _selection,
+ getItemId: getItemId
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_actions, {
+ fields: _fields,
+ view: view,
+ onChangeView: onChangeView,
+ supportedLayouts: supportedLayouts
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, {
+ actions: actions,
+ data: data,
+ fields: _fields,
+ getItemId: getItemId,
+ isLoading: isLoading,
+ onChangeView: onChangeView,
+ onSelectionChange: onSetSelection,
+ selection: _selection,
+ setOpenedFilter: setOpenedFilter,
+ view: view
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pagination, {
+ view: view,
+ onChangeView: onChangeView,
+ paginationInfo: paginationInfo
+ }), [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type) && hasPossibleBulkAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsToolbar, {
+ data: data,
+ actions: actions,
+ selection: _selection,
+ onSelectionChange: onSetSelection,
+ getItemId: getItemId
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/header.js
-
/**
* WordPress dependencies
*/
@@ -42595,32 +32583,38 @@ function DataViews({
* Internal dependencies
*/
+
function Header({
title,
subTitle,
actions
}) {
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "edit-site-page-header",
as: "header",
- alignment: "left",
- className: "edit-site-page-header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, {
- className: "edit-site-page-header__page-title"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- as: "h2",
- level: 3,
- weight: 500,
- className: "edit-site-page-header__title"
- }, title), subTitle && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- as: "p",
- className: "edit-site-page-header__sub-title"
- }, subTitle)), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-page-header__actions"
- }, actions));
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "edit-site-page-header__page-title",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ as: "h2",
+ level: 3,
+ weight: 500,
+ className: "edit-site-page-header__title",
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
+ className: "edit-site-page-header__actions",
+ children: actions
+ })]
+ }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ as: "p",
+ className: "edit-site-page-header__sub-title",
+ children: subTitle
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page/index.js
-
/**
* External dependencies
*/
@@ -42631,11 +32625,16 @@ function Header({
*/
-
/**
* Internal dependencies
*/
+
+
+
+const {
+ NavigableRegion: page_NavigableRegion
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
function Page({
title,
subTitle,
@@ -42644,32 +32643,130 @@ function Page({
className,
hideTitleFromUI = false
}) {
- const classes = classnames_default()('edit-site-page', className);
- return (0,external_React_.createElement)(NavigableRegion, {
+ const classes = dist_clsx('edit-site-page', className);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, {
className: classes,
- ariaLabel: title
- }, (0,external_React_.createElement)("div", {
- className: "edit-site-page-content"
- }, !hideTitleFromUI && title && (0,external_React_.createElement)(Header, {
- title: title,
- subTitle: subTitle,
- actions: actions
- }), children), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null));
+ ariaLabel: title,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-page-content",
+ children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, {
+ title: title,
+ subTitle: subTitle,
+ actions: actions
+ }), children]
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/actions/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js
+/**
+ * WordPress dependencies
+ */
+
+
+const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"
+ })]
+});
+/* harmony default export */ const library_pages = (pages);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/published.js
/**
* WordPress dependencies
*/
+const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"
+ })
+});
+/* harmony default export */ const library_published = (published);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/scheduled.js
+/**
+ * WordPress dependencies
+ */
+const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"
+ })
+});
+/* harmony default export */ const library_scheduled = (scheduled);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drafts.js
+/**
+ * WordPress dependencies
+ */
+const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"
+ })
+});
+/* harmony default export */ const library_drafts = (drafts);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pending.js
+/**
+ * WordPress dependencies
+ */
+
+
+const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"
+ })
+});
+/* harmony default export */ const library_pending = (pending);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-allowed.js
+/**
+ * WordPress dependencies
+ */
+
+
+const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"
+ })
+});
+/* harmony default export */ const not_allowed = (notAllowed);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js
+/**
+ * WordPress dependencies
+ */
@@ -42677,303 +32774,219 @@ function Page({
* Internal dependencies
*/
-const {
- useHistory: actions_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const trashPostAction = {
- id: 'move-to-trash',
- label: (0,external_wp_i18n_namespaceObject.__)('Move to Trash'),
- isPrimary: true,
- icon: library_trash,
- isEligible({
- status
- }) {
- return status !== 'trash';
+const DEFAULT_CONFIG_PER_VIEW_TYPE = {
+ [LAYOUT_TABLE]: {
+ primaryField: 'title'
},
- supportsBulk: true,
- hideModalHeader: true,
- RenderModal: ({
- items: posts,
- closeModal,
- onPerform
- }) => {
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- deleteEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, posts.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The page's title.
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(posts[0].title.rendered)) : (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %d: The number of pages (2 or more).
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete %d pages?'), posts.length)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: closeModal
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: async () => {
- const promiseResult = await Promise.allSettled(posts.map(post => {
- return deleteEntityRecord('postType', post.type, post.id, {}, {
- throwOnError: true
- });
- }));
- // If all the promises were fulfilled with success.
- if (promiseResult.every(({
- status
- }) => status === 'fulfilled')) {
- let successMessage;
- if (promiseResult.length === 1) {
- successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the Trash.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(posts[0].title.rendered));
- } else {
- successMessage = (0,external_wp_i18n_namespaceObject.__)('Pages moved to the Trash.');
- }
- createSuccessNotice(successMessage, {
- type: 'snackbar',
- id: 'edit-site-page-trashed'
- });
- } else {
- // If there was at lease one failure.
- let errorMessage;
- // If we were trying to move a single post to the trash.
- if (promiseResult.length === 1) {
- if (promiseResult[0].reason?.message) {
- errorMessage = promiseResult[0].reason.message;
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the post to the trash.');
- }
- // If we were trying to move multiple posts to the trash
- } else {
- const errorMessages = new Set();
- const failedPromises = promiseResult.filter(({
- status
- }) => status === 'rejected');
- for (const failedPromise of failedPromises) {
- if (failedPromise.reason?.message) {
- errorMessages.add(failedPromise.reason.message);
- }
- }
- if (errorMessages.size === 0) {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the posts to the trash.');
- } else if (errorMessages.size === 1) {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
- (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the posts to the trash: %s'), [...errorMessages][0]);
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
- (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving the pages to the trash: %s'), [...errorMessages].join(','));
- }
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- if (onPerform) {
- onPerform();
- }
- closeModal();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))));
+ [LAYOUT_GRID]: {
+ mediaField: 'featured-image',
+ primaryField: 'title'
+ },
+ [LAYOUT_LIST]: {
+ primaryField: 'title',
+ mediaField: 'featured-image'
}
};
-function usePermanentlyDeletePostAction() {
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- deleteEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
- id: 'permanently-delete',
- label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'),
- isPrimary: true,
+const DEFAULT_PAGE_BASE = {
+ type: LAYOUT_LIST,
+ search: '',
+ filters: [],
+ page: 1,
+ perPage: 20,
+ sort: {
+ field: 'date',
+ direction: 'desc'
+ },
+ // All fields are visible by default, so it's
+ // better to keep track of the hidden ones.
+ hiddenFields: ['date', 'featured-image'],
+ layout: {
+ ...DEFAULT_CONFIG_PER_VIEW_TYPE[LAYOUT_LIST]
+ }
+};
+const DEFAULT_VIEWS = {
+ page: [{
+ title: (0,external_wp_i18n_namespaceObject.__)('All pages'),
+ slug: 'all',
+ icon: library_pages,
+ view: DEFAULT_PAGE_BASE
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Published'),
+ slug: 'published',
+ icon: library_published,
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'publish'
+ }]
+ }
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'),
+ slug: 'future',
+ icon: library_scheduled,
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'future'
+ }]
+ }
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Drafts'),
+ slug: 'drafts',
+ icon: library_drafts,
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'draft'
+ }]
+ }
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Pending'),
+ slug: 'pending',
+ icon: library_pending,
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'pending'
+ }]
+ }
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Private'),
+ slug: 'private',
+ icon: not_allowed,
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'private'
+ }]
+ }
+ }, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Trash'),
+ slug: 'trash',
icon: library_trash,
- supportsBulk: true,
- isEligible({
- status
- }) {
- return status === 'trash';
- },
- async callback(posts) {
- const promiseResult = await Promise.allSettled(posts.map(post => {
- return deleteEntityRecord('postType', post.type, post.id, {
- force: true
- }, {
- throwOnError: true
- });
- }));
- // If all the promises were fulfilled with success.
- if (promiseResult.every(({
- status
- }) => status === 'fulfilled')) {
- let successMessage;
- if (promiseResult.length === 1) {
- successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(posts[0].title.rendered));
- } else {
- successMessage = (0,external_wp_i18n_namespaceObject.__)('The posts were permanently deleted.');
- }
- createSuccessNotice(successMessage, {
- type: 'snackbar',
- id: 'edit-site-post-permanently-deleted'
- });
- } else {
- // If there was at lease one failure.
- let errorMessage;
- // If we were trying to permanently delete a single post.
- if (promiseResult.length === 1) {
- if (promiseResult[0].reason?.message) {
- errorMessage = promiseResult[0].reason.message;
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the post.');
- }
- // If we were trying to permanently delete multiple posts
- } else {
- const errorMessages = new Set();
- const failedPromises = promiseResult.filter(({
- status
- }) => status === 'rejected');
- for (const failedPromise of failedPromises) {
- if (failedPromise.reason?.message) {
- errorMessages.add(failedPromise.reason.message);
- }
- }
- if (errorMessages.size === 0) {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the posts.');
- } else if (errorMessages.size === 1) {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
- (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
- (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
- }
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
+ view: {
+ ...DEFAULT_PAGE_BASE,
+ filters: [{
+ field: 'status',
+ operator: OPERATOR_IS_ANY,
+ value: 'trash'
+ }]
}
- }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
-}
-function useRestorePostAction() {
+ }]
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-page/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+function AddNewPageModal({
+ onSave,
+ onClose
+}) {
+ const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
const {
- createSuccessNotice,
- createErrorNotice
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createErrorNotice,
+ createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
- editEntityRecord,
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
- id: 'restore',
- label: (0,external_wp_i18n_namespaceObject.__)('Restore'),
- isPrimary: true,
- icon: library_backup,
- supportsBulk: true,
- isEligible({
- status
- }) {
- return status === 'trash';
- },
- async callback(posts) {
- try {
- for (const post of posts) {
- await editEntityRecord('postType', post.type, post.id, {
- status: 'draft'
- });
- await saveEditedEntityRecord('postType', post.type, post.id, {
- throwOnError: true
- });
- }
- createSuccessNotice(posts.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
- (0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(posts[0].title.rendered)), {
- type: 'snackbar',
- id: 'edit-site-post-restored'
- });
- } catch (error) {
- let errorMessage;
- if (error.message && error.code !== 'unknown_error' && error.message) {
- errorMessage = error.message;
- } else if (posts.length > 1) {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.');
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.');
- }
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
+ resolveSelect
+ } = (0,external_wp_data_namespaceObject.useRegistry)();
+ async function createPage(event) {
+ event.preventDefault();
+ if (isCreatingPage) {
+ return;
}
- }), [createSuccessNotice, createErrorNotice, editEntityRecord, saveEditedEntityRecord]);
-}
-const viewPostAction = {
- id: 'view-post',
- label: (0,external_wp_i18n_namespaceObject.__)('View'),
- isPrimary: true,
- icon: library_external,
- isEligible(post) {
- return post.status !== 'trash';
- },
- callback(posts) {
- const post = posts[0];
- document.location.href = post.link;
- }
-};
-function useEditPostAction() {
- const history = actions_useHistory();
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
- id: 'edit-post',
- label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
- isEligible({
- status
- }) {
- return status !== 'trash';
- },
- callback(posts) {
- const post = posts[0];
- history.push({
- postId: post.id,
- postType: post.type,
- canvas: 'edit'
+ setIsCreatingPage(true);
+ try {
+ const pagePostType = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType('page');
+ const newPage = await saveEntityRecord('postType', 'page', {
+ status: 'draft',
+ title,
+ slug: title || (0,external_wp_i18n_namespaceObject.__)('No title'),
+ content: !!pagePostType.template && pagePostType.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], pagePostType.template)) : undefined
+ }, {
+ throwOnError: true
});
+ onSave(newPage);
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Title of the created template e.g: "Category".
+ (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), {
+ type: 'snackbar'
+ });
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the page.');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ } finally {
+ setIsCreatingPage(false);
}
- }), [history]);
-}
-const postRevisionsAction = {
- id: 'view-post-revisions',
- label: (0,external_wp_i18n_namespaceObject.__)('View revisions'),
- isPrimary: false,
- isEligible: post => {
- var _post$_links$predeces, _post$_links$version;
- if (post.status === 'trash') {
- return false;
- }
- const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null;
- const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
- return lastRevisionId && revisionsCount > 1;
- },
- callback(posts) {
- const post = posts[0];
- const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
- revision: post?._links?.['predecessor-version']?.[0]?.id
- });
- document.location.href = href;
}
-};
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Draft a new page'),
+ onRequestClose: onClose,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: createPage,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 3,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __next40pxDefaultSize: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Page title'),
+ onChange: setTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'),
+ value: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 2,
+ justify: "end",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ onClick: onClose,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "primary",
+ type: "submit",
+ isBusy: isCreatingPage,
+ "aria-disabled": isCreatingPage,
+ children: (0,external_wp_i18n_namespaceObject.__)('Create draft')
+ })]
+ })]
+ })
+ })
+ });
+}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/media/index.js
-
/**
* WordPress dependencies
*/
+
function Media({
id,
size = ['large', 'medium', 'thumbnail'],
@@ -42987,7 +33000,7 @@ function Media({
if (!mediaUrl) {
return null;
}
- return (0,external_React_.createElement)("img", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
...props,
src: mediaUrl,
alt: media.alt_text
@@ -42995,13 +33008,72 @@ function Media({
}
/* harmony default export */ const components_media = (Media);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-pages/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
+/**
+ * WordPress dependencies
+ */
+
+const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"
+ })
+});
+/* harmony default export */ const library_pencil = (pencil);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
/**
- * External dependencies
+ * Internal dependencies
+ */
+
+
+/* harmony default export */ const edit = (library_pencil);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
*/
+const {
+ useHistory: dataviews_actions_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const useEditPostAction = () => {
+ const history = dataviews_actions_useHistory();
+ return (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ id: 'edit-post',
+ label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
+ isPrimary: true,
+ icon: edit,
+ isEligible(post) {
+ if (post.status === 'trash') {
+ return false;
+ }
+ // It's eligible for all post types except theme patterns.
+ return post.type !== PATTERN_TYPES.theme;
+ },
+ callback(items) {
+ const post = items[0];
+ history.push({
+ postId: post.id,
+ postType: post.type,
+ canvas: 'edit'
+ });
+ }
+ }), [history]);
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-pages/index.js
/**
* WordPress dependencies
*/
@@ -43015,6 +33087,7 @@ function Media({
+
/**
* Internal dependencies
*/
@@ -43026,21 +33099,27 @@ function Media({
+
+
+
+
+const {
+ usePostActions
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
const {
useLocation: page_pages_useLocation,
useHistory: page_pages_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
const page_pages_EMPTY_ARRAY = [];
-const SUPPORTED_LAYOUTS = window?.__experimentalAdminViews ? [LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST] : [LAYOUT_GRID, LAYOUT_TABLE];
+const getFormattedDate = dateToDisplay => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay));
function useView(postType) {
const {
- params
+ params: {
+ activeView = 'all',
+ isCustom = 'false',
+ layout
+ }
} = page_pages_useLocation();
- const {
- activeView = 'all',
- isCustom = 'false',
- layout
- } = params;
const history = page_pages_useHistory();
const selectedDefaultView = (0,external_wp_element_namespaceObject.useMemo)(() => {
const defaultView = isCustom === 'false' && DEFAULT_VIEWS[postType].find(({
@@ -43095,13 +33174,16 @@ function useView(postType) {
}, [editEntityRecord, editedViewRecord?.id]);
const setDefaultViewAndUpdateUrl = (0,external_wp_element_namespaceObject.useCallback)(viewToSet => {
if (viewToSet.type !== view?.type) {
+ const {
+ params
+ } = history.getLocationWithParams();
history.push({
...params,
layout: viewToSet.type
});
}
setView(viewToSet);
- }, [params, view?.type, history]);
+ }, [history, view?.type]);
if (isCustom === 'false') {
return [view, setDefaultViewAndUpdateUrl];
} else if (isCustom === 'true' && customView) {
@@ -43138,6 +33220,7 @@ function FeaturedImage({
item,
viewType
}) {
+ const isDisabled = item.status === 'trash';
const {
onClick
} = useLink({
@@ -43147,50 +33230,58 @@ function FeaturedImage({
});
const hasMedia = !!item.featured_media;
const size = viewType === LAYOUT_GRID ? ['large', 'full', 'medium', 'thumbnail'] : ['thumbnail', 'medium', 'large', 'full'];
- const media = hasMedia ? (0,external_React_.createElement)(components_media, {
+ const media = hasMedia ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_media, {
className: "edit-site-page-pages__featured-image",
id: item.featured_media,
size: size
}) : null;
- if (viewType === LAYOUT_LIST) {
- return media;
- }
- return (0,external_React_.createElement)("button", {
- className: classnames_default()('page-pages-preview-field__button', {
- 'edit-site-page-pages__media-wrapper': viewType === LAYOUT_TABLE
- }),
- type: "button",
- onClick: onClick,
- "aria-label": item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)')
- }, media);
+ const renderButton = viewType !== LAYOUT_LIST && !isDisabled;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: `edit-site-page-pages__featured-image-wrapper is-layout-${viewType}`,
+ children: renderButton ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", {
+ className: "page-pages-preview-field__button",
+ type: "button",
+ onClick: onClick,
+ "aria-label": item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
+ children: media
+ }) : media
+ });
+}
+function getItemId(item) {
+ return item.id.toString();
}
function PagePages() {
+ var _pages$map, _usePrevious;
const postType = 'page';
const [view, setView] = useView(postType);
const history = page_pages_useHistory();
const {
- params
+ params: {
+ postId
+ }
} = page_pages_useLocation();
- const {
- isCustom = 'false'
- } = params;
+ const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]);
const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)(items => {
- if (isCustom === 'false' && view?.type === LAYOUT_LIST) {
+ var _params$isCustom;
+ const {
+ params
+ } = history.getLocationWithParams();
+ if (((_params$isCustom = params.isCustom) !== null && _params$isCustom !== void 0 ? _params$isCustom : 'false') === 'false' && view?.type === LAYOUT_LIST) {
history.push({
...params,
postId: items.length === 1 ? items[0].id : undefined
});
}
- }, [history, params, view?.type, isCustom]);
+ }, [history, view?.type]);
const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => {
const filters = {};
view.filters.forEach(filter => {
- if (filter.field === 'status' && filter.operator === OPERATOR_IN) {
+ if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) {
filters.status = filter.value;
}
- if (filter.field === 'author' && filter.operator === OPERATOR_IN) {
+ if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) {
filters.author = filter.value;
- } else if (filter.field === 'author' && filter.operator === OPERATOR_NOT_IN) {
+ } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) {
filters.author_exclude = filter.value;
}
});
@@ -43215,14 +33306,47 @@ function PagePages() {
totalItems,
totalPages
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', postType, queryArgs);
+ const ids = (_pages$map = pages?.map(page => getItemId(page))) !== null && _pages$map !== void 0 ? _pages$map : [];
+ const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : [];
+ const deletedIds = prevIds.filter(id => !ids.includes(id));
+ const postIdWasDeleted = deletedIds.includes(postId);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (postIdWasDeleted) {
+ history.push({
+ ...history.getLocationWithParams().params,
+ postId: undefined
+ });
+ }
+ }, [postIdWasDeleted, history]);
const {
records: authors,
isResolving: isLoadingAuthors
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user');
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user', {
+ per_page: -1
+ });
const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({
totalItems,
totalPages
}), [totalItems, totalPages]);
+ const {
+ frontPageId,
+ postsPageId,
+ addNewLabel,
+ canCreatePage
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecord,
+ getPostType,
+ canUser
+ } = select(external_wp_coreData_namespaceObject.store);
+ const siteSettings = getEntityRecord('root', 'site');
+ return {
+ frontPageId: siteSettings?.page_on_front,
+ postsPageId: siteSettings?.page_for_posts,
+ addNewLabel: getPostType('page')?.labels?.add_new_item,
+ canCreatePage: canUser('create', 'pages')
+ };
+ });
const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [{
id: 'featured-image',
header: (0,external_wp_i18n_namespaceObject.__)('Featured Image'),
@@ -43231,7 +33355,7 @@ function PagePages() {
}) => item.featured_media,
render: ({
item
- }) => (0,external_React_.createElement)(FeaturedImage, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FeaturedImage, {
item: item,
viewType: view.type
}),
@@ -43246,13 +33370,35 @@ function PagePages() {
render: ({
item
}) => {
- return [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type) ? (0,external_React_.createElement)(Link, {
+ const addLink = [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type) && item.status !== 'trash';
+ const title = addLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, {
params: {
postId: item.id,
postType: item.type,
canvas: 'edit'
- }
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)')) : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)');
+ },
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)')
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)')
+ });
+ let suffix = '';
+ if (item.id === frontPageId) {
+ suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "edit-site-page-pages__title-badge",
+ children: (0,external_wp_i18n_namespaceObject.__)('Front Page')
+ });
+ } else if (item.id === postsPageId) {
+ suffix = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "edit-site-page-pages__title-badge",
+ children: (0,external_wp_i18n_namespaceObject.__)('Posts Page')
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "edit-site-page-pages-title",
+ alignment: "center",
+ justify: "flex-start",
+ children: [title, suffix]
+ });
},
maxWidth: 300,
enableHiding: false
@@ -43262,7 +33408,6 @@ function PagePages() {
getValue: ({
item
}) => item._embedded?.author[0]?.name,
- type: ENUMERATION_TYPE,
elements: authors?.map(({
id,
name
@@ -43281,29 +33426,65 @@ function PagePages() {
value
}) => value === item.status)?.label) !== null && _STATUSES$find$label !== void 0 ? _STATUSES$find$label : item.status;
},
- type: ENUMERATION_TYPE,
elements: STATUSES,
enableSorting: false,
filterBy: {
- operators: [OPERATOR_IN]
+ operators: [OPERATOR_IS_ANY]
}
}, {
header: (0,external_wp_i18n_namespaceObject.__)('Date'),
id: 'date',
- getValue: ({
- item
- }) => item.date,
render: ({
item
}) => {
- const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(item.date));
- return (0,external_React_.createElement)("time", null, formattedDate);
+ const isDraftOrPrivate = ['draft', 'private'].includes(item.status);
+ if (isDraftOrPrivate) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */
+ (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(item.date)), {
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}),
+ time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {})
+ });
+ }
+ const isScheduled = item.status === 'future';
+ if (isScheduled) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */
+ (0,external_wp_i18n_namespaceObject.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate(item.date)), {
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}),
+ time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {})
+ });
+ }
+
+ // Pending & Published posts show the modified date if it's newer.
+ const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)(item.modified) > (0,external_wp_date_namespaceObject.getDate)(item.date) ? item.modified : item.date;
+ const isPending = item.status === 'pending';
+ if (isPending) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the newest of created or modified date for the page */
+ (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay)), {
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}),
+ time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {})
+ });
+ }
+ const isPublished = item.status === 'publish';
+ if (isPublished) {
+ return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the newest of created or modified date for the page */
+ (0,external_wp_i18n_namespaceObject.__)('<span>Published: <time>%s</time></span>'), getFormattedDate(dateToDisplay)), {
+ span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}),
+ time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {})
+ });
+ }
+
+ // Unknow status.
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {
+ children: getFormattedDate(item.date)
+ });
}
- }], [authors, view.type]);
- const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
- const restorePostAction = useRestorePostAction();
- const editPostAction = useEditPostAction();
- const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [viewPostAction, trashPostAction, restorePostAction, permanentlyDeletePostAction, editPostAction, postRevisionsAction], [permanentlyDeletePostAction, restorePostAction, editPostAction]);
+ }], [authors, view.type, frontPageId, postsPageId]);
+ const postTypeActions = usePostActions({
+ postType: 'page',
+ context: 'list'
+ });
+ const editAction = useEditPostAction();
+ const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]);
const onChangeView = (0,external_wp_element_namespaceObject.useCallback)(newView => {
if (newView.type !== view.type) {
newView = {
@@ -43316,17 +33497,9 @@ function PagePages() {
setView(newView);
}, [view.type, setView]);
const [showAddPageModal, setShowAddPageModal] = (0,external_wp_element_namespaceObject.useState)(false);
- const openModal = (0,external_wp_element_namespaceObject.useCallback)(() => {
- if (!showAddPageModal) {
- setShowAddPageModal(true);
- }
- }, [showAddPageModal]);
- const closeModal = (0,external_wp_element_namespaceObject.useCallback)(() => {
- if (showAddPageModal) {
- setShowAddPageModal(false);
- }
- }, [showAddPageModal]);
- const handleNewPage = (0,external_wp_element_namespaceObject.useCallback)(({
+ const openModal = () => setShowAddPageModal(true);
+ const closeModal = () => setShowAddPageModal(false);
+ const handleNewPage = ({
type,
id
}) => {
@@ -43336,85 +33509,411 @@ function PagePages() {
canvas: 'edit'
});
closeModal();
- }, [history]);
-
- // TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.
- return (0,external_React_.createElement)(Page, {
+ };
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, {
title: (0,external_wp_i18n_namespaceObject.__)('Pages'),
- actions: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: openModal
- }, (0,external_wp_i18n_namespaceObject.__)('Add new page')), showAddPageModal && (0,external_React_.createElement)(AddNewPageModal, {
- onSave: handleNewPage,
- onClose: closeModal
- }))
- }, (0,external_React_.createElement)(DataViews, {
- paginationInfo: paginationInfo,
- fields: fields,
- actions: actions,
- data: pages || page_pages_EMPTY_ARRAY,
- isLoading: isLoadingPages || isLoadingAuthors,
- view: view,
- onChangeView: onChangeView,
- onSelectionChange: onSelectionChange,
- supportedLayouts: SUPPORTED_LAYOUTS
- }));
+ actions: addNewLabel && canCreatePage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: openModal,
+ __next40pxDefaultSize: true,
+ children: addNewLabel
+ }), showAddPageModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPageModal, {
+ onSave: handleNewPage,
+ onClose: closeModal
+ })]
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, {
+ paginationInfo: paginationInfo,
+ fields: fields,
+ actions: actions,
+ data: pages || page_pages_EMPTY_ARRAY,
+ isLoading: isLoadingPages || isLoadingAuthors,
+ view: view,
+ onChangeView: onChangeView,
+ selection: selection,
+ setSelection: setSelection,
+ onSelectionChange: onSelectionChange,
+ getItemId: getItemId
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function filter_and_sort_data_view_normalizeSearchInput(input = '') {
+ return remove_accents_default()(input.trim().toLowerCase());
+}
+const filter_and_sort_data_view_EMPTY_ARRAY = [];
/**
+ * Applies the filtering, sorting and pagination to the raw data based on the view configuration.
+ *
+ * @param data Raw data.
+ * @param view View config.
+ * @param fields Fields config.
+ *
+ * @return Filtered, sorted and paginated data.
+ */
+function filterSortAndPaginate(data, view, fields) {
+ if (!data) {
+ return {
+ data: filter_and_sort_data_view_EMPTY_ARRAY,
+ paginationInfo: {
+ totalItems: 0,
+ totalPages: 0
+ }
+ };
+ }
+ const _fields = normalizeFields(fields);
+ let filteredData = [...data];
+ // Handle global search.
+ if (view.search) {
+ const normalizedSearch = filter_and_sort_data_view_normalizeSearchInput(view.search);
+ filteredData = filteredData.filter(item => {
+ return _fields.filter(field => field.enableGlobalSearch).map(field => {
+ return filter_and_sort_data_view_normalizeSearchInput(field.getValue({
+ item
+ }));
+ }).some(field => field.includes(normalizedSearch));
+ });
+ }
+ if (view.filters.length > 0) {
+ view.filters.forEach(filter => {
+ const field = _fields.find(_field => _field.id === filter.field);
+ if (field) {
+ if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) {
+ filteredData = filteredData.filter(item => {
+ const fieldValue = field.getValue({
+ item
+ });
+ if (Array.isArray(fieldValue)) {
+ return filter.value.some(filterValue => fieldValue.includes(filterValue));
+ } else if (typeof fieldValue === 'string') {
+ return filter.value.includes(fieldValue);
+ }
+ return false;
+ });
+ } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) {
+ filteredData = filteredData.filter(item => {
+ const fieldValue = field.getValue({
+ item
+ });
+ if (Array.isArray(fieldValue)) {
+ return !filter.value.some(filterValue => fieldValue.includes(filterValue));
+ } else if (typeof fieldValue === 'string') {
+ return !filter.value.includes(fieldValue);
+ }
+ return false;
+ });
+ } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) {
+ filteredData = filteredData.filter(item => {
+ return filter.value.every(value => {
+ return field.getValue({
+ item
+ })?.includes(value);
+ });
+ });
+ } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) {
+ filteredData = filteredData.filter(item => {
+ return filter.value.every(value => {
+ return !field.getValue({
+ item
+ })?.includes(value);
+ });
+ });
+ } else if (filter.operator === constants_OPERATOR_IS) {
+ filteredData = filteredData.filter(item => {
+ return filter.value === field.getValue({
+ item
+ });
+ });
+ } else if (filter.operator === constants_OPERATOR_IS_NOT) {
+ filteredData = filteredData.filter(item => {
+ return filter.value !== field.getValue({
+ item
+ });
+ });
+ }
+ }
+ });
+ }
+
+ // Handle sorting.
+ if (view.sort) {
+ const fieldId = view.sort.field;
+ const fieldToSort = _fields.find(field => {
+ return field.id === fieldId;
+ });
+ if (fieldToSort) {
+ filteredData.sort((a, b) => {
+ var _fieldToSort$getValue, _fieldToSort$getValue2;
+ const valueA = (_fieldToSort$getValue = fieldToSort.getValue({
+ item: a
+ })) !== null && _fieldToSort$getValue !== void 0 ? _fieldToSort$getValue : '';
+ const valueB = (_fieldToSort$getValue2 = fieldToSort.getValue({
+ item: b
+ })) !== null && _fieldToSort$getValue2 !== void 0 ? _fieldToSort$getValue2 : '';
+ return view.sort?.direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
+ });
+ }
+ }
+
+ // Handle pagination.
+ let totalItems = filteredData.length;
+ let totalPages = 1;
+ if (view.page !== undefined && view.perPage !== undefined) {
+ const start = (view.page - 1) * view.perPage;
+ totalItems = filteredData?.length || 0;
+ totalPages = Math.ceil(totalItems / view.perPage);
+ filteredData = filteredData?.slice(start, start + view.perPage);
+ }
+ return {
+ data: filteredData,
+ paginationInfo: {
+ totalItems,
+ totalPages
+ }
+ };
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js
+/**
* WordPress dependencies
*/
-const header_header = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.5 10.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"
-}));
-/* harmony default export */ const library_header = (header_header);
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"
+ })
+});
+/* harmony default export */ const lock_small = (lockSmall);
+
+;// CONCATENATED MODULE: external ["wp","priorityQueue"]
+const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/async/index.js
+/**
+ * WordPress dependencies
+ */
+
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
+const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)();
/**
+ * Renders a component at the next idle time.
+ * @param {*} props
+ */
+function Async({
+ children,
+ placeholder
+}) {
+ const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false);
+
+ // In the future, we could try to use startTransition here, but currently
+ // react will batch all transitions, which means all previews will be
+ // rendered at the same time.
+ // https://react.dev/reference/react/startTransition#caveats
+ // > If there are multiple ongoing Transitions, React currently batches them
+ // > together. This is a limitation that will likely be removed in a future
+ // > release.
+
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ const context = {};
+ blockPreviewQueue.add(context, () => {
+ // Synchronously run all renders so it consumes timeRemaining.
+ // See https://github.com/WordPress/gutenberg/pull/48238
+ (0,external_wp_element_namespaceObject.flushSync)(() => {
+ setShouldRender(true);
+ });
+ });
+ return () => {
+ blockPreviewQueue.cancel(context);
+ };
+ }, []);
+ if (!shouldRender) {
+ return placeholder;
+ }
+ return children;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js
+const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js
+/**
* WordPress dependencies
*/
-const footer = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
-}));
-/* harmony default export */ const library_footer = (footer);
-;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function usePatternSettings() {
+ var _storedSettings$__exp;
+ const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ return getSettings();
+ }, []);
+ const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp :
+ // WP 6.0
+ storedSettings.__experimentalBlockPatterns; // WP 5.9
+
+ const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []);
+ const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]);
+ const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const {
+ __experimentalAdditionalBlockPatterns,
+ ...restStoredSettings
+ } = storedSettings;
+ return {
+ ...restStoredSettings,
+ __experimentalBlockPatterns: blockPatterns,
+ __unstableIsPreviewMode: true
+ };
+ }, [storedSettings, blockPatterns]);
+ return settings;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js
/**
* WordPress dependencies
*/
-const lockSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- clipRule: "evenodd",
- d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"
-}));
-/* harmony default export */ const lock_small = (lockSmall);
-;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
-const external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/dataviews-pattern-actions.js
+/**
+ * Internal dependencies
+ */
+
+const {
+ extractWords,
+ getNormalizedSearchTerms,
+ normalizeString: search_items_normalizeString
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
/**
- * External dependencies
+ * Internal dependencies
*/
+// Default search helpers.
+const defaultGetName = item => item.name || '';
+const defaultGetTitle = item => item.title;
+const defaultGetDescription = item => item.description || '';
+const defaultGetKeywords = item => item.keywords || [];
+const defaultHasCategory = () => false;
+const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
+ return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
+};
+
+/**
+ * Filters an item list given a search term.
+ *
+ * @param {Array} items Item list
+ * @param {string} searchInput Search input.
+ * @param {Object} config Search Config.
+ *
+ * @return {Array} Filtered item list.
+ */
+const searchItems = (items = [], searchInput = '', config = {}) => {
+ const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
+
+ // Filter patterns by category: the default category indicates that all patterns will be shown.
+ const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length;
+ const searchRankConfig = {
+ ...config,
+ onlyFilterByCategory
+ };
+
+ // If we aren't filtering on search terms, matching on category is satisfactory.
+ // If we are, then we need more than a category match.
+ const threshold = onlyFilterByCategory ? 0 : 1;
+ const rankedItems = items.map(item => {
+ return [item, getItemSearchRank(item, searchInput, searchRankConfig)];
+ }).filter(([, rank]) => rank > threshold);
+
+ // If we didn't have terms to search on, there's no point sorting.
+ if (normalizedSearchTerms.length === 0) {
+ return rankedItems.map(([item]) => item);
+ }
+ rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
+ return rankedItems.map(([item]) => item);
+};
+
+/**
+ * Get the search rank for a given item and a specific search term.
+ * The better the match, the higher the rank.
+ * If the rank equals 0, it should be excluded from the results.
+ *
+ * @param {Object} item Item to filter.
+ * @param {string} searchTerm Search term.
+ * @param {Object} config Search Config.
+ *
+ * @return {number} Search Rank.
+ */
+function getItemSearchRank(item, searchTerm, config) {
+ const {
+ categoryId,
+ getName = defaultGetName,
+ getTitle = defaultGetTitle,
+ getDescription = defaultGetDescription,
+ getKeywords = defaultGetKeywords,
+ hasCategory = defaultHasCategory,
+ onlyFilterByCategory
+ } = config;
+ let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0;
+
+ // If an item doesn't belong to the current category or we don't have
+ // search terms to filter by, return the initial rank value.
+ if (!rank || onlyFilterByCategory) {
+ return rank;
+ }
+ const name = getName(item);
+ const title = getTitle(item);
+ const description = getDescription(item);
+ const keywords = getKeywords(item);
+ const normalizedSearchInput = search_items_normalizeString(searchTerm);
+ const normalizedTitle = search_items_normalizeString(title);
+
+ // Prefers exact matches
+ // Then prefers if the beginning of the title matches the search term
+ // name, keywords, description matches come later.
+ if (normalizedSearchInput === normalizedTitle) {
+ rank += 30;
+ } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
+ rank += 20;
+ } else {
+ const terms = [name, title, description, ...keywords].join(' ');
+ const normalizedSearchTerms = extractWords(normalizedSearchInput);
+ const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
+ if (unmatchedTerms.length === 0) {
+ rank += 10;
+ }
+ }
+ return rank;
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js
/**
* WordPress dependencies
*/
@@ -43424,6 +33923,246 @@ const external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const EMPTY_PATTERN_LIST = [];
+const createTemplatePartId = (theme, slug) => theme && slug ? theme + '//' + slug : null;
+const templatePartToPattern = templatePart => ({
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(templatePart.content.raw, {
+ __unstableSkipMigrationLogs: true
+ }),
+ categories: [templatePart.area],
+ description: templatePart.description || '',
+ isCustom: templatePart.source === TEMPLATE_ORIGINS.custom,
+ keywords: templatePart.keywords || [],
+ id: createTemplatePartId(templatePart.theme, templatePart.slug),
+ name: createTemplatePartId(templatePart.theme, templatePart.slug),
+ title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(templatePart.title.rendered),
+ type: templatePart.type,
+ _links: templatePart._links,
+ templatePart
+});
+const selectTemplatePartsAsPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => {
+ var _getEntityRecords;
+ const {
+ getEntityRecords,
+ isResolving: isResolvingSelector
+ } = select(external_wp_coreData_namespaceObject.store);
+ const {
+ __experimentalGetDefaultTemplatePartAreas
+ } = select(external_wp_editor_namespaceObject.store);
+ const query = {
+ per_page: -1
+ };
+ const rawTemplateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST;
+ const templateParts = rawTemplateParts.map(templatePart => templatePartToPattern(templatePart));
+
+ // In the case where a custom template part area has been removed we need
+ // the current list of areas to cross check against so orphaned template
+ // parts can be treated as uncategorized.
+ const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
+ const templatePartAreas = knownAreas.map(area => area.area);
+ const templatePartHasCategory = (item, category) => {
+ if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) {
+ return item.templatePart.area === category;
+ }
+ return item.templatePart.area === category || !templatePartAreas.includes(item.templatePart.area);
+ };
+ const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]);
+ const patterns = searchItems(templateParts, search, {
+ categoryId,
+ hasCategory: templatePartHasCategory
+ });
+ return {
+ patterns,
+ isResolving
+ };
+}, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+}), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+}]), select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas()]);
+const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => {
+ var _settings$__experimen;
+ const {
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ const {
+ isResolving: isResolvingSelector
+ } = select(external_wp_coreData_namespaceObject.store);
+ const settings = getSettings();
+ const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
+ const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
+ const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({
+ ...pattern,
+ keywords: pattern.keywords || [],
+ type: PATTERN_TYPES.theme,
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
+ __unstableSkipMigrationLogs: true
+ })
+ }));
+ return {
+ patterns,
+ isResolving: isResolvingSelector('getBlockPatterns')
+ };
+}, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), lock_unlock_unlock(select(store)).getSettings()]);
+const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => {
+ const {
+ patterns: themePatterns,
+ isResolving: isResolvingThemePatterns
+ } = selectThemePatterns(select);
+ const {
+ patterns: userPatterns,
+ isResolving: isResolvingUserPatterns
+ } = selectUserPatterns(select);
+ let patterns = [...(themePatterns || []), ...(userPatterns || [])];
+ if (syncStatus) {
+ // User patterns can have their sync statuses checked directly
+ // Non-user patterns are all unsynced for the time being.
+ patterns = patterns.filter(pattern => {
+ return pattern.type === PATTERN_TYPES.user ? pattern.syncStatus === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced;
+ });
+ }
+ if (categoryId) {
+ patterns = searchItems(patterns, search, {
+ categoryId,
+ hasCategory: (item, currentCategory) => item.categories?.includes(currentCategory)
+ });
+ } else {
+ patterns = searchItems(patterns, search, {
+ hasCategory: item => !item.hasOwnProperty('categories')
+ });
+ }
+ return {
+ patterns,
+ isResolving: isResolvingThemePatterns || isResolvingUserPatterns
+ };
+}, select => [selectThemePatterns(select), selectUserPatterns(select)]);
+
+/**
+ * Converts a post of type `wp_block` to a 'pattern item' that more closely
+ * matches the structure of theme provided patterns.
+ *
+ * @param {Object} patternPost The `wp_block` record being normalized.
+ * @param {Map} categories A Map of user created categories.
+ *
+ * @return {Object} The normalized item.
+ */
+const convertPatternPostToItem = (patternPost, categories) => ({
+ blocks: (0,external_wp_blocks_namespaceObject.parse)(patternPost.content.raw, {
+ __unstableSkipMigrationLogs: true
+ }),
+ ...(patternPost.wp_pattern_category.length > 0 && {
+ categories: patternPost.wp_pattern_category.map(patternCategoryId => categories && categories.get(patternCategoryId) ? categories.get(patternCategoryId).slug : patternCategoryId)
+ }),
+ termLabels: patternPost.wp_pattern_category.map(patternCategoryId => categories?.get(patternCategoryId) ? categories.get(patternCategoryId).label : patternCategoryId),
+ id: patternPost.id,
+ name: patternPost.slug,
+ syncStatus: patternPost.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full,
+ title: patternPost.title.raw,
+ type: patternPost.type,
+ description: patternPost.excerpt.raw,
+ patternPost
+});
+const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => {
+ const {
+ getEntityRecords,
+ isResolving: isResolvingSelector,
+ getUserPatternCategories
+ } = select(external_wp_coreData_namespaceObject.store);
+ const query = {
+ per_page: -1
+ };
+ const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query);
+ const userPatternCategories = getUserPatternCategories();
+ const categories = new Map();
+ userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory));
+ let patterns = patternPosts ? patternPosts.map(record => convertPatternPostToItem(record, categories)) : EMPTY_PATTERN_LIST;
+ const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]);
+ if (syncStatus) {
+ patterns = patterns.filter(pattern => pattern.syncStatus === syncStatus);
+ }
+ patterns = searchItems(patterns, search, {
+ // We exit user pattern retrieval early if we aren't in the
+ // catch-all category for user created patterns, so it has
+ // to be in the category.
+ hasCategory: () => true
+ });
+ return {
+ patterns,
+ isResolving,
+ categories: userPatternCategories
+ };
+}, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, {
+ per_page: -1
+}), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, {
+ per_page: -1
+}]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]);
+const usePatterns = (postType, categoryId, {
+ search = '',
+ syncStatus
+} = {}) => {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
+ if (postType === TEMPLATE_PART_POST_TYPE) {
+ return selectTemplatePartsAsPatterns(select, categoryId, search);
+ } else if (postType === PATTERN_TYPES.user && !!categoryId) {
+ const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId;
+ return selectPatterns(select, appliedCategory, syncStatus, search);
+ } else if (postType === PATTERN_TYPES.user) {
+ return selectUserPatterns(select, syncStatus, search);
+ }
+ return {
+ patterns: EMPTY_PATTERN_LIST,
+ isResolving: false
+ };
+ }, [categoryId, postType, search, syncStatus]);
+};
+/* harmony default export */ const use_patterns = (usePatterns);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
+/**
+ * WordPress dependencies
+ */
+
+
+const symbol_symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 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"
+ })
+});
+/* harmony default export */ const library_symbol = (symbol_symbol);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
+/**
+ * WordPress dependencies
+ */
+
+
+const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
+ })
+});
+/* harmony default export */ const library_upload = (upload);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
@@ -43438,336 +34177,207 @@ const external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"
+
const {
- useHistory: dataviews_pattern_actions_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
+ useHistory: add_new_pattern_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const {
+ CreatePatternModal,
+ useAddPatternCategory
+} = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis);
const {
- CreatePatternModalContents,
- useDuplicatePatternProps
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
-const exportJSONaction = {
- id: 'export-pattern',
- label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'),
- isEligible: item => item.type === PATTERN_TYPES.user,
- callback: ([item]) => {
- const json = {
- __file: item.type,
- title: item.title || item.name,
- content: item.patternPost.content.raw,
- syncStatus: item.patternPost.wp_pattern_sync_status
+ CreateTemplatePartModal: add_new_pattern_CreateTemplatePartModal
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+function AddNewPattern() {
+ const history = add_new_pattern_useHistory();
+ const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false);
+ // eslint-disable-next-line @wordpress/no-unused-vars-before-return
+ const {
+ createPatternFromFile
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store));
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)();
+ const {
+ isBlockBasedTheme,
+ addNewPatternLabel,
+ addNewTemplatePartLabel,
+ canCreatePattern,
+ canCreateTemplatePart
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getCurrentTheme,
+ getPostType,
+ canUser
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
+ addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
+ addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
+ canCreatePattern: canUser('create', 'blocks'),
+ canCreateTemplatePart: canUser('create', 'template-parts')
};
- return (0,external_wp_blob_namespaceObject.downloadBlob)(`${paramCase(item.title || item.name)}.json`, JSON.stringify(json, null, 2), 'application/json');
+ }, []);
+ function handleCreatePattern({
+ pattern
+ }) {
+ setShowPatternModal(false);
+ history.push({
+ postId: pattern.id,
+ postType: PATTERN_TYPES.user,
+ canvas: 'edit'
+ });
}
-};
-const renameAction = {
- id: 'rename-pattern',
- label: (0,external_wp_i18n_namespaceObject.__)('Rename'),
- isEligible: item => {
- const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- const isUserPattern = item.type === PATTERN_TYPES.user;
- const isCustomPattern = isUserPattern || isTemplatePart && item.isCustom;
- const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
- return isCustomPattern && !hasThemeFile;
- },
- RenderModal: ({
- items,
- closeModal
- }) => {
- const [item] = items;
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => item.title);
- const {
- editEntityRecord,
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- async function onRename(event) {
- event.preventDefault();
- try {
- await editEntityRecord('postType', item.type, item.id, {
- title
- });
- // Update state before saving rerenders the list.
- setTitle('');
- closeModal();
- // Persist edited entity.
- await saveEditedEntityRecord('postType', item.type, item.id, {
- throwOnError: true
- });
- createSuccessNotice(item.type === TEMPLATE_PART_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Template part renamed.') : (0,external_wp_i18n_namespaceObject.__)('Pattern renamed.'), {
- type: 'snackbar'
- });
- } catch (error) {
- const fallbackErrorMessage = item.type === TEMPLATE_PART_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the pattern.');
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_React_.createElement)("form", {
- onSubmit: onRename
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- __next40pxDefaultSize: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- required: true
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- variant: "tertiary",
+ function handleCreateTemplatePart(templatePart) {
+ setShowTemplatePartModal(false);
+
+ // Navigate to the created template part editor.
+ history.push({
+ postId: templatePart.id,
+ postType: TEMPLATE_PART_POST_TYPE,
+ canvas: 'edit'
+ });
+ }
+ function handleError() {
+ setShowPatternModal(false);
+ setShowTemplatePartModal(false);
+ }
+ const controls = [];
+ if (canCreatePattern) {
+ controls.push({
+ icon: library_symbol,
+ onClick: () => setShowPatternModal(true),
+ title: addNewPatternLabel
+ });
+ }
+ if (isBlockBasedTheme && canCreateTemplatePart) {
+ controls.push({
+ icon: symbol_filled,
+ onClick: () => setShowTemplatePartModal(true),
+ title: addNewTemplatePartLabel
+ });
+ }
+ if (canCreatePattern) {
+ controls.push({
+ icon: library_upload,
onClick: () => {
- closeModal();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- __next40pxDefaultSize: true,
- variant: "primary",
- type: "submit"
- }, (0,external_wp_i18n_namespaceObject.__)('Save')))));
+ patternUploadInputRef.current.click();
+ },
+ title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON')
+ });
}
-};
-const canDeleteOrReset = item => {
- const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- const isUserPattern = item.type === PATTERN_TYPES.user;
- return isUserPattern || isTemplatePart && item.isCustom;
-};
-const deleteAction = {
- id: 'delete-pattern',
- label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
- isEligible: item => {
- const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
- return canDeleteOrReset(item) && !hasThemeFile;
- },
- hideModalHeader: true,
- supportsBulk: true,
- RenderModal: ({
- items,
- closeModal,
- onPerform
- }) => {
- const {
- __experimentalDeleteReusableBlock
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_reusableBlocks_namespaceObject.store);
- const {
- createErrorNotice,
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- removeTemplates
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- const deletePattern = async () => {
- const promiseResult = await Promise.allSettled(items.map(item => {
- return __experimentalDeleteReusableBlock(item.id);
- }));
- // If all the promises were fulfilled with success.
- if (promiseResult.every(({
- status
- }) => status === 'fulfilled')) {
- let successMessage;
- if (promiseResult.length === 1) {
- successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), items[0].title);
- } else {
- successMessage = (0,external_wp_i18n_namespaceObject.__)('The patterns were deleted.');
+ const {
+ categoryMap,
+ findOrCreateTerm
+ } = useAddPatternCategory();
+ if (controls.length === 0) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ controls: controls,
+ icon: null,
+ toggleProps: {
+ variant: 'primary',
+ showTooltip: false,
+ __next40pxDefaultSize: true
+ },
+ text: addNewPatternLabel,
+ label: addNewPatternLabel
+ }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, {
+ onClose: () => setShowPatternModal(false),
+ onSuccess: handleCreatePattern,
+ onError: handleError
+ }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_pattern_CreateTemplatePartModal, {
+ closeModal: () => setShowTemplatePartModal(false),
+ blocks: [],
+ onCreate: handleCreateTemplatePart,
+ onError: handleError
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", {
+ type: "file",
+ accept: ".json",
+ hidden: true,
+ ref: patternUploadInputRef,
+ onChange: async event => {
+ const file = event.target.files?.[0];
+ if (!file) {
+ return;
}
- createSuccessNotice(successMessage, {
- type: 'snackbar',
- id: 'edit-site-page-trashed'
- });
- } else {
- // If there was at lease one failure.
- let errorMessage;
- // If we were trying to delete a single pattern.
- if (promiseResult.length === 1) {
- if (promiseResult[0].reason?.message) {
- errorMessage = promiseResult[0].reason.message;
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern.');
- }
- // If we were trying to delete multiple patterns.
- } else {
- const errorMessages = new Set();
- const failedPromises = promiseResult.filter(({
- status
- }) => status === 'rejected');
- for (const failedPromise of failedPromises) {
- if (failedPromise.reason?.message) {
- errorMessages.add(failedPromise.reason.message);
+ try {
+ const {
+ params: {
+ postType,
+ categoryId
+ }
+ } = history.getLocationWithParams();
+ let currentCategoryId;
+ // When we're not handling template parts, we should
+ // add or create the proper pattern category.
+ if (postType !== TEMPLATE_PART_POST_TYPE) {
+ const currentCategory = categoryMap.values().find(term => term.name === categoryId);
+ if (currentCategory) {
+ currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label));
}
}
- if (errorMessages.size === 0) {
- errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the patterns.');
- } else if (errorMessages.size === 1) {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
- (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the patterns: %s'), [...errorMessages][0]);
- } else {
- errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
- (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the patterns: %s'), [...errorMessages].join(','));
+ const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined);
+
+ // Navigate to the All patterns category for the newly created pattern
+ // if we're not on that page already and if we're not in the `my-patterns`
+ // category.
+ if (!currentCategoryId && categoryId !== 'my-patterns') {
+ history.push({
+ postType: PATTERN_TYPES.user,
+ categoryId: PATTERN_DEFAULT_CATEGORY
+ });
}
- createErrorNotice(errorMessage, {
- type: 'snackbar'
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The imported pattern's title.
+ (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), {
+ type: 'snackbar',
+ id: 'import-pattern-success'
});
+ } catch (err) {
+ createErrorNotice(err.message, {
+ type: 'snackbar',
+ id: 'import-pattern-error'
+ });
+ } finally {
+ event.target.value = '';
}
}
- };
- const deleteItem = () => {
- if (items[0].type === TEMPLATE_PART_POST_TYPE) {
- removeTemplates(items);
- } else {
- deletePattern();
- }
- if (onPerform) {
- onPerform();
- }
- closeModal();
- };
- let questionMessage;
- if (items.length === 1) {
- questionMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The page's title.
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(items[0].title || items[0].name));
- } else if (items.length > 1 && items[0].type === TEMPLATE_PART_POST_TYPE) {
- questionMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %d: The number of template parts (2 or more).
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete %d template parts?'), items.length);
- } else {
- questionMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %d: The number of patterns (2 or more).
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete %d patterns?'), items.length);
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, questionMessage), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: closeModal
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: deleteItem
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))));
- }
-};
-const resetAction = {
- id: 'reset-action',
- label: (0,external_wp_i18n_namespaceObject.__)('Clear customizations'),
- isEligible: item => {
- const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
- return canDeleteOrReset(item) && hasThemeFile;
- },
- hideModalHeader: true,
- RenderModal: ({
- items,
- closeModal
- }) => {
- const [item] = items;
- const {
- removeTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to clear these customizations?')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: closeModal
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: () => removeTemplate(item)
- }, (0,external_wp_i18n_namespaceObject.__)('Clear'))));
- }
-};
-const duplicatePatternAction = {
- id: 'duplicate-pattern',
- label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
- isEligible: item => item.type !== TEMPLATE_PART_POST_TYPE,
- modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'),
- RenderModal: ({
- items,
- closeModal
- }) => {
- const [item] = items;
- const {
- categoryId = PATTERN_DEFAULT_CATEGORY
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const isThemePattern = item.type === PATTERN_TYPES.theme;
- const history = dataviews_pattern_actions_useHistory();
- function onPatternSuccess({
- pattern
- }) {
- history.push({
- categoryType: PATTERN_TYPES.theme,
- categoryId,
- postType: PATTERN_TYPES.user,
- postId: pattern.id
- });
- closeModal();
- }
- const duplicatedProps = useDuplicatePatternProps({
- pattern: isThemePattern ? item : item.patternPost,
- onSuccess: onPatternSuccess
- });
- return (0,external_React_.createElement)(CreatePatternModalContents, {
- onClose: closeModal,
- confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
- ...duplicatedProps
- });
- }
-};
-const duplicateTemplatePartAction = {
- id: 'duplicate-template-part',
- label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
- isEligible: item => item.type === TEMPLATE_PART_POST_TYPE,
- modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'),
- RenderModal: ({
- items,
- closeModal
- }) => {
- const [item] = items;
- const {
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+function useDefaultPatternCategories() {
+ const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _settings$__experimen;
const {
- categoryId = PATTERN_DEFAULT_CATEGORY
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const history = dataviews_pattern_actions_useHistory();
- async function onTemplatePartSuccess(templatePart) {
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
- (0,external_wp_i18n_namespaceObject.__)('"%s" duplicated.'), item.title), {
- type: 'snackbar',
- id: 'edit-site-patterns-success'
- });
- history.push({
- postType: TEMPLATE_PART_POST_TYPE,
- postId: templatePart?.id,
- categoryType: TEMPLATE_PART_POST_TYPE,
- categoryId
- });
- closeModal();
- }
- return (0,external_React_.createElement)(CreateTemplatePartModalContents, {
- blocks: item.blocks,
- defaultArea: item.templatePart.area,
- defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing template part title */
- (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), item.title),
- onCreate: onTemplatePartSuccess,
- onError: closeModal,
- confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label')
- });
- }
-};
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ const settings = getSettings();
+ return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories;
+ });
+ const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories());
+ return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])];
+}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js
/**
* WordPress dependencies
*/
@@ -43781,36 +34391,120 @@ const duplicateTemplatePartAction = {
-function usePatternSettings() {
- var _storedSettings$__exp;
- const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => {
+
+function useThemePatterns() {
+ const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _getSettings$__experi;
const {
getSettings
- } = unlock(select(store_store));
- return getSettings();
- }, []);
- const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp :
- // WP 6.0
- storedSettings.__experimentalBlockPatterns; // WP 5.9
+ } = lock_unlock_unlock(select(store));
+ return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns;
+ });
+ const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns());
+ const patterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]);
+ return patterns;
+}
- const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []);
- const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]);
- const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const {
- __experimentalAdditionalBlockPatterns,
- ...restStoredSettings
- } = storedSettings;
- return {
- ...restStoredSettings,
- __experimentalBlockPatterns: blockPatterns,
- __unstableIsPreviewMode: true
- };
- }, [storedSettings, blockPatterns]);
- return settings;
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function usePatternCategories() {
+ const defaultCategories = useDefaultPatternCategories();
+ defaultCategories.push({
+ name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
+ label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
+ });
+ const themePatterns = useThemePatterns();
+ const {
+ patterns: userPatterns,
+ categories: userPatternCategories
+ } = use_patterns(PATTERN_TYPES.user);
+ const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const categoryMap = {};
+ const categoriesWithCounts = [];
+
+ // Create a map for easier counting of patterns in categories.
+ defaultCategories.forEach(category => {
+ if (!categoryMap[category.name]) {
+ categoryMap[category.name] = {
+ ...category,
+ count: 0
+ };
+ }
+ });
+ userPatternCategories.forEach(category => {
+ if (!categoryMap[category.name]) {
+ categoryMap[category.name] = {
+ ...category,
+ count: 0
+ };
+ }
+ });
+
+ // Update the category counts to reflect theme registered patterns.
+ themePatterns.forEach(pattern => {
+ pattern.categories?.forEach(category => {
+ if (categoryMap[category]) {
+ categoryMap[category].count += 1;
+ }
+ });
+ // If the pattern has no categories, add it to uncategorized.
+ if (!pattern.categories?.length) {
+ categoryMap.uncategorized.count += 1;
+ }
+ });
+
+ // Update the category counts to reflect user registered patterns.
+ userPatterns.forEach(pattern => {
+ pattern.categories?.forEach(category => {
+ if (categoryMap[category]) {
+ categoryMap[category].count += 1;
+ }
+ });
+ // If the pattern has no categories, add it to uncategorized.
+ if (!pattern.categories?.length) {
+ categoryMap.uncategorized.count += 1;
+ }
+ });
+
+ // Filter categories so we only have those containing patterns.
+ [...defaultCategories, ...userPatternCategories].forEach(category => {
+ if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) {
+ categoriesWithCounts.push(categoryMap[category.name]);
+ }
+ });
+ const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label));
+ sortedCategories.unshift({
+ name: PATTERN_USER_CATEGORY,
+ label: (0,external_wp_i18n_namespaceObject.__)('My patterns'),
+ count: userPatterns.length
+ });
+ sortedCategories.unshift({
+ name: PATTERN_DEFAULT_CATEGORY,
+ label: (0,external_wp_i18n_namespaceObject.__)('All patterns'),
+ description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'),
+ count: themePatterns.length + userPatterns.length
+ });
+ return sortedCategories;
+ }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]);
+ return {
+ patternCategories,
+ hasPatterns: !!patternCategories.length
+ };
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js
-
/**
* WordPress dependencies
*/
@@ -43827,25 +34521,31 @@ function usePatternSettings() {
* Internal dependencies
*/
+
+
+
const {
RenamePatternCategoryModal
-} = unlock(external_wp_patterns_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis);
function RenameCategoryMenuItem({
category,
onClose
}) {
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => setIsModalOpen(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_React_.createElement)(rename_category_menu_item_RenameModal, {
- category: category,
- onClose: () => {
- setIsModalOpen(false);
- onClose();
- }
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => setIsModalOpen(true),
+ children: (0,external_wp_i18n_namespaceObject.__)('Rename')
+ }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, {
+ category: category,
+ onClose: () => {
+ setIsModalOpen(false);
+ onClose();
+ }
+ })]
+ });
}
-function rename_category_menu_item_RenameModal({
+function RenameModal({
category,
onClose
}) {
@@ -43860,7 +34560,7 @@ function rename_category_menu_item_RenameModal({
// Optimization - only use pattern categories when the modal is open.
const existingCategories = usePatternCategories();
- return (0,external_React_.createElement)(RenamePatternCategoryModal, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, {
category: normalizedCategory,
existingCategories: existingCategories,
onClose: onClose,
@@ -43869,7 +34569,6 @@ function rename_category_menu_item_RenameModal({
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js
-
/**
* WordPress dependencies
*/
@@ -43887,9 +34586,12 @@ function rename_category_menu_item_RenameModal({
*/
+
+
+
const {
useHistory: delete_category_menu_item_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
function DeleteCategoryMenuItem({
category,
onClose
@@ -43925,8 +34627,7 @@ function DeleteCategoryMenuItem({
});
onClose?.();
history.push({
- path: `/patterns`,
- categoryType: PATTERN_TYPES.theme,
+ postType: PATTERN_TYPES.user,
categoryId: PATTERN_DEFAULT_CATEGORY
});
} catch (error) {
@@ -43937,22 +34638,30 @@ function DeleteCategoryMenuItem({
});
}
};
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
- isDestructive: true,
- onClick: () => setIsModalOpen(true)
- }, (0,external_wp_i18n_namespaceObject.__)('Delete')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
- isOpen: isModalOpen,
- onConfirm: onDelete,
- onCancel: () => setIsModalOpen(false),
- confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'),
- className: "edit-site-patterns__delete-modal"
- }, (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The pattern category's name.
- (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ isDestructive: true,
+ onClick: () => setIsModalOpen(true),
+ children: (0,external_wp_i18n_namespaceObject.__)('Delete')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: isModalOpen,
+ onConfirm: onDelete,
+ onCancel: () => setIsModalOpen(false),
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'),
+ className: "edit-site-patterns__delete-modal",
+ title: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The pattern category's name.
+ (0,external_wp_i18n_namespaceObject.__)('Delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)),
+ size: "medium",
+ __experimentalHideHeader: false,
+ children: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The pattern category's name.
+ (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label))
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js
-
/**
* WordPress dependencies
*/
@@ -43969,6 +34678,9 @@ function DeleteCategoryMenuItem({
+
+
+
function PatternsHeader({
categoryId,
type,
@@ -43982,46 +34694,200 @@ function PatternsHeader({
let title, description, patternCategory;
if (type === TEMPLATE_PART_POST_TYPE) {
const templatePartArea = templatePartAreas.find(area => area.area === categoryId);
- title = templatePartArea?.label;
- description = templatePartArea?.description;
- } else if (type === PATTERN_TYPES.theme) {
+ title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts');
+ description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.');
+ } else if (type === PATTERN_TYPES.user && !!categoryId) {
patternCategory = patternCategories.find(category => category.name === categoryId);
title = patternCategory?.label;
description = patternCategory?.description;
}
- if (!title) return null;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-patterns__section-header"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- as: "h2",
- level: 4,
- id: titleId
- }, title), !!patternCategory?.id && (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- toggleProps: {
- className: 'edit-site-patterns__button',
- describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: pattern category name */
- (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title)
- }
- }, ({
- onClose
- }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(RenameCategoryMenuItem, {
- category: patternCategory,
- onClose: onClose
- }), (0,external_React_.createElement)(DeleteCategoryMenuItem, {
- category: patternCategory,
- onClose: onClose
- })))), description ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted",
- as: "p",
- id: descriptionId
- }, description) : null);
+ if (!title) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "edit-site-patterns__section-header",
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "space-between",
+ className: "edit-site-patterns__title",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ as: "h2",
+ level: 3,
+ id: titleId,
+ weight: 500,
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ expanded: false,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ toggleProps: {
+ className: 'edit-site-patterns__button',
+ describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: pattern category name */
+ (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title),
+ size: 'compact'
+ },
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, {
+ category: patternCategory,
+ onClose: onClose
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, {
+ category: patternCategory,
+ onClose: onClose
+ })]
+ })
+ })]
+ })]
+ }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ as: "p",
+ id: descriptionId,
+ className: "edit-site-patterns__sub-title",
+ children: description
+ }) : null]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
+/**
+ * WordPress dependencies
+ */
+
+
+const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_plugins = (plugins);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js
+/**
+ * WordPress dependencies
+ */
+
+
+const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_globe = (globe);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
+/**
+ * WordPress dependencies
+ */
+
+
+const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ 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",
+ clipRule: "evenodd"
+ })
+});
+/* harmony default export */ const comment_author_avatar = (commentAuthorAvatar);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/** @typedef {'wp_template'|'wp_template_part'} TemplateType */
+
+/**
+ * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType
+ *
+ * @typedef AddedByData
+ * @type {Object}
+ * @property {AddedByType} type The type of the data.
+ * @property {JSX.Element} icon The icon to display.
+ * @property {string} [imageUrl] The optional image URL to display.
+ * @property {string} [text] The text to display.
+ * @property {boolean} isCustomized Whether the template has been customized.
+ *
+ * @param {TemplateType} postType The template post type.
+ * @param {number} postId The template post id.
+ * @return {AddedByData} The added by object or null.
+ */
+function useAddedBy(postType, postId) {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecord,
+ getMedia,
+ getUser,
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const template = getEditedEntityRecord('postType', postType, postId);
+ const originalSource = template?.original_source;
+ const authorText = template?.author_text;
+ switch (originalSource) {
+ case 'theme':
+ {
+ return {
+ type: originalSource,
+ icon: library_layout,
+ text: authorText,
+ isCustomized: template.source === TEMPLATE_ORIGINS.custom
+ };
+ }
+ case 'plugin':
+ {
+ return {
+ type: originalSource,
+ icon: library_plugins,
+ text: authorText,
+ isCustomized: template.source === TEMPLATE_ORIGINS.custom
+ };
+ }
+ case 'site':
+ {
+ const siteData = getEntityRecord('root', '__unstableBase');
+ return {
+ type: originalSource,
+ icon: library_globe,
+ imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined,
+ text: authorText,
+ isCustomized: false
+ };
+ }
+ default:
+ {
+ const user = getUser(template.author);
+ return {
+ type: 'user',
+ icon: comment_author_avatar,
+ imageUrl: user?.avatar_urls?.[48],
+ text: authorText,
+ isCustomized: false
+ };
+ }
+ }
+ }, [postType, postId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js
+/**
+ * External dependencies
+ */
+
/**
* WordPress dependencies
@@ -44035,6 +34901,8 @@ function PatternsHeader({
+
+
/**
* Internal dependencies
*/
@@ -44046,20 +34914,29 @@ function PatternsHeader({
+
+
+
+
const {
ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider,
useGlobalStyle: page_patterns_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const templatePartIcons = {
- header: library_header,
- footer: library_footer,
- uncategorized: symbol_filled
-};
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ usePostActions: page_patterns_usePostActions
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const {
+ useLocation: page_patterns_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
const page_patterns_EMPTY_ARRAY = [];
const defaultConfigPerViewType = {
+ [LAYOUT_TABLE]: {
+ primaryField: 'title'
+ },
[LAYOUT_GRID]: {
mediaField: 'preview',
- primaryField: 'title'
+ primaryField: 'title',
+ badgeFields: ['sync-status']
}
};
const DEFAULT_VIEW = {
@@ -44067,7 +34944,7 @@ const DEFAULT_VIEW = {
search: '',
page: 1,
perPage: 20,
- hiddenFields: ['sync-status'],
+ hiddenFields: [],
layout: {
...defaultConfigPerViewType[LAYOUT_GRID]
},
@@ -44075,11 +34952,11 @@ const DEFAULT_VIEW = {
};
const SYNC_FILTERS = [{
value: PATTERN_SYNC_TYPES.full,
- label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that shows all synchronized patterns'),
+ label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'),
description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.')
}, {
value: PATTERN_SYNC_TYPES.unsynced,
- label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'Option that shows all patterns that are not synchronized'),
+ label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'),
description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.')
}];
function PreviewWrapper({
@@ -44088,125 +34965,138 @@ function PreviewWrapper({
ariaDescribedBy,
children
}) {
- if (item.type === PATTERN_TYPES.theme) {
- return children;
- }
- return (0,external_React_.createElement)("button", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", {
className: "page-patterns-preview-field__button",
type: "button",
- onClick: onClick,
+ onClick: item.type !== PATTERN_TYPES.theme ? onClick : undefined,
"aria-label": item.title,
- "aria-describedby": ariaDescribedBy
- }, children);
+ "aria-describedby": ariaDescribedBy,
+ "aria-disabled": item.type === PATTERN_TYPES.theme,
+ children: children
+ });
}
function Preview({
item,
- categoryId,
viewType
}) {
const descriptionId = (0,external_wp_element_namespaceObject.useId)();
const isUserPattern = item.type === PATTERN_TYPES.user;
- const isNonUserPattern = item.type === PATTERN_TYPES.theme;
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
const isEmpty = !item.blocks?.length;
- // Only custom patterns or custom template parts can be renamed or deleted.
- const isCustomPattern = isUserPattern || isTemplatePart && item.isCustom;
- const ariaDescriptions = [];
- if (isCustomPattern) {
- // User patterns don't have descriptions, but can be edited and deleted, so include some help text.
- ariaDescriptions.push((0,external_wp_i18n_namespaceObject.__)('Press Enter to edit, or Delete to delete the pattern.'));
- } else if (item.description) {
- ariaDescriptions.push(item.description);
- }
- if (isNonUserPattern) {
- ariaDescriptions.push((0,external_wp_i18n_namespaceObject.__)('Theme & plugin patterns cannot be edited.'));
- }
const [backgroundColor] = page_patterns_useGlobalStyle('color.background');
const {
onClick
} = useLink({
postType: item.type,
postId: isUserPattern ? item.id : item.name,
- categoryId,
- categoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme
+ canvas: 'edit'
});
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: `page-patterns-preview-field is-viewtype-${viewType}`,
style: {
backgroundColor
- }
- }, (0,external_React_.createElement)(PreviewWrapper, {
- item: item,
- onClick: onClick,
- ariaDescribedBy: ariaDescriptions.length ? ariaDescriptions.map((_, index) => `${descriptionId}-${index}`).join(' ') : undefined
- }, isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty template part'), isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty pattern'), !isEmpty && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockPreview, {
- blocks: item.blocks
- }))), ariaDescriptions.map((ariaDescription, index) => (0,external_React_.createElement)("div", {
- key: index,
- hidden: true,
- id: `${descriptionId}-${index}`
- }, ariaDescription)));
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, {
+ item: item,
+ onClick: onClick,
+ ariaDescribedBy: item.description ? descriptionId : undefined,
+ children: [isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty template part'), isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty pattern'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Async, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, {
+ blocks: item.blocks,
+ viewportWidth: item.viewportWidth
+ })
+ })]
+ }), item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ hidden: true,
+ id: descriptionId,
+ children: item.description
+ })]
+ });
}
-function Title({
+function Author({
item,
- categoryId
+ viewType
+}) {
+ const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ text,
+ icon,
+ imageUrl
+ } = useAddedBy(item.type, item.id);
+ const withIcon = viewType !== LAYOUT_LIST;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ alignment: "left",
+ spacing: 1,
+ children: [withIcon && imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('page-templates-author-field__avatar', {
+ 'is-loaded': isImageLoaded
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ onLoad: () => setIsImageLoaded(true),
+ alt: "",
+ src: imageUrl
+ })
+ }), withIcon && !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "page-templates-author-field__icon",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
+ icon: icon
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "page-templates-author-field__name",
+ children: text
+ })]
+ });
+}
+function Title({
+ item
}) {
const isUserPattern = item.type === PATTERN_TYPES.user;
- const isNonUserPattern = item.type === PATTERN_TYPES.theme;
- const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- let itemIcon;
const {
onClick
} = useLink({
postType: item.type,
postId: isUserPattern ? item.id : item.name,
- categoryId,
- categoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme
+ canvas: 'edit'
});
- if (!isUserPattern && templatePartIcons[categoryId]) {
- itemIcon = templatePartIcons[categoryId];
- } else {
- itemIcon = item.syncStatus === PATTERN_SYNC_TYPES.full ? library_symbol : undefined;
- }
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center",
justify: "flex-start",
- spacing: 2
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
- as: "div",
- gap: 0,
- justify: "left",
- className: "edit-site-patterns__pattern-title"
- }, item.type === PATTERN_TYPES.theme ? item.title : (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "link",
- onClick: onClick
- // Required for the grid's roving tab index system.
- // See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
- ,
- tabIndex: "-1"
- }, item.title || item.name)), itemIcon && !isNonUserPattern && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- placement: "top",
- text: (0,external_wp_i18n_namespaceObject.__)('Editing this pattern will also update anywhere it is used')
- }, (0,external_React_.createElement)(build_module_icon, {
- className: "edit-site-patterns__pattern-icon",
- icon: itemIcon
- })), item.type === PATTERN_TYPES.theme && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
- placement: "top",
- text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.')
- }, (0,external_React_.createElement)(build_module_icon, {
- className: "edit-site-patterns__pattern-lock-icon",
- icon: lock_small,
- size: 24
- })));
+ spacing: 2,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ as: "div",
+ gap: 0,
+ justify: "left",
+ className: "edit-site-patterns__pattern-title",
+ children: item.type === PATTERN_TYPES.theme ? item.title : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "link",
+ onClick: onClick
+ // Required for the grid's roving tab index system.
+ // See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
+ ,
+ tabIndex: "-1",
+ children: item.title || item.name
+ })
+ }), item.type === PATTERN_TYPES.theme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
+ placement: "top",
+ text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
+ className: "edit-site-patterns__pattern-lock-icon",
+ icon: lock_small,
+ size: 24
+ })
+ })]
+ });
}
function DataviewsPatterns() {
const {
- categoryType,
- categoryId = PATTERN_DEFAULT_CATEGORY
- } = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href);
- const type = categoryType || PATTERN_TYPES.theme;
+ params: {
+ postType,
+ categoryId: categoryIdFromURL
+ }
+ } = page_patterns_useLocation();
+ const type = postType || PATTERN_TYPES.user;
+ const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW);
- const isUncategorizedThemePatterns = type === PATTERN_TYPES.theme && categoryId === 'uncategorized';
const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId);
const viewSyncStatus = view.filters?.find(({
field
@@ -44214,63 +35104,101 @@ function DataviewsPatterns() {
const {
patterns,
isResolving
- } = use_patterns(type, isUncategorizedThemePatterns ? '' : categoryId, {
+ } = use_patterns(type, categoryId, {
search: view.search,
syncStatus: viewSyncStatus
});
+ const {
+ records
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+ });
+ const authors = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!records) {
+ return page_patterns_EMPTY_ARRAY;
+ }
+ const authorsSet = new Set();
+ records.forEach(template => {
+ authorsSet.add(template.author_text);
+ });
+ return Array.from(authorsSet).map(author => ({
+ value: author,
+ label: author
+ }));
+ }, [records]);
const fields = (0,external_wp_element_namespaceObject.useMemo)(() => {
const _fields = [{
header: (0,external_wp_i18n_namespaceObject.__)('Preview'),
id: 'preview',
render: ({
item
- }) => (0,external_React_.createElement)(Preview, {
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Preview, {
item: item,
- categoryId: categoryId,
viewType: view.type
}),
enableSorting: false,
- enableHiding: false
+ enableHiding: false,
+ width: '1%'
}, {
header: (0,external_wp_i18n_namespaceObject.__)('Title'),
id: 'title',
- getValue: ({
- item
- }) => item.title,
render: ({
item
- }) => (0,external_React_.createElement)(Title, {
- item: item,
- categoryId: categoryId
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Title, {
+ item: item
}),
enableHiding: false
}];
- if (type === PATTERN_TYPES.theme) {
+ if (type === PATTERN_TYPES.user) {
_fields.push({
- header: (0,external_wp_i18n_namespaceObject.__)('Sync Status'),
+ header: (0,external_wp_i18n_namespaceObject.__)('Sync status'),
id: 'sync-status',
render: ({
item
}) => {
// User patterns can have their sync statuses checked directly.
// Non-user patterns are all unsynced for the time being.
- return SYNC_FILTERS.find(({
- value
- }) => value === item.syncStatus)?.label || SYNC_FILTERS.find(({
- value
- }) => value === PATTERN_SYNC_TYPES.unsynced).label;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: `edit-site-patterns__field-sync-status-${item.syncStatus}`,
+ children: (SYNC_FILTERS.find(({
+ value
+ }) => value === item.syncStatus) || SYNC_FILTERS.find(({
+ value
+ }) => value === PATTERN_SYNC_TYPES.unsynced)).label
+ });
},
- type: ENUMERATION_TYPE,
elements: SYNC_FILTERS,
filterBy: {
- operators: [OPERATOR_IN],
+ operators: [OPERATOR_IS],
isPrimary: true
},
enableSorting: false
});
+ } else if (type === TEMPLATE_PART_POST_TYPE) {
+ _fields.push({
+ header: (0,external_wp_i18n_namespaceObject.__)('Author'),
+ id: 'author',
+ getValue: ({
+ item
+ }) => item.templatePart.author_text,
+ render: ({
+ item
+ }) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Author, {
+ viewType: view.type,
+ item: item
+ });
+ },
+ elements: authors,
+ filterBy: {
+ isPrimary: true
+ },
+ width: '1%'
+ });
}
return _fields;
- }, [view.type, categoryId, type]);
+ }, [view.type, type, authors]);
+
// Reset the page number when the category changes.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (previousCategoryId !== categoryId) {
@@ -44281,32 +35209,32 @@ function DataviewsPatterns() {
data,
paginationInfo
} = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!patterns) {
- return {
- data: page_patterns_EMPTY_ARRAY,
- paginationInfo: {
- totalItems: 0,
- totalPages: 0
- }
- };
+ // Search is managed server-side as well as filters for patterns.
+ // However, the author filter in template parts is done client-side.
+ const viewWithoutFilters = {
+ ...view
+ };
+ delete viewWithoutFilters.search;
+ if (type !== TEMPLATE_PART_POST_TYPE) {
+ viewWithoutFilters.filters = [];
}
- let filteredData = [...patterns];
- // Handle sorting.
- if (view.sort) {
- filteredData = sortByTextFields({
- data: filteredData,
- view,
- fields,
- textFields: ['title', 'author']
- });
+ return filterSortAndPaginate(patterns, viewWithoutFilters, fields);
+ }, [patterns, view, fields, type]);
+ const templatePartActions = page_patterns_usePostActions({
+ postType: TEMPLATE_PART_POST_TYPE,
+ context: 'list'
+ });
+ const patternActions = page_patterns_usePostActions({
+ postType: PATTERN_TYPES.user,
+ context: 'list'
+ });
+ const editAction = useEditPostAction();
+ const actions = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (type === TEMPLATE_PART_POST_TYPE) {
+ return [editAction, ...templatePartActions].filter(Boolean);
}
- // Handle pagination.
- return getPaginationResults({
- data: filteredData,
- view
- });
- }, [patterns, view, fields]);
- const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [renameAction, duplicatePatternAction, duplicateTemplatePartAction, exportJSONaction, resetAction, deleteAction], []);
+ return [editAction, ...patternActions].filter(Boolean);
+ }, [editAction, type, templatePartActions, patternActions]);
const onChangeView = (0,external_wp_element_namespaceObject.useCallback)(newView => {
if (newView.type !== view.type) {
newView = {
@@ -44323,39 +35251,211 @@ function DataviewsPatterns() {
// Wrap everything in a block editor provider.
// This ensures 'styles' that are needed for the previews are synced
// from the site editor store to the block editor store.
- // TODO: check if I add the provider in every preview like in templates...
- return (0,external_React_.createElement)(page_patterns_ExperimentalBlockEditorProvider, {
- settings: settings
- }, (0,external_React_.createElement)(Page, {
- title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'),
- className: "edit-site-page-patterns-dataviews",
- hideTitleFromUI: true
- }, (0,external_React_.createElement)(PatternsHeader, {
- categoryId: categoryId,
- type: type,
- titleId: `${id}-title`,
- descriptionId: `${id}-description`
- }), (0,external_React_.createElement)(DataViews, {
- paginationInfo: paginationInfo,
- fields: fields,
- actions: actions,
- data: data || page_patterns_EMPTY_ARRAY,
- getItemId: item => item.name,
- isLoading: isResolving,
- view: view,
- onChangeView: onChangeView,
- deferredRendering: true,
- supportedLayouts: [LAYOUT_GRID]
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, {
+ settings: settings,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'),
+ className: "edit-site-page-patterns-dataviews",
+ hideTitleFromUI: true,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, {
+ categoryId: categoryId,
+ type: type,
+ titleId: `${id}-title`,
+ descriptionId: `${id}-description`
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, {
+ paginationInfo: paginationInfo,
+ fields: fields,
+ actions: actions,
+ data: data || page_patterns_EMPTY_ARRAY,
+ getItemId: item => item.name,
+ isLoading: isResolving,
+ view: view,
+ onChangeView: onChangeView,
+ supportedLayouts: [LAYOUT_GRID, LAYOUT_TABLE]
+ })]
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates-template-parts/actions.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
+/**
+ * WordPress dependencies
+ */
+
+const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
+ })
+});
+/* harmony default export */ const library_home = (home);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
/**
* WordPress dependencies
*/
+const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
+ })
+});
+/* harmony default export */ const library_verse = (verse);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin.js
+/**
+ * WordPress dependencies
+ */
+
+
+const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"
+ })
+});
+/* harmony default export */ const library_pin = (pin);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js
+/**
+ * WordPress dependencies
+ */
+
+
+const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"
+ })
+});
+/* harmony default export */ const library_archive = (archive);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js
+/**
+ * WordPress dependencies
+ */
+
+
+const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const not_found = (notFound);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js
+/**
+ * WordPress dependencies
+ */
+
+
+const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_list = (list);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js
+/**
+ * WordPress dependencies
+ */
+
+
+const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ 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",
+ clipRule: "evenodd"
+ })
+});
+/* harmony default export */ const block_meta = (blockMeta);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js
+/**
+ * WordPress dependencies
+ */
+
+
+const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"
+ })
+});
+/* harmony default export */ const library_calendar = (calendar);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
+/**
+ * WordPress dependencies
+ */
+
+
+const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
+ })
+});
+/* harmony default export */ const library_tag = (tag);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m7 6.5 4 2.5-4 2.5z"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"
+ })]
+});
+/* harmony default export */ const library_media = (media);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
+/**
+ * WordPress dependencies
+ */
+
+
+const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ 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"
+ })
+});
+/* harmony default export */ const library_post = (post_post);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js
+/**
+ * WordPress dependencies
+ */
+
@@ -44367,175 +35467,1249 @@ function DataviewsPatterns() {
* Internal dependencies
*/
+const EMPTY_OBJECT = {};
+
+/**
+ * @typedef IHasNameAndId
+ * @property {string|number} id The entity's id.
+ * @property {string} name The entity's name.
+ */
+const utils_getValueFromObjectPath = (object, path) => {
+ let value = object;
+ path.split('.').forEach(fieldName => {
+ value = value?.[fieldName];
+ });
+ return value;
+};
+/**
+ * Helper util to map records to add a `name` prop from a
+ * provided path, in order to handle all entities in the same
+ * fashion(implementing`IHasNameAndId` interface).
+ *
+ * @param {Object[]} entities The array of entities.
+ * @param {string} path The path to map a `name` property from the entity.
+ * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
+ */
+const mapToIHasNameAndId = (entities, path) => {
+ return (entities || []).map(entity => ({
+ ...entity,
+ name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path))
+ }));
+};
+/**
+ * @typedef {Object} EntitiesInfo
+ * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).
+ * @property {number[]} existingEntitiesIds An array of the existing entities ids.
+ */
-function useResetTemplateAction() {
- const {
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
- id: 'reset-template',
- label: (0,external_wp_i18n_namespaceObject.__)('Reset'),
- isPrimary: true,
- icon: library_backup,
- isEligible: isTemplateRevertable,
- supportsBulk: true,
- async callback(templates) {
- try {
- for (const template of templates) {
- await revertTemplate(template, {
- allowUndo: false
- });
- await saveEditedEntityRecord('postType', template.type, template.id);
- }
- createSuccessNotice(templates.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
- (0,external_wp_i18n_namespaceObject.__)('%s items reverted.'), templates.length) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" reverted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(templates[0].title.rendered)), {
- type: 'snackbar',
- id: 'edit-site-template-reverted'
- });
- } catch (error) {
- let fallbackErrorMessage;
- if (templates[0].type === constants_TEMPLATE_POST_TYPE) {
- fallbackErrorMessage = templates.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the templates.');
- } else {
- fallbackErrorMessage = templates.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template parts.');
- }
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
+const useExistingTemplates = () => {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, {
+ per_page: -1
+ }), []);
+};
+const useDefaultTemplateTypes = () => {
+ return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes(), []);
+};
+const usePublicPostTypes = () => {
+ const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({
+ per_page: -1
+ }), []);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const excludedPostTypes = ['attachment'];
+ return postTypes?.filter(({
+ viewable,
+ slug
+ }) => viewable && !excludedPostTypes.includes(slug));
+ }, [postTypes]);
+};
+const usePublicTaxonomies = () => {
+ const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({
+ per_page: -1
+ }), []);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return taxonomies?.filter(({
+ visibility
+ }) => visibility?.publicly_queryable);
+ }, [taxonomies]);
+};
+function usePostTypeArchiveMenuItems() {
+ const publicPostTypes = usePublicPostTypes();
+ const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]);
+ const existingTemplates = useExistingTemplates();
+ // We need to keep track of naming conflicts. If a conflict
+ // occurs, we need to add slug.
+ const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, {
+ labels
+ }) => {
+ const singularName = labels.singular_name.toLowerCase();
+ accumulator[singularName] = (accumulator[singularName] || 0) + 1;
+ return accumulator;
+ }, {}), [publicPostTypes]);
+ const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({
+ labels,
+ slug
+ }) => {
+ const singularName = labels.singular_name.toLowerCase();
+ return postTypeLabels[singularName] > 1 && singularName !== slug;
+ }, [postTypeLabels]);
+ return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => {
+ let title;
+ if (needsUniqueIdentifier(postType)) {
+ title = (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
+ (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug);
+ } else {
+ title = (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the post type e.g: "Post".
+ (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name);
}
- }), [createErrorNotice, createSuccessNotice, revertTemplate, saveEditedEntityRecord]);
+ return {
+ slug: 'archive-' + postType.slug,
+ description: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the post type e.g: "Post".
+ (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name),
+ title,
+ // `icon` is the `menu_icon` property of a post type. We
+ // only handle `dashicons` for now, even if the `menu_icon`
+ // also supports urls and svg as values.
+ icon: postType.icon?.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive,
+ templatePrefix: 'archive'
+ };
+ }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]);
}
-const deleteTemplateAction = {
- id: 'delete-template',
- label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
- isPrimary: true,
- icon: library_trash,
- isEligible: isTemplateRemovable,
- supportsBulk: true,
- hideModalHeader: true,
- RenderModal: ({
- items: templates,
- closeModal,
- onPerform
+const usePostTypeMenuItems = onClickMenuItem => {
+ const publicPostTypes = usePublicPostTypes();
+ const existingTemplates = useExistingTemplates();
+ const defaultTemplateTypes = useDefaultTemplateTypes();
+ // We need to keep track of naming conflicts. If a conflict
+ // occurs, we need to add slug.
+ const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, {
+ labels
}) => {
+ const templateName = (labels.template_name || labels.singular_name).toLowerCase();
+ accumulator[templateName] = (accumulator[templateName] || 0) + 1;
+ return accumulator;
+ }, {}), [publicPostTypes]);
+ const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({
+ labels,
+ slug
+ }) => {
+ const templateName = (labels.template_name || labels.singular_name).toLowerCase();
+ return templateLabels[templateName] > 1 && templateName !== slug;
+ }, [templateLabels]);
+
+ // `page`is a special case in template hierarchy.
+ const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, {
+ slug
+ }) => {
+ let suffix = slug;
+ if (slug !== 'page') {
+ suffix = `single-${suffix}`;
+ }
+ accumulator[slug] = suffix;
+ return accumulator;
+ }, {}), [publicPostTypes]);
+ const postTypesInfo = useEntitiesInfo('postType', templatePrefixes);
+ const existingTemplateSlugs = (existingTemplates || []).map(({
+ slug
+ }) => slug);
+ const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => {
const {
- removeTemplates
- } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, templates.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %d: number of items to delete.
- (0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', templates.length), templates.length) : (0,external_wp_i18n_namespaceObject.sprintf)(
- // translators: %s: The template or template part's titles
- (0,external_wp_i18n_namespaceObject.__)('Delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(templates?.[0]?.title?.rendered))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: closeModal
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: async () => {
- await removeTemplates(templates, {
- allowUndo: false
+ slug,
+ labels,
+ icon
+ } = postType;
+ // We need to check if the general template is part of the
+ // defaultTemplateTypes. If it is, just use that info and
+ // augment it with the specific template functionality.
+ const generalTemplateSlug = templatePrefixes[slug];
+ const defaultTemplateType = defaultTemplateTypes?.find(({
+ slug: _slug
+ }) => _slug === generalTemplateSlug);
+ const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
+ const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
+ let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the post type e.g: "Post".
+ (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name);
+ if (_needsUniqueIdentifier) {
+ menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: Name of the template e.g: "Single Item: Post"; %2s: Slug of the post type e.g: "book".
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
+ (0,external_wp_i18n_namespaceObject.__)('Single item: %1$s (%2$s)'), labels.singular_name, slug);
+ }
+ const menuItem = defaultTemplateType ? {
+ ...defaultTemplateType,
+ templatePrefix: templatePrefixes[slug]
+ } : {
+ slug: generalTemplateSlug,
+ title: menuItemTitle,
+ description: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the post type e.g: "Post".
+ (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name),
+ // `icon` is the `menu_icon` property of a post type. We
+ // only handle `dashicons` for now, even if the `menu_icon`
+ // also supports urls and svg as values.
+ icon: icon?.startsWith('dashicons-') ? icon.slice(10) : library_post,
+ templatePrefix: templatePrefixes[slug]
+ };
+ const hasEntities = postTypesInfo?.[slug]?.hasEntities;
+ // We have a different template creation flow only if they have entities.
+ if (hasEntities) {
+ menuItem.onClick = template => {
+ onClickMenuItem({
+ type: 'postType',
+ slug,
+ config: {
+ recordNamePath: 'title.rendered',
+ queryArgs: ({
+ search
+ }) => {
+ return {
+ _fields: 'id,title,slug,link',
+ orderBy: search ? 'relevance' : 'modified',
+ exclude: postTypesInfo[slug].existingEntitiesIds
+ };
+ },
+ getSpecificTemplate: suggestion => {
+ const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
+ return {
+ title: templateSlug,
+ slug: templateSlug,
+ templatePrefix: templatePrefixes[slug]
+ };
+ }
+ },
+ labels,
+ hasGeneralTemplate,
+ template
});
- if (onPerform) {
- onPerform();
- }
- closeModal();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))));
- }
+ };
+ }
+ // We don't need to add the menu item if there are no
+ // entities and the general template exists.
+ if (!hasGeneralTemplate || hasEntities) {
+ accumulator.push(menuItem);
+ }
+ return accumulator;
+ }, []);
+ // Split menu items into two groups: one for the default post types
+ // and one for the rest.
+ const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => {
+ const {
+ slug
+ } = postType;
+ let key = 'postTypesMenuItems';
+ if (slug === 'page') {
+ key = 'defaultPostTypesMenuItems';
+ }
+ accumulator[key].push(postType);
+ return accumulator;
+ }, {
+ defaultPostTypesMenuItems: [],
+ postTypesMenuItems: []
+ }), [menuItems]);
+ return postTypesMenuItems;
};
-const renameTemplateAction = {
- id: 'rename-template',
- label: (0,external_wp_i18n_namespaceObject.__)('Rename'),
- isEligible: template => {
- // We can only remove templates or template parts that can be removed.
- // Additionally in the case of templates, we can only remove custom templates.
- if (!isTemplateRemovable(template) || template.type === constants_TEMPLATE_POST_TYPE && !template.is_custom) {
- return false;
+const useTaxonomiesMenuItems = onClickMenuItem => {
+ const publicTaxonomies = usePublicTaxonomies();
+ const existingTemplates = useExistingTemplates();
+ const defaultTemplateTypes = useDefaultTemplateTypes();
+ // `category` and `post_tag` are special cases in template hierarchy.
+ const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, {
+ slug
+ }) => {
+ let suffix = slug;
+ if (!['category', 'post_tag'].includes(slug)) {
+ suffix = `taxonomy-${suffix}`;
}
- return true;
- },
- RenderModal: ({
- items: templates,
- closeModal
+ if (slug === 'post_tag') {
+ suffix = `tag`;
+ }
+ accumulator[slug] = suffix;
+ return accumulator;
+ }, {}), [publicTaxonomies]);
+ // We need to keep track of naming conflicts. If a conflict
+ // occurs, we need to add slug.
+ const taxonomyLabels = publicTaxonomies?.reduce((accumulator, {
+ labels
}) => {
- const template = templates[0];
- const title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered);
- const [editedTitle, setEditedTitle] = (0,external_wp_element_namespaceObject.useState)(title);
- const {
- editEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const templateName = (labels.template_name || labels.singular_name).toLowerCase();
+ accumulator[templateName] = (accumulator[templateName] || 0) + 1;
+ return accumulator;
+ }, {});
+ const needsUniqueIdentifier = (labels, slug) => {
+ if (['category', 'post_tag'].includes(slug)) {
+ return false;
+ }
+ const templateName = (labels.template_name || labels.singular_name).toLowerCase();
+ return taxonomyLabels[templateName] > 1 && templateName !== slug;
+ };
+ const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes);
+ const existingTemplateSlugs = (existingTemplates || []).map(({
+ slug
+ }) => slug);
+ const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => {
const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- async function onTemplateRename(event) {
- event.preventDefault();
- try {
- await editEntityRecord('postType', template.type, template.id, {
- title: editedTitle
- });
- // Update state before saving rerenders the list.
- setEditedTitle('');
- closeModal();
- // Persist edited entity.
- await saveSpecifiedEntityEdits('postType', template.type, template.id, ['title'],
- // Only save title to avoid persisting other edits.
- {
- throwOnError: true
- });
- // TODO: this action will be reused in template parts list, so
- // let's keep this for a bit, even it's always a `template` now.
- createSuccessNotice(template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Template renamed.') : (0,external_wp_i18n_namespaceObject.__)('Template part renamed.'), {
- type: 'snackbar'
- });
- } catch (error) {
- const fallbackErrorMessage = template.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the template part.');
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
- createErrorNotice(errorMessage, {
- type: 'snackbar'
+ slug,
+ labels
+ } = taxonomy;
+ // We need to check if the general template is part of the
+ // defaultTemplateTypes. If it is, just use that info and
+ // augment it with the specific template functionality.
+ const generalTemplateSlug = templatePrefixes[slug];
+ const defaultTemplateType = defaultTemplateTypes?.find(({
+ slug: _slug
+ }) => _slug === generalTemplateSlug);
+ const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
+ const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug);
+ let menuItemTitle = labels.template_name || labels.singular_name;
+ if (_needsUniqueIdentifier) {
+ menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: Name of the template e.g: "Products by Category"; %2s: Slug of the taxonomy e.g: "product_cat".
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.singular_name, slug);
+ }
+ const menuItem = defaultTemplateType ? {
+ ...defaultTemplateType,
+ templatePrefix: templatePrefixes[slug]
+ } : {
+ slug: generalTemplateSlug,
+ title: menuItemTitle,
+ description: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the taxonomy e.g: "Product Categories".
+ (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name),
+ icon: block_meta,
+ templatePrefix: templatePrefixes[slug]
+ };
+ const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
+ // We have a different template creation flow only if they have entities.
+ if (hasEntities) {
+ menuItem.onClick = template => {
+ onClickMenuItem({
+ type: 'taxonomy',
+ slug,
+ config: {
+ queryArgs: ({
+ search
+ }) => {
+ return {
+ _fields: 'id,name,slug,link',
+ orderBy: search ? 'name' : 'count',
+ exclude: taxonomiesInfo[slug].existingEntitiesIds
+ };
+ },
+ getSpecificTemplate: suggestion => {
+ const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
+ return {
+ title: templateSlug,
+ slug: templateSlug,
+ templatePrefix: templatePrefixes[slug]
+ };
+ }
+ },
+ labels,
+ hasGeneralTemplate,
+ template
});
+ };
+ }
+ // We don't need to add the menu item if there are no
+ // entities and the general template exists.
+ if (!hasGeneralTemplate || hasEntities) {
+ accumulator.push(menuItem);
+ }
+ return accumulator;
+ }, []);
+ // Split menu items into two groups: one for the default taxonomies
+ // and one for the rest.
+ const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => {
+ const {
+ slug
+ } = taxonomy;
+ let key = 'taxonomiesMenuItems';
+ if (['category', 'tag'].includes(slug)) {
+ key = 'defaultTaxonomiesMenuItems';
+ }
+ accumulator[key].push(taxonomy);
+ return accumulator;
+ }, {
+ defaultTaxonomiesMenuItems: [],
+ taxonomiesMenuItems: []
+ }), [menuItems]);
+ return taxonomiesMenuItems;
+};
+const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = {
+ user: 'author'
+};
+const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = {
+ user: {
+ who: 'authors'
+ }
+};
+function useAuthorMenuItem(onClickMenuItem) {
+ const existingTemplates = useExistingTemplates();
+ const defaultTemplateTypes = useDefaultTemplateTypes();
+ const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS);
+ let authorMenuItem = defaultTemplateTypes?.find(({
+ slug
+ }) => slug === 'author');
+ if (!authorMenuItem) {
+ authorMenuItem = {
+ description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'),
+ slug: 'author',
+ title: 'Author'
+ };
+ }
+ const hasGeneralTemplate = !!existingTemplates?.find(({
+ slug
+ }) => slug === 'author');
+ if (authorInfo.user?.hasEntities) {
+ authorMenuItem = {
+ ...authorMenuItem,
+ templatePrefix: 'author'
+ };
+ authorMenuItem.onClick = template => {
+ onClickMenuItem({
+ type: 'root',
+ slug: 'user',
+ config: {
+ queryArgs: ({
+ search
+ }) => {
+ return {
+ _fields: 'id,name,slug,link',
+ orderBy: search ? 'name' : 'registered_date',
+ exclude: authorInfo.user.existingEntitiesIds,
+ who: 'authors'
+ };
+ },
+ getSpecificTemplate: suggestion => {
+ const templateSlug = `author-${suggestion.slug}`;
+ return {
+ title: templateSlug,
+ slug: templateSlug,
+ templatePrefix: 'author'
+ };
+ }
+ },
+ labels: {
+ singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'),
+ search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'),
+ not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'),
+ all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors')
+ },
+ hasGeneralTemplate,
+ template
+ });
+ };
+ }
+ if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
+ return authorMenuItem;
+ }
+}
+
+/**
+ * Helper hook that filters all the existing templates by the given
+ * object with the entity's slug as key and the template prefix as value.
+ *
+ * Example:
+ * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]
+ * `templatePrefixes` is: { post_tag: 'tag' }
+ * It will return: { post_tag: ['apple'] }
+ *
+ * Note: We append the `-` to the given template prefix in this function for our checks.
+ *
+ * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
+ * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.
+ */
+const useExistingTemplateSlugs = templatePrefixes => {
+ const existingTemplates = useExistingTemplates();
+ const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => {
+ const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => {
+ const _prefix = `${prefix}-`;
+ if (existingTemplate.slug.startsWith(_prefix)) {
+ _accumulator.push(existingTemplate.slug.substring(_prefix.length));
+ }
+ return _accumulator;
+ }, []);
+ if (slugsWithTemplates.length) {
+ accumulator[slug] = slugsWithTemplates;
+ }
+ return accumulator;
+ }, {});
+ }, [templatePrefixes, existingTemplates]);
+ return existingSlugs;
+};
+
+/**
+ * Helper hook that finds the existing records with an associated template,
+ * as they need to be excluded from the template suggestions.
+ *
+ * @param {string} entityName The entity's name.
+ * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
+ * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
+ * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.
+ */
+const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
+ const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
+ const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => {
+ const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
+ _fields: 'id',
+ context: 'view',
+ slug: slugsWithTemplates,
+ ...additionalQueryParameters[slug]
+ });
+ if (entitiesWithTemplates?.length) {
+ accumulator[slug] = entitiesWithTemplates;
+ }
+ return accumulator;
+ }, {});
+ }, [slugsToExcludePerEntity]);
+ return recordsToExcludePerEntity;
+};
+
+/**
+ * Helper hook that returns information about an entity having
+ * records that we can create a specific template for.
+ *
+ * For example we can search for `terms` in `taxonomy` entity or
+ * `posts` in `postType` entity.
+ *
+ * First we need to find the existing records with an associated template,
+ * to query afterwards for any remaining record, by excluding them.
+ *
+ * @param {string} entityName The entity's name.
+ * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
+ * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
+ * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.
+ */
+const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => {
+ const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters);
+ const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => {
+ const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({
+ id
+ }) => id) || [];
+ accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
+ per_page: 1,
+ _fields: 'id',
+ context: 'view',
+ exclude: existingEntitiesIds,
+ ...additionalQueryParameters[slug]
+ })?.length;
+ return accumulator;
+ }, {});
+ }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]);
+ const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => {
+ const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({
+ id
+ }) => id) || [];
+ accumulator[slug] = {
+ hasEntities: entitiesHasRecords[slug],
+ existingEntitiesIds
+ };
+ return accumulator;
+ }, {});
+ }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]);
+ return entitiesInfo;
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ CompositeV2: add_custom_template_modal_content_Composite,
+ CompositeItemV2: add_custom_template_modal_content_CompositeItem,
+ useCompositeStoreV2: add_custom_template_modal_content_useCompositeStore
+} = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
+const add_custom_template_modal_content_EMPTY_ARRAY = [];
+function SuggestionListItem({
+ suggestion,
+ search,
+ onSelect,
+ entityForSuggestions
+}) {
+ const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item';
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_custom_template_modal_content_CompositeItem, {
+ render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ role: "option",
+ className: baseCssClass,
+ onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion))
+ }),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ size: "body",
+ lineHeight: 1.53846153846 // 20px
+ ,
+ weight: 500,
+ className: `${baseCssClass}__title`,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, {
+ text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name),
+ highlight: search
+ })
+ }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ size: "body",
+ lineHeight: 1.53846153846 // 20px
+ ,
+ className: `${baseCssClass}__info`,
+ children: suggestion.link
+ })]
+ });
+}
+function useSearchSuggestions(entityForSuggestions, search) {
+ const {
+ config
+ } = entityForSuggestions;
+ const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ order: 'asc',
+ context: 'view',
+ search,
+ per_page: search ? 20 : 10,
+ ...config.queryArgs(search)
+ }), [search, config]);
+ const {
+ records: searchResults,
+ hasResolved: searchHasResolved
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query);
+ const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (!searchHasResolved) {
+ return;
+ }
+ let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY;
+ if (searchResults?.length) {
+ newSuggestions = searchResults;
+ if (config.recordNamePath) {
+ newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath);
}
}
- return (0,external_React_.createElement)("form", {
- onSubmit: onTemplateRename
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
+ // Update suggestions only when the query has resolved, so as to keep
+ // the previous results in the UI.
+ setSuggestions(newSuggestions);
+ }, [searchResults, searchHasResolved]);
+ return suggestions;
+}
+function SuggestionList({
+ entityForSuggestions,
+ onSelect
+}) {
+ const composite = add_custom_template_modal_content_useCompositeStore({
+ orientation: 'vertical'
+ });
+ const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
+ const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch);
+ const {
+ labels
+ } = entityForSuggestions;
+ const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false);
+ if (!showSearchControl && suggestions?.length > 9) {
+ setShowSearchControl(true);
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: editedTitle,
- onChange: setEditedTitle,
- required: true
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: closeModal
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit"
- }, (0,external_wp_i18n_namespaceObject.__)('Save')))));
+ onChange: setSearch,
+ value: search,
+ label: labels.search_items,
+ placeholder: labels.search_items
+ }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content_Composite, {
+ store: composite,
+ role: "listbox",
+ className: "edit-site-custom-template-modal__suggestions_list",
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'),
+ children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, {
+ suggestion: suggestion,
+ search: debouncedSearch,
+ onSelect: onSelect,
+ entityForSuggestions: entityForSuggestions
+ }, suggestion.slug))
+ }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "p",
+ className: "edit-site-custom-template-modal__no-results",
+ children: labels.not_found
+ })]
+ });
+}
+function AddCustomTemplateModalContent({
+ onSelect,
+ entityForSuggestions
+}) {
+ const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 4,
+ className: "edit-site-custom-template-modal__contents-wrapper",
+ alignment: "left",
+ children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "p",
+ children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ className: "edit-site-custom-template-modal__contents",
+ gap: "4",
+ align: "initial",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, {
+ isBlock: true,
+ as: external_wp_components_namespaceObject.Button,
+ onClick: () => {
+ const {
+ slug,
+ title,
+ description,
+ templatePrefix
+ } = entityForSuggestions.template;
+ onSelect({
+ slug,
+ title,
+ description,
+ templatePrefix
+ });
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "span",
+ weight: 500,
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children: entityForSuggestions.labels.all_items
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "span",
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children:
+ // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
+ (0,external_wp_i18n_namespaceObject.__)('For all items')
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, {
+ isBlock: true,
+ as: external_wp_components_namespaceObject.Button,
+ onClick: () => {
+ setShowSearchEntities(true);
+ },
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "span",
+ weight: 500,
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children: entityForSuggestions.labels.singular_name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "span",
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children:
+ // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
+ (0,external_wp_i18n_namespaceObject.__)('For a specific item')
+ })]
+ })]
+ })]
+ }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ as: "p",
+ children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, {
+ entityForSuggestions: entityForSuggestions,
+ onSelect: onSelect
+ })]
+ })]
+ });
+}
+/* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent);
+
+;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
+/******************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise, SuppressedError, Symbol */
+
+var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+};
+
+function __extends(d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ }
+ return __assign.apply(this, arguments);
+}
+
+function __rest(s, e) {
+ var t = {};
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
+ t[p[i]] = s[p[i]];
+ }
+ return t;
+}
+
+function __decorate(decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+}
+
+function __param(paramIndex, decorator) {
+ return function (target, key) { decorator(target, key, paramIndex); }
+}
+
+function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
+ var _, done = false;
+ for (var i = decorators.length - 1; i >= 0; i--) {
+ var context = {};
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
+ if (kind === "accessor") {
+ if (result === void 0) continue;
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
+ if (_ = accept(result.get)) descriptor.get = _;
+ if (_ = accept(result.set)) descriptor.set = _;
+ if (_ = accept(result.init)) initializers.unshift(_);
+ }
+ else if (_ = accept(result)) {
+ if (kind === "field") initializers.unshift(_);
+ else descriptor[key] = _;
+ }
+ }
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
+ done = true;
+};
+
+function __runInitializers(thisArg, initializers, value) {
+ var useValue = arguments.length > 2;
+ for (var i = 0; i < initializers.length; i++) {
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
+ }
+ return useValue ? value : void 0;
+};
+
+function __propKey(x) {
+ return typeof x === "symbol" ? x : "".concat(x);
+};
+
+function __setFunctionName(f, name, prefix) {
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
+};
+
+function __metadata(metadataKey, metadataValue) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
+}
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+var __createBinding = Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+});
+
+function __exportStar(m, o) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
+}
+
+function __values(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+}
+
+function __read(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+}
+
+/** @deprecated */
+function __spread() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read(arguments[i]));
+ return ar;
+}
+
+/** @deprecated */
+function __spreadArrays() {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+}
+
+function __spreadArray(to, from, pack) {
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
+}
+
+function __await(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+}
+
+function __asyncGenerator(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
+ function fulfill(value) { resume("next", value); }
+ function reject(value) { resume("throw", value); }
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
+}
+
+function __asyncDelegator(o) {
+ var i, p;
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
+}
+
+function __asyncValues(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
+}
+
+function __makeTemplateObject(cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+};
+
+var __setModuleDefault = Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+};
+
+function __importStar(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+}
+
+function __importDefault(mod) {
+ return (mod && mod.__esModule) ? mod : { default: mod };
+}
+
+function __classPrivateFieldGet(receiver, state, kind, f) {
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
+}
+
+function __classPrivateFieldSet(receiver, state, value, kind, f) {
+ if (kind === "m") throw new TypeError("Private method is not writable");
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
+}
+
+function __classPrivateFieldIn(state, receiver) {
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
+ return typeof state === "function" ? receiver === state : state.has(receiver);
+}
+
+function __addDisposableResource(env, value, async) {
+ if (value !== null && value !== void 0) {
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
+ var dispose;
+ if (async) {
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
+ dispose = value[Symbol.asyncDispose];
+ }
+ if (dispose === void 0) {
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
+ dispose = value[Symbol.dispose];
+ }
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
+ env.stack.push({ value: value, dispose: dispose, async: async });
+ }
+ else if (async) {
+ env.stack.push({ async: true });
+ }
+ return value;
+}
+
+var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
+ var e = new Error(message);
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
+};
+
+function __disposeResources(env) {
+ function fail(e) {
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
+ env.hasError = true;
+ }
+ function next() {
+ while (env.stack.length) {
+ var rec = env.stack.pop();
+ try {
+ var result = rec.dispose && rec.dispose.call(rec.value);
+ if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
+ }
+ catch (e) {
+ fail(e);
+ }
+ }
+ if (env.hasError) throw env.error;
}
+ return next();
+}
+
+/* harmony default export */ const tslib_es6 = ({
+ __extends,
+ __assign,
+ __rest,
+ __decorate,
+ __param,
+ __metadata,
+ __awaiter,
+ __generator,
+ __createBinding,
+ __exportStar,
+ __values,
+ __read,
+ __spread,
+ __spreadArrays,
+ __spreadArray,
+ __await,
+ __asyncGenerator,
+ __asyncDelegator,
+ __asyncValues,
+ __makeTemplateObject,
+ __importStar,
+ __importDefault,
+ __classPrivateFieldGet,
+ __classPrivateFieldSet,
+ __classPrivateFieldIn,
+ __addDisposableResource,
+ __disposeResources,
+});
+
+;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
+/**
+ * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
+ */
+var SUPPORTED_LOCALE = {
+ tr: {
+ regexp: /\u0130|\u0049|\u0049\u0307/g,
+ map: {
+ İ: "\u0069",
+ I: "\u0131",
+ İ: "\u0069",
+ },
+ },
+ az: {
+ regexp: /\u0130/g,
+ map: {
+ İ: "\u0069",
+ I: "\u0131",
+ İ: "\u0069",
+ },
+ },
+ lt: {
+ regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
+ map: {
+ I: "\u0069\u0307",
+ J: "\u006A\u0307",
+ Į: "\u012F\u0307",
+ Ì: "\u0069\u0307\u0300",
+ Í: "\u0069\u0307\u0301",
+ Ĩ: "\u0069\u0307\u0303",
+ },
+ },
};
+/**
+ * Localized lower case.
+ */
+function localeLowerCase(str, locale) {
+ var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
+ if (lang)
+ return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
+ return lowerCase(str);
+}
+/**
+ * Lower case as a function.
+ */
+function lowerCase(str) {
+ return str.toLowerCase();
+}
+
+;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
+
+// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
+var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
+// Remove all non-word characters.
+var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
+/**
+ * Normalize the string into something other libraries can manipulate easier.
+ */
+function noCase(input, options) {
+ if (options === void 0) { options = {}; }
+ var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
+ var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
+ var start = 0;
+ var end = result.length;
+ // Trim the delimiter from around the output string.
+ while (result.charAt(start) === "\0")
+ start++;
+ while (result.charAt(end - 1) === "\0")
+ end--;
+ // Transform each token independently.
+ return result.slice(start, end).split("\0").map(transform).join(delimiter);
+}
+/**
+ * Replace `re` in the input string with the replacement value.
+ */
+function replace(input, re, value) {
+ if (re instanceof RegExp)
+ return input.replace(re, value);
+ return re.reduce(function (input, re) { return input.replace(re, value); }, input);
+}
+
+;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
+
+
+function dotCase(input, options) {
+ if (options === void 0) { options = {}; }
+ return noCase(input, __assign({ delimiter: "." }, options));
+}
+
+;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
+
+
+function paramCase(input, options) {
+ if (options === void 0) { options = {}; }
+ return dotCase(input, __assign({ delimiter: "-" }, options));
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js
+/**
+ * External dependencies
+ */
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates-template-parts/add-new-template-part.js
/**
* WordPress dependencies
@@ -44545,6 +36719,88 @@ const renameTemplateAction = {
+function AddCustomGenericTemplateModalContent({
+ onClose,
+ createTemplate
+}) {
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
+ const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
+ const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
+ async function onCreateTemplate(event) {
+ event.preventDefault();
+ if (isBusy) {
+ return;
+ }
+ setIsBusy(true);
+ try {
+ await createTemplate({
+ slug: 'wp-custom-template-' + paramCase(title || defaultTitle),
+ title: title || defaultTitle
+ }, false);
+ } finally {
+ setIsBusy(false);
+ }
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: onCreateTemplate,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 6,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __next40pxDefaultSize: true,
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ placeholder: defaultTitle,
+ disabled: isBusy,
+ help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "edit-site-custom-generic-template__modal-actions",
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ onClick: () => {
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "primary",
+ type: "submit",
+ isBusy: isBusy,
+ "aria-disabled": isBusy,
+ children: (0,external_wp_i18n_namespaceObject.__)('Create')
+ })]
+ })]
+ })
+ });
+}
+/* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
/**
* Internal dependencies
@@ -44553,47 +36809,293 @@ const renameTemplateAction = {
+
+
+
const {
- useHistory: add_new_template_part_useHistory
-} = unlock(external_wp_router_namespaceObject.privateApis);
-function AddNewTemplatePart() {
+ useHistory: add_new_template_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404'];
+const TEMPLATE_ICONS = {
+ 'front-page': library_home,
+ home: library_verse,
+ single: library_pin,
+ page: library_page,
+ archive: library_archive,
+ search: library_search,
+ 404: not_found,
+ index: library_list,
+ category: library_category,
+ author: comment_author_avatar,
+ taxonomy: block_meta,
+ date: library_calendar,
+ tag: library_tag,
+ attachment: library_media
+};
+function TemplateListItem({
+ title,
+ direction,
+ className,
+ description,
+ icon,
+ onClick,
+ children
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ className: className,
+ onClick: onClick,
+ label: description,
+ showTooltip: !!description,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
+ as: "span",
+ spacing: 2,
+ align: "center",
+ justify: "center",
+ style: {
+ width: '100%'
+ },
+ direction: direction,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-add-new-template__template-icon",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: icon
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: "edit-site-add-new-template__template-name",
+ alignment: "center",
+ spacing: 0,
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ align: "center",
+ weight: 500,
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children: title
+ }), children]
+ })]
+ })
+ });
+}
+const modalContentMap = {
+ templatesList: 1,
+ customTemplate: 2,
+ customGenericTemplate: 3
+};
+function NewTemplateModal({
+ onClose
+}) {
+ const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList);
+ const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({});
+ const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
+ const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate));
+ const history = add_new_template_useHistory();
const {
- canCreate,
- postType
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createErrorNotice,
+ createSuccessNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const {
+ homeUrl
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
- supportsTemplatePartsMode
- } = select(store_store).getSettings();
+ getUnstableBase // Site index.
+ } = select(external_wp_coreData_namespaceObject.store);
return {
- canCreate: !supportsTemplatePartsMode,
- postType: select(external_wp_coreData_namespaceObject.store).getPostType(TEMPLATE_PART_POST_TYPE)
+ homeUrl: getUnstableBase()?.home
};
}, []);
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const history = add_new_template_part_useHistory();
- if (!canCreate || !postType) {
- return null;
- }
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: () => setIsModalOpen(true)
- }, postType.labels.add_new_item), isModalOpen && (0,external_React_.createElement)(CreateTemplatePartModal, {
- closeModal: () => setIsModalOpen(false),
- blocks: [],
- onCreate: templatePart => {
- setIsModalOpen(false);
+ const TEMPLATE_SHORT_DESCRIPTIONS = {
+ 'front-page': homeUrl,
+ date: (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: The homepage url.
+ (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear())
+ };
+ async function createTemplate(template, isWPSuggestion = true) {
+ if (isSubmitting) {
+ return;
+ }
+ setIsSubmitting(true);
+ try {
+ const {
+ title,
+ description,
+ slug
+ } = template;
+ const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, {
+ description,
+ // Slugs need to be strings, so this is for template `404`
+ slug: slug.toString(),
+ status: 'publish',
+ title,
+ // This adds a post meta field in template that is part of `is_custom` value calculation.
+ is_wp_suggestion: isWPSuggestion
+ }, {
+ throwOnError: true
+ });
+
+ // Navigate to the created template editor.
history.push({
- postId: templatePart.id,
- postType: TEMPLATE_PART_POST_TYPE,
+ postId: newTemplate.id,
+ postType: TEMPLATE_POST_TYPE,
canvas: 'edit'
});
- },
- onError: () => setIsModalOpen(false)
- }));
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Title of the created template e.g: "Category".
+ (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), {
+ type: 'snackbar'
+ });
+ } catch (error) {
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.');
+ createErrorNotice(errorMessage, {
+ type: 'snackbar'
+ });
+ } finally {
+ setIsSubmitting(false);
+ }
+ }
+ const onModalClose = () => {
+ onClose();
+ setModalContent(modalContentMap.templatesList);
+ };
+ let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template');
+ if (modalContent === modalContentMap.customTemplate) {
+ modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %s: Name of the post type e.g: "Post".
+ (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name);
+ } else if (modalContent === modalContentMap.customGenericTemplate) {
+ modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template');
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, {
+ title: modalTitle,
+ className: dist_clsx('edit-site-add-new-template__modal', {
+ 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList,
+ 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate
+ }),
+ onRequestClose: onModalClose,
+ overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined,
+ children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, {
+ columns: 3,
+ gap: 4,
+ align: "flex-start",
+ justify: "center",
+ className: "edit-site-add-new-template__template-list__contents",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ className: "edit-site-add-new-template__template-list__prompt",
+ children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:')
+ }), missingTemplates.map(template => {
+ const {
+ title,
+ slug,
+ onClick
+ } = template;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, {
+ title: title,
+ direction: "column",
+ className: "edit-site-add-new-template__template-button",
+ description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
+ icon: TEMPLATE_ICONS[slug] || library_layout,
+ onClick: () => onClick ? onClick(template) : createTemplate(template)
+ }, slug);
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Custom template'),
+ direction: "row",
+ className: "edit-site-add-new-template__custom-template-button",
+ icon: edit,
+ onClick: () => setModalContent(modalContentMap.customGenericTemplate),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ lineHeight: 1.53846153846 // 20px
+ ,
+ children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.')
+ })
+ })]
+ }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, {
+ onSelect: createTemplate,
+ entityForSuggestions: entityForSuggestions
+ }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, {
+ onClose: onModalClose,
+ createTemplate: createTemplate
+ })]
+ });
}
+function NewTemplate() {
+ const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false);
+ const {
+ postType
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getPostType
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ postType: getPostType(TEMPLATE_POST_TYPE)
+ };
+ }, []);
+ if (!postType) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ onClick: () => setShowModal(true),
+ label: postType.labels.add_new_item,
+ __next40pxDefaultSize: true,
+ children: postType.labels.add_new_item
+ }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, {
+ onClose: () => setShowModal(false)
+ })]
+ });
+}
+function useMissingTemplates(setEntityForSuggestions, onClick) {
+ const existingTemplates = useExistingTemplates();
+ const defaultTemplateTypes = useDefaultTemplateTypes();
+ const existingTemplateSlugs = (existingTemplates || []).map(({
+ slug
+ }) => slug);
+ const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug));
+ const onClickMenuItem = _entityForSuggestions => {
+ onClick?.();
+ setEntityForSuggestions(_entityForSuggestions);
+ };
+ // We need to replace existing default template types with
+ // the create specific template functionality. The original
+ // info (title, description, etc.) is preserved in the
+ // used hooks.
+ const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
+ const {
+ defaultTaxonomiesMenuItems,
+ taxonomiesMenuItems
+ } = useTaxonomiesMenuItems(onClickMenuItem);
+ const {
+ defaultPostTypesMenuItems,
+ postTypesMenuItems
+ } = usePostTypeMenuItems(onClickMenuItem);
+ const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
+ [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => {
+ if (!menuItem) {
+ return;
+ }
+ const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug);
+ // Some default template types might have been filtered above from
+ // `missingDefaultTemplates` because they only check for the general
+ // template. So here we either replace or append the item, augmented
+ // with the check if it has available specific item to create a
+ // template for.
+ if (matchIndex > -1) {
+ enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
+ } else {
+ enhancedMissingDefaultTemplateTypes.push(menuItem);
+ }
+ });
+ // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
+ enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
+ return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
+ });
+ const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems];
+ return missingTemplates;
+}
+/* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate));
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates-template-parts/index.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js
/**
* External dependencies
*/
@@ -44612,6 +37114,7 @@ function AddNewTemplatePart() {
+
/**
* Internal dependencies
*/
@@ -44625,31 +37128,36 @@ function AddNewTemplatePart() {
+
+
const {
- ExperimentalBlockEditorProvider: page_templates_template_parts_ExperimentalBlockEditorProvider,
- useGlobalStyle: page_templates_template_parts_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
+ usePostActions: page_templates_usePostActions
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
const {
- useHistory: page_templates_template_parts_useHistory,
- useLocation: page_templates_template_parts_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
-const page_templates_template_parts_EMPTY_ARRAY = [];
-const page_templates_template_parts_SUPPORTED_LAYOUTS = window?.__experimentalAdminViews ? [LAYOUT_TABLE, LAYOUT_GRID, LAYOUT_LIST] : [LAYOUT_TABLE, LAYOUT_GRID];
-const page_templates_template_parts_defaultConfigPerViewType = {
+ ExperimentalBlockEditorProvider: page_templates_ExperimentalBlockEditorProvider,
+ useGlobalStyle: page_templates_useGlobalStyle
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ useHistory: page_templates_useHistory,
+ useLocation: page_templates_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const page_templates_EMPTY_ARRAY = [];
+const page_templates_defaultConfigPerViewType = {
[LAYOUT_TABLE]: {
primaryField: 'title'
},
[LAYOUT_GRID]: {
mediaField: 'preview',
- primaryField: 'title'
+ primaryField: 'title',
+ columnFields: ['description']
},
[LAYOUT_LIST]: {
primaryField: 'title',
mediaField: 'preview'
}
};
-const page_templates_template_parts_DEFAULT_VIEW = {
- type: LAYOUT_TABLE,
+const page_templates_DEFAULT_VIEW = {
+ type: LAYOUT_GRID,
search: '',
page: 1,
perPage: 20,
@@ -44660,13 +37168,10 @@ const page_templates_template_parts_DEFAULT_VIEW = {
// All fields are visible by default, so it's
// better to keep track of the hidden ones.
hiddenFields: ['preview'],
- layout: page_templates_template_parts_defaultConfigPerViewType[LAYOUT_TABLE],
+ layout: page_templates_defaultConfigPerViewType[LAYOUT_GRID],
filters: []
};
-function page_templates_template_parts_normalizeSearchInput(input = '') {
- return remove_accents_default()(input.trim().toLowerCase());
-}
-function page_templates_template_parts_Title({
+function page_templates_Title({
item,
viewType
}) {
@@ -44680,42 +37185,51 @@ function page_templates_template_parts_Title({
canvas: 'edit'
}
};
- if (item.type === TEMPLATE_PART_POST_TYPE) {
- linkProps.state = {
- backPath: '/wp_template_part/all'
- };
- }
- return (0,external_React_.createElement)(Link, {
- ...linkProps
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)'));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Link, {
+ ...linkProps,
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered) || (0,external_wp_i18n_namespaceObject.__)('(no title)')
+ });
}
function AuthorField({
item,
viewType
}) {
+ const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false);
const {
text,
icon,
imageUrl
} = useAddedBy(item.type, item.id);
const withIcon = viewType !== LAYOUT_LIST;
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "left",
- spacing: 1
- }, withIcon && imageUrl && (0,external_React_.createElement)(AvatarImage, {
- imageUrl: imageUrl
- }), withIcon && !imageUrl && (0,external_React_.createElement)("div", {
- className: "edit-site-list-added-by__icon"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: icon
- })), (0,external_React_.createElement)("span", null, text));
-}
-function page_templates_template_parts_Preview({
+ spacing: 1,
+ children: [withIcon && imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('page-templates-author-field__avatar', {
+ 'is-loaded': isImageLoaded
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
+ onLoad: () => setIsImageLoaded(true),
+ alt: "",
+ src: imageUrl
+ })
+ }), withIcon && !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "page-templates-author-field__icon",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ icon: icon
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "page-templates-author-field__name",
+ children: text
+ })]
+ });
+}
+function page_templates_Preview({
item,
viewType
}) {
const settings = usePatternSettings();
- const [backgroundColor = 'white'] = page_templates_template_parts_useGlobalStyle('color.background');
+ const [backgroundColor = 'white'] = page_templates_useGlobalStyle('color.background');
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw);
}, [item.content.raw]);
@@ -44734,44 +37248,51 @@ function page_templates_template_parts_Preview({
// TODO: Same approach is used in the patterns list and it becomes obvious that some of
// the block editor settings are needed in context where we don't have the block editor.
// Explore how we can solve this in a better way.
- return (0,external_React_.createElement)(page_templates_template_parts_ExperimentalBlockEditorProvider, {
- settings: settings
- }, (0,external_React_.createElement)("div", {
- className: `page-templates-preview-field is-viewtype-${viewType}`,
- style: {
- backgroundColor
- }
- }, viewType === LAYOUT_LIST && !isEmpty && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockPreview, {
- blocks: blocks
- }), viewType !== LAYOUT_LIST && (0,external_React_.createElement)("button", {
- className: "page-templates-preview-field__button",
- type: "button",
- onClick: onClick,
- "aria-label": item.title?.rendered || item.title
- }, isEmpty && (item.type === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Empty template') : (0,external_wp_i18n_namespaceObject.__)('Empty template part')), !isEmpty && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockPreview, {
- blocks: blocks
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_templates_ExperimentalBlockEditorProvider, {
+ settings: settings,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: `page-templates-preview-field is-viewtype-${viewType}`,
+ style: {
+ backgroundColor
+ },
+ children: [viewType === LAYOUT_LIST && !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Async, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, {
+ blocks: blocks
+ })
+ }), viewType !== LAYOUT_LIST && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("button", {
+ className: "page-templates-preview-field__button",
+ type: "button",
+ onClick: onClick,
+ "aria-label": item.title?.rendered || item.title,
+ children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Async, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, {
+ blocks: blocks
+ })
+ })]
+ })]
+ })
+ });
}
-function PageTemplatesTemplateParts({
- postType
-}) {
+function PageTemplates() {
const {
params
- } = page_templates_template_parts_useLocation();
+ } = page_templates_useLocation();
const {
activeView = 'all',
- layout
+ layout,
+ postId
} = params;
+ const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]);
const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const usedType = window?.__experimentalAdminViews ? layout !== null && layout !== void 0 ? layout : page_templates_template_parts_DEFAULT_VIEW.type : page_templates_template_parts_DEFAULT_VIEW.type;
+ const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type;
return {
- ...page_templates_template_parts_DEFAULT_VIEW,
+ ...page_templates_DEFAULT_VIEW,
type: usedType,
- layout: page_templates_template_parts_defaultConfigPerViewType[usedType],
+ layout: page_templates_defaultConfigPerViewType[usedType],
filters: activeView !== 'all' ? [{
field: 'author',
- operator: 'in',
- value: activeView
+ operator: 'isAny',
+ value: [activeView]
}] : []
};
}, [layout, activeView]);
@@ -44781,18 +37302,18 @@ function PageTemplatesTemplateParts({
...currentView,
filters: activeView !== 'all' ? [{
field: 'author',
- operator: 'in',
- value: activeView
+ operator: OPERATOR_IS_ANY,
+ value: [activeView]
}] : []
}));
}, [activeView]);
const {
records,
isResolving: isLoadingData
- } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', postType, {
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, {
per_page: -1
});
- const history = page_templates_template_parts_useHistory();
+ const history = page_templates_useHistory();
const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)(items => {
if (view?.type === LAYOUT_LIST) {
history.push({
@@ -44803,7 +37324,7 @@ function PageTemplatesTemplateParts({
}, [history, params, view?.type]);
const authors = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!records) {
- return page_templates_template_parts_EMPTY_ARRAY;
+ return page_templates_EMPTY_ARRAY;
}
const authorsSet = new Set();
records.forEach(template => {
@@ -44814,141 +37335,93 @@ function PageTemplatesTemplateParts({
label: author
}));
}, [records]);
- const fields = (0,external_wp_element_namespaceObject.useMemo)(() => {
- const _fields = [{
- header: (0,external_wp_i18n_namespaceObject.__)('Preview'),
- id: 'preview',
- render: ({
- item
- }) => {
- return (0,external_React_.createElement)(page_templates_template_parts_Preview, {
- item: item,
- viewType: view.type
- });
- },
- minWidth: 120,
- maxWidth: 120,
- enableSorting: false
- }, {
- header: postType === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Template') : (0,external_wp_i18n_namespaceObject.__)('Template Part'),
- id: 'title',
- getValue: ({
- item
- }) => item.title?.rendered,
- render: ({
- item
- }) => (0,external_React_.createElement)(page_templates_template_parts_Title, {
+ const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [{
+ header: (0,external_wp_i18n_namespaceObject.__)('Preview'),
+ id: 'preview',
+ render: ({
+ item
+ }) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_templates_Preview, {
item: item,
viewType: view.type
- }),
- maxWidth: 400,
- enableHiding: false
- }];
- if (postType === constants_TEMPLATE_POST_TYPE) {
- _fields.push({
- header: (0,external_wp_i18n_namespaceObject.__)('Description'),
- id: 'description',
- getValue: ({
- item
- }) => item.description,
- render: ({
- item
- }) => {
- return item.description ? (0,external_React_.createElement)("span", {
- className: "page-templates-description"
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description)) : view.type === LAYOUT_TABLE && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- variant: "muted",
- "aria-hidden": "true"
- }, "\u2014"), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('No description.')));
- },
- maxWidth: 400,
- minWidth: 320,
- enableSorting: false
});
- }
- // TODO: The plan is to support fields reordering, which would require an API like `order` or something
- // similar. With the aforementioned API we wouldn't need to construct the fields array like this.
- _fields.push({
- header: (0,external_wp_i18n_namespaceObject.__)('Author'),
- id: 'author',
- getValue: ({
- item
- }) => item.author_text,
- render: ({
- item
- }) => {
- return (0,external_React_.createElement)(AuthorField, {
- viewType: view.type,
- item: item
- });
- },
- type: ENUMERATION_TYPE,
- elements: authors,
- width: '1%'
- });
- return _fields;
- }, [postType, authors, view.type]);
+ },
+ minWidth: 120,
+ maxWidth: 120,
+ enableSorting: false
+ }, {
+ header: (0,external_wp_i18n_namespaceObject.__)('Template'),
+ id: 'title',
+ getValue: ({
+ item
+ }) => item.title?.rendered,
+ render: ({
+ item
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_templates_Title, {
+ item: item,
+ viewType: view.type
+ }),
+ maxWidth: 400,
+ enableHiding: false,
+ enableGlobalSearch: true
+ }, {
+ header: (0,external_wp_i18n_namespaceObject.__)('Description'),
+ id: 'description',
+ render: ({
+ item
+ }) => {
+ return item.description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ className: "page-templates-description",
+ children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description)
+ }) : view.type === LAYOUT_TABLE && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ variant: "muted",
+ "aria-hidden": "true",
+ children: "\u2014"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
+ children: (0,external_wp_i18n_namespaceObject.__)('No description.')
+ })]
+ });
+ },
+ maxWidth: 400,
+ minWidth: 320,
+ enableSorting: false,
+ enableGlobalSearch: true
+ }, {
+ header: (0,external_wp_i18n_namespaceObject.__)('Author'),
+ id: 'author',
+ getValue: ({
+ item
+ }) => item.author_text,
+ render: ({
+ item
+ }) => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AuthorField, {
+ viewType: view.type,
+ item: item
+ });
+ },
+ elements: authors,
+ width: '1%'
+ }], [authors, view.type]);
const {
data,
paginationInfo
} = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!records) {
- return {
- data: page_templates_template_parts_EMPTY_ARRAY,
- paginationInfo: {
- totalItems: 0,
- totalPages: 0
- }
- };
- }
- let filteredData = [...records];
- // Handle global search.
- if (view.search) {
- const normalizedSearch = page_templates_template_parts_normalizeSearchInput(view.search);
- filteredData = filteredData.filter(item => {
- const title = item.title?.rendered || item.slug;
- return page_templates_template_parts_normalizeSearchInput(title).includes(normalizedSearch) || page_templates_template_parts_normalizeSearchInput(item.description).includes(normalizedSearch);
- });
- }
-
- // Handle filters.
- if (view.filters.length > 0) {
- view.filters.forEach(filter => {
- if (filter.field === 'author' && filter.operator === OPERATOR_IN && !!filter.value) {
- filteredData = filteredData.filter(item => {
- return item.author_text === filter.value;
- });
- } else if (filter.field === 'author' && filter.operator === OPERATOR_NOT_IN && !!filter.value) {
- filteredData = filteredData.filter(item => {
- return item.author_text !== filter.value;
- });
- }
- });
- }
-
- // Handle sorting.
- if (view.sort) {
- filteredData = sortByTextFields({
- data: filteredData,
- view,
- fields,
- textFields: ['title', 'author']
- });
- }
- // Handle pagination.
- return getPaginationResults({
- data: filteredData,
- view
- });
+ return filterSortAndPaginate(records, view, fields);
}, [records, view, fields]);
- const resetTemplateAction = useResetTemplateAction();
- const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [resetTemplateAction, deleteTemplateAction, renameTemplateAction, postRevisionsAction], [resetTemplateAction]);
+ const postTypeActions = page_templates_usePostActions({
+ postType: TEMPLATE_POST_TYPE,
+ context: 'list'
+ });
+ const editAction = useEditPostAction();
+ const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]);
const onChangeView = (0,external_wp_element_namespaceObject.useCallback)(newView => {
if (newView.type !== view.type) {
newView = {
...newView,
layout: {
- ...page_templates_template_parts_defaultConfigPerViewType[newView.type]
+ ...page_templates_defaultConfigPerViewType[newView.type]
}
};
history.push({
@@ -44958,37 +37431,2195 @@ function PageTemplatesTemplateParts({
}
setView(newView);
}, [view.type, setView, history, params]);
- return (0,external_React_.createElement)(Page, {
- className: "edit-site-page-template-template-parts-dataviews",
- title: postType === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Templates') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'),
- actions: postType === constants_TEMPLATE_POST_TYPE ? (0,external_React_.createElement)(AddNewTemplate, {
- templateType: postType,
- showIcon: false,
- toggleProps: {
- variant: 'primary'
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, {
+ className: "edit-site-page-templates",
+ title: (0,external_wp_i18n_namespaceObject.__)('Templates'),
+ actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, {
+ paginationInfo: paginationInfo,
+ fields: fields,
+ actions: actions,
+ data: data,
+ isLoading: isLoadingData,
+ view: view,
+ onChangeView: onChangeView,
+ onSelectionChange: onSelectionChange,
+ selection: selection,
+ setSelection: setSelection
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+function SidebarButton(props) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ ...props,
+ className: dist_clsx('edit-site-sidebar-button', props.className)
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+const {
+ useHistory: sidebar_navigation_screen_useHistory,
+ useLocation: sidebar_navigation_screen_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function SidebarNavigationScreen({
+ isRoot,
+ title,
+ actions,
+ meta,
+ content,
+ footer,
+ description,
+ backPath: backPathProp
+}) {
+ const {
+ dashboardLink,
+ dashboardLinkText,
+ previewingThemeName
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ const currentlyPreviewingThemeId = currentlyPreviewingTheme();
+ return {
+ dashboardLink: getSettings().__experimentalDashboardLink,
+ dashboardLinkText: getSettings().__experimentalDashboardLinkText,
+ // Do not call `getTheme` with null, it will cause a request to
+ // the server.
+ previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined
+ };
+ }, []);
+ const location = sidebar_navigation_screen_useLocation();
+ const history = sidebar_navigation_screen_useHistory();
+ const {
+ navigate
+ } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext);
+ const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath;
+ const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ className: dist_clsx('edit-site-sidebar-navigation-screen__main', {
+ 'has-footer': !!footer
+ }),
+ spacing: 0,
+ justify: "flex-start",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 3,
+ alignment: "flex-start",
+ className: "edit-site-sidebar-navigation-screen__title-icon",
+ children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, {
+ onClick: () => {
+ history.push(backPath);
+ navigate('back');
+ },
+ icon: icon,
+ label: (0,external_wp_i18n_namespaceObject.__)('Back'),
+ showTooltip: false
+ }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, {
+ icon: icon,
+ label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'),
+ href: dashboardLink || 'index.php'
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ className: "edit-site-sidebar-navigation-screen__title",
+ color: '#e0e0e0' /* $gray-200 */,
+ level: 1,
+ size: 20,
+ children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)('Previewing %1$s: %2$s', previewingThemeName, title)
+ }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen__actions",
+ children: actions
+ })]
+ }), meta && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen__meta",
+ children: meta
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-sidebar-navigation-screen__content",
+ children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ className: "edit-site-sidebar-navigation-screen__description",
+ children: description
+ }), content]
+ })]
+ }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", {
+ className: "edit-site-sidebar-navigation-screen__footer",
+ children: footer
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
+ })
+});
+/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"
+ })
+});
+/* harmony default export */ const chevron_right_small = (chevronRightSmall);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useHistory: sidebar_navigation_item_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function SidebarNavigationItem({
+ className,
+ icon,
+ withChevron = false,
+ suffix,
+ uid,
+ params,
+ onClick,
+ children,
+ ...props
+}) {
+ const history = sidebar_navigation_item_useHistory();
+ const {
+ navigate
+ } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext);
+ // If there is no custom click handler, create one that navigates to `params`.
+ function handleClick(e) {
+ if (onClick) {
+ onClick(e);
+ navigate('forward');
+ } else if (params) {
+ e.preventDefault();
+ history.push(params);
+ navigate('forward', `[id="${uid}"]`);
+ }
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {
+ className: dist_clsx('edit-site-sidebar-navigation-item', {
+ 'with-suffix': !withChevron && suffix
+ }, className),
+ onClick: handleClick,
+ id: uid,
+ ...props,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
+ style: {
+ fill: 'currentcolor'
+ },
+ icon: icon,
+ size: 24
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
+ children: children
+ }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
+ icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small,
+ className: "edit-site-sidebar-navigation-item__drilldown-indicator",
+ size: 24
+ }), !withChevron && suffix]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
+/**
+ * WordPress dependencies
+ */
+
+
+function SidebarNavigationScreenDetailsPanelLabel({
+ children
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ className: "edit-site-sidebar-navigation-details-screen-panel__label",
+ children: children
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+function SidebarNavigationScreenDetailsPanelRow({
+ label,
+ children,
+ className,
+ ...extraProps
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ spacing: 5,
+ alignment: "left",
+ className: dist_clsx('edit-site-sidebar-navigation-details-screen-panel__row', className),
+ ...extraProps,
+ children: children
+ }, label);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
+/**
+ * WordPress dependencies
+ */
+
+
+function SidebarNavigationScreenDetailsPanelValue({
+ children
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
+ className: "edit-site-sidebar-navigation-details-screen-panel__value",
+ children: children
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-panel/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function SidebarNavigationScreenDetailsPanel({
+ title,
+ children,
+ spacing
+}) {
+ return /*#__PURE__*/_jsxs(VStack, {
+ className: "edit-site-sidebar-navigation-details-screen-panel",
+ spacing: spacing,
+ children: [title && /*#__PURE__*/_jsx(Heading, {
+ className: "edit-site-sidebar-navigation-details-screen-panel__heading",
+ level: 2,
+ children: title
+ }), children]
+ });
+}
+
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function SidebarNavigationScreenDetailsFooter({
+ record,
+ ...otherProps
+}) {
+ var _record$_links$predec, _record$_links$versio;
+ /*
+ * There might be other items in the future,
+ * but for now it's just modified date.
+ * Later we might render a list of items and isolate
+ * the following logic.
+ */
+ const hrefProps = {};
+ const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null;
+ const revisionsCount = (_record$_links$versio = record?._links?.['version-history']?.[0]?.count) !== null && _record$_links$versio !== void 0 ? _record$_links$versio : 0;
+ // Enable the revisions link if there is a last revision and there are more than one revisions.
+ if (lastRevisionId && revisionsCount > 1) {
+ hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
+ revision: record?._links['predecessor-version'][0].id
+ });
+ hrefProps.as = 'a';
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ className: "edit-site-sidebar-navigation-screen-details-footer",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Revisions'),
+ ...hrefProps,
+ ...otherProps,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SidebarNavigationScreenDetailsPanelRow, {
+ justify: "space-between",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelLabel, {
+ children: (0,external_wp_i18n_namespaceObject.__)('Last modified')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsPanelValue, {
+ children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is the relative time when the post was last modified. */
+ (0,external_wp_i18n_namespaceObject.__)('<time>%s</time>'), (0,external_wp_date_namespaceObject.humanTimeDiff)(record.modified)), {
+ time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {
+ dateTime: record.modified
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
+ className: "edit-site-sidebar-navigation-screen-details-footer__icon",
+ icon: library_backup
+ })]
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const sidebar_navigation_screen_global_styles_noop = () => {};
+function SidebarNavigationItemGlobalStyles(props) {
+ const {
+ openGeneralSidebar
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ setCanvasMode
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+ const hasGlobalStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
+ if (hasGlobalStyleVariations) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ ...props,
+ params: {
+ path: '/wp_global_styles'
+ },
+ uid: "global-styles-navigation-item"
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ ...props,
+ onClick: () => {
+ // Switch to edit mode.
+ setCanvasMode('edit');
+ // Open global styles sidebar.
+ openGeneralSidebar('edit-site/global-styles');
+ }
+ });
+}
+function SidebarNavigationScreenGlobalStylesContent() {
+ const {
+ storedSettings
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ return {
+ storedSettings: getSettings()
+ };
+ }, []);
+ const colorVariations = useColorVariations();
+ const typographyVariations = useTypographyVariations();
+ const gap = 3;
+
+ // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
+ // loaded. This is necessary because the Iframe component waits until
+ // the block editor store's `__internalIsInitialized` is true before
+ // rendering the iframe. Without this, the iframe previews will not render
+ // in mobile viewport sizes, where the editor canvas is hidden.
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
+ settings: storedSettings,
+ onChange: sidebar_navigation_screen_global_styles_noop,
+ onInput: sidebar_navigation_screen_global_styles_noop,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: 10,
+ className: "edit-site-global-styles-variation-container",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, {
+ gap: gap
+ }), colorVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Palettes'),
+ gap: gap
+ }), typographyVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Typography'),
+ gap: gap
+ })]
+ })
+ });
+}
+function SidebarNavigationScreenGlobalStyles({
+ backPath
+}) {
+ const {
+ revisions,
+ isLoading: isLoadingRevisions
+ } = useGlobalStylesRevisions();
+ const {
+ openGeneralSidebar
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
+ const {
+ setIsListViewOpened
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
+ const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ const {
+ setCanvasMode,
+ setEditorCanvasContainerView
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+ const {
+ isViewMode,
+ isStyleBookOpened,
+ revisionsCount
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ var _globalStyles$_links$;
+ const {
+ getCanvasMode,
+ getEditorCanvasContainerView
+ } = lock_unlock_unlock(select(store));
+ const {
+ getEntityRecord,
+ __experimentalGetCurrentGlobalStylesId
+ } = select(external_wp_coreData_namespaceObject.store);
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
+ const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
+ return {
+ isViewMode: 'view' === getCanvasMode(),
+ isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
+ revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
+ };
+ }, []);
+ const {
+ set: setPreference
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
+ const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => {
+ return Promise.all([setPreference('core', 'distractionFree', false), setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
+ }, [setCanvasMode, openGeneralSidebar, setPreference]);
+ const openStyleBook = (0,external_wp_element_namespaceObject.useCallback)(async () => {
+ await openGlobalStyles();
+ // Open the Style Book once the canvas mode is set to edit,
+ // and the global styles sidebar is open. This ensures that
+ // the Style Book is not prematurely closed.
+ setEditorCanvasContainerView('style-book');
+ setIsListViewOpened(false);
+ }, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]);
+ const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => {
+ await openGlobalStyles();
+ // Open the global styles revisions once the canvas mode is set to edit,
+ // and the global styles sidebar is open. The global styles UI is responsible
+ // for redirecting to the revisions screen once the editor canvas container
+ // has been set to 'global-styles-revisions'.
+ setEditorCanvasContainerView('global-styles-revisions');
+ }, [openGlobalStyles, setEditorCanvasContainerView]);
+
+ // If there are no revisions, do not render a footer.
+ const hasRevisions = revisionsCount > 0;
+ const modifiedDateTime = revisions?.[0]?.modified;
+ const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles.'),
+ backPath: backPath,
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}),
+ footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, {
+ record: revisions?.[0],
+ onClick: openRevisions
+ }),
+ actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, {
+ icon: library_seen,
+ label: (0,external_wp_i18n_namespaceObject.__)('Style Book'),
+ onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
+ isPressed: isStyleBookOpened
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, {
+ icon: edit,
+ label: (0,external_wp_i18n_namespaceObject.__)('Edit styles'),
+ onClick: async () => await openGlobalStyles()
+ })]
+ })
+ }), isStyleBookOpened && !isMobileViewport && isViewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, {
+ enableResizing: false,
+ isSelected: () => false,
+ onClick: openStyleBook,
+ onSelect: openStyleBook,
+ showCloseButton: false,
+ showTabs: false
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
+/**
+ * WordPress dependencies
+ */
+
+
+const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
+ })
+});
+/* harmony default export */ const library_navigation = (navigation);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+function SidebarNavigationScreenMain() {
+ const {
+ setEditorCanvasContainerView
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
+
+ // Clear the editor canvas container view when accessing the main navigation screen.
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ setEditorCanvasContainerView(undefined);
+ }, [setEditorCanvasContainerView]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ isRoot: true,
+ title: (0,external_wp_i18n_namespaceObject.__)('Design'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ uid: "navigation-navigation-item",
+ params: {
+ postType: NAVIGATION_POST_TYPE
+ },
+ withChevron: true,
+ icon: library_navigation,
+ children: (0,external_wp_i18n_namespaceObject.__)('Navigation')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, {
+ uid: "styles-navigation-item",
+ withChevron: true,
+ icon: library_styles,
+ children: (0,external_wp_i18n_namespaceObject.__)('Styles')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ uid: "page-navigation-item",
+ params: {
+ postType: 'page'
+ },
+ withChevron: true,
+ icon: library_page,
+ children: (0,external_wp_i18n_namespaceObject.__)('Pages')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ uid: "template-navigation-item",
+ params: {
+ postType: TEMPLATE_POST_TYPE
+ },
+ withChevron: true,
+ icon: library_layout,
+ children: (0,external_wp_i18n_namespaceObject.__)('Templates')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ uid: "patterns-navigation-item",
+ params: {
+ postType: PATTERN_TYPES.user
+ },
+ withChevron: true,
+ icon: library_symbol,
+ children: (0,external_wp_i18n_namespaceObject.__)('Patterns')
+ })]
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js
+// This requested is preloaded in `gutenberg_preload_navigation_posts`.
+// As unbounded queries are limited to 100 by `fetchAllMiddleware`
+// on apiFetch this query is limited to 100.
+// These parameters must be kept aligned with those in
+// lib/compat/wordpress-6.3/navigation-block-preloading.php
+// and
+// block-library/src/navigation/constants.js
+const PRELOADED_NAVIGATION_MENUS_QUERY = {
+ per_page: 100,
+ status: ['publish', 'draft'],
+ order: 'desc',
+ orderby: 'date'
+};
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+const notEmptyString = testString => testString?.trim()?.length > 0;
+function rename_modal_RenameModal({
+ menuTitle,
+ onClose,
+ onSave
+}) {
+ const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle);
+ const titleHasChanged = editedMenuTitle !== menuTitle;
+ const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
+ onRequestClose: onClose,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ className: "sidebar-navigation__rename-modal-form",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "3",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
+ value: editedMenuTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'),
+ onChange: setEditedMenuTitle
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ variant: "tertiary",
+ onClick: onClose,
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ __next40pxDefaultSize: true,
+ __experimentalIsFocusable: true,
+ disabled: !isEditedMenuTitleValid,
+ variant: "primary",
+ type: "submit",
+ onClick: e => {
+ e.preventDefault();
+ if (!isEditedMenuTitleValid) {
+ return;
+ }
+ onSave({
+ title: editedMenuTitle
+ });
+
+ // Immediate close avoids ability to hit save multiple times.
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Save')
+ })]
+ })]
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+function DeleteConfirmDialog({
+ onClose,
+ onConfirm
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
+ isOpen: true,
+ onConfirm: () => {
+ onConfirm();
+
+ // Immediate close avoids ability to hit delete multiple times.
+ onClose();
+ },
+ onCancel: onClose,
+ confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'),
+ size: "medium",
+ children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?')
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+const {
+ useHistory: more_menu_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const POPOVER_PROPS = {
+ position: 'bottom right'
+};
+function ScreenNavigationMoreMenu(props) {
+ const {
+ onDelete,
+ onSave,
+ onDuplicate,
+ menuTitle,
+ menuId
+ } = props;
+ const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false);
+ const history = more_menu_useHistory();
+ const closeModals = () => {
+ setRenameModalOpen(false);
+ setDeleteConfirmDialogOpen(false);
+ };
+ const openRenameModal = () => setRenameModalOpen(true);
+ const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ className: "sidebar-navigation__more-menu",
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ icon: more_vertical,
+ popoverProps: POPOVER_PROPS,
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ openRenameModal();
+ // Close the dropdown after opening the modal.
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Rename')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ history.push({
+ postId: menuId,
+ postType: 'wp_navigation',
+ canvas: 'edit'
+ });
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Edit')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ onDuplicate();
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Duplicate')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ isDestructive: true,
+ onClick: () => {
+ openDeleteConfirmDialog();
+
+ // Close the dropdown after opening the modal.
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Delete')
+ })]
+ })
+ })
+ }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, {
+ onClose: closeModals,
+ onConfirm: onDelete
+ }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_modal_RenameModal, {
+ onClose: closeModals,
+ menuTitle: menuTitle,
+ onSave: onSave
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
+ })
+});
+/* harmony default export */ const chevron_up = (chevronUp);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
+/**
+ * WordPress dependencies
+ */
+
+
+const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
+ })
+});
+/* harmony default export */ const chevron_down = (chevronDown);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+const leaf_more_menu_POPOVER_PROPS = {
+ className: 'block-editor-block-settings-menu__popover',
+ placement: 'bottom-start'
+};
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useHistory: leaf_more_menu_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function LeafMoreMenu(props) {
+ const history = leaf_more_menu_useHistory();
+ const {
+ block
+ } = props;
+ const {
+ clientId
+ } = block;
+ const {
+ moveBlocksDown,
+ moveBlocksUp,
+ removeBlocks
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
+ (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({
+ clientId,
+ maximumLength: 25
+ }));
+ const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
+ (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({
+ clientId,
+ maximumLength: 25
+ }));
+ const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getBlockRootClientId
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ return getBlockRootClientId(clientId);
+ }, [clientId]);
+ const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => {
+ const {
+ attributes,
+ name
+ } = selectedBlock;
+ if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
+ const {
+ params
+ } = history.getLocationWithParams();
+ history.push({
+ postType: attributes.type,
+ postId: attributes.id,
+ canvas: 'edit'
+ }, {
+ backPath: params
+ });
+ }
+ if (name === 'core/page-list-item' && attributes.id && history) {
+ const {
+ params
+ } = history.getLocationWithParams();
+ history.push({
+ postType: 'page',
+ postId: attributes.id,
+ canvas: 'edit'
+ }, {
+ backPath: params
+ });
+ }
+ }, [history]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Options'),
+ className: "block-editor-block-settings-menu",
+ popoverProps: leaf_more_menu_POPOVER_PROPS,
+ noIcons: true,
+ ...props,
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ icon: chevron_up,
+ onClick: () => {
+ moveBlocksUp([clientId], rootClientId);
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Move up')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ icon: chevron_down,
+ onClick: () => {
+ moveBlocksDown([clientId], rootClientId);
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Move down')
+ }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ onGoToPage(block);
+ onClose();
+ },
+ children: goToLabel
+ })]
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ removeBlocks([clientId], false);
+ onClose();
+ },
+ children: removeLabel
+ })
+ })]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ PrivateListView
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+
+// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
+const MAX_PAGE_COUNT = 100;
+const PAGES_QUERY = ['postType', 'page', {
+ per_page: MAX_PAGE_COUNT,
+ _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'],
+ // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
+ // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
+ // sort.
+ orderby: 'menu_order',
+ order: 'asc'
+}];
+function NavigationMenuContent({
+ rootClientId
+}) {
+ const {
+ listViewRootClientId,
+ isLoading
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ areInnerBlocksControlled,
+ getBlockName,
+ getBlockCount,
+ getBlockOrder
+ } = select(external_wp_blockEditor_namespaceObject.store);
+ const {
+ isResolving
+ } = select(external_wp_coreData_namespaceObject.store);
+ const blockClientIds = getBlockOrder(rootClientId);
+ const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list';
+ const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0;
+ const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY);
+ return {
+ listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId,
+ // This is a small hack to wait for the navigation block
+ // to actually load its inner blocks.
+ isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages
+ };
+ }, [rootClientId]);
+ const {
+ replaceBlock,
+ __unstableMarkNextChangeAsNotPersistent
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
+ const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => {
+ if (block.name === 'core/navigation-link' && !block.attributes.url) {
+ __unstableMarkNextChangeAsNotPersistent();
+ replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes));
+ }
+ }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]);
+
+ // The hidden block is needed because it makes block edit side effects trigger.
+ // For example a navigation page list load its items has an effect on edit to load its items.
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, {
+ rootClientId: listViewRootClientId,
+ onSelect: offCanvasOnselect,
+ blockSettingsMenu: LeafMoreMenu,
+ showAppender: false
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {})
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const navigation_menu_editor_noop = () => {};
+function NavigationMenuEditor({
+ navigationMenuId
+}) {
+ const {
+ storedSettings
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getSettings
+ } = lock_unlock_unlock(select(store));
+ return {
+ storedSettings: getSettings()
+ };
+ }, []);
+ const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ if (!navigationMenuId) {
+ return [];
+ }
+ return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', {
+ ref: navigationMenuId
+ })];
+ }, [navigationMenuId]);
+ if (!navigationMenuId || !blocks?.length) {
+ return null;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
+ settings: storedSettings,
+ value: blocks,
+ onChange: navigation_menu_editor_noop,
+ onInput: navigation_menu_editor_noop,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__content",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, {
+ rootClientId: blocks[0].clientId
+ })
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
+function buildNavigationLabel(title, id, status) {
+ if (!title?.rendered) {
+ /* translators: %s is the index of the menu in the list of menus. */
+ return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id);
+ }
+ if (status === 'publish') {
+ return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered);
+ }
+ return (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status);
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+function SingleNavigationMenu({
+ navigationMenu,
+ backPath,
+ handleDelete,
+ handleDuplicate,
+ handleSave
+}) {
+ const menuTitle = navigationMenu?.title?.rendered;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, {
+ menuId: navigationMenu?.id,
+ menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
+ onDelete: handleDelete,
+ onSave: handleSave,
+ onDuplicate: handleDuplicate
+ })
+ }),
+ backPath: backPath,
+ title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
+ description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, {
+ navigationMenuId: navigationMenu?.id
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+const {
+ useLocation: sidebar_navigation_screen_navigation_menu_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const postType = `wp_navigation`;
+function SidebarNavigationScreenNavigationMenu({
+ backPath
+}) {
+ const {
+ params: {
+ postId
+ }
+ } = sidebar_navigation_screen_navigation_menu_useLocation();
+ const {
+ record: navigationMenu,
+ isResolving
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId);
+ const {
+ isSaving,
+ isDeleting
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ isSavingEntityRecord,
+ isDeletingEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ isSaving: isSavingEntityRecord('postType', postType, postId),
+ isDeleting: isDeletingEntityRecord('postType', postType, postId)
+ };
+ }, [postId]);
+ const isLoading = isResolving || isSaving || isDeleting;
+ const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
+ const {
+ handleSave,
+ handleDelete,
+ handleDuplicate
+ } = useNavigationMenuHandlers();
+ const _handleDelete = () => handleDelete(navigationMenu);
+ const _handleSave = edits => handleSave(navigationMenu, edits);
+ const _handleDuplicate = () => handleDuplicate(navigationMenu);
+ if (isLoading) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'),
+ backPath: backPath,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
+ })
+ });
+ }
+ if (!isLoading && !navigationMenu) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'),
+ backPath: backPath
+ });
+ }
+ if (!navigationMenu?.content?.raw) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, {
+ menuId: navigationMenu?.id,
+ menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
+ onDelete: _handleDelete,
+ onSave: _handleSave,
+ onDuplicate: _handleDuplicate
+ }),
+ backPath: backPath,
+ title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
+ description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.')
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, {
+ navigationMenu: navigationMenu,
+ backPath: backPath,
+ handleDelete: _handleDelete,
+ handleSave: _handleSave,
+ handleDuplicate: _handleDuplicate
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+const {
+ useHistory: use_navigation_menu_handlers_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useDeleteNavigationMenu() {
+ const {
+ deleteEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const history = use_navigation_menu_handlers_useHistory();
+ const handleDelete = async navigationMenu => {
+ const postId = navigationMenu?.id;
+ try {
+ await deleteEntityRecord('postType', postType, postId, {
+ force: true
+ }, {
+ throwOnError: true
+ });
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), {
+ type: 'snackbar'
+ });
+ history.push({
+ postType: 'wp_navigation'
+ });
+ } catch (error) {
+ createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */
+ (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), {
+ type: 'snackbar'
+ });
+ }
+ };
+ return handleDelete;
+}
+function useSaveNavigationMenu() {
+ const {
+ getEditedEntityRecord
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedEntityRecord: getEditedEntityRecordSelector
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ getEditedEntityRecord: getEditedEntityRecordSelector
+ };
+ }, []);
+ const {
+ editEntityRecord,
+ __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const handleSave = async (navigationMenu, edits) => {
+ if (!edits) {
+ return;
+ }
+ const postId = navigationMenu?.id;
+ // Prepare for revert in case of error.
+ const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId);
+
+ // Apply the edits.
+ editEntityRecord('postType', postType, postId, edits);
+ const recordPropertiesToSave = Object.keys(edits);
+
+ // Attempt to persist.
+ try {
+ await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, {
+ throwOnError: true
+ });
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), {
+ type: 'snackbar'
+ });
+ } catch (error) {
+ // Revert to original in case of error.
+ editEntityRecord('postType', postType, postId, originalRecord);
+ createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be renamed. */
+ (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), {
+ type: 'snackbar'
+ });
+ }
+ };
+ return handleSave;
+}
+function useDuplicateNavigationMenu() {
+ const history = use_navigation_menu_handlers_useHistory();
+ const {
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const {
+ createSuccessNotice,
+ createErrorNotice
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
+ const handleDuplicate = async navigationMenu => {
+ const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
+ try {
+ const savedRecord = await saveEntityRecord('postType', postType, {
+ title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Navigation menu title */
+ (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), menuTitle),
+ content: navigationMenu?.content?.raw,
+ status: 'publish'
+ }, {
+ throwOnError: true
+ });
+ if (savedRecord) {
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), {
+ type: 'snackbar'
+ });
+ history.push({
+ postType: postType,
+ postId: savedRecord.id
+ });
}
- }) : (0,external_React_.createElement)(AddNewTemplatePart, null)
- }, (0,external_React_.createElement)(DataViews, {
- paginationInfo: paginationInfo,
- fields: fields,
+ } catch (error) {
+ createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */
+ (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), {
+ type: 'snackbar'
+ });
+ }
+ };
+ return handleDuplicate;
+}
+function useNavigationMenuHandlers() {
+ return {
+ handleDelete: useDeleteNavigationMenu(),
+ handleSave: useSaveNavigationMenu(),
+ handleDuplicate: useDuplicateNavigationMenu()
+ };
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
+
+function buildMenuLabel(title, id, status) {
+ if (!title) {
+ /* translators: %s is the index of the menu in the list of menus. */
+ return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id);
+ }
+ if (status === 'publish') {
+ return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title);
+ }
+ return (0,external_wp_i18n_namespaceObject.sprintf)(
+ // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
+ (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status);
+}
+
+// Save a boolean to prevent us creating a fallback more than once per session.
+let hasCreatedFallback = false;
+function SidebarNavigationScreenNavigationMenus({
+ backPath
+}) {
+ const {
+ records: navigationMenus,
+ isResolving: isResolvingNavigationMenus,
+ hasResolved: hasResolvedNavigationMenus
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY);
+ const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
+ const {
+ getNavigationFallbackId
+ } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store));
+ const firstNavigationMenu = navigationMenus?.[0];
+
+ // Save a boolean to prevent us creating a fallback more than once per session.
+ if (firstNavigationMenu) {
+ hasCreatedFallback = true;
+ }
+
+ // If there is no navigation menu found
+ // then trigger fallback algorithm to create one.
+ if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) {
+ getNavigationFallbackId();
+ }
+ const {
+ handleSave,
+ handleDelete,
+ handleDuplicate
+ } = useNavigationMenuHandlers();
+ const hasNavigationMenus = !!navigationMenus?.length;
+ if (isLoading) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ backPath: backPath,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
+ })
+ });
+ }
+ if (!isLoading && !hasNavigationMenus) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'),
+ backPath: backPath
+ });
+ }
+
+ // if single menu then render it
+ if (navigationMenus?.length === 1) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, {
+ navigationMenu: firstNavigationMenu,
+ backPath: backPath,
+ handleDelete: () => handleDelete(firstNavigationMenu),
+ handleDuplicate: () => handleDuplicate(firstNavigationMenu),
+ handleSave: edits => handleSave(firstNavigationMenu, edits)
+ });
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, {
+ backPath: backPath,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: navigationMenus?.map(({
+ id,
+ title,
+ status
+ }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, {
+ postId: id,
+ withChevron: true,
+ icon: library_navigation,
+ children: buildMenuLabel(title?.rendered, index + 1, status)
+ }, id))
+ })
+ });
+}
+function SidebarNavigationScreenWrapper({
+ children,
+ actions,
+ title,
+ description,
+ backPath
+}) {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'),
actions: actions,
- data: data,
- isLoading: isLoadingData,
- view: view,
- onChangeView: onChangeView,
- onSelectionChange: onSelectionChange,
- deferredRendering: !view.hiddenFields?.includes('preview'),
- supportedLayouts: page_templates_template_parts_SUPPORTED_LAYOUTS
- }));
+ description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'),
+ backPath: backPath,
+ content: children
+ });
}
+const NavMenuItem = ({
+ postId,
+ ...props
+}) => {
+ const linkInfo = useLink({
+ postId,
+ postType: 'wp_navigation'
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ ...linkInfo,
+ ...props
+ });
+};
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/router.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+const {
+ useLocation: dataview_item_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function DataViewItem({
+ title,
+ slug,
+ customViewId,
+ type,
+ icon,
+ isActive,
+ isCustom,
+ suffix
+}) {
+ const {
+ params: {
+ postType,
+ layout
+ }
+ } = dataview_item_useLocation();
+ const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon;
+ let activeView = isCustom ? customViewId : slug;
+ if (activeView === 'all') {
+ activeView = undefined;
+ }
+ const linkInfo = useLink({
+ postType,
+ layout,
+ activeView,
+ isCustom: isCustom ? 'true' : undefined
+ });
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "flex-start",
+ className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', {
+ 'is-selected': isActive
+ }),
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ icon: iconToUse,
+ ...linkInfo,
+ "aria-current": isActive ? 'true' : undefined,
+ children: title
+ }), suffix]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+const content_EMPTY_ARRAY = [];
+function TemplateDataviewItem({
+ template,
+ isActive
+}) {
+ const {
+ text,
+ icon
+ } = useAddedBy(template.type, template.id);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, {
+ slug: text,
+ title: text,
+ icon: icon,
+ isActive: isActive,
+ isCustom: false
+ }, text);
+}
+function DataviewsTemplatesSidebarContent({
+ activeView,
+ title
+}) {
+ const {
+ records
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, {
+ per_page: -1
+ });
+ const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ var _ref;
+ const firstItemPerAuthor = records?.reduce((acc, template) => {
+ const author = template.author_text;
+ if (author && !acc[author]) {
+ acc[author] = template;
+ }
+ return acc;
+ }, {});
+ return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY;
+ }, [records]);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, {
+ slug: "all",
+ title: title,
+ icon: library_layout,
+ isActive: activeView === 'all',
+ isCustom: false
+ }), firstItemPerAuthorText.map(template => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, {
+ template: template,
+ isActive: activeView === template.author_text
+ }, template.author_text);
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+const {
+ useLocation: sidebar_navigation_screen_templates_browse_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function SidebarNavigationScreenTemplatesBrowse({
+ backPath
+}) {
+ const {
+ params: {
+ activeView = 'all'
+ }
+ } = sidebar_navigation_screen_templates_browse_useLocation();
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Templates'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
+ backPath: backPath,
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {
+ activeView: activeView,
+ title: (0,external_wp_i18n_namespaceObject.__)('All templates')
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js
+/**
+ * WordPress dependencies
+ */
+
+
+const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
+ viewBox: "0 0 24 24",
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
+ })
+});
+/* harmony default export */ const library_file = (file);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js
+/**
+ * Internal dependencies
+ */
+
+
+
+
+function CategoryItem({
+ count,
+ icon,
+ id,
+ isActive,
+ label,
+ type
+}) {
+ const linkInfo = useLink({
+ categoryId: id !== TEMPLATE_PART_ALL_AREAS_CATEGORY && id !== PATTERN_DEFAULT_CATEGORY ? id : undefined,
+ postType: type === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user
+ });
+ if (!count) {
+ return;
+ }
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ ...linkInfo,
+ icon: icon,
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: count
+ }),
+ "aria-current": isActive ? 'true' : undefined,
+ children: label
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+const useTemplatePartsGroupedByArea = items => {
+ const allItems = items || [];
+ const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
+
+ // Create map of template areas ensuring that default areas are displayed before
+ // any custom registered template part areas.
+ const knownAreas = {
+ header: {},
+ footer: {},
+ sidebar: {},
+ uncategorized: {}
+ };
+ templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = {
+ ...templatePartArea,
+ templateParts: []
+ });
+ const groupedByArea = allItems.reduce((accumulator, item) => {
+ const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
+ accumulator[key].templateParts.push(item);
+ return accumulator;
+ }, knownAreas);
+ return groupedByArea;
+};
+function useTemplatePartAreas() {
+ const {
+ records: templateParts,
+ isResolving: isLoading
+ } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, {
+ per_page: -1
+ });
+ return {
+ hasTemplateParts: templateParts ? !!templateParts.length : false,
+ isLoading,
+ templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
+ };
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+const {
+ useLocation: sidebar_navigation_screen_patterns_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function CategoriesGroup({
+ templatePartAreas,
+ patternCategories,
+ currentCategory,
+ currentType
+}) {
+ const [allPatterns, ...otherPatterns] = patternCategories;
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ className: "edit-site-sidebar-navigation-screen-patterns__group",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, {
+ count: Object.values(templatePartAreas).map(({
+ templateParts
+ }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
+ icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */,
+ label: (0,external_wp_i18n_namespaceObject.__)('All template parts'),
+ id: TEMPLATE_PART_ALL_AREAS_CATEGORY,
+ type: TEMPLATE_PART_POST_TYPE,
+ isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE
+ }, "all"), Object.entries(templatePartAreas).map(([area, {
+ label,
+ templateParts
+ }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, {
+ count: templateParts?.length,
+ icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area),
+ label: label,
+ id: area,
+ type: TEMPLATE_PART_POST_TYPE,
+ isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE
+ }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen-patterns__divider"
+ }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, {
+ count: allPatterns.count,
+ label: allPatterns.label,
+ icon: library_file,
+ id: allPatterns.name,
+ type: PATTERN_TYPES.user,
+ isActive: currentCategory === `${allPatterns.name}` && currentType === PATTERN_TYPES.user
+ }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, {
+ count: category.count,
+ label: category.label,
+ icon: library_file,
+ id: category.name,
+ type: PATTERN_TYPES.user,
+ isActive: currentCategory === `${category.name}` && currentType === PATTERN_TYPES.user
+ }, category.name))]
+ });
+}
+function SidebarNavigationScreenPatterns({
+ backPath
+}) {
+ const {
+ params: {
+ postType,
+ categoryId
+ }
+ } = sidebar_navigation_screen_patterns_useLocation();
+ const currentType = postType || PATTERN_TYPES.user;
+ const currentCategory = categoryId || (currentType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
+ const {
+ templatePartAreas,
+ hasTemplateParts,
+ isLoading
+ } = useTemplatePartAreas();
+ const {
+ patternCategories,
+ hasPatterns
+ } = usePatternCategories();
+ const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ isRoot: !isBlockBasedTheme,
+ title: (0,external_wp_i18n_namespaceObject.__)('Patterns'),
+ description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'),
+ backPath: backPath,
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ className: "edit-site-sidebar-navigation-screen-patterns__group",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {
+ children: (0,external_wp_i18n_namespaceObject.__)('No items found')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, {
+ templatePartAreas: templatePartAreas,
+ patternCategories: patternCategories,
+ currentCategory: currentCategory,
+ currentType: currentType
+ })]
+ })]
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+const {
+ useHistory: add_new_view_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function AddNewItemModalContent({
+ type,
+ setIsAdding
+}) {
+ const history = add_new_view_useHistory();
+ const {
+ saveEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
+ const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: async event => {
+ event.preventDefault();
+ setIsSaving(true);
+ const {
+ getEntityRecords
+ } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store);
+ let dataViewTaxonomyId;
+ const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', {
+ slug: type
+ });
+ if (dataViewTypeRecords && dataViewTypeRecords.length > 0) {
+ dataViewTaxonomyId = dataViewTypeRecords[0].id;
+ } else {
+ const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', {
+ name: type
+ });
+ if (record && record.id) {
+ dataViewTaxonomyId = record.id;
+ }
+ }
+ const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', {
+ title,
+ status: 'publish',
+ wp_dataviews_type: dataViewTaxonomyId,
+ content: JSON.stringify(DEFAULT_VIEWS[type][0].view)
+ });
+ const {
+ params: {
+ postType
+ }
+ } = history.getLocationWithParams();
+ history.push({
+ postType,
+ activeView: savedRecord.id,
+ isCustom: 'true'
+ });
+ setIsSaving(false);
+ setIsAdding(false);
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'),
+ className: "patterns-create-modal__name-input"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: () => {
+ setIsAdding(false);
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ "aria-disabled": !title || isSaving,
+ isBusy: isSaving,
+ children: (0,external_wp_i18n_namespaceObject.__)('Create')
+ })]
+ })]
+ })
+ });
+}
+function AddNewItem({
+ type
+}) {
+ const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, {
+ icon: library_plus,
+ onClick: () => {
+ setIsAdding(true);
+ },
+ className: "dataviews__siderbar-content-add-new-item",
+ children: (0,external_wp_i18n_namespaceObject.__)('New view')
+ }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Add new view'),
+ onRequestClose: () => {
+ setIsAdding(false);
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, {
+ type: type,
+ setIsAdding: setIsAdding
+ })
+ })]
+ });
+}
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js
/**
* WordPress dependencies
*/
+
+
+
+
+
+
/**
* Internal dependencies
*/
@@ -44998,10 +39629,312 @@ function PageTemplatesTemplateParts({
+const {
+ useHistory: custom_dataviews_list_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const custom_dataviews_list_EMPTY_ARRAY = [];
+function RenameItemModalContent({
+ dataviewId,
+ currentTitle,
+ setIsRenaming
+}) {
+ const {
+ editEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: async event => {
+ event.preventDefault();
+ await editEntityRecord('postType', 'wp_dataviews', dataviewId, {
+ title
+ });
+ setIsRenaming(false);
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'),
+ className: "patterns-create-modal__name-input"
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: () => {
+ setIsRenaming(false);
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ "aria-disabled": !title,
+ children: (0,external_wp_i18n_namespaceObject.__)('Rename')
+ })]
+ })]
+ })
+ });
+}
+function CustomDataViewItem({
+ dataviewId,
+ isActive
+}) {
+ const history = custom_dataviews_list_useHistory();
+ const {
+ dataview
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEditedEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ return {
+ dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId)
+ };
+ }, [dataviewId]);
+ const {
+ deleteEntityRecord
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
+ const type = (0,external_wp_element_namespaceObject.useMemo)(() => {
+ const viewContent = JSON.parse(dataview.content);
+ return viewContent.type;
+ }, [dataview.content]);
+ const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, {
+ title: dataview.title,
+ type: type,
+ isActive: isActive,
+ isCustom: true,
+ customViewId: dataviewId,
+ suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: more_vertical,
+ label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
+ className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu",
+ toggleProps: {
+ style: {
+ color: 'inherit'
+ },
+ size: 'small'
+ },
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => {
+ setIsRenaming(true);
+ onClose();
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Rename')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: async () => {
+ await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, {
+ force: true
+ });
+ if (isActive) {
+ const {
+ params: {
+ postType
+ }
+ } = history.getLocationWithParams();
+ history.replace({
+ postType
+ });
+ }
+ onClose();
+ },
+ isDestructive: true,
+ children: (0,external_wp_i18n_namespaceObject.__)('Delete')
+ })]
+ })
+ })
+ }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Rename view'),
+ onRequestClose: () => {
+ setIsRenaming(false);
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, {
+ dataviewId: dataviewId,
+ setIsRenaming: setIsRenaming,
+ currentTitle: dataview.title
+ })
+ })]
+ });
+}
+function useCustomDataViews(type) {
+ const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ getEntityRecords
+ } = select(external_wp_coreData_namespaceObject.store);
+ const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', {
+ slug: type
+ });
+ if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) {
+ return custom_dataviews_list_EMPTY_ARRAY;
+ }
+ const dataViews = getEntityRecords('postType', 'wp_dataviews', {
+ wp_dataviews_type: dataViewTypeRecords[0].id,
+ orderby: 'date',
+ order: 'asc'
+ });
+ if (!dataViews) {
+ return custom_dataviews_list_EMPTY_ARRAY;
+ }
+ return dataViews;
+ });
+ return customDataViews;
+}
+function CustomDataViewsList({
+ type,
+ activeView,
+ isCustom
+}) {
+ const customDataViews = useCustomDataViews(type);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-sidebar-navigation-screen-dataviews__group-header",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
+ level: 2,
+ children: (0,external_wp_i18n_namespaceObject.__)('Custom Views')
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: [customDataViews.map(customViewRecord => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, {
+ dataviewId: customViewRecord.id,
+ isActive: isCustom && Number(activeView) === customViewRecord.id
+ }, customViewRecord.id);
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, {
+ type: type
+ })]
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
const {
- useLocation: router_useLocation
-} = unlock(external_wp_router_namespaceObject.privateApis);
+ useLocation: sidebar_dataviews_useLocation
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+
+
+
+
+
+function DataViewsSidebarContent() {
+ const {
+ params: {
+ postType,
+ activeView = 'all',
+ isCustom = 'false'
+ }
+ } = sidebar_dataviews_useLocation();
+ if (!postType) {
+ return null;
+ }
+ const isCustomBoolean = isCustom === 'true';
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
+ children: DEFAULT_VIEWS[postType].map(dataview => {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, {
+ slug: dataview.slug,
+ title: dataview.title,
+ icon: dataview.icon,
+ type: dataview.view.type,
+ isActive: !isCustomBoolean && dataview.slug === activeView,
+ isCustom: false
+ }, dataview.slug);
+ })
+ }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, {
+ activeView: activeView,
+ type: postType,
+ isCustom: true
+ })]
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/router.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const {
+ useLocation: router_useLocation,
+ useHistory: router_useHistory
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+function useRedirectOldPaths() {
+ const history = router_useHistory();
+ const {
+ params
+ } = router_useLocation();
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ const {
+ postType,
+ path,
+ categoryType,
+ ...rest
+ } = params;
+ if (path === '/wp_template_part/all') {
+ history.replace({
+ postType: TEMPLATE_PART_POST_TYPE
+ });
+ }
+ if (path === '/page') {
+ history.replace({
+ postType: 'page',
+ ...rest
+ });
+ }
+ if (path === '/wp_template') {
+ history.replace({
+ postType: TEMPLATE_POST_TYPE,
+ ...rest
+ });
+ }
+ if (path === '/patterns') {
+ history.replace({
+ postType: categoryType === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user,
+ ...rest
+ });
+ }
+ if (path === '/navigation') {
+ history.replace({
+ postType: NAVIGATION_POST_TYPE,
+ ...rest
+ });
+ }
+ }, [history, params]);
+}
function useLayoutAreas() {
const isSiteEditorLoading = useIsSiteEditorLoading();
const {
@@ -45014,39 +39947,51 @@ function useLayoutAreas() {
layout,
isCustom,
canvas
- } = params !== null && params !== void 0 ? params : {};
-
- // Note: Since "sidebar" is not yet supported here,
- // returning undefined from "mobile" means show the sidebar.
+ } = params;
+ const hasEditCanvasMode = canvas === 'edit';
+ useRedirectOldPaths();
- // Regular page
- if (path === '/page') {
+ // Page list
+ if (postType === 'page') {
+ const isListLayout = layout === 'list' || !layout;
return {
+ key: 'pages',
areas: {
- content: undefined,
- preview: (0,external_React_.createElement)(Editor, {
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Pages'),
+ backPath: {},
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, {})
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PagePages, {}),
+ preview: (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
}),
- mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
+ mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
- }) : undefined
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PagePages, {})
},
widths: {
- content: undefined
+ content: isListLayout ? 380 : undefined
}
};
}
- // List layout is still experimental.
- // Extracted it here out of the conditionals so it doesn't unintentionally becomes stable.
- const isListLayout = isCustom !== 'true' && layout === 'list' && window?.__experimentalAdminViews;
- if (path === '/pages') {
+ // Templates
+ if (postType === TEMPLATE_POST_TYPE) {
+ const isListLayout = isCustom !== 'true' && layout === 'list';
return {
+ key: 'templates',
areas: {
- content: (0,external_React_.createElement)(PagePages, null),
- preview: isListLayout && (0,external_React_.createElement)(Editor, {
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, {
+ backPath: {}
+ }),
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}),
+ preview: (isListLayout || hasEditCanvasMode) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
- })
+ }),
+ mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {})
},
widths: {
content: isListLayout ? 380 : undefined
@@ -45054,85 +39999,280 @@ function useLayoutAreas() {
};
}
- // Regular other post types
- if (postType && postId) {
+ // Patterns
+ if ([TEMPLATE_PART_POST_TYPE, PATTERN_TYPES.user].includes(postType)) {
return {
+ key: 'patterns',
areas: {
- preview: (0,external_React_.createElement)(Editor, {
- isLoading: isSiteEditorLoading
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, {
+ backPath: {}
}),
- mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
+ content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}),
+ mobile: hasEditCanvasMode ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}),
+ preview: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
- }) : undefined
+ })
}
};
}
- // Templates
- if (path === '/wp_template/all') {
+ // Styles
+ if (path === '/wp_global_styles') {
return {
+ key: 'styles',
areas: {
- content: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
- postType: constants_TEMPLATE_POST_TYPE
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, {
+ backPath: {}
}),
- preview: isListLayout && (0,external_React_.createElement)(Editor, {
+ preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
}),
- mobile: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
- postType: constants_TEMPLATE_POST_TYPE
+ mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
})
- },
- widths: {
- content: isListLayout ? 380 : undefined
}
};
}
- // Template parts
- if (path === '/wp_template_part/all') {
+ // Navigation
+ if (postType === NAVIGATION_POST_TYPE) {
+ if (postId) {
+ return {
+ key: 'navigation',
+ areas: {
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, {
+ backPath: {
+ postType: NAVIGATION_POST_TYPE
+ }
+ }),
+ preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
+ }),
+ mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
+ })
+ }
+ };
+ }
return {
+ key: 'navigation',
areas: {
- content: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
- postType: TEMPLATE_PART_POST_TYPE
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, {
+ backPath: {}
}),
- preview: isListLayout && (0,external_React_.createElement)(Editor, {
+ preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
}),
- mobile: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
- postType: TEMPLATE_PART_POST_TYPE
+ mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
+ isLoading: isSiteEditorLoading
})
- },
- widths: {
- content: isListLayout ? 380 : undefined
- }
- };
- }
-
- // Patterns
- if (path === '/patterns') {
- return {
- areas: {
- content: (0,external_React_.createElement)(DataviewsPatterns, null),
- mobile: (0,external_React_.createElement)(DataviewsPatterns, null)
}
};
}
// Fallback shows the home page preview
return {
+ key: 'default',
areas: {
- preview: (0,external_React_.createElement)(Editor, {
+ sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}),
+ preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
}),
- mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
+ mobile: hasEditCanvasMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {
isLoading: isSiteEditorLoading
- }) : undefined
+ })
}
};
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js
+;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/esm/index.js
+var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}};
+;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/esm/index.js
+var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e};
+
+;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/esm/index.js
+var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null;
+
+;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/esm/index.js
+function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&&gt(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var esm_ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance;
+
+;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/esm/index.js
+var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated;
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * WordPress dependencies
+ */
+
+function getAbsolutePosition(element) {
+ return {
+ top: element.offsetTop,
+ left: element.offsetLeft
+ };
+}
+const ANIMATION_DURATION = 400;
+
+/**
+ * Hook used to compute the styles required to move a div into a new position.
+ *
+ * The way this animation works is the following:
+ * - It first renders the element as if there was no animation.
+ * - It takes a snapshot of the position of the block to use it
+ * as a destination point for the animation.
+ * - It restores the element to the previous position using a CSS transform
+ * - It uses the "resetAnimation" flag to reset the animation
+ * from the beginning in order to animate to the new destination point.
+ *
+ * @param {Object} $1 Options
+ * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
+ */
+function useMovingAnimation({
+ triggerAnimationOnChange
+}) {
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
+
+ // Whenever the trigger changes, we need to take a snapshot of the current
+ // position of the block to use it as a destination point for the animation.
+ const {
+ previous,
+ prevRect
+ } = (0,external_wp_element_namespaceObject.useMemo)(() => ({
+ previous: ref.current && getAbsolutePosition(ref.current),
+ prevRect: ref.current && ref.current.getBoundingClientRect()
+ }),
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [triggerAnimationOnChange]);
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
+ if (!previous || !ref.current) {
+ return;
+ }
+
+ // We disable the animation if the user has a preference for reduced
+ // motion.
+ const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+ if (disableAnimation) {
+ return;
+ }
+ const controller = new esm_le({
+ x: 0,
+ y: 0,
+ width: prevRect.width,
+ height: prevRect.height,
+ config: {
+ duration: ANIMATION_DURATION,
+ easing: Lt.easeInOutQuint
+ },
+ onChange({
+ value
+ }) {
+ if (!ref.current) {
+ return;
+ }
+ let {
+ x,
+ y,
+ width,
+ height
+ } = value;
+ x = Math.round(x);
+ y = Math.round(y);
+ width = Math.round(width);
+ height = Math.round(height);
+ const finishedMoving = x === 0 && y === 0;
+ ref.current.style.transformOrigin = 'center center';
+ ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform.
+ : `translate3d(${x}px,${y}px,0)`;
+ ref.current.style.width = finishedMoving ? null : `${width}px`;
+ ref.current.style.height = finishedMoving ? null : `${height}px`;
+ }
+ });
+ ref.current.style.transform = undefined;
+ const destination = ref.current.getBoundingClientRect();
+ const x = Math.round(prevRect.left - destination.left);
+ const y = Math.round(prevRect.top - destination.top);
+ const width = destination.width;
+ const height = destination.height;
+ controller.start({
+ x: 0,
+ y: 0,
+ width,
+ height,
+ from: {
+ x,
+ y,
+ width: prevRect.width,
+ height: prevRect.height
+ }
+ });
+ return () => {
+ controller.stop();
+ controller.set({
+ x: 0,
+ y: 0,
+ width: prevRect.width,
+ height: prevRect.height
+ });
+ };
+ }, [previous, prevRect]);
+ return ref;
+}
+/* harmony default export */ const animation = (useMovingAnimation);
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js
+/**
+ * WordPress dependencies
+ */
+
+
+
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+function SaveHub() {
+ const {
+ isDisabled,
+ isSaving
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
+ const {
+ __experimentalGetDirtyEntityRecords,
+ isSavingEntityRecord
+ } = select(external_wp_coreData_namespaceObject.store);
+ const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
+ const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
+ return {
+ isSaving: _isSaving,
+ isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme()
+ };
+ }, []);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
+ className: "edit-site-save-hub",
+ alignment: "right",
+ spacing: 4,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, {
+ className: "edit-site-save-hub__button",
+ variant: isDisabled ? null : 'primary',
+ showTooltip: false,
+ icon: isDisabled && !isSaving ? library_check : null,
+ showReviewMessage: true,
+ __next40pxDefaultSize: true
+ })
+ });
+}
+
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js
/**
* External dependencies
*/
@@ -45172,16 +40312,23 @@ function useLayoutAreas() {
+
+
+
+
const {
useCommands
-} = unlock(external_wp_coreCommands_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_coreCommands_namespaceObject.privateApis);
const {
useCommandContext
-} = unlock(external_wp_commands_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_commands_namespaceObject.privateApis);
const {
useGlobalStyle: layout_useGlobalStyle
-} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
-const ANIMATION_DURATION = 0.5;
+} = lock_unlock_unlock(external_wp_blockEditor_namespaceObject.privateApis);
+const {
+ NavigableRegion: layout_NavigableRegion
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
+const layout_ANIMATION_DURATION = 0.3;
function Layout() {
// This ensures the edited entity id and type are initialized properly.
useInitEditedEntityFromURL();
@@ -45189,8 +40336,8 @@ function Layout() {
useCommands();
useEditModeCommands();
useCommonCommands();
- (0,external_wp_blockEditor_namespaceObject.useBlockCommands)();
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
+ const toggleRef = (0,external_wp_element_namespaceObject.useRef)();
const {
isDistractionFree,
hasFixedToolbar,
@@ -45204,11 +40351,11 @@ function Layout() {
} = select(external_wp_keyboardShortcuts_namespaceObject.store);
const {
getCanvasMode
- } = unlock(select(store_store));
+ } = lock_unlock_unlock(select(store));
return {
canvasMode: getCanvasMode(),
- previousShortcut: getAllShortcutKeyCombinations('core/edit-site/previous-region'),
- nextShortcut: getAllShortcutKeyCombinations('core/edit-site/next-region'),
+ previousShortcut: getAllShortcutKeyCombinations('core/editor/previous-region'),
+ nextShortcut: getAllShortcutKeyCombinations('core/editor/next-region'),
hasFixedToolbar: select(external_wp_preferences_namespaceObject.store).get('core', 'fixedToolbar'),
isDistractionFree: select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'),
hasBlockSelected: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()
@@ -45224,34 +40371,18 @@ function Layout() {
const isEditorLoading = useIsSiteEditorLoading();
const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_namespaceObject.useState)(false);
const {
+ key: routeKey,
areas,
widths
} = useLayoutAreas();
-
- // This determines which animation variant should apply to the header.
- // There is also a `isDistractionFreeHovering` state that gets priority
- // when hovering the `edit-site-layout__header-container` in distraction
- // free mode. It's set via framer and trickles down to all the children
- // so they can use this variant state too.
- //
- // TODO: The issue with this is we want to have the hover state stick when hovering
- // a popover opened via the header. We'll probably need to lift this state to
- // handle it ourselves. Also, focusWithin the header needs to be handled.
- let headerAnimationState;
- if (canvasMode === 'view') {
- // We need 'view' to always take priority so 'isDistractionFree'
- // doesn't bleed over into the view (sidebar) state
- headerAnimationState = 'view';
- } else if (isDistractionFree) {
- headerAnimationState = 'isDistractionFree';
- } else {
- headerAnimationState = canvasMode; // edit, view, init
- }
+ const animationRef = animation({
+ triggerAnimationOnChange: canvasMode + '__' + routeKey
+ });
// Sets the right context for the command palette
let commandContext = 'site-editor';
if (canvasMode === 'edit') {
- commandContext = 'site-editor-edit';
+ commandContext = 'entity-edit';
}
if (hasBlockSelected) {
commandContext = 'block-selection-edit';
@@ -45259,6 +40390,14 @@ function Layout() {
useCommandContext(commandContext);
const [backgroundColor] = layout_useGlobalStyle('color.background');
const [gradientValue] = layout_useGlobalStyle('color.gradient');
+ const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvasMode);
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
+ if (previousCanvaMode === 'edit') {
+ toggleRef.current?.focus();
+ }
+ // Should not depend on the previous canvas mode value but the next.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [canvasMode]);
// Synchronizing the URL with the store value of canvasMode happens in an effect
// This condition ensures the component is only rendered after the synchronization happens
@@ -45266,153 +40405,95 @@ function Layout() {
if (canvasMode === 'init') {
return null;
}
- return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_commands_namespaceObject.CommandMenu, null), (0,external_React_.createElement)(register, null), (0,external_React_.createElement)(global, null), fullResizer, (0,external_React_.createElement)("div", {
- ...navigateRegionsProps,
- ref: navigateRegionsProps.ref,
- className: classnames_default()('edit-site-layout', navigateRegionsProps.className, {
- 'is-distraction-free': isDistractionFree && canvasMode === 'edit',
- 'is-full-canvas': canvasMode === 'edit',
- 'has-fixed-toolbar': hasFixedToolbar,
- 'is-block-toolbar-visible': hasBlockSelected
- })
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: "edit-site-layout__header-container",
- variants: {
- isDistractionFree: {
- opacity: 0,
- transition: {
- type: 'tween',
- delay: 0.8,
- delayChildren: 0.8
- } // How long to wait before the header exits
- },
- isDistractionFreeHovering: {
- opacity: 1,
- transition: {
- type: 'tween',
- delay: 0.2,
- delayChildren: 0.2
- } // How long to wait before the header shows
- },
- view: {
- opacity: 1
- },
- edit: {
- opacity: 1
- }
- },
- whileHover: isDistractionFree ? 'isDistractionFreeHovering' : undefined,
- animate: headerAnimationState
- }, (0,external_React_.createElement)(site_hub, {
- isTransparent: isResizableFrameOversized,
- className: "edit-site-layout__hub"
- }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
- initial: false
- }, canvasMode === 'edit' && (0,external_React_.createElement)(NavigableRegion, {
- key: "header",
- className: "edit-site-layout__header",
- ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
- as: external_wp_components_namespaceObject.__unstableMotion.div,
- variants: {
- isDistractionFree: {
- opacity: 0,
- y: 0
- },
- isDistractionFreeHovering: {
- opacity: 1,
- y: 0
- },
- view: {
- opacity: 1,
- y: '-100%'
- },
- edit: {
- opacity: 1,
- y: 0
- }
- },
- exit: {
- y: '-100%'
- },
- initial: {
- opacity: isDistractionFree ? 1 : 0,
- y: isDistractionFree ? 0 : '-100%'
- },
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : 0.2,
- ease: 'easeOut'
- }
- }, (0,external_React_.createElement)(HeaderEditMode, null)))), (0,external_React_.createElement)("div", {
- className: "edit-site-layout__content"
- }, (!isMobileViewport || isMobileViewport && !areas.mobile) && (0,external_React_.createElement)(NavigableRegion, {
- ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
- className: "edit-site-layout__sidebar-region"
- }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, canvasMode === 'view' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- initial: {
- opacity: 0
- },
- animate: {
- opacity: 1
- },
- exit: {
- opacity: 0
- },
- transition: {
- type: 'tween',
- duration:
- // Disable transition in mobile to emulate a full page transition.
- disableMotion || isMobileViewport ? 0 : ANIMATION_DURATION,
- ease: 'easeOut'
- },
- className: "edit-site-layout__sidebar"
- }, (0,external_React_.createElement)(sidebar, null)))), (0,external_React_.createElement)(SavePanel, null), isMobileViewport && areas.mobile && (0,external_React_.createElement)("div", {
- className: "edit-site-layout__mobile",
- style: {
- maxWidth: widths?.content
- }
- }, areas.mobile), !isMobileViewport && areas.content && canvasMode !== 'edit' && (0,external_React_.createElement)("div", {
- className: "edit-site-layout__area",
- style: {
- maxWidth: widths?.content
- }
- }, areas.content), !isMobileViewport && areas.preview && (0,external_React_.createElement)("div", {
- className: "edit-site-layout__canvas-container"
- }, canvasResizer, !!canvasSize.width && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- whileHover: canvasMode === 'view' ? {
- scale: 1.005,
- transition: {
- duration: disableMotion ? 0 : 0.5,
- ease: 'easeOut'
- }
- } : {},
- initial: false,
- layout: "position",
- className: classnames_default()('edit-site-layout__canvas', {
- 'is-right-aligned': isResizableFrameOversized
- }),
- transition: {
- type: 'tween',
- duration: disableMotion ? 0 : ANIMATION_DURATION,
- ease: 'easeOut'
- }
- }, (0,external_React_.createElement)(ErrorBoundary, null, (0,external_React_.createElement)(resizable_frame, {
- isReady: !isEditorLoading,
- isFullWidth: canvasMode === 'edit',
- defaultSize: {
- width: canvasSize.width - 24 /* $canvas-padding */,
- height: canvasSize.height
- },
- isOversized: isResizableFrameOversized,
- setIsOversized: setIsResizableFrameOversized,
- innerContentStyle: {
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
- }
- }, areas.preview)))))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global, {}), fullResizer, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ...navigateRegionsProps,
+ ref: navigateRegionsProps.ref,
+ className: dist_clsx('edit-site-layout', navigateRegionsProps.className, {
+ 'is-distraction-free': isDistractionFree && canvasMode === 'edit',
+ 'is-full-canvas': canvasMode === 'edit',
+ 'has-fixed-toolbar': hasFixedToolbar,
+ 'is-block-toolbar-visible': hasBlockSelected
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-layout__content",
+ children: [(!isMobileViewport || !areas.mobile) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_NavigableRegion, {
+ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
+ className: "edit-site-layout__sidebar-region",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
+ children: canvasMode === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
+ initial: {
+ opacity: 0
+ },
+ animate: {
+ opacity: 1
+ },
+ exit: {
+ opacity: 0
+ },
+ transition: {
+ type: 'tween',
+ duration:
+ // Disable transition in mobile to emulate a full page transition.
+ disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION,
+ ease: 'easeOut'
+ },
+ className: "edit-site-layout__sidebar",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_hub, {
+ ref: toggleRef,
+ isTransparent: isResizableFrameOversized
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, {
+ routeKey: routeKey,
+ children: areas.sidebar
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})]
+ })
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), isMobileViewport && areas.mobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-layout__mobile",
+ children: [canvasMode !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, {
+ routeKey: routeKey,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteHubMobile, {
+ ref: toggleRef,
+ isTransparent: isResizableFrameOversized
+ })
+ }), areas.mobile]
+ }), !isMobileViewport && areas.content && canvasMode !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "edit-site-layout__area",
+ style: {
+ maxWidth: widths?.content
+ },
+ children: areas.content
+ }), !isMobileViewport && areas.preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "edit-site-layout__canvas-container",
+ children: [canvasResizer, !!canvasSize.width && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('edit-site-layout__canvas', {
+ 'is-right-aligned': isResizableFrameOversized
+ }),
+ ref: animationRef,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundary, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_frame, {
+ isReady: !isEditorLoading,
+ isFullWidth: canvasMode === 'edit',
+ defaultSize: {
+ width: canvasSize.width - 24 /* $canvas-padding */,
+ height: canvasSize.height
+ },
+ isOversized: isResizableFrameOversized,
+ setIsOversized: setIsResizableFrameOversized,
+ innerContentStyle: {
+ background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
+ },
+ children: areas.preview
+ })
+ })
+ })]
+ })]
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js
-
/**
* WordPress dependencies
*/
@@ -45430,9 +40511,13 @@ function Layout() {
+
const {
RouterProvider
-} = unlock(external_wp_router_namespaceObject.privateApis);
+} = lock_unlock_unlock(external_wp_router_namespaceObject.privateApis);
+const {
+ GlobalStylesProvider
+} = lock_unlock_unlock(external_wp_editor_namespaceObject.privateApis);
function App() {
const {
createErrorNotice
@@ -45441,237 +40526,75 @@ function App() {
createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */
(0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
}
- return (0,external_React_.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_React_.createElement)(GlobalStylesProvider, null, (0,external_React_.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_React_.createElement)(RouterProvider, null, (0,external_React_.createElement)(Layout, null), (0,external_React_.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
- onError: onPluginAreaError
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(RouterProvider, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, {
+ onError: onPluginAreaError
+ })]
+ })]
+ })
+ });
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js
-
+;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/deprecated.js
/**
* WordPress dependencies
*/
+
+
+const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
+const deprecateSlot = name => {
+ external_wp_deprecated_default()(`wp.editPost.${name}`, {
+ since: '6.6',
+ alternative: `wp.editor.${name}`
+ });
+};
+
+/* eslint-disable jsdoc/require-param */
/**
- * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
- * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
- * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
- *
- * ```js
- * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
- * ```
- *
- * @see PluginSidebarMoreMenuItem
- *
- * @param {Object} props Element props.
- * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
- * @param {string} [props.className] An optional class name added to the sidebar body.
- * @param {string} props.title Title displayed at the top of the sidebar.
- * @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.
- * @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.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var el = wp.element.createElement;
- * var PanelBody = wp.components.PanelBody;
- * var PluginSidebar = wp.editSite.PluginSidebar;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function MyPluginSidebar() {
- * return el(
- * PluginSidebar,
- * {
- * name: 'my-sidebar',
- * title: 'My sidebar title',
- * icon: moreIcon,
- * },
- * el(
- * PanelBody,
- * {},
- * __( 'My sidebar content' )
- * )
- * );
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PanelBody } from '@wordpress/components';
- * import { PluginSidebar } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * const MyPluginSidebar = () => (
- * <PluginSidebar
- * name="my-sidebar"
- * title="My sidebar title"
- * icon={ more }
- * >
- * <PanelBody>
- * { __( 'My sidebar content' ) }
- * </PanelBody>
- * </PluginSidebar>
- * );
- * ```
+ * @see PluginMoreMenuItem in @wordpress/editor package.
*/
-function PluginSidebarEditSite({
- className,
- ...props
-}) {
- return (0,external_React_.createElement)(complementary_area, {
- panelClassName: className,
- className: "edit-site-sidebar-edit-mode",
- scope: "core/edit-site",
+function PluginMoreMenuItem(props) {
+ if (!isSiteEditor) {
+ return null;
+ }
+ deprecateSlot('PluginMoreMenuItem');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, {
...props
});
}
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js
-
/**
- * WordPress dependencies
+ * @see PluginSidebar in @wordpress/editor package.
*/
-
+function PluginSidebar(props) {
+ if (!isSiteEditor) {
+ return null;
+ }
+ deprecateSlot('PluginSidebar');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, {
+ ...props
+ });
+}
/**
- * Renders a menu item in `Plugins` group in `More Menu` drop down,
- * and can be used to activate the corresponding `PluginSidebar` component.
- * The text within the component appears as the menu item label.
- *
- * @param {Object} props Component props.
- * @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.
- * @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.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function MySidebarMoreMenuItem() {
- * return wp.element.createElement(
- * PluginSidebarMoreMenuItem,
- * {
- * target: 'my-sidebar',
- * icon: moreIcon,
- * },
- * __( 'My sidebar title' )
- * )
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * const MySidebarMoreMenuItem = () => (
- * <PluginSidebarMoreMenuItem
- * target="my-sidebar"
- * icon={ more }
- * >
- * { __( 'My sidebar title' ) }
- * </PluginSidebarMoreMenuItem>
- * );
- * ```
- *
- * @return {Component} The component to be rendered.
+ * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
*/
-
function PluginSidebarMoreMenuItem(props) {
- return (0,external_React_.createElement)(ComplementaryAreaMoreMenuItem
- // Menu item is marked with unstable prop for backward compatibility.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- , {
- __unstableExplicitMenuItem: true,
- scope: "core/edit-site",
+ if (!isSiteEditor) {
+ return null;
+ }
+ deprecateSlot('PluginSidebarMoreMenuItem');
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, {
...props
});
}
-
-;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header-edit-mode/plugin-more-menu-item/index.js
-/**
- * WordPress dependencies
- */
-
-
-
-
-
-/**
- * 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.
- * The text within the component appears as the menu item label.
- *
- * @param {Object} props Component properties.
- * @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.
- * @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.
- * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
- * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function onButtonClick() {
- * alert( 'Button clicked.' );
- * }
- *
- * function MyButtonMoreMenuItem() {
- * return wp.element.createElement(
- * PluginMoreMenuItem,
- * {
- * icon: moreIcon,
- * onClick: onButtonClick,
- * },
- * __( 'My button title' )
- * );
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PluginMoreMenuItem } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * function onButtonClick() {
- * alert( 'Button clicked.' );
- * }
- *
- * const MyButtonMoreMenuItem = () => (
- * <PluginMoreMenuItem
- * icon={ more }
- * onClick={ onButtonClick }
- * >
- * { __( 'My button title' ) }
- * </PluginMoreMenuItem>
- * );
- * ```
- *
- * @return {Component} The component to be rendered.
- */
-/* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
- var _ownProps$as;
- return {
- as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
- icon: ownProps.icon || context.icon,
- name: 'core/edit-site/plugin-more-menu'
- };
-}))(action_item));
+/* eslint-enable jsdoc/require-param */
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js
-
/**
* WordPress dependencies
*/
@@ -45684,7 +40607,6 @@ function PluginSidebarMoreMenuItem(props) {
-
/**
* Internal dependencies
*/
@@ -45698,6 +40620,7 @@ function PluginSidebarMoreMenuItem(props) {
* @param {string} id ID of the root element to render the screen in.
* @param {Object} settings Editor settings.
*/
+
function initializeEditor(id, settings) {
const target = document.getElementById(id);
const root = (0,external_wp_element_namespaceObject.createRoot)(target);
@@ -45735,8 +40658,7 @@ function initializeEditor(id, settings) {
showBlockBreadcrumbs: true,
showListViewByDefault: false
});
- (0,external_wp_data_namespaceObject.dispatch)(store).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
- (0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings);
+ (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings);
// Keep the defaultTemplateTypes in the core/editor settings too,
// so that they can be selected with core/editor selectors in any editor.
@@ -45750,7 +40672,7 @@ function initializeEditor(id, settings) {
// Prevent the default browser action for files dropped outside of dropzones.
window.addEventListener('dragover', e => e.preventDefault(), false);
window.addEventListener('drop', e => e.preventDefault(), false);
- root.render((0,external_React_.createElement)(App, null));
+ root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}));
return root;
}
function reinitializeEditor() {
@@ -45763,8 +40685,6 @@ function reinitializeEditor() {
-
-
})();
(window.wp = window.wp || {}).editSite = __webpack_exports__;