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