[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> keycodes.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["keycodes"] =
   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 = 487);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 1:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = window["wp"]["i18n"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 15:
  98  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99  
 100  "use strict";
 101  
 102  // EXPORTS
 103  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 104  
 105  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 106  var arrayLikeToArray = __webpack_require__(24);
 107  
 108  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 109  
 110  function _arrayWithoutHoles(arr) {
 111    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 112  }
 113  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 114  var iterableToArray = __webpack_require__(37);
 115  
 116  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 117  var unsupportedIterableToArray = __webpack_require__(31);
 118  
 119  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 120  function _nonIterableSpread() {
 121    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 122  }
 123  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 124  
 125  
 126  
 127  
 128  function _toConsumableArray(arr) {
 129    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 130  }
 131  
 132  /***/ }),
 133  
 134  /***/ 2:
 135  /***/ (function(module, exports) {
 136  
 137  (function() { module.exports = window["lodash"]; }());
 138  
 139  /***/ }),
 140  
 141  /***/ 24:
 142  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 143  
 144  "use strict";
 145  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 146  function _arrayLikeToArray(arr, len) {
 147    if (len == null || len > arr.length) len = arr.length;
 148  
 149    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 150      arr2[i] = arr[i];
 151    }
 152  
 153    return arr2;
 154  }
 155  
 156  /***/ }),
 157  
 158  /***/ 31:
 159  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 160  
 161  "use strict";
 162  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 163  /* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
 164  
 165  function _unsupportedIterableToArray(o, minLen) {
 166    if (!o) return;
 167    if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 168    var n = Object.prototype.toString.call(o).slice(8, -1);
 169    if (n === "Object" && o.constructor) n = o.constructor.name;
 170    if (n === "Map" || n === "Set") return Array.from(o);
 171    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);
 172  }
 173  
 174  /***/ }),
 175  
 176  /***/ 37:
 177  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 178  
 179  "use strict";
 180  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 181  function _iterableToArray(iter) {
 182    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 183  }
 184  
 185  /***/ }),
 186  
 187  /***/ 487:
 188  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 189  
 190  "use strict";
 191  // ESM COMPAT FLAG
 192  __webpack_require__.r(__webpack_exports__);
 193  
 194  // EXPORTS
 195  __webpack_require__.d(__webpack_exports__, "BACKSPACE", function() { return /* binding */ BACKSPACE; });
 196  __webpack_require__.d(__webpack_exports__, "TAB", function() { return /* binding */ TAB; });
 197  __webpack_require__.d(__webpack_exports__, "ENTER", function() { return /* binding */ ENTER; });
 198  __webpack_require__.d(__webpack_exports__, "ESCAPE", function() { return /* binding */ ESCAPE; });
 199  __webpack_require__.d(__webpack_exports__, "SPACE", function() { return /* binding */ SPACE; });
 200  __webpack_require__.d(__webpack_exports__, "LEFT", function() { return /* binding */ LEFT; });
 201  __webpack_require__.d(__webpack_exports__, "UP", function() { return /* binding */ UP; });
 202  __webpack_require__.d(__webpack_exports__, "RIGHT", function() { return /* binding */ RIGHT; });
 203  __webpack_require__.d(__webpack_exports__, "DOWN", function() { return /* binding */ DOWN; });
 204  __webpack_require__.d(__webpack_exports__, "DELETE", function() { return /* binding */ DELETE; });
 205  __webpack_require__.d(__webpack_exports__, "F10", function() { return /* binding */ F10; });
 206  __webpack_require__.d(__webpack_exports__, "ALT", function() { return /* binding */ ALT; });
 207  __webpack_require__.d(__webpack_exports__, "CTRL", function() { return /* binding */ CTRL; });
 208  __webpack_require__.d(__webpack_exports__, "COMMAND", function() { return /* binding */ COMMAND; });
 209  __webpack_require__.d(__webpack_exports__, "SHIFT", function() { return /* binding */ SHIFT; });
 210  __webpack_require__.d(__webpack_exports__, "ZERO", function() { return /* binding */ ZERO; });
 211  __webpack_require__.d(__webpack_exports__, "modifiers", function() { return /* binding */ modifiers; });
 212  __webpack_require__.d(__webpack_exports__, "rawShortcut", function() { return /* binding */ rawShortcut; });
 213  __webpack_require__.d(__webpack_exports__, "displayShortcutList", function() { return /* binding */ displayShortcutList; });
 214  __webpack_require__.d(__webpack_exports__, "displayShortcut", function() { return /* binding */ displayShortcut; });
 215  __webpack_require__.d(__webpack_exports__, "shortcutAriaLabel", function() { return /* binding */ shortcutAriaLabel; });
 216  __webpack_require__.d(__webpack_exports__, "isKeyboardEvent", function() { return /* binding */ isKeyboardEvent; });
 217  
 218  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 219  var defineProperty = __webpack_require__(5);
 220  
 221  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 222  var toConsumableArray = __webpack_require__(15);
 223  
 224  // EXTERNAL MODULE: external "lodash"
 225  var external_lodash_ = __webpack_require__(2);
 226  
 227  // EXTERNAL MODULE: external ["wp","i18n"]
 228  var external_wp_i18n_ = __webpack_require__(1);
 229  
 230  // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/platform.js
 231  /**
 232   * External dependencies
 233   */
 234  
 235  /**
 236   * Return true if platform is MacOS.
 237   *
 238   * @param {Window} _window window object by default; used for DI testing.
 239   *
 240   * @return {boolean} True if MacOS; false otherwise.
 241   */
 242  
 243  function isAppleOS() {
 244    var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
 245  
 246    var platform = _window.navigator.platform;
 247    return platform.indexOf('Mac') !== -1 || Object(external_lodash_["includes"])(['iPad', 'iPhone'], platform);
 248  }
 249  
 250  // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/index.js
 251  
 252  
 253  
 254  /**
 255   * Note: The order of the modifier keys in many of the [foo]Shortcut()
 256   * functions in this file are intentional and should not be changed. They're
 257   * designed to fit with the standard menu keyboard shortcuts shown in the
 258   * user's platform.
 259   *
 260   * For example, on MacOS menu shortcuts will place Shift before Command, but
 261   * on Windows Control will usually come first. So don't provide your own
 262   * shortcut combos directly to keyboardShortcut().
 263   */
 264  
 265  /**
 266   * External dependencies
 267   */
 268  
 269  /**
 270   * WordPress dependencies
 271   */
 272  
 273  
 274  /**
 275   * Internal dependencies
 276   */
 277  
 278  
 279  /** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
 280  
 281  /** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt'} WPKeycodeModifier */
 282  
 283  /**
 284   * An object of handler functions for each of the possible modifier
 285   * combinations. A handler will return a value for a given key.
 286   *
 287   * @template T
 288   *
 289   * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler
 290   */
 291  
 292  /* eslint-disable jsdoc/valid-types */
 293  
 294  /**
 295   * @template T
 296   *
 297   * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
 298   */
 299  
 300  /** @typedef {(event: KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
 301  
 302  /* eslint-enable jsdoc/valid-types */
 303  
 304  /**
 305   * Keycode for BACKSPACE key.
 306   */
 307  
 308  var BACKSPACE = 8;
 309  /**
 310   * Keycode for TAB key.
 311   */
 312  
 313  var TAB = 9;
 314  /**
 315   * Keycode for ENTER key.
 316   */
 317  
 318  var ENTER = 13;
 319  /**
 320   * Keycode for ESCAPE key.
 321   */
 322  
 323  var ESCAPE = 27;
 324  /**
 325   * Keycode for SPACE key.
 326   */
 327  
 328  var SPACE = 32;
 329  /**
 330   * Keycode for LEFT key.
 331   */
 332  
 333  var LEFT = 37;
 334  /**
 335   * Keycode for UP key.
 336   */
 337  
 338  var UP = 38;
 339  /**
 340   * Keycode for RIGHT key.
 341   */
 342  
 343  var RIGHT = 39;
 344  /**
 345   * Keycode for DOWN key.
 346   */
 347  
 348  var DOWN = 40;
 349  /**
 350   * Keycode for DELETE key.
 351   */
 352  
 353  var DELETE = 46;
 354  /**
 355   * Keycode for F10 key.
 356   */
 357  
 358  var F10 = 121;
 359  /**
 360   * Keycode for ALT key.
 361   */
 362  
 363  var ALT = 'alt';
 364  /**
 365   * Keycode for CTRL key.
 366   */
 367  
 368  var CTRL = 'ctrl';
 369  /**
 370   * Keycode for COMMAND/META key.
 371   */
 372  
 373  var COMMAND = 'meta';
 374  /**
 375   * Keycode for SHIFT key.
 376   */
 377  
 378  var SHIFT = 'shift';
 379  /**
 380   * Keycode for ZERO key.
 381   */
 382  
 383  var ZERO = 48;
 384  /**
 385   * Object that contains functions that return the available modifier
 386   * depending on platform.
 387   *
 388   * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
 389   */
 390  
 391  var modifiers = {
 392    primary: function primary(_isApple) {
 393      return _isApple() ? [COMMAND] : [CTRL];
 394    },
 395    primaryShift: function primaryShift(_isApple) {
 396      return _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT];
 397    },
 398    primaryAlt: function primaryAlt(_isApple) {
 399      return _isApple() ? [ALT, COMMAND] : [CTRL, ALT];
 400    },
 401    secondary: function secondary(_isApple) {
 402      return _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT];
 403    },
 404    access: function access(_isApple) {
 405      return _isApple() ? [CTRL, ALT] : [SHIFT, ALT];
 406    },
 407    ctrl: function ctrl() {
 408      return [CTRL];
 409    },
 410    alt: function alt() {
 411      return [ALT];
 412    },
 413    ctrlShift: function ctrlShift() {
 414      return [CTRL, SHIFT];
 415    },
 416    shift: function shift() {
 417      return [SHIFT];
 418    },
 419    shiftAlt: function shiftAlt() {
 420      return [SHIFT, ALT];
 421    }
 422  };
 423  /**
 424   * An object that contains functions to get raw shortcuts.
 425   *
 426   * These are intended for user with the KeyboardShortcuts.
 427   *
 428   * @example
 429   * ```js
 430   * // Assuming macOS:
 431   * rawShortcut.primary( 'm' )
 432   * // "meta+m""
 433   * ```
 434   *
 435   * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
 436   *                                                 shortcuts.
 437   */
 438  
 439  var rawShortcut = Object(external_lodash_["mapValues"])(modifiers, function (modifier) {
 440    return (
 441      /** @type {WPKeyHandler<string>} */
 442      function (character) {
 443        var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
 444  
 445        return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character.toLowerCase()]).join('+');
 446      }
 447    );
 448  });
 449  /**
 450   * Return an array of the parts of a keyboard shortcut chord for display.
 451   *
 452   * @example
 453   * ```js
 454   * // Assuming macOS:
 455   * displayShortcutList.primary( 'm' );
 456   * // [ "⌘", "M" ]
 457   * ```
 458   *
 459   * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
 460   *                                                   shortcut sequences.
 461   */
 462  
 463  var displayShortcutList = Object(external_lodash_["mapValues"])(modifiers, function (modifier) {
 464    return (
 465      /** @type {WPKeyHandler<string[]>} */
 466      function (character) {
 467        var _replacementKeyMap;
 468  
 469        var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
 470  
 471        var isApple = _isApple();
 472  
 473        var replacementKeyMap = (_replacementKeyMap = {}, Object(defineProperty["a" /* default */])(_replacementKeyMap, ALT, isApple ? '⌥' : 'Alt'), Object(defineProperty["a" /* default */])(_replacementKeyMap, CTRL, isApple ? '⌃' : 'Ctrl'), Object(defineProperty["a" /* default */])(_replacementKeyMap, COMMAND, '⌘'), Object(defineProperty["a" /* default */])(_replacementKeyMap, SHIFT, isApple ? '⇧' : 'Shift'), _replacementKeyMap);
 474        var modifierKeys = modifier(_isApple).reduce(function (accumulator, key) {
 475          var replacementKey = Object(external_lodash_["get"])(replacementKeyMap, key, key); // If on the Mac, adhere to platform convention and don't show plus between keys.
 476  
 477          if (isApple) {
 478            return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey]);
 479          }
 480  
 481          return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey, '+']);
 482        },
 483        /** @type {string[]} */
 484        []);
 485        var capitalizedCharacter = Object(external_lodash_["capitalize"])(character);
 486        return [].concat(Object(toConsumableArray["a" /* default */])(modifierKeys), [capitalizedCharacter]);
 487      }
 488    );
 489  });
 490  /**
 491   * An object that contains functions to display shortcuts.
 492   *
 493   * @example
 494   * ```js
 495   * // Assuming macOS:
 496   * displayShortcut.primary( 'm' );
 497   * // "⌘M"
 498   * ```
 499   *
 500   * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
 501   *                                                 display shortcuts.
 502   */
 503  
 504  var displayShortcut = Object(external_lodash_["mapValues"])(displayShortcutList, function (shortcutList) {
 505    return (
 506      /** @type {WPKeyHandler<string>} */
 507      function (character) {
 508        var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
 509  
 510        return shortcutList(character, _isApple).join('');
 511      }
 512    );
 513  });
 514  /**
 515   * An object that contains functions to return an aria label for a keyboard
 516   * shortcut.
 517   *
 518   * @example
 519   * ```js
 520   * // Assuming macOS:
 521   * shortcutAriaLabel.primary( '.' );
 522   * // "Command + Period"
 523   * ```
 524   *
 525   * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
 526   *                                                 shortcut ARIA labels.
 527   */
 528  
 529  var shortcutAriaLabel = Object(external_lodash_["mapValues"])(modifiers, function (modifier) {
 530    return (
 531      /** @type {WPKeyHandler<string>} */
 532      function (character) {
 533        var _replacementKeyMap2;
 534  
 535        var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS;
 536  
 537        var isApple = _isApple();
 538  
 539        var replacementKeyMap = (_replacementKeyMap2 = {}, Object(defineProperty["a" /* default */])(_replacementKeyMap2, SHIFT, 'Shift'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, COMMAND, isApple ? 'Command' : 'Control'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, CTRL, 'Control'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, ALT, isApple ? 'Option' : 'Alt'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, ',', Object(external_wp_i18n_["__"])('Comma')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '.', Object(external_wp_i18n_["__"])('Period')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '`', Object(external_wp_i18n_["__"])('Backtick')), _replacementKeyMap2);
 540        return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character]).map(function (key) {
 541          return Object(external_lodash_["capitalize"])(Object(external_lodash_["get"])(replacementKeyMap, key, key));
 542        }).join(isApple ? ' ' : ' + ');
 543      }
 544    );
 545  });
 546  /**
 547   * From a given KeyboardEvent, returns an array of active modifier constants for
 548   * the event.
 549   *
 550   * @param {KeyboardEvent} event Keyboard event.
 551   *
 552   * @return {Array<WPModifierPart>} Active modifier constants.
 553   */
 554  
 555  function getEventModifiers(event) {
 556    return (
 557      /** @type {WPModifierPart[]} */
 558      [ALT, CTRL, COMMAND, SHIFT].filter(function (key) {
 559        return event[
 560        /** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
 561        "".concat(key, "Key")];
 562      })
 563    );
 564  }
 565  /**
 566   * An object that contains functions to check if a keyboard event matches a
 567   * predefined shortcut combination.
 568   *
 569   * @example
 570   * ```js
 571   * // Assuming an event for ⌘M key press:
 572   * isKeyboardEvent.primary( event, 'm' );
 573   * // true
 574   * ```
 575   *
 576   * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
 577   *                                                       to match events.
 578   */
 579  
 580  
 581  var isKeyboardEvent = Object(external_lodash_["mapValues"])(modifiers, function (getModifiers) {
 582    return (
 583      /** @type {WPEventKeyHandler} */
 584      function (event, character) {
 585        var _isApple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isAppleOS;
 586  
 587        var mods = getModifiers(_isApple);
 588        var eventMods = getEventModifiers(event);
 589  
 590        if (Object(external_lodash_["xor"])(mods, eventMods).length) {
 591          return false;
 592        }
 593  
 594        if (!character) {
 595          return Object(external_lodash_["includes"])(mods, event.key.toLowerCase());
 596        }
 597  
 598        return event.key === character;
 599      }
 600    );
 601  });
 602  
 603  
 604  /***/ }),
 605  
 606  /***/ 5:
 607  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 608  
 609  "use strict";
 610  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 611  function _defineProperty(obj, key, value) {
 612    if (key in obj) {
 613      Object.defineProperty(obj, key, {
 614        value: value,
 615        enumerable: true,
 616        configurable: true,
 617        writable: true
 618      });
 619    } else {
 620      obj[key] = value;
 621    }
 622  
 623    return obj;
 624  }
 625  
 626  /***/ })
 627  
 628  /******/ });


Generated: Sun Feb 28 01:00:03 2021 Cross-referenced by PHPXref 0.7.1