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


Generated: Thu Apr 9 01:00:03 2020 Cross-referenced by PHPXref 0.7.1