2022-04-11 14:04:30 +02:00
|
|
|
/******/ (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 });
|
2020-01-22 23:06:21 +01:00
|
|
|
/******/ };
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ }();
|
|
|
|
/******/
|
2020-01-22 23:06:21 +01:00
|
|
|
/************************************************************************/
|
2022-04-11 14:04:30 +02:00
|
|
|
var __webpack_exports__ = {};
|
2021-05-20 14:20:04 +02:00
|
|
|
// ESM COMPAT FLAG
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
// EXPORTS
|
2022-04-11 14:04:30 +02:00
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
|
"ShortcutProvider": function() { return /* reexport */ ShortcutProvider; },
|
|
|
|
"__unstableUseShortcutEventMatch": function() { return /* reexport */ useShortcutEventMatch; },
|
|
|
|
"store": function() { return /* reexport */ store; },
|
|
|
|
"useShortcut": function() { return /* reexport */ useShortcut; }
|
|
|
|
});
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
|
|
|
|
var actions_namespaceObject = {};
|
|
|
|
__webpack_require__.r(actions_namespaceObject);
|
2022-04-11 14:04:30 +02:00
|
|
|
__webpack_require__.d(actions_namespaceObject, {
|
|
|
|
"registerShortcut": function() { return registerShortcut; },
|
|
|
|
"unregisterShortcut": function() { return unregisterShortcut; }
|
|
|
|
});
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
|
|
|
|
var selectors_namespaceObject = {};
|
|
|
|
__webpack_require__.r(selectors_namespaceObject);
|
2022-04-11 14:04:30 +02:00
|
|
|
__webpack_require__.d(selectors_namespaceObject, {
|
|
|
|
"getAllShortcutKeyCombinations": function() { return getAllShortcutKeyCombinations; },
|
|
|
|
"getAllShortcutRawKeyCombinations": function() { return getAllShortcutRawKeyCombinations; },
|
|
|
|
"getCategoryShortcuts": function() { return getCategoryShortcuts; },
|
|
|
|
"getShortcutAliases": function() { return getShortcutAliases; },
|
|
|
|
"getShortcutDescription": function() { return getShortcutDescription; },
|
|
|
|
"getShortcutKeyCombination": function() { return getShortcutKeyCombination; },
|
|
|
|
"getShortcutRepresentation": function() { return getShortcutRepresentation; }
|
|
|
|
});
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: external ["wp","data"]
|
|
|
|
var external_wp_data_namespaceObject = window["wp"]["data"];
|
|
|
|
;// CONCATENATED MODULE: external "lodash"
|
|
|
|
var external_lodash_namespaceObject = window["lodash"];
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
|
2020-01-22 23:06:21 +01:00
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* External dependencies
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* Reducer returning the registered shortcuts
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @param {Object} state Current state.
|
|
|
|
* @param {Object} action Dispatched action.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @return {Object} Updated state.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2021-11-15 13:50:17 +01:00
|
|
|
function reducer() {
|
|
|
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
switch (action.type) {
|
|
|
|
case 'REGISTER_SHORTCUT':
|
|
|
|
return { ...state,
|
|
|
|
[action.name]: {
|
|
|
|
category: action.category,
|
|
|
|
keyCombination: action.keyCombination,
|
|
|
|
aliases: action.aliases,
|
|
|
|
description: action.description
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
case 'UNREGISTER_SHORTCUT':
|
2022-04-11 14:04:30 +02:00
|
|
|
return (0,external_lodash_namespaceObject.omit)(state, action.name);
|
2021-05-20 14:20:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
2020-01-22 23:06:21 +01:00
|
|
|
}
|
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
/* harmony default export */ var store_reducer = (reducer);
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
|
2021-05-20 14:20:04 +02:00
|
|
|
/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
|
|
|
|
|
2020-01-22 23:06:21 +01:00
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* Keyboard key combination.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @typedef {Object} WPShortcutKeyCombination
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @property {string} character Character.
|
|
|
|
* @property {WPKeycodeModifier|undefined} modifier Modifier.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* Configuration of a registered keyboard shortcut.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @typedef {Object} WPShortcutConfig
|
|
|
|
*
|
|
|
|
* @property {string} name Shortcut name.
|
|
|
|
* @property {string} category Shortcut category.
|
|
|
|
* @property {string} description Shortcut description.
|
|
|
|
* @property {WPShortcutKeyCombination} keyCombination Shortcut key combination.
|
|
|
|
* @property {WPShortcutKeyCombination[]} [aliases] Shortcut aliases.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* Returns an action object used to register a new keyboard shortcut.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @param {WPShortcutConfig} config Shortcut config.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @return {Object} action.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2021-11-15 13:50:17 +01:00
|
|
|
function registerShortcut(_ref) {
|
|
|
|
let {
|
|
|
|
name,
|
|
|
|
category,
|
|
|
|
description,
|
|
|
|
keyCombination,
|
|
|
|
aliases
|
|
|
|
} = _ref;
|
2021-05-20 14:20:04 +02:00
|
|
|
return {
|
|
|
|
type: 'REGISTER_SHORTCUT',
|
|
|
|
name,
|
|
|
|
category,
|
|
|
|
keyCombination,
|
|
|
|
aliases,
|
|
|
|
description
|
|
|
|
};
|
2020-01-22 23:06:21 +01:00
|
|
|
}
|
|
|
|
/**
|
2021-05-20 14:20:04 +02:00
|
|
|
* Returns an action object used to unregister a keyboard shortcut.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @param {string} name Shortcut name.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2021-05-20 14:20:04 +02:00
|
|
|
* @return {Object} action.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
function unregisterShortcut(name) {
|
|
|
|
return {
|
|
|
|
type: 'UNREGISTER_SHORTCUT',
|
|
|
|
name
|
|
|
|
};
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
|
2020-01-22 23:06:21 +01:00
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
var LEAF_KEY, hasWeakMap;
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Arbitrary value used as key for referencing cache object in WeakMap tree.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @type {Object}
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
LEAF_KEY = {};
|
2020-01-22 23:06:21 +01:00
|
|
|
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Whether environment supports WeakMap.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @type {boolean}
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
hasWeakMap = typeof WeakMap !== 'undefined';
|
2020-01-22 23:06:21 +01:00
|
|
|
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns the first argument as the sole entry in an array.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {*} value Value to return.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {Array} Value returned as entry in array.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
function arrayOf( value ) {
|
|
|
|
return [ value ];
|
2020-01-22 23:06:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns true if the value passed is object-like, or false otherwise. A value
|
|
|
|
* is object-like if it can support property assignment, e.g. object or array.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {*} value Value to test.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {boolean} Whether value is object-like.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
function isObjectLike( value ) {
|
|
|
|
return !! value && 'object' === typeof value;
|
2020-01-22 23:06:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Creates and returns a new cache object.
|
2020-01-22 23:06:21 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {Object} Cache object.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
function createCache() {
|
|
|
|
var cache = {
|
|
|
|
clear: function() {
|
|
|
|
cache.head = null;
|
|
|
|
},
|
|
|
|
};
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return cache;
|
2020-01-22 23:06:21 +01:00
|
|
|
}
|
|
|
|
|
2020-02-10 23:33:27 +01:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns true if entries within the two arrays are strictly equal by
|
|
|
|
* reference from a starting index.
|
2020-02-10 23:33:27 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Array} a First array.
|
|
|
|
* @param {Array} b Second array.
|
|
|
|
* @param {number} fromIndex Index from which to start comparison.
|
2020-02-10 23:33:27 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {boolean} Whether arrays are shallowly equal.
|
2020-01-22 23:06:21 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
function isShallowEqual( a, b, fromIndex ) {
|
|
|
|
var i;
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
if ( a.length !== b.length ) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
for ( i = fromIndex; i < a.length; i++ ) {
|
|
|
|
if ( a[ i ] !== b[ i ] ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return true;
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2021-01-28 03:04:13 +01:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns a memoized selector function. The getDependants function argument is
|
|
|
|
* called before the memoized selector and is expected to return an immutable
|
|
|
|
* reference or array of references on which the selector depends for computing
|
|
|
|
* its own return value. The memoize cache is preserved only as long as those
|
|
|
|
* dependant references remain the same. If getDependants returns a different
|
|
|
|
* reference(s), the cache is cleared and the selector value regenerated.
|
2021-01-28 03:04:13 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Function} selector Selector function.
|
|
|
|
* @param {Function} getDependants Dependant getter returning an immutable
|
|
|
|
* reference or array of reference used in
|
|
|
|
* cache bust consideration.
|
2021-01-28 03:04:13 +01:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {Function} Memoized selector.
|
2021-01-28 03:04:13 +01:00
|
|
|
*/
|
2022-04-11 14:04:30 +02:00
|
|
|
/* harmony default export */ function rememo(selector, getDependants ) {
|
|
|
|
var rootCache, getCache;
|
2021-01-28 03:04:13 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Use object source as dependant if getter not provided
|
|
|
|
if ( ! getDependants ) {
|
|
|
|
getDependants = arrayOf;
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Returns the root cache. If WeakMap is supported, this is assigned to the
|
|
|
|
* root WeakMap cache set, otherwise it is a shared instance of the default
|
|
|
|
* cache object.
|
|
|
|
*
|
|
|
|
* @return {(WeakMap|Object)} Root cache object.
|
|
|
|
*/
|
|
|
|
function getRootCache() {
|
|
|
|
return rootCache;
|
|
|
|
}
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Returns the cache for a given dependants array. When possible, a WeakMap
|
|
|
|
* will be used to create a unique cache for each set of dependants. This
|
|
|
|
* is feasible due to the nature of WeakMap in allowing garbage collection
|
|
|
|
* to occur on entries where the key object is no longer referenced. Since
|
|
|
|
* WeakMap requires the key to be an object, this is only possible when the
|
|
|
|
* dependant is object-like. The root cache is created as a hierarchy where
|
|
|
|
* each top-level key is the first entry in a dependants set, the value a
|
|
|
|
* WeakMap where each key is the next dependant, and so on. This continues
|
|
|
|
* so long as the dependants are object-like. If no dependants are object-
|
|
|
|
* like, then the cache is shared across all invocations.
|
|
|
|
*
|
|
|
|
* @see isObjectLike
|
|
|
|
*
|
|
|
|
* @param {Array} dependants Selector dependants.
|
|
|
|
*
|
|
|
|
* @return {Object} Cache object.
|
|
|
|
*/
|
|
|
|
function getWeakMapCache( dependants ) {
|
|
|
|
var caches = rootCache,
|
|
|
|
isUniqueByDependants = true,
|
|
|
|
i, dependant, map, cache;
|
2021-07-15 20:55:29 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
for ( i = 0; i < dependants.length; i++ ) {
|
|
|
|
dependant = dependants[ i ];
|
2021-07-15 20:55:29 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Can only compose WeakMap from object-like key.
|
|
|
|
if ( ! isObjectLike( dependant ) ) {
|
|
|
|
isUniqueByDependants = false;
|
|
|
|
break;
|
|
|
|
}
|
2021-07-15 20:55:29 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Does current segment of cache already have a WeakMap?
|
|
|
|
if ( caches.has( dependant ) ) {
|
|
|
|
// Traverse into nested WeakMap.
|
|
|
|
caches = caches.get( dependant );
|
|
|
|
} else {
|
|
|
|
// Create, set, and traverse into a new one.
|
|
|
|
map = new WeakMap();
|
|
|
|
caches.set( dependant, map );
|
|
|
|
caches = map;
|
|
|
|
}
|
|
|
|
}
|
2021-07-15 20:55:29 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// We use an arbitrary (but consistent) object as key for the last item
|
|
|
|
// in the WeakMap to serve as our running cache.
|
|
|
|
if ( ! caches.has( LEAF_KEY ) ) {
|
|
|
|
cache = createCache();
|
|
|
|
cache.isUniqueByDependants = isUniqueByDependants;
|
|
|
|
caches.set( LEAF_KEY, cache );
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return caches.get( LEAF_KEY );
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Assign cache handler by availability of WeakMap
|
|
|
|
getCache = hasWeakMap ? getWeakMapCache : getRootCache;
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Resets root memoization cache.
|
|
|
|
*/
|
|
|
|
function clear() {
|
|
|
|
rootCache = hasWeakMap ? new WeakMap() : createCache();
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// eslint-disable-next-line jsdoc/check-param-names
|
|
|
|
/**
|
|
|
|
* The augmented selector call, considering first whether dependants have
|
|
|
|
* changed before passing it to underlying memoize function.
|
|
|
|
*
|
|
|
|
* @param {Object} source Source object for derivation.
|
|
|
|
* @param {...*} extraArgs Additional arguments to pass to selector.
|
|
|
|
*
|
|
|
|
* @return {*} Selector result.
|
|
|
|
*/
|
|
|
|
function callSelector( /* source, ...extraArgs */ ) {
|
|
|
|
var len = arguments.length,
|
|
|
|
cache, node, i, args, dependants;
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Create copy of arguments (avoid leaking deoptimization).
|
|
|
|
args = new Array( len );
|
|
|
|
for ( i = 0; i < len; i++ ) {
|
|
|
|
args[ i ] = arguments[ i ];
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
dependants = getDependants.apply( null, args );
|
|
|
|
cache = getCache( dependants );
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// If not guaranteed uniqueness by dependants (primitive type or lack
|
|
|
|
// of WeakMap support), shallow compare against last dependants and, if
|
|
|
|
// references have changed, destroy cache to recalculate result.
|
|
|
|
if ( ! cache.isUniqueByDependants ) {
|
|
|
|
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
|
|
|
|
cache.clear();
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
cache.lastDependants = dependants;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
node = cache.head;
|
|
|
|
while ( node ) {
|
|
|
|
// Check whether node arguments match arguments
|
|
|
|
if ( ! isShallowEqual( node.args, args, 1 ) ) {
|
|
|
|
node = node.next;
|
|
|
|
continue;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// At this point we can assume we've found a match
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Surface matched node to head if not already
|
|
|
|
if ( node !== cache.head ) {
|
|
|
|
// Adjust siblings to point to each other.
|
|
|
|
node.prev.next = node.next;
|
|
|
|
if ( node.next ) {
|
|
|
|
node.next.prev = node.prev;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
node.next = cache.head;
|
|
|
|
node.prev = null;
|
|
|
|
cache.head.prev = node;
|
|
|
|
cache.head = node;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Return immediately
|
|
|
|
return node.val;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// No cached value found. Continue to insertion phase:
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
node = {
|
|
|
|
// Generate the result from original function
|
|
|
|
val: selector.apply( null, args ),
|
|
|
|
};
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Avoid including the source object in the cache.
|
|
|
|
args[ 0 ] = null;
|
|
|
|
node.args = args;
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Don't need to check whether node is already head, since it would
|
|
|
|
// have been returned above already if it was
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
// Shift existing head down list
|
|
|
|
if ( cache.head ) {
|
|
|
|
cache.head.prev = node;
|
|
|
|
node.next = cache.head;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
cache.head = node;
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return node.val;
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
callSelector.getDependants = getDependants;
|
|
|
|
callSelector.clear = clear;
|
|
|
|
clear();
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return callSelector;
|
2021-11-08 15:29:21 +01:00
|
|
|
}
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: external ["wp","keycodes"]
|
|
|
|
var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Shared reference to an empty array for cases where it is important to avoid
|
|
|
|
* returning a new array reference on every invocation.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @type {Array<any>}
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const EMPTY_ARRAY = [];
|
2021-05-20 14:20:04 +02:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Shortcut formatting methods.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @property {WPKeycodeHandlerByModifier} display Display formatting.
|
|
|
|
* @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
|
|
|
|
* @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const FORMATTING_METHODS = {
|
|
|
|
display: external_wp_keycodes_namespaceObject.displayShortcut,
|
|
|
|
raw: external_wp_keycodes_namespaceObject.rawShortcut,
|
|
|
|
ariaLabel: external_wp_keycodes_namespaceObject.shortcutAriaLabel
|
|
|
|
};
|
2021-05-20 14:20:04 +02:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns a string representing the key combination.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {?WPShortcutKeyCombination} shortcut Key combination.
|
|
|
|
* @param {keyof FORMATTING_METHODS} representation Type of representation
|
|
|
|
* (display, raw, ariaLabel).
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {string?} Shortcut representation.
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function getKeyCombinationRepresentation(shortcut, representation) {
|
|
|
|
if (!shortcut) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
|
|
|
|
}
|
2021-05-20 14:20:04 +02:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns the main key combination for a given shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {WPShortcutKeyCombination?} Key combination.
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
|
|
|
|
function getShortcutKeyCombination(state, name) {
|
|
|
|
return state[name] ? state[name].keyCombination : null;
|
|
|
|
}
|
2021-05-20 14:20:04 +02:00
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns a string representing the main key combination for a given shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Shortcut name.
|
|
|
|
* @param {keyof FORMATTING_METHODS} representation Type of representation
|
|
|
|
* (display, raw, ariaLabel).
|
|
|
|
*
|
|
|
|
* @return {string?} Shortcut representation.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function getShortcutRepresentation(state, name) {
|
|
|
|
let representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
|
|
|
|
const shortcut = getShortcutKeyCombination(state, name);
|
|
|
|
return getKeyCombinationRepresentation(shortcut, representation);
|
2021-05-20 14:20:04 +02:00
|
|
|
}
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns the shortcut description given its name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {string?} Shortcut description.
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function getShortcutDescription(state, name) {
|
|
|
|
return state[name] ? state[name].description : null;
|
2021-05-20 14:20:04 +02:00
|
|
|
}
|
|
|
|
/**
|
2022-04-11 14:04:30 +02:00
|
|
|
* Returns the aliases for a given shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Shortcut name.
|
2021-05-20 14:20:04 +02:00
|
|
|
*
|
2022-04-11 14:04:30 +02:00
|
|
|
* @return {WPShortcutKeyCombination[]} Key combinations.
|
2021-05-20 14:20:04 +02:00
|
|
|
*/
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function getShortcutAliases(state, name) {
|
|
|
|
return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
|
|
|
|
}
|
|
|
|
const getAllShortcutKeyCombinations = rememo((state, name) => {
|
|
|
|
return (0,external_lodash_namespaceObject.compact)([getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name)]);
|
|
|
|
}, (state, name) => [state[name]]);
|
|
|
|
/**
|
|
|
|
* Returns the raw representation of all the keyboard combinations of a given shortcut name.
|
|
|
|
*
|
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Shortcut name.
|
|
|
|
*
|
|
|
|
* @return {string[]} Shortcuts.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const getAllShortcutRawKeyCombinations = rememo((state, name) => {
|
|
|
|
return getAllShortcutKeyCombinations(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw'));
|
|
|
|
}, (state, name) => [state[name]]);
|
|
|
|
/**
|
|
|
|
* Returns the shortcut names list for a given category name.
|
|
|
|
*
|
|
|
|
* @param {Object} state Global state.
|
|
|
|
* @param {string} name Category name.
|
|
|
|
*
|
|
|
|
* @return {string[]} Shortcut names.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
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;
|
|
|
|
});
|
|
|
|
}, state => [state]);
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const STORE_NAME = 'core/keyboard-shortcuts';
|
|
|
|
/**
|
|
|
|
* Store definition for the keyboard shortcuts namespace.
|
|
|
|
*
|
|
|
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
|
|
|
|
reducer: store_reducer,
|
|
|
|
actions: actions_namespaceObject,
|
|
|
|
selectors: selectors_namespaceObject
|
|
|
|
});
|
|
|
|
(0,external_wp_data_namespaceObject.register)(store);
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: external ["wp","element"]
|
|
|
|
var external_wp_element_namespaceObject = window["wp"]["element"];
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Returns a function to check if a keyboard event matches a shortcut name.
|
|
|
|
*
|
|
|
|
* @return {Function} A function to to check if a keyboard event matches a
|
|
|
|
* predefined shortcut combination.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function useShortcutEventMatch() {
|
|
|
|
const {
|
|
|
|
getAllShortcutKeyCombinations
|
|
|
|
} = (0,external_wp_data_namespaceObject.useSelect)(store);
|
|
|
|
/**
|
|
|
|
* A function to check if a keyboard event matches a predefined shortcut
|
|
|
|
* combination.
|
|
|
|
*
|
|
|
|
* @param {string} name Shortcut name.
|
|
|
|
* @param {KeyboardEvent} event Event to check.
|
|
|
|
*
|
|
|
|
* @return {boolean} True if the event matches any shortcuts, false if not.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function isMatch(name, event) {
|
|
|
|
return getAllShortcutKeyCombinations(name).some(_ref => {
|
|
|
|
let {
|
|
|
|
modifier,
|
|
|
|
character
|
|
|
|
} = _ref;
|
|
|
|
return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
|
|
|
|
});
|
|
|
|
}
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
return isMatch;
|
|
|
|
}
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/context.js
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
const context = (0,external_wp_element_namespaceObject.createContext)();
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
/**
|
|
|
|
* Attach a keyboard shortcut handler.
|
|
|
|
*
|
|
|
|
* @param {string} name Shortcut name.
|
|
|
|
* @param {Function} callback Shortcut callback.
|
|
|
|
* @param {Object} options Shortcut options.
|
|
|
|
* @param {boolean} options.isDisabled Whether to disable to shortut.
|
|
|
|
*/
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function useShortcut(name, callback) {
|
|
|
|
let {
|
|
|
|
isDisabled
|
|
|
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
|
|
const shortcuts = (0,external_wp_element_namespaceObject.useContext)(context);
|
|
|
|
const isMatch = useShortcutEventMatch();
|
|
|
|
const callbackRef = (0,external_wp_element_namespaceObject.useRef)();
|
|
|
|
callbackRef.current = callback;
|
|
|
|
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
|
|
|
if (isDisabled) {
|
|
|
|
return;
|
|
|
|
}
|
2021-05-20 14:20:04 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
function _callback(event) {
|
|
|
|
if (isMatch(name, event)) {
|
|
|
|
callbackRef.current(event);
|
|
|
|
}
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
shortcuts.current.add(_callback);
|
|
|
|
return () => {
|
|
|
|
shortcuts.current.delete(_callback);
|
|
|
|
};
|
|
|
|
}, [name, isDisabled]);
|
|
|
|
}
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
2021-11-08 15:29:21 +01:00
|
|
|
function _extends() {
|
|
|
|
_extends = Object.assign || 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);
|
|
|
|
}
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/components/shortcut-provider.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
Provider
|
|
|
|
} = context;
|
|
|
|
/**
|
|
|
|
* Handles callbacks added to context by `useShortcut`.
|
|
|
|
*
|
|
|
|
* @param {Object} props Props to pass to `div`.
|
|
|
|
*
|
|
|
|
* @return {import('@wordpress/element').WPElement} Component.
|
|
|
|
*/
|
|
|
|
|
|
|
|
function ShortcutProvider(props) {
|
|
|
|
const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(new Set());
|
|
|
|
|
|
|
|
function onKeyDown(event) {
|
|
|
|
if (props.onKeyDown) props.onKeyDown(event);
|
|
|
|
|
|
|
|
for (const keyboardShortcut of keyboardShortcuts.current) {
|
|
|
|
keyboardShortcut(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
|
|
|
|
|
|
|
|
|
|
return (0,external_wp_element_namespaceObject.createElement)(Provider, {
|
|
|
|
value: keyboardShortcuts
|
|
|
|
}, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, {
|
|
|
|
onKeyDown: onKeyDown
|
|
|
|
})));
|
|
|
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-08 15:29:21 +01:00
|
|
|
|
2020-01-22 23:06:21 +01:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
(window.wp = window.wp || {}).keyboardShortcuts = __webpack_exports__;
|
|
|
|
/******/ })()
|
|
|
|
;
|