--- a/wp/wp-includes/js/dist/keyboard-shortcuts.js Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/js/dist/keyboard-shortcuts.js Wed Sep 21 18:19:35 2022 +0200
@@ -82,193 +82,422 @@
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 456);
+/******/ return __webpack_require__(__webpack_require__.s = "cFS5");
/******/ })
/************************************************************************/
/******/ ({
-/***/ 14:
+/***/ "1ZqX":
+/***/ (function(module, exports) {
+
+(function() { module.exports = window["wp"]["data"]; }());
+
+/***/ }),
+
+/***/ "K9lf":
+/***/ (function(module, exports) {
+
+(function() { module.exports = window["wp"]["compose"]; }());
+
+/***/ }),
+
+/***/ "RxS6":
+/***/ (function(module, exports) {
+
+(function() { module.exports = window["wp"]["keycodes"]; }());
+
+/***/ }),
+
+/***/ "YLtl":
+/***/ (function(module, exports) {
+
+(function() { module.exports = window["lodash"]; }());
+
+/***/ }),
+
+/***/ "cFS5":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
// EXPORTS
-__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
+__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
+__webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
+__webpack_require__.d(__webpack_exports__, "__unstableUseShortcutEventMatch", function() { return /* reexport */ useShortcutEventMatch; });
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
-var arrayWithHoles = __webpack_require__(38);
+// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
+var actions_namespaceObject = {};
+__webpack_require__.r(actions_namespaceObject);
+__webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
+__webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
-function _iterableToArrayLimit(arr, i) {
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
+// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
+var selectors_namespaceObject = {};
+__webpack_require__.r(selectors_namespaceObject);
+__webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
+__webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
+__webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
+__webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
+__webpack_require__.d(selectors_namespaceObject, "getAllShortcutKeyCombinations", function() { return selectors_getAllShortcutKeyCombinations; });
+__webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
+__webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
+
+// EXTERNAL MODULE: external ["wp","data"]
+var external_wp_data_ = __webpack_require__("1ZqX");
+
+// EXTERNAL MODULE: external "lodash"
+var external_lodash_ = __webpack_require__("YLtl");
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
+/**
+ * External dependencies
+ */
+
+/**
+ * Reducer returning the registered shortcuts
+ *
+ * @param {Object} state Current state.
+ * @param {Object} action Dispatched action.
+ *
+ * @return {Object} Updated state.
+ */
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
+function reducer(state = {}, action) {
+ 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':
+ return Object(external_lodash_["omit"])(state, action.name);
}
- return _arr;
+ return state;
}
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
-var unsupportedIterableToArray = __webpack_require__(29);
+
+/* harmony default export */ var store_reducer = (reducer);
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
+/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
-var nonIterableRest = __webpack_require__(39);
+/**
+ * Keyboard key combination.
+ *
+ * @typedef {Object} WPShortcutKeyCombination
+ *
+ * @property {string} character Character.
+ * @property {WPKeycodeModifier|undefined} modifier Modifier.
+ */
+
+/**
+ * Configuration of a registered keyboard shortcut.
+ *
+ * @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.
+ */
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
-
-
+/**
+ * Returns an action object used to register a new keyboard shortcut.
+ *
+ * @param {WPShortcutConfig} config Shortcut config.
+ *
+ * @return {Object} action.
+ */
+function registerShortcut({
+ name,
+ category,
+ description,
+ keyCombination,
+ aliases
+}) {
+ return {
+ type: 'REGISTER_SHORTCUT',
+ name,
+ category,
+ keyCombination,
+ aliases,
+ description
+ };
+}
+/**
+ * Returns an action object used to unregister a keyboard shortcut.
+ *
+ * @param {string} name Shortcut name.
+ *
+ * @return {Object} action.
+ */
-
-function _slicedToArray(arr, i) {
- return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
+function unregisterShortcut(name) {
+ return {
+ type: 'UNREGISTER_SHORTCUT',
+ name
+ };
}
-/***/ }),
+// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
+var rememo = __webpack_require__("pPDe");
+
+// EXTERNAL MODULE: external ["wp","keycodes"]
+var external_wp_keycodes_ = __webpack_require__("RxS6");
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
+/**
+ * External dependencies
+ */
+
-/***/ 18:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
+/**
+ * WordPress dependencies
+ */
+
+
+/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
-"use strict";
+/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
+
+/**
+ * Shared reference to an empty array for cases where it is important to avoid
+ * returning a new array reference on every invocation.
+ *
+ * @type {Array<any>}
+ */
-// EXPORTS
-__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
+const EMPTY_ARRAY = [];
+/**
+ * Shortcut formatting methods.
+ *
+ * @property {WPKeycodeHandlerByModifier} display Display formatting.
+ * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
+ * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.
+ */
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
-var arrayLikeToArray = __webpack_require__(26);
+const FORMATTING_METHODS = {
+ display: external_wp_keycodes_["displayShortcut"],
+ raw: external_wp_keycodes_["rawShortcut"],
+ ariaLabel: external_wp_keycodes_["shortcutAriaLabel"]
+};
+/**
+ * Returns a string representing the key combination.
+ *
+ * @param {?WPShortcutKeyCombination} shortcut Key combination.
+ * @param {keyof FORMATTING_METHODS} representation Type of representation
+ * (display, raw, ariaLabel).
+ *
+ * @return {string?} Shortcut representation.
+ */
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
+function getKeyCombinationRepresentation(shortcut, representation) {
+ if (!shortcut) {
+ return null;
+ }
+
+ return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
+}
+/**
+ * Returns the main key combination for a given shortcut name.
+ *
+ * @param {Object} state Global state.
+ * @param {string} name Shortcut name.
+ *
+ * @return {WPShortcutKeyCombination?} Key combination.
+ */
+
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
+function getShortcutKeyCombination(state, name) {
+ return state[name] ? state[name].keyCombination : null;
+}
+/**
+ * Returns a string representing the main key combination for a given shortcut name.
+ *
+ * @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.
+ */
+
+function getShortcutRepresentation(state, name, representation = 'display') {
+ const shortcut = getShortcutKeyCombination(state, name);
+ return getKeyCombinationRepresentation(shortcut, representation);
}
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
-var iterableToArray = __webpack_require__(35);
+/**
+ * Returns the shortcut description given its name.
+ *
+ * @param {Object} state Global state.
+ * @param {string} name Shortcut name.
+ *
+ * @return {string?} Shortcut description.
+ */
+
+function getShortcutDescription(state, name) {
+ return state[name] ? state[name].description : null;
+}
+/**
+ * Returns the aliases for a given shortcut name.
+ *
+ * @param {Object} state Global state.
+ * @param {string} name Shortcut name.
+ *
+ * @return {WPShortcutKeyCombination[]} Key combinations.
+ */
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
-var unsupportedIterableToArray = __webpack_require__(29);
+function getShortcutAliases(state, name) {
+ return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
+}
+const selectors_getAllShortcutKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
+ return Object(external_lodash_["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.
+ */
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
+const getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
+ return selectors_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.
+ */
+
+const getCategoryShortcuts = Object(rememo["a" /* default */])((state, categoryName) => {
+ 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
+/**
+ * WordPress dependencies
+ */
+
+/**
+ * Internal dependencies
+ */
-function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
+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}
+ */
+
+const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
+ reducer: store_reducer,
+ actions: actions_namespaceObject,
+ selectors: selectors_namespaceObject
+});
+Object(external_wp_data_["register"])(store);
+
+// EXTERNAL MODULE: external ["wp","compose"]
+var external_wp_compose_ = __webpack_require__("K9lf");
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Attach a keyboard shortcut handler.
+ *
+ * @param {string} name Shortcut name.
+ * @param {Function} callback Shortcut callback.
+ * @param {Object} options Shortcut options.
+ */
+
+function useShortcut(name, callback, options) {
+ const shortcuts = Object(external_wp_data_["useSelect"])(select => {
+ return select(store).getAllShortcutRawKeyCombinations(name);
+ }, [name]);
+ Object(external_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
}
-/***/ }),
+/* harmony default export */ var use_shortcut = (useShortcut);
-/***/ 2:
-/***/ (function(module, exports) {
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js
+/**
+ * WordPress dependencies
+ */
+
-(function() { module.exports = this["lodash"]; }());
+/**
+ * Internal dependencies
+ */
+
-/***/ }),
-
-/***/ 21:
-/***/ (function(module, exports) {
+/**
+ * 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.
+ */
-(function() { module.exports = this["wp"]["keycodes"]; }());
-
-/***/ }),
-
-/***/ 26:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
+function useShortcutEventMatch() {
+ const {
+ getAllShortcutKeyCombinations
+ } = Object(external_wp_data_["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.
+ */
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
-function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
-
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
+ function isMatch(name, event) {
+ return getAllShortcutKeyCombinations(name).some(({
+ modifier,
+ character
+ }) => {
+ return external_wp_keycodes_["isKeyboardEvent"][modifier](event, character);
+ });
}
- return arr2;
+ return isMatch;
}
+// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
+
+
+
+
+
/***/ }),
-/***/ 29:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
-/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
-
-function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
-}
-
-/***/ }),
-
-/***/ 35:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
-function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
-}
-
-/***/ }),
-
-/***/ 38:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
-function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
-}
-
-/***/ }),
-
-/***/ 39:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-/***/ }),
-
-/***/ 4:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["data"]; }());
-
-/***/ }),
-
-/***/ 42:
+/***/ "pPDe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -548,389 +777,6 @@
});
-/***/ }),
-
-/***/ 456:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-// ESM COMPAT FLAG
-__webpack_require__.r(__webpack_exports__);
-
-// EXPORTS
-__webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
-
-// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
-var actions_namespaceObject = {};
-__webpack_require__.r(actions_namespaceObject);
-__webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
-__webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
-
-// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
-var selectors_namespaceObject = {};
-__webpack_require__.r(selectors_namespaceObject);
-__webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
-__webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
-__webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
-__webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
-__webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
-__webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
-
-// EXTERNAL MODULE: external {"this":["wp","data"]}
-var external_this_wp_data_ = __webpack_require__(4);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
-var defineProperty = __webpack_require__(5);
-
-// EXTERNAL MODULE: external {"this":"lodash"}
-var external_this_lodash_ = __webpack_require__(2);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
-
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-/**
- * External dependencies
- */
-
-/**
- * Reducer returning the registered shortcuts
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
-
-function reducer() {
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var action = arguments.length > 1 ? arguments[1] : undefined;
-
- switch (action.type) {
- case 'REGISTER_SHORTCUT':
- return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.name, {
- category: action.category,
- keyCombination: action.keyCombination,
- aliases: action.aliases,
- description: action.description
- }));
-
- case 'UNREGISTER_SHORTCUT':
- return Object(external_this_lodash_["omit"])(state, action.name);
- }
-
- return state;
-}
-
-/* harmony default export */ var store_reducer = (reducer);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
-/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
-
-/**
- * Keyboard key combination.
- *
- * @typedef {Object} WPShortcutKeyCombination
- *
- * @property {string} character Character.
- * @property {WPKeycodeModifier|undefined} modifier Modifier.
- */
-
-/**
- * Configuration of a registered keyboard shortcut.
- *
- * @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.
- */
-
-/**
- * Returns an action object used to register a new keyboard shortcut.
- *
- * @param {WPShortcutConfig} config Shortcut config.
- *
- * @return {Object} action.
- */
-function registerShortcut(_ref) {
- var name = _ref.name,
- category = _ref.category,
- description = _ref.description,
- keyCombination = _ref.keyCombination,
- aliases = _ref.aliases;
- return {
- type: 'REGISTER_SHORTCUT',
- name: name,
- category: category,
- keyCombination: keyCombination,
- aliases: aliases,
- description: description
- };
-}
-/**
- * Returns an action object used to unregister a keyboard shortcut.
- *
- * @param {string} name Shortcut name.
- *
- * @return {Object} action.
- */
-
-function unregisterShortcut(name) {
- return {
- type: 'UNREGISTER_SHORTCUT',
- name: name
- };
-}
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
-var slicedToArray = __webpack_require__(14);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
-var toConsumableArray = __webpack_require__(18);
-
-// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
-var rememo = __webpack_require__(42);
-
-// EXTERNAL MODULE: external {"this":["wp","keycodes"]}
-var external_this_wp_keycodes_ = __webpack_require__(21);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
-
-
-
-/**
- * External dependencies
- */
-
-
-/**
- * WordPress dependencies
- */
-
-
-/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
-
-/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
-
-/**
- * Shared reference to an empty array for cases where it is important to avoid
- * returning a new array reference on every invocation.
- *
- * @type {Array<any>}
- */
-
-var EMPTY_ARRAY = [];
-/**
- * Shortcut formatting methods.
- *
- * @property {WPKeycodeHandlerByModifier} display Display formatting.
- * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
- * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.
- */
-
-var FORMATTING_METHODS = {
- display: external_this_wp_keycodes_["displayShortcut"],
- raw: external_this_wp_keycodes_["rawShortcut"],
- ariaLabel: external_this_wp_keycodes_["shortcutAriaLabel"]
-};
-/**
- * Returns a string representing the key combination.
- *
- * @param {?WPShortcutKeyCombination} shortcut Key combination.
- * @param {keyof FORMATTING_METHODS} representation Type of representation
- * (display, raw, ariaLabel).
- *
- * @return {string?} Shortcut representation.
- */
-
-function getKeyCombinationRepresentation(shortcut, representation) {
- if (!shortcut) {
- return null;
- }
-
- return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
-}
-/**
- * Returns the main key combination for a given shortcut name.
- *
- * @param {Object} state Global state.
- * @param {string} name Shortcut name.
- *
- * @return {WPShortcutKeyCombination?} Key combination.
- */
-
-
-function getShortcutKeyCombination(state, name) {
- return state[name] ? state[name].keyCombination : null;
-}
-/**
- * Returns a string representing the main key combination for a given shortcut name.
- *
- * @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.
- */
-
-function getShortcutRepresentation(state, name) {
- var representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
- var shortcut = getShortcutKeyCombination(state, name);
- return getKeyCombinationRepresentation(shortcut, representation);
-}
-/**
- * Returns the shortcut description given its name.
- *
- * @param {Object} state Global state.
- * @param {string} name Shortcut name.
- *
- * @return {string?} Shortcut description.
- */
-
-function getShortcutDescription(state, name) {
- return state[name] ? state[name].description : null;
-}
-/**
- * Returns the aliases for a given shortcut name.
- *
- * @param {Object} state Global state.
- * @param {string} name Shortcut name.
- *
- * @return {WPShortcutKeyCombination[]} Key combinations.
- */
-
-function getShortcutAliases(state, name) {
- return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
-}
-/**
- * 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.
- */
-
-var getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])(function (state, name) {
- return Object(external_this_lodash_["compact"])([getKeyCombinationRepresentation(getShortcutKeyCombination(state, name), 'raw')].concat(Object(toConsumableArray["a" /* default */])(getShortcutAliases(state, name).map(function (combination) {
- return getKeyCombinationRepresentation(combination, 'raw');
- }))));
-}, function (state, name) {
- return [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.
- */
-
-var getCategoryShortcuts = Object(rememo["a" /* default */])(function (state, categoryName) {
- return Object.entries(state).filter(function (_ref) {
- var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
- shortcut = _ref2[1];
-
- return shortcut.category === categoryName;
- }).map(function (_ref3) {
- var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 1),
- name = _ref4[0];
-
- return name;
- });
-}, function (state) {
- return [state];
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
-/**
- * WordPress dependencies
- */
-
-/**
- * Internal dependencies
- */
-
-
-
-
-/* harmony default export */ var store = (Object(external_this_wp_data_["registerStore"])('core/keyboard-shortcuts', {
- reducer: store_reducer,
- actions: actions_namespaceObject,
- selectors: selectors_namespaceObject
-}));
-
-// EXTERNAL MODULE: external {"this":["wp","compose"]}
-var external_this_wp_compose_ = __webpack_require__(9);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Attach a keyboard shortcut handler.
- *
- * @param {string} name Shortcut name.
- * @param {Function} callback Shortcut callback.
- * @param {Object} options Shortcut options.
- */
-
-function useShortcut(name, callback, options) {
- var shortcuts = Object(external_this_wp_data_["useSelect"])(function (select) {
- return select('core/keyboard-shortcuts').getAllShortcutRawKeyCombinations(name);
- }, [name]);
- Object(external_this_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
-}
-
-/* harmony default export */ var use_shortcut = (useShortcut);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
-/**
- * Internal dependencies
- */
-
-
-
-
-/***/ }),
-
-/***/ 5:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
-function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
-}
-
-/***/ }),
-
-/***/ 9:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["compose"]; }());
-
/***/ })
/******/ });
\ No newline at end of file