|
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 = 382); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
|
88 /******/ ({ |
|
89 |
|
90 /***/ 1: |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = this["wp"]["i18n"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ 15: |
|
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
100 "use strict"; |
|
101 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
102 function _defineProperty(obj, key, value) { |
|
103 if (key in obj) { |
|
104 Object.defineProperty(obj, key, { |
|
105 value: value, |
|
106 enumerable: true, |
|
107 configurable: true, |
|
108 writable: true |
|
109 }); |
|
110 } else { |
|
111 obj[key] = value; |
|
112 } |
|
113 |
|
114 return obj; |
|
115 } |
|
116 |
|
117 /***/ }), |
|
118 |
|
119 /***/ 17: |
|
120 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
121 |
|
122 "use strict"; |
|
123 |
|
124 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
125 function _arrayWithoutHoles(arr) { |
|
126 if (Array.isArray(arr)) { |
|
127 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { |
|
128 arr2[i] = arr[i]; |
|
129 } |
|
130 |
|
131 return arr2; |
|
132 } |
|
133 } |
|
134 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
135 var iterableToArray = __webpack_require__(34); |
|
136 |
|
137 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
138 function _nonIterableSpread() { |
|
139 throw new TypeError("Invalid attempt to spread non-iterable instance"); |
|
140 } |
|
141 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
142 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); |
|
143 |
|
144 |
|
145 |
|
146 function _toConsumableArray(arr) { |
|
147 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
148 } |
|
149 |
|
150 /***/ }), |
|
151 |
|
152 /***/ 2: |
|
153 /***/ (function(module, exports) { |
|
154 |
|
155 (function() { module.exports = this["lodash"]; }()); |
|
156 |
|
157 /***/ }), |
|
158 |
|
159 /***/ 34: |
|
160 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
161 |
|
162 "use strict"; |
|
163 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
164 function _iterableToArray(iter) { |
|
165 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
|
166 } |
|
167 |
|
168 /***/ }), |
|
169 |
|
170 /***/ 382: |
|
171 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
172 |
|
173 "use strict"; |
|
174 __webpack_require__.r(__webpack_exports__); |
|
175 |
|
176 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
177 var defineProperty = __webpack_require__(15); |
|
178 |
|
179 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
180 var toConsumableArray = __webpack_require__(17); |
|
181 |
|
182 // EXTERNAL MODULE: external "lodash" |
|
183 var external_lodash_ = __webpack_require__(2); |
|
184 |
|
185 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
186 var external_this_wp_i18n_ = __webpack_require__(1); |
|
187 |
|
188 // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/platform.js |
|
189 /** |
|
190 * External dependencies |
|
191 */ |
|
192 |
|
193 /** |
|
194 * Return true if platform is MacOS. |
|
195 * |
|
196 * @param {Object} _window window object by default; used for DI testing. |
|
197 * |
|
198 * @return {boolean} True if MacOS; false otherwise. |
|
199 */ |
|
200 |
|
201 function isAppleOS() { |
|
202 var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; |
|
203 |
|
204 var platform = _window.navigator.platform; |
|
205 return platform.indexOf('Mac') !== -1 || Object(external_lodash_["includes"])(['iPad', 'iPhone'], platform); |
|
206 } |
|
207 |
|
208 // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/index.js |
|
209 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BACKSPACE", function() { return BACKSPACE; }); |
|
210 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TAB", function() { return TAB; }); |
|
211 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ENTER", function() { return ENTER; }); |
|
212 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ESCAPE", function() { return ESCAPE; }); |
|
213 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPACE", function() { return SPACE; }); |
|
214 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LEFT", function() { return LEFT; }); |
|
215 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UP", function() { return UP; }); |
|
216 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RIGHT", function() { return RIGHT; }); |
|
217 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOWN", function() { return DOWN; }); |
|
218 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DELETE", function() { return DELETE; }); |
|
219 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F10", function() { return F10; }); |
|
220 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ALT", function() { return ALT; }); |
|
221 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CTRL", function() { return CTRL; }); |
|
222 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND", function() { return COMMAND; }); |
|
223 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SHIFT", function() { return SHIFT; }); |
|
224 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "modifiers", function() { return modifiers; }); |
|
225 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rawShortcut", function() { return rawShortcut; }); |
|
226 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayShortcutList", function() { return displayShortcutList; }); |
|
227 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayShortcut", function() { return displayShortcut; }); |
|
228 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shortcutAriaLabel", function() { return shortcutAriaLabel; }); |
|
229 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isKeyboardEvent", function() { return isKeyboardEvent; }); |
|
230 |
|
231 |
|
232 |
|
233 /** |
|
234 * Note: The order of the modifier keys in many of the [foo]Shortcut() |
|
235 * functions in this file are intentional and should not be changed. They're |
|
236 * designed to fit with the standard menu keyboard shortcuts shown in the |
|
237 * user's platform. |
|
238 * |
|
239 * For example, on MacOS menu shortcuts will place Shift before Command, but |
|
240 * on Windows Control will usually come first. So don't provide your own |
|
241 * shortcut combos directly to keyboardShortcut(). |
|
242 */ |
|
243 |
|
244 /** |
|
245 * External dependencies |
|
246 */ |
|
247 |
|
248 /** |
|
249 * WordPress dependencies |
|
250 */ |
|
251 |
|
252 |
|
253 /** |
|
254 * Internal dependencies |
|
255 */ |
|
256 |
|
257 |
|
258 /** |
|
259 * Keycode for BACKSPACE key. |
|
260 */ |
|
261 |
|
262 var BACKSPACE = 8; |
|
263 /** |
|
264 * Keycode for TAB key. |
|
265 */ |
|
266 |
|
267 var TAB = 9; |
|
268 /** |
|
269 * Keycode for ENTER key. |
|
270 */ |
|
271 |
|
272 var ENTER = 13; |
|
273 /** |
|
274 * Keycode for ESCAPE key. |
|
275 */ |
|
276 |
|
277 var ESCAPE = 27; |
|
278 /** |
|
279 * Keycode for SPACE key. |
|
280 */ |
|
281 |
|
282 var SPACE = 32; |
|
283 /** |
|
284 * Keycode for LEFT key. |
|
285 */ |
|
286 |
|
287 var LEFT = 37; |
|
288 /** |
|
289 * Keycode for UP key. |
|
290 */ |
|
291 |
|
292 var UP = 38; |
|
293 /** |
|
294 * Keycode for RIGHT key. |
|
295 */ |
|
296 |
|
297 var RIGHT = 39; |
|
298 /** |
|
299 * Keycode for DOWN key. |
|
300 */ |
|
301 |
|
302 var DOWN = 40; |
|
303 /** |
|
304 * Keycode for DELETE key. |
|
305 */ |
|
306 |
|
307 var DELETE = 46; |
|
308 /** |
|
309 * Keycode for F10 key. |
|
310 */ |
|
311 |
|
312 var F10 = 121; |
|
313 /** |
|
314 * Keycode for ALT key. |
|
315 */ |
|
316 |
|
317 var ALT = 'alt'; |
|
318 /** |
|
319 * Keycode for CTRL key. |
|
320 */ |
|
321 |
|
322 var CTRL = 'ctrl'; |
|
323 /** |
|
324 * Keycode for COMMAND/META key. |
|
325 */ |
|
326 |
|
327 var COMMAND = 'meta'; |
|
328 /** |
|
329 * Keycode for SHIFT key. |
|
330 */ |
|
331 |
|
332 var SHIFT = 'shift'; |
|
333 /** |
|
334 * Object that contains functions that return the available modifier |
|
335 * depending on platform. |
|
336 * |
|
337 * - `primary`: takes a isApple function as a parameter. |
|
338 * - `primaryShift`: takes a isApple function as a parameter. |
|
339 * - `primaryAlt`: takes a isApple function as a parameter. |
|
340 * - `secondary`: takes a isApple function as a parameter. |
|
341 * - `access`: takes a isApple function as a parameter. |
|
342 * - `ctrl` |
|
343 * - `alt` |
|
344 * - `ctrlShift` |
|
345 * - `shift` |
|
346 * - `shiftAlt` |
|
347 */ |
|
348 |
|
349 var modifiers = { |
|
350 primary: function primary(_isApple) { |
|
351 return _isApple() ? [COMMAND] : [CTRL]; |
|
352 }, |
|
353 primaryShift: function primaryShift(_isApple) { |
|
354 return _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT]; |
|
355 }, |
|
356 primaryAlt: function primaryAlt(_isApple) { |
|
357 return _isApple() ? [ALT, COMMAND] : [CTRL, ALT]; |
|
358 }, |
|
359 secondary: function secondary(_isApple) { |
|
360 return _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT]; |
|
361 }, |
|
362 access: function access(_isApple) { |
|
363 return _isApple() ? [CTRL, ALT] : [SHIFT, ALT]; |
|
364 }, |
|
365 ctrl: function ctrl() { |
|
366 return [CTRL]; |
|
367 }, |
|
368 alt: function alt() { |
|
369 return [ALT]; |
|
370 }, |
|
371 ctrlShift: function ctrlShift() { |
|
372 return [CTRL, SHIFT]; |
|
373 }, |
|
374 shift: function shift() { |
|
375 return [SHIFT]; |
|
376 }, |
|
377 shiftAlt: function shiftAlt() { |
|
378 return [SHIFT, ALT]; |
|
379 } |
|
380 }; |
|
381 /** |
|
382 * An object that contains functions to get raw shortcuts. |
|
383 * E.g. rawShortcut.primary( 'm' ) will return 'meta+m' on Mac. |
|
384 * These are intended for user with the KeyboardShortcuts component or TinyMCE. |
|
385 * |
|
386 * @type {Object} Keyed map of functions to raw shortcuts. |
|
387 */ |
|
388 |
|
389 var rawShortcut = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { |
|
390 return function (character) { |
|
391 var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
392 |
|
393 return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character.toLowerCase()]).join('+'); |
|
394 }; |
|
395 }); |
|
396 /** |
|
397 * Return an array of the parts of a keyboard shortcut chord for display |
|
398 * E.g displayShortcutList.primary( 'm' ) will return [ '⌘', 'M' ] on Mac. |
|
399 * |
|
400 * @type {Object} keyed map of functions to shortcut sequences |
|
401 */ |
|
402 |
|
403 var displayShortcutList = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { |
|
404 return function (character) { |
|
405 var _replacementKeyMap; |
|
406 |
|
407 var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
408 |
|
409 var isApple = _isApple(); |
|
410 |
|
411 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); |
|
412 var modifierKeys = modifier(_isApple).reduce(function (accumulator, key) { |
|
413 var replacementKey = Object(external_lodash_["get"])(replacementKeyMap, key, key); // If on the Mac, adhere to platform convention and don't show plus between keys. |
|
414 |
|
415 if (isApple) { |
|
416 return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey]); |
|
417 } |
|
418 |
|
419 return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey, '+']); |
|
420 }, []); |
|
421 var capitalizedCharacter = Object(external_lodash_["capitalize"])(character); |
|
422 return [].concat(Object(toConsumableArray["a" /* default */])(modifierKeys), [capitalizedCharacter]); |
|
423 }; |
|
424 }); |
|
425 /** |
|
426 * An object that contains functions to display shortcuts. |
|
427 * E.g. displayShortcut.primary( 'm' ) will return '⌘M' on Mac. |
|
428 * |
|
429 * @type {Object} Keyed map of functions to display shortcuts. |
|
430 */ |
|
431 |
|
432 var displayShortcut = Object(external_lodash_["mapValues"])(displayShortcutList, function (shortcutList) { |
|
433 return function (character) { |
|
434 var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
435 |
|
436 return shortcutList(character, _isApple).join(''); |
|
437 }; |
|
438 }); |
|
439 /** |
|
440 * An object that contains functions to return an aria label for a keyboard shortcut. |
|
441 * E.g. shortcutAriaLabel.primary( '.' ) will return 'Command + Period' on Mac. |
|
442 */ |
|
443 |
|
444 var shortcutAriaLabel = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { |
|
445 return function (character) { |
|
446 var _replacementKeyMap2; |
|
447 |
|
448 var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; |
|
449 |
|
450 var isApple = _isApple(); |
|
451 |
|
452 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); |
|
453 return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character]).map(function (key) { |
|
454 return Object(external_lodash_["capitalize"])(Object(external_lodash_["get"])(replacementKeyMap, key, key)); |
|
455 }).join(isApple ? ' ' : ' + '); |
|
456 }; |
|
457 }); |
|
458 /** |
|
459 * An object that contains functions to check if a keyboard event matches a |
|
460 * predefined shortcut combination. |
|
461 * E.g. isKeyboardEvent.primary( event, 'm' ) will return true if the event |
|
462 * signals pressing ⌘M. |
|
463 * |
|
464 * @type {Object} Keyed map of functions to match events. |
|
465 */ |
|
466 |
|
467 var isKeyboardEvent = Object(external_lodash_["mapValues"])(modifiers, function (getModifiers) { |
|
468 return function (event, character) { |
|
469 var _isApple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isAppleOS; |
|
470 |
|
471 var mods = getModifiers(_isApple); |
|
472 |
|
473 if (!mods.every(function (key) { |
|
474 return event["".concat(key, "Key")]; |
|
475 })) { |
|
476 return false; |
|
477 } |
|
478 |
|
479 if (!character) { |
|
480 return Object(external_lodash_["includes"])(mods, event.key.toLowerCase()); |
|
481 } |
|
482 |
|
483 return event.key === character; |
|
484 }; |
|
485 }); |
|
486 |
|
487 |
|
488 /***/ }) |
|
489 |
|
490 /******/ }); |