9
|
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 |
16
|
85 |
/******/ return __webpack_require__(__webpack_require__.s = 466); |
9
|
86 |
/******/ }) |
|
87 |
/************************************************************************/ |
|
88 |
/******/ ({ |
|
89 |
|
|
90 |
/***/ 1: |
|
91 |
/***/ (function(module, exports) { |
|
92 |
|
|
93 |
(function() { module.exports = this["wp"]["i18n"]; }()); |
|
94 |
|
|
95 |
/***/ }), |
|
96 |
|
16
|
97 |
/***/ 18: |
9
|
98 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
|
100 |
"use strict"; |
|
101 |
|
16
|
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__(26); |
|
107 |
|
9
|
108 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
16
|
109 |
|
9
|
110 |
function _arrayWithoutHoles(arr) { |
16
|
111 |
if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
9
|
112 |
} |
|
113 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
16
|
114 |
var iterableToArray = __webpack_require__(35); |
|
115 |
|
|
116 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
117 |
var unsupportedIterableToArray = __webpack_require__(29); |
9
|
118 |
|
|
119 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
120 |
function _nonIterableSpread() { |
16
|
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."); |
9
|
122 |
} |
|
123 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
16
|
124 |
|
9
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
function _toConsumableArray(arr) { |
16
|
129 |
return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
9
|
130 |
} |
|
131 |
|
|
132 |
/***/ }), |
|
133 |
|
|
134 |
/***/ 2: |
|
135 |
/***/ (function(module, exports) { |
|
136 |
|
|
137 |
(function() { module.exports = this["lodash"]; }()); |
|
138 |
|
|
139 |
/***/ }), |
|
140 |
|
16
|
141 |
/***/ 26: |
|
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 |
/***/ 29: |
|
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 _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
164 |
|
|
165 |
function _unsupportedIterableToArray(o, minLen) { |
|
166 |
if (!o) return; |
|
167 |
if (typeof o === "string") return Object(_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(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
172 |
} |
|
173 |
|
|
174 |
/***/ }), |
|
175 |
|
|
176 |
/***/ 35: |
9
|
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) { |
16
|
182 |
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
9
|
183 |
} |
|
184 |
|
|
185 |
/***/ }), |
|
186 |
|
16
|
187 |
/***/ 466: |
9
|
188 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
189 |
|
|
190 |
"use strict"; |
16
|
191 |
// ESM COMPAT FLAG |
9
|
192 |
__webpack_require__.r(__webpack_exports__); |
|
193 |
|
16
|
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 |
|
9
|
218 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
16
|
219 |
var defineProperty = __webpack_require__(5); |
9
|
220 |
|
|
221 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
16
|
222 |
var toConsumableArray = __webpack_require__(18); |
9
|
223 |
|
16
|
224 |
// EXTERNAL MODULE: external {"this":"lodash"} |
|
225 |
var external_this_lodash_ = __webpack_require__(2); |
9
|
226 |
|
|
227 |
// EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
228 |
var external_this_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 {Object} _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; |
16
|
247 |
return platform.indexOf('Mac') !== -1 || Object(external_this_lodash_["includes"])(['iPad', 'iPhone'], platform); |
9
|
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 |
/** |
16
|
280 |
* @typedef {'primary'|'primaryShift'|'primaryAlt'|'secondary'|'access'|'ctrl'|'alt'|'ctrlShift'|'shift'|'shiftAlt'} WPKeycodeModifier |
|
281 |
*/ |
|
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 |
* @typedef {Record<WPKeycodeModifier, (key:string)=>any>} WPKeycodeHandlerByModifier |
|
288 |
*/ |
|
289 |
|
|
290 |
/** |
9
|
291 |
* Keycode for BACKSPACE key. |
|
292 |
*/ |
|
293 |
|
|
294 |
var BACKSPACE = 8; |
|
295 |
/** |
|
296 |
* Keycode for TAB key. |
|
297 |
*/ |
|
298 |
|
|
299 |
var TAB = 9; |
|
300 |
/** |
|
301 |
* Keycode for ENTER key. |
|
302 |
*/ |
|
303 |
|
|
304 |
var ENTER = 13; |
|
305 |
/** |
|
306 |
* Keycode for ESCAPE key. |
|
307 |
*/ |
|
308 |
|
|
309 |
var ESCAPE = 27; |
|
310 |
/** |
|
311 |
* Keycode for SPACE key. |
|
312 |
*/ |
|
313 |
|
|
314 |
var SPACE = 32; |
|
315 |
/** |
|
316 |
* Keycode for LEFT key. |
|
317 |
*/ |
|
318 |
|
|
319 |
var LEFT = 37; |
|
320 |
/** |
|
321 |
* Keycode for UP key. |
|
322 |
*/ |
|
323 |
|
|
324 |
var UP = 38; |
|
325 |
/** |
|
326 |
* Keycode for RIGHT key. |
|
327 |
*/ |
|
328 |
|
|
329 |
var RIGHT = 39; |
|
330 |
/** |
|
331 |
* Keycode for DOWN key. |
|
332 |
*/ |
|
333 |
|
|
334 |
var DOWN = 40; |
|
335 |
/** |
|
336 |
* Keycode for DELETE key. |
|
337 |
*/ |
|
338 |
|
|
339 |
var DELETE = 46; |
|
340 |
/** |
|
341 |
* Keycode for F10 key. |
|
342 |
*/ |
|
343 |
|
|
344 |
var F10 = 121; |
|
345 |
/** |
|
346 |
* Keycode for ALT key. |
|
347 |
*/ |
|
348 |
|
|
349 |
var ALT = 'alt'; |
|
350 |
/** |
|
351 |
* Keycode for CTRL key. |
|
352 |
*/ |
|
353 |
|
|
354 |
var CTRL = 'ctrl'; |
|
355 |
/** |
|
356 |
* Keycode for COMMAND/META key. |
|
357 |
*/ |
|
358 |
|
|
359 |
var COMMAND = 'meta'; |
|
360 |
/** |
|
361 |
* Keycode for SHIFT key. |
|
362 |
*/ |
|
363 |
|
|
364 |
var SHIFT = 'shift'; |
|
365 |
/** |
16
|
366 |
* Keycode for ZERO key. |
|
367 |
*/ |
|
368 |
|
|
369 |
var ZERO = 48; |
|
370 |
/** |
9
|
371 |
* Object that contains functions that return the available modifier |
|
372 |
* depending on platform. |
|
373 |
* |
|
374 |
* - `primary`: takes a isApple function as a parameter. |
|
375 |
* - `primaryShift`: takes a isApple function as a parameter. |
|
376 |
* - `primaryAlt`: takes a isApple function as a parameter. |
|
377 |
* - `secondary`: takes a isApple function as a parameter. |
|
378 |
* - `access`: takes a isApple function as a parameter. |
|
379 |
* - `ctrl` |
|
380 |
* - `alt` |
|
381 |
* - `ctrlShift` |
|
382 |
* - `shift` |
|
383 |
* - `shiftAlt` |
|
384 |
*/ |
|
385 |
|
|
386 |
var modifiers = { |
|
387 |
primary: function primary(_isApple) { |
|
388 |
return _isApple() ? [COMMAND] : [CTRL]; |
|
389 |
}, |
|
390 |
primaryShift: function primaryShift(_isApple) { |
|
391 |
return _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT]; |
|
392 |
}, |
|
393 |
primaryAlt: function primaryAlt(_isApple) { |
|
394 |
return _isApple() ? [ALT, COMMAND] : [CTRL, ALT]; |
|
395 |
}, |
|
396 |
secondary: function secondary(_isApple) { |
|
397 |
return _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT]; |
|
398 |
}, |
|
399 |
access: function access(_isApple) { |
|
400 |
return _isApple() ? [CTRL, ALT] : [SHIFT, ALT]; |
|
401 |
}, |
|
402 |
ctrl: function ctrl() { |
|
403 |
return [CTRL]; |
|
404 |
}, |
|
405 |
alt: function alt() { |
|
406 |
return [ALT]; |
|
407 |
}, |
|
408 |
ctrlShift: function ctrlShift() { |
|
409 |
return [CTRL, SHIFT]; |
|
410 |
}, |
|
411 |
shift: function shift() { |
|
412 |
return [SHIFT]; |
|
413 |
}, |
|
414 |
shiftAlt: function shiftAlt() { |
|
415 |
return [SHIFT, ALT]; |
|
416 |
} |
|
417 |
}; |
|
418 |
/** |
|
419 |
* An object that contains functions to get raw shortcuts. |
|
420 |
* E.g. rawShortcut.primary( 'm' ) will return 'meta+m' on Mac. |
|
421 |
* These are intended for user with the KeyboardShortcuts component or TinyMCE. |
|
422 |
* |
16
|
423 |
* @type {WPKeycodeHandlerByModifier} Keyed map of functions to raw shortcuts. |
9
|
424 |
*/ |
|
425 |
|
16
|
426 |
var rawShortcut = Object(external_this_lodash_["mapValues"])(modifiers, function (modifier) { |
9
|
427 |
return function (character) { |
|
428 |
var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
429 |
|
|
430 |
return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character.toLowerCase()]).join('+'); |
|
431 |
}; |
|
432 |
}); |
|
433 |
/** |
|
434 |
* Return an array of the parts of a keyboard shortcut chord for display |
|
435 |
* E.g displayShortcutList.primary( 'm' ) will return [ '⌘', 'M' ] on Mac. |
|
436 |
* |
16
|
437 |
* @type {WPKeycodeHandlerByModifier} Keyed map of functions to shortcut |
|
438 |
* sequences. |
9
|
439 |
*/ |
|
440 |
|
16
|
441 |
var displayShortcutList = Object(external_this_lodash_["mapValues"])(modifiers, function (modifier) { |
9
|
442 |
return function (character) { |
|
443 |
var _replacementKeyMap; |
|
444 |
|
|
445 |
var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
446 |
|
|
447 |
var isApple = _isApple(); |
|
448 |
|
|
449 |
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); |
|
450 |
var modifierKeys = modifier(_isApple).reduce(function (accumulator, key) { |
16
|
451 |
var replacementKey = Object(external_this_lodash_["get"])(replacementKeyMap, key, key); // If on the Mac, adhere to platform convention and don't show plus between keys. |
9
|
452 |
|
|
453 |
if (isApple) { |
|
454 |
return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey]); |
|
455 |
} |
|
456 |
|
|
457 |
return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey, '+']); |
|
458 |
}, []); |
16
|
459 |
var capitalizedCharacter = Object(external_this_lodash_["capitalize"])(character); |
9
|
460 |
return [].concat(Object(toConsumableArray["a" /* default */])(modifierKeys), [capitalizedCharacter]); |
|
461 |
}; |
|
462 |
}); |
|
463 |
/** |
|
464 |
* An object that contains functions to display shortcuts. |
|
465 |
* E.g. displayShortcut.primary( 'm' ) will return '⌘M' on Mac. |
|
466 |
* |
16
|
467 |
* @type {WPKeycodeHandlerByModifier} Keyed map of functions to display |
|
468 |
* shortcuts. |
9
|
469 |
*/ |
|
470 |
|
16
|
471 |
var displayShortcut = Object(external_this_lodash_["mapValues"])(displayShortcutList, function (shortcutList) { |
9
|
472 |
return function (character) { |
|
473 |
var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
474 |
|
|
475 |
return shortcutList(character, _isApple).join(''); |
|
476 |
}; |
|
477 |
}); |
|
478 |
/** |
|
479 |
* An object that contains functions to return an aria label for a keyboard shortcut. |
|
480 |
* E.g. shortcutAriaLabel.primary( '.' ) will return 'Command + Period' on Mac. |
16
|
481 |
* |
|
482 |
* @type {WPKeycodeHandlerByModifier} Keyed map of functions to shortcut ARIA |
|
483 |
* labels. |
9
|
484 |
*/ |
|
485 |
|
16
|
486 |
var shortcutAriaLabel = Object(external_this_lodash_["mapValues"])(modifiers, function (modifier) { |
9
|
487 |
return function (character) { |
|
488 |
var _replacementKeyMap2; |
|
489 |
|
|
490 |
var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
491 |
|
|
492 |
var isApple = _isApple(); |
|
493 |
|
|
494 |
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_this_wp_i18n_["__"])('Comma')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '.', Object(external_this_wp_i18n_["__"])('Period')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '`', Object(external_this_wp_i18n_["__"])('Backtick')), _replacementKeyMap2); |
|
495 |
return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character]).map(function (key) { |
16
|
496 |
return Object(external_this_lodash_["capitalize"])(Object(external_this_lodash_["get"])(replacementKeyMap, key, key)); |
9
|
497 |
}).join(isApple ? ' ' : ' + '); |
|
498 |
}; |
|
499 |
}); |
|
500 |
/** |
16
|
501 |
* From a given KeyboardEvent, returns an array of active modifier constants for |
|
502 |
* the event. |
|
503 |
* |
|
504 |
* @param {KeyboardEvent} event Keyboard event. |
|
505 |
* |
|
506 |
* @return {Array<ALT|CTRL|COMMAND|SHIFT>} Active modifier constants. |
|
507 |
*/ |
|
508 |
|
|
509 |
function getEventModifiers(event) { |
|
510 |
return [ALT, CTRL, COMMAND, SHIFT].filter(function (key) { |
|
511 |
return event["".concat(key, "Key")]; |
|
512 |
}); |
|
513 |
} |
|
514 |
/** |
9
|
515 |
* An object that contains functions to check if a keyboard event matches a |
|
516 |
* predefined shortcut combination. |
|
517 |
* E.g. isKeyboardEvent.primary( event, 'm' ) will return true if the event |
|
518 |
* signals pressing ⌘M. |
|
519 |
* |
16
|
520 |
* @type {WPKeycodeHandlerByModifier} Keyed map of functions to match events. |
9
|
521 |
*/ |
|
522 |
|
16
|
523 |
|
|
524 |
var isKeyboardEvent = Object(external_this_lodash_["mapValues"])(modifiers, function (getModifiers) { |
9
|
525 |
return function (event, character) { |
|
526 |
var _isApple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isAppleOS; |
|
527 |
|
|
528 |
var mods = getModifiers(_isApple); |
16
|
529 |
var eventMods = getEventModifiers(event); |
9
|
530 |
|
16
|
531 |
if (Object(external_this_lodash_["xor"])(mods, eventMods).length) { |
9
|
532 |
return false; |
|
533 |
} |
|
534 |
|
|
535 |
if (!character) { |
16
|
536 |
return Object(external_this_lodash_["includes"])(mods, event.key.toLowerCase()); |
9
|
537 |
} |
|
538 |
|
|
539 |
return event.key === character; |
|
540 |
}; |
|
541 |
}); |
|
542 |
|
|
543 |
|
16
|
544 |
/***/ }), |
|
545 |
|
|
546 |
/***/ 5: |
|
547 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
548 |
|
|
549 |
"use strict"; |
|
550 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
551 |
function _defineProperty(obj, key, value) { |
|
552 |
if (key in obj) { |
|
553 |
Object.defineProperty(obj, key, { |
|
554 |
value: value, |
|
555 |
enumerable: true, |
|
556 |
configurable: true, |
|
557 |
writable: true |
|
558 |
}); |
|
559 |
} else { |
|
560 |
obj[key] = value; |
|
561 |
} |
|
562 |
|
|
563 |
return obj; |
|
564 |
} |
|
565 |
|
9
|
566 |
/***/ }) |
|
567 |
|
|
568 |
/******/ }); |