2022-04-11 14:04:30 +02:00
/******/ ( function ( ) { // webpackBootstrap
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ ! function ( ) {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , definition ) {
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ! function ( ) {
/******/ _ _webpack _require _ _ . o = function ( obj , prop ) { return Object . prototype . hasOwnProperty . call ( obj , prop ) ; }
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ ! function ( ) {
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
2018-12-14 05:41:57 +01:00
/******/ } ;
2022-04-11 14:04:30 +02:00
/******/ } ( ) ;
/******/
2018-12-14 05:41:57 +01:00
/************************************************************************/
2022-04-11 14:04:30 +02:00
var _ _webpack _exports _ _ = { } ;
2020-06-29 13:50:29 +02:00
// ESM COMPAT FLAG
2018-12-14 05:41:57 +01:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2018-12-18 04:14:52 +01:00
2020-06-29 13:50:29 +02:00
// EXPORTS
2022-04-11 14:04:30 +02:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"ALT" : function ( ) { return /* binding */ ALT ; } ,
"BACKSPACE" : function ( ) { return /* binding */ BACKSPACE ; } ,
"COMMAND" : function ( ) { return /* binding */ COMMAND ; } ,
"CTRL" : function ( ) { return /* binding */ CTRL ; } ,
"DELETE" : function ( ) { return /* binding */ DELETE ; } ,
"DOWN" : function ( ) { return /* binding */ DOWN ; } ,
"END" : function ( ) { return /* binding */ END ; } ,
"ENTER" : function ( ) { return /* binding */ ENTER ; } ,
"ESCAPE" : function ( ) { return /* binding */ ESCAPE ; } ,
"F10" : function ( ) { return /* binding */ F10 ; } ,
"HOME" : function ( ) { return /* binding */ HOME ; } ,
"LEFT" : function ( ) { return /* binding */ LEFT ; } ,
"PAGEDOWN" : function ( ) { return /* binding */ PAGEDOWN ; } ,
"PAGEUP" : function ( ) { return /* binding */ PAGEUP ; } ,
"RIGHT" : function ( ) { return /* binding */ RIGHT ; } ,
"SHIFT" : function ( ) { return /* binding */ SHIFT ; } ,
"SPACE" : function ( ) { return /* binding */ SPACE ; } ,
"TAB" : function ( ) { return /* binding */ TAB ; } ,
"UP" : function ( ) { return /* binding */ UP ; } ,
"ZERO" : function ( ) { return /* binding */ ZERO ; } ,
"displayShortcut" : function ( ) { return /* binding */ displayShortcut ; } ,
"displayShortcutList" : function ( ) { return /* binding */ displayShortcutList ; } ,
"isKeyboardEvent" : function ( ) { return /* binding */ isKeyboardEvent ; } ,
"modifiers" : function ( ) { return /* binding */ modifiers ; } ,
"rawShortcut" : function ( ) { return /* binding */ rawShortcut ; } ,
"shortcutAriaLabel" : function ( ) { return /* binding */ shortcutAriaLabel ; }
} ) ;
; // CONCATENATED MODULE: external "lodash"
var external _lodash _namespaceObject = window [ "lodash" ] ;
; // CONCATENATED MODULE: external ["wp","i18n"]
var external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/platform.js
2018-12-18 04:14:52 +01:00
/ * *
* External dependencies
* /
/ * *
* Return true if platform is MacOS .
*
2021-04-15 17:19:43 +02:00
* @ param { Window ? } _window window object by default ; used for DI testing .
2018-12-18 04:14:52 +01:00
*
2021-01-28 03:04:13 +01:00
* @ return { boolean } True if MacOS ; false otherwise .
2018-12-18 04:14:52 +01:00
* /
2021-11-15 13:50:17 +01:00
function isAppleOS ( ) {
let _window = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : null ;
2021-04-15 17:19:43 +02:00
if ( ! _window ) {
if ( typeof window === 'undefined' ) {
return false ;
}
_window = window ;
}
2018-12-18 04:14:52 +01:00
2021-05-19 17:09:27 +02:00
const {
platform
} = _window . navigator ;
2022-04-11 14:04:30 +02:00
return platform . indexOf ( 'Mac' ) !== - 1 || ( 0 , external _lodash _namespaceObject . includes ) ( [ 'iPad' , 'iPhone' ] , platform ) ;
2018-12-18 04:14:52 +01:00
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/keycodes/build-module/index.js
2018-12-14 05:41:57 +01:00
/ * *
* Note : The order of the modifier keys in many of the [ foo ] Shortcut ( )
* functions in this file are intentional and should not be changed . They ' re
* designed to fit with the standard menu keyboard shortcuts shown in the
* user ' s platform .
*
* For example , on MacOS menu shortcuts will place Shift before Command , but
* on Windows Control will usually come first . So don ' t provide your own
* shortcut combos directly to keyboardShortcut ( ) .
* /
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
2021-01-28 03:04:13 +01:00
/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
2021-11-08 15:29:21 +01:00
/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */
2020-01-22 23:06:21 +01:00
/ * *
* An object of handler functions for each of the possible modifier
* combinations . A handler will return a value for a given key .
*
2021-01-28 03:04:13 +01:00
* @ template T
*
* @ typedef { Record < WPKeycodeModifier , T > } WPModifierHandler
* /
/ * *
* @ template T
*
* @ typedef { ( character : string , isApple ? : ( ) => boolean ) => T } WPKeyHandler
2020-01-22 23:06:21 +01:00
* /
2021-01-28 03:04:13 +01:00
/** @typedef {(event: KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for BACKSPACE key .
* /
2021-05-19 17:09:27 +02:00
const BACKSPACE = 8 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for TAB key .
* /
2021-05-19 17:09:27 +02:00
const TAB = 9 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for ENTER key .
* /
2021-05-19 17:09:27 +02:00
const ENTER = 13 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for ESCAPE key .
* /
2021-05-19 17:09:27 +02:00
const ESCAPE = 27 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for SPACE key .
* /
2021-05-19 17:09:27 +02:00
const SPACE = 32 ;
2021-11-08 15:29:21 +01:00
/ * *
* Keycode for PAGEUP key .
* /
const PAGEUP = 33 ;
/ * *
* Keycode for PAGEDOWN key .
* /
const PAGEDOWN = 34 ;
/ * *
* Keycode for END key .
* /
const END = 35 ;
/ * *
* Keycode for HOME key .
* /
const HOME = 36 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for LEFT key .
* /
2021-05-19 17:09:27 +02:00
const LEFT = 37 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for UP key .
* /
2021-05-19 17:09:27 +02:00
const UP = 38 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for RIGHT key .
* /
2021-05-19 17:09:27 +02:00
const RIGHT = 39 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for DOWN key .
* /
2021-05-19 17:09:27 +02:00
const DOWN = 40 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for DELETE key .
* /
2021-05-19 17:09:27 +02:00
const DELETE = 46 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for F10 key .
* /
2021-05-19 17:09:27 +02:00
const F10 = 121 ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for ALT key .
* /
2021-05-19 17:09:27 +02:00
const ALT = 'alt' ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for CTRL key .
* /
2021-05-19 17:09:27 +02:00
const CTRL = 'ctrl' ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for COMMAND / META key .
* /
2021-05-19 17:09:27 +02:00
const COMMAND = 'meta' ;
2019-03-21 13:48:00 +01:00
/ * *
* Keycode for SHIFT key .
* /
2021-05-19 17:09:27 +02:00
const SHIFT = 'shift' ;
2020-06-26 15:33:47 +02:00
/ * *
* Keycode for ZERO key .
* /
2021-05-19 17:09:27 +02:00
const ZERO = 48 ;
2019-03-21 13:48:00 +01:00
/ * *
* Object that contains functions that return the available modifier
* depending on platform .
*
2021-01-28 03:04:13 +01:00
* @ type { WPModifierHandler < ( isApple : ( ) => boolean ) => WPModifierPart [ ] > }
2019-03-21 13:48:00 +01:00
* /
2021-05-19 17:09:27 +02:00
const modifiers = {
primary : _isApple => _isApple ( ) ? [ COMMAND ] : [ CTRL ] ,
primaryShift : _isApple => _isApple ( ) ? [ SHIFT , COMMAND ] : [ CTRL , SHIFT ] ,
primaryAlt : _isApple => _isApple ( ) ? [ ALT , COMMAND ] : [ CTRL , ALT ] ,
secondary : _isApple => _isApple ( ) ? [ SHIFT , ALT , COMMAND ] : [ CTRL , SHIFT , ALT ] ,
access : _isApple => _isApple ( ) ? [ CTRL , ALT ] : [ SHIFT , ALT ] ,
ctrl : ( ) => [ CTRL ] ,
alt : ( ) => [ ALT ] ,
ctrlShift : ( ) => [ CTRL , SHIFT ] ,
shift : ( ) => [ SHIFT ] ,
2021-11-08 15:29:21 +01:00
shiftAlt : ( ) => [ SHIFT , ALT ] ,
undefined : ( ) => [ ]
2018-12-14 05:41:57 +01:00
} ;
/ * *
* An object that contains functions to get raw shortcuts .
*
2021-01-28 03:04:13 +01:00
* These are intended for user with the KeyboardShortcuts .
*
* @ example
* ` ` ` js
* // Assuming macOS:
* rawShortcut . primary ( 'm' )
* // "meta+m""
* ` ` `
*
* @ type { WPModifierHandler < WPKeyHandler < string >> } Keyed map of functions to raw
* shortcuts .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const rawShortcut = ( 0 , external _lodash _namespaceObject . mapValues ) ( modifiers , modifier => {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPKeyHandler<string>} */
2021-11-15 13:50:17 +01:00
function ( character ) {
let _isApple = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isAppleOS ;
2021-05-19 17:09:27 +02:00
return [ ... modifier ( _isApple ) , character . toLowerCase ( ) ] . join ( '+' ) ;
2021-01-28 03:04:13 +01:00
}
) ;
2018-12-14 05:41:57 +01:00
} ) ;
/ * *
2021-01-28 03:04:13 +01:00
* Return an array of the parts of a keyboard shortcut chord for display .
2018-12-14 05:41:57 +01:00
*
2021-01-28 03:04:13 +01:00
* @ example
* ` ` ` js
* // Assuming macOS:
* displayShortcutList . primary ( 'm' ) ;
* // [ "⌘", "M" ]
* ` ` `
*
* @ type { WPModifierHandler < WPKeyHandler < string [ ] >> } Keyed map of functions to
* shortcut sequences .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const displayShortcutList = ( 0 , external _lodash _namespaceObject . mapValues ) ( modifiers , modifier => {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPKeyHandler<string[]>} */
2021-11-15 13:50:17 +01:00
function ( character ) {
let _isApple = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isAppleOS ;
2021-05-19 17:09:27 +02:00
const isApple = _isApple ( ) ;
const replacementKeyMap = {
[ ALT ] : isApple ? '⌥' : 'Alt' ,
[ CTRL ] : isApple ? '⌃' : 'Ctrl' ,
// Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.
[ COMMAND ] : '⌘' ,
[ SHIFT ] : isApple ? '⇧' : 'Shift'
} ;
const modifierKeys = modifier ( _isApple ) . reduce ( ( accumulator , key ) => {
2022-04-11 14:04:30 +02:00
const replacementKey = ( 0 , external _lodash _namespaceObject . get ) ( replacementKeyMap , key , key ) ; // If on the Mac, adhere to platform convention and don't show plus between keys.
2018-12-14 05:41:57 +01:00
2021-01-28 03:04:13 +01:00
if ( isApple ) {
2021-05-19 17:09:27 +02:00
return [ ... accumulator , replacementKey ] ;
2021-01-28 03:04:13 +01:00
}
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
return [ ... accumulator , replacementKey , '+' ] ;
2021-01-28 03:04:13 +01:00
} ,
/** @type {string[]} */
[ ] ) ;
2022-04-11 14:04:30 +02:00
const capitalizedCharacter = ( 0 , external _lodash _namespaceObject . capitalize ) ( character ) ;
2021-05-19 17:09:27 +02:00
return [ ... modifierKeys , capitalizedCharacter ] ;
2021-01-28 03:04:13 +01:00
}
) ;
2018-12-14 05:41:57 +01:00
} ) ;
/ * *
* An object that contains functions to display shortcuts .
*
2021-01-28 03:04:13 +01:00
* @ example
* ` ` ` js
* // Assuming macOS:
* displayShortcut . primary ( 'm' ) ;
* // "⌘M"
* ` ` `
*
* @ type { WPModifierHandler < WPKeyHandler < string >> } Keyed map of functions to
* display shortcuts .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const displayShortcut = ( 0 , external _lodash _namespaceObject . mapValues ) ( displayShortcutList , shortcutList => {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPKeyHandler<string>} */
2021-11-15 13:50:17 +01:00
function ( character ) {
let _isApple = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isAppleOS ;
return shortcutList ( character , _isApple ) . join ( '' ) ;
}
2021-01-28 03:04:13 +01:00
) ;
2018-12-14 05:41:57 +01:00
} ) ;
/ * *
2021-01-28 03:04:13 +01:00
* An object that contains functions to return an aria label for a keyboard
* shortcut .
*
* @ example
* ` ` ` js
* // Assuming macOS:
* shortcutAriaLabel . primary ( '.' ) ;
* // "Command + Period"
* ` ` `
2020-01-22 23:06:21 +01:00
*
2021-01-28 03:04:13 +01:00
* @ type { WPModifierHandler < WPKeyHandler < string >> } Keyed map of functions to
* shortcut ARIA labels .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const shortcutAriaLabel = ( 0 , external _lodash _namespaceObject . mapValues ) ( modifiers , modifier => {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPKeyHandler<string>} */
2021-11-15 13:50:17 +01:00
function ( character ) {
let _isApple = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isAppleOS ;
2021-05-19 17:09:27 +02:00
const isApple = _isApple ( ) ;
const replacementKeyMap = {
[ SHIFT ] : 'Shift' ,
[ COMMAND ] : isApple ? 'Command' : 'Control' ,
[ CTRL ] : 'Control' ,
[ ALT ] : isApple ? 'Option' : 'Alt' ,
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
/* translators: comma as in the character ',' */
2022-04-11 14:04:30 +02:00
',' : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Comma' ) ,
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
/* translators: period as in the character '.' */
2022-04-11 14:04:30 +02:00
'.' : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Period' ) ,
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
/* translators: backtick as in the character '`' */
2022-04-11 14:04:30 +02:00
'`' : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Backtick' )
2021-05-19 17:09:27 +02:00
} ;
2022-04-11 14:04:30 +02:00
return [ ... modifier ( _isApple ) , character ] . map ( key => ( 0 , external _lodash _namespaceObject . capitalize ) ( ( 0 , external _lodash _namespaceObject . get ) ( replacementKeyMap , key , key ) ) ) . join ( isApple ? ' ' : ' + ' ) ;
2021-01-28 03:04:13 +01:00
}
) ;
2018-12-14 05:41:57 +01:00
} ) ;
2020-06-26 15:33:47 +02:00
/ * *
* From a given KeyboardEvent , returns an array of active modifier constants for
* the event .
*
* @ param { KeyboardEvent } event Keyboard event .
*
2021-01-28 03:04:13 +01:00
* @ return { Array < WPModifierPart > } Active modifier constants .
2020-06-26 15:33:47 +02:00
* /
function getEventModifiers ( event ) {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPModifierPart[]} */
2021-05-19 17:09:27 +02:00
[ ALT , CTRL , COMMAND , SHIFT ] . filter ( key => event [
/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
` ${ key } Key ` ] )
2021-01-28 03:04:13 +01:00
) ;
2020-06-26 15:33:47 +02:00
}
2018-12-14 05:41:57 +01:00
/ * *
* An object that contains functions to check if a keyboard event matches a
* predefined shortcut combination .
*
2021-01-28 03:04:13 +01:00
* @ example
* ` ` ` js
* // Assuming an event for ⌘M key press:
* isKeyboardEvent . primary ( event , 'm' ) ;
* // true
* ` ` `
*
* @ type { WPModifierHandler < WPEventKeyHandler > } Keyed map of functions
* to match events .
2018-12-14 05:41:57 +01:00
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const isKeyboardEvent = ( 0 , external _lodash _namespaceObject . mapValues ) ( modifiers , getModifiers => {
2021-01-28 03:04:13 +01:00
return (
/** @type {WPEventKeyHandler} */
2021-11-15 13:50:17 +01:00
function ( event , character ) {
let _isApple = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : isAppleOS ;
2021-05-19 17:09:27 +02:00
const mods = getModifiers ( _isApple ) ;
const eventMods = getEventModifiers ( event ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ( 0 , external _lodash _namespaceObject . xor ) ( mods , eventMods ) . length ) {
2021-01-28 03:04:13 +01:00
return false ;
}
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
let key = event . key . toLowerCase ( ) ;
2021-01-28 03:04:13 +01:00
if ( ! character ) {
2022-04-11 14:04:30 +02:00
return ( 0 , external _lodash _namespaceObject . includes ) ( mods , key ) ;
2021-11-08 15:29:21 +01:00
}
if ( event . altKey && character . length === 1 ) {
key = String . fromCharCode ( event . keyCode ) . toLowerCase ( ) ;
} // For backwards compatibility.
if ( character === 'del' ) {
character = 'delete' ;
2021-01-28 03:04:13 +01:00
}
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
return key === character . toLowerCase ( ) ;
2021-01-28 03:04:13 +01:00
}
) ;
2018-12-14 05:41:57 +01:00
} ) ;
2022-04-11 14:04:30 +02:00
( window . wp = window . wp || { } ) . keycodes = _ _webpack _exports _ _ ;
/******/ } ) ( )
;