[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> keyboard-shortcuts.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["keyboardShortcuts"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 477);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 11:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  
  95  // EXPORTS
  96  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
  97  
  98  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  99  var arrayWithHoles = __webpack_require__(38);
 100  
 101  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 102  function _iterableToArrayLimit(arr, i) {
 103    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 104    var _arr = [];
 105    var _n = true;
 106    var _d = false;
 107    var _e = undefined;
 108  
 109    try {
 110      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 111        _arr.push(_s.value);
 112  
 113        if (i && _arr.length === i) break;
 114      }
 115    } catch (err) {
 116      _d = true;
 117      _e = err;
 118    } finally {
 119      try {
 120        if (!_n && _i["return"] != null) _i["return"]();
 121      } finally {
 122        if (_d) throw _e;
 123      }
 124    }
 125  
 126    return _arr;
 127  }
 128  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 129  var unsupportedIterableToArray = __webpack_require__(31);
 130  
 131  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 132  var nonIterableRest = __webpack_require__(39);
 133  
 134  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 135  
 136  
 137  
 138  
 139  function _slicedToArray(arr, i) {
 140    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 141  }
 142  
 143  /***/ }),
 144  
 145  /***/ 12:
 146  /***/ (function(module, exports) {
 147  
 148  (function() { module.exports = window["wp"]["compose"]; }());
 149  
 150  /***/ }),
 151  
 152  /***/ 15:
 153  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 154  
 155  "use strict";
 156  
 157  // EXPORTS
 158  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 159  
 160  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 161  var arrayLikeToArray = __webpack_require__(24);
 162  
 163  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 164  
 165  function _arrayWithoutHoles(arr) {
 166    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 167  }
 168  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 169  var iterableToArray = __webpack_require__(37);
 170  
 171  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 172  var unsupportedIterableToArray = __webpack_require__(31);
 173  
 174  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 175  function _nonIterableSpread() {
 176    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 177  }
 178  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 179  
 180  
 181  
 182  
 183  function _toConsumableArray(arr) {
 184    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 185  }
 186  
 187  /***/ }),
 188  
 189  /***/ 17:
 190  /***/ (function(module, exports) {
 191  
 192  (function() { module.exports = window["wp"]["keycodes"]; }());
 193  
 194  /***/ }),
 195  
 196  /***/ 2:
 197  /***/ (function(module, exports) {
 198  
 199  (function() { module.exports = window["lodash"]; }());
 200  
 201  /***/ }),
 202  
 203  /***/ 24:
 204  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 205  
 206  "use strict";
 207  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 208  function _arrayLikeToArray(arr, len) {
 209    if (len == null || len > arr.length) len = arr.length;
 210  
 211    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 212      arr2[i] = arr[i];
 213    }
 214  
 215    return arr2;
 216  }
 217  
 218  /***/ }),
 219  
 220  /***/ 31:
 221  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 222  
 223  "use strict";
 224  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 225  /* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
 226  
 227  function _unsupportedIterableToArray(o, minLen) {
 228    if (!o) return;
 229    if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 230    var n = Object.prototype.toString.call(o).slice(8, -1);
 231    if (n === "Object" && o.constructor) n = o.constructor.name;
 232    if (n === "Map" || n === "Set") return Array.from(o);
 233    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 234  }
 235  
 236  /***/ }),
 237  
 238  /***/ 37:
 239  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 240  
 241  "use strict";
 242  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 243  function _iterableToArray(iter) {
 244    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 245  }
 246  
 247  /***/ }),
 248  
 249  /***/ 38:
 250  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 251  
 252  "use strict";
 253  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 254  function _arrayWithHoles(arr) {
 255    if (Array.isArray(arr)) return arr;
 256  }
 257  
 258  /***/ }),
 259  
 260  /***/ 39:
 261  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 262  
 263  "use strict";
 264  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 265  function _nonIterableRest() {
 266    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 267  }
 268  
 269  /***/ }),
 270  
 271  /***/ 4:
 272  /***/ (function(module, exports) {
 273  
 274  (function() { module.exports = window["wp"]["data"]; }());
 275  
 276  /***/ }),
 277  
 278  /***/ 41:
 279  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 280  
 281  "use strict";
 282  
 283  
 284  var LEAF_KEY, hasWeakMap;
 285  
 286  /**
 287   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 288   *
 289   * @type {Object}
 290   */
 291  LEAF_KEY = {};
 292  
 293  /**
 294   * Whether environment supports WeakMap.
 295   *
 296   * @type {boolean}
 297   */
 298  hasWeakMap = typeof WeakMap !== 'undefined';
 299  
 300  /**
 301   * Returns the first argument as the sole entry in an array.
 302   *
 303   * @param {*} value Value to return.
 304   *
 305   * @return {Array} Value returned as entry in array.
 306   */
 307  function arrayOf( value ) {
 308      return [ value ];
 309  }
 310  
 311  /**
 312   * Returns true if the value passed is object-like, or false otherwise. A value
 313   * is object-like if it can support property assignment, e.g. object or array.
 314   *
 315   * @param {*} value Value to test.
 316   *
 317   * @return {boolean} Whether value is object-like.
 318   */
 319  function isObjectLike( value ) {
 320      return !! value && 'object' === typeof value;
 321  }
 322  
 323  /**
 324   * Creates and returns a new cache object.
 325   *
 326   * @return {Object} Cache object.
 327   */
 328  function createCache() {
 329      var cache = {
 330          clear: function() {
 331              cache.head = null;
 332          },
 333      };
 334  
 335      return cache;
 336  }
 337  
 338  /**
 339   * Returns true if entries within the two arrays are strictly equal by
 340   * reference from a starting index.
 341   *
 342   * @param {Array}  a         First array.
 343   * @param {Array}  b         Second array.
 344   * @param {number} fromIndex Index from which to start comparison.
 345   *
 346   * @return {boolean} Whether arrays are shallowly equal.
 347   */
 348  function isShallowEqual( a, b, fromIndex ) {
 349      var i;
 350  
 351      if ( a.length !== b.length ) {
 352          return false;
 353      }
 354  
 355      for ( i = fromIndex; i < a.length; i++ ) {
 356          if ( a[ i ] !== b[ i ] ) {
 357              return false;
 358          }
 359      }
 360  
 361      return true;
 362  }
 363  
 364  /**
 365   * Returns a memoized selector function. The getDependants function argument is
 366   * called before the memoized selector and is expected to return an immutable
 367   * reference or array of references on which the selector depends for computing
 368   * its own return value. The memoize cache is preserved only as long as those
 369   * dependant references remain the same. If getDependants returns a different
 370   * reference(s), the cache is cleared and the selector value regenerated.
 371   *
 372   * @param {Function} selector      Selector function.
 373   * @param {Function} getDependants Dependant getter returning an immutable
 374   *                                 reference or array of reference used in
 375   *                                 cache bust consideration.
 376   *
 377   * @return {Function} Memoized selector.
 378   */
 379  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 380      var rootCache, getCache;
 381  
 382      // Use object source as dependant if getter not provided
 383      if ( ! getDependants ) {
 384          getDependants = arrayOf;
 385      }
 386  
 387      /**
 388       * Returns the root cache. If WeakMap is supported, this is assigned to the
 389       * root WeakMap cache set, otherwise it is a shared instance of the default
 390       * cache object.
 391       *
 392       * @return {(WeakMap|Object)} Root cache object.
 393       */
 394  	function getRootCache() {
 395          return rootCache;
 396      }
 397  
 398      /**
 399       * Returns the cache for a given dependants array. When possible, a WeakMap
 400       * will be used to create a unique cache for each set of dependants. This
 401       * is feasible due to the nature of WeakMap in allowing garbage collection
 402       * to occur on entries where the key object is no longer referenced. Since
 403       * WeakMap requires the key to be an object, this is only possible when the
 404       * dependant is object-like. The root cache is created as a hierarchy where
 405       * each top-level key is the first entry in a dependants set, the value a
 406       * WeakMap where each key is the next dependant, and so on. This continues
 407       * so long as the dependants are object-like. If no dependants are object-
 408       * like, then the cache is shared across all invocations.
 409       *
 410       * @see isObjectLike
 411       *
 412       * @param {Array} dependants Selector dependants.
 413       *
 414       * @return {Object} Cache object.
 415       */
 416  	function getWeakMapCache( dependants ) {
 417          var caches = rootCache,
 418              isUniqueByDependants = true,
 419              i, dependant, map, cache;
 420  
 421          for ( i = 0; i < dependants.length; i++ ) {
 422              dependant = dependants[ i ];
 423  
 424              // Can only compose WeakMap from object-like key.
 425              if ( ! isObjectLike( dependant ) ) {
 426                  isUniqueByDependants = false;
 427                  break;
 428              }
 429  
 430              // Does current segment of cache already have a WeakMap?
 431              if ( caches.has( dependant ) ) {
 432                  // Traverse into nested WeakMap.
 433                  caches = caches.get( dependant );
 434              } else {
 435                  // Create, set, and traverse into a new one.
 436                  map = new WeakMap();
 437                  caches.set( dependant, map );
 438                  caches = map;
 439              }
 440          }
 441  
 442          // We use an arbitrary (but consistent) object as key for the last item
 443          // in the WeakMap to serve as our running cache.
 444          if ( ! caches.has( LEAF_KEY ) ) {
 445              cache = createCache();
 446              cache.isUniqueByDependants = isUniqueByDependants;
 447              caches.set( LEAF_KEY, cache );
 448          }
 449  
 450          return caches.get( LEAF_KEY );
 451      }
 452  
 453      // Assign cache handler by availability of WeakMap
 454      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 455  
 456      /**
 457       * Resets root memoization cache.
 458       */
 459  	function clear() {
 460          rootCache = hasWeakMap ? new WeakMap() : createCache();
 461      }
 462  
 463      // eslint-disable-next-line jsdoc/check-param-names
 464      /**
 465       * The augmented selector call, considering first whether dependants have
 466       * changed before passing it to underlying memoize function.
 467       *
 468       * @param {Object} source    Source object for derivation.
 469       * @param {...*}   extraArgs Additional arguments to pass to selector.
 470       *
 471       * @return {*} Selector result.
 472       */
 473  	function callSelector( /* source, ...extraArgs */ ) {
 474          var len = arguments.length,
 475              cache, node, i, args, dependants;
 476  
 477          // Create copy of arguments (avoid leaking deoptimization).
 478          args = new Array( len );
 479          for ( i = 0; i < len; i++ ) {
 480              args[ i ] = arguments[ i ];
 481          }
 482  
 483          dependants = getDependants.apply( null, args );
 484          cache = getCache( dependants );
 485  
 486          // If not guaranteed uniqueness by dependants (primitive type or lack
 487          // of WeakMap support), shallow compare against last dependants and, if
 488          // references have changed, destroy cache to recalculate result.
 489          if ( ! cache.isUniqueByDependants ) {
 490              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 491                  cache.clear();
 492              }
 493  
 494              cache.lastDependants = dependants;
 495          }
 496  
 497          node = cache.head;
 498          while ( node ) {
 499              // Check whether node arguments match arguments
 500              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 501                  node = node.next;
 502                  continue;
 503              }
 504  
 505              // At this point we can assume we've found a match
 506  
 507              // Surface matched node to head if not already
 508              if ( node !== cache.head ) {
 509                  // Adjust siblings to point to each other.
 510                  node.prev.next = node.next;
 511                  if ( node.next ) {
 512                      node.next.prev = node.prev;
 513                  }
 514  
 515                  node.next = cache.head;
 516                  node.prev = null;
 517                  cache.head.prev = node;
 518                  cache.head = node;
 519              }
 520  
 521              // Return immediately
 522              return node.val;
 523          }
 524  
 525          // No cached value found. Continue to insertion phase:
 526  
 527          node = {
 528              // Generate the result from original function
 529              val: selector.apply( null, args ),
 530          };
 531  
 532          // Avoid including the source object in the cache.
 533          args[ 0 ] = null;
 534          node.args = args;
 535  
 536          // Don't need to check whether node is already head, since it would
 537          // have been returned above already if it was
 538  
 539          // Shift existing head down list
 540          if ( cache.head ) {
 541              cache.head.prev = node;
 542              node.next = cache.head;
 543          }
 544  
 545          cache.head = node;
 546  
 547          return node.val;
 548      }
 549  
 550      callSelector.getDependants = getDependants;
 551      callSelector.clear = clear;
 552      clear();
 553  
 554      return callSelector;
 555  });
 556  
 557  
 558  /***/ }),
 559  
 560  /***/ 477:
 561  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 562  
 563  "use strict";
 564  // ESM COMPAT FLAG
 565  __webpack_require__.r(__webpack_exports__);
 566  
 567  // EXPORTS
 568  __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
 569  __webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
 570  
 571  // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
 572  var actions_namespaceObject = {};
 573  __webpack_require__.r(actions_namespaceObject);
 574  __webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
 575  __webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
 576  
 577  // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
 578  var selectors_namespaceObject = {};
 579  __webpack_require__.r(selectors_namespaceObject);
 580  __webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
 581  __webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
 582  __webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
 583  __webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
 584  __webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
 585  __webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
 586  
 587  // EXTERNAL MODULE: external ["wp","data"]
 588  var external_wp_data_ = __webpack_require__(4);
 589  
 590  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 591  var defineProperty = __webpack_require__(5);
 592  
 593  // EXTERNAL MODULE: external "lodash"
 594  var external_lodash_ = __webpack_require__(2);
 595  
 596  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
 597  
 598  
 599  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; }
 600  
 601  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; }
 602  
 603  /**
 604   * External dependencies
 605   */
 606  
 607  /**
 608   * Reducer returning the registered shortcuts
 609   *
 610   * @param {Object} state  Current state.
 611   * @param {Object} action Dispatched action.
 612   *
 613   * @return {Object} Updated state.
 614   */
 615  
 616  function reducer() {
 617    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 618    var action = arguments.length > 1 ? arguments[1] : undefined;
 619  
 620    switch (action.type) {
 621      case 'REGISTER_SHORTCUT':
 622        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.name, {
 623          category: action.category,
 624          keyCombination: action.keyCombination,
 625          aliases: action.aliases,
 626          description: action.description
 627        }));
 628  
 629      case 'UNREGISTER_SHORTCUT':
 630        return Object(external_lodash_["omit"])(state, action.name);
 631    }
 632  
 633    return state;
 634  }
 635  
 636  /* harmony default export */ var store_reducer = (reducer);
 637  
 638  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
 639  /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
 640  
 641  /**
 642   * Keyboard key combination.
 643   *
 644   * @typedef {Object} WPShortcutKeyCombination
 645   *
 646   * @property {string}                      character Character.
 647   * @property {WPKeycodeModifier|undefined} modifier  Modifier.
 648   */
 649  
 650  /**
 651   * Configuration of a registered keyboard shortcut.
 652   *
 653   * @typedef {Object} WPShortcutConfig
 654   *
 655   * @property {string}                     name           Shortcut name.
 656   * @property {string}                     category       Shortcut category.
 657   * @property {string}                     description    Shortcut description.
 658   * @property {WPShortcutKeyCombination}   keyCombination Shortcut key combination.
 659   * @property {WPShortcutKeyCombination[]} [aliases]      Shortcut aliases.
 660   */
 661  
 662  /**
 663   * Returns an action object used to register a new keyboard shortcut.
 664   *
 665   * @param {WPShortcutConfig} config Shortcut config.
 666   *
 667   * @return {Object} action.
 668   */
 669  function registerShortcut(_ref) {
 670    var name = _ref.name,
 671        category = _ref.category,
 672        description = _ref.description,
 673        keyCombination = _ref.keyCombination,
 674        aliases = _ref.aliases;
 675    return {
 676      type: 'REGISTER_SHORTCUT',
 677      name: name,
 678      category: category,
 679      keyCombination: keyCombination,
 680      aliases: aliases,
 681      description: description
 682    };
 683  }
 684  /**
 685   * Returns an action object used to unregister a keyboard shortcut.
 686   *
 687   * @param {string} name Shortcut name.
 688   *
 689   * @return {Object} action.
 690   */
 691  
 692  function unregisterShortcut(name) {
 693    return {
 694      type: 'UNREGISTER_SHORTCUT',
 695      name: name
 696    };
 697  }
 698  
 699  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
 700  var slicedToArray = __webpack_require__(11);
 701  
 702  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 703  var toConsumableArray = __webpack_require__(15);
 704  
 705  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 706  var rememo = __webpack_require__(41);
 707  
 708  // EXTERNAL MODULE: external ["wp","keycodes"]
 709  var external_wp_keycodes_ = __webpack_require__(17);
 710  
 711  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
 712  
 713  
 714  
 715  /**
 716   * External dependencies
 717   */
 718  
 719  
 720  /**
 721   * WordPress dependencies
 722   */
 723  
 724  
 725  /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
 726  
 727  /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
 728  
 729  /**
 730   * Shared reference to an empty array for cases where it is important to avoid
 731   * returning a new array reference on every invocation.
 732   *
 733   * @type {Array<any>}
 734   */
 735  
 736  var EMPTY_ARRAY = [];
 737  /**
 738   * Shortcut formatting methods.
 739   *
 740   * @property {WPKeycodeHandlerByModifier} display     Display formatting.
 741   * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
 742   * @property {WPKeycodeHandlerByModifier} ariaLabel   ARIA label formatting.
 743   */
 744  
 745  var FORMATTING_METHODS = {
 746    display: external_wp_keycodes_["displayShortcut"],
 747    raw: external_wp_keycodes_["rawShortcut"],
 748    ariaLabel: external_wp_keycodes_["shortcutAriaLabel"]
 749  };
 750  /**
 751   * Returns a string representing the key combination.
 752   *
 753   * @param {?WPShortcutKeyCombination} shortcut       Key combination.
 754   * @param {keyof FORMATTING_METHODS}  representation Type of representation
 755   *                                                   (display, raw, ariaLabel).
 756   *
 757   * @return {string?} Shortcut representation.
 758   */
 759  
 760  function getKeyCombinationRepresentation(shortcut, representation) {
 761    if (!shortcut) {
 762      return null;
 763    }
 764  
 765    return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
 766  }
 767  /**
 768   * Returns the main key combination for a given shortcut name.
 769   *
 770   * @param {Object} state Global state.
 771   * @param {string} name  Shortcut name.
 772   *
 773   * @return {WPShortcutKeyCombination?} Key combination.
 774   */
 775  
 776  
 777  function getShortcutKeyCombination(state, name) {
 778    return state[name] ? state[name].keyCombination : null;
 779  }
 780  /**
 781   * Returns a string representing the main key combination for a given shortcut name.
 782   *
 783   * @param {Object}                   state          Global state.
 784   * @param {string}                   name           Shortcut name.
 785   * @param {keyof FORMATTING_METHODS} representation Type of representation
 786   *                                                  (display, raw, ariaLabel).
 787   *
 788   * @return {string?} Shortcut representation.
 789   */
 790  
 791  function getShortcutRepresentation(state, name) {
 792    var representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
 793    var shortcut = getShortcutKeyCombination(state, name);
 794    return getKeyCombinationRepresentation(shortcut, representation);
 795  }
 796  /**
 797   * Returns the shortcut description given its name.
 798   *
 799   * @param {Object} state Global state.
 800   * @param {string} name  Shortcut name.
 801   *
 802   * @return {string?} Shortcut description.
 803   */
 804  
 805  function getShortcutDescription(state, name) {
 806    return state[name] ? state[name].description : null;
 807  }
 808  /**
 809   * Returns the aliases for a given shortcut name.
 810   *
 811   * @param {Object} state Global state.
 812   * @param {string} name  Shortcut name.
 813   *
 814   * @return {WPShortcutKeyCombination[]} Key combinations.
 815   */
 816  
 817  function getShortcutAliases(state, name) {
 818    return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
 819  }
 820  /**
 821   * Returns the raw representation of all the keyboard combinations of a given shortcut name.
 822   *
 823   * @param {Object} state Global state.
 824   * @param {string} name  Shortcut name.
 825   *
 826   * @return {string[]} Shortcuts.
 827   */
 828  
 829  var getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])(function (state, name) {
 830    return Object(external_lodash_["compact"])([getKeyCombinationRepresentation(getShortcutKeyCombination(state, name), 'raw')].concat(Object(toConsumableArray["a" /* default */])(getShortcutAliases(state, name).map(function (combination) {
 831      return getKeyCombinationRepresentation(combination, 'raw');
 832    }))));
 833  }, function (state, name) {
 834    return [state[name]];
 835  });
 836  /**
 837   * Returns the shortcut names list for a given category name.
 838   *
 839   * @param {Object} state Global state.
 840   * @param {string} name  Category name.
 841   *
 842   * @return {string[]} Shortcut names.
 843   */
 844  
 845  var getCategoryShortcuts = Object(rememo["a" /* default */])(function (state, categoryName) {
 846    return Object.entries(state).filter(function (_ref) {
 847      var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
 848          shortcut = _ref2[1];
 849  
 850      return shortcut.category === categoryName;
 851    }).map(function (_ref3) {
 852      var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 1),
 853          name = _ref4[0];
 854  
 855      return name;
 856    });
 857  }, function (state) {
 858    return [state];
 859  });
 860  
 861  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
 862  /**
 863   * WordPress dependencies
 864   */
 865  
 866  /**
 867   * Internal dependencies
 868   */
 869  
 870  
 871  
 872  
 873  var STORE_NAME = 'core/keyboard-shortcuts';
 874  /**
 875   * Store definition for the keyboard shortcuts namespace.
 876   *
 877   * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
 878   *
 879   * @type {Object}
 880   */
 881  
 882  var store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
 883    reducer: store_reducer,
 884    actions: actions_namespaceObject,
 885    selectors: selectors_namespaceObject
 886  });
 887  Object(external_wp_data_["register"])(store);
 888  
 889  // EXTERNAL MODULE: external ["wp","compose"]
 890  var external_wp_compose_ = __webpack_require__(12);
 891  
 892  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
 893  /**
 894   * WordPress dependencies
 895   */
 896  
 897  
 898  /**
 899   * Internal dependencies
 900   */
 901  
 902  
 903  /**
 904   * Attach a keyboard shortcut handler.
 905   *
 906   * @param {string} name       Shortcut name.
 907   * @param {Function} callback Shortcut callback.
 908   * @param {Object} options    Shortcut options.
 909   */
 910  
 911  function useShortcut(name, callback, options) {
 912    var shortcuts = Object(external_wp_data_["useSelect"])(function (select) {
 913      return select(store).getAllShortcutRawKeyCombinations(name);
 914    }, [name]);
 915    Object(external_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
 916  }
 917  
 918  /* harmony default export */ var use_shortcut = (useShortcut);
 919  
 920  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
 921  
 922  
 923  
 924  
 925  /***/ }),
 926  
 927  /***/ 5:
 928  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 929  
 930  "use strict";
 931  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 932  function _defineProperty(obj, key, value) {
 933    if (key in obj) {
 934      Object.defineProperty(obj, key, {
 935        value: value,
 936        enumerable: true,
 937        configurable: true,
 938        writable: true
 939      });
 940    } else {
 941      obj[key] = value;
 942    }
 943  
 944    return obj;
 945  }
 946  
 947  /***/ })
 948  
 949  /******/ });


Generated: Thu Mar 4 01:00:04 2021 Cross-referenced by PHPXref 0.7.1