rebase on oct-10-2023
This commit is contained in:
@@ -391,8 +391,9 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Add an item to the collection.
|
||||
*
|
||||
* @param {string|wp.customize.Class} item - The item instance to add, or the ID for the instance to add. When an ID string is supplied, then itemObject must be provided.
|
||||
* @param {wp.customize.Class} [itemObject] - The item instance when the first argument is a ID string.
|
||||
* @param {string|wp.customize.Class} item - The item instance to add, or the ID for the instance to add.
|
||||
* When an ID string is supplied, then itemObject must be provided.
|
||||
* @param {wp.customize.Class} [itemObject] - The item instance when the first argument is an ID string.
|
||||
* @return {wp.customize.Class} The new item's instance, or an existing instance if already added.
|
||||
*/
|
||||
add: function( item, itemObject ) {
|
||||
|
||||
Vendored
+1
-2
@@ -100,8 +100,7 @@ function addIntroText() {
|
||||
*
|
||||
* @return {HTMLDivElement} The ARIA live region HTML element.
|
||||
*/
|
||||
function addContainer() {
|
||||
let ariaLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'polite';
|
||||
function addContainer(ariaLive = 'polite') {
|
||||
const container = document.createElement('div');
|
||||
container.id = `a11y-speak-${ariaLive}`;
|
||||
container.className = 'a11y-speak-region';
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var t={n:function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},d:function(e,n){for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{setup:function(){return d},speak:function(){return p}});var n=window.wp.domReady,i=t.n(n),o=window.wp.i18n;function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"polite";const e=document.createElement("div");e.id=`a11y-speak-${t}`,e.className="a11y-speak-region",e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("aria-live",t),e.setAttribute("aria-relevant","additions text"),e.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(e),e}let a="";function d(){const t=document.getElementById("a11y-speak-intro-text"),e=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===t&&function(){const t=document.createElement("p");t.id="a11y-speak-intro-text",t.className="a11y-speak-intro-text",t.textContent=(0,o.__)("Notifications"),t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("hidden","hidden");const{body:e}=document;e&&e.appendChild(t)}(),null===e&&r("assertive"),null===n&&r("polite")}function p(t,e){!function(){const t=document.getElementsByClassName("a11y-speak-region"),e=document.getElementById("a11y-speak-intro-text");for(let e=0;e<t.length;e++)t[e].textContent="";e&&e.setAttribute("hidden","hidden")}(),t=function(t){return t=t.replace(/<[^<>]+>/g," "),a===t&&(t+=" "),a=t,t}(t);const n=document.getElementById("a11y-speak-intro-text"),i=document.getElementById("a11y-speak-assertive"),o=document.getElementById("a11y-speak-polite");i&&"assertive"===e?i.textContent=t:o&&(o.textContent=t),n&&n.removeAttribute("hidden")}i()(d),(window.wp=window.wp||{}).a11y=e}();
|
||||
!function(){"use strict";var t={n:function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},d:function(e,n){for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{setup:function(){return d},speak:function(){return p}});var n=window.wp.domReady,i=t.n(n),o=window.wp.i18n;function r(t="polite"){const e=document.createElement("div");e.id=`a11y-speak-${t}`,e.className="a11y-speak-region",e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("aria-live",t),e.setAttribute("aria-relevant","additions text"),e.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(e),e}let a="";function d(){const t=document.getElementById("a11y-speak-intro-text"),e=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===t&&function(){const t=document.createElement("p");t.id="a11y-speak-intro-text",t.className="a11y-speak-intro-text",t.textContent=(0,o.__)("Notifications"),t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("hidden","hidden");const{body:e}=document;e&&e.appendChild(t)}(),null===e&&r("assertive"),null===n&&r("polite")}function p(t,e){!function(){const t=document.getElementsByClassName("a11y-speak-region"),e=document.getElementById("a11y-speak-intro-text");for(let e=0;e<t.length;e++)t[e].textContent="";e&&e.setAttribute("hidden","hidden")}(),t=function(t){return t=t.replace(/<[^<>]+>/g," "),a===t&&(t+=" "),a=t,t}(t);const n=document.getElementById("a11y-speak-intro-text"),i=document.getElementById("a11y-speak-assertive"),o=document.getElementById("a11y-speak-polite");i&&"assertive"===e?i.textContent=t:o&&(o.textContent=t),n&&n.removeAttribute("hidden")}i()(d),(window.wp=window.wp||{}).a11y=e}();
|
||||
+34
-47
@@ -95,8 +95,7 @@ const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';
|
||||
* @return {Object} A record with the annotations applied.
|
||||
*/
|
||||
|
||||
function applyAnnotations(record) {
|
||||
let annotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
||||
function applyAnnotations(record, annotations = []) {
|
||||
annotations.forEach(annotation => {
|
||||
let {
|
||||
start,
|
||||
@@ -176,11 +175,10 @@ function retrieveAnnotationPositions(formats) {
|
||||
*/
|
||||
|
||||
|
||||
function updateAnnotationsWithPositions(annotations, positions, _ref) {
|
||||
let {
|
||||
removeAnnotation,
|
||||
updateAnnotationRange
|
||||
} = _ref;
|
||||
function updateAnnotationsWithPositions(annotations, positions, {
|
||||
removeAnnotation,
|
||||
updateAnnotationRange
|
||||
}) {
|
||||
annotations.forEach(currentAnnotation => {
|
||||
const position = positions[currentAnnotation.id]; // If we cannot find an annotation, delete it.
|
||||
|
||||
@@ -216,20 +214,18 @@ const annotation = {
|
||||
return null;
|
||||
},
|
||||
|
||||
__experimentalGetPropsForEditableTreePreparation(select, _ref2) {
|
||||
let {
|
||||
richTextIdentifier,
|
||||
blockClientId
|
||||
} = _ref2;
|
||||
__experimentalGetPropsForEditableTreePreparation(select, {
|
||||
richTextIdentifier,
|
||||
blockClientId
|
||||
}) {
|
||||
return {
|
||||
annotations: select(STORE_NAME).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)
|
||||
};
|
||||
},
|
||||
|
||||
__experimentalCreatePrepareEditableTree(_ref3) {
|
||||
let {
|
||||
annotations
|
||||
} = _ref3;
|
||||
__experimentalCreatePrepareEditableTree({
|
||||
annotations
|
||||
}) {
|
||||
return (formats, text) => {
|
||||
if (annotations.length === 0) {
|
||||
return formats;
|
||||
@@ -307,12 +303,10 @@ var external_wp_data_namespaceObject = window["wp"]["data"];
|
||||
*/
|
||||
|
||||
const addAnnotationClassName = OriginalComponent => {
|
||||
return (0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
|
||||
let {
|
||||
clientId,
|
||||
className
|
||||
} = _ref;
|
||||
|
||||
return (0,external_wp_data_namespaceObject.withSelect)((select, {
|
||||
clientId,
|
||||
className
|
||||
}) => {
|
||||
const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
|
||||
|
||||
return {
|
||||
@@ -349,12 +343,9 @@ function filterWithReference(collection, predicate) {
|
||||
*/
|
||||
|
||||
|
||||
const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, _ref) => {
|
||||
let [key, value] = _ref;
|
||||
return { ...acc,
|
||||
[key]: callback(value)
|
||||
};
|
||||
}, {});
|
||||
const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({ ...acc,
|
||||
[key]: callback(value)
|
||||
}), {});
|
||||
/**
|
||||
* Verifies whether the given annotations is a valid annotation.
|
||||
*
|
||||
@@ -376,12 +367,9 @@ function isValidAnnotationRange(annotation) {
|
||||
*/
|
||||
|
||||
|
||||
function annotations() {
|
||||
function annotations(state = {}, action) {
|
||||
var _state$blockClientId;
|
||||
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
switch (action.type) {
|
||||
case 'ANNOTATION_ADD':
|
||||
const blockClientId = action.blockClientId;
|
||||
@@ -398,7 +386,7 @@ function annotations() {
|
||||
return state;
|
||||
}
|
||||
|
||||
const previousAnnotationsForBlock = (_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
|
||||
const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
|
||||
return { ...state,
|
||||
[blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
|
||||
};
|
||||
@@ -767,18 +755,18 @@ const EMPTY_ARRAY = [];
|
||||
const __experimentalGetAnnotationsForBlock = rememo((state, blockClientId) => {
|
||||
var _state$blockClientId;
|
||||
|
||||
return ((_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
|
||||
return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
|
||||
return annotation.selector === 'block';
|
||||
});
|
||||
}, (state, blockClientId) => {
|
||||
var _state$blockClientId2;
|
||||
|
||||
return [(_state$blockClientId2 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
|
||||
return [(_state$blockClientId2 = state?.[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
|
||||
});
|
||||
function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
|
||||
var _state$blockClientId3;
|
||||
|
||||
return (_state$blockClientId3 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
|
||||
return (_state$blockClientId3 = state?.[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
|
||||
}
|
||||
/**
|
||||
* Returns the annotations that apply to the given RichText instance.
|
||||
@@ -796,7 +784,7 @@ function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
|
||||
const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, richTextIdentifier) => {
|
||||
var _state$blockClientId4;
|
||||
|
||||
return ((_state$blockClientId4 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
|
||||
return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
|
||||
return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier;
|
||||
}).map(annotation => {
|
||||
const {
|
||||
@@ -810,7 +798,7 @@ const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, ri
|
||||
}, (state, blockClientId) => {
|
||||
var _state$blockClientId5;
|
||||
|
||||
return [(_state$blockClientId5 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
|
||||
return [(_state$blockClientId5 = state?.[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
|
||||
});
|
||||
/**
|
||||
* Returns all annotations in the editor state.
|
||||
@@ -942,15 +930,14 @@ function v4(options, buf, offset) {
|
||||
* @return {Object} Action object.
|
||||
*/
|
||||
|
||||
function __experimentalAddAnnotation(_ref) {
|
||||
let {
|
||||
blockClientId,
|
||||
richTextIdentifier = null,
|
||||
range = null,
|
||||
selector = 'range',
|
||||
source = 'default',
|
||||
id = esm_browser_v4()
|
||||
} = _ref;
|
||||
function __experimentalAddAnnotation({
|
||||
blockClientId,
|
||||
richTextIdentifier = null,
|
||||
range = null,
|
||||
selector = 'range',
|
||||
source = 'default',
|
||||
id = esm_browser_v4()
|
||||
}) {
|
||||
const action = {
|
||||
type: 'ANNOTATION_ADD',
|
||||
id,
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+45
-23
@@ -147,10 +147,7 @@ var external_wp_url_namespaceObject = window["wp"]["url"];
|
||||
*/
|
||||
|
||||
function createPreloadingMiddleware(preloadedData) {
|
||||
const cache = Object.fromEntries(Object.entries(preloadedData).map(_ref => {
|
||||
let [path, data] = _ref;
|
||||
return [(0,external_wp_url_namespaceObject.normalizePath)(path), data];
|
||||
}));
|
||||
const cache = Object.fromEntries(Object.entries(preloadedData).map(([path, data]) => [(0,external_wp_url_namespaceObject.normalizePath)(path), data]));
|
||||
return (options, next) => {
|
||||
const {
|
||||
parse = true
|
||||
@@ -229,17 +226,14 @@ function prepareResponse(responseData, parse) {
|
||||
* @return {import('../types').APIFetchOptions} The request with the modified query args
|
||||
*/
|
||||
|
||||
const modifyQuery = (_ref, queryArgs) => {
|
||||
let {
|
||||
path,
|
||||
url,
|
||||
...options
|
||||
} = _ref;
|
||||
return { ...options,
|
||||
url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs),
|
||||
path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs)
|
||||
};
|
||||
};
|
||||
const modifyQuery = ({
|
||||
path,
|
||||
url,
|
||||
...options
|
||||
}, queryArgs) => ({ ...options,
|
||||
url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs),
|
||||
path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs)
|
||||
});
|
||||
/**
|
||||
* Duplicates parsing functionality from apiFetch.
|
||||
*
|
||||
@@ -439,9 +433,7 @@ const userLocaleMiddleware = (options, next) => {
|
||||
* @return {Promise<any> | null | Response} Parsed response.
|
||||
*/
|
||||
|
||||
const response_parseResponse = function (response) {
|
||||
let shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
|
||||
const response_parseResponse = (response, shouldParseResponse = true) => {
|
||||
if (shouldParseResponse) {
|
||||
if (response.status === 204) {
|
||||
return null;
|
||||
@@ -485,8 +477,7 @@ const parseJsonAndNormalizeError = response => {
|
||||
*/
|
||||
|
||||
|
||||
const parseResponseAndNormalizeError = function (response) {
|
||||
let shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
const parseResponseAndNormalizeError = (response, shouldParseResponse = true) => {
|
||||
return Promise.resolve(response_parseResponse(response, shouldParseResponse)).catch(res => parseAndThrowError(res, shouldParseResponse));
|
||||
};
|
||||
/**
|
||||
@@ -497,9 +488,7 @@ const parseResponseAndNormalizeError = function (response) {
|
||||
* @return {Promise<any>} Parsed response.
|
||||
*/
|
||||
|
||||
function parseAndThrowError(response) {
|
||||
let shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
|
||||
function parseAndThrowError(response, shouldParseResponse = true) {
|
||||
if (!shouldParseResponse) {
|
||||
throw response;
|
||||
}
|
||||
@@ -598,6 +587,37 @@ const mediaUploadMiddleware = (options, next) => {
|
||||
|
||||
/* harmony default export */ var media_upload = (mediaUploadMiddleware);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/theme-preview.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* This appends a `wp_theme_preview` parameter to the REST API request URL if
|
||||
* the admin URL contains a `theme` GET parameter.
|
||||
*
|
||||
* @param {Record<string, any>} themePath
|
||||
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
|
||||
*/
|
||||
|
||||
const createThemePreviewMiddleware = themePath => (options, next) => {
|
||||
if (typeof options.url === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, 'wp_theme_preview')) {
|
||||
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
|
||||
wp_theme_preview: themePath
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof options.path === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, 'wp_theme_preview')) {
|
||||
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
|
||||
wp_theme_preview: themePath
|
||||
});
|
||||
}
|
||||
|
||||
return next(options);
|
||||
};
|
||||
|
||||
/* harmony default export */ var theme_preview = (createThemePreviewMiddleware);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/index.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
@@ -616,6 +636,7 @@ const mediaUploadMiddleware = (options, next) => {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Default set of header values which should be sent with every request unless
|
||||
* explicitly provided through apiFetch options.
|
||||
@@ -777,6 +798,7 @@ apiFetch.createPreloadingMiddleware = preloading;
|
||||
apiFetch.createRootURLMiddleware = root_url;
|
||||
apiFetch.fetchAllMiddleware = fetch_all_middleware;
|
||||
apiFetch.mediaUploadMiddleware = media_upload;
|
||||
apiFetch.createThemePreviewMiddleware = theme_preview;
|
||||
/* harmony default export */ var build_module = (apiFetch);
|
||||
|
||||
(window.wp = window.wp || {}).apiFetch = __webpack_exports__["default"];
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-2
@@ -164,8 +164,7 @@ function replaceInHtmlTags(haystack, replacePairs) {
|
||||
*/
|
||||
|
||||
|
||||
function autop(text) {
|
||||
let br = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
function autop(text, br = true) {
|
||||
const preTags = [];
|
||||
|
||||
if (text.trim() === '') {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-3
@@ -83,9 +83,7 @@ function getBlobByURL(url) {
|
||||
*/
|
||||
|
||||
function getBlobTypeByURL(url) {
|
||||
var _getBlobByURL;
|
||||
|
||||
return (_getBlobByURL = getBlobByURL(url)) === null || _getBlobByURL === void 0 ? void 0 : _getBlobByURL.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
||||
return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
||||
}
|
||||
/**
|
||||
* Remove the resource and file cache from memory.
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{createBlobURL:function(){return o},getBlobByURL:function(){return r},getBlobTypeByURL:function(){return i},isBlobURL:function(){return c},revokeBlobURL:function(){return u}});const t={};function o(e){const n=window.URL.createObjectURL(e);return t[n]=e,n}function r(e){return t[e]}function i(e){var n;return null===(n=r(e))||void 0===n?void 0:n.type.split("/")[0]}function u(e){t[e]&&window.URL.revokeObjectURL(e),delete t[e]}function c(e){return!(!e||!e.indexOf)&&0===e.indexOf("blob:")}(window.wp=window.wp||{}).blob=n}();
|
||||
!function(){"use strict";var e={d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{createBlobURL:function(){return o},getBlobByURL:function(){return r},getBlobTypeByURL:function(){return u},isBlobURL:function(){return c},revokeBlobURL:function(){return i}});const t={};function o(e){const n=window.URL.createObjectURL(e);return t[n]=e,n}function r(e){return t[e]}function u(e){return r(e)?.type.split("/")[0]}function i(e){t[e]&&window.URL.revokeObjectURL(e),delete t[e]}function c(e){return!(!e||!e.indexOf)&&0===e.indexOf("blob:")}(window.wp=window.wp||{}).blob=n}();
|
||||
+528
-453
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+33103
-24304
File diff suppressed because one or more lines are too long
+3
-3
File diff suppressed because one or more lines are too long
+9672
-7953
File diff suppressed because it is too large
Load Diff
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+1165
-844
File diff suppressed because it is too large
Load Diff
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+4160
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
Vendored
+18816
-9313
File diff suppressed because one or more lines are too long
+22
-6
File diff suppressed because one or more lines are too long
Vendored
+618
-480
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+487
@@ -0,0 +1,487 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ // The require scope
|
||||
/******/ var __webpack_require__ = {};
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ !function() {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, definition) {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ !function() {
|
||||
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/make namespace object */
|
||||
/******/ !function() {
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"privateApis": function() { return /* reexport */ privateApis; }
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","commands"]
|
||||
var external_wp_commands_namespaceObject = window["wp"]["commands"];
|
||||
;// CONCATENATED MODULE: external ["wp","i18n"]
|
||||
var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
||||
;// CONCATENATED MODULE: external ["wp","element"]
|
||||
var external_wp_element_namespaceObject = window["wp"]["element"];
|
||||
;// CONCATENATED MODULE: external ["wp","primitives"]
|
||||
var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
|
||||
}));
|
||||
/* harmony default export */ var library_plus = (plus);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var library_external = (external);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/admin-navigation-commands.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function useAdminNavigationCommands() {
|
||||
(0,external_wp_commands_namespaceObject.useCommand)({
|
||||
name: 'core/add-new-post',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Add new post'),
|
||||
icon: library_plus,
|
||||
callback: () => {
|
||||
document.location.href = 'post-new.php';
|
||||
}
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommand)({
|
||||
name: 'core/add-new-page',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Add new page'),
|
||||
icon: library_plus,
|
||||
callback: () => {
|
||||
document.location.href = 'post-new.php?post_type=page';
|
||||
}
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommand)({
|
||||
name: 'core/manage-reusable-blocks',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Manage all of my patterns'),
|
||||
callback: () => {
|
||||
document.location.href = 'edit.php?post_type=wp_block';
|
||||
},
|
||||
icon: library_external
|
||||
});
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","data"]
|
||||
var external_wp_data_namespaceObject = window["wp"]["data"];
|
||||
;// CONCATENATED MODULE: external ["wp","coreData"]
|
||||
var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var library_post = (post);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"
|
||||
}));
|
||||
/* harmony default export */ var library_page = (page);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var library_layout = (layout);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var symbol_filled = (symbolFilled);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const navigation = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
viewBox: "0 0 24 24",
|
||||
xmlns: "http://www.w3.org/2000/svg"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var library_navigation = (navigation);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
viewBox: "0 0 24 24",
|
||||
xmlns: "http://www.w3.org/2000/svg"
|
||||
}, (0,external_wp_element_namespaceObject.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 */ var library_styles = (styles);
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","router"]
|
||||
var external_wp_router_namespaceObject = window["wp"]["router"];
|
||||
;// CONCATENATED MODULE: external ["wp","url"]
|
||||
var external_wp_url_namespaceObject = window["wp"]["url"];
|
||||
;// CONCATENATED MODULE: external ["wp","privateApis"]
|
||||
var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/lock-unlock.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const {
|
||||
lock,
|
||||
unlock
|
||||
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/core-commands');
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/site-editor-navigation-commands.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
const {
|
||||
useHistory
|
||||
} = unlock(external_wp_router_namespaceObject.privateApis);
|
||||
const icons = {
|
||||
post: library_post,
|
||||
page: library_page,
|
||||
wp_template: library_layout,
|
||||
wp_template_part: symbol_filled
|
||||
};
|
||||
|
||||
const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader({
|
||||
search
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const supportsSearch = !['wp_template', 'wp_template_part'].includes(postType);
|
||||
const {
|
||||
records,
|
||||
isLoading
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getEntityRecords
|
||||
} = select(external_wp_coreData_namespaceObject.store);
|
||||
const query = supportsSearch ? {
|
||||
search: !!search ? search : undefined,
|
||||
per_page: 10,
|
||||
orderby: search ? 'relevance' : 'date',
|
||||
status: ['publish', 'future', 'draft', 'pending', 'private']
|
||||
} : {
|
||||
per_page: -1
|
||||
};
|
||||
return {
|
||||
records: getEntityRecords('postType', postType, query),
|
||||
isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query])
|
||||
};
|
||||
}, [supportsSearch, search]);
|
||||
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
return (records !== null && records !== void 0 ? records : []).slice(0, 10).map(record => {
|
||||
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
|
||||
const extraArgs = isSiteEditor ? {
|
||||
canvas: (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'canvas')
|
||||
} : {};
|
||||
return {
|
||||
name: postType + '-' + record.id,
|
||||
searchLabel: record.title?.rendered + ' ' + record.id,
|
||||
label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
|
||||
icon: icons[postType],
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
postType,
|
||||
postId: record.id,
|
||||
...extraArgs
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
};
|
||||
});
|
||||
}, [records, history]);
|
||||
return {
|
||||
commands,
|
||||
isLoading
|
||||
};
|
||||
};
|
||||
|
||||
const usePageNavigationCommandLoader = getNavigationCommandLoaderPerPostType('page');
|
||||
const usePostNavigationCommandLoader = getNavigationCommandLoaderPerPostType('post');
|
||||
const useTemplateNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template');
|
||||
const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template_part');
|
||||
|
||||
function useSiteEditorBasicNavigationCommands() {
|
||||
const history = useHistory();
|
||||
const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php');
|
||||
const commands = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
const result = [];
|
||||
result.push({
|
||||
name: 'core/edit-site/open-navigation',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Open navigation'),
|
||||
icon: library_navigation,
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
path: '/navigation'
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: 'core/edit-site/open-pages',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Open pages'),
|
||||
icon: library_page,
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
path: '/page'
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: 'core/edit-site/open-style-variations',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Open style variations'),
|
||||
icon: library_styles,
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
path: '/wp_global_styles'
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: 'core/edit-site/open-templates',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Open templates'),
|
||||
icon: library_layout,
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
path: '/wp_template'
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: 'core/edit-site/open-template-parts',
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Open library'),
|
||||
icon: symbol_filled,
|
||||
callback: ({
|
||||
close
|
||||
}) => {
|
||||
const args = {
|
||||
path: '/patterns'
|
||||
};
|
||||
const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', args);
|
||||
|
||||
if (isSiteEditor) {
|
||||
history.push(args);
|
||||
} else {
|
||||
document.location = targetUrl;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}, [history, isSiteEditor]);
|
||||
return {
|
||||
commands,
|
||||
isLoading: false
|
||||
};
|
||||
}
|
||||
|
||||
function useSiteEditorNavigationCommands() {
|
||||
(0,external_wp_commands_namespaceObject.useCommandLoader)({
|
||||
name: 'core/edit-site/navigate-pages',
|
||||
hook: usePageNavigationCommandLoader
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommandLoader)({
|
||||
name: 'core/edit-site/navigate-posts',
|
||||
hook: usePostNavigationCommandLoader
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommandLoader)({
|
||||
name: 'core/edit-site/navigate-templates',
|
||||
hook: useTemplateNavigationCommandLoader
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommandLoader)({
|
||||
name: 'core/edit-site/navigate-template-parts',
|
||||
hook: useTemplatePartNavigationCommandLoader
|
||||
});
|
||||
(0,external_wp_commands_namespaceObject.useCommandLoader)({
|
||||
name: 'core/edit-site/basic-navigation',
|
||||
hook: useSiteEditorBasicNavigationCommands,
|
||||
context: 'site-editor'
|
||||
});
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/private-apis.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
function useCommands() {
|
||||
useAdminNavigationCommands();
|
||||
useSiteEditorNavigationCommands();
|
||||
}
|
||||
|
||||
const privateApis = {};
|
||||
lock(privateApis, {
|
||||
useCommands
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-commands/build-module/index.js
|
||||
|
||||
|
||||
(window.wp = window.wp || {}).coreCommands = __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
+2
File diff suppressed because one or more lines are too long
Vendored
+1790
-1475
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+351
-276
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+22
-20
@@ -74,6 +74,7 @@ var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dispatches a control action for triggering an api fetch call.
|
||||
*
|
||||
@@ -93,7 +94,6 @@ var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external
|
||||
*
|
||||
* @return {Object} The control descriptor.
|
||||
*/
|
||||
|
||||
function apiFetch(request) {
|
||||
return {
|
||||
type: 'API_FETCH',
|
||||
@@ -104,43 +104,49 @@ function apiFetch(request) {
|
||||
* Control for resolving a selector in a registered data store.
|
||||
* Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.
|
||||
*
|
||||
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
|
||||
* @param storeNameOrDescriptor The store object or identifier.
|
||||
* @param selectorName The selector name.
|
||||
* @param args Arguments passed without change to the `@wordpress/data` control.
|
||||
*/
|
||||
|
||||
function build_module_select() {
|
||||
function build_module_select(storeNameOrDescriptor, selectorName, ...args) {
|
||||
external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', {
|
||||
since: '5.7',
|
||||
alternative: 'built-in `resolveSelect` control in `@wordpress/data`'
|
||||
});
|
||||
return external_wp_data_namespaceObject.controls.resolveSelect(...arguments);
|
||||
return external_wp_data_namespaceObject.controls.resolveSelect(storeNameOrDescriptor, selectorName, ...args);
|
||||
}
|
||||
/**
|
||||
* Control for calling a selector in a registered data store.
|
||||
* Alias for the `select` built-in control in the `@wordpress/data` package.
|
||||
*
|
||||
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
|
||||
* @param storeNameOrDescriptor The store object or identifier.
|
||||
* @param selectorName The selector name.
|
||||
* @param args Arguments passed without change to the `@wordpress/data` control.
|
||||
*/
|
||||
|
||||
function syncSelect() {
|
||||
function syncSelect(storeNameOrDescriptor, selectorName, ...args) {
|
||||
external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', {
|
||||
since: '5.7',
|
||||
alternative: 'built-in `select` control in `@wordpress/data`'
|
||||
});
|
||||
return external_wp_data_namespaceObject.controls.select(...arguments);
|
||||
return external_wp_data_namespaceObject.controls.select(storeNameOrDescriptor, selectorName, ...args);
|
||||
}
|
||||
/**
|
||||
* Control for dispatching an action in a registered data store.
|
||||
* Alias for the `dispatch` control in the `@wordpress/data` package.
|
||||
*
|
||||
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
|
||||
* @param storeNameOrDescriptor The store object or identifier.
|
||||
* @param actionName The action name.
|
||||
* @param args Arguments passed without change to the `@wordpress/data` control.
|
||||
*/
|
||||
|
||||
function dispatch() {
|
||||
function dispatch(storeNameOrDescriptor, actionName, ...args) {
|
||||
external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', {
|
||||
since: '5.7',
|
||||
alternative: 'built-in `dispatch` control in `@wordpress/data`'
|
||||
});
|
||||
return external_wp_data_namespaceObject.controls.dispatch(...arguments);
|
||||
return external_wp_data_namespaceObject.controls.dispatch(storeNameOrDescriptor, actionName, ...args);
|
||||
}
|
||||
/**
|
||||
* Dispatches a control action for awaiting on a promise to be resolved.
|
||||
@@ -197,17 +203,13 @@ const __unstableAwaitPromise = function (promise) {
|
||||
*/
|
||||
|
||||
const controls = {
|
||||
AWAIT_PROMISE: _ref => {
|
||||
let {
|
||||
promise
|
||||
} = _ref;
|
||||
return promise;
|
||||
},
|
||||
AWAIT_PROMISE: ({
|
||||
promise
|
||||
}) => promise,
|
||||
|
||||
API_FETCH(_ref2) {
|
||||
let {
|
||||
request
|
||||
} = _ref2;
|
||||
API_FETCH({
|
||||
request
|
||||
}) {
|
||||
return external_wp_apiFetch_default()(request);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var t={n:function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},d:function(n,e){for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{__unstableAwaitPromise:function(){return d},apiFetch:function(){return u},controls:function(){return p},dispatch:function(){return a},select:function(){return s},syncSelect:function(){return l}});var e=window.wp.apiFetch,r=t.n(e),o=window.wp.data,i=window.wp.deprecated,c=t.n(i);function u(t){return{type:"API_FETCH",request:t}}function s(){return c()("`select` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `resolveSelect` control in `@wordpress/data`"}),o.controls.resolveSelect(...arguments)}function l(){return c()("`syncSelect` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `select` control in `@wordpress/data`"}),o.controls.select(...arguments)}function a(){return c()("`dispatch` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `dispatch` control in `@wordpress/data`"}),o.controls.dispatch(...arguments)}const d=function(t){return{type:"AWAIT_PROMISE",promise:t}},p={AWAIT_PROMISE:t=>{let{promise:n}=t;return n},API_FETCH(t){let{request:n}=t;return r()(n)}};(window.wp=window.wp||{}).dataControls=n}();
|
||||
!function(){"use strict";var t={n:function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},d:function(n,e){for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{__unstableAwaitPromise:function(){return d},apiFetch:function(){return u},controls:function(){return p},dispatch:function(){return l},select:function(){return s},syncSelect:function(){return a}});var e=window.wp.apiFetch,r=t.n(e),o=window.wp.data,i=window.wp.deprecated,c=t.n(i);function u(t){return{type:"API_FETCH",request:t}}function s(t,n,...e){return c()("`select` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `resolveSelect` control in `@wordpress/data`"}),o.controls.resolveSelect(t,n,...e)}function a(t,n,...e){return c()("`syncSelect` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `select` control in `@wordpress/data`"}),o.controls.select(t,n,...e)}function l(t,n,...e){return c()("`dispatch` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `dispatch` control in `@wordpress/data`"}),o.controls.dispatch(t,n,...e)}const d=function(t){return{type:"AWAIT_PROMISE",promise:t}},p={AWAIT_PROMISE:({promise:t})=>t,API_FETCH({request:t}){return r()(t)}};(window.wp=window.wp||{}).dataControls=n}();
|
||||
Vendored
+581
-478
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+25
-19
File diff suppressed because one or more lines are too long
Vendored
+4
-4
File diff suppressed because one or more lines are too long
Vendored
+1
-2
@@ -74,8 +74,7 @@ const logged = Object.create(null);
|
||||
* ```
|
||||
*/
|
||||
|
||||
function deprecated(feature) {
|
||||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
function deprecated(feature, options = {}) {
|
||||
const {
|
||||
since,
|
||||
version,
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}},n={};e.d(n,{default:function(){return i}});var t=window.wp.hooks;const o=Object.create(null);function i(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{since:i,version:r,alternative:c,plugin:d,link:a,hint:l}=n,s=d?` from ${d}`:"",u=i?` since version ${i}`:"",$=r?` and will be removed${s} in version ${r}`:"",w=c?` Please use ${c} instead.`:"",p=a?` See: ${a}`:"",f=l?` Note: ${l}`:"",v=`${e} is deprecated${u}${$}.${w}${p}${f}`;v in o||((0,t.doAction)("deprecated",e,n,v),console.warn(v),o[v]=!0)}(window.wp=window.wp||{}).deprecated=n.default}();
|
||||
!function(){"use strict";var e={d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}},n={};e.d(n,{default:function(){return i}});var t=window.wp.hooks;const o=Object.create(null);function i(e,n={}){const{since:i,version:r,alternative:c,plugin:a,link:d,hint:s}=n,l=`${e} is deprecated${i?` since version ${i}`:""}${r?` and will be removed${a?` from ${a}`:""} in version ${r}`:""}.${c?` Please use ${c} instead.`:""}${d?` See: ${d}`:""}${s?` Note: ${s}`:""}`;l in o||((0,t.doAction)("deprecated",e,n,l),console.warn(l),o[l]=!0)}(window.wp=window.wp||{}).deprecated=n.default}();
|
||||
Vendored
+58
-60
@@ -176,7 +176,7 @@ function isValidFocusableArea(element) {
|
||||
* Returns all focusable elements within a given context.
|
||||
*
|
||||
* @param {Element} context Element in which to search.
|
||||
* @param {Object} [options]
|
||||
* @param {Object} options
|
||||
* @param {boolean} [options.sequential] If set, only return elements that are
|
||||
* sequentially focusable.
|
||||
* Non-interactive elements with a
|
||||
@@ -184,15 +184,13 @@ function isValidFocusableArea(element) {
|
||||
* not sequentially focusable.
|
||||
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
||||
*
|
||||
* @return {Element[]} Focusable elements.
|
||||
* @return {HTMLElement[]} Focusable elements.
|
||||
*/
|
||||
|
||||
|
||||
function find(context) {
|
||||
let {
|
||||
sequential = false
|
||||
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
function find(context, {
|
||||
sequential = false
|
||||
} = {}) {
|
||||
/* eslint-disable jsdoc/no-undefined-types */
|
||||
|
||||
/** @type {NodeListOf<HTMLElement>} */
|
||||
@@ -441,12 +439,9 @@ function getRectangleFromRange(range) {
|
||||
} // Ignore tiny selection at the edge of a range.
|
||||
|
||||
|
||||
const filteredRects = rects.filter(_ref => {
|
||||
let {
|
||||
width
|
||||
} = _ref;
|
||||
return width > 1;
|
||||
}); // If it's full of tiny selections, return browser default.
|
||||
const filteredRects = rects.filter(({
|
||||
width
|
||||
}) => width > 1); // If it's full of tiny selections, return browser default.
|
||||
|
||||
if (filteredRects.length === 0) {
|
||||
return range.getBoundingClientRect();
|
||||
@@ -512,7 +507,7 @@ function getRectangleFromRange(range) {
|
||||
//
|
||||
// See: https://stackoverflow.com/a/6847328/995445
|
||||
|
||||
if (!rect) {
|
||||
if (!rect || rect.height === 0) {
|
||||
assertIsDefined(ownerDocument, 'ownerDocument');
|
||||
const padNode = ownerDocument.createTextNode('\u200b'); // Do not modify the live range.
|
||||
|
||||
@@ -586,7 +581,7 @@ function documentHasTextSelection(doc) {
|
||||
*/
|
||||
function isHTMLInputElement(node) {
|
||||
/* eslint-enable jsdoc/valid-types */
|
||||
return (node === null || node === void 0 ? void 0 : node.nodeName) === 'INPUT';
|
||||
return node?.nodeName === 'INPUT';
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-text-field.js
|
||||
@@ -730,27 +725,45 @@ function getComputedStyle(element) {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Given a DOM node, finds the closest scrollable container node.
|
||||
*
|
||||
* @param {Element | null} node Node from which to start.
|
||||
* Given a DOM node, finds the closest scrollable container node or the node
|
||||
* itself, if scrollable.
|
||||
*
|
||||
* @param {Element | null} node Node from which to start.
|
||||
* @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').
|
||||
* Defaults to 'vertical'.
|
||||
* @return {Element | undefined} Scrollable container node, if found.
|
||||
*/
|
||||
|
||||
function getScrollContainer(node) {
|
||||
function getScrollContainer(node, direction = 'vertical') {
|
||||
if (!node) {
|
||||
return undefined;
|
||||
} // Scrollable if scrollable height exceeds displayed...
|
||||
}
|
||||
|
||||
if (direction === 'vertical' || direction === 'all') {
|
||||
// Scrollable if scrollable height exceeds displayed...
|
||||
if (node.scrollHeight > node.clientHeight) {
|
||||
// ...except when overflow is defined to be hidden or visible
|
||||
const {
|
||||
overflowY
|
||||
} = getComputedStyle(node);
|
||||
|
||||
if (node.scrollHeight > node.clientHeight) {
|
||||
// ...except when overflow is defined to be hidden or visible
|
||||
const {
|
||||
overflowY
|
||||
} = getComputedStyle(node);
|
||||
if (/(auto|scroll)/.test(overflowY)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (/(auto|scroll)/.test(overflowY)) {
|
||||
return node;
|
||||
if (direction === 'horizontal' || direction === 'all') {
|
||||
// Scrollable if scrollable width exceeds displayed...
|
||||
if (node.scrollWidth > node.clientWidth) {
|
||||
// ...except when overflow is defined to be hidden or visible
|
||||
const {
|
||||
overflowX
|
||||
} = getComputedStyle(node);
|
||||
|
||||
if (/(auto|scroll)/.test(overflowX)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,7 +774,7 @@ function getScrollContainer(node) {
|
||||
|
||||
return getScrollContainer(
|
||||
/** @type {Element} */
|
||||
node.parentNode);
|
||||
node.parentNode, direction);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-offset-parent.js
|
||||
@@ -966,18 +979,12 @@ function getRangeHeight(range) {
|
||||
return;
|
||||
}
|
||||
|
||||
const highestTop = Math.min(...rects.map(_ref => {
|
||||
let {
|
||||
top
|
||||
} = _ref;
|
||||
return top;
|
||||
}));
|
||||
const lowestBottom = Math.max(...rects.map(_ref2 => {
|
||||
let {
|
||||
bottom
|
||||
} = _ref2;
|
||||
return bottom;
|
||||
}));
|
||||
const highestTop = Math.min(...rects.map(({
|
||||
top
|
||||
}) => top));
|
||||
const lowestBottom = Math.max(...rects.map(({
|
||||
bottom
|
||||
}) => bottom));
|
||||
return lowestBottom - highestTop;
|
||||
}
|
||||
|
||||
@@ -1132,9 +1139,7 @@ function hiddenCaretRangeFromPoint(doc, x, y, container) {
|
||||
* @return {boolean} True if at the edge, false if not.
|
||||
*/
|
||||
|
||||
function isEdge(container, isReverse) {
|
||||
let onlyVertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
|
||||
function isEdge(container, isReverse, onlyVertical = false) {
|
||||
if (isInputOrTextArea(container) && typeof container.selectionStart === 'number') {
|
||||
if (container.selectionStart !== container.selectionEnd) {
|
||||
return false;
|
||||
@@ -1431,7 +1436,7 @@ function placeCaretAtHorizontalEdge(container, isReverse) {
|
||||
*/
|
||||
|
||||
function placeCaretAtVerticalEdge(container, isReverse, rect) {
|
||||
return placeCaretAtEdge(container, isReverse, rect === null || rect === void 0 ? void 0 : rect.left);
|
||||
return placeCaretAtEdge(container, isReverse, rect?.left);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/insert-after.js
|
||||
@@ -1907,12 +1912,10 @@ function cleanNodeList(nodeList, doc, schema, inline) {
|
||||
Array.from(nodeList).forEach((
|
||||
/** @type {Node & { nextElementSibling?: unknown }} */
|
||||
node) => {
|
||||
var _schema$tag$isMatch, _schema$tag;
|
||||
|
||||
const tag = node.nodeName.toLowerCase(); // It's a valid child, if the tag exists in the schema without an isMatch
|
||||
// function, or with an isMatch function that matches the node.
|
||||
|
||||
if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || (_schema$tag$isMatch = (_schema$tag = schema[tag]).isMatch) !== null && _schema$tag$isMatch !== void 0 && _schema$tag$isMatch.call(_schema$tag, node))) {
|
||||
if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || schema[tag].isMatch?.(node))) {
|
||||
if (isElement(node)) {
|
||||
const {
|
||||
attributes = [],
|
||||
@@ -1930,11 +1933,9 @@ function cleanNodeList(nodeList, doc, schema, inline) {
|
||||
|
||||
if (node.hasAttributes()) {
|
||||
// Strip invalid attributes.
|
||||
Array.from(node.attributes).forEach(_ref => {
|
||||
let {
|
||||
name
|
||||
} = _ref;
|
||||
|
||||
Array.from(node.attributes).forEach(({
|
||||
name
|
||||
}) => {
|
||||
if (name !== 'class' && !attributes.includes(name)) {
|
||||
node.removeAttribute(name);
|
||||
}
|
||||
@@ -2077,14 +2078,11 @@ function getFilesFromDataTransfer(dataTransfer) {
|
||||
Array.from(dataTransfer.items).forEach(item => {
|
||||
const file = item.getAsFile();
|
||||
|
||||
if (file && !files.find(_ref => {
|
||||
let {
|
||||
name,
|
||||
type,
|
||||
size
|
||||
} = _ref;
|
||||
return name === file.name && type === file.type && size === file.size;
|
||||
})) {
|
||||
if (file && !files.find(({
|
||||
name,
|
||||
type,
|
||||
size
|
||||
}) => name === file.name && type === file.type && size === file.size)) {
|
||||
files.push(file);
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+2231
-2291
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+16500
-10596
File diff suppressed because it is too large
Load Diff
+9
-2
File diff suppressed because one or more lines are too long
+681
-641
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1376
-1469
File diff suppressed because it is too large
Load Diff
Vendored
+1
-8
File diff suppressed because one or more lines are too long
Vendored
+403
-272
@@ -231,9 +231,9 @@ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextSt
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {string} interpolatedString The interpolation string to be parsed.
|
||||
* @param {Object} conversionMap The map used to convert the string to
|
||||
* a react element.
|
||||
* @param {string} interpolatedString The interpolation string to be parsed.
|
||||
* @param {Record<string, WPElement>} conversionMap The map used to convert the string to
|
||||
* a react element.
|
||||
* @throws {TypeError}
|
||||
* @return {WPElement} A wp element.
|
||||
*/
|
||||
@@ -493,6 +493,13 @@ function closeOuterElement(endOffset) {
|
||||
* @typedef {import('react').SyntheticEvent} WPSyntheticEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object containing a React synthetic event.
|
||||
*
|
||||
* @template T
|
||||
* @typedef {import('react').RefObject<T>} RefObject<T>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object that provides utilities for dealing with React children.
|
||||
*/
|
||||
@@ -680,11 +687,7 @@ function closeOuterElement(endOffset) {
|
||||
* @return {Array} The concatenated value.
|
||||
*/
|
||||
|
||||
function concatChildren() {
|
||||
for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
childrenArguments[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
function concatChildren(...childrenArguments) {
|
||||
return childrenArguments.reduce((accumulator, children, i) => {
|
||||
external_React_namespaceObject.Children.forEach(children, (child, j) => {
|
||||
if (child && 'string' !== typeof child) {
|
||||
@@ -709,7 +712,7 @@ function concatChildren() {
|
||||
|
||||
function switchChildrenNodeName(children, nodeName) {
|
||||
return children && external_React_namespaceObject.Children.map(children, (elt, index) => {
|
||||
if (typeof (elt === null || elt === void 0 ? void 0 : elt.valueOf()) === 'string') {
|
||||
if (typeof elt?.valueOf() === 'string') {
|
||||
return (0,external_React_namespaceObject.createElement)(nodeName, {
|
||||
key: index
|
||||
}, elt);
|
||||
@@ -764,37 +767,40 @@ var client = __webpack_require__(4470);
|
||||
/**
|
||||
* Renders a given element into the target DOM node.
|
||||
*
|
||||
* @param {import('./react').WPElement} element Element to render.
|
||||
* @param {HTMLElement} target DOM node into which element should be rendered.
|
||||
* @deprecated since WordPress 6.2.0. Use `createRoot` instead.
|
||||
* @see https://react.dev/reference/react-dom/render
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Hydrates a given element into the target DOM node.
|
||||
*
|
||||
* @param {import('./react').WPElement} element Element to hydrate.
|
||||
* @param {HTMLElement} target DOM node into which element should be hydrated.
|
||||
* @deprecated since WordPress 6.2.0. Use `hydrateRoot` instead.
|
||||
* @see https://react.dev/reference/react-dom/hydrate
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new React root for the target DOM node.
|
||||
*
|
||||
* @see https://reactjs.org/docs/react-dom-client.html#createroot
|
||||
* @since 6.2.0 Introduced in WordPress core.
|
||||
* @see https://react.dev/reference/react-dom/client/createRoot
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new React root for the target DOM node and hydrates it with a pre-generated markup.
|
||||
*
|
||||
* @see https://reactjs.org/docs/react-dom-client.html#hydrateroot
|
||||
* @since 6.2.0 Introduced in WordPress core.
|
||||
* @see https://react.dev/reference/react-dom/client/hydrateRoot
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Removes any mounted element from the target DOM node.
|
||||
*
|
||||
* @param {Element} target DOM node in which element is to be removed
|
||||
* @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.
|
||||
* @see https://react.dev/reference/react-dom/unmountComponentAtNode
|
||||
*/
|
||||
|
||||
|
||||
@@ -811,7 +817,7 @@ const isEmptyElement = element => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof (element === null || element === void 0 ? void 0 : element.valueOf()) === 'string' || Array.isArray(element)) {
|
||||
if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
|
||||
return !element.length;
|
||||
}
|
||||
|
||||
@@ -854,7 +860,7 @@ const Platform = {
|
||||
|
||||
/* harmony default export */ var platform = (Platform);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/element/node_modules/is-plain-object/dist/is-plain-object.mjs
|
||||
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
@@ -890,246 +896,377 @@ function isPlainObject(o) {
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
|
||||
/*! *****************************************************************************
|
||||
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 */
|
||||
|
||||
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 __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 (_) 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;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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: n === "return" } : 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;
|
||||
}
|
||||
;// 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") 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 */ var 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
|
||||
/**
|
||||
@@ -1250,11 +1387,10 @@ var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
|
||||
* @return {JSX.Element} Dangerously-rendering component.
|
||||
*/
|
||||
|
||||
function RawHTML(_ref) {
|
||||
let {
|
||||
children,
|
||||
...props
|
||||
} = _ref;
|
||||
function RawHTML({
|
||||
children,
|
||||
...props
|
||||
}) {
|
||||
let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string.
|
||||
|
||||
external_React_namespaceObject.Children.toArray(children).forEach(child => {
|
||||
@@ -1557,9 +1693,7 @@ function getNormalStylePropertyValue(property, value) {
|
||||
*/
|
||||
|
||||
|
||||
function renderElement(element, context) {
|
||||
let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
function renderElement(element, context, legacyContext = {}) {
|
||||
if (null === element || undefined === element || false === element) {
|
||||
return '';
|
||||
}
|
||||
@@ -1637,8 +1771,7 @@ function renderElement(element, context) {
|
||||
* @return {string} Serialized element.
|
||||
*/
|
||||
|
||||
function renderNativeComponent(type, props, context) {
|
||||
let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
function renderNativeComponent(type, props, context, legacyContext = {}) {
|
||||
let content = '';
|
||||
|
||||
if (type === 'textarea' && props.hasOwnProperty('value')) {
|
||||
@@ -1683,8 +1816,7 @@ function renderNativeComponent(type, props, context) {
|
||||
* @return {string} Serialized element
|
||||
*/
|
||||
|
||||
function renderComponent(Component, props, context) {
|
||||
let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
function renderComponent(Component, props, context, legacyContext = {}) {
|
||||
const instance = new
|
||||
/** @type {import('react').ComponentClass} */
|
||||
Component(props, legacyContext);
|
||||
@@ -1712,8 +1844,7 @@ function renderComponent(Component, props, context) {
|
||||
* @return {string} Serialized children.
|
||||
*/
|
||||
|
||||
function renderChildren(children, context) {
|
||||
let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
function renderChildren(children, context, legacyContext = {}) {
|
||||
let result = '';
|
||||
children = Array.isArray(children) ? children : [children];
|
||||
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+306
-232
@@ -65,14 +65,12 @@ const bold = {
|
||||
tagName: 'strong',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onToggle() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: bold_name,
|
||||
@@ -148,14 +146,17 @@ const code_code = {
|
||||
start,
|
||||
text
|
||||
} = value;
|
||||
const characterBefore = text.slice(start - 1, start); // Quick check the text for the necessary character.
|
||||
const characterBefore = text[start - 1]; // Quick check the text for the necessary character.
|
||||
|
||||
if (characterBefore !== BACKTICK) {
|
||||
return value;
|
||||
}
|
||||
|
||||
const textBefore = text.slice(0, start - 1);
|
||||
const indexBefore = textBefore.lastIndexOf(BACKTICK);
|
||||
if (start - 2 < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
const indexBefore = text.lastIndexOf(BACKTICK, start - 2);
|
||||
|
||||
if (indexBefore === -1) {
|
||||
return value;
|
||||
@@ -176,14 +177,12 @@ const code_code = {
|
||||
return value;
|
||||
},
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
isActive
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
isActive
|
||||
}) {
|
||||
function onClick() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: code_name,
|
||||
@@ -257,20 +256,18 @@ const image_image = {
|
||||
edit: Edit
|
||||
};
|
||||
|
||||
function InlineUI(_ref) {
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
activeObjectAttributes,
|
||||
contentRef
|
||||
} = _ref;
|
||||
function InlineUI({
|
||||
value,
|
||||
onChange,
|
||||
activeObjectAttributes,
|
||||
contentRef
|
||||
}) {
|
||||
const {
|
||||
style
|
||||
} = activeObjectAttributes;
|
||||
const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(style === null || style === void 0 ? void 0 : style.replace(/\D/g, ''));
|
||||
const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(style?.replace(/\D/g, ''));
|
||||
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
|
||||
editableContentElement: contentRef.current,
|
||||
value,
|
||||
settings: image_image
|
||||
});
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
|
||||
@@ -293,29 +290,31 @@ function InlineUI(_ref) {
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
alignment: "bottom",
|
||||
spacing: "0"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
|
||||
className: "block-editor-format-toolbar__image-container-value",
|
||||
type: "number",
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
|
||||
value: width,
|
||||
min: 1,
|
||||
onChange: newWidth => setWidth(newWidth)
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
className: "block-editor-format-toolbar__image-container-button",
|
||||
icon: keyboard_return,
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Apply'),
|
||||
type: "submit"
|
||||
})));
|
||||
}))));
|
||||
}
|
||||
|
||||
function Edit(_ref2) {
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
isObjectActive,
|
||||
activeObjectAttributes,
|
||||
contentRef
|
||||
} = _ref2;
|
||||
function Edit({
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
isObjectActive,
|
||||
activeObjectAttributes,
|
||||
contentRef
|
||||
}) {
|
||||
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
|
||||
function openModal() {
|
||||
@@ -338,13 +337,12 @@ function Edit(_ref2) {
|
||||
isActive: isObjectActive
|
||||
}), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
|
||||
allowedTypes: ALLOWED_MEDIA_TYPES,
|
||||
onSelect: _ref3 => {
|
||||
let {
|
||||
id,
|
||||
url,
|
||||
alt,
|
||||
width: imgWidth
|
||||
} = _ref3;
|
||||
onSelect: ({
|
||||
id,
|
||||
url,
|
||||
alt,
|
||||
width: imgWidth
|
||||
}) => {
|
||||
closeModal();
|
||||
onChange((0,external_wp_richText_namespaceObject.insertObject)(value, {
|
||||
type: image_name,
|
||||
@@ -358,10 +356,9 @@ function Edit(_ref2) {
|
||||
onFocus();
|
||||
},
|
||||
onClose: closeModal,
|
||||
render: _ref4 => {
|
||||
let {
|
||||
open
|
||||
} = _ref4;
|
||||
render: ({
|
||||
open
|
||||
}) => {
|
||||
open();
|
||||
return null;
|
||||
}
|
||||
@@ -408,14 +405,12 @@ const italic = {
|
||||
tagName: 'em',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onToggle() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: italic_name,
|
||||
@@ -465,7 +460,7 @@ const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_w
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
|
||||
d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"
|
||||
}));
|
||||
/* harmony default export */ var link_off = (linkOff);
|
||||
|
||||
@@ -480,7 +475,7 @@ const link_link = (0,external_wp_element_namespaceObject.createElement)(external
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
|
||||
d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
|
||||
}));
|
||||
/* harmony default export */ var library_link = (link_link);
|
||||
|
||||
@@ -570,13 +565,12 @@ function isValidHref(href) {
|
||||
* @return {Object} The final format object.
|
||||
*/
|
||||
|
||||
function createLinkFormat(_ref) {
|
||||
let {
|
||||
url,
|
||||
type,
|
||||
id,
|
||||
opensInNewWindow
|
||||
} = _ref;
|
||||
function createLinkFormat({
|
||||
url,
|
||||
type,
|
||||
id,
|
||||
opensInNewWindow
|
||||
}) {
|
||||
const format = {
|
||||
type: 'core/link',
|
||||
attributes: {
|
||||
@@ -608,11 +602,7 @@ function createLinkFormat(_ref) {
|
||||
|
||||
/* eslint-enable jsdoc/no-undefined-types */
|
||||
|
||||
function getFormatBoundary(value, format) {
|
||||
var _newFormats$startInde, _newFormats$endIndex, _newFormats;
|
||||
|
||||
let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
|
||||
let endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
|
||||
function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) {
|
||||
const EMPTY_BOUNDARIES = {
|
||||
start: null,
|
||||
end: null
|
||||
@@ -623,30 +613,21 @@ function getFormatBoundary(value, format) {
|
||||
let targetFormat;
|
||||
let initialIndex;
|
||||
|
||||
if (!(formats !== null && formats !== void 0 && formats.length)) {
|
||||
if (!formats?.length) {
|
||||
return EMPTY_BOUNDARIES;
|
||||
} // Clone formats to avoid modifying source formats.
|
||||
|
||||
|
||||
const newFormats = formats.slice();
|
||||
const formatAtStart = (_newFormats$startInde = newFormats[startIndex]) === null || _newFormats$startInde === void 0 ? void 0 : _newFormats$startInde.find(_ref2 => {
|
||||
let {
|
||||
type
|
||||
} = _ref2;
|
||||
return type === format.type;
|
||||
});
|
||||
const formatAtEnd = (_newFormats$endIndex = newFormats[endIndex]) === null || _newFormats$endIndex === void 0 ? void 0 : _newFormats$endIndex.find(_ref3 => {
|
||||
let {
|
||||
type
|
||||
} = _ref3;
|
||||
return type === format.type;
|
||||
});
|
||||
const formatAtEndMinusOne = (_newFormats = newFormats[endIndex - 1]) === null || _newFormats === void 0 ? void 0 : _newFormats.find(_ref4 => {
|
||||
let {
|
||||
type
|
||||
} = _ref4;
|
||||
return type === format.type;
|
||||
});
|
||||
const formatAtStart = newFormats[startIndex]?.find(({
|
||||
type
|
||||
}) => type === format.type);
|
||||
const formatAtEnd = newFormats[endIndex]?.find(({
|
||||
type
|
||||
}) => type === format.type);
|
||||
const formatAtEndMinusOne = newFormats[endIndex - 1]?.find(({
|
||||
type
|
||||
}) => type === format.type);
|
||||
|
||||
if (!!formatAtStart) {
|
||||
// Set values to conform to "start"
|
||||
@@ -713,19 +694,7 @@ function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, dir
|
||||
return index;
|
||||
}
|
||||
|
||||
const partialRight = function (fn) {
|
||||
for (var _len = arguments.length, partialArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
partialArgs[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return function () {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return fn(...args, ...partialArgs);
|
||||
};
|
||||
};
|
||||
const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
|
||||
|
||||
const walkToStart = partialRight(walkToBoundary, 'backwards');
|
||||
const walkToEnd = partialRight(walkToBoundary, 'forwards');
|
||||
@@ -785,17 +754,16 @@ function useLinkInstanceKey(instance) {
|
||||
|
||||
|
||||
|
||||
function InlineLinkUI(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
activeAttributes,
|
||||
addingLink,
|
||||
value,
|
||||
onChange,
|
||||
speak,
|
||||
stopAddingLink,
|
||||
contentRef
|
||||
} = _ref;
|
||||
function InlineLinkUI({
|
||||
isActive,
|
||||
activeAttributes,
|
||||
addingLink,
|
||||
value,
|
||||
onChange,
|
||||
speak,
|
||||
stopAddingLink,
|
||||
contentRef
|
||||
}) {
|
||||
const richLinkTextValue = getRichTextValueFromSelection(value, isActive); // Get the text content minus any HTML tags.
|
||||
|
||||
const richTextText = richLinkTextValue.text;
|
||||
@@ -939,7 +907,6 @@ function InlineLinkUI(_ref) {
|
||||
|
||||
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
|
||||
editableContentElement: contentRef.current,
|
||||
value,
|
||||
settings: build_module_link_link
|
||||
}); // Generate a string based key that is unique to this anchor reference.
|
||||
// This is used to force re-mount the LinkControl component to avoid
|
||||
@@ -968,7 +935,7 @@ function InlineLinkUI(_ref) {
|
||||
function createButtonText(searchTerm) {
|
||||
return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||
/* translators: %s: search term. */
|
||||
(0,external_wp_i18n_namespaceObject.__)('Create Page: <mark>%s</mark>'), searchTerm), {
|
||||
(0,external_wp_i18n_namespaceObject.__)('Create page: <mark>%s</mark>'), searchTerm), {
|
||||
mark: (0,external_wp_element_namespaceObject.createElement)("mark", null)
|
||||
});
|
||||
}
|
||||
@@ -977,6 +944,7 @@ function InlineLinkUI(_ref) {
|
||||
anchor: popoverAnchor,
|
||||
focusOnMount: focusOnMount.current,
|
||||
onClose: stopAddingLink,
|
||||
onFocusOutside: () => stopAddingLink(false),
|
||||
placement: "bottom",
|
||||
shift: true
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
|
||||
@@ -1040,15 +1008,14 @@ const link_name = 'core/link';
|
||||
|
||||
const link_title = (0,external_wp_i18n_namespaceObject.__)('Link');
|
||||
|
||||
function link_Edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
activeAttributes,
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
contentRef
|
||||
} = _ref;
|
||||
function link_Edit({
|
||||
isActive,
|
||||
activeAttributes,
|
||||
value,
|
||||
onChange,
|
||||
onFocus,
|
||||
contentRef
|
||||
}) {
|
||||
const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
|
||||
function addLink() {
|
||||
@@ -1073,9 +1040,12 @@ function link_Edit(_ref) {
|
||||
}
|
||||
}
|
||||
|
||||
function stopAddingLink() {
|
||||
function stopAddingLink(returnFocus = true) {
|
||||
setAddingLink(false);
|
||||
onFocus();
|
||||
|
||||
if (returnFocus) {
|
||||
onFocus();
|
||||
}
|
||||
}
|
||||
|
||||
function onRemoveFormat() {
|
||||
@@ -1130,12 +1100,10 @@ const build_module_link_link = {
|
||||
target: 'target'
|
||||
},
|
||||
|
||||
__unstablePasteRule(value, _ref2) {
|
||||
let {
|
||||
html,
|
||||
plainText
|
||||
} = _ref2;
|
||||
|
||||
__unstablePasteRule(value, {
|
||||
html,
|
||||
plainText
|
||||
}) {
|
||||
if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
|
||||
return value;
|
||||
}
|
||||
@@ -1194,14 +1162,12 @@ const strikethrough = {
|
||||
tagName: 's',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onClick() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: strikethrough_name,
|
||||
@@ -1247,12 +1213,10 @@ const underline = {
|
||||
style: 'style'
|
||||
},
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
value,
|
||||
onChange
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
value,
|
||||
onChange
|
||||
}) {
|
||||
const onToggle = () => {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: underline_name,
|
||||
@@ -1292,12 +1256,11 @@ const underline = {
|
||||
* @return {JSX.Element} Icon component
|
||||
*/
|
||||
|
||||
function Icon(_ref) {
|
||||
let {
|
||||
icon,
|
||||
size = 24,
|
||||
...props
|
||||
} = _ref;
|
||||
function Icon({
|
||||
icon,
|
||||
size = 24,
|
||||
...props
|
||||
}) {
|
||||
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
|
||||
width: size,
|
||||
height: size,
|
||||
@@ -1355,8 +1318,7 @@ const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_
|
||||
|
||||
|
||||
|
||||
function parseCSS() {
|
||||
let css = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
function parseCSS(css = '') {
|
||||
return css.split(';').reduce((accumulator, rule) => {
|
||||
if (rule) {
|
||||
const [property, value] = rule.split(':');
|
||||
@@ -1368,9 +1330,7 @@ function parseCSS() {
|
||||
}, {});
|
||||
}
|
||||
|
||||
function parseClassName() {
|
||||
let className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
let colorSettings = arguments.length > 1 ? arguments[1] : undefined;
|
||||
function parseClassName(className = '', colorSettings) {
|
||||
return className.split(' ').reduce((accumulator, name) => {
|
||||
// `colorSlug` could contain dashes, so simply match the start and end.
|
||||
if (name.startsWith('has-') && name.endsWith('-color')) {
|
||||
@@ -1435,13 +1395,12 @@ function setColors(value, name, colorSettings, colors) {
|
||||
});
|
||||
}
|
||||
|
||||
function ColorPicker(_ref) {
|
||||
let {
|
||||
name,
|
||||
property,
|
||||
value,
|
||||
onChange
|
||||
} = _ref;
|
||||
function ColorPicker({
|
||||
name,
|
||||
property,
|
||||
value,
|
||||
onChange
|
||||
}) {
|
||||
const colors = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
var _getSettings$colors;
|
||||
|
||||
@@ -1462,15 +1421,13 @@ function ColorPicker(_ref) {
|
||||
});
|
||||
}
|
||||
|
||||
function InlineColorUI(_ref2) {
|
||||
let {
|
||||
name,
|
||||
value,
|
||||
onChange,
|
||||
onClose,
|
||||
contentRef
|
||||
} = _ref2;
|
||||
|
||||
function InlineColorUI({
|
||||
name,
|
||||
value,
|
||||
onChange,
|
||||
onClose,
|
||||
contentRef
|
||||
}) {
|
||||
/*
|
||||
As you change the text color by typing a HEX value into a field,
|
||||
the return value of document.getSelection jumps to the field you're editing,
|
||||
@@ -1480,7 +1437,6 @@ function InlineColorUI(_ref2) {
|
||||
*/
|
||||
const popoverAnchor = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)((0,external_wp_richText_namespaceObject.useAnchor)({
|
||||
editableContentElement: contentRef.current,
|
||||
value,
|
||||
settings: text_color_textColor
|
||||
}));
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
|
||||
@@ -1543,12 +1499,10 @@ function getComputedStyleProperty(element, property) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function fillComputedColors(element, _ref) {
|
||||
let {
|
||||
color,
|
||||
backgroundColor
|
||||
} = _ref;
|
||||
|
||||
function fillComputedColors(element, {
|
||||
color,
|
||||
backgroundColor
|
||||
}) {
|
||||
if (!color && !backgroundColor) {
|
||||
return;
|
||||
}
|
||||
@@ -1559,14 +1513,13 @@ function fillComputedColors(element, _ref) {
|
||||
};
|
||||
}
|
||||
|
||||
function TextColorEdit(_ref2) {
|
||||
let {
|
||||
value,
|
||||
onChange,
|
||||
isActive,
|
||||
activeAttributes,
|
||||
contentRef
|
||||
} = _ref2;
|
||||
function TextColorEdit({
|
||||
value,
|
||||
onChange,
|
||||
isActive,
|
||||
activeAttributes,
|
||||
contentRef
|
||||
}) {
|
||||
const allowCustomControl = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.custom');
|
||||
const colors = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.palette') || EMPTY_ARRAY;
|
||||
const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
@@ -1667,14 +1620,12 @@ const subscript_subscript = {
|
||||
tagName: 'sub',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onToggle() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: subscript_name,
|
||||
@@ -1733,14 +1684,12 @@ const superscript_superscript = {
|
||||
tagName: 'sup',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onToggle() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: superscript_name,
|
||||
@@ -1775,7 +1724,7 @@ const button_button = (0,external_wp_element_namespaceObject.createElement)(exte
|
||||
viewBox: "0 0 24 24",
|
||||
xmlns: "http://www.w3.org/2000/svg"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"
|
||||
d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"
|
||||
}));
|
||||
/* harmony default export */ var library_button = (button_button);
|
||||
|
||||
@@ -1799,14 +1748,12 @@ const keyboard = {
|
||||
tagName: 'kbd',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onToggle() {
|
||||
onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
|
||||
type: keyboard_name,
|
||||
@@ -1865,14 +1812,12 @@ const unknown = {
|
||||
tagName: '*',
|
||||
className: null,
|
||||
|
||||
edit(_ref) {
|
||||
let {
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
} = _ref;
|
||||
|
||||
edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
onFocus
|
||||
}) {
|
||||
function onClick() {
|
||||
onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, unknown_name));
|
||||
onFocus();
|
||||
@@ -1898,6 +1843,137 @@ const unknown = {
|
||||
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/language.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const language = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
||||
d: "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"
|
||||
}));
|
||||
/* harmony default export */ var library_language = (language);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/language/index.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const language_name = 'core/language';
|
||||
|
||||
const language_title = (0,external_wp_i18n_namespaceObject.__)('Language');
|
||||
|
||||
const language_language = {
|
||||
name: language_name,
|
||||
tagName: 'bdo',
|
||||
className: null,
|
||||
edit: language_Edit,
|
||||
title: language_title
|
||||
};
|
||||
|
||||
function language_Edit({
|
||||
isActive,
|
||||
value,
|
||||
onChange,
|
||||
contentRef
|
||||
}) {
|
||||
const [isPopoverVisible, setIsPopoverVisible] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
|
||||
const togglePopover = () => {
|
||||
setIsPopoverVisible(state => !state);
|
||||
};
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
|
||||
icon: library_language,
|
||||
label: language_title,
|
||||
title: language_title,
|
||||
onClick: () => {
|
||||
if (isActive) {
|
||||
onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, language_name));
|
||||
} else {
|
||||
togglePopover();
|
||||
}
|
||||
},
|
||||
isActive: isActive,
|
||||
role: "menuitemcheckbox"
|
||||
}), isPopoverVisible && (0,external_wp_element_namespaceObject.createElement)(InlineLanguageUI, {
|
||||
value: value,
|
||||
onChange: onChange,
|
||||
onClose: togglePopover,
|
||||
contentRef: contentRef
|
||||
}));
|
||||
}
|
||||
|
||||
function InlineLanguageUI({
|
||||
value,
|
||||
contentRef,
|
||||
onChange,
|
||||
onClose
|
||||
}) {
|
||||
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
|
||||
editableContentElement: contentRef.current,
|
||||
settings: language_language
|
||||
});
|
||||
const [lang, setLang] = (0,external_wp_element_namespaceObject.useState)('');
|
||||
const [dir, setDir] = (0,external_wp_element_namespaceObject.useState)('ltr');
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
|
||||
className: "block-editor-format-toolbar__language-popover",
|
||||
anchor: popoverAnchor,
|
||||
placement: "bottom",
|
||||
onClose: onClose
|
||||
}, (0,external_wp_element_namespaceObject.createElement)("form", {
|
||||
className: "block-editor-format-toolbar__language-container-content",
|
||||
onSubmit: event => {
|
||||
event.preventDefault();
|
||||
onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
|
||||
type: language_name,
|
||||
attributes: {
|
||||
lang,
|
||||
dir
|
||||
}
|
||||
}));
|
||||
onClose();
|
||||
}
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
|
||||
label: language_title,
|
||||
value: lang,
|
||||
onChange: val => setLang(val),
|
||||
help: (0,external_wp_i18n_namespaceObject.__)('A valid language attribute, like "en" or "fr".')
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Text direction'),
|
||||
value: dir,
|
||||
options: [{
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Left to right'),
|
||||
value: 'ltr'
|
||||
}, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Right to left'),
|
||||
value: 'rtl'
|
||||
}],
|
||||
onChange: val => setDir(val)
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
alignment: "right"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "primary",
|
||||
type: "submit",
|
||||
text: (0,external_wp_i18n_namespaceObject.__)('Apply')
|
||||
}))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
@@ -1914,7 +1990,8 @@ const unknown = {
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ var default_formats = ([bold, code_code, image_image, italic, build_module_link_link, strikethrough, underline, text_color_textColor, subscript_subscript, superscript_superscript, keyboard, unknown]);
|
||||
|
||||
/* harmony default export */ var default_formats = ([bold, code_code, image_image, italic, build_module_link_link, strikethrough, underline, text_color_textColor, subscript_subscript, superscript_superscript, keyboard, unknown, language_language]);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js
|
||||
/**
|
||||
@@ -1926,13 +2003,10 @@ const unknown = {
|
||||
*/
|
||||
|
||||
|
||||
default_formats.forEach(_ref => {
|
||||
let {
|
||||
name,
|
||||
...settings
|
||||
} = _ref;
|
||||
return (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings);
|
||||
});
|
||||
default_formats.forEach(({
|
||||
name,
|
||||
...settings
|
||||
}) => (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings));
|
||||
|
||||
(window.wp = window.wp || {}).formatLibrary = __webpack_exports__;
|
||||
/******/ })()
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+6
-13
@@ -149,8 +149,7 @@ function validateHookName(hookName) {
|
||||
*/
|
||||
|
||||
function createAddHook(hooks, storeKey) {
|
||||
return function addHook(hookName, namespace, callback) {
|
||||
let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
|
||||
return function addHook(hookName, namespace, callback, priority = 10) {
|
||||
const hooksStore = hooks[storeKey];
|
||||
|
||||
if (!build_module_validateHookName(hookName)) {
|
||||
@@ -257,8 +256,7 @@ function createAddHook(hooks, storeKey) {
|
||||
* @return {RemoveHook} Function that removes hooks.
|
||||
*/
|
||||
|
||||
function createRemoveHook(hooks, storeKey) {
|
||||
let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
function createRemoveHook(hooks, storeKey, removeAll = false) {
|
||||
return function removeHook(hookName, namespace) {
|
||||
const hooksStore = hooks[storeKey];
|
||||
|
||||
@@ -365,9 +363,8 @@ function createHasHook(hooks, storeKey) {
|
||||
*
|
||||
* @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.
|
||||
*/
|
||||
function createRunHook(hooks, storeKey) {
|
||||
let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
return function runHooks(hookName) {
|
||||
function createRunHook(hooks, storeKey, returnFirstArg = false) {
|
||||
return function runHooks(hookName, ...args) {
|
||||
const hooksStore = hooks[storeKey];
|
||||
|
||||
if (!hooksStore[hookName]) {
|
||||
@@ -382,10 +379,6 @@ function createRunHook(hooks, storeKey) {
|
||||
|
||||
if (false) {}
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (!handlers || !handlers.length) {
|
||||
return returnFirstArg ? args[0] : undefined;
|
||||
}
|
||||
@@ -431,10 +424,10 @@ function createRunHook(hooks, storeKey) {
|
||||
*/
|
||||
function createCurrentHook(hooks, storeKey) {
|
||||
return function currentHook() {
|
||||
var _hooksStore$__current, _hooksStore$__current2;
|
||||
var _hooksStore$__current;
|
||||
|
||||
const hooksStore = hooks[storeKey];
|
||||
return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
|
||||
return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var n={d:function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},o:function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r:function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},t={};n.r(t),n.d(t,{actions:function(){return S},addAction:function(){return v},addFilter:function(){return m},applyFilters:function(){return k},createHooks:function(){return h},currentAction:function(){return w},currentFilter:function(){return I},defaultHooks:function(){return f},didAction:function(){return O},didFilter:function(){return j},doAction:function(){return b},doingAction:function(){return x},doingFilter:function(){return T},filters:function(){return z},hasAction:function(){return _},hasFilter:function(){return g},removeAction:function(){return p},removeAllActions:function(){return y},removeAllFilters:function(){return F},removeFilter:function(){return A}});var r=function(n){return"string"!=typeof n||""===n?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(n)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var e=function(n){return"string"!=typeof n||""===n?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(n)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(n)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(n,t){return function(o,i,c){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;const u=n[t];if(!e(o))return;if(!r(i))return;if("function"!=typeof c)return void console.error("The hook callback must be a function.");if("number"!=typeof s)return void console.error("If specified, the hook priority must be a number.");const l={callback:c,priority:s,namespace:i};if(u[o]){const n=u[o].handlers;let t;for(t=n.length;t>0&&!(s>=n[t-1].priority);t--);t===n.length?n[t]=l:n.splice(t,0,l),u.__current.forEach((n=>{n.name===o&&n.currentIndex>=t&&n.currentIndex++}))}else u[o]={handlers:[l],runs:0};"hookAdded"!==o&&n.doAction("hookAdded",o,i,c,s)}};var i=function(n,t){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,c){const s=n[t];if(!e(i))return;if(!o&&!r(c))return;if(!s[i])return 0;let u=0;if(o)u=s[i].handlers.length,s[i]={runs:s[i].runs,handlers:[]};else{const n=s[i].handlers;for(let t=n.length-1;t>=0;t--)n[t].namespace===c&&(n.splice(t,1),u++,s.__current.forEach((n=>{n.name===i&&n.currentIndex>=t&&n.currentIndex--})))}return"hookRemoved"!==i&&n.doAction("hookRemoved",i,c),u}};var c=function(n,t){return function(r,e){const o=n[t];return void 0!==e?r in o&&o[r].handlers.some((n=>n.namespace===e)):r in o}};var s=function(n,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(e){const o=n[t];o[e]||(o[e]={handlers:[],runs:0}),o[e].runs++;const i=o[e].handlers;for(var c=arguments.length,s=new Array(c>1?c-1:0),u=1;u<c;u++)s[u-1]=arguments[u];if(!i||!i.length)return r?s[0]:void 0;const l={name:e,currentIndex:0};for(o.__current.push(l);l.currentIndex<i.length;){const n=i[l.currentIndex].callback.apply(null,s);r&&(s[0]=n),l.currentIndex++}return o.__current.pop(),r?s[0]:void 0}};var u=function(n,t){return function(){var r,e;const o=n[t];return null!==(r=null===(e=o.__current[o.__current.length-1])||void 0===e?void 0:e.name)&&void 0!==r?r:null}};var l=function(n,t){return function(r){const e=n[t];return void 0===r?void 0!==e.__current[0]:!!e.__current[0]&&r===e.__current[0].name}};var a=function(n,t){return function(r){const o=n[t];if(e(r))return o[r]&&o[r].runs?o[r].runs:0}};class d{constructor(){this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=i(this,"actions"),this.removeFilter=i(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=i(this,"actions",!0),this.removeAllFilters=i(this,"filters",!0),this.doAction=s(this,"actions"),this.applyFilters=s(this,"filters",!0),this.currentAction=u(this,"actions"),this.currentFilter=u(this,"filters"),this.doingAction=l(this,"actions"),this.doingFilter=l(this,"filters"),this.didAction=a(this,"actions"),this.didFilter=a(this,"filters")}}var h=function(){return new d};const f=h(),{addAction:v,addFilter:m,removeAction:p,removeFilter:A,hasAction:_,hasFilter:g,removeAllActions:y,removeAllFilters:F,doAction:b,applyFilters:k,currentAction:w,currentFilter:I,doingAction:x,doingFilter:T,didAction:O,didFilter:j,actions:S,filters:z}=f;(window.wp=window.wp||{}).hooks=t}();
|
||||
!function(){"use strict";var n={d:function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},o:function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r:function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},t={};n.r(t),n.d(t,{actions:function(){return S},addAction:function(){return m},addFilter:function(){return p},applyFilters:function(){return k},createHooks:function(){return f},currentAction:function(){return w},currentFilter:function(){return I},defaultHooks:function(){return h},didAction:function(){return O},didFilter:function(){return j},doAction:function(){return b},doingAction:function(){return x},doingFilter:function(){return T},filters:function(){return z},hasAction:function(){return _},hasFilter:function(){return y},removeAction:function(){return A},removeAllActions:function(){return F},removeAllFilters:function(){return g},removeFilter:function(){return v}});var r=function(n){return"string"!=typeof n||""===n?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(n)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var e=function(n){return"string"!=typeof n||""===n?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(n)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(n)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(n,t){return function(o,i,c,s=10){const u=n[t];if(!e(o))return;if(!r(i))return;if("function"!=typeof c)return void console.error("The hook callback must be a function.");if("number"!=typeof s)return void console.error("If specified, the hook priority must be a number.");const l={callback:c,priority:s,namespace:i};if(u[o]){const n=u[o].handlers;let t;for(t=n.length;t>0&&!(s>=n[t-1].priority);t--);t===n.length?n[t]=l:n.splice(t,0,l),u.__current.forEach((n=>{n.name===o&&n.currentIndex>=t&&n.currentIndex++}))}else u[o]={handlers:[l],runs:0};"hookAdded"!==o&&n.doAction("hookAdded",o,i,c,s)}};var i=function(n,t,o=!1){return function(i,c){const s=n[t];if(!e(i))return;if(!o&&!r(c))return;if(!s[i])return 0;let u=0;if(o)u=s[i].handlers.length,s[i]={runs:s[i].runs,handlers:[]};else{const n=s[i].handlers;for(let t=n.length-1;t>=0;t--)n[t].namespace===c&&(n.splice(t,1),u++,s.__current.forEach((n=>{n.name===i&&n.currentIndex>=t&&n.currentIndex--})))}return"hookRemoved"!==i&&n.doAction("hookRemoved",i,c),u}};var c=function(n,t){return function(r,e){const o=n[t];return void 0!==e?r in o&&o[r].handlers.some((n=>n.namespace===e)):r in o}};var s=function(n,t,r=!1){return function(e,...o){const i=n[t];i[e]||(i[e]={handlers:[],runs:0}),i[e].runs++;const c=i[e].handlers;if(!c||!c.length)return r?o[0]:void 0;const s={name:e,currentIndex:0};for(i.__current.push(s);s.currentIndex<c.length;){const n=c[s.currentIndex].callback.apply(null,o);r&&(o[0]=n),s.currentIndex++}return i.__current.pop(),r?o[0]:void 0}};var u=function(n,t){return function(){var r;const e=n[t];return null!==(r=e.__current[e.__current.length-1]?.name)&&void 0!==r?r:null}};var l=function(n,t){return function(r){const e=n[t];return void 0===r?void 0!==e.__current[0]:!!e.__current[0]&&r===e.__current[0].name}};var a=function(n,t){return function(r){const o=n[t];if(e(r))return o[r]&&o[r].runs?o[r].runs:0}};class d{constructor(){this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=i(this,"actions"),this.removeFilter=i(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=i(this,"actions",!0),this.removeAllFilters=i(this,"filters",!0),this.doAction=s(this,"actions"),this.applyFilters=s(this,"filters",!0),this.currentAction=u(this,"actions"),this.currentFilter=u(this,"filters"),this.doingAction=l(this,"actions"),this.doingFilter=l(this,"filters"),this.didAction=a(this,"actions"),this.didFilter=a(this,"filters")}}var f=function(){return new d};const h=f(),{addAction:m,addFilter:p,removeAction:A,removeFilter:v,hasAction:_,hasFilter:y,removeAllActions:F,removeAllFilters:g,doAction:b,applyFilters:k,currentAction:w,currentFilter:I,doingAction:x,doingFilter:T,didAction:O,didFilter:j,actions:S,filters:z}=h;(window.wp=window.wp||{}).hooks=t}();
|
||||
Vendored
+173
-206
@@ -1,174 +1,6 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 9756:
|
||||
/***/ (function(module) {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Accepts a function to be memoized, and returns a new memoized function, with
|
||||
* optional options.
|
||||
*
|
||||
* @template {Function} F
|
||||
*
|
||||
* @param {F} fn Function to memoize.
|
||||
* @param {MemizeOptions} [options] Options object.
|
||||
*
|
||||
* @return {F & MemizeMemoizedFunction} Memoized function.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
if ( false ) {}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
module.exports = memize;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 124:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
@@ -500,9 +332,168 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
"subscribe": function() { return /* reexport */ subscribe; }
|
||||
});
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/memize/index.js
|
||||
var memize = __webpack_require__(9756);
|
||||
var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
|
||||
;// 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
|
||||
var sprintf = __webpack_require__(124);
|
||||
var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
|
||||
@@ -520,7 +511,7 @@ var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
|
||||
* @param {...*} args Arguments to pass to `console.error`
|
||||
*/
|
||||
|
||||
const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
|
||||
const logErrorOnce = memize(console.error); // eslint-disable-line no-console
|
||||
|
||||
/**
|
||||
* Returns a formatted string. If an error occurs in applying the format, the
|
||||
@@ -534,12 +525,8 @@ const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-
|
||||
* @return {string} The formatted string.
|
||||
*/
|
||||
|
||||
function sprintf_sprintf(format) {
|
||||
function sprintf_sprintf(format, ...args) {
|
||||
try {
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return sprintf_default().sprintf(format, ...args);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
@@ -1252,27 +1239,21 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
||||
/** @type {GetLocaleData} */
|
||||
|
||||
|
||||
const getLocaleData = function () {
|
||||
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
||||
return tannin.data[domain];
|
||||
};
|
||||
const getLocaleData = (domain = 'default') => tannin.data[domain];
|
||||
/**
|
||||
* @param {LocaleData} [data]
|
||||
* @param {string} [domain]
|
||||
*/
|
||||
|
||||
|
||||
const doSetLocaleData = function (data) {
|
||||
var _tannin$data$domain;
|
||||
|
||||
let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
||||
const doSetLocaleData = (data, domain = 'default') => {
|
||||
tannin.data[domain] = { ...tannin.data[domain],
|
||||
...data
|
||||
}; // Populate default domain configuration (supported locale date which omits
|
||||
// a plural forms expression).
|
||||
|
||||
tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''],
|
||||
...((_tannin$data$domain = tannin.data[domain]) === null || _tannin$data$domain === void 0 ? void 0 : _tannin$data$domain[''])
|
||||
...tannin.data[domain]?.['']
|
||||
}; // Clean up cached plural forms functions cache as it might be updated.
|
||||
|
||||
delete tannin.pluralForms[domain];
|
||||
@@ -1287,17 +1268,14 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
||||
/** @type {AddLocaleData} */
|
||||
|
||||
|
||||
const addLocaleData = function (data) {
|
||||
var _tannin$data$domain2;
|
||||
|
||||
let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
||||
const addLocaleData = (data, domain = 'default') => {
|
||||
tannin.data[domain] = { ...tannin.data[domain],
|
||||
...data,
|
||||
// Populate default domain configuration (supported locale date which omits
|
||||
// a plural forms expression).
|
||||
'': { ...DEFAULT_LOCALE_DATA[''],
|
||||
...((_tannin$data$domain2 = tannin.data[domain]) === null || _tannin$data$domain2 === void 0 ? void 0 : _tannin$data$domain2['']),
|
||||
...(data === null || data === void 0 ? void 0 : data[''])
|
||||
...tannin.data[domain]?.[''],
|
||||
...data?.['']
|
||||
}
|
||||
}; // Clean up cached plural forms functions cache as it might be updated.
|
||||
|
||||
@@ -1331,13 +1309,7 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
||||
*/
|
||||
|
||||
|
||||
const dcnpgettext = function () {
|
||||
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
||||
let context = arguments.length > 1 ? arguments[1] : undefined;
|
||||
let single = arguments.length > 2 ? arguments[2] : undefined;
|
||||
let plural = arguments.length > 3 ? arguments[3] : undefined;
|
||||
let number = arguments.length > 4 ? arguments[4] : undefined;
|
||||
|
||||
const dcnpgettext = (domain = 'default', context, single, plural, number) => {
|
||||
if (!tannin.data[domain]) {
|
||||
// Use `doSetLocaleData` to set silently, without notifying listeners.
|
||||
doSetLocaleData(undefined, domain);
|
||||
@@ -1348,10 +1320,7 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
||||
/** @type {GetFilterDomain} */
|
||||
|
||||
|
||||
const getFilterDomain = function () {
|
||||
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
||||
return domain;
|
||||
};
|
||||
const getFilterDomain = (domain = 'default') => domain;
|
||||
/** @type {__} */
|
||||
|
||||
|
||||
@@ -1488,10 +1457,8 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
||||
|
||||
|
||||
const hasTranslation = (single, context, domain) => {
|
||||
var _tannin$data, _tannin$data2;
|
||||
|
||||
const key = context ? context + '\u0004' + single : single;
|
||||
let result = !!((_tannin$data = tannin.data) !== null && _tannin$data !== void 0 && (_tannin$data2 = _tannin$data[domain !== null && domain !== void 0 ? domain : 'default']) !== null && _tannin$data2 !== void 0 && _tannin$data2[key]);
|
||||
let result = !!tannin.data?.[domain !== null && domain !== void 0 ? domain : 'default']?.[key];
|
||||
|
||||
if (hooks) {
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+3
-3
@@ -127,10 +127,10 @@ function isShallowEqualArrays(a, b) {
|
||||
|
||||
/**
|
||||
* Returns true if the two arrays or objects are shallow equal, or false
|
||||
* otherwise.
|
||||
* otherwise. Also handles primitive values, just in case.
|
||||
*
|
||||
* @param {any[]|ComparableObject} a First object or array to compare.
|
||||
* @param {any[]|ComparableObject} b Second object or array to compare.
|
||||
* @param {unknown} a First object or array to compare.
|
||||
* @param {unknown} b Second object or array to compare.
|
||||
*
|
||||
* @return {boolean} Whether the two values are shallow equal.
|
||||
*/
|
||||
|
||||
+19
-48
@@ -77,10 +77,7 @@ var external_wp_data_namespaceObject = window["wp"]["data"];
|
||||
*
|
||||
* @return {Object} Updated state.
|
||||
*/
|
||||
function reducer() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function reducer(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'REGISTER_SHORTCUT':
|
||||
return { ...state,
|
||||
@@ -136,14 +133,13 @@ function reducer() {
|
||||
*
|
||||
* @return {Object} action.
|
||||
*/
|
||||
function registerShortcut(_ref) {
|
||||
let {
|
||||
name,
|
||||
category,
|
||||
description,
|
||||
keyCombination,
|
||||
aliases
|
||||
} = _ref;
|
||||
function registerShortcut({
|
||||
name,
|
||||
category,
|
||||
description,
|
||||
keyCombination,
|
||||
aliases
|
||||
}) {
|
||||
return {
|
||||
type: 'REGISTER_SHORTCUT',
|
||||
name,
|
||||
@@ -544,8 +540,7 @@ function getShortcutKeyCombination(state, name) {
|
||||
* @return {string?} Shortcut representation.
|
||||
*/
|
||||
|
||||
function getShortcutRepresentation(state, name) {
|
||||
let representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
|
||||
function getShortcutRepresentation(state, name, representation = 'display') {
|
||||
const shortcut = getShortcutKeyCombination(state, name);
|
||||
return getKeyCombinationRepresentation(shortcut, representation);
|
||||
}
|
||||
@@ -598,13 +593,7 @@ const getAllShortcutRawKeyCombinations = rememo((state, name) => {
|
||||
*/
|
||||
|
||||
const getCategoryShortcuts = rememo((state, categoryName) => {
|
||||
return Object.entries(state).filter(_ref => {
|
||||
let [, shortcut] = _ref;
|
||||
return shortcut.category === categoryName;
|
||||
}).map(_ref2 => {
|
||||
let [name] = _ref2;
|
||||
return name;
|
||||
});
|
||||
return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name);
|
||||
}, state => [state]);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
|
||||
@@ -670,11 +659,10 @@ function useShortcutEventMatch() {
|
||||
*/
|
||||
|
||||
function isMatch(name, event) {
|
||||
return getAllShortcutKeyCombinations(name).some(_ref => {
|
||||
let {
|
||||
modifier,
|
||||
character
|
||||
} = _ref;
|
||||
return getAllShortcutKeyCombinations(name).some(({
|
||||
modifier,
|
||||
character
|
||||
}) => {
|
||||
return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
|
||||
});
|
||||
}
|
||||
@@ -709,10 +697,9 @@ const context = (0,external_wp_element_namespaceObject.createContext)();
|
||||
* @param {boolean} options.isDisabled Whether to disable to shortut.
|
||||
*/
|
||||
|
||||
function useShortcut(name, callback) {
|
||||
let {
|
||||
isDisabled
|
||||
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
function useShortcut(name, callback, {
|
||||
isDisabled
|
||||
} = {}) {
|
||||
const shortcuts = (0,external_wp_element_namespaceObject.useContext)(context);
|
||||
const isMatch = useShortcutEventMatch();
|
||||
const callbackRef = (0,external_wp_element_namespaceObject.useRef)();
|
||||
@@ -735,25 +722,9 @@ function useShortcut(name, callback) {
|
||||
}, [name, isDisabled]);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
||||
function _extends() {
|
||||
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
return _extends.apply(this, arguments);
|
||||
}
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/components/shortcut-provider.js
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
@@ -789,9 +760,9 @@ function ShortcutProvider(props) {
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)(Provider, {
|
||||
value: keyboardShortcuts
|
||||
}, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, {
|
||||
}, (0,external_wp_element_namespaceObject.createElement)("div", { ...props,
|
||||
onKeyDown: onKeyDown
|
||||
})));
|
||||
}));
|
||||
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ShortcutProvider:function(){return j},__unstableUseShortcutEventMatch:function(){return T},store:function(){return C},useShortcut:function(){return k}});var n={};e.r(n),e.d(n,{registerShortcut:function(){return i},unregisterShortcut:function(){return u}});var r={};e.r(r),e.d(r,{getAllShortcutKeyCombinations:function(){return w},getAllShortcutRawKeyCombinations:function(){return m},getCategoryShortcuts:function(){return R},getShortcutAliases:function(){return b},getShortcutDescription:function(){return S},getShortcutKeyCombination:function(){return g},getShortcutRepresentation:function(){return v}});var o=window.wp.data;var a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REGISTER_SHORTCUT":return{...e,[t.name]:{category:t.category,keyCombination:t.keyCombination,aliases:t.aliases,description:t.description}};case"UNREGISTER_SHORTCUT":const{[t.name]:n,...r}=e;return r}return e};function i(e){let{name:t,category:n,description:r,keyCombination:o,aliases:a}=e;return{type:"REGISTER_SHORTCUT",name:t,category:n,keyCombination:o,aliases:a,description:r}}function u(e){return{type:"UNREGISTER_SHORTCUT",name:e}}var c={};function s(e){return[e]}function l(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function f(e,t){var n,r=t||s;function o(e){var t,r,o,a,i,u=n,s=!0;for(t=0;t<e.length;t++){if(r=e[t],!(i=r)||"object"!=typeof i){s=!1;break}u.has(r)?u=u.get(r):(o=new WeakMap,u.set(r,o),u=o)}return u.has(c)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=s,u.set(c,a)),u.get(c)}function a(){n=new WeakMap}function i(){var t,n,a,i,u,c=arguments.length;for(i=new Array(c),a=0;a<c;a++)i[a]=arguments[a];for((t=o(u=r.apply(null,i))).isUniqueByDependants||(t.lastDependants&&!l(u,t.lastDependants,0)&&t.clear(),t.lastDependants=u),n=t.head;n;){if(l(n.args,i,1))return n!==t.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=t.head,n.prev=null,t.head.prev=n,t.head=n),n.val;n=n.next}return n={val:e.apply(null,i)},i[0]=null,n.args=i,t.head&&(t.head.prev=n,n.next=t.head),t.head=n,n.val}return i.getDependants=r,i.clear=a,a(),i}var d=window.wp.keycodes;const p=[],h={display:d.displayShortcut,raw:d.rawShortcut,ariaLabel:d.shortcutAriaLabel};function y(e,t){return e?e.modifier?h[t][e.modifier](e.character):e.character:null}function g(e,t){return e[t]?e[t].keyCombination:null}function v(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"display";const r=g(e,t);return y(r,n)}function S(e,t){return e[t]?e[t].description:null}function b(e,t){return e[t]&&e[t].aliases?e[t].aliases:p}const w=f(((e,t)=>[g(e,t),...b(e,t)].filter(Boolean)),((e,t)=>[e[t]])),m=f(((e,t)=>w(e,t).map((e=>y(e,"raw")))),((e,t)=>[e[t]])),R=f(((e,t)=>Object.entries(e).filter((e=>{let[,n]=e;return n.category===t})).map((e=>{let[t]=e;return t}))),(e=>[e])),C=(0,o.createReduxStore)("core/keyboard-shortcuts",{reducer:a,actions:n,selectors:r});(0,o.register)(C);var O=window.wp.element;function T(){const{getAllShortcutKeyCombinations:e}=(0,o.useSelect)(C);return function(t,n){return e(t).some((e=>{let{modifier:t,character:r}=e;return d.isKeyboardEvent[t](n,r)}))}}const E=(0,O.createContext)();function k(e,t){let{isDisabled:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(0,O.useContext)(E),o=T(),a=(0,O.useRef)();a.current=t,(0,O.useEffect)((()=>{if(!n)return r.current.add(t),()=>{r.current.delete(t)};function t(t){o(e,t)&&a.current(t)}}),[e,n])}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D.apply(this,arguments)}const{Provider:x}=E;function j(e){const t=(0,O.useRef)(new Set);return(0,O.createElement)(x,{value:t},(0,O.createElement)("div",D({},e,{onKeyDown:function(n){e.onKeyDown&&e.onKeyDown(n);for(const e of t.current)e(n)}})))}(window.wp=window.wp||{}).keyboardShortcuts=t}();
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ShortcutProvider:function(){return O},__unstableUseShortcutEventMatch:function(){return E},store:function(){return C},useShortcut:function(){return D}});var n={};e.r(n),e.d(n,{registerShortcut:function(){return u},unregisterShortcut:function(){return i}});var r={};e.r(r),e.d(r,{getAllShortcutKeyCombinations:function(){return b},getAllShortcutRawKeyCombinations:function(){return m},getCategoryShortcuts:function(){return R},getShortcutAliases:function(){return w},getShortcutDescription:function(){return v},getShortcutKeyCombination:function(){return g},getShortcutRepresentation:function(){return S}});var o=window.wp.data;var a=function(e={},t){switch(t.type){case"REGISTER_SHORTCUT":return{...e,[t.name]:{category:t.category,keyCombination:t.keyCombination,aliases:t.aliases,description:t.description}};case"UNREGISTER_SHORTCUT":const{[t.name]:n,...r}=e;return r}return e};function u({name:e,category:t,description:n,keyCombination:r,aliases:o}){return{type:"REGISTER_SHORTCUT",name:e,category:t,keyCombination:r,aliases:o,description:n}}function i(e){return{type:"UNREGISTER_SHORTCUT",name:e}}var c={};function s(e){return[e]}function l(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function f(e,t){var n,r=t||s;function o(){n=new WeakMap}function a(){var t,o,a,u,i,s=arguments.length;for(u=new Array(s),a=0;a<s;a++)u[a]=arguments[a];for(t=function(e){var t,r,o,a,u,i=n,s=!0;for(t=0;t<e.length;t++){if(!(u=r=e[t])||"object"!=typeof u){s=!1;break}i.has(r)?i=i.get(r):(o=new WeakMap,i.set(r,o),i=o)}return i.has(c)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=s,i.set(c,a)),i.get(c)}(i=r.apply(null,u)),t.isUniqueByDependants||(t.lastDependants&&!l(i,t.lastDependants,0)&&t.clear(),t.lastDependants=i),o=t.head;o;){if(l(o.args,u,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,u)},u[0]=null,o.args=u,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}var d=window.wp.keycodes;const p=[],y={display:d.displayShortcut,raw:d.rawShortcut,ariaLabel:d.shortcutAriaLabel};function h(e,t){return e?e.modifier?y[t][e.modifier](e.character):e.character:null}function g(e,t){return e[t]?e[t].keyCombination:null}function S(e,t,n="display"){return h(g(e,t),n)}function v(e,t){return e[t]?e[t].description:null}function w(e,t){return e[t]&&e[t].aliases?e[t].aliases:p}const b=f(((e,t)=>[g(e,t),...w(e,t)].filter(Boolean)),((e,t)=>[e[t]])),m=f(((e,t)=>b(e,t).map((e=>h(e,"raw")))),((e,t)=>[e[t]])),R=f(((e,t)=>Object.entries(e).filter((([,e])=>e.category===t)).map((([e])=>e))),(e=>[e])),C=(0,o.createReduxStore)("core/keyboard-shortcuts",{reducer:a,actions:n,selectors:r});(0,o.register)(C);var T=window.wp.element;function E(){const{getAllShortcutKeyCombinations:e}=(0,o.useSelect)(C);return function(t,n){return e(t).some((({modifier:e,character:t})=>d.isKeyboardEvent[e](n,t)))}}const k=(0,T.createContext)();function D(e,t,{isDisabled:n}={}){const r=(0,T.useContext)(k),o=E(),a=(0,T.useRef)();a.current=t,(0,T.useEffect)((()=>{if(!n)return r.current.add(t),()=>{r.current.delete(t)};function t(t){o(e,t)&&a.current(t)}}),[e,n])}const{Provider:x}=k;function O(e){const t=(0,T.useRef)(new Set);return(0,T.createElement)(x,{value:t},(0,T.createElement)("div",{...e,onKeyDown:function(n){e.onKeyDown&&e.onKeyDown(n);for(const e of t.current)e(n)}}))}(window.wp=window.wp||{}).keyboardShortcuts=t}();
|
||||
Vendored
+381
-267
@@ -68,246 +68,377 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
"shortcutAriaLabel": function() { return /* binding */ shortcutAriaLabel; }
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
|
||||
/*! *****************************************************************************
|
||||
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 */
|
||||
|
||||
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 __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 (_) 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;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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: n === "return" } : 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;
|
||||
}
|
||||
;// 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") 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 */ var 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
|
||||
/**
|
||||
@@ -420,9 +551,7 @@ var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
||||
*
|
||||
* @return {boolean} True if MacOS; false otherwise.
|
||||
*/
|
||||
function isAppleOS() {
|
||||
let _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
|
||||
function isAppleOS(_window = null) {
|
||||
if (!_window) {
|
||||
if (typeof window === 'undefined') {
|
||||
return false;
|
||||
@@ -482,7 +611,7 @@ function isAppleOS() {
|
||||
* @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
|
||||
*/
|
||||
|
||||
/** @typedef {(event: KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
|
||||
/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
|
||||
|
||||
/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
|
||||
|
||||
@@ -590,7 +719,7 @@ const ZERO = 48;
|
||||
/**
|
||||
* Map the values of an object with a specified callback and return the result object.
|
||||
*
|
||||
* @template T
|
||||
* @template {{ [s: string]: any; } | ArrayLike<any>} T
|
||||
*
|
||||
* @param {T} object Object to map values of.
|
||||
* @param {( value: any ) => any} mapFn Mapping function
|
||||
@@ -599,10 +728,7 @@ const ZERO = 48;
|
||||
*/
|
||||
|
||||
function mapValues(object, mapFn) {
|
||||
return Object.fromEntries(Object.entries(object).map(_ref => {
|
||||
let [key, value] = _ref;
|
||||
return [key, mapFn(value)];
|
||||
}));
|
||||
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
|
||||
}
|
||||
/**
|
||||
* Object that contains functions that return the available modifier
|
||||
@@ -646,9 +772,7 @@ const rawShortcut = mapValues(modifiers, (
|
||||
modifier) => {
|
||||
return (
|
||||
/** @type {WPKeyHandler<string>} */
|
||||
function (character) {
|
||||
let _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
|
||||
|
||||
(character, _isApple = isAppleOS) => {
|
||||
return [...modifier(_isApple), character.toLowerCase()].join('+');
|
||||
}
|
||||
);
|
||||
@@ -672,9 +796,7 @@ const displayShortcutList = mapValues(modifiers, (
|
||||
modifier) => {
|
||||
return (
|
||||
/** @type {WPKeyHandler<string[]>} */
|
||||
function (character) {
|
||||
let _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
|
||||
|
||||
(character, _isApple = isAppleOS) => {
|
||||
const isApple = _isApple();
|
||||
|
||||
const replacementKeyMap = {
|
||||
@@ -726,11 +848,7 @@ const displayShortcut = mapValues(displayShortcutList, (
|
||||
shortcutList) => {
|
||||
return (
|
||||
/** @type {WPKeyHandler<string>} */
|
||||
function (character) {
|
||||
let _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
|
||||
|
||||
return shortcutList(character, _isApple).join('');
|
||||
}
|
||||
(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('')
|
||||
);
|
||||
});
|
||||
/**
|
||||
@@ -753,9 +871,7 @@ const shortcutAriaLabel = mapValues(modifiers, (
|
||||
modifier) => {
|
||||
return (
|
||||
/** @type {WPKeyHandler<string>} */
|
||||
function (character) {
|
||||
let _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
|
||||
|
||||
(character, _isApple = isAppleOS) => {
|
||||
const isApple = _isApple();
|
||||
/** @type {Record<string,string>} */
|
||||
|
||||
@@ -790,7 +906,7 @@ modifier) => {
|
||||
* From a given KeyboardEvent, returns an array of active modifier constants for
|
||||
* the event.
|
||||
*
|
||||
* @param {KeyboardEvent} event Keyboard event.
|
||||
* @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.
|
||||
*
|
||||
* @return {Array<WPModifierPart>} Active modifier constants.
|
||||
*/
|
||||
@@ -824,9 +940,7 @@ const isKeyboardEvent = mapValues(modifiers, (
|
||||
getModifiers) => {
|
||||
return (
|
||||
/** @type {WPEventKeyHandler} */
|
||||
function (event, character) {
|
||||
let _isApple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isAppleOS;
|
||||
|
||||
(event, character, _isApple = isAppleOS) => {
|
||||
const mods = getModifiers(_isApple);
|
||||
const eventMods = getEventModifiers(event);
|
||||
/** @type {Record<string,string>} */
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var t={d:function(n,r){for(var e in r)t.o(r,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{ALT:function(){return P},BACKSPACE:function(){return d},COMMAND:function(){return L},CTRL:function(){return j},DELETE:function(){return S},DOWN:function(){return E},END:function(){return m},ENTER:function(){return p},ESCAPE:function(){return h},F10:function(){return b},HOME:function(){return A},LEFT:function(){return w},PAGEDOWN:function(){return y},PAGEUP:function(){return v},RIGHT:function(){return O},SHIFT:function(){return T},SPACE:function(){return g},TAB:function(){return s},UP:function(){return C},ZERO:function(){return _},displayShortcut:function(){return x},displayShortcutList:function(){return Z},isAppleOS:function(){return a},isKeyboardEvent:function(){return N},modifiers:function(){return k},rawShortcut:function(){return M},shortcutAriaLabel:function(){return D}});var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};Object.create;Object.create;function e(t){return t.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function u(t,n,r){return n instanceof RegExp?t.replace(n,r):n.reduce((function(t,n){return t.replace(n,r)}),t)}function c(t){return function(t){return t.charAt(0).toUpperCase()+t.substr(1)}(t.toLowerCase())}function f(t,n){return void 0===n&&(n={}),function(t,n){void 0===n&&(n={});for(var r=n.splitRegexp,c=void 0===r?o:r,f=n.stripRegexp,l=void 0===f?i:f,a=n.transform,d=void 0===a?e:a,s=n.delimiter,p=void 0===s?" ":s,h=u(u(t,c,"$1\0$2"),l,"\0"),g=0,v=h.length;"\0"===h.charAt(g);)g++;for(;"\0"===h.charAt(v-1);)v--;return h.slice(g,v).split("\0").map(d).join(p)}(t,r({delimiter:" ",transform:c},n))}var l=window.wp.i18n;function a(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!t){if("undefined"==typeof window)return!1;t=window}const{platform:n}=t.navigator;return-1!==n.indexOf("Mac")||["iPad","iPhone"].includes(n)}const d=8,s=9,p=13,h=27,g=32,v=33,y=34,m=35,A=36,w=37,C=38,O=39,E=40,S=46,b=121,P="alt",j="ctrl",L="meta",T="shift",_=48;function R(t,n){return Object.fromEntries(Object.entries(t).map((t=>{let[r,e]=t;return[r,n(e)]})))}const k={primary:t=>t()?[L]:[j],primaryShift:t=>t()?[T,L]:[j,T],primaryAlt:t=>t()?[P,L]:[j,P],secondary:t=>t()?[T,P,L]:[j,T,P],access:t=>t()?[j,P]:[T,P],ctrl:()=>[j],alt:()=>[P],ctrlShift:()=>[j,T],shift:()=>[T],shiftAlt:()=>[T,P],undefined:()=>[]},M=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return[...t(r),n.toLowerCase()].join("+")})),Z=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const e=r(),o={[P]:e?"⌥":"Alt",[j]:e?"⌃":"Ctrl",[L]:"⌘",[T]:e?"⇧":"Shift"},i=t(r).reduce(((t,n)=>{var r;const i=null!==(r=o[n])&&void 0!==r?r:n;return e?[...t,i]:[...t,i,"+"]}),[]),u=f(n,{stripRegexp:/[^A-Z0-9~`,\.\\\-]/gi});return[...i,u]})),x=R(Z,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return t(n,r).join("")})),D=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const e=r(),o={[T]:"Shift",[L]:e?"Command":"Control",[j]:"Control",[P]:e?"Option":"Alt",",":(0,l.__)("Comma"),".":(0,l.__)("Period"),"`":(0,l.__)("Backtick"),"~":(0,l.__)("Tilde")};return[...t(r),n].map((t=>{var n;return f(null!==(n=o[t])&&void 0!==n?n:t)})).join(e?" ":" + ")}));function K(t){return[P,j,L,T].filter((n=>t[`${n}Key`]))}const N=R(k,(t=>function(n,r){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;const o=t(e),i=K(n),u={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=o.filter((t=>!i.includes(t))),f=i.filter((t=>!o.includes(t)));if(c.length>0||f.length>0)return!1;let l=n.key.toLowerCase();return r?(n.altKey&&1===r.length&&(l=String.fromCharCode(n.keyCode).toLowerCase()),n.shiftKey&&1===r.length&&u[n.code]&&(l=u[n.code]),"del"===r&&(r="delete"),l===r.toLowerCase()):o.includes(l)}));(window.wp=window.wp||{}).keycodes=n}();
|
||||
!function(){"use strict";var t={d:function(n,r){for(var e in r)t.o(r,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{ALT:function(){return P},BACKSPACE:function(){return s},COMMAND:function(){return L},CTRL:function(){return j},DELETE:function(){return S},DOWN:function(){return O},END:function(){return g},ENTER:function(){return p},ESCAPE:function(){return h},F10:function(){return b},HOME:function(){return v},LEFT:function(){return w},PAGEDOWN:function(){return A},PAGEUP:function(){return m},RIGHT:function(){return E},SHIFT:function(){return T},SPACE:function(){return y},TAB:function(){return d},UP:function(){return C},ZERO:function(){return _},displayShortcut:function(){return x},displayShortcutList:function(){return Z},isAppleOS:function(){return l},isKeyboardEvent:function(){return K},modifiers:function(){return k},rawShortcut:function(){return M},shortcutAriaLabel:function(){return D}});var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function e(t){return t.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function u(t,n,r){return n instanceof RegExp?t.replace(n,r):n.reduce((function(t,n){return t.replace(n,r)}),t)}function c(t){return function(t){return t.charAt(0).toUpperCase()+t.substr(1)}(t.toLowerCase())}function f(t,n){return void 0===n&&(n={}),function(t,n){void 0===n&&(n={});for(var r=n.splitRegexp,c=void 0===r?o:r,f=n.stripRegexp,a=void 0===f?i:f,l=n.transform,s=void 0===l?e:l,d=n.delimiter,p=void 0===d?" ":d,h=u(u(t,c,"$1\0$2"),a,"\0"),y=0,m=h.length;"\0"===h.charAt(y);)y++;for(;"\0"===h.charAt(m-1);)m--;return h.slice(y,m).split("\0").map(s).join(p)}(t,r({delimiter:" ",transform:c},n))}var a=window.wp.i18n;function l(t=null){if(!t){if("undefined"==typeof window)return!1;t=window}const{platform:n}=t.navigator;return-1!==n.indexOf("Mac")||["iPad","iPhone"].includes(n)}const s=8,d=9,p=13,h=27,y=32,m=33,A=34,g=35,v=36,w=37,C=38,E=39,O=40,S=46,b=121,P="alt",j="ctrl",L="meta",T="shift",_=48;function R(t,n){return Object.fromEntries(Object.entries(t).map((([t,r])=>[t,n(r)])))}const k={primary:t=>t()?[L]:[j],primaryShift:t=>t()?[T,L]:[j,T],primaryAlt:t=>t()?[P,L]:[j,P],secondary:t=>t()?[T,P,L]:[j,T,P],access:t=>t()?[j,P]:[T,P],ctrl:()=>[j],alt:()=>[P],ctrlShift:()=>[j,T],shift:()=>[T],shiftAlt:()=>[T,P],undefined:()=>[]},M=R(k,(t=>(n,r=l)=>[...t(r),n.toLowerCase()].join("+"))),Z=R(k,(t=>(n,r=l)=>{const e=r(),o={[P]:e?"⌥":"Alt",[j]:e?"⌃":"Ctrl",[L]:"⌘",[T]:e?"⇧":"Shift"};return[...t(r).reduce(((t,n)=>{var r;const i=null!==(r=o[n])&&void 0!==r?r:n;return e?[...t,i]:[...t,i,"+"]}),[]),f(n,{stripRegexp:/[^A-Z0-9~`,\.\\\-]/gi})]})),x=R(Z,(t=>(n,r=l)=>t(n,r).join(""))),D=R(k,(t=>(n,r=l)=>{const e=r(),o={[T]:"Shift",[L]:e?"Command":"Control",[j]:"Control",[P]:e?"Option":"Alt",",":(0,a.__)("Comma"),".":(0,a.__)("Period"),"`":(0,a.__)("Backtick"),"~":(0,a.__)("Tilde")};return[...t(r),n].map((t=>{var n;return f(null!==(n=o[t])&&void 0!==n?n:t)})).join(e?" ":" + ")}));const K=R(k,(t=>(n,r,e=l)=>{const o=t(e),i=function(t){return[P,j,L,T].filter((n=>t[`${n}Key`]))}(n),u={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=o.filter((t=>!i.includes(t))),f=i.filter((t=>!o.includes(t)));if(c.length>0||f.length>0)return!1;let a=n.key.toLowerCase();return r?(n.altKey&&1===r.length&&(a=String.fromCharCode(n.keyCode).toLowerCase()),n.shiftKey&&1===r.length&&u[n.code]&&(a=u[n.code]),"del"===r&&(r="delete"),a===r.toLowerCase()):o.includes(a)}));(window.wp=window.wp||{}).keycodes=n}();
|
||||
+403
-275
@@ -53,246 +53,377 @@ __webpack_require__.r(__webpack_exports__);
|
||||
var external_wp_element_namespaceObject = window["wp"]["element"];
|
||||
;// CONCATENATED MODULE: external ["wp","i18n"]
|
||||
var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
||||
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
|
||||
/*! *****************************************************************************
|
||||
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 */
|
||||
|
||||
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 __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 (_) 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;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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: n === "return" } : 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;
|
||||
}
|
||||
;// 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") 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 */ var 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
|
||||
/**
|
||||
@@ -468,10 +599,12 @@ async function exportReusableBlock(id) {
|
||||
});
|
||||
const title = post.title.raw;
|
||||
const content = post.content.raw;
|
||||
const syncStatus = post.wp_pattern_sync_status;
|
||||
const fileContent = JSON.stringify({
|
||||
__file: 'wp_block',
|
||||
title,
|
||||
content
|
||||
content,
|
||||
syncStatus
|
||||
}, null, 2);
|
||||
const fileName = paramCase(title) + '.json';
|
||||
download(fileName, fileContent, 'application/json');
|
||||
@@ -510,8 +643,8 @@ async function importReusableBlock(file) {
|
||||
throw new Error('Invalid JSON file');
|
||||
}
|
||||
|
||||
if (parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== 'string' || typeof parsedContent.content !== 'string') {
|
||||
throw new Error('Invalid Reusable block JSON file');
|
||||
if (parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== 'string' || typeof parsedContent.content !== 'string' || parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string') {
|
||||
throw new Error('Invalid Pattern JSON file');
|
||||
}
|
||||
|
||||
const postType = await external_wp_apiFetch_default()({
|
||||
@@ -522,7 +655,10 @@ async function importReusableBlock(file) {
|
||||
data: {
|
||||
title: parsedContent.title,
|
||||
content: parsedContent.content,
|
||||
status: 'publish'
|
||||
status: 'publish',
|
||||
meta: parsedContent.syncStatus === 'unsynced' ? {
|
||||
wp_pattern_sync_status: parsedContent.syncStatus
|
||||
} : undefined
|
||||
},
|
||||
method: 'POST'
|
||||
});
|
||||
@@ -547,11 +683,10 @@ async function importReusableBlock(file) {
|
||||
|
||||
|
||||
|
||||
function ImportForm(_ref) {
|
||||
let {
|
||||
instanceId,
|
||||
onUpload
|
||||
} = _ref;
|
||||
function ImportForm({
|
||||
instanceId,
|
||||
onUpload
|
||||
}) {
|
||||
const inputId = 'list-reusable-blocks-import-form-' + instanceId;
|
||||
const formRef = (0,external_wp_element_namespaceObject.useRef)();
|
||||
const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
@@ -592,8 +727,8 @@ function ImportForm(_ref) {
|
||||
uiMessage = (0,external_wp_i18n_namespaceObject.__)('Invalid JSON file');
|
||||
break;
|
||||
|
||||
case 'Invalid Reusable block JSON file':
|
||||
uiMessage = (0,external_wp_i18n_namespaceObject.__)('Invalid Reusable block JSON file');
|
||||
case 'Invalid Pattern JSON file':
|
||||
uiMessage = (0,external_wp_i18n_namespaceObject.__)('Invalid Pattern JSON file');
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -649,34 +784,27 @@ function ImportForm(_ref) {
|
||||
|
||||
|
||||
|
||||
function ImportDropdown(_ref) {
|
||||
let {
|
||||
onUpload
|
||||
} = _ref;
|
||||
function ImportDropdown({
|
||||
onUpload
|
||||
}) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
|
||||
popoverProps: {
|
||||
placement: 'bottom-start'
|
||||
},
|
||||
contentClassName: "list-reusable-blocks-import-dropdown__content",
|
||||
renderToggle: _ref2 => {
|
||||
let {
|
||||
isOpen,
|
||||
onToggle
|
||||
} = _ref2;
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
"aria-expanded": isOpen,
|
||||
onClick: onToggle,
|
||||
variant: "primary"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Import from JSON'));
|
||||
},
|
||||
renderContent: _ref3 => {
|
||||
let {
|
||||
onClose
|
||||
} = _ref3;
|
||||
return (0,external_wp_element_namespaceObject.createElement)(import_form, {
|
||||
onUpload: (0,external_wp_compose_namespaceObject.pipe)(onClose, onUpload)
|
||||
});
|
||||
}
|
||||
renderToggle: ({
|
||||
isOpen,
|
||||
onToggle
|
||||
}) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
"aria-expanded": isOpen,
|
||||
onClick: onToggle,
|
||||
variant: "primary"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Import from JSON')),
|
||||
renderContent: ({
|
||||
onClose
|
||||
}) => (0,external_wp_element_namespaceObject.createElement)(import_form, {
|
||||
onUpload: (0,external_wp_compose_namespaceObject.pipe)(onClose, onUpload)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -716,7 +844,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const showNotice = () => {
|
||||
const notice = document.createElement('div');
|
||||
notice.className = 'notice notice-success is-dismissible';
|
||||
notice.innerHTML = `<p>${(0,external_wp_i18n_namespaceObject.__)('Reusable block imported successfully!')}</p>`;
|
||||
notice.innerHTML = `<p>${(0,external_wp_i18n_namespaceObject.__)('Pattern imported successfully!')}</p>`;
|
||||
const headerEnd = document.querySelector('.wp-header-end');
|
||||
|
||||
if (!headerEnd) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+25
-35
@@ -232,7 +232,7 @@ const getGalleryDetailsMediaFrame = () => {
|
||||
const slimImageObject = img => {
|
||||
const attrSet = ['sizes', 'mime', 'type', 'subtype', 'id', 'url', 'alt', 'link', 'caption'];
|
||||
return attrSet.reduce((result, key) => {
|
||||
if (img !== null && img !== void 0 && img.hasOwnProperty(key)) {
|
||||
if (img?.hasOwnProperty(key)) {
|
||||
result[key] = img[key];
|
||||
}
|
||||
|
||||
@@ -255,15 +255,14 @@ const getAttachmentsCollection = ids => {
|
||||
};
|
||||
|
||||
class MediaUpload extends external_wp_element_namespaceObject.Component {
|
||||
constructor(_ref) {
|
||||
let {
|
||||
allowedTypes,
|
||||
gallery = false,
|
||||
unstableFeaturedImageFlow = false,
|
||||
modalClass,
|
||||
multiple = false,
|
||||
title = (0,external_wp_i18n_namespaceObject.__)('Select or Upload Media')
|
||||
} = _ref;
|
||||
constructor({
|
||||
allowedTypes,
|
||||
gallery = false,
|
||||
unstableFeaturedImageFlow = false,
|
||||
modalClass,
|
||||
multiple = false,
|
||||
title = (0,external_wp_i18n_namespaceObject.__)('Select or Upload Media')
|
||||
}) {
|
||||
super(...arguments);
|
||||
this.openModal = this.openModal.bind(this);
|
||||
this.onOpen = this.onOpen.bind(this);
|
||||
@@ -439,7 +438,7 @@ class MediaUpload extends external_wp_element_namespaceObject.Component {
|
||||
// (for galleries) or a (number) singular id (e.g. image block).
|
||||
|
||||
|
||||
const hasMedia = Array.isArray(value) ? !!(value !== null && value !== void 0 && value.length) : !!value;
|
||||
const hasMedia = Array.isArray(value) ? !!value?.length : !!value;
|
||||
|
||||
if (!hasMedia) {
|
||||
return;
|
||||
@@ -459,9 +458,7 @@ class MediaUpload extends external_wp_element_namespaceObject.Component {
|
||||
const attachments = getAttachmentsCollection(valueArray); // Once attachments are loaded, set the current selection.
|
||||
|
||||
attachments.more().done(function () {
|
||||
var _attachments$models;
|
||||
|
||||
if (isGallery && attachments !== null && attachments !== void 0 && (_attachments$models = attachments.models) !== null && _attachments$models !== void 0 && _attachments$models.length) {
|
||||
if (isGallery && attachments?.models?.length) {
|
||||
selection.add(attachments.models);
|
||||
}
|
||||
});
|
||||
@@ -546,8 +543,7 @@ function getMimeTypesArray(wpMimeTypesObject) {
|
||||
return wpMimeTypesObject;
|
||||
}
|
||||
|
||||
return Object.entries(wpMimeTypesObject).map(_ref => {
|
||||
let [extensionsString, mime] = _ref;
|
||||
return Object.entries(wpMimeTypesObject).map(([extensionsString, mime]) => {
|
||||
const [type] = mime.split('/');
|
||||
const extensions = extensionsString.split('|');
|
||||
return [mime, ...extensions.map(extension => `${type}/${extension}`)];
|
||||
@@ -569,24 +565,21 @@ function getMimeTypesArray(wpMimeTypesObject) {
|
||||
* @param {?Object} $0.wpAllowedMimeTypes List of allowed mime types and file extensions.
|
||||
*/
|
||||
|
||||
async function uploadMedia(_ref2) {
|
||||
let {
|
||||
allowedTypes,
|
||||
additionalData = {},
|
||||
filesList,
|
||||
maxUploadFileSize,
|
||||
onError = noop,
|
||||
onFileChange,
|
||||
wpAllowedMimeTypes = null
|
||||
} = _ref2;
|
||||
async function uploadMedia({
|
||||
allowedTypes,
|
||||
additionalData = {},
|
||||
filesList,
|
||||
maxUploadFileSize,
|
||||
onError = noop,
|
||||
onFileChange,
|
||||
wpAllowedMimeTypes = null
|
||||
}) {
|
||||
// Cast filesList to array.
|
||||
const files = [...filesList];
|
||||
const filesSet = [];
|
||||
|
||||
const setAndUpdateFiles = (idx, value) => {
|
||||
var _filesSet$idx;
|
||||
|
||||
(0,external_wp_blob_namespaceObject.revokeBlobURL)((_filesSet$idx = filesSet[idx]) === null || _filesSet$idx === void 0 ? void 0 : _filesSet$idx.url);
|
||||
(0,external_wp_blob_namespaceObject.revokeBlobURL)(filesSet[idx]?.url);
|
||||
filesSet[idx] = value;
|
||||
onFileChange(filesSet.filter(Boolean));
|
||||
}; // Allowed type specified by consumer.
|
||||
@@ -677,7 +670,7 @@ async function uploadMedia(_ref2) {
|
||||
const mediaFile = validFiles[idx];
|
||||
|
||||
try {
|
||||
var _savedMedia$caption$r, _savedMedia$caption;
|
||||
var _savedMedia$caption$r;
|
||||
|
||||
const savedMedia = await createMediaFromFile(mediaFile, additionalData); // eslint-disable-next-line camelcase
|
||||
|
||||
@@ -688,7 +681,7 @@ async function uploadMedia(_ref2) {
|
||||
} = savedMedia;
|
||||
const mediaObject = { ...savedMediaProps,
|
||||
alt: savedMedia.alt_text,
|
||||
caption: (_savedMedia$caption$r = (_savedMedia$caption = savedMedia.caption) === null || _savedMedia$caption === void 0 ? void 0 : _savedMedia$caption.raw) !== null && _savedMedia$caption$r !== void 0 ? _savedMedia$caption$r : '',
|
||||
caption: (_savedMedia$caption$r = savedMedia.caption?.raw) !== null && _savedMedia$caption$r !== void 0 ? _savedMedia$caption$r : '',
|
||||
title: savedMedia.title.raw,
|
||||
url: savedMedia.source_url
|
||||
};
|
||||
@@ -726,10 +719,7 @@ function createMediaFromFile(file, additionalData) {
|
||||
data.append('file', file, file.name || file.type.replace('/', '.'));
|
||||
|
||||
if (additionalData) {
|
||||
Object.entries(additionalData).forEach(_ref3 => {
|
||||
let [key, value] = _ref3;
|
||||
return data.append(key, value);
|
||||
});
|
||||
Object.entries(additionalData).forEach(([key, value]) => data.append(key, value));
|
||||
}
|
||||
|
||||
return external_wp_apiFetch_default()({
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+125
-31
@@ -51,7 +51,9 @@ __webpack_require__.d(actions_namespaceObject, {
|
||||
"createNotice": function() { return createNotice; },
|
||||
"createSuccessNotice": function() { return createSuccessNotice; },
|
||||
"createWarningNotice": function() { return createWarningNotice; },
|
||||
"removeNotice": function() { return removeNotice; }
|
||||
"removeAllNotices": function() { return removeAllNotices; },
|
||||
"removeNotice": function() { return removeNotice; },
|
||||
"removeNotices": function() { return removeNotices; }
|
||||
});
|
||||
|
||||
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js
|
||||
@@ -72,9 +74,7 @@ var external_wp_data_namespaceObject = window["wp"]["data"];
|
||||
*
|
||||
* @return {Function} Higher-order reducer.
|
||||
*/
|
||||
const onSubKey = actionProperty => reducer => function () {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
const onSubKey = actionProperty => reducer => (state = {}, action) => {
|
||||
// Retrieve subkey from action. Do not track if undefined; useful for cases
|
||||
// where reducer is scoped by action shape.
|
||||
const key = action[actionProperty];
|
||||
@@ -112,27 +112,28 @@ const onSubKey = actionProperty => reducer => function () {
|
||||
* @return {Object} Updated state.
|
||||
*/
|
||||
|
||||
const notices = on_sub_key('context')(function () {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
const notices = on_sub_key('context')((state = [], action) => {
|
||||
switch (action.type) {
|
||||
case 'CREATE_NOTICE':
|
||||
// Avoid duplicates on ID.
|
||||
return [...state.filter(_ref => {
|
||||
let {
|
||||
id
|
||||
} = _ref;
|
||||
return id !== action.notice.id;
|
||||
}), action.notice];
|
||||
return [...state.filter(({
|
||||
id
|
||||
}) => id !== action.notice.id), action.notice];
|
||||
|
||||
case 'REMOVE_NOTICE':
|
||||
return state.filter(_ref2 => {
|
||||
let {
|
||||
id
|
||||
} = _ref2;
|
||||
return id !== action.id;
|
||||
});
|
||||
return state.filter(({
|
||||
id
|
||||
}) => id !== action.id);
|
||||
|
||||
case 'REMOVE_NOTICES':
|
||||
return state.filter(({
|
||||
id
|
||||
}) => !action.ids.includes(id));
|
||||
|
||||
case 'REMOVE_ALL_NOTICES':
|
||||
return state.filter(({
|
||||
type
|
||||
}) => type !== action.noticeType);
|
||||
}
|
||||
|
||||
return state;
|
||||
@@ -176,7 +177,7 @@ let uniqueId = 0;
|
||||
/**
|
||||
* Returns an action object used in signalling that a notice is to be created.
|
||||
*
|
||||
* @param {string} [status='info'] Notice status.
|
||||
* @param {string|undefined} status Notice status ("info" if undefined is passed).
|
||||
* @param {string} content Notice message.
|
||||
* @param {Object} [options] Notice options.
|
||||
* @param {string} [options.context='global'] Context under which to
|
||||
@@ -225,10 +226,7 @@ let uniqueId = 0;
|
||||
* @return {Object} Action object.
|
||||
*/
|
||||
|
||||
function createNotice() {
|
||||
let status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATUS;
|
||||
let content = arguments.length > 1 ? arguments[1] : undefined;
|
||||
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
function createNotice(status = DEFAULT_STATUS, content, options = {}) {
|
||||
const {
|
||||
speak = true,
|
||||
isDismissible = true,
|
||||
@@ -465,14 +463,113 @@ function createWarningNotice(content, options) {
|
||||
* @return {Object} Action object.
|
||||
*/
|
||||
|
||||
function removeNotice(id) {
|
||||
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT;
|
||||
function removeNotice(id, context = DEFAULT_CONTEXT) {
|
||||
return {
|
||||
type: 'REMOVE_NOTICE',
|
||||
id,
|
||||
context
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Removes all notices from a given context. Defaults to the default context.
|
||||
*
|
||||
* @param {string} noticeType The context to remove all notices from.
|
||||
* @param {string} context The context to remove all notices from.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* import { __ } from '@wordpress/i18n';
|
||||
* import { useDispatch, useSelect } from '@wordpress/data';
|
||||
* import { store as noticesStore } from '@wordpress/notices';
|
||||
* import { Button } from '@wordpress/components';
|
||||
*
|
||||
* export const ExampleComponent = () => {
|
||||
* const notices = useSelect( ( select ) =>
|
||||
* select( noticesStore ).getNotices()
|
||||
* );
|
||||
* const { removeNotices } = useDispatch( noticesStore );
|
||||
* return (
|
||||
* <>
|
||||
* <ul>
|
||||
* { notices.map( ( notice ) => (
|
||||
* <li key={ notice.id }>{ notice.content }</li>
|
||||
* ) ) }
|
||||
* </ul>
|
||||
* <Button
|
||||
* onClick={ () =>
|
||||
* removeAllNotices()
|
||||
* }
|
||||
* >
|
||||
* { __( 'Clear all notices', 'woo-gutenberg-products-block' ) }
|
||||
* </Button>
|
||||
* <Button
|
||||
* onClick={ () =>
|
||||
* removeAllNotices( 'snackbar' )
|
||||
* }
|
||||
* >
|
||||
* { __( 'Clear all snackbar notices', 'woo-gutenberg-products-block' ) }
|
||||
* </Button>
|
||||
* </>
|
||||
* );
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @return {Object} Action object.
|
||||
*/
|
||||
|
||||
function removeAllNotices(noticeType = 'default', context = DEFAULT_CONTEXT) {
|
||||
return {
|
||||
type: 'REMOVE_ALL_NOTICES',
|
||||
noticeType,
|
||||
context
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns an action object used in signalling that several notices are to be removed.
|
||||
*
|
||||
* @param {string[]} ids List of unique notice identifiers.
|
||||
* @param {string} [context='global'] Optional context (grouping) in which the notices are
|
||||
* intended to appear. Defaults to default context.
|
||||
* @example
|
||||
* ```js
|
||||
* import { __ } from '@wordpress/i18n';
|
||||
* import { useDispatch, useSelect } from '@wordpress/data';
|
||||
* import { store as noticesStore } from '@wordpress/notices';
|
||||
* import { Button } from '@wordpress/components';
|
||||
*
|
||||
* const ExampleComponent = () => {
|
||||
* const notices = useSelect( ( select ) =>
|
||||
* select( noticesStore ).getNotices()
|
||||
* );
|
||||
* const { removeNotices } = useDispatch( noticesStore );
|
||||
* return (
|
||||
* <>
|
||||
* <ul>
|
||||
* { notices.map( ( notice ) => (
|
||||
* <li key={ notice.id }>{ notice.content }</li>
|
||||
* ) ) }
|
||||
* </ul>
|
||||
* <Button
|
||||
* onClick={ () =>
|
||||
* removeNotices( notices.map( ( { id } ) => id ) )
|
||||
* }
|
||||
* >
|
||||
* { __( 'Clear all notices' ) }
|
||||
* </Button>
|
||||
* </>
|
||||
* );
|
||||
* };
|
||||
* ```
|
||||
* @return {Object} Action object.
|
||||
*/
|
||||
|
||||
function removeNotices(ids, context = DEFAULT_CONTEXT) {
|
||||
return {
|
||||
type: 'REMOVE_NOTICES',
|
||||
ids,
|
||||
context
|
||||
};
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/selectors.js
|
||||
/**
|
||||
@@ -546,8 +643,7 @@ const DEFAULT_NOTICES = [];
|
||||
* @return {WPNotice[]} Array of notices.
|
||||
*/
|
||||
|
||||
function getNotices(state) {
|
||||
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT;
|
||||
function getNotices(state, context = DEFAULT_CONTEXT) {
|
||||
return state[context] || DEFAULT_NOTICES;
|
||||
}
|
||||
|
||||
@@ -567,8 +663,6 @@ function getNotices(state) {
|
||||
* Store definition for the notices namespace.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
|
||||
const store = (0,external_wp_data_namespaceObject.createReduxStore)('core/notices', {
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{store:function(){return w}});var n={};t.r(n),t.d(n,{createErrorNotice:function(){return v},createInfoNotice:function(){return g},createNotice:function(){return d},createSuccessNotice:function(){return f},createWarningNotice:function(){return p},removeNotice:function(){return y}});var r={};t.r(r),t.d(r,{getNotices:function(){return E}});var i=window.wp.data;var o=t=>e=>function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;const i=r[t];if(void 0===i)return n;const o=e(n[i],r);return o===n[i]?n:{...n,[i]:o}};const c=o("context")((function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"CREATE_NOTICE":return[...t.filter((t=>{let{id:n}=t;return n!==e.notice.id})),e.notice];case"REMOVE_NOTICE":return t.filter((t=>{let{id:n}=t;return n!==e.id}))}return t}));var u=c;const s="global",l="info";let a=0;function d(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{speak:r=!0,isDismissible:i=!0,context:o=s,id:c=`${o}${++a}`,actions:u=[],type:d="default",__unstableHTML:f,icon:g=null,explicitDismiss:v=!1,onDismiss:p}=n;return e=String(e),{type:"CREATE_NOTICE",context:o,notice:{id:c,status:t,content:e,spokenMessage:r?e:null,__unstableHTML:f,isDismissible:i,actions:u,type:d,icon:g,explicitDismiss:v,onDismiss:p}}}function f(t,e){return d("success",t,e)}function g(t,e){return d("info",t,e)}function v(t,e){return d("error",t,e)}function p(t,e){return d("warning",t,e)}function y(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;return{type:"REMOVE_NOTICE",id:t,context:e}}const b=[];function E(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;return t[e]||b}const w=(0,i.createReduxStore)("core/notices",{reducer:u,actions:n,selectors:r});(0,i.register)(w),(window.wp=window.wp||{}).notices=e}();
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:function(){return b}});var n={};e.r(n),e.d(n,{createErrorNotice:function(){return E},createInfoNotice:function(){return d},createNotice:function(){return f},createSuccessNotice:function(){return l},createWarningNotice:function(){return p},removeAllNotices:function(){return O},removeNotice:function(){return y},removeNotices:function(){return N}});var r={};e.r(r),e.d(r,{getNotices:function(){return _}});var i=window.wp.data;var o=e=>t=>(n={},r)=>{const i=r[e];if(void 0===i)return n;const o=t(n[i],r);return o===n[i]?n:{...n,[i]:o}};var c=o("context")(((e=[],t)=>{switch(t.type){case"CREATE_NOTICE":return[...e.filter((({id:e})=>e!==t.notice.id)),t.notice];case"REMOVE_NOTICE":return e.filter((({id:e})=>e!==t.id));case"REMOVE_NOTICES":return e.filter((({id:e})=>!t.ids.includes(e)));case"REMOVE_ALL_NOTICES":return e.filter((({type:e})=>e!==t.noticeType))}return e}));const u="global",s="info";let a=0;function f(e=s,t,n={}){const{speak:r=!0,isDismissible:i=!0,context:o=u,id:c=`${o}${++a}`,actions:f=[],type:l="default",__unstableHTML:d,icon:E=null,explicitDismiss:p=!1,onDismiss:y}=n;return{type:"CREATE_NOTICE",context:o,notice:{id:c,status:e,content:t=String(t),spokenMessage:r?t:null,__unstableHTML:d,isDismissible:i,actions:f,type:l,icon:E,explicitDismiss:p,onDismiss:y}}}function l(e,t){return f("success",e,t)}function d(e,t){return f("info",e,t)}function E(e,t){return f("error",e,t)}function p(e,t){return f("warning",e,t)}function y(e,t=u){return{type:"REMOVE_NOTICE",id:e,context:t}}function O(e="default",t=u){return{type:"REMOVE_ALL_NOTICES",noticeType:e,context:t}}function N(e,t=u){return{type:"REMOVE_NOTICES",ids:e,context:t}}const T=[];function _(e,t=u){return e[t]||T}const b=(0,i.createReduxStore)("core/notices",{reducer:c,actions:n,selectors:r});(0,i.register)(b),(window.wp=window.wp||{}).notices=t}();
|
||||
Vendored
+18
-32
@@ -94,10 +94,7 @@ var external_wp_data_namespaceObject = window["wp"]["data"];
|
||||
* @return {Array} Updated state.
|
||||
*/
|
||||
|
||||
function guides() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function guides(state = [], action) {
|
||||
switch (action.type) {
|
||||
case 'TRIGGER_GUIDE':
|
||||
return [...state, action.tipIds];
|
||||
@@ -114,10 +111,7 @@ function guides() {
|
||||
* @return {boolean} Updated state.
|
||||
*/
|
||||
|
||||
function areTipsEnabled() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function areTipsEnabled(state = true, action) {
|
||||
switch (action.type) {
|
||||
case 'DISABLE_TIPS':
|
||||
return false;
|
||||
@@ -138,10 +132,7 @@ function areTipsEnabled() {
|
||||
* @return {Object} Updated state.
|
||||
*/
|
||||
|
||||
function dismissedTips() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function dismissedTips(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'DISMISS_TIP':
|
||||
return { ...state,
|
||||
@@ -566,13 +557,11 @@ const getAssociatedGuide = rememo((state, tipId) => {
|
||||
*/
|
||||
|
||||
function isTipVisible(state, tipId) {
|
||||
var _state$preferences$di;
|
||||
|
||||
if (!state.preferences.areTipsEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((_state$preferences$di = state.preferences.dismissedTips) !== null && _state$preferences$di !== void 0 && _state$preferences$di.hasOwnProperty(tipId)) {
|
||||
if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -681,15 +670,14 @@ function onClick(event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function DotTip(_ref) {
|
||||
let {
|
||||
position = 'middle right',
|
||||
children,
|
||||
isVisible,
|
||||
hasNextTip,
|
||||
onDismiss,
|
||||
onDisable
|
||||
} = _ref;
|
||||
function DotTip({
|
||||
position = 'middle right',
|
||||
children,
|
||||
isVisible,
|
||||
hasNextTip,
|
||||
onDismiss,
|
||||
onDisable
|
||||
}) {
|
||||
const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null);
|
||||
const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => {
|
||||
if (!anchorParent.current) {
|
||||
@@ -725,10 +713,9 @@ function DotTip(_ref) {
|
||||
onClick: onDisable
|
||||
}));
|
||||
}
|
||||
/* harmony default export */ var dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
|
||||
let {
|
||||
tipId
|
||||
} = _ref2;
|
||||
/* harmony default export */ var dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, {
|
||||
tipId
|
||||
}) => {
|
||||
const {
|
||||
isTipVisible,
|
||||
getAssociatedGuide
|
||||
@@ -738,10 +725,9 @@ function DotTip(_ref) {
|
||||
isVisible: isTipVisible(tipId),
|
||||
hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
|
||||
};
|
||||
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
|
||||
let {
|
||||
tipId
|
||||
} = _ref3;
|
||||
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
|
||||
tipId
|
||||
}) => {
|
||||
const {
|
||||
dismissTip,
|
||||
disableTips
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{DotTip:function(){return P},store:function(){return m}});var t={};e.r(t),e.d(t,{disableTips:function(){return d},dismissTip:function(){return l},enableTips:function(){return p},triggerGuide:function(){return c}});var r={};e.r(r),e.d(r,{areTipsEnabled:function(){return T},getAssociatedGuide:function(){return h},isTipVisible:function(){return g}});var i=window.wp.deprecated,s=e.n(i),o=window.wp.data;const u=(0,o.combineReducers)({areTipsEnabled:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"DISABLE_TIPS":return!1;case"ENABLE_TIPS":return!0}return e},dismissedTips:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"DISMISS_TIP":return{...e,[n.id]:!0};case"ENABLE_TIPS":return{}}return e}});var a=(0,o.combineReducers)({guides:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return"TRIGGER_GUIDE"===n.type?[...e,n.tipIds]:e},preferences:u});function c(e){return{type:"TRIGGER_GUIDE",tipIds:e}}function l(e){return{type:"DISMISS_TIP",id:e}}function d(){return{type:"DISABLE_TIPS"}}function p(){return{type:"ENABLE_TIPS"}}var f={};function w(e){return[e]}function v(e,n,t){var r;if(e.length!==n.length)return!1;for(r=t;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}const h=function(e,n){var t,r=n||w;function i(e){var n,r,i,s,o,u=t,a=!0;for(n=0;n<e.length;n++){if(r=e[n],!(o=r)||"object"!=typeof o){a=!1;break}u.has(r)?u=u.get(r):(i=new WeakMap,u.set(r,i),u=i)}return u.has(f)||((s=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=a,u.set(f,s)),u.get(f)}function s(){t=new WeakMap}function o(){var n,t,s,o,u,a=arguments.length;for(o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];for((n=i(u=r.apply(null,o))).isUniqueByDependants||(n.lastDependants&&!v(u,n.lastDependants,0)&&n.clear(),n.lastDependants=u),t=n.head;t;){if(v(t.args,o,1))return t!==n.head&&(t.prev.next=t.next,t.next&&(t.next.prev=t.prev),t.next=n.head,t.prev=null,n.head.prev=t,n.head=t),t.val;t=t.next}return t={val:e.apply(null,o)},o[0]=null,t.args=o,n.head&&(n.head.prev=t,t.next=n.head),n.head=t,t.val}return o.getDependants=r,o.clear=s,s(),o}(((e,n)=>{for(const t of e.guides)if(t.includes(n)){const n=t.filter((n=>!Object.keys(e.preferences.dismissedTips).includes(n))),[r=null,i=null]=n;return{tipIds:t,currentTipId:r,nextTipId:i}}return null}),(e=>[e.guides,e.preferences.dismissedTips]));function g(e,n){var t;if(!e.preferences.areTipsEnabled)return!1;if(null!==(t=e.preferences.dismissedTips)&&void 0!==t&&t.hasOwnProperty(n))return!1;const r=h(e,n);return!r||r.currentTipId===n}function T(e){return e.preferences.areTipsEnabled}const b="core/nux",m=(0,o.createReduxStore)(b,{reducer:a,actions:t,selectors:r,persist:["preferences"]});(0,o.registerStore)(b,{reducer:a,actions:t,selectors:r,persist:["preferences"]});var I=window.wp.element,y=window.wp.compose,E=window.wp.components,S=window.wp.i18n,_=window.wp.primitives;var x=(0,I.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,I.createElement)(_.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function D(e){e.stopPropagation()}var P=(0,y.compose)((0,o.withSelect)(((e,n)=>{let{tipId:t}=n;const{isTipVisible:r,getAssociatedGuide:i}=e(m),s=i(t);return{isVisible:r(t),hasNextTip:!(!s||!s.nextTipId)}})),(0,o.withDispatch)(((e,n)=>{let{tipId:t}=n;const{dismissTip:r,disableTips:i}=e(m);return{onDismiss(){r(t)},onDisable(){i()}}})))((function(e){let{position:n="middle right",children:t,isVisible:r,hasNextTip:i,onDismiss:s,onDisable:o}=e;const u=(0,I.useRef)(null),a=(0,I.useCallback)((e=>{u.current&&(u.current.contains(e.relatedTarget)||o())}),[o,u]);return r?(0,I.createElement)(E.Popover,{className:"nux-dot-tip",position:n,focusOnMount:!0,role:"dialog","aria-label":(0,S.__)("Editor tips"),onClick:D,onFocusOutside:a},(0,I.createElement)("p",null,t),(0,I.createElement)("p",null,(0,I.createElement)(E.Button,{variant:"link",onClick:s},i?(0,S.__)("See next tip"):(0,S.__)("Got it"))),(0,I.createElement)(E.Button,{className:"nux-dot-tip__disable",icon:x,label:(0,S.__)("Disable tips"),onClick:o})):null}));s()("wp.nux",{since:"5.4",hint:"wp.components.Guide can be used to show a user guide.",version:"6.2"}),(window.wp=window.wp||{}).nux=n}();
|
||||
!function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{DotTip:function(){return P},store:function(){return g}});var t={};e.r(t),e.d(t,{disableTips:function(){return l},dismissTip:function(){return p},enableTips:function(){return d},triggerGuide:function(){return c}});var r={};e.r(r),e.d(r,{areTipsEnabled:function(){return h},getAssociatedGuide:function(){return v},isTipVisible:function(){return b}});var i=window.wp.deprecated,s=e.n(i),o=window.wp.data;const u=(0,o.combineReducers)({areTipsEnabled:function(e=!0,n){switch(n.type){case"DISABLE_TIPS":return!1;case"ENABLE_TIPS":return!0}return e},dismissedTips:function(e={},n){switch(n.type){case"DISMISS_TIP":return{...e,[n.id]:!0};case"ENABLE_TIPS":return{}}return e}});var a=(0,o.combineReducers)({guides:function(e=[],n){return"TRIGGER_GUIDE"===n.type?[...e,n.tipIds]:e},preferences:u});function c(e){return{type:"TRIGGER_GUIDE",tipIds:e}}function p(e){return{type:"DISMISS_TIP",id:e}}function l(){return{type:"DISABLE_TIPS"}}function d(){return{type:"ENABLE_TIPS"}}var f={};function w(e){return[e]}function T(e,n,t){var r;if(e.length!==n.length)return!1;for(r=t;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}const v=function(e,n){var t,r=n||w;function i(){t=new WeakMap}function s(){var n,i,s,o,u,a=arguments.length;for(o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];for(n=function(e){var n,r,i,s,o,u=t,a=!0;for(n=0;n<e.length;n++){if(!(o=r=e[n])||"object"!=typeof o){a=!1;break}u.has(r)?u=u.get(r):(i=new WeakMap,u.set(r,i),u=i)}return u.has(f)||((s=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=a,u.set(f,s)),u.get(f)}(u=r.apply(null,o)),n.isUniqueByDependants||(n.lastDependants&&!T(u,n.lastDependants,0)&&n.clear(),n.lastDependants=u),i=n.head;i;){if(T(i.args,o,1))return i!==n.head&&(i.prev.next=i.next,i.next&&(i.next.prev=i.prev),i.next=n.head,i.prev=null,n.head.prev=i,n.head=i),i.val;i=i.next}return i={val:e.apply(null,o)},o[0]=null,i.args=o,n.head&&(n.head.prev=i,i.next=n.head),n.head=i,i.val}return s.getDependants=r,s.clear=i,i(),s}(((e,n)=>{for(const t of e.guides)if(t.includes(n)){const n=t.filter((n=>!Object.keys(e.preferences.dismissedTips).includes(n))),[r=null,i=null]=n;return{tipIds:t,currentTipId:r,nextTipId:i}}return null}),(e=>[e.guides,e.preferences.dismissedTips]));function b(e,n){if(!e.preferences.areTipsEnabled)return!1;if(e.preferences.dismissedTips?.hasOwnProperty(n))return!1;const t=v(e,n);return!t||t.currentTipId===n}function h(e){return e.preferences.areTipsEnabled}const m="core/nux",g=(0,o.createReduxStore)(m,{reducer:a,actions:t,selectors:r,persist:["preferences"]});(0,o.registerStore)(m,{reducer:a,actions:t,selectors:r,persist:["preferences"]});var I=window.wp.element,y=window.wp.compose,E=window.wp.components,S=window.wp.i18n,_=window.wp.primitives;var x=(0,I.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,I.createElement)(_.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function D(e){e.stopPropagation()}var P=(0,y.compose)((0,o.withSelect)(((e,{tipId:n})=>{const{isTipVisible:t,getAssociatedGuide:r}=e(g),i=r(n);return{isVisible:t(n),hasNextTip:!(!i||!i.nextTipId)}})),(0,o.withDispatch)(((e,{tipId:n})=>{const{dismissTip:t,disableTips:r}=e(g);return{onDismiss(){t(n)},onDisable(){r()}}})))((function({position:e="middle right",children:n,isVisible:t,hasNextTip:r,onDismiss:i,onDisable:s}){const o=(0,I.useRef)(null),u=(0,I.useCallback)((e=>{o.current&&(o.current.contains(e.relatedTarget)||s())}),[s,o]);return t?(0,I.createElement)(E.Popover,{className:"nux-dot-tip",position:e,focusOnMount:!0,role:"dialog","aria-label":(0,S.__)("Editor tips"),onClick:D,onFocusOutside:u},(0,I.createElement)("p",null,n),(0,I.createElement)("p",null,(0,I.createElement)(E.Button,{variant:"link",onClick:i},r?(0,S.__)("See next tip"):(0,S.__)("Got it"))),(0,I.createElement)(E.Button,{className:"nux-dot-tip__disable",icon:x,label:(0,S.__)("Disable tips"),onClick:s})):null}));s()("wp.nux",{since:"5.4",hint:"wp.components.Guide can be used to show a user guide.",version:"6.2"}),(window.wp=window.wp||{}).nux=n}();
|
||||
Vendored
+242
-309
@@ -1,199 +1,7 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 9756:
|
||||
/***/ (function(module) {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Accepts a function to be memoized, and returns a new memoized function, with
|
||||
* optional options.
|
||||
*
|
||||
* @template {Function} F
|
||||
*
|
||||
* @param {F} fn Function to memoize.
|
||||
* @param {MemizeOptions} [options] Options object.
|
||||
*
|
||||
* @return {F & MemizeMemoizedFunction} Memoized function.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
if ( false ) {}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
module.exports = memize;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/ "use strict";
|
||||
/******/ // The require scope
|
||||
/******/ var __webpack_require__ = {};
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/compat get default export */
|
||||
@@ -238,9 +46,6 @@ module.exports = memize;
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
||||
!function() {
|
||||
"use strict";
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
@@ -256,37 +61,187 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","element"]
|
||||
var external_wp_element_namespaceObject = window["wp"]["element"];
|
||||
// EXTERNAL MODULE: ./node_modules/memize/index.js
|
||||
var memize = __webpack_require__(9756);
|
||||
var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
|
||||
;// 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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: external ["wp","hooks"]
|
||||
var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
||||
function _extends() {
|
||||
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
return _extends.apply(this, arguments);
|
||||
}
|
||||
;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
|
||||
var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
|
||||
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
|
||||
;// CONCATENATED MODULE: external ["wp","compose"]
|
||||
var external_wp_compose_namespaceObject = window["wp"]["compose"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
const {
|
||||
Consumer,
|
||||
Provider
|
||||
@@ -299,15 +254,17 @@ const {
|
||||
* A Higher Order Component used to inject Plugin context to the
|
||||
* wrapped component.
|
||||
*
|
||||
* @param {Function} mapContextToProps Function called on every context change,
|
||||
* expected to return object of props to
|
||||
* merge with the component's own props.
|
||||
* @param mapContextToProps Function called on every context change,
|
||||
* expected to return object of props to
|
||||
* merge with the component's own props.
|
||||
*
|
||||
* @return {WPComponent} Enhanced component with injected context as props.
|
||||
*/
|
||||
|
||||
const withPluginContext = mapContextToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
|
||||
return props => (0,external_wp_element_namespaceObject.createElement)(Consumer, null, context => (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, _extends({}, props, mapContextToProps(context, props))));
|
||||
return props => (0,external_wp_element_namespaceObject.createElement)(Consumer, null, context => (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, { ...props,
|
||||
...mapContextToProps(context, props)
|
||||
}));
|
||||
}, 'withPluginContext');
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-error-boundary/index.js
|
||||
@@ -316,6 +273,9 @@ const withPluginContext = mapContextToProps => (0,external_wp_compose_namespaceO
|
||||
*/
|
||||
|
||||
class PluginErrorBoundary extends external_wp_element_namespaceObject.Component {
|
||||
/**
|
||||
* @param {Object} props
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -328,6 +288,10 @@ class PluginErrorBoundary extends external_wp_element_namespaceObject.Component
|
||||
hasError: true
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {Error} error Error object passed by React.
|
||||
*/
|
||||
|
||||
|
||||
componentDidCatch(error) {
|
||||
const {
|
||||
@@ -375,36 +339,17 @@ const plugins = (0,external_wp_element_namespaceObject.createElement)(external_w
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Defined behavior of a plugin type.
|
||||
*
|
||||
* @typedef {Object} WPPlugin
|
||||
*
|
||||
* @property {string} name A string identifying the plugin. Must be
|
||||
* unique across all registered plugins.
|
||||
* @property {string|WPElement|Function} [icon] An icon to be shown in the UI. It can
|
||||
* be a slug of the Dashicon, or an element
|
||||
* (or function returning an element) if you
|
||||
* choose to render your own SVG.
|
||||
* @property {Function} render A component containing the UI elements
|
||||
* to be rendered.
|
||||
* @property {string} [scope] The optional scope to be used when rendering inside
|
||||
* a plugin area. No scope by default.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin definitions keyed by plugin name.
|
||||
*
|
||||
* @type {Object.<string,WPPlugin>}
|
||||
*/
|
||||
|
||||
const api_plugins = {};
|
||||
/**
|
||||
* Registers a plugin to the editor.
|
||||
*
|
||||
* @param {string} name A string identifying the plugin.Must be
|
||||
* unique across all registered plugins.
|
||||
* @param {Omit<WPPlugin, 'name'>} settings The settings for this plugin.
|
||||
* @param name A string identifying the plugin. Must be
|
||||
* unique across all registered plugins.
|
||||
* @param settings The settings for this plugin.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
@@ -474,7 +419,7 @@ const api_plugins = {};
|
||||
* } );
|
||||
* ```
|
||||
*
|
||||
* @return {WPPlugin} The final plugin settings object.
|
||||
* @return The final plugin settings object.
|
||||
*/
|
||||
|
||||
function registerPlugin(name, settings) {
|
||||
@@ -531,7 +476,7 @@ function registerPlugin(name, settings) {
|
||||
/**
|
||||
* Unregisters a plugin by name.
|
||||
*
|
||||
* @param {string} name Plugin name.
|
||||
* @param name Plugin name.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
@@ -549,8 +494,8 @@ function registerPlugin(name, settings) {
|
||||
* unregisterPlugin( 'plugin-name' );
|
||||
* ```
|
||||
*
|
||||
* @return {WPPlugin | undefined} The previous plugin settings object, if it has been
|
||||
* successfully unregistered; otherwise `undefined`.
|
||||
* @return The previous plugin settings object, if it has been
|
||||
* successfully unregistered; otherwise `undefined`.
|
||||
*/
|
||||
|
||||
function unregisterPlugin(name) {
|
||||
@@ -567,9 +512,9 @@ function unregisterPlugin(name) {
|
||||
/**
|
||||
* Returns a registered plugin settings.
|
||||
*
|
||||
* @param {string} name Plugin name.
|
||||
* @param name Plugin name.
|
||||
*
|
||||
* @return {?WPPlugin} Plugin setting.
|
||||
* @return Plugin setting.
|
||||
*/
|
||||
|
||||
function getPlugin(name) {
|
||||
@@ -578,10 +523,10 @@ function getPlugin(name) {
|
||||
/**
|
||||
* Returns all registered plugins without a scope or for a given scope.
|
||||
*
|
||||
* @param {string} [scope] The scope to be used when rendering inside
|
||||
* a plugin area. No scope by default.
|
||||
* @param scope The scope to be used when rendering inside
|
||||
* a plugin area. No scope by default.
|
||||
*
|
||||
* @return {WPPlugin[]} The list of plugins without a scope or for a given scope.
|
||||
* @return The list of plugins without a scope or for a given scope.
|
||||
*/
|
||||
|
||||
function getPlugins(scope) {
|
||||
@@ -601,6 +546,7 @@ function getPlugins(scope) {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
@@ -608,9 +554,16 @@ function getPlugins(scope) {
|
||||
|
||||
|
||||
|
||||
const getPluginContext = memize((icon, name) => ({
|
||||
icon,
|
||||
name
|
||||
}));
|
||||
/**
|
||||
* A component that renders all plugin fills in a hidden div.
|
||||
*
|
||||
* @param props
|
||||
* @param props.scope
|
||||
* @param props.onError
|
||||
* @example
|
||||
* ```js
|
||||
* // Using ES5 syntax
|
||||
@@ -643,69 +596,50 @@ function getPlugins(scope) {
|
||||
* @return {WPComponent} The component to be rendered.
|
||||
*/
|
||||
|
||||
class PluginArea extends external_wp_element_namespaceObject.Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.setPlugins = this.setPlugins.bind(this);
|
||||
this.memoizedContext = memize_default()((name, icon) => {
|
||||
return {
|
||||
name,
|
||||
icon
|
||||
};
|
||||
});
|
||||
this.state = this.getCurrentPluginsState();
|
||||
}
|
||||
|
||||
getCurrentPluginsState() {
|
||||
function PluginArea({
|
||||
scope,
|
||||
onError
|
||||
}) {
|
||||
const store = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
let lastValue = [];
|
||||
return {
|
||||
plugins: getPlugins(this.props.scope).map(_ref => {
|
||||
let {
|
||||
icon,
|
||||
name,
|
||||
render
|
||||
} = _ref;
|
||||
return {
|
||||
Plugin: render,
|
||||
context: this.memoizedContext(name, icon)
|
||||
subscribe(listener) {
|
||||
(0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', listener);
|
||||
(0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', listener);
|
||||
return () => {
|
||||
(0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered');
|
||||
(0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered');
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
(0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins);
|
||||
(0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins);
|
||||
}
|
||||
getValue() {
|
||||
const nextValue = getPlugins(scope);
|
||||
|
||||
componentWillUnmount() {
|
||||
(0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered');
|
||||
(0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered');
|
||||
}
|
||||
if (!external_wp_isShallowEqual_default()(lastValue, nextValue)) {
|
||||
lastValue = nextValue;
|
||||
}
|
||||
|
||||
setPlugins() {
|
||||
this.setState(this.getCurrentPluginsState);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
||||
style: {
|
||||
display: 'none'
|
||||
return lastValue;
|
||||
}
|
||||
}, this.state.plugins.map(_ref2 => {
|
||||
let {
|
||||
context,
|
||||
Plugin
|
||||
} = _ref2;
|
||||
return (0,external_wp_element_namespaceObject.createElement)(Provider, {
|
||||
key: context.name,
|
||||
value: context
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(PluginErrorBoundary, {
|
||||
name: context.name,
|
||||
onError: this.props.onError
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(Plugin, null)));
|
||||
}));
|
||||
}
|
||||
|
||||
};
|
||||
}, [scope]);
|
||||
const plugins = (0,external_wp_element_namespaceObject.useSyncExternalStore)(store.subscribe, store.getValue);
|
||||
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
||||
style: {
|
||||
display: 'none'
|
||||
}
|
||||
}, plugins.map(({
|
||||
icon,
|
||||
name,
|
||||
render: Plugin
|
||||
}) => (0,external_wp_element_namespaceObject.createElement)(Provider, {
|
||||
key: name,
|
||||
value: getPluginContext(icon, name)
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(PluginErrorBoundary, {
|
||||
name: name,
|
||||
onError: onError
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(Plugin, null)))));
|
||||
}
|
||||
|
||||
/* harmony default export */ var plugin_area = (PluginArea);
|
||||
@@ -718,7 +652,6 @@ class PluginArea extends external_wp_element_namespaceObject.Component {
|
||||
|
||||
|
||||
|
||||
}();
|
||||
(window.wp = window.wp || {}).plugins = __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){var e={9756:function(e){e.exports=function(e,n){var t,r,i=0;function o(){var o,u,s=t,l=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(u=0;u<l;u++)if(s.args[u]!==arguments[u]){s=s.next;continue e}return s!==t&&(s===r&&(r=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=t,s.prev=null,t.prev=s,t=s),s.val}s=s.next}for(o=new Array(l),u=0;u<l;u++)o[u]=arguments[u];return s={args:o,val:e.apply(null,o)},t?(t.prev=s,s.next=t):r=s,i===n.maxSize?(r=r.prev).next=null:i++,t=s,s.val}return n=n||{},o.clear=function(){t=null,r=null,i=0},o}}},n={};function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},t.d=function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){"use strict";t.r(r),t.d(r,{PluginArea:function(){return x},getPlugin:function(){return h},getPlugins:function(){return w},registerPlugin:function(){return f},unregisterPlugin:function(){return v},withPluginContext:function(){return c}});var e=window.wp.element,n=t(9756),i=t.n(n),o=window.wp.hooks;function u(){return u=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u.apply(this,arguments)}var s=window.wp.compose;const{Consumer:l,Provider:a}=(0,e.createContext)({name:null,icon:null}),c=n=>(0,s.createHigherOrderComponent)((t=>r=>(0,e.createElement)(l,null,(i=>(0,e.createElement)(t,u({},r,n(i,r)))))),"withPluginContext");class p extends e.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){const{name:n,onError:t}=this.props;t&&t(n,e)}render(){return this.state.hasError?null:this.props.children}}var g=window.wp.primitives;var d=(0,e.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(g.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"}));const m={};function f(e,n){if("object"!=typeof n)return console.error("No settings object provided!"),null;if("string"!=typeof e)return console.error("Plugin name must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(e))return console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".'),null;m[e]&&console.error(`Plugin "${e}" is already registered.`),n=(0,o.applyFilters)("plugins.registerPlugin",n,e);const{render:t,scope:r}=n;if("function"!=typeof t)return console.error('The "render" property must be specified and must be a valid function.'),null;if(r){if("string"!=typeof r)return console.error("Plugin scope must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(r))return console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".'),null}return m[e]={name:e,icon:d,...n},(0,o.doAction)("plugins.pluginRegistered",n,e),n}function v(e){if(!m[e])return void console.error('Plugin "'+e+'" is not registered.');const n=m[e];return delete m[e],(0,o.doAction)("plugins.pluginUnregistered",n,e),n}function h(e){return m[e]}function w(e){return Object.values(m).filter((n=>n.scope===e))}class P extends e.Component{constructor(){super(...arguments),this.setPlugins=this.setPlugins.bind(this),this.memoizedContext=i()(((e,n)=>({name:e,icon:n}))),this.state=this.getCurrentPluginsState()}getCurrentPluginsState(){return{plugins:w(this.props.scope).map((e=>{let{icon:n,name:t,render:r}=e;return{Plugin:r,context:this.memoizedContext(t,n)}}))}}componentDidMount(){(0,o.addAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered",this.setPlugins),(0,o.addAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered",this.setPlugins)}componentWillUnmount(){(0,o.removeAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered"),(0,o.removeAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered")}setPlugins(){this.setState(this.getCurrentPluginsState)}render(){return(0,e.createElement)("div",{style:{display:"none"}},this.state.plugins.map((n=>{let{context:t,Plugin:r}=n;return(0,e.createElement)(a,{key:t.name,value:t},(0,e.createElement)(p,{name:t.name,onError:this.props.onError},(0,e.createElement)(r,null)))})))}}var x=P}(),(window.wp=window.wp||{}).plugins=r}();
|
||||
!function(){"use strict";var e={n:function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(r,{a:r}),r},d:function(n,r){for(var t in r)e.o(r,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:r[t]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{PluginArea:function(){return y},getPlugin:function(){return v},getPlugins:function(){return w},registerPlugin:function(){return f},unregisterPlugin:function(){return m},withPluginContext:function(){return a}});var r=window.wp.element;var t=window.wp.hooks,o=window.wp.isShallowEqual,i=e.n(o),l=window.wp.compose;const{Consumer:u,Provider:s}=(0,r.createContext)({name:null,icon:null}),a=e=>(0,l.createHigherOrderComponent)((n=>t=>(0,r.createElement)(u,null,(o=>(0,r.createElement)(n,{...t,...e(o,t)})))),"withPluginContext");class c extends r.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){const{name:n,onError:r}=this.props;r&&r(n,e)}render(){return this.state.hasError?null:this.props.children}}var p=window.wp.primitives;var g=(0,r.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(p.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"}));const d={};function f(e,n){if("object"!=typeof n)return console.error("No settings object provided!"),null;if("string"!=typeof e)return console.error("Plugin name must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(e))return console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".'),null;d[e]&&console.error(`Plugin "${e}" is already registered.`),n=(0,t.applyFilters)("plugins.registerPlugin",n,e);const{render:r,scope:o}=n;if("function"!=typeof r)return console.error('The "render" property must be specified and must be a valid function.'),null;if(o){if("string"!=typeof o)return console.error("Plugin scope must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(o))return console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".'),null}return d[e]={name:e,icon:g,...n},(0,t.doAction)("plugins.pluginRegistered",n,e),n}function m(e){if(!d[e])return void console.error('Plugin "'+e+'" is not registered.');const n=d[e];return delete d[e],(0,t.doAction)("plugins.pluginUnregistered",n,e),n}function v(e){return d[e]}function w(e){return Object.values(d).filter((n=>n.scope===e))}const h=function(e,n){var r,t,o=0;function i(){var i,l,u=r,s=arguments.length;e:for(;u;){if(u.args.length===arguments.length){for(l=0;l<s;l++)if(u.args[l]!==arguments[l]){u=u.next;continue e}return u!==r&&(u===t&&(t=u.prev),u.prev.next=u.next,u.next&&(u.next.prev=u.prev),u.next=r,u.prev=null,r.prev=u,r=u),u.val}u=u.next}for(i=new Array(s),l=0;l<s;l++)i[l]=arguments[l];return u={args:i,val:e.apply(null,i)},r?(r.prev=u,u.next=r):t=u,o===n.maxSize?(t=t.prev).next=null:o++,r=u,u.val}return n=n||{},i.clear=function(){r=null,t=null,o=0},i}(((e,n)=>({icon:e,name:n})));var y=function({scope:e,onError:n}){const o=(0,r.useMemo)((()=>{let n=[];return{subscribe(e){return(0,t.addAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered",e),(0,t.addAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered",e),()=>{(0,t.removeAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered"),(0,t.removeAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered")}},getValue(){const r=w(e);return i()(n,r)||(n=r),n}}}),[e]),l=(0,r.useSyncExternalStore)(o.subscribe,o.getValue);return(0,r.createElement)("div",{style:{display:"none"}},l.map((({icon:e,name:t,render:o})=>(0,r.createElement)(s,{key:t,value:h(e,t)},(0,r.createElement)(c,{name:t,onError:n},(0,r.createElement)(o,null))))))};(window.wp=window.wp||{}).plugins=n}();
|
||||
+50
-77
@@ -79,18 +79,14 @@ var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_w
|
||||
function debounceAsync(func, delayMS) {
|
||||
let timeoutId;
|
||||
let activePromise;
|
||||
return async function debounced() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return async function debounced(...args) {
|
||||
// This is a leading edge debounce. If there's no promise or timeout
|
||||
// in progress, call the debounced function immediately.
|
||||
if (!activePromise && !timeoutId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Keep a reference to the promise.
|
||||
activePromise = func(...args).then(function () {
|
||||
resolve(...arguments);
|
||||
activePromise = func(...args).then((...thenArgs) => {
|
||||
resolve(...thenArgs);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
}).finally(() => {
|
||||
@@ -117,8 +113,8 @@ function debounceAsync(func, delayMS) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Schedule the next request but with a delay.
|
||||
timeoutId = setTimeout(() => {
|
||||
activePromise = func(...args).then(function () {
|
||||
resolve(...arguments);
|
||||
activePromise = func(...args).then((...thenArgs) => {
|
||||
resolve(...thenArgs);
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
}).finally(() => {
|
||||
@@ -162,18 +158,15 @@ const localStorage = window.localStorage;
|
||||
* @return {Object} A persistence layer for WordPress user meta.
|
||||
*/
|
||||
|
||||
function create() {
|
||||
let {
|
||||
preloadedData,
|
||||
localStorageRestoreKey = 'WP_PREFERENCES_RESTORE_DATA',
|
||||
requestDebounceMS = 2500
|
||||
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
function create({
|
||||
preloadedData,
|
||||
localStorageRestoreKey = 'WP_PREFERENCES_RESTORE_DATA',
|
||||
requestDebounceMS = 2500
|
||||
} = {}) {
|
||||
let cache = preloadedData;
|
||||
const debouncedApiFetch = debounceAsync((external_wp_apiFetch_default()), requestDebounceMS);
|
||||
|
||||
async function get() {
|
||||
var _user$meta;
|
||||
|
||||
if (cache) {
|
||||
return cache;
|
||||
}
|
||||
@@ -181,12 +174,12 @@ function create() {
|
||||
const user = await external_wp_apiFetch_default()({
|
||||
path: '/wp/v2/users/me?context=edit'
|
||||
});
|
||||
const serverData = user === null || user === void 0 ? void 0 : (_user$meta = user.meta) === null || _user$meta === void 0 ? void 0 : _user$meta.persisted_preferences;
|
||||
const serverData = user?.meta?.persisted_preferences;
|
||||
const localData = JSON.parse(localStorage.getItem(localStorageRestoreKey)); // Date parse returns NaN for invalid input. Coerce anything invalid
|
||||
// into a conveniently comparable zero.
|
||||
|
||||
const serverTimestamp = Date.parse(serverData === null || serverData === void 0 ? void 0 : serverData._modified) || 0;
|
||||
const localTimestamp = Date.parse(localData === null || localData === void 0 ? void 0 : localData._modified) || 0; // Prefer server data if it exists and is more recent.
|
||||
const serverTimestamp = Date.parse(serverData?._modified) || 0;
|
||||
const localTimestamp = Date.parse(localData?._modified) || 0; // Prefer server data if it exists and is more recent.
|
||||
// Otherwise fallback to localStorage data.
|
||||
|
||||
if (serverData && serverTimestamp >= localTimestamp) {
|
||||
@@ -296,35 +289,31 @@ function create() {
|
||||
* @return {Object} The migrated state
|
||||
*/
|
||||
function moveFeaturePreferences(state, sourceStoreName) {
|
||||
var _state$interfaceStore, _state$interfaceStore2, _state$interfaceStore3, _state$sourceStoreNam, _state$sourceStoreNam2, _state$preferencesSto;
|
||||
|
||||
const preferencesStoreName = 'core/preferences';
|
||||
const interfaceStoreName = 'core/interface'; // Features most recently (and briefly) lived in the interface package.
|
||||
// If data exists there, prioritize using that for the migration. If not
|
||||
// also check the original package as the user may have updated from an
|
||||
// older block editor version.
|
||||
|
||||
const interfaceFeatures = state === null || state === void 0 ? void 0 : (_state$interfaceStore = state[interfaceStoreName]) === null || _state$interfaceStore === void 0 ? void 0 : (_state$interfaceStore2 = _state$interfaceStore.preferences) === null || _state$interfaceStore2 === void 0 ? void 0 : (_state$interfaceStore3 = _state$interfaceStore2.features) === null || _state$interfaceStore3 === void 0 ? void 0 : _state$interfaceStore3[sourceStoreName];
|
||||
const sourceFeatures = state === null || state === void 0 ? void 0 : (_state$sourceStoreNam = state[sourceStoreName]) === null || _state$sourceStoreNam === void 0 ? void 0 : (_state$sourceStoreNam2 = _state$sourceStoreNam.preferences) === null || _state$sourceStoreNam2 === void 0 ? void 0 : _state$sourceStoreNam2.features;
|
||||
const interfaceFeatures = state?.[interfaceStoreName]?.preferences?.features?.[sourceStoreName];
|
||||
const sourceFeatures = state?.[sourceStoreName]?.preferences?.features;
|
||||
const featuresToMigrate = interfaceFeatures ? interfaceFeatures : sourceFeatures;
|
||||
|
||||
if (!featuresToMigrate) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const existingPreferences = state === null || state === void 0 ? void 0 : (_state$preferencesSto = state[preferencesStoreName]) === null || _state$preferencesSto === void 0 ? void 0 : _state$preferencesSto.preferences; // Avoid migrating features again if they've previously been migrated.
|
||||
const existingPreferences = state?.[preferencesStoreName]?.preferences; // Avoid migrating features again if they've previously been migrated.
|
||||
|
||||
if (existingPreferences !== null && existingPreferences !== void 0 && existingPreferences[sourceStoreName]) {
|
||||
if (existingPreferences?.[sourceStoreName]) {
|
||||
return state;
|
||||
}
|
||||
|
||||
let updatedInterfaceState;
|
||||
|
||||
if (interfaceFeatures) {
|
||||
var _state$interfaceStore4, _state$interfaceStore5;
|
||||
|
||||
const otherInterfaceState = state === null || state === void 0 ? void 0 : state[interfaceStoreName];
|
||||
const otherInterfaceScopes = state === null || state === void 0 ? void 0 : (_state$interfaceStore4 = state[interfaceStoreName]) === null || _state$interfaceStore4 === void 0 ? void 0 : (_state$interfaceStore5 = _state$interfaceStore4.preferences) === null || _state$interfaceStore5 === void 0 ? void 0 : _state$interfaceStore5.features;
|
||||
const otherInterfaceState = state?.[interfaceStoreName];
|
||||
const otherInterfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
|
||||
updatedInterfaceState = {
|
||||
[interfaceStoreName]: { ...otherInterfaceState,
|
||||
preferences: {
|
||||
@@ -339,10 +328,8 @@ function moveFeaturePreferences(state, sourceStoreName) {
|
||||
let updatedSourceState;
|
||||
|
||||
if (sourceFeatures) {
|
||||
var _state$sourceStoreNam3;
|
||||
|
||||
const otherSourceState = state === null || state === void 0 ? void 0 : state[sourceStoreName];
|
||||
const sourcePreferences = state === null || state === void 0 ? void 0 : (_state$sourceStoreNam3 = state[sourceStoreName]) === null || _state$sourceStoreNam3 === void 0 ? void 0 : _state$sourceStoreNam3.preferences;
|
||||
const otherSourceState = state?.[sourceStoreName];
|
||||
const sourcePreferences = state?.[sourceStoreName]?.preferences;
|
||||
updatedSourceState = {
|
||||
[sourceStoreName]: { ...otherSourceState,
|
||||
preferences: { ...sourcePreferences,
|
||||
@@ -409,39 +396,35 @@ function moveFeaturePreferences(state, sourceStoreName) {
|
||||
* preferences data structure.
|
||||
*/
|
||||
function moveThirdPartyFeaturePreferencesToPreferences(state) {
|
||||
var _state$interfaceStore, _state$interfaceStore2;
|
||||
|
||||
const interfaceStoreName = 'core/interface';
|
||||
const preferencesStoreName = 'core/preferences';
|
||||
const interfaceScopes = state === null || state === void 0 ? void 0 : (_state$interfaceStore = state[interfaceStoreName]) === null || _state$interfaceStore === void 0 ? void 0 : (_state$interfaceStore2 = _state$interfaceStore.preferences) === null || _state$interfaceStore2 === void 0 ? void 0 : _state$interfaceStore2.features;
|
||||
const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
|
||||
const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
|
||||
|
||||
if (!(interfaceScopeKeys !== null && interfaceScopeKeys !== void 0 && interfaceScopeKeys.length)) {
|
||||
if (!interfaceScopeKeys?.length) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return interfaceScopeKeys.reduce(function (convertedState, scope) {
|
||||
var _convertedState$prefe, _convertedState$prefe2, _convertedState$prefe3, _convertedState$inter, _convertedState$inter2;
|
||||
|
||||
if (scope.startsWith('core')) {
|
||||
return convertedState;
|
||||
}
|
||||
|
||||
const featuresToMigrate = interfaceScopes === null || interfaceScopes === void 0 ? void 0 : interfaceScopes[scope];
|
||||
const featuresToMigrate = interfaceScopes?.[scope];
|
||||
|
||||
if (!featuresToMigrate) {
|
||||
return convertedState;
|
||||
}
|
||||
|
||||
const existingMigratedData = convertedState === null || convertedState === void 0 ? void 0 : (_convertedState$prefe = convertedState[preferencesStoreName]) === null || _convertedState$prefe === void 0 ? void 0 : (_convertedState$prefe2 = _convertedState$prefe.preferences) === null || _convertedState$prefe2 === void 0 ? void 0 : _convertedState$prefe2[scope];
|
||||
const existingMigratedData = convertedState?.[preferencesStoreName]?.preferences?.[scope];
|
||||
|
||||
if (existingMigratedData) {
|
||||
return convertedState;
|
||||
}
|
||||
|
||||
const otherPreferencesScopes = convertedState === null || convertedState === void 0 ? void 0 : (_convertedState$prefe3 = convertedState[preferencesStoreName]) === null || _convertedState$prefe3 === void 0 ? void 0 : _convertedState$prefe3.preferences;
|
||||
const otherInterfaceState = convertedState === null || convertedState === void 0 ? void 0 : convertedState[interfaceStoreName];
|
||||
const otherInterfaceScopes = convertedState === null || convertedState === void 0 ? void 0 : (_convertedState$inter = convertedState[interfaceStoreName]) === null || _convertedState$inter === void 0 ? void 0 : (_convertedState$inter2 = _convertedState$inter.preferences) === null || _convertedState$inter2 === void 0 ? void 0 : _convertedState$inter2.features;
|
||||
const otherPreferencesScopes = convertedState?.[preferencesStoreName]?.preferences;
|
||||
const otherInterfaceState = convertedState?.[interfaceStoreName];
|
||||
const otherInterfaceScopes = convertedState?.[interfaceStoreName]?.preferences?.features;
|
||||
return { ...convertedState,
|
||||
[preferencesStoreName]: {
|
||||
preferences: { ...otherPreferencesScopes,
|
||||
@@ -498,31 +481,27 @@ const identity = arg => arg;
|
||||
*/
|
||||
|
||||
|
||||
function moveIndividualPreferenceToPreferences(state, _ref, key) {
|
||||
var _state$sourceStoreNam, _state$sourceStoreNam2, _state$preferencesSto, _state$preferencesSto2, _state$preferencesSto3, _state$preferencesSto4, _state$preferencesSto5, _state$preferencesSto6, _state$sourceStoreNam3;
|
||||
|
||||
let {
|
||||
from: sourceStoreName,
|
||||
to: scope
|
||||
} = _ref;
|
||||
let convert = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : identity;
|
||||
function moveIndividualPreferenceToPreferences(state, {
|
||||
from: sourceStoreName,
|
||||
to: scope
|
||||
}, key, convert = identity) {
|
||||
const preferencesStoreName = 'core/preferences';
|
||||
const sourcePreference = state === null || state === void 0 ? void 0 : (_state$sourceStoreNam = state[sourceStoreName]) === null || _state$sourceStoreNam === void 0 ? void 0 : (_state$sourceStoreNam2 = _state$sourceStoreNam.preferences) === null || _state$sourceStoreNam2 === void 0 ? void 0 : _state$sourceStoreNam2[key]; // There's nothing to migrate, exit early.
|
||||
const sourcePreference = state?.[sourceStoreName]?.preferences?.[key]; // There's nothing to migrate, exit early.
|
||||
|
||||
if (sourcePreference === undefined) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const targetPreference = state === null || state === void 0 ? void 0 : (_state$preferencesSto = state[preferencesStoreName]) === null || _state$preferencesSto === void 0 ? void 0 : (_state$preferencesSto2 = _state$preferencesSto.preferences) === null || _state$preferencesSto2 === void 0 ? void 0 : (_state$preferencesSto3 = _state$preferencesSto2[scope]) === null || _state$preferencesSto3 === void 0 ? void 0 : _state$preferencesSto3[key]; // There's existing data at the target, so don't overwrite it, exit early.
|
||||
const targetPreference = state?.[preferencesStoreName]?.preferences?.[scope]?.[key]; // There's existing data at the target, so don't overwrite it, exit early.
|
||||
|
||||
if (targetPreference) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const otherScopes = state === null || state === void 0 ? void 0 : (_state$preferencesSto4 = state[preferencesStoreName]) === null || _state$preferencesSto4 === void 0 ? void 0 : _state$preferencesSto4.preferences;
|
||||
const otherPreferences = state === null || state === void 0 ? void 0 : (_state$preferencesSto5 = state[preferencesStoreName]) === null || _state$preferencesSto5 === void 0 ? void 0 : (_state$preferencesSto6 = _state$preferencesSto5.preferences) === null || _state$preferencesSto6 === void 0 ? void 0 : _state$preferencesSto6[scope];
|
||||
const otherSourceState = state === null || state === void 0 ? void 0 : state[sourceStoreName];
|
||||
const allSourcePreferences = state === null || state === void 0 ? void 0 : (_state$sourceStoreNam3 = state[sourceStoreName]) === null || _state$sourceStoreNam3 === void 0 ? void 0 : _state$sourceStoreNam3.preferences; // Pass an object with the key and value as this allows the convert
|
||||
const otherScopes = state?.[preferencesStoreName]?.preferences;
|
||||
const otherPreferences = state?.[preferencesStoreName]?.preferences?.[scope];
|
||||
const otherSourceState = state?.[sourceStoreName];
|
||||
const allSourcePreferences = state?.[sourceStoreName]?.preferences; // Pass an object with the key and value as this allows the convert
|
||||
// function to convert to a data structure that has different keys.
|
||||
|
||||
const convertedPreferences = convert({
|
||||
@@ -593,27 +572,25 @@ function moveIndividualPreferenceToPreferences(state, _ref, key) {
|
||||
* @param {Object} state The local storage state.
|
||||
*/
|
||||
function moveInterfaceEnableItems(state) {
|
||||
var _state$interfaceStore, _state$preferencesSto, _state$preferencesSto2, _sourceEnableItems$si, _sourceEnableItems$si2, _sourceEnableItems$mu, _sourceEnableItems$mu2;
|
||||
var _state$preferencesSto, _sourceEnableItems$si, _sourceEnableItems$mu;
|
||||
|
||||
const interfaceStoreName = 'core/interface';
|
||||
const preferencesStoreName = 'core/preferences';
|
||||
const sourceEnableItems = state === null || state === void 0 ? void 0 : (_state$interfaceStore = state[interfaceStoreName]) === null || _state$interfaceStore === void 0 ? void 0 : _state$interfaceStore.enableItems; // There's nothing to migrate, exit early.
|
||||
const sourceEnableItems = state?.[interfaceStoreName]?.enableItems; // There's nothing to migrate, exit early.
|
||||
|
||||
if (!sourceEnableItems) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const allPreferences = (_state$preferencesSto = state === null || state === void 0 ? void 0 : (_state$preferencesSto2 = state[preferencesStoreName]) === null || _state$preferencesSto2 === void 0 ? void 0 : _state$preferencesSto2.preferences) !== null && _state$preferencesSto !== void 0 ? _state$preferencesSto : {}; // First convert complementaryAreas into the right format.
|
||||
const allPreferences = (_state$preferencesSto = state?.[preferencesStoreName]?.preferences) !== null && _state$preferencesSto !== void 0 ? _state$preferencesSto : {}; // First convert complementaryAreas into the right format.
|
||||
// Use the existing preferences as the accumulator so that the data is
|
||||
// merged.
|
||||
|
||||
const sourceComplementaryAreas = (_sourceEnableItems$si = sourceEnableItems === null || sourceEnableItems === void 0 ? void 0 : (_sourceEnableItems$si2 = sourceEnableItems.singleEnableItems) === null || _sourceEnableItems$si2 === void 0 ? void 0 : _sourceEnableItems$si2.complementaryArea) !== null && _sourceEnableItems$si !== void 0 ? _sourceEnableItems$si : {};
|
||||
const sourceComplementaryAreas = (_sourceEnableItems$si = sourceEnableItems?.singleEnableItems?.complementaryArea) !== null && _sourceEnableItems$si !== void 0 ? _sourceEnableItems$si : {};
|
||||
const preferencesWithConvertedComplementaryAreas = Object.keys(sourceComplementaryAreas).reduce((accumulator, scope) => {
|
||||
var _accumulator$scope;
|
||||
|
||||
const data = sourceComplementaryAreas[scope]; // Don't overwrite any existing data in the preferences store.
|
||||
|
||||
if (accumulator !== null && accumulator !== void 0 && (_accumulator$scope = accumulator[scope]) !== null && _accumulator$scope !== void 0 && _accumulator$scope.complementaryArea) {
|
||||
if (accumulator?.[scope]?.complementaryArea) {
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
@@ -625,13 +602,11 @@ function moveInterfaceEnableItems(state) {
|
||||
}, allPreferences); // Next feed the converted complementary areas back into a reducer that
|
||||
// converts the pinned items, resulting in the fully migrated data.
|
||||
|
||||
const sourcePinnedItems = (_sourceEnableItems$mu = sourceEnableItems === null || sourceEnableItems === void 0 ? void 0 : (_sourceEnableItems$mu2 = sourceEnableItems.multipleEnableItems) === null || _sourceEnableItems$mu2 === void 0 ? void 0 : _sourceEnableItems$mu2.pinnedItems) !== null && _sourceEnableItems$mu !== void 0 ? _sourceEnableItems$mu : {};
|
||||
const sourcePinnedItems = (_sourceEnableItems$mu = sourceEnableItems?.multipleEnableItems?.pinnedItems) !== null && _sourceEnableItems$mu !== void 0 ? _sourceEnableItems$mu : {};
|
||||
const allConvertedData = Object.keys(sourcePinnedItems).reduce((accumulator, scope) => {
|
||||
var _accumulator$scope2;
|
||||
|
||||
const data = sourcePinnedItems[scope]; // Don't overwrite any existing data in the preferences store.
|
||||
|
||||
if (accumulator !== null && accumulator !== void 0 && (_accumulator$scope2 = accumulator[scope]) !== null && _accumulator$scope2 !== void 0 && _accumulator$scope2.pinnedItems) {
|
||||
if (accumulator?.[scope]?.pinnedItems) {
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
@@ -687,15 +662,15 @@ function moveInterfaceEnableItems(state) {
|
||||
function convertEditPostPanels(preferences) {
|
||||
var _preferences$panels;
|
||||
|
||||
const panels = (_preferences$panels = preferences === null || preferences === void 0 ? void 0 : preferences.panels) !== null && _preferences$panels !== void 0 ? _preferences$panels : {};
|
||||
const panels = (_preferences$panels = preferences?.panels) !== null && _preferences$panels !== void 0 ? _preferences$panels : {};
|
||||
return Object.keys(panels).reduce((convertedData, panelName) => {
|
||||
const panel = panels[panelName];
|
||||
|
||||
if ((panel === null || panel === void 0 ? void 0 : panel.enabled) === false) {
|
||||
if (panel?.enabled === false) {
|
||||
convertedData.inactivePanels.push(panelName);
|
||||
}
|
||||
|
||||
if ((panel === null || panel === void 0 ? void 0 : panel.opened) === true) {
|
||||
if (panel?.opened === true) {
|
||||
convertedData.openPanels.push(panelName);
|
||||
}
|
||||
|
||||
@@ -739,8 +714,6 @@ function getLegacyData(userId) {
|
||||
|
||||
|
||||
function convertLegacyData(data) {
|
||||
var _data, _data$corePreference;
|
||||
|
||||
if (!data) {
|
||||
return;
|
||||
} // Move boolean feature preferences from each editor into the
|
||||
@@ -785,7 +758,7 @@ function convertLegacyData(data) {
|
||||
}, 'editorMode'); // The new system is only concerned with persisting
|
||||
// 'core/preferences' preferences reducer, so only return that.
|
||||
|
||||
return (_data = data) === null || _data === void 0 ? void 0 : (_data$corePreference = _data['core/preferences']) === null || _data$corePreference === void 0 ? void 0 : _data$corePreference.preferences;
|
||||
return data?.['core/preferences']?.preferences;
|
||||
}
|
||||
/**
|
||||
* Gets the legacy local storage data for the given user and returns the
|
||||
@@ -807,7 +780,7 @@ function convertComplementaryAreas(state) {
|
||||
return Object.keys(state).reduce((stateAccumulator, scope) => {
|
||||
const scopeData = state[scope]; // If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.
|
||||
|
||||
if (scopeData !== null && scopeData !== void 0 && scopeData.complementaryArea) {
|
||||
if (scopeData?.complementaryArea) {
|
||||
const updatedScopeData = { ...scopeData
|
||||
};
|
||||
delete updatedScopeData.complementaryArea;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+23
-35
@@ -104,10 +104,7 @@ var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
|
||||
* @return {Object} Updated state.
|
||||
*/
|
||||
|
||||
function defaults() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function defaults(state = {}, action) {
|
||||
if (action.type === 'SET_PREFERENCE_DEFAULTS') {
|
||||
const {
|
||||
scope,
|
||||
@@ -150,9 +147,7 @@ function withPersistenceLayer(reducer) {
|
||||
const nextState = reducer(state, action);
|
||||
|
||||
if (action.type === 'SET_PREFERENCE_VALUE') {
|
||||
var _persistenceLayer;
|
||||
|
||||
(_persistenceLayer = persistenceLayer) === null || _persistenceLayer === void 0 ? void 0 : _persistenceLayer.set(nextState);
|
||||
persistenceLayer?.set(nextState);
|
||||
}
|
||||
|
||||
return nextState;
|
||||
@@ -168,10 +163,7 @@ function withPersistenceLayer(reducer) {
|
||||
*/
|
||||
|
||||
|
||||
const preferences = withPersistenceLayer(function () {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
const preferences = withPersistenceLayer((state = {}, action) => {
|
||||
if (action.type === 'SET_PREFERENCE_VALUE') {
|
||||
const {
|
||||
scope,
|
||||
@@ -201,11 +193,10 @@ const preferences = withPersistenceLayer(function () {
|
||||
* @param {string} name The preference name.
|
||||
*/
|
||||
function toggle(scope, name) {
|
||||
return function (_ref) {
|
||||
let {
|
||||
select,
|
||||
dispatch
|
||||
} = _ref;
|
||||
return function ({
|
||||
select,
|
||||
dispatch
|
||||
}) {
|
||||
const currentValue = select.get(scope, name);
|
||||
dispatch.set(scope, name, !currentValue);
|
||||
};
|
||||
@@ -248,13 +239,13 @@ function setDefaults(scope, defaults) {
|
||||
}
|
||||
/** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */
|
||||
|
||||
/** @typedef {(*) => void} WPPreferencesPersistenceLayerSet */
|
||||
/** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */
|
||||
|
||||
/**
|
||||
* @typedef WPPreferencesPersistenceLayer
|
||||
*
|
||||
* @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.
|
||||
* @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.
|
||||
* @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -294,10 +285,8 @@ async function setPersistenceLayer(persistenceLayer) {
|
||||
* @return {*} Is the feature enabled?
|
||||
*/
|
||||
function get(state, scope, name) {
|
||||
var _state$preferences$sc, _state$defaults$scope;
|
||||
|
||||
const value = (_state$preferences$sc = state.preferences[scope]) === null || _state$preferences$sc === void 0 ? void 0 : _state$preferences$sc[name];
|
||||
return value !== undefined ? value : (_state$defaults$scope = state.defaults[scope]) === null || _state$defaults$scope === void 0 ? void 0 : _state$defaults$scope[name];
|
||||
const value = state.preferences[scope]?.[name];
|
||||
return value !== undefined ? value : state.defaults[scope]?.[name];
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/constants.js
|
||||
@@ -352,19 +341,18 @@ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME,
|
||||
*/
|
||||
|
||||
|
||||
function PreferenceToggleMenuItem(_ref) {
|
||||
let {
|
||||
scope,
|
||||
name,
|
||||
label,
|
||||
info,
|
||||
messageActivated,
|
||||
messageDeactivated,
|
||||
shortcut,
|
||||
onToggle = () => null,
|
||||
disabled = false
|
||||
} = _ref;
|
||||
const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, name), [name]);
|
||||
function PreferenceToggleMenuItem({
|
||||
scope,
|
||||
name,
|
||||
label,
|
||||
info,
|
||||
messageActivated,
|
||||
messageDeactivated,
|
||||
shortcut,
|
||||
onToggle = () => null,
|
||||
disabled = false
|
||||
}) {
|
||||
const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, name), [scope, name]);
|
||||
const {
|
||||
toggle
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{PreferenceToggleMenuItem:function(){return m},store:function(){return S}});var n={};e.r(n),e.d(n,{set:function(){return E},setDefaults:function(){return w},setPersistenceLayer:function(){return v},toggle:function(){return p}});var r={};e.r(r),e.d(r,{get:function(){return g}});var o=window.wp.element,c=window.wp.data,i=window.wp.components,s=window.wp.i18n,u=window.wp.primitives;var a=(0,o.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(u.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),l=window.wp.a11y;const d=function(e){let t;return(n,r)=>{if("SET_PERSISTENCE_LAYER"===r.type){const{persistenceLayer:e,persistedData:n}=r;return t=e,n}const o=e(n,r);var c;"SET_PREFERENCE_VALUE"===r.type&&(null===(c=t)||void 0===c||c.set(o));return o}}((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_PREFERENCE_VALUE"===t.type){const{scope:n,name:r,value:o}=t;return{...e,[n]:{...e[n],[r]:o}}}return e}));var f=(0,c.combineReducers)({defaults:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_PREFERENCE_DEFAULTS"===t.type){const{scope:n,defaults:r}=t;return{...e,[n]:{...e[n],...r}}}return e},preferences:d});function p(e,t){return function(n){let{select:r,dispatch:o}=n;const c=r.get(e,t);o.set(e,t,!c)}}function E(e,t,n){return{type:"SET_PREFERENCE_VALUE",scope:e,name:t,value:n}}function w(e,t){return{type:"SET_PREFERENCE_DEFAULTS",scope:e,defaults:t}}async function v(e){const t=await e.get();return{type:"SET_PERSISTENCE_LAYER",persistenceLayer:e,persistedData:t}}function g(e,t,n){var r,o;const c=null===(r=e.preferences[t])||void 0===r?void 0:r[n];return void 0!==c?c:null===(o=e.defaults[t])||void 0===o?void 0:o[n]}const S=(0,c.createReduxStore)("core/preferences",{reducer:f,actions:n,selectors:r});function m(e){let{scope:t,name:n,label:r,info:u,messageActivated:d,messageDeactivated:f,shortcut:p,onToggle:E=(()=>null),disabled:w=!1}=e;const v=(0,c.useSelect)((e=>!!e(S).get(t,n)),[n]),{toggle:g}=(0,c.useDispatch)(S);return(0,o.createElement)(i.MenuItem,{icon:v&&a,isSelected:v,onClick:()=>{E(),g(t,n),(()=>{if(v){const e=f||(0,s.sprintf)((0,s.__)("Preference deactivated - %s"),r);(0,l.speak)(e)}else{const e=d||(0,s.sprintf)((0,s.__)("Preference activated - %s"),r);(0,l.speak)(e)}})()},role:"menuitemcheckbox",info:u,shortcut:p,disabled:w},r)}(0,c.register)(S),(window.wp=window.wp||{}).preferences=t}();
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{PreferenceToggleMenuItem:function(){return y},store:function(){return m}});var n={};e.r(n),e.d(n,{set:function(){return l},setDefaults:function(){return w},setPersistenceLayer:function(){return g},toggle:function(){return d}});var r={};e.r(r),e.d(r,{get:function(){return S}});var o=window.wp.element,c=window.wp.data,s=window.wp.components,i=window.wp.i18n,u=window.wp.primitives;var a=(0,o.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(u.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),f=window.wp.a11y;const p=function(e){let t;return(n,r)=>{if("SET_PERSISTENCE_LAYER"===r.type){const{persistenceLayer:e,persistedData:n}=r;return t=e,n}const o=e(n,r);return"SET_PREFERENCE_VALUE"===r.type&&t?.set(o),o}}(((e={},t)=>{if("SET_PREFERENCE_VALUE"===t.type){const{scope:n,name:r,value:o}=t;return{...e,[n]:{...e[n],[r]:o}}}return e}));var E=(0,c.combineReducers)({defaults:function(e={},t){if("SET_PREFERENCE_DEFAULTS"===t.type){const{scope:n,defaults:r}=t;return{...e,[n]:{...e[n],...r}}}return e},preferences:p});function d(e,t){return function({select:n,dispatch:r}){const o=n.get(e,t);r.set(e,t,!o)}}function l(e,t,n){return{type:"SET_PREFERENCE_VALUE",scope:e,name:t,value:n}}function w(e,t){return{type:"SET_PREFERENCE_DEFAULTS",scope:e,defaults:t}}async function g(e){const t=await e.get();return{type:"SET_PERSISTENCE_LAYER",persistenceLayer:e,persistedData:t}}function S(e,t,n){const r=e.preferences[t]?.[n];return void 0!==r?r:e.defaults[t]?.[n]}const m=(0,c.createReduxStore)("core/preferences",{reducer:E,actions:n,selectors:r});function y({scope:e,name:t,label:n,info:r,messageActivated:u,messageDeactivated:p,shortcut:E,onToggle:d=(()=>null),disabled:l=!1}){const w=(0,c.useSelect)((n=>!!n(m).get(e,t)),[e,t]),{toggle:g}=(0,c.useDispatch)(m);return(0,o.createElement)(s.MenuItem,{icon:w&&a,isSelected:w,onClick:()=>{d(),g(e,t),(()=>{if(w){const e=p||(0,i.sprintf)((0,i.__)("Preference deactivated - %s"),n);(0,f.speak)(e)}else{const e=u||(0,i.sprintf)((0,i.__)("Preference activated - %s"),n);(0,f.speak)(e)}})()},role:"menuitemcheckbox",info:r,shortcut:E,disabled:l},n)}(0,c.register)(m),(window.wp=window.wp||{}).preferences=t}();
|
||||
Vendored
+7
-7
@@ -255,12 +255,11 @@ const Stop = props => (0,external_wp_element_namespaceObject.createElement)('sto
|
||||
* @return {JSX.Element} Stop component
|
||||
*/
|
||||
|
||||
const SVG = _ref => {
|
||||
let {
|
||||
className,
|
||||
isPressed,
|
||||
...props
|
||||
} = _ref;
|
||||
const SVG = ({
|
||||
className,
|
||||
isPressed,
|
||||
...props
|
||||
}) => {
|
||||
const appliedProps = { ...props,
|
||||
className: classnames_default()(className, {
|
||||
'is-pressed': isPressed
|
||||
@@ -270,7 +269,8 @@ const SVG = _ref => {
|
||||
}; // Disable reason: We need to have a way to render HTML tag for web.
|
||||
// eslint-disable-next-line react/forbid-elements
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)("svg", appliedProps);
|
||||
return (0,external_wp_element_namespaceObject.createElement)("svg", { ...appliedProps
|
||||
});
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/primitives/build-module/horizontal-rule/index.js
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var u=o.apply(null,n);u&&e.push(u)}}else if("object"===i){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){"use strict";n.r(r),n.d(r,{BlockQuotation:function(){return g},Circle:function(){return i},Defs:function(){return s},G:function(){return u},HorizontalRule:function(){return y},Line:function(){return a},LinearGradient:function(){return d},Path:function(){return c},Polygon:function(){return l},RadialGradient:function(){return p},Rect:function(){return f},SVG:function(){return m},Stop:function(){return v},View:function(){return b}});var e=n(4403),t=n.n(e),o=window.wp.element;const i=e=>(0,o.createElement)("circle",e),u=e=>(0,o.createElement)("g",e),a=e=>(0,o.createElement)("line",e),c=e=>(0,o.createElement)("path",e),l=e=>(0,o.createElement)("polygon",e),f=e=>(0,o.createElement)("rect",e),s=e=>(0,o.createElement)("defs",e),p=e=>(0,o.createElement)("radialGradient",e),d=e=>(0,o.createElement)("linearGradient",e),v=e=>(0,o.createElement)("stop",e),m=e=>{let{className:n,isPressed:r,...i}=e;const u={...i,className:t()(n,{"is-pressed":r})||void 0,"aria-hidden":!0,focusable:!1};return(0,o.createElement)("svg",u)},y="hr",g="blockquote",b="div"}(),(window.wp=window.wp||{}).primitives=r}();
|
||||
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var u=o.apply(null,n);u&&e.push(u)}}else if("object"===i){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){"use strict";n.r(r),n.d(r,{BlockQuotation:function(){return g},Circle:function(){return i},Defs:function(){return s},G:function(){return u},HorizontalRule:function(){return y},Line:function(){return a},LinearGradient:function(){return d},Path:function(){return c},Polygon:function(){return l},RadialGradient:function(){return p},Rect:function(){return f},SVG:function(){return m},Stop:function(){return v},View:function(){return b}});var e=n(4403),t=n.n(e),o=window.wp.element;const i=e=>(0,o.createElement)("circle",e),u=e=>(0,o.createElement)("g",e),a=e=>(0,o.createElement)("line",e),c=e=>(0,o.createElement)("path",e),l=e=>(0,o.createElement)("polygon",e),f=e=>(0,o.createElement)("rect",e),s=e=>(0,o.createElement)("defs",e),p=e=>(0,o.createElement)("radialGradient",e),d=e=>(0,o.createElement)("linearGradient",e),v=e=>(0,o.createElement)("stop",e),m=({className:e,isPressed:n,...r})=>{const i={...r,className:t()(e,{"is-pressed":n})||void 0,"aria-hidden":!0,focusable:!1};return(0,o.createElement)("svg",{...i})},y="hr",g="blockquote",b="div"}(),(window.wp=window.wp||{}).primitives=r}();
|
||||
+8
-7
@@ -54,7 +54,7 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
/**
|
||||
* The list of core modules allowed to opt-in to the private APIs.
|
||||
*/
|
||||
const CORE_MODULES_USING_PRIVATE_APIS = ['@wordpress/block-editor', '@wordpress/block-library', '@wordpress/blocks', '@wordpress/components', '@wordpress/customize-widgets', '@wordpress/data', '@wordpress/edit-post', '@wordpress/edit-site', '@wordpress/edit-widgets', '@wordpress/editor'];
|
||||
const CORE_MODULES_USING_PRIVATE_APIS = ['@wordpress/block-editor', '@wordpress/block-library', '@wordpress/blocks', '@wordpress/commands', '@wordpress/components', '@wordpress/core-commands', '@wordpress/core-data', '@wordpress/customize-widgets', '@wordpress/data', '@wordpress/edit-post', '@wordpress/edit-site', '@wordpress/edit-widgets', '@wordpress/editor', '@wordpress/reusable-blocks', '@wordpress/router'];
|
||||
/**
|
||||
* A list of core modules that already opted-in to
|
||||
* the privateApis package.
|
||||
@@ -81,15 +81,16 @@ const registeredPrivateApis = [];
|
||||
const requiredConsent = 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.';
|
||||
/** @type {boolean} */
|
||||
|
||||
let allowReRegistration; // Use try/catch to force "false" if the environment variable is not explicitly
|
||||
// set to true (e.g. when building WordPress core).
|
||||
let allowReRegistration; // The safety measure is meant for WordPress core where IS_WORDPRESS_CORE
|
||||
// is set to true.
|
||||
// For the general use-case, the re-registration should be allowed by default
|
||||
// Let's default to true, then. Try/catch will fall back to "true" even if the
|
||||
// environment variable is not explicitly defined.
|
||||
|
||||
try {
|
||||
var _process$env$ALLOW_EX;
|
||||
|
||||
allowReRegistration = (_process$env$ALLOW_EX = process.env.ALLOW_EXPERIMENT_REREGISTRATION) !== null && _process$env$ALLOW_EX !== void 0 ? _process$env$ALLOW_EX : false;
|
||||
allowReRegistration = true ? false : 0;
|
||||
} catch (error) {
|
||||
allowReRegistration = false;
|
||||
allowReRegistration = true;
|
||||
}
|
||||
/**
|
||||
* Called by a @wordpress package wishing to opt-in to accessing or exposing
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(o,r){for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:r[t]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{__dangerousOptInToUnstableAPIsOnlyForCoreModules:function(){return i}});const r=["@wordpress/block-editor","@wordpress/block-library","@wordpress/blocks","@wordpress/components","@wordpress/customize-widgets","@wordpress/data","@wordpress/edit-post","@wordpress/edit-site","@wordpress/edit-widgets","@wordpress/editor"],t=[];let n;try{var s;n=null!==(s=process.env.ALLOW_EXPERIMENT_REREGISTRATION)&&void 0!==s&&s}catch(e){n=!1}const i=(e,o)=>{if(!r.includes(o))throw new Error(`You tried to opt-in to unstable APIs as module "${o}". This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if(!n&&t.includes(o))throw new Error(`You tried to opt-in to unstable APIs as module "${o}" which is already registered. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release."!==e)throw new Error("You tried to opt-in to unstable APIs without confirming you know the consequences. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on the next WordPress release.");return t.push(o),{lock:a,unlock:d}};function a(e,o){if(!e)throw new Error("Cannot lock an undefined object.");l in e||(e[l]={}),u.set(e[l],o)}function d(e){if(!e)throw new Error("Cannot unlock an undefined object.");if(!(l in e))throw new Error("Cannot unlock an object that was not locked before. ");return u.get(e[l])}const u=new WeakMap,l=Symbol("Private API ID");(window.wp=window.wp||{}).privateApis=o}();
|
||||
!function(){"use strict";var e={d:function(o,r){for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:r[t]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{__dangerousOptInToUnstableAPIsOnlyForCoreModules:function(){return s}});const r=["@wordpress/block-editor","@wordpress/block-library","@wordpress/blocks","@wordpress/commands","@wordpress/components","@wordpress/core-commands","@wordpress/core-data","@wordpress/customize-widgets","@wordpress/data","@wordpress/edit-post","@wordpress/edit-site","@wordpress/edit-widgets","@wordpress/editor","@wordpress/reusable-blocks","@wordpress/router"],t=[];let n;try{n=!1}catch(e){n=!0}const s=(e,o)=>{if(!r.includes(o))throw new Error(`You tried to opt-in to unstable APIs as module "${o}". This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if(!n&&t.includes(o))throw new Error(`You tried to opt-in to unstable APIs as module "${o}" which is already registered. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release."!==e)throw new Error("You tried to opt-in to unstable APIs without confirming you know the consequences. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on the next WordPress release.");return t.push(o),{lock:i,unlock:a}};function i(e,o){if(!e)throw new Error("Cannot lock an undefined object.");u in e||(e[u]={}),d.set(e[u],o)}function a(e){if(!e)throw new Error("Cannot unlock an undefined object.");if(!(u in e))throw new Error("Cannot unlock an object that was not locked before. ");return d.get(e[u])}const d=new WeakMap,u=Symbol("Private API ID");(window.wp=window.wp||{}).privateApis=o}();
|
||||
+17
-23
@@ -731,7 +731,7 @@ function isPromise(obj) {
|
||||
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/redux-routine/node_modules/is-plain-object/dist/is-plain-object.mjs
|
||||
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
@@ -814,31 +814,26 @@ function isActionOfType(object, expectedType) {
|
||||
/**
|
||||
* Create a co-routine runtime.
|
||||
*
|
||||
* @param controls Object of control handlers.
|
||||
* @param dispatch Unhandled action dispatch.
|
||||
* @param controls Object of control handlers.
|
||||
* @param dispatch Unhandled action dispatch.
|
||||
*/
|
||||
|
||||
function createRuntime() {
|
||||
let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let dispatch = arguments.length > 1 ? arguments[1] : undefined;
|
||||
const rungenControls = Object.entries(controls).map(_ref => {
|
||||
let [actionType, control] = _ref;
|
||||
return (value, next, iterate, yieldNext, yieldError) => {
|
||||
if (!isActionOfType(value, actionType)) {
|
||||
return false;
|
||||
}
|
||||
function createRuntime(controls = {}, dispatch) {
|
||||
const rungenControls = Object.entries(controls).map(([actionType, control]) => (value, next, iterate, yieldNext, yieldError) => {
|
||||
if (!isActionOfType(value, actionType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const routine = control(value);
|
||||
const routine = control(value);
|
||||
|
||||
if (isPromise(routine)) {
|
||||
// Async control routine awaits resolution.
|
||||
routine.then(yieldNext, yieldError);
|
||||
} else {
|
||||
yieldNext(routine);
|
||||
}
|
||||
if (isPromise(routine)) {
|
||||
// Async control routine awaits resolution.
|
||||
routine.then(yieldNext, yieldError);
|
||||
} else {
|
||||
yieldNext(routine);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
return true;
|
||||
});
|
||||
|
||||
const unhandledActionControl = (value, next) => {
|
||||
@@ -881,8 +876,7 @@ function createRuntime() {
|
||||
* @return {import('redux').Middleware} Co-routine runtime
|
||||
*/
|
||||
|
||||
function createMiddleware() {
|
||||
let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
function createMiddleware(controls = {}) {
|
||||
return store => {
|
||||
const runtime = createRuntime(controls, store.dispatch);
|
||||
return next => action => {
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+137
-108
@@ -39,7 +39,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"ReusableBlocksMenuItems": function() { return /* reexport */ reusable_blocks_menu_items; },
|
||||
"ReusableBlocksMenuItems": function() { return /* reexport */ ReusableBlocksMenuItems; },
|
||||
"store": function() { return /* reexport */ store; }
|
||||
});
|
||||
|
||||
@@ -81,33 +81,41 @@ var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
||||
* @param {string} clientId The client ID of the block to attach.
|
||||
*/
|
||||
|
||||
const __experimentalConvertBlockToStatic = clientId => _ref => {
|
||||
let {
|
||||
registry
|
||||
} = _ref;
|
||||
const __experimentalConvertBlockToStatic = clientId => ({
|
||||
registry
|
||||
}) => {
|
||||
const oldBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId);
|
||||
const reusableBlock = registry.select('core').getEditedEntityRecord('postType', 'wp_block', oldBlock.attributes.ref);
|
||||
const newBlocks = (0,external_wp_blocks_namespaceObject.parse)(typeof reusableBlock.content === 'function' ? reusableBlock.content(reusableBlock) : reusableBlock.content);
|
||||
registry.dispatch(external_wp_blockEditor_namespaceObject.store).replaceBlocks(oldBlock.clientId, newBlocks);
|
||||
};
|
||||
/**
|
||||
* Returns a generator converting one or more static blocks into a reusable block.
|
||||
* Returns a generator converting one or more static blocks into a pattern.
|
||||
*
|
||||
* @param {string[]} clientIds The client IDs of the block to detach.
|
||||
* @param {string} title Reusable block title.
|
||||
* @param {string[]} clientIds The client IDs of the block to detach.
|
||||
* @param {string} title Pattern title.
|
||||
* @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.
|
||||
*/
|
||||
|
||||
const __experimentalConvertBlocksToReusable = (clientIds, title) => async _ref2 => {
|
||||
let {
|
||||
registry,
|
||||
dispatch
|
||||
} = _ref2;
|
||||
const __experimentalConvertBlocksToReusable = (clientIds, title, syncType) => async ({
|
||||
registry,
|
||||
dispatch
|
||||
}) => {
|
||||
const meta = syncType === 'unsynced' ? {
|
||||
wp_pattern_sync_status: syncType
|
||||
} : undefined;
|
||||
const reusableBlock = {
|
||||
title: title || (0,external_wp_i18n_namespaceObject.__)('Untitled Reusable block'),
|
||||
title: title || (0,external_wp_i18n_namespaceObject.__)('Untitled Pattern block'),
|
||||
content: (0,external_wp_blocks_namespaceObject.serialize)(registry.select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds)),
|
||||
status: 'publish'
|
||||
status: 'publish',
|
||||
meta
|
||||
};
|
||||
const updatedRecord = await registry.dispatch('core').saveEntityRecord('postType', 'wp_block', reusableBlock);
|
||||
|
||||
if (syncType === 'unsynced') {
|
||||
return;
|
||||
}
|
||||
|
||||
const newBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/block', {
|
||||
ref: updatedRecord.id
|
||||
});
|
||||
@@ -121,10 +129,9 @@ const __experimentalConvertBlocksToReusable = (clientIds, title) => async _ref2
|
||||
* @param {string} id The ID of the reusable block to delete.
|
||||
*/
|
||||
|
||||
const __experimentalDeleteReusableBlock = id => async _ref3 => {
|
||||
let {
|
||||
registry
|
||||
} = _ref3;
|
||||
const __experimentalDeleteReusableBlock = id => async ({
|
||||
registry
|
||||
}) => {
|
||||
const reusableBlock = registry.select('core').getEditedEntityRecord('postType', 'wp_block', id); // Don't allow a reusable block with a temporary ID to be deleted.
|
||||
|
||||
if (!reusableBlock) {
|
||||
@@ -163,11 +170,8 @@ function __experimentalSetEditingReusableBlock(clientId, isEditing) {
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
function isEditingReusableBlock() {
|
||||
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
let action = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
if ((action === null || action === void 0 ? void 0 : action.type) === 'SET_EDITING_REUSABLE_BLOCK') {
|
||||
function isEditingReusableBlock(state = {}, action) {
|
||||
if (action?.type === 'SET_EDITING_REUSABLE_BLOCK') {
|
||||
return { ...state,
|
||||
[action.clientId]: action.isEditing
|
||||
};
|
||||
@@ -244,6 +248,17 @@ const symbol = (0,external_wp_element_namespaceObject.createElement)(external_wp
|
||||
var external_wp_notices_namespaceObject = window["wp"]["notices"];
|
||||
;// CONCATENATED MODULE: external ["wp","coreData"]
|
||||
var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
|
||||
;// CONCATENATED MODULE: external ["wp","privateApis"]
|
||||
var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/lock-unlock.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const {
|
||||
unlock
|
||||
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/reusable-blocks');
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
|
||||
|
||||
|
||||
@@ -264,6 +279,7 @@ var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Menu control to convert block(s) to reusable block.
|
||||
*
|
||||
@@ -273,11 +289,16 @@ var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
|
||||
* @return {import('@wordpress/element').WPComponent} The menu control or null.
|
||||
*/
|
||||
|
||||
function ReusableBlockConvertButton(_ref) {
|
||||
let {
|
||||
clientIds,
|
||||
rootClientId
|
||||
} = _ref;
|
||||
function ReusableBlockConvertButton({
|
||||
clientIds,
|
||||
rootClientId
|
||||
}) {
|
||||
const {
|
||||
useReusableBlocksRenameHint,
|
||||
ReusableBlocksRenameHint
|
||||
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
|
||||
const showRenameHint = useReusableBlocksRenameHint();
|
||||
const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined);
|
||||
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
|
||||
const canConvert = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
@@ -288,21 +309,23 @@ function ReusableBlockConvertButton(_ref) {
|
||||
} = select(external_wp_coreData_namespaceObject.store);
|
||||
const {
|
||||
getBlocksByClientId,
|
||||
canInsertBlockType
|
||||
canInsertBlockType,
|
||||
getBlockRootClientId
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined);
|
||||
const blocks = (_getBlocksByClientId = getBlocksByClientId(clientIds)) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [];
|
||||
const isReusable = blocks.length === 1 && blocks[0] && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]) && !!select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', blocks[0].attributes.ref);
|
||||
|
||||
const _canConvert = // Hide when this is already a reusable block.
|
||||
!isReusable && // Hide when reusable blocks are disabled.
|
||||
canInsertBlockType('core/block', rootClientId) && blocks.every(block => // Guard against the case where a regular block has *just* been converted.
|
||||
canInsertBlockType('core/block', rootId) && blocks.every(block => // Guard against the case where a regular block has *just* been converted.
|
||||
!!block && // Hide on invalid blocks.
|
||||
block.isValid && // Hide when block doesn't support being made reusable.
|
||||
(0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'reusable', true)) && // Hide when current doesn't have permission to do that.
|
||||
!!canUser('create', 'blocks');
|
||||
|
||||
return _canConvert;
|
||||
}, [clientIds]);
|
||||
}, [clientIds, rootClientId]);
|
||||
const {
|
||||
__experimentalConvertBlocksToReusable: convertBlocksToReusable
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
||||
@@ -312,65 +335,72 @@ function ReusableBlockConvertButton(_ref) {
|
||||
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
|
||||
const onConvert = (0,external_wp_element_namespaceObject.useCallback)(async function (reusableBlockTitle) {
|
||||
try {
|
||||
await convertBlocksToReusable(clientIds, reusableBlockTitle);
|
||||
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Reusable block created.'), {
|
||||
type: 'snackbar'
|
||||
await convertBlocksToReusable(clientIds, reusableBlockTitle, syncType);
|
||||
createSuccessNotice(!syncType ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name the user has given to the pattern.
|
||||
(0,external_wp_i18n_namespaceObject.__)('Synced Pattern created: %s'), reusableBlockTitle) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name the user has given to the pattern.
|
||||
(0,external_wp_i18n_namespaceObject.__)('Unsynced Pattern created: %s'), reusableBlockTitle), {
|
||||
type: 'snackbar',
|
||||
id: 'convert-to-reusable-block-success'
|
||||
});
|
||||
} catch (error) {
|
||||
createErrorNotice(error.message, {
|
||||
type: 'snackbar'
|
||||
type: 'snackbar',
|
||||
id: 'convert-to-reusable-block-error'
|
||||
});
|
||||
}
|
||||
}, [clientIds]);
|
||||
}, [convertBlocksToReusable, clientIds, syncType, createSuccessNotice, createErrorNotice]);
|
||||
|
||||
if (!canConvert) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
|
||||
let {
|
||||
onClose
|
||||
} = _ref2;
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
icon: library_symbol,
|
||||
onClick: () => {
|
||||
setIsModalOpen(true);
|
||||
}
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Create Reusable block')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
|
||||
title: (0,external_wp_i18n_namespaceObject.__)('Create Reusable block'),
|
||||
onRequestClose: () => {
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
},
|
||||
overlayClassName: "reusable-blocks-menu-items__convert-modal"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)("form", {
|
||||
onSubmit: event => {
|
||||
event.preventDefault();
|
||||
onConvert(title);
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
onClose();
|
||||
}
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||
spacing: "5"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
|
||||
__nextHasNoMarginBottom: true,
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
|
||||
value: title,
|
||||
onChange: setTitle
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
justify: "right"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "tertiary",
|
||||
onClick: () => {
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
}
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "primary",
|
||||
type: "submit"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Save')))))));
|
||||
});
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({
|
||||
onClose
|
||||
}) => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
icon: library_symbol,
|
||||
onClick: () => setIsModalOpen(true)
|
||||
}, showRenameHint ? (0,external_wp_i18n_namespaceObject.__)('Create pattern/reusable block') : (0,external_wp_i18n_namespaceObject.__)('Create pattern')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
|
||||
title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'),
|
||||
onRequestClose: () => {
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
},
|
||||
overlayClassName: "reusable-blocks-menu-items__convert-modal"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)("form", {
|
||||
onSubmit: event => {
|
||||
event.preventDefault();
|
||||
onConvert(title);
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
onClose();
|
||||
}
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||
spacing: "5"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_wp_element_namespaceObject.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 pattern')
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
|
||||
label: (0,external_wp_i18n_namespaceObject.__)('Synced'),
|
||||
help: (0,external_wp_i18n_namespaceObject.__)('Editing the pattern will update it anywhere it is used.'),
|
||||
checked: !syncType,
|
||||
onChange: () => {
|
||||
setSyncType(!syncType ? 'unsynced' : undefined);
|
||||
}
|
||||
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||
justify: "right"
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "tertiary",
|
||||
onClick: () => {
|
||||
setIsModalOpen(false);
|
||||
setTitle('');
|
||||
}
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
||||
variant: "primary",
|
||||
type: "submit"
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Create'))))))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","url"]
|
||||
@@ -394,28 +424,40 @@ var external_wp_url_namespaceObject = window["wp"]["url"];
|
||||
|
||||
|
||||
|
||||
function ReusableBlocksManageButton(_ref) {
|
||||
let {
|
||||
clientId
|
||||
} = _ref;
|
||||
function ReusableBlocksManageButton({
|
||||
clientId
|
||||
}) {
|
||||
const {
|
||||
canRemove,
|
||||
isVisible,
|
||||
innerBlockCount
|
||||
innerBlockCount,
|
||||
managePatternsUrl
|
||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||
const {
|
||||
getBlock,
|
||||
canRemoveBlock,
|
||||
getBlockCount
|
||||
getBlockCount,
|
||||
getSettings
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
const {
|
||||
canUser
|
||||
} = select(external_wp_coreData_namespaceObject.store);
|
||||
const reusableBlock = getBlock(clientId);
|
||||
|
||||
const isBlockTheme = getSettings().__unstableIsBlockBasedTheme;
|
||||
|
||||
return {
|
||||
canRemove: canRemoveBlock(clientId),
|
||||
isVisible: !!reusableBlock && (0,external_wp_blocks_namespaceObject.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref),
|
||||
innerBlockCount: getBlockCount(clientId)
|
||||
innerBlockCount: getBlockCount(clientId),
|
||||
// The site editor and templates both check whether the user
|
||||
// has edit_theme_options capabilities. We can leverage that here
|
||||
// and omit the manage patterns link if the user can't access it.
|
||||
managePatternsUrl: isBlockTheme && canUser('read', 'templates') ? (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', {
|
||||
path: '/patterns'
|
||||
}) : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
|
||||
post_type: 'wp_block'
|
||||
})
|
||||
};
|
||||
}, [clientId]);
|
||||
const {
|
||||
@@ -427,12 +469,10 @@ function ReusableBlocksManageButton(_ref) {
|
||||
}
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
|
||||
post_type: 'wp_block'
|
||||
})
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), canRemove && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
href: managePatternsUrl
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Manage patterns')), canRemove && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
||||
onClick: () => convertBlockToStatic(clientId)
|
||||
}, innerBlockCount > 1 ? (0,external_wp_i18n_namespaceObject.__)('Convert to regular blocks') : (0,external_wp_i18n_namespaceObject.__)('Convert to regular block')));
|
||||
}, innerBlockCount > 1 ? (0,external_wp_i18n_namespaceObject.__)('Detach patterns') : (0,external_wp_i18n_namespaceObject.__)('Detach pattern')));
|
||||
}
|
||||
|
||||
/* harmony default export */ var reusable_blocks_manage_button = (ReusableBlocksManageButton);
|
||||
@@ -451,12 +491,10 @@ function ReusableBlocksManageButton(_ref) {
|
||||
|
||||
|
||||
|
||||
|
||||
function ReusableBlocksMenuItems(_ref) {
|
||||
let {
|
||||
clientIds,
|
||||
rootClientId
|
||||
} = _ref;
|
||||
function ReusableBlocksMenuItems({
|
||||
rootClientId
|
||||
}) {
|
||||
const clientIds = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientIds(), []);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlockConvertButton, {
|
||||
clientIds: clientIds,
|
||||
rootClientId: rootClientId
|
||||
@@ -465,15 +503,6 @@ function ReusableBlocksMenuItems(_ref) {
|
||||
}));
|
||||
}
|
||||
|
||||
/* harmony default export */ var reusable_blocks_menu_items = ((0,external_wp_data_namespaceObject.withSelect)(select => {
|
||||
const {
|
||||
getSelectedBlockClientIds
|
||||
} = select(external_wp_blockEditor_namespaceObject.store);
|
||||
return {
|
||||
clientIds: getSelectedBlockClientIds()
|
||||
};
|
||||
})(ReusableBlocksMenuItems));
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js
|
||||
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+651
-542
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+962
@@ -0,0 +1,962 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ // The require scope
|
||||
/******/ var __webpack_require__ = {};
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ !function() {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, definition) {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ !function() {
|
||||
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/make namespace object */
|
||||
/******/ !function() {
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"privateApis": function() { return /* reexport */ privateApis; }
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","element"]
|
||||
var external_wp_element_namespaceObject = window["wp"]["element"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
||||
function extends_extends() {
|
||||
extends_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
return extends_extends.apply(this, arguments);
|
||||
}
|
||||
;// CONCATENATED MODULE: ./node_modules/history/index.js
|
||||
|
||||
|
||||
/**
|
||||
* Actions represent the type of change to a location value.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
|
||||
*/
|
||||
var Action;
|
||||
|
||||
(function (Action) {
|
||||
/**
|
||||
* A POP indicates a change to an arbitrary index in the history stack, such
|
||||
* as a back or forward navigation. It does not describe the direction of the
|
||||
* navigation, only that the current index changed.
|
||||
*
|
||||
* Note: This is the default action for newly created history objects.
|
||||
*/
|
||||
Action["Pop"] = "POP";
|
||||
/**
|
||||
* A PUSH indicates a new entry being added to the history stack, such as when
|
||||
* a link is clicked and a new page loads. When this happens, all subsequent
|
||||
* entries in the stack are lost.
|
||||
*/
|
||||
|
||||
Action["Push"] = "PUSH";
|
||||
/**
|
||||
* A REPLACE indicates the entry at the current index in the history stack
|
||||
* being replaced by a new one.
|
||||
*/
|
||||
|
||||
Action["Replace"] = "REPLACE";
|
||||
})(Action || (Action = {}));
|
||||
|
||||
var readOnly = false ? 0 : function (obj) {
|
||||
return obj;
|
||||
};
|
||||
|
||||
function warning(cond, message) {
|
||||
if (!cond) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof console !== 'undefined') console.warn(message);
|
||||
|
||||
try {
|
||||
// Welcome to debugging history!
|
||||
//
|
||||
// This error is thrown as a convenience so you can more easily
|
||||
// find the source for a warning that appears in the console by
|
||||
// enabling "pause on exceptions" in your JavaScript debugger.
|
||||
throw new Error(message); // eslint-disable-next-line no-empty
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
var BeforeUnloadEventType = 'beforeunload';
|
||||
var HashChangeEventType = 'hashchange';
|
||||
var PopStateEventType = 'popstate';
|
||||
/**
|
||||
* Browser history stores the location in regular URLs. This is the standard for
|
||||
* most web apps, but it requires some configuration on the server to ensure you
|
||||
* serve the same app at multiple URLs.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
|
||||
*/
|
||||
|
||||
function createBrowserHistory(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var _options = options,
|
||||
_options$window = _options.window,
|
||||
window = _options$window === void 0 ? document.defaultView : _options$window;
|
||||
var globalHistory = window.history;
|
||||
|
||||
function getIndexAndLocation() {
|
||||
var _window$location = window.location,
|
||||
pathname = _window$location.pathname,
|
||||
search = _window$location.search,
|
||||
hash = _window$location.hash;
|
||||
var state = globalHistory.state || {};
|
||||
return [state.idx, readOnly({
|
||||
pathname: pathname,
|
||||
search: search,
|
||||
hash: hash,
|
||||
state: state.usr || null,
|
||||
key: state.key || 'default'
|
||||
})];
|
||||
}
|
||||
|
||||
var blockedPopTx = null;
|
||||
|
||||
function handlePop() {
|
||||
if (blockedPopTx) {
|
||||
blockers.call(blockedPopTx);
|
||||
blockedPopTx = null;
|
||||
} else {
|
||||
var nextAction = Action.Pop;
|
||||
|
||||
var _getIndexAndLocation = getIndexAndLocation(),
|
||||
nextIndex = _getIndexAndLocation[0],
|
||||
nextLocation = _getIndexAndLocation[1];
|
||||
|
||||
if (blockers.length) {
|
||||
if (nextIndex != null) {
|
||||
var delta = index - nextIndex;
|
||||
|
||||
if (delta) {
|
||||
// Revert the POP
|
||||
blockedPopTx = {
|
||||
action: nextAction,
|
||||
location: nextLocation,
|
||||
retry: function retry() {
|
||||
go(delta * -1);
|
||||
}
|
||||
};
|
||||
go(delta);
|
||||
}
|
||||
} else {
|
||||
// Trying to POP to a location with no index. We did not create
|
||||
// this location, so we can't effectively block the navigation.
|
||||
false ? 0 : void 0;
|
||||
}
|
||||
} else {
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(PopStateEventType, handlePop);
|
||||
var action = Action.Pop;
|
||||
|
||||
var _getIndexAndLocation2 = getIndexAndLocation(),
|
||||
index = _getIndexAndLocation2[0],
|
||||
location = _getIndexAndLocation2[1];
|
||||
|
||||
var listeners = createEvents();
|
||||
var blockers = createEvents();
|
||||
|
||||
if (index == null) {
|
||||
index = 0;
|
||||
globalHistory.replaceState(extends_extends({}, globalHistory.state, {
|
||||
idx: index
|
||||
}), '');
|
||||
}
|
||||
|
||||
function createHref(to) {
|
||||
return typeof to === 'string' ? to : createPath(to);
|
||||
} // state defaults to `null` because `window.history.state` does
|
||||
|
||||
|
||||
function getNextLocation(to, state) {
|
||||
if (state === void 0) {
|
||||
state = null;
|
||||
}
|
||||
|
||||
return readOnly(extends_extends({
|
||||
pathname: location.pathname,
|
||||
hash: '',
|
||||
search: ''
|
||||
}, typeof to === 'string' ? parsePath(to) : to, {
|
||||
state: state,
|
||||
key: createKey()
|
||||
}));
|
||||
}
|
||||
|
||||
function getHistoryStateAndUrl(nextLocation, index) {
|
||||
return [{
|
||||
usr: nextLocation.state,
|
||||
key: nextLocation.key,
|
||||
idx: index
|
||||
}, createHref(nextLocation)];
|
||||
}
|
||||
|
||||
function allowTx(action, location, retry) {
|
||||
return !blockers.length || (blockers.call({
|
||||
action: action,
|
||||
location: location,
|
||||
retry: retry
|
||||
}), false);
|
||||
}
|
||||
|
||||
function applyTx(nextAction) {
|
||||
action = nextAction;
|
||||
|
||||
var _getIndexAndLocation3 = getIndexAndLocation();
|
||||
|
||||
index = _getIndexAndLocation3[0];
|
||||
location = _getIndexAndLocation3[1];
|
||||
listeners.call({
|
||||
action: action,
|
||||
location: location
|
||||
});
|
||||
}
|
||||
|
||||
function push(to, state) {
|
||||
var nextAction = Action.Push;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
push(to, state);
|
||||
}
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
|
||||
historyState = _getHistoryStateAndUr[0],
|
||||
url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
|
||||
// try...catch because iOS limits us to 100 pushState calls :/
|
||||
|
||||
|
||||
try {
|
||||
globalHistory.pushState(historyState, '', url);
|
||||
} catch (error) {
|
||||
// They are going to lose state here, but there is no real
|
||||
// way to warn them about it since the page will refresh...
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
|
||||
function replace(to, state) {
|
||||
var nextAction = Action.Replace;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
replace(to, state);
|
||||
}
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
|
||||
historyState = _getHistoryStateAndUr2[0],
|
||||
url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
|
||||
|
||||
|
||||
globalHistory.replaceState(historyState, '', url);
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
|
||||
function go(delta) {
|
||||
globalHistory.go(delta);
|
||||
}
|
||||
|
||||
var history = {
|
||||
get action() {
|
||||
return action;
|
||||
},
|
||||
|
||||
get location() {
|
||||
return location;
|
||||
},
|
||||
|
||||
createHref: createHref,
|
||||
push: push,
|
||||
replace: replace,
|
||||
go: go,
|
||||
back: function back() {
|
||||
go(-1);
|
||||
},
|
||||
forward: function forward() {
|
||||
go(1);
|
||||
},
|
||||
listen: function listen(listener) {
|
||||
return listeners.push(listener);
|
||||
},
|
||||
block: function block(blocker) {
|
||||
var unblock = blockers.push(blocker);
|
||||
|
||||
if (blockers.length === 1) {
|
||||
window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
|
||||
}
|
||||
|
||||
return function () {
|
||||
unblock(); // Remove the beforeunload listener so the document may
|
||||
// still be salvageable in the pagehide event.
|
||||
// See https://html.spec.whatwg.org/#unloading-documents
|
||||
|
||||
if (!blockers.length) {
|
||||
window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
return history;
|
||||
}
|
||||
/**
|
||||
* Hash history stores the location in window.location.hash. This makes it ideal
|
||||
* for situations where you don't want to send the location to the server for
|
||||
* some reason, either because you do cannot configure it or the URL space is
|
||||
* reserved for something else.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
|
||||
*/
|
||||
|
||||
function createHashHistory(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var _options2 = options,
|
||||
_options2$window = _options2.window,
|
||||
window = _options2$window === void 0 ? document.defaultView : _options2$window;
|
||||
var globalHistory = window.history;
|
||||
|
||||
function getIndexAndLocation() {
|
||||
var _parsePath = parsePath(window.location.hash.substr(1)),
|
||||
_parsePath$pathname = _parsePath.pathname,
|
||||
pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
|
||||
_parsePath$search = _parsePath.search,
|
||||
search = _parsePath$search === void 0 ? '' : _parsePath$search,
|
||||
_parsePath$hash = _parsePath.hash,
|
||||
hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
|
||||
|
||||
var state = globalHistory.state || {};
|
||||
return [state.idx, readOnly({
|
||||
pathname: pathname,
|
||||
search: search,
|
||||
hash: hash,
|
||||
state: state.usr || null,
|
||||
key: state.key || 'default'
|
||||
})];
|
||||
}
|
||||
|
||||
var blockedPopTx = null;
|
||||
|
||||
function handlePop() {
|
||||
if (blockedPopTx) {
|
||||
blockers.call(blockedPopTx);
|
||||
blockedPopTx = null;
|
||||
} else {
|
||||
var nextAction = Action.Pop;
|
||||
|
||||
var _getIndexAndLocation4 = getIndexAndLocation(),
|
||||
nextIndex = _getIndexAndLocation4[0],
|
||||
nextLocation = _getIndexAndLocation4[1];
|
||||
|
||||
if (blockers.length) {
|
||||
if (nextIndex != null) {
|
||||
var delta = index - nextIndex;
|
||||
|
||||
if (delta) {
|
||||
// Revert the POP
|
||||
blockedPopTx = {
|
||||
action: nextAction,
|
||||
location: nextLocation,
|
||||
retry: function retry() {
|
||||
go(delta * -1);
|
||||
}
|
||||
};
|
||||
go(delta);
|
||||
}
|
||||
} else {
|
||||
// Trying to POP to a location with no index. We did not create
|
||||
// this location, so we can't effectively block the navigation.
|
||||
false ? 0 : void 0;
|
||||
}
|
||||
} else {
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
|
||||
// https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
|
||||
|
||||
window.addEventListener(HashChangeEventType, function () {
|
||||
var _getIndexAndLocation5 = getIndexAndLocation(),
|
||||
nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
|
||||
|
||||
|
||||
if (createPath(nextLocation) !== createPath(location)) {
|
||||
handlePop();
|
||||
}
|
||||
});
|
||||
var action = Action.Pop;
|
||||
|
||||
var _getIndexAndLocation6 = getIndexAndLocation(),
|
||||
index = _getIndexAndLocation6[0],
|
||||
location = _getIndexAndLocation6[1];
|
||||
|
||||
var listeners = createEvents();
|
||||
var blockers = createEvents();
|
||||
|
||||
if (index == null) {
|
||||
index = 0;
|
||||
globalHistory.replaceState(_extends({}, globalHistory.state, {
|
||||
idx: index
|
||||
}), '');
|
||||
}
|
||||
|
||||
function getBaseHref() {
|
||||
var base = document.querySelector('base');
|
||||
var href = '';
|
||||
|
||||
if (base && base.getAttribute('href')) {
|
||||
var url = window.location.href;
|
||||
var hashIndex = url.indexOf('#');
|
||||
href = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
||||
}
|
||||
|
||||
return href;
|
||||
}
|
||||
|
||||
function createHref(to) {
|
||||
return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
|
||||
}
|
||||
|
||||
function getNextLocation(to, state) {
|
||||
if (state === void 0) {
|
||||
state = null;
|
||||
}
|
||||
|
||||
return readOnly(_extends({
|
||||
pathname: location.pathname,
|
||||
hash: '',
|
||||
search: ''
|
||||
}, typeof to === 'string' ? parsePath(to) : to, {
|
||||
state: state,
|
||||
key: createKey()
|
||||
}));
|
||||
}
|
||||
|
||||
function getHistoryStateAndUrl(nextLocation, index) {
|
||||
return [{
|
||||
usr: nextLocation.state,
|
||||
key: nextLocation.key,
|
||||
idx: index
|
||||
}, createHref(nextLocation)];
|
||||
}
|
||||
|
||||
function allowTx(action, location, retry) {
|
||||
return !blockers.length || (blockers.call({
|
||||
action: action,
|
||||
location: location,
|
||||
retry: retry
|
||||
}), false);
|
||||
}
|
||||
|
||||
function applyTx(nextAction) {
|
||||
action = nextAction;
|
||||
|
||||
var _getIndexAndLocation7 = getIndexAndLocation();
|
||||
|
||||
index = _getIndexAndLocation7[0];
|
||||
location = _getIndexAndLocation7[1];
|
||||
listeners.call({
|
||||
action: action,
|
||||
location: location
|
||||
});
|
||||
}
|
||||
|
||||
function push(to, state) {
|
||||
var nextAction = Action.Push;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
push(to, state);
|
||||
}
|
||||
|
||||
false ? 0 : void 0;
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
|
||||
historyState = _getHistoryStateAndUr3[0],
|
||||
url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
|
||||
// try...catch because iOS limits us to 100 pushState calls :/
|
||||
|
||||
|
||||
try {
|
||||
globalHistory.pushState(historyState, '', url);
|
||||
} catch (error) {
|
||||
// They are going to lose state here, but there is no real
|
||||
// way to warn them about it since the page will refresh...
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
|
||||
function replace(to, state) {
|
||||
var nextAction = Action.Replace;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
replace(to, state);
|
||||
}
|
||||
|
||||
false ? 0 : void 0;
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
|
||||
historyState = _getHistoryStateAndUr4[0],
|
||||
url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
|
||||
|
||||
|
||||
globalHistory.replaceState(historyState, '', url);
|
||||
applyTx(nextAction);
|
||||
}
|
||||
}
|
||||
|
||||
function go(delta) {
|
||||
globalHistory.go(delta);
|
||||
}
|
||||
|
||||
var history = {
|
||||
get action() {
|
||||
return action;
|
||||
},
|
||||
|
||||
get location() {
|
||||
return location;
|
||||
},
|
||||
|
||||
createHref: createHref,
|
||||
push: push,
|
||||
replace: replace,
|
||||
go: go,
|
||||
back: function back() {
|
||||
go(-1);
|
||||
},
|
||||
forward: function forward() {
|
||||
go(1);
|
||||
},
|
||||
listen: function listen(listener) {
|
||||
return listeners.push(listener);
|
||||
},
|
||||
block: function block(blocker) {
|
||||
var unblock = blockers.push(blocker);
|
||||
|
||||
if (blockers.length === 1) {
|
||||
window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
|
||||
}
|
||||
|
||||
return function () {
|
||||
unblock(); // Remove the beforeunload listener so the document may
|
||||
// still be salvageable in the pagehide event.
|
||||
// See https://html.spec.whatwg.org/#unloading-documents
|
||||
|
||||
if (!blockers.length) {
|
||||
window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
return history;
|
||||
}
|
||||
/**
|
||||
* Memory history stores the current location in memory. It is designed for use
|
||||
* in stateful non-browser environments like tests and React Native.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
|
||||
*/
|
||||
|
||||
function createMemoryHistory(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var _options3 = options,
|
||||
_options3$initialEntr = _options3.initialEntries,
|
||||
initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
|
||||
initialIndex = _options3.initialIndex;
|
||||
var entries = initialEntries.map(function (entry) {
|
||||
var location = readOnly(_extends({
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: '',
|
||||
state: null,
|
||||
key: createKey()
|
||||
}, typeof entry === 'string' ? parsePath(entry) : entry));
|
||||
false ? 0 : void 0;
|
||||
return location;
|
||||
});
|
||||
var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
|
||||
var action = Action.Pop;
|
||||
var location = entries[index];
|
||||
var listeners = createEvents();
|
||||
var blockers = createEvents();
|
||||
|
||||
function createHref(to) {
|
||||
return typeof to === 'string' ? to : createPath(to);
|
||||
}
|
||||
|
||||
function getNextLocation(to, state) {
|
||||
if (state === void 0) {
|
||||
state = null;
|
||||
}
|
||||
|
||||
return readOnly(_extends({
|
||||
pathname: location.pathname,
|
||||
search: '',
|
||||
hash: ''
|
||||
}, typeof to === 'string' ? parsePath(to) : to, {
|
||||
state: state,
|
||||
key: createKey()
|
||||
}));
|
||||
}
|
||||
|
||||
function allowTx(action, location, retry) {
|
||||
return !blockers.length || (blockers.call({
|
||||
action: action,
|
||||
location: location,
|
||||
retry: retry
|
||||
}), false);
|
||||
}
|
||||
|
||||
function applyTx(nextAction, nextLocation) {
|
||||
action = nextAction;
|
||||
location = nextLocation;
|
||||
listeners.call({
|
||||
action: action,
|
||||
location: location
|
||||
});
|
||||
}
|
||||
|
||||
function push(to, state) {
|
||||
var nextAction = Action.Push;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
push(to, state);
|
||||
}
|
||||
|
||||
false ? 0 : void 0;
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
index += 1;
|
||||
entries.splice(index, entries.length, nextLocation);
|
||||
applyTx(nextAction, nextLocation);
|
||||
}
|
||||
}
|
||||
|
||||
function replace(to, state) {
|
||||
var nextAction = Action.Replace;
|
||||
var nextLocation = getNextLocation(to, state);
|
||||
|
||||
function retry() {
|
||||
replace(to, state);
|
||||
}
|
||||
|
||||
false ? 0 : void 0;
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
entries[index] = nextLocation;
|
||||
applyTx(nextAction, nextLocation);
|
||||
}
|
||||
}
|
||||
|
||||
function go(delta) {
|
||||
var nextIndex = clamp(index + delta, 0, entries.length - 1);
|
||||
var nextAction = Action.Pop;
|
||||
var nextLocation = entries[nextIndex];
|
||||
|
||||
function retry() {
|
||||
go(delta);
|
||||
}
|
||||
|
||||
if (allowTx(nextAction, nextLocation, retry)) {
|
||||
index = nextIndex;
|
||||
applyTx(nextAction, nextLocation);
|
||||
}
|
||||
}
|
||||
|
||||
var history = {
|
||||
get index() {
|
||||
return index;
|
||||
},
|
||||
|
||||
get action() {
|
||||
return action;
|
||||
},
|
||||
|
||||
get location() {
|
||||
return location;
|
||||
},
|
||||
|
||||
createHref: createHref,
|
||||
push: push,
|
||||
replace: replace,
|
||||
go: go,
|
||||
back: function back() {
|
||||
go(-1);
|
||||
},
|
||||
forward: function forward() {
|
||||
go(1);
|
||||
},
|
||||
listen: function listen(listener) {
|
||||
return listeners.push(listener);
|
||||
},
|
||||
block: function block(blocker) {
|
||||
return blockers.push(blocker);
|
||||
}
|
||||
};
|
||||
return history;
|
||||
} ////////////////////////////////////////////////////////////////////////////////
|
||||
// UTILS
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function clamp(n, lowerBound, upperBound) {
|
||||
return Math.min(Math.max(n, lowerBound), upperBound);
|
||||
}
|
||||
|
||||
function promptBeforeUnload(event) {
|
||||
// Cancel the event.
|
||||
event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
|
||||
|
||||
event.returnValue = '';
|
||||
}
|
||||
|
||||
function createEvents() {
|
||||
var handlers = [];
|
||||
return {
|
||||
get length() {
|
||||
return handlers.length;
|
||||
},
|
||||
|
||||
push: function push(fn) {
|
||||
handlers.push(fn);
|
||||
return function () {
|
||||
handlers = handlers.filter(function (handler) {
|
||||
return handler !== fn;
|
||||
});
|
||||
};
|
||||
},
|
||||
call: function call(arg) {
|
||||
handlers.forEach(function (fn) {
|
||||
return fn && fn(arg);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substr(2, 8);
|
||||
}
|
||||
/**
|
||||
* Creates a string URL path from the given pathname, search, and hash components.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
|
||||
*/
|
||||
|
||||
|
||||
function createPath(_ref) {
|
||||
var _ref$pathname = _ref.pathname,
|
||||
pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
|
||||
_ref$search = _ref.search,
|
||||
search = _ref$search === void 0 ? '' : _ref$search,
|
||||
_ref$hash = _ref.hash,
|
||||
hash = _ref$hash === void 0 ? '' : _ref$hash;
|
||||
if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
|
||||
if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
|
||||
return pathname;
|
||||
}
|
||||
/**
|
||||
* Parses a string URL path into its separate pathname, search, and hash components.
|
||||
*
|
||||
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
|
||||
*/
|
||||
|
||||
function parsePath(path) {
|
||||
var parsedPath = {};
|
||||
|
||||
if (path) {
|
||||
var hashIndex = path.indexOf('#');
|
||||
|
||||
if (hashIndex >= 0) {
|
||||
parsedPath.hash = path.substr(hashIndex);
|
||||
path = path.substr(0, hashIndex);
|
||||
}
|
||||
|
||||
var searchIndex = path.indexOf('?');
|
||||
|
||||
if (searchIndex >= 0) {
|
||||
parsedPath.search = path.substr(searchIndex);
|
||||
path = path.substr(0, searchIndex);
|
||||
}
|
||||
|
||||
if (path) {
|
||||
parsedPath.pathname = path;
|
||||
}
|
||||
}
|
||||
|
||||
return parsedPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","url"]
|
||||
var external_wp_url_namespaceObject = window["wp"]["url"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/history.js
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
const history_history = createBrowserHistory();
|
||||
const originalHistoryPush = history_history.push;
|
||||
const originalHistoryReplace = history_history.replace;
|
||||
|
||||
function 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));
|
||||
const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params);
|
||||
return originalHistoryPush.call(history_history, newUrl, state);
|
||||
}
|
||||
|
||||
function replace(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));
|
||||
const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params);
|
||||
return originalHistoryReplace.call(history_history, newUrl, state);
|
||||
}
|
||||
|
||||
history_history.push = push;
|
||||
history_history.replace = replace;
|
||||
/* harmony default export */ var build_module_history = (history_history);
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/router.js
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
const RoutesContext = (0,external_wp_element_namespaceObject.createContext)();
|
||||
const HistoryContext = (0,external_wp_element_namespaceObject.createContext)();
|
||||
function useLocation() {
|
||||
return (0,external_wp_element_namespaceObject.useContext)(RoutesContext);
|
||||
}
|
||||
function useHistory() {
|
||||
return (0,external_wp_element_namespaceObject.useContext)(HistoryContext);
|
||||
}
|
||||
|
||||
function getLocationWithParams(location) {
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
return { ...location,
|
||||
params: Object.fromEntries(searchParams.entries())
|
||||
};
|
||||
}
|
||||
|
||||
function RouterProvider({
|
||||
children
|
||||
}) {
|
||||
const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(build_module_history.location));
|
||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||
return build_module_history.listen(({
|
||||
location: updatedLocation
|
||||
}) => {
|
||||
setLocation(getLocationWithParams(updatedLocation));
|
||||
});
|
||||
}, []);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, {
|
||||
value: build_module_history
|
||||
}, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, {
|
||||
value: location
|
||||
}, children));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: external ["wp","privateApis"]
|
||||
var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/lock-unlock.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const {
|
||||
lock,
|
||||
unlock
|
||||
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/router');
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/private-apis.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
const privateApis = {};
|
||||
lock(privateApis, {
|
||||
useHistory: useHistory,
|
||||
useLocation: useLocation,
|
||||
RouterProvider: RouterProvider
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/index.js
|
||||
|
||||
|
||||
(window.wp = window.wp || {}).router = __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{privateApis:function(){return A}});var n,r=window.wp.element;function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(n||(n={}));var a=function(e){return e};var u="beforeunload",i="popstate";function c(e){e.preventDefault(),e.returnValue=""}function s(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function l(){return Math.random().toString(36).substr(2,8)}function f(e){var t=e.pathname,n=void 0===t?"/":t,r=e.search,o=void 0===r?"":r,a=e.hash,u=void 0===a?"":a;return o&&"?"!==o&&(n+="?"===o.charAt(0)?o:"?"+o),u&&"#"!==u&&(n+="#"===u.charAt(0)?u:"#"+u),n}function h(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var p=window.wp.url;const d=function(e){void 0===e&&(e={});var t=e.window,r=void 0===t?document.defaultView:t,p=r.history;function d(){var e=r.location,t=e.pathname,n=e.search,o=e.hash,u=p.state||{};return[u.idx,a({pathname:t,search:n,hash:o,state:u.usr||null,key:u.key||"default"})]}var v=null;r.addEventListener(i,(function(){if(v)P.call(v),v=null;else{var e=n.Pop,t=d(),r=t[0],o=t[1];if(P.length){if(null!=r){var a=w-r;a&&(v={action:e,location:o,retry:function(){x(-1*a)}},x(a))}}else j(e)}}));var y=n.Pop,g=d(),w=g[0],b=g[1],m=s(),P=s();function O(e){return"string"==typeof e?e:f(e)}function k(e,t){return void 0===t&&(t=null),a(o({pathname:b.pathname,hash:"",search:""},"string"==typeof e?h(e):e,{state:t,key:l()}))}function A(e,t){return[{usr:e.state,key:e.key,idx:t},O(e)]}function S(e,t,n){return!P.length||(P.call({action:e,location:t,retry:n}),!1)}function j(e){y=e;var t=d();w=t[0],b=t[1],m.call({action:y,location:b})}function x(e){p.go(e)}null==w&&(w=0,p.replaceState(o({},p.state,{idx:w}),""));var E={get action(){return y},get location(){return b},createHref:O,push:function e(t,o){var a=n.Push,u=k(t,o);if(S(a,u,(function(){e(t,o)}))){var i=A(u,w+1),c=i[0],s=i[1];try{p.pushState(c,"",s)}catch(e){r.location.assign(s)}j(a)}},replace:function e(t,r){var o=n.Replace,a=k(t,r);if(S(o,a,(function(){e(t,r)}))){var u=A(a,w),i=u[0],c=u[1];p.replaceState(i,"",c),j(o)}},go:x,back:function(){x(-1)},forward:function(){x(1)},listen:function(e){return m.push(e)},block:function(e){var t=P.push(e);return 1===P.length&&r.addEventListener(u,c),function(){t(),P.length||r.removeEventListener(u,c)}}};return E}(),v=d.push,y=d.replace;d.push=function(e,t){const n=(0,p.getQueryArgs)(window.location.href),r=(0,p.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,p.addQueryArgs)(r,e);return v.call(d,o,t)},d.replace=function(e,t){const n=(0,p.getQueryArgs)(window.location.href),r=(0,p.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,p.addQueryArgs)(r,e);return y.call(d,o,t)};var g=d;const w=(0,r.createContext)(),b=(0,r.createContext)();function m(e){const t=new URLSearchParams(e.search);return{...e,params:Object.fromEntries(t.entries())}}var P=window.wp.privateApis;const{lock:O,unlock:k}=(0,P.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/router"),A={};O(A,{useHistory:function(){return(0,r.useContext)(b)},useLocation:function(){return(0,r.useContext)(w)},RouterProvider:function({children:e}){const[t,n]=(0,r.useState)((()=>m(g.location)));return(0,r.useEffect)((()=>g.listen((({location:e})=>{n(m(e))}))),[]),(0,r.createElement)(b.Provider,{value:g},(0,r.createElement)(w.Provider,{value:t},e))}}),(window.wp=window.wp||{}).router=t}();
|
||||
+31
-51
@@ -147,21 +147,6 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
"default": function() { return /* binding */ build_module; }
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
||||
function _extends() {
|
||||
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
return _extends.apply(this, arguments);
|
||||
}
|
||||
;// CONCATENATED MODULE: external ["wp","element"]
|
||||
var external_wp_element_namespaceObject = window["wp"]["element"];
|
||||
;// CONCATENATED MODULE: external ["wp","data"]
|
||||
@@ -185,7 +170,6 @@ var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/server-side-render.js
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
@@ -202,9 +186,7 @@ var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
|
||||
|
||||
|
||||
const EMPTY_OBJECT = {};
|
||||
function rendererPath(block) {
|
||||
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
let urlQueryArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
function rendererPath(block, attributes = null, urlQueryArgs = {}) {
|
||||
return (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-renderer/${block}`, {
|
||||
context: 'edit',
|
||||
...(null !== attributes ? {
|
||||
@@ -231,26 +213,24 @@ function removeBlockSupportAttributes(attributes) {
|
||||
spacing,
|
||||
typography,
|
||||
...restStyles
|
||||
} = (attributes === null || attributes === void 0 ? void 0 : attributes.style) || EMPTY_OBJECT;
|
||||
} = attributes?.style || EMPTY_OBJECT;
|
||||
return { ...restAttributes,
|
||||
style: restStyles
|
||||
};
|
||||
}
|
||||
|
||||
function DefaultEmptyResponsePlaceholder(_ref) {
|
||||
let {
|
||||
className
|
||||
} = _ref;
|
||||
function DefaultEmptyResponsePlaceholder({
|
||||
className
|
||||
}) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
|
||||
className: className
|
||||
}, (0,external_wp_i18n_namespaceObject.__)('Block rendered as empty.'));
|
||||
}
|
||||
|
||||
function DefaultErrorResponsePlaceholder(_ref2) {
|
||||
let {
|
||||
response,
|
||||
className
|
||||
} = _ref2;
|
||||
function DefaultErrorResponsePlaceholder({
|
||||
response,
|
||||
className
|
||||
}) {
|
||||
const errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: error message describing the problem
|
||||
(0,external_wp_i18n_namespaceObject.__)('Error loading block: %s'), response.errorMsg);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
|
||||
@@ -258,11 +238,10 @@ function DefaultErrorResponsePlaceholder(_ref2) {
|
||||
}, errorMessage);
|
||||
}
|
||||
|
||||
function DefaultLoadingResponsePlaceholder(_ref3) {
|
||||
let {
|
||||
children,
|
||||
showLoader
|
||||
} = _ref3;
|
||||
function DefaultLoadingResponsePlaceholder({
|
||||
children,
|
||||
showLoader
|
||||
}) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
||||
style: {
|
||||
position: 'relative'
|
||||
@@ -382,24 +361,26 @@ function ServerSideRender(props) {
|
||||
}, [isLoading]);
|
||||
const hasResponse = !!response;
|
||||
const hasEmptyResponse = response === '';
|
||||
const hasError = response === null || response === void 0 ? void 0 : response.error;
|
||||
const hasError = response?.error;
|
||||
|
||||
if (isLoading) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(LoadingResponsePlaceholder, _extends({}, props, {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(LoadingResponsePlaceholder, { ...props,
|
||||
showLoader: showLoader
|
||||
}), hasResponse && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, {
|
||||
}, hasResponse && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, {
|
||||
className: className
|
||||
}, response));
|
||||
}
|
||||
|
||||
if (hasEmptyResponse || !hasResponse) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(EmptyResponsePlaceholder, props);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(EmptyResponsePlaceholder, { ...props
|
||||
});
|
||||
}
|
||||
|
||||
if (hasError) {
|
||||
return (0,external_wp_element_namespaceObject.createElement)(ErrorResponsePlaceholder, _extends({
|
||||
response: response
|
||||
}, props));
|
||||
return (0,external_wp_element_namespaceObject.createElement)(ErrorResponsePlaceholder, {
|
||||
response: response,
|
||||
...props
|
||||
});
|
||||
}
|
||||
|
||||
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, {
|
||||
@@ -410,7 +391,6 @@ function ServerSideRender(props) {
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/index.js
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
@@ -446,12 +426,11 @@ const ExportedServerSideRender = (0,external_wp_data_namespaceObject.withSelect)
|
||||
}
|
||||
|
||||
return build_module_EMPTY_OBJECT;
|
||||
})(_ref => {
|
||||
let {
|
||||
urlQueryArgs = build_module_EMPTY_OBJECT,
|
||||
currentPostId,
|
||||
...props
|
||||
} = _ref;
|
||||
})(({
|
||||
urlQueryArgs = build_module_EMPTY_OBJECT,
|
||||
currentPostId,
|
||||
...props
|
||||
}) => {
|
||||
const newUrlQueryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||
if (!currentPostId) {
|
||||
return urlQueryArgs;
|
||||
@@ -462,9 +441,10 @@ const ExportedServerSideRender = (0,external_wp_data_namespaceObject.withSelect)
|
||||
...urlQueryArgs
|
||||
};
|
||||
}, [currentPostId, urlQueryArgs]);
|
||||
return (0,external_wp_element_namespaceObject.createElement)(ServerSideRender, _extends({
|
||||
urlQueryArgs: newUrlQueryArgs
|
||||
}, props));
|
||||
return (0,external_wp_element_namespaceObject.createElement)(ServerSideRender, {
|
||||
urlQueryArgs: newUrlQueryArgs,
|
||||
...props
|
||||
});
|
||||
});
|
||||
/* harmony default export */ var build_module = (ExportedServerSideRender);
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={5619:function(e){e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var n,o,u;if(Array.isArray(r)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(!e(r[o],t[o]))return!1;return!0}if(r instanceof Map&&t instanceof Map){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;for(o of r.entries())if(!e(o[1],t.get(o[0])))return!1;return!0}if(r instanceof Set&&t instanceof Set){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(r)&&ArrayBuffer.isView(t)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(r[o]!==t[o])return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((n=(u=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,u[o]))return!1;for(o=n;0!=o--;){var i=u[o];if(!e(r[i],t[i]))return!1}return!0}return r!=r&&t!=t}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var u=r[n]={exports:{}};return e[n](u,u.exports,t),u.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var n={};!function(){function e(){return e=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},e.apply(this,arguments)}t.d(n,{default:function(){return b}});var r=window.wp.element,o=window.wp.data,u=t(5619),i=t.n(u),s=window.wp.compose,c=window.wp.i18n,l=window.wp.apiFetch,a=t.n(l),f=window.wp.url,p=window.wp.components,d=window.wp.blocks;const w={};function m(e){let{className:t}=e;return(0,r.createElement)(p.Placeholder,{className:t},(0,c.__)("Block rendered as empty."))}function g(e){let{response:t,className:n}=e;const o=(0,c.sprintf)((0,c.__)("Error loading block: %s"),t.errorMsg);return(0,r.createElement)(p.Placeholder,{className:n},o)}function y(e){let{children:t,showLoader:n}=e;return(0,r.createElement)("div",{style:{position:"relative"}},n&&(0,r.createElement)("div",{style:{position:"absolute",top:"50%",left:"50%",marginTop:"-9px",marginLeft:"-9px"}},(0,r.createElement)(p.Spinner,null)),(0,r.createElement)("div",{style:{opacity:n?"0.3":1}},t))}function v(t){const{attributes:n,block:o,className:u,httpMethod:c="GET",urlQueryArgs:l,skipBlockSupportAttributes:p=!1,EmptyResponsePlaceholder:v=m,ErrorResponsePlaceholder:h=g,LoadingResponsePlaceholder:b=y}=t,E=(0,r.useRef)(!0),[O,S]=(0,r.useState)(!1),P=(0,r.useRef)(),[j,k]=(0,r.useState)(null),x=(0,s.usePrevious)(t),[A,M]=(0,r.useState)(!1);function R(){var e,r;if(!E.current)return;M(!0);let t=n&&(0,d.__experimentalSanitizeBlockAttributes)(o,n);p&&(t=function(e){const{backgroundColor:r,borderColor:t,fontFamily:n,fontSize:o,gradient:u,textColor:i,className:s,...c}=e,{border:l,color:a,elements:f,spacing:p,typography:d,...m}=(null==e?void 0:e.style)||w;return{...c,style:m}}(t));const u="POST"===c,i=u?null:null!==(e=t)&&void 0!==e?e:null,s=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,f.addQueryArgs)(`/wp/v2/block-renderer/${e}`,{context:"edit",...null!==r?{attributes:r}:{},...t})}(o,i,l),m=u?{attributes:null!==(r=t)&&void 0!==r?r:null}:null,g=P.current=a()({path:s,data:m,method:u?"POST":"GET"}).then((e=>{E.current&&g===P.current&&e&&k(e.rendered)})).catch((e=>{E.current&&g===P.current&&k({error:!0,errorMsg:e.message})})).finally((()=>{E.current&&g===P.current&&M(!1)}));return g}const T=(0,s.useDebounce)(R,500);(0,r.useEffect)((()=>()=>{E.current=!1}),[]),(0,r.useEffect)((()=>{void 0===x?R():i()(x,t)||T()})),(0,r.useEffect)((()=>{if(!A)return;const e=setTimeout((()=>{S(!0)}),1e3);return()=>clearTimeout(e)}),[A]);const _=!!j,N=""===j,z=null==j?void 0:j.error;return A?(0,r.createElement)(b,e({},t,{showLoader:O}),_&&(0,r.createElement)(r.RawHTML,{className:u},j)):N||!_?(0,r.createElement)(v,t):z?(0,r.createElement)(h,e({response:j},t)):(0,r.createElement)(r.RawHTML,{className:u},j)}const h={};var b=(0,o.withSelect)((e=>{const r=e("core/editor");if(r){const e=r.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return h}))((t=>{let{urlQueryArgs:n=h,currentPostId:o,...u}=t;const i=(0,r.useMemo)((()=>o?{post_id:o,...n}:n),[o,n]);return(0,r.createElement)(v,e({urlQueryArgs:i},u))}))}(),(window.wp=window.wp||{}).serverSideRender=n.default}();
|
||||
!function(){"use strict";var e={5619:function(e){e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var n,o,u;if(Array.isArray(r)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(!e(r[o],t[o]))return!1;return!0}if(r instanceof Map&&t instanceof Map){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;for(o of r.entries())if(!e(o[1],t.get(o[0])))return!1;return!0}if(r instanceof Set&&t instanceof Set){if(r.size!==t.size)return!1;for(o of r.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(r)&&ArrayBuffer.isView(t)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(r[o]!==t[o])return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((n=(u=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,u[o]))return!1;for(o=n;0!=o--;){var s=u[o];if(!e(r[s],t[s]))return!1}return!0}return r!=r&&t!=t}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var u=r[n]={exports:{}};return e[n](u,u.exports,t),u.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var n={};!function(){t.d(n,{default:function(){return v}});var e=window.wp.element,r=window.wp.data,o=t(5619),u=t.n(o),s=window.wp.compose,i=window.wp.i18n,c=window.wp.apiFetch,a=t.n(c),l=window.wp.url,f=window.wp.components,p=window.wp.blocks;const d={};function w({className:r}){return(0,e.createElement)(f.Placeholder,{className:r},(0,i.__)("Block rendered as empty."))}function m({response:r,className:t}){const n=(0,i.sprintf)((0,i.__)("Error loading block: %s"),r.errorMsg);return(0,e.createElement)(f.Placeholder,{className:t},n)}function y({children:r,showLoader:t}){return(0,e.createElement)("div",{style:{position:"relative"}},t&&(0,e.createElement)("div",{style:{position:"absolute",top:"50%",left:"50%",marginTop:"-9px",marginLeft:"-9px"}},(0,e.createElement)(f.Spinner,null)),(0,e.createElement)("div",{style:{opacity:t?"0.3":1}},r))}function g(r){const{attributes:t,block:n,className:o,httpMethod:i="GET",urlQueryArgs:c,skipBlockSupportAttributes:f=!1,EmptyResponsePlaceholder:g=w,ErrorResponsePlaceholder:h=m,LoadingResponsePlaceholder:v=y}=r,b=(0,e.useRef)(!0),[E,S]=(0,e.useState)(!1),O=(0,e.useRef)(),[P,k]=(0,e.useState)(null),x=(0,s.usePrevious)(r),[A,j]=(0,e.useState)(!1);function M(){var e,r;if(!b.current)return;j(!0);let o=t&&(0,p.__experimentalSanitizeBlockAttributes)(n,t);f&&(o=function(e){const{backgroundColor:r,borderColor:t,fontFamily:n,fontSize:o,gradient:u,textColor:s,className:i,...c}=e,{border:a,color:l,elements:f,spacing:p,typography:w,...m}=e?.style||d;return{...c,style:m}}(o));const u="POST"===i,s=u?null:null!==(e=o)&&void 0!==e?e:null,w=function(e,r=null,t={}){return(0,l.addQueryArgs)(`/wp/v2/block-renderer/${e}`,{context:"edit",...null!==r?{attributes:r}:{},...t})}(n,s,c),m=u?{attributes:null!==(r=o)&&void 0!==r?r:null}:null,y=O.current=a()({path:w,data:m,method:u?"POST":"GET"}).then((e=>{b.current&&y===O.current&&e&&k(e.rendered)})).catch((e=>{b.current&&y===O.current&&k({error:!0,errorMsg:e.message})})).finally((()=>{b.current&&y===O.current&&j(!1)}));return y}const R=(0,s.useDebounce)(M,500);(0,e.useEffect)((()=>()=>{b.current=!1}),[]),(0,e.useEffect)((()=>{void 0===x?M():u()(x,r)||R()})),(0,e.useEffect)((()=>{if(!A)return;const e=setTimeout((()=>{S(!0)}),1e3);return()=>clearTimeout(e)}),[A]);const T=!!P,_=""===P,N=P?.error;return A?(0,e.createElement)(v,{...r,showLoader:E},T&&(0,e.createElement)(e.RawHTML,{className:o},P)):_||!T?(0,e.createElement)(g,{...r}):N?(0,e.createElement)(h,{response:P,...r}):(0,e.createElement)(e.RawHTML,{className:o},P)}const h={};var v=(0,r.withSelect)((e=>{const r=e("core/editor");if(r){const e=r.getCurrentPostId();if(e&&"number"==typeof e)return{currentPostId:e}}return h}))((({urlQueryArgs:r=h,currentPostId:t,...n})=>{const o=(0,e.useMemo)((()=>t?{post_id:t,...r}:r),[t,r]);return(0,e.createElement)(g,{urlQueryArgs:o,...n})}))}(),(window.wp=window.wp||{}).serverSideRender=n.default}();
|
||||
Vendored
+61
-104
@@ -1,9 +1,37 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
/******/ "use strict";
|
||||
/******/ // The require scope
|
||||
/******/ var __webpack_require__ = {};
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ !function() {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, definition) {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ !function() {
|
||||
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
||||
/******/ }();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
|
||||
/***/ 9756:
|
||||
/***/ (function(module) {
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"default": function() { return /* binding */ build_module; }
|
||||
});
|
||||
|
||||
// UNUSED EXPORTS: attrs, fromMatch, next, regexp, replace, string
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
|
||||
/**
|
||||
* Memize options object.
|
||||
*
|
||||
@@ -36,14 +64,14 @@
|
||||
* Accepts a function to be memoized, and returns a new memoized function, with
|
||||
* optional options.
|
||||
*
|
||||
* @template {Function} F
|
||||
* @template {(...args: any[]) => any} F
|
||||
*
|
||||
* @param {F} fn Function to memoize.
|
||||
* @param {MemizeOptions} [options] Options object.
|
||||
*
|
||||
* @return {F & MemizeMemoizedFunction} Memoized function.
|
||||
* @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
|
||||
*/
|
||||
function memize( fn, options ) {
|
||||
function memize(fn, options) {
|
||||
var size = 0;
|
||||
|
||||
/** @type {?MemizeCacheNode|undefined} */
|
||||
@@ -54,12 +82,13 @@ function memize( fn, options ) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
function memoized( /* ...args */ ) {
|
||||
function memoized(/* ...args */) {
|
||||
var node = head,
|
||||
len = arguments.length,
|
||||
args, i;
|
||||
args,
|
||||
i;
|
||||
|
||||
searchCache: while ( node ) {
|
||||
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
|
||||
@@ -67,14 +96,14 @@ function memize( fn, options ) {
|
||||
// function which could incur an arguments leaking deoptimization.
|
||||
|
||||
// Check whether node arguments match arguments length
|
||||
if ( node.args.length !== 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 ] ) {
|
||||
for (i = 0; i < len; i++) {
|
||||
if (node.args[i] !== arguments[i]) {
|
||||
node = node.next;
|
||||
continue searchCache;
|
||||
}
|
||||
@@ -83,23 +112,23 @@ function memize( fn, options ) {
|
||||
// At this point we can assume we've found a match
|
||||
|
||||
// Surface matched node to head if not already
|
||||
if ( node !== head ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
/** @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;
|
||||
/** @type {MemizeCacheNode} */ (head).prev = node;
|
||||
head = node;
|
||||
}
|
||||
|
||||
@@ -110,23 +139,23 @@ function memize( fn, options ) {
|
||||
// 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 ];
|
||||
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 ),
|
||||
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 ) {
|
||||
if (head) {
|
||||
head.prev = node;
|
||||
node.next = head;
|
||||
} else {
|
||||
@@ -135,9 +164,9 @@ function memize( fn, options ) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
|
||||
tail = /** @type {MemizeCacheNode} */ (tail).prev;
|
||||
/** @type {MemizeCacheNode} */ (tail).next = null;
|
||||
} else {
|
||||
size++;
|
||||
}
|
||||
@@ -147,14 +176,12 @@ function memize( fn, options ) {
|
||||
return node.val;
|
||||
}
|
||||
|
||||
memoized.clear = function() {
|
||||
memoized.clear = function () {
|
||||
head = null;
|
||||
tail = null;
|
||||
size = 0;
|
||||
};
|
||||
|
||||
if ( false ) {}
|
||||
|
||||
// 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
|
||||
@@ -164,75 +191,9 @@ function memize( fn, options ) {
|
||||
return memoized;
|
||||
}
|
||||
|
||||
module.exports = memize;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/compat get default export */
|
||||
/******/ !function() {
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function() { return module['default']; } :
|
||||
/******/ function() { return module; };
|
||||
/******/ __webpack_require__.d(getter, { a: getter });
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ !function() {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, definition) {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ !function() {
|
||||
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
||||
/******/ }();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
||||
!function() {
|
||||
"use strict";
|
||||
/* unused harmony exports next, replace, string, regexp, attrs, fromMatch */
|
||||
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9756);
|
||||
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_0__);
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/shortcode/build-module/index.js
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
@@ -276,8 +237,7 @@ var __webpack_exports__ = {};
|
||||
* @return {WPShortcodeMatch | undefined} Matched information.
|
||||
*/
|
||||
|
||||
function next(tag, text) {
|
||||
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
function next(tag, text, index = 0) {
|
||||
const re = regexp(tag);
|
||||
re.lastIndex = index;
|
||||
const match = re.exec(text);
|
||||
@@ -395,7 +355,7 @@ function regexp(tag) {
|
||||
* @return {WPShortcodeAttrs} Parsed shortcode attributes.
|
||||
*/
|
||||
|
||||
const attrs = memize__WEBPACK_IMPORTED_MODULE_0___default()(text => {
|
||||
const attrs = memize(text => {
|
||||
const named = {};
|
||||
const numeric = []; // This regular expression is reused from `shortcode_parse_atts()` in
|
||||
// `wp-includes/shortcodes.php`.
|
||||
@@ -510,8 +470,7 @@ const shortcode = Object.assign(function (options) {
|
||||
} else if (attributes.length === attributeTypes.length && attributeTypes.every((t, key) => t === attributes[key])) {
|
||||
this.attrs = attributes; // Handle a flat object of attributes.
|
||||
} else {
|
||||
Object.entries(attributes).forEach(_ref => {
|
||||
let [key, value] = _ref;
|
||||
Object.entries(attributes).forEach(([key, value]) => {
|
||||
this.set(key, value);
|
||||
});
|
||||
}
|
||||
@@ -568,8 +527,7 @@ Object.assign(shortcode.prototype, {
|
||||
text += ' ' + value;
|
||||
}
|
||||
});
|
||||
Object.entries(this.attrs.named).forEach(_ref2 => {
|
||||
let [name, value] = _ref2;
|
||||
Object.entries(this.attrs.named).forEach(([name, value]) => {
|
||||
text += ' ' + name + '="' + value + '"';
|
||||
}); // If the tag is marked as `single` or `self-closing`, close the tag and
|
||||
// ignore any additional content.
|
||||
@@ -592,9 +550,8 @@ Object.assign(shortcode.prototype, {
|
||||
}
|
||||
|
||||
});
|
||||
/* harmony default export */ __webpack_exports__["default"] = (shortcode);
|
||||
/* harmony default export */ var build_module = (shortcode);
|
||||
|
||||
}();
|
||||
(window.wp = window.wp || {}).shortcode = __webpack_exports__["default"];
|
||||
/******/ })()
|
||||
;
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){var t={9756:function(t){t.exports=function(t,e){var n,r,s=0;function o(){var o,i,c=n,u=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i<u;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==n&&(c===r&&(r=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=n,c.prev=null,n.prev=c,n=c),c.val}c=c.next}for(o=new Array(u),i=0;i<u;i++)o[i]=arguments[i];return c={args:o,val:t.apply(null,o)},n?(n.prev=c,c.next=n):r=c,s===e.maxSize?(r=r.prev).next=null:s++,n=c,c.val}return e=e||{},o.clear=function(){n=null,r=null,s=0},o}}},e={};function n(r){var s=e[r];if(void 0!==s)return s.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var r={};!function(){"use strict";var t=n(9756);function e(t){return new RegExp("\\[(\\[?)("+t+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)","g")}const s=n.n(t)()((t=>{const e={},n=[],r=/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;let s;for(t=t.replace(/[\u00a0\u200b]/g," ");s=r.exec(t);)s[1]?e[s[1].toLowerCase()]=s[2]:s[3]?e[s[3].toLowerCase()]=s[4]:s[5]?e[s[5].toLowerCase()]=s[6]:s[7]?n.push(s[7]):s[8]?n.push(s[8]):s[9]&&n.push(s[9]);return{named:e,numeric:n}}));function o(t){let e;return e=t[4]?"self-closing":t[6]?"closed":"single",new i({tag:t[2],attrs:t[3],type:e,content:t[5]})}const i=Object.assign((function(t){const{tag:e,attrs:n,type:r,content:o}=t||{};if(Object.assign(this,{tag:e,type:r,content:o}),this.attrs={named:{},numeric:[]},!n)return;const i=["named","numeric"];"string"==typeof n?this.attrs=s(n):n.length===i.length&&i.every(((t,e)=>t===n[e]))?this.attrs=n:Object.entries(n).forEach((t=>{let[e,n]=t;this.set(e,n)}))}),{next:function t(n,r){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=e(n);i.lastIndex=s;const c=i.exec(r);if(!c)return;if("["===c[1]&&"]"===c[7])return t(n,r,i.lastIndex);const u={index:c.index,content:c[0],shortcode:o(c)};return c[1]&&(u.content=u.content.slice(1),u.index++),c[7]&&(u.content=u.content.slice(0,-1)),u},replace:function(t,n,r){return n.replace(e(t),(function(t,e,n,s,i,c,u,a){if("["===e&&"]"===a)return t;const l=r(o(arguments));return l||""===l?e+l+a:t}))},string:function(t){return new i(t).string()},regexp:e,attrs:s,fromMatch:o});Object.assign(i.prototype,{get(t){return this.attrs["number"==typeof t?"numeric":"named"][t]},set(t,e){return this.attrs["number"==typeof t?"numeric":"named"][t]=e,this},string(){let t="["+this.tag;return this.attrs.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),Object.entries(this.attrs.named).forEach((e=>{let[n,r]=e;t+=" "+n+'="'+r+'"'})),"single"===this.type?t+"]":"self-closing"===this.type?t+" /]":(t+="]",this.content&&(t+=this.content),t+"[/"+this.tag+"]")}}),r.default=i}(),(window.wp=window.wp||{}).shortcode=r.default}();
|
||||
!function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e={};function n(t){return new RegExp("\\[(\\[?)("+t+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)","g")}t.d(e,{default:function(){return i}});const r=function(t,e){var n,r,s=0;function o(){var o,i,c=n,a=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i<a;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==n&&(c===r&&(r=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=n,c.prev=null,n.prev=c,n=c),c.val}c=c.next}for(o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return c={args:o,val:t.apply(null,o)},n?(n.prev=c,c.next=n):r=c,s===e.maxSize?(r=r.prev).next=null:s++,n=c,c.val}return e=e||{},o.clear=function(){n=null,r=null,s=0},o}((t=>{const e={},n=[],r=/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;let s;for(t=t.replace(/[\u00a0\u200b]/g," ");s=r.exec(t);)s[1]?e[s[1].toLowerCase()]=s[2]:s[3]?e[s[3].toLowerCase()]=s[4]:s[5]?e[s[5].toLowerCase()]=s[6]:s[7]?n.push(s[7]):s[8]?n.push(s[8]):s[9]&&n.push(s[9]);return{named:e,numeric:n}}));function s(t){let e;return e=t[4]?"self-closing":t[6]?"closed":"single",new o({tag:t[2],attrs:t[3],type:e,content:t[5]})}const o=Object.assign((function(t){const{tag:e,attrs:n,type:s,content:o}=t||{};if(Object.assign(this,{tag:e,type:s,content:o}),this.attrs={named:{},numeric:[]},!n)return;const i=["named","numeric"];"string"==typeof n?this.attrs=r(n):n.length===i.length&&i.every(((t,e)=>t===n[e]))?this.attrs=n:Object.entries(n).forEach((([t,e])=>{this.set(t,e)}))}),{next:function t(e,r,o=0){const i=n(e);i.lastIndex=o;const c=i.exec(r);if(!c)return;if("["===c[1]&&"]"===c[7])return t(e,r,i.lastIndex);const a={index:c.index,content:c[0],shortcode:s(c)};return c[1]&&(a.content=a.content.slice(1),a.index++),c[7]&&(a.content=a.content.slice(0,-1)),a},replace:function(t,e,r){return e.replace(n(t),(function(t,e,n,o,i,c,a,u){if("["===e&&"]"===u)return t;const l=r(s(arguments));return l||""===l?e+l+u:t}))},string:function(t){return new o(t).string()},regexp:n,attrs:r,fromMatch:s});Object.assign(o.prototype,{get(t){return this.attrs["number"==typeof t?"numeric":"named"][t]},set(t,e){return this.attrs["number"==typeof t?"numeric":"named"][t]=e,this},string(){let t="["+this.tag;return this.attrs.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),Object.entries(this.attrs.named).forEach((([e,n])=>{t+=" "+e+'="'+n+'"'})),"single"===this.type?t+"]":"self-closing"===this.type?t+" /]":(t+="]",this.content&&(t+=this.content),t+"[/"+this.tag+"]")}});var i=o;(window.wp=window.wp||{}).shortcode=e.default}();
|
||||
+47
-43
@@ -63,10 +63,10 @@ const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
|
||||
/**
|
||||
* Returns a JSON representation of the generated CSS rules.
|
||||
*
|
||||
* @param style Style object.
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
* @param ruleKey A CSS property key.
|
||||
* @param style Style object.
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
* @param ruleKey A CSS property key.
|
||||
*
|
||||
* @return GeneratedCSSRule[] CSS rules.
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
|
||||
function generateRule(style, options, path, ruleKey) {
|
||||
const styleValue = (0,external_lodash_namespaceObject.get)(style, path);
|
||||
return styleValue ? [{
|
||||
selector: options === null || options === void 0 ? void 0 : options.selector,
|
||||
selector: options?.selector,
|
||||
key: ruleKey,
|
||||
value: getCSSVarFromStyleValue(styleValue)
|
||||
}] : [];
|
||||
@@ -82,17 +82,16 @@ function generateRule(style, options, path, ruleKey) {
|
||||
/**
|
||||
* Returns a JSON representation of the generated CSS rules taking into account box model properties, top, right, bottom, left.
|
||||
*
|
||||
* @param style Style object.
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
* @param ruleKeys An array of CSS property keys and patterns.
|
||||
* @param individualProperties The "sides" or individual properties for which to generate rules.
|
||||
* @param style Style object.
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
* @param ruleKeys An array of CSS property keys and patterns.
|
||||
* @param individualProperties The "sides" or individual properties for which to generate rules.
|
||||
*
|
||||
* @return GeneratedCSSRule[] CSS rules.
|
||||
*/
|
||||
|
||||
function generateBoxRules(style, options, path, ruleKeys) {
|
||||
let individualProperties = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['top', 'right', 'bottom', 'left'];
|
||||
function generateBoxRules(style, options, path, ruleKeys, individualProperties = ['top', 'right', 'bottom', 'left']) {
|
||||
const boxStyle = (0,external_lodash_namespaceObject.get)(style, path);
|
||||
|
||||
if (!boxStyle) {
|
||||
@@ -103,7 +102,7 @@ function generateBoxRules(style, options, path, ruleKeys) {
|
||||
|
||||
if (typeof boxStyle === 'string') {
|
||||
rules.push({
|
||||
selector: options === null || options === void 0 ? void 0 : options.selector,
|
||||
selector: options?.selector,
|
||||
key: ruleKeys.default,
|
||||
value: boxStyle
|
||||
});
|
||||
@@ -113,8 +112,8 @@ function generateBoxRules(style, options, path, ruleKeys) {
|
||||
|
||||
if (value) {
|
||||
acc.push({
|
||||
selector: options === null || options === void 0 ? void 0 : options.selector,
|
||||
key: ruleKeys === null || ruleKeys === void 0 ? void 0 : ruleKeys.individual.replace('%s', upperFirst(side)),
|
||||
selector: options?.selector,
|
||||
key: ruleKeys?.individual.replace('%s', upperFirst(side)),
|
||||
value
|
||||
});
|
||||
}
|
||||
@@ -129,7 +128,7 @@ function generateBoxRules(style, options, path, ruleKeys) {
|
||||
/**
|
||||
* Returns a CSS var value from incoming style value following the pattern `var:description|context|slug`.
|
||||
*
|
||||
* @param styleValue A raw style value.
|
||||
* @param styleValue A raw style value.
|
||||
*
|
||||
* @return string A CSS var value.
|
||||
*/
|
||||
@@ -145,7 +144,7 @@ function getCSSVarFromStyleValue(styleValue) {
|
||||
/**
|
||||
* Capitalizes the first letter in a string.
|
||||
*
|
||||
* @param string The string whose first letter the function will capitalize.
|
||||
* @param string The string whose first letter the function will capitalize.
|
||||
*
|
||||
* @return String with the first letter capitalized.
|
||||
*/
|
||||
@@ -157,7 +156,7 @@ function upperFirst(string) {
|
||||
/**
|
||||
* Converts an array of strings into a camelCase string.
|
||||
*
|
||||
* @param strings The strings to join into a camelCase string.
|
||||
* @param strings The strings to join into a camelCase string.
|
||||
*
|
||||
* @return camelCase string.
|
||||
*/
|
||||
@@ -175,7 +174,7 @@ function camelCaseJoin(strings) {
|
||||
/**
|
||||
* Creates a function for generating CSS rules when the style path is the same as the camelCase CSS property used in React.
|
||||
*
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
* @param path An array of strings representing the path to the style value in the style object.
|
||||
*
|
||||
* @return A function that generates CSS rules.
|
||||
*/
|
||||
@@ -186,7 +185,7 @@ function createBorderGenerateFunction(path) {
|
||||
/**
|
||||
* Creates a function for generating border-{top,bottom,left,right}-{color,style,width} CSS rules.
|
||||
*
|
||||
* @param edge The edge to create CSS rules for.
|
||||
* @param edge The edge to create CSS rules for.
|
||||
*
|
||||
* @return A function that generates CSS rules.
|
||||
*/
|
||||
@@ -321,33 +320,25 @@ const shadow = {
|
||||
|
||||
const outline_color = {
|
||||
name: 'color',
|
||||
generate: function (style, options) {
|
||||
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['outline', 'color'];
|
||||
let ruleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'outlineColor';
|
||||
generate: (style, options, path = ['outline', 'color'], ruleKey = 'outlineColor') => {
|
||||
return generateRule(style, options, path, ruleKey);
|
||||
}
|
||||
};
|
||||
const offset = {
|
||||
name: 'offset',
|
||||
generate: function (style, options) {
|
||||
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['outline', 'offset'];
|
||||
let ruleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'outlineOffset';
|
||||
generate: (style, options, path = ['outline', 'offset'], ruleKey = 'outlineOffset') => {
|
||||
return generateRule(style, options, path, ruleKey);
|
||||
}
|
||||
};
|
||||
const outlineStyle = {
|
||||
name: 'style',
|
||||
generate: function (style, options) {
|
||||
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['outline', 'style'];
|
||||
let ruleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'outlineStyle';
|
||||
generate: (style, options, path = ['outline', 'style'], ruleKey = 'outlineStyle') => {
|
||||
return generateRule(style, options, path, ruleKey);
|
||||
}
|
||||
};
|
||||
const outline_width = {
|
||||
name: 'width',
|
||||
generate: function (style, options) {
|
||||
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['outline', 'width'];
|
||||
let ruleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'outlineWidth';
|
||||
generate: (style, options, path = ['outline', 'width'], ruleKey = 'outlineWidth') => {
|
||||
return generateRule(style, options, path, ruleKey);
|
||||
}
|
||||
};
|
||||
@@ -429,7 +420,7 @@ const letterSpacing = {
|
||||
}
|
||||
};
|
||||
const lineHeight = {
|
||||
name: 'letterSpacing',
|
||||
name: 'lineHeight',
|
||||
generate: (style, options) => {
|
||||
return generateRule(style, options, ['typography', 'lineHeight'], 'lineHeight');
|
||||
}
|
||||
@@ -482,17 +473,16 @@ const styleDefinitions = [...border, ...styles_color, ...dimensions, ...outline,
|
||||
*
|
||||
* @since 6.1.0 Introduced in WordPress core.
|
||||
*
|
||||
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
*
|
||||
* @return A generated stylesheet or inline style declarations.
|
||||
*/
|
||||
|
||||
function compileCSS(style) {
|
||||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
function compileCSS(style, options = {}) {
|
||||
const rules = getCSSRules(style, options); // If no selector is provided, treat generated rules as inline styles to be returned as a single string.
|
||||
|
||||
if (!(options !== null && options !== void 0 && options.selector)) {
|
||||
if (!options?.selector) {
|
||||
const inlineRules = [];
|
||||
rules.forEach(rule => {
|
||||
inlineRules.push(`${(0,external_lodash_namespaceObject.kebabCase)(rule.key)}: ${rule.value};`);
|
||||
@@ -500,7 +490,22 @@ function compileCSS(style) {
|
||||
return inlineRules.join(' ');
|
||||
}
|
||||
|
||||
const groupedRules = (0,external_lodash_namespaceObject.groupBy)(rules, 'selector');
|
||||
const groupedRules = rules.reduce((acc, rule) => {
|
||||
const {
|
||||
selector
|
||||
} = rule;
|
||||
|
||||
if (!selector) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
if (!acc[selector]) {
|
||||
acc[selector] = [];
|
||||
}
|
||||
|
||||
acc[selector].push(rule);
|
||||
return acc;
|
||||
}, {});
|
||||
const selectorRules = Object.keys(groupedRules).reduce((acc, subSelector) => {
|
||||
acc.push(`${subSelector} { ${groupedRules[subSelector].map(rule => `${(0,external_lodash_namespaceObject.kebabCase)(rule.key)}: ${rule.value};`).join(' ')} }`);
|
||||
return acc;
|
||||
@@ -512,14 +517,13 @@ function compileCSS(style) {
|
||||
*
|
||||
* @since 6.1.0 Introduced in WordPress core.
|
||||
*
|
||||
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
||||
* @param options Options object with settings to adjust how the styles are generated.
|
||||
*
|
||||
* @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.
|
||||
*/
|
||||
|
||||
function getCSSRules(style) {
|
||||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
function getCSSRules(style, options = {}) {
|
||||
const rules = [];
|
||||
styleDefinitions.forEach(definition => {
|
||||
if (typeof definition.generate === 'function') {
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compileCSS:function(){return h},getCSSRules:function(){return y}});var n=window.lodash;const o="var:";function r(e,t,o,r){const a=(0,n.get)(e,o);return a?[{selector:null==t?void 0:t.selector,key:r,value:i(a)}]:[]}function a(e,t,o,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:["top","right","bottom","left"];const g=(0,n.get)(e,o);if(!g)return[];const u=[];if("string"==typeof g)u.push({selector:null==t?void 0:t.selector,key:r.default,value:g});else{const e=a.reduce(((e,o)=>{const a=i((0,n.get)(g,[o]));return a&&e.push({selector:null==t?void 0:t.selector,key:null==r?void 0:r.individual.replace("%s",l(o)),value:a}),e}),[]);u.push(...e)}return u}function i(e){if("string"==typeof e&&e.startsWith(o)){return`var(--wp--${e.slice(o.length).split("|").map((e=>(0,n.kebabCase)(e))).join("--")})`}return e}function l(e){const[t,...n]=e;return t.toUpperCase()+n.join("")}function g(e){return(t,n)=>r(t,n,e,function(e){const[t,...n]=e;return t.toLowerCase()+n.map(l).join("")}(e))}function u(e){return(t,n)=>["color","style","width"].flatMap((o=>g(["border",e,o])(t,n)))}const d={name:"radius",generate:(e,t)=>a(e,t,["border","radius"],{default:"borderRadius",individual:"border%sRadius"},["topLeft","topRight","bottomLeft","bottomRight"])};const c={name:"color",generate:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["outline","color"],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"outlineColor";return r(e,t,n,o)}},s={name:"offset",generate:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["outline","offset"],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"outlineOffset";return r(e,t,n,o)}},f={name:"style",generate:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["outline","style"],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"outlineStyle";return r(e,t,n,o)}},p={name:"width",generate:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["outline","width"],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"outlineWidth";return r(e,t,n,o)}};const m=[...[{name:"color",generate:g(["border","color"])},{name:"style",generate:g(["border","style"])},{name:"width",generate:g(["border","width"])},d,{name:"borderTop",generate:u("top")},{name:"borderRight",generate:u("right")},{name:"borderBottom",generate:u("bottom")},{name:"borderLeft",generate:u("left")}],...[{name:"text",generate:(e,t)=>r(e,t,["color","text"],"color")},{name:"gradient",generate:(e,t)=>r(e,t,["color","gradient"],"background")},{name:"background",generate:(e,t)=>r(e,t,["color","background"],"backgroundColor")}],...[{name:"minHeight",generate:(e,t)=>r(e,t,["dimensions","minHeight"],"minHeight")}],...[c,f,s,p],...[{name:"margin",generate:(e,t)=>a(e,t,["spacing","margin"],{default:"margin",individual:"margin%s"})},{name:"padding",generate:(e,t)=>a(e,t,["spacing","padding"],{default:"padding",individual:"padding%s"})}],...[{name:"fontFamily",generate:(e,t)=>r(e,t,["typography","fontFamily"],"fontFamily")},{name:"fontSize",generate:(e,t)=>r(e,t,["typography","fontSize"],"fontSize")},{name:"fontStyle",generate:(e,t)=>r(e,t,["typography","fontStyle"],"fontStyle")},{name:"fontWeight",generate:(e,t)=>r(e,t,["typography","fontWeight"],"fontWeight")},{name:"letterSpacing",generate:(e,t)=>r(e,t,["typography","letterSpacing"],"letterSpacing")},{name:"letterSpacing",generate:(e,t)=>r(e,t,["typography","lineHeight"],"lineHeight")},{name:"textColumns",generate:(e,t)=>r(e,t,["typography","textColumns"],"columnCount")},{name:"textDecoration",generate:(e,t)=>r(e,t,["typography","textDecoration"],"textDecoration")},{name:"textTransform",generate:(e,t)=>r(e,t,["typography","textTransform"],"textTransform")}],...[{name:"shadow",generate:(e,t)=>r(e,t,["shadow"],"boxShadow")}]];function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=y(e,t);if(null==t||!t.selector){const e=[];return o.forEach((t=>{e.push(`${(0,n.kebabCase)(t.key)}: ${t.value};`)})),e.join(" ")}const r=(0,n.groupBy)(o,"selector"),a=Object.keys(r).reduce(((e,t)=>(e.push(`${t} { ${r[t].map((e=>`${(0,n.kebabCase)(e.key)}: ${e.value};`)).join(" ")} }`),e)),[]);return a.join("\n")}function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=[];return m.forEach((o=>{"function"==typeof o.generate&&n.push(...o.generate(e,t))})),n}(window.wp=window.wp||{}).styleEngine=t}();
|
||||
!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compileCSS:function(){return p},getCSSRules:function(){return m}});var n=window.lodash;const o="var:",r="|",a="--";function i(e,t,o,r){const a=(0,n.get)(e,o);return a?[{selector:t?.selector,key:r,value:u(a)}]:[]}function g(e,t,o,r,a=["top","right","bottom","left"]){const i=(0,n.get)(e,o);if(!i)return[];const g=[];if("string"==typeof i)g.push({selector:t?.selector,key:r.default,value:i});else{const e=a.reduce(((e,o)=>{const a=u((0,n.get)(i,[o]));return a&&e.push({selector:t?.selector,key:r?.individual.replace("%s",l(o)),value:a}),e}),[]);g.push(...e)}return g}function u(e){if("string"==typeof e&&e.startsWith(o)){return`var(--wp--${e.slice(o.length).split(r).map((e=>(0,n.kebabCase)(e))).join(a)})`}return e}function l(e){const[t,...n]=e;return t.toUpperCase()+n.join("")}function s(e){return(t,n)=>i(t,n,e,function(e){const[t,...n]=e;return t.toLowerCase()+n.map(l).join("")}(e))}function c(e){return(t,n)=>["color","style","width"].flatMap((o=>s(["border",e,o])(t,n)))}const d={name:"radius",generate:(e,t)=>g(e,t,["border","radius"],{default:"borderRadius",individual:"border%sRadius"},["topLeft","topRight","bottomLeft","bottomRight"])};const f=[...[{name:"color",generate:s(["border","color"])},{name:"style",generate:s(["border","style"])},{name:"width",generate:s(["border","width"])},d,{name:"borderTop",generate:c("top")},{name:"borderRight",generate:c("right")},{name:"borderBottom",generate:c("bottom")},{name:"borderLeft",generate:c("left")}],...[{name:"text",generate:(e,t)=>i(e,t,["color","text"],"color")},{name:"gradient",generate:(e,t)=>i(e,t,["color","gradient"],"background")},{name:"background",generate:(e,t)=>i(e,t,["color","background"],"backgroundColor")}],...[{name:"minHeight",generate:(e,t)=>i(e,t,["dimensions","minHeight"],"minHeight")}],...[{name:"color",generate:(e,t,n=["outline","color"],o="outlineColor")=>i(e,t,n,o)},{name:"style",generate:(e,t,n=["outline","style"],o="outlineStyle")=>i(e,t,n,o)},{name:"offset",generate:(e,t,n=["outline","offset"],o="outlineOffset")=>i(e,t,n,o)},{name:"width",generate:(e,t,n=["outline","width"],o="outlineWidth")=>i(e,t,n,o)}],...[{name:"margin",generate:(e,t)=>g(e,t,["spacing","margin"],{default:"margin",individual:"margin%s"})},{name:"padding",generate:(e,t)=>g(e,t,["spacing","padding"],{default:"padding",individual:"padding%s"})}],...[{name:"fontFamily",generate:(e,t)=>i(e,t,["typography","fontFamily"],"fontFamily")},{name:"fontSize",generate:(e,t)=>i(e,t,["typography","fontSize"],"fontSize")},{name:"fontStyle",generate:(e,t)=>i(e,t,["typography","fontStyle"],"fontStyle")},{name:"fontWeight",generate:(e,t)=>i(e,t,["typography","fontWeight"],"fontWeight")},{name:"letterSpacing",generate:(e,t)=>i(e,t,["typography","letterSpacing"],"letterSpacing")},{name:"lineHeight",generate:(e,t)=>i(e,t,["typography","lineHeight"],"lineHeight")},{name:"textColumns",generate:(e,t)=>i(e,t,["typography","textColumns"],"columnCount")},{name:"textDecoration",generate:(e,t)=>i(e,t,["typography","textDecoration"],"textDecoration")},{name:"textTransform",generate:(e,t)=>i(e,t,["typography","textTransform"],"textTransform")}],...[{name:"shadow",generate:(e,t)=>i(e,t,["shadow"],"boxShadow")}]];function p(e,t={}){const o=m(e,t);if(!t?.selector){const e=[];return o.forEach((t=>{e.push(`${(0,n.kebabCase)(t.key)}: ${t.value};`)})),e.join(" ")}const r=o.reduce(((e,t)=>{const{selector:n}=t;return n?(e[n]||(e[n]=[]),e[n].push(t),e):e}),{});return Object.keys(r).reduce(((e,t)=>(e.push(`${t} { ${r[t].map((e=>`${(0,n.kebabCase)(e.key)}: ${e.value};`)).join(" ")} }`),e)),[]).join("\n")}function m(e,t={}){const n=[];return f.forEach((o=>{"function"==typeof o.generate&&n.push(...o.generate(e,t))})),n}(window.wp=window.wp||{}).styleEngine=t}();
|
||||
Vendored
+11
-20
@@ -37,8 +37,7 @@ class TokenList {
|
||||
*
|
||||
* @param {string} initialValue Initial value to assign.
|
||||
*/
|
||||
constructor() {
|
||||
let initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
constructor(initialValue = '') {
|
||||
this.value = initialValue; // Disable reason: These are type hints on the class.
|
||||
|
||||
/* eslint-disable no-unused-expressions */
|
||||
@@ -56,32 +55,32 @@ class TokenList {
|
||||
*/
|
||||
|
||||
|
||||
entries() {
|
||||
return this._valueAsArray.entries(...arguments);
|
||||
entries(...args) {
|
||||
return this._valueAsArray.entries(...args);
|
||||
}
|
||||
/**
|
||||
* @param {Parameters<Array<string>['forEach']>} args
|
||||
*/
|
||||
|
||||
|
||||
forEach() {
|
||||
return this._valueAsArray.forEach(...arguments);
|
||||
forEach(...args) {
|
||||
return this._valueAsArray.forEach(...args);
|
||||
}
|
||||
/**
|
||||
* @param {Parameters<Array<string>['keys']>} args
|
||||
*/
|
||||
|
||||
|
||||
keys() {
|
||||
return this._valueAsArray.keys(...arguments);
|
||||
keys(...args) {
|
||||
return this._valueAsArray.keys(...args);
|
||||
}
|
||||
/**
|
||||
* @param {Parameters<Array<string>['values']>} args
|
||||
*/
|
||||
|
||||
|
||||
values() {
|
||||
return this._valueAsArray.values(...arguments);
|
||||
values(...args) {
|
||||
return this._valueAsArray.values(...args);
|
||||
}
|
||||
/**
|
||||
* Returns the associated set as string.
|
||||
@@ -183,11 +182,7 @@ class TokenList {
|
||||
*/
|
||||
|
||||
|
||||
add() {
|
||||
for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
items[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
add(...items) {
|
||||
this.value += ' ' + items.join(' ');
|
||||
}
|
||||
/**
|
||||
@@ -199,11 +194,7 @@ class TokenList {
|
||||
*/
|
||||
|
||||
|
||||
remove() {
|
||||
for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
items[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
remove(...items) {
|
||||
this.value = this._valueAsArray.filter(val => !items.includes(val)).join(' ');
|
||||
}
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){"use strict";var r={d:function(e,t){for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o:function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}},e={};r.d(e,{default:function(){return t}});class t{constructor(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.value=r,this._currentValue,this._valueAsArray}entries(){return this._valueAsArray.entries(...arguments)}forEach(){return this._valueAsArray.forEach(...arguments)}keys(){return this._valueAsArray.keys(...arguments)}values(){return this._valueAsArray.values(...arguments)}get value(){return this._currentValue}set value(r){r=String(r),this._valueAsArray=[...new Set(r.split(/\s+/g).filter(Boolean))],this._currentValue=this._valueAsArray.join(" ")}get length(){return this._valueAsArray.length}toString(){return this.value}*[Symbol.iterator](){return yield*this._valueAsArray}item(r){return this._valueAsArray[r]}contains(r){return-1!==this._valueAsArray.indexOf(r)}add(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];this.value+=" "+e.join(" ")}remove(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];this.value=this._valueAsArray.filter((r=>!e.includes(r))).join(" ")}toggle(r,e){return void 0===e&&(e=!this.contains(r)),e?this.add(r):this.remove(r),e}replace(r,e){return!!this.contains(r)&&(this.remove(r),this.add(e),!0)}supports(){return!0}}(window.wp=window.wp||{}).tokenList=e.default}();
|
||||
!function(){"use strict";var r={d:function(e,t){for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o:function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}},e={};r.d(e,{default:function(){return t}});class t{constructor(r=""){this.value=r,this._currentValue,this._valueAsArray}entries(...r){return this._valueAsArray.entries(...r)}forEach(...r){return this._valueAsArray.forEach(...r)}keys(...r){return this._valueAsArray.keys(...r)}values(...r){return this._valueAsArray.values(...r)}get value(){return this._currentValue}set value(r){r=String(r),this._valueAsArray=[...new Set(r.split(/\s+/g).filter(Boolean))],this._currentValue=this._valueAsArray.join(" ")}get length(){return this._valueAsArray.length}toString(){return this.value}*[Symbol.iterator](){return yield*this._valueAsArray}item(r){return this._valueAsArray[r]}contains(r){return-1!==this._valueAsArray.indexOf(r)}add(...r){this.value+=" "+r.join(" ")}remove(...r){this.value=this._valueAsArray.filter((e=>!r.includes(e))).join(" ")}toggle(r,e){return void 0===e&&(e=!this.contains(r)),e?this.add(r):this.remove(r),e}replace(r,e){return!!this.contains(r)&&(this.remove(r),this.add(e),!0)}supports(){return!0}}(window.wp=window.wp||{}).tokenList=e.default}();
|
||||
Vendored
+39
-12
@@ -534,6 +534,7 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
"isValidQueryString": function() { return /* reexport */ isValidQueryString; },
|
||||
"normalizePath": function() { return /* reexport */ normalizePath; },
|
||||
"prependHTTP": function() { return /* reexport */ prependHTTP; },
|
||||
"prependHTTPS": function() { return /* reexport */ prependHTTPS; },
|
||||
"removeQueryArgs": function() { return /* reexport */ removeQueryArgs; },
|
||||
"safeDecodeURI": function() { return /* reexport */ safeDecodeURI; },
|
||||
"safeDecodeURIComponent": function() { return /* reexport */ safeDecodeURIComponent; }
|
||||
@@ -1025,10 +1026,7 @@ function getQueryArgs(url) {
|
||||
* @return {string} URL with arguments applied.
|
||||
*/
|
||||
|
||||
function addQueryArgs() {
|
||||
let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
let args = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function addQueryArgs(url = '', args) {
|
||||
// If no arguments are to be appended, return original URL.
|
||||
if (!args || !Object.keys(args).length) {
|
||||
return url;
|
||||
@@ -1122,7 +1120,7 @@ function hasQueryArg(url, arg) {
|
||||
* @return {string} Updated URL.
|
||||
*/
|
||||
|
||||
function removeQueryArgs(url) {
|
||||
function removeQueryArgs(url, ...args) {
|
||||
const queryStringIndex = url.indexOf('?');
|
||||
|
||||
if (queryStringIndex === -1) {
|
||||
@@ -1131,11 +1129,6 @@ function removeQueryArgs(url) {
|
||||
|
||||
const query = getQueryArgs(url);
|
||||
const baseURL = url.substr(0, queryStringIndex);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
args.forEach(arg => delete query[arg]);
|
||||
const queryString = buildQueryString(query);
|
||||
return queryString ? baseURL + '?' + queryString : baseURL;
|
||||
@@ -1211,8 +1204,7 @@ function safeDecodeURI(uri) {
|
||||
*
|
||||
* @return {string} Displayed URL.
|
||||
*/
|
||||
function filterURLForDisplay(url) {
|
||||
let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
function filterURLForDisplay(url, maxLength = null) {
|
||||
// Remove protocol and www prefixes.
|
||||
let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
|
||||
|
||||
@@ -1336,6 +1328,40 @@ function normalizePath(path) {
|
||||
.join('&');
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-https.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepends "https://" to a url, if it looks like something that is meant to be a TLD.
|
||||
*
|
||||
* Note: this will not replace "http://" with "https://".
|
||||
*
|
||||
* @param {string} url The URL to test.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org
|
||||
* ```
|
||||
*
|
||||
* @return {string} The updated URL.
|
||||
*/
|
||||
|
||||
function prependHTTPS(url) {
|
||||
if (!url) {
|
||||
return url;
|
||||
} // If url starts with http://, return it as is.
|
||||
|
||||
|
||||
if (url.startsWith('http://')) {
|
||||
return url;
|
||||
}
|
||||
|
||||
url = prependHTTP(url);
|
||||
return url.replace(/^http:/, 'https:');
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js
|
||||
|
||||
|
||||
@@ -1362,6 +1388,7 @@ function normalizePath(path) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}();
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user