@wordpress/keyboard-shortcuts 5.13.0 → 5.13.1-next.cd6172eb0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_context","_jsxRuntime","Provider","context","ShortcutProvider","props","keyboardShortcuts","useState","Set","onKeyDown","event","keyboardShortcut","jsx","value","children"],"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n * Adding a provider allows to register contextual shortcuts\n * that are only active when a certain part of the UI is focused.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {Element} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst [ keyboardShortcuts ] = useState( () => new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) {\n\t\t\tprops.onKeyDown( event );\n\t\t}\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAAqC,IAAAE,WAAA,GAAAF,OAAA;AARrC;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEG;AAAS,CAAC,GAAGC,gBAAO;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAEC,KAAK,EAAG;EACzC,MAAM,CAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,MAAM,IAAIC,GAAG,CAAC,CAAE,CAAC;EAEzD,SAASC,SAASA,CAAEC,KAAK,EAAG;IAC3B,IAAKL,KAAK,CAACI,SAAS,EAAG;MACtBJ,KAAK,CAACI,SAAS,CAAEC,KAAM,CAAC;IACzB;IAEA,KAAM,MAAMC,gBAAgB,IAAIL,iBAAiB,EAAG;MACnDK,gBAAgB,CAAED,KAAM,CAAC;IAC1B;EACD;;EAEA;EACA,oBACC,IAAAT,WAAA,CAAAW,GAAA,EAACV,QAAQ;IAACW,KAAK,EAAGP,iBAAmB;IAAAQ,QAAA,eACpC,IAAAb,WAAA,CAAAW,GAAA;MAAA,GAAUP,KAAK;MAAGI,SAAS,EAAGA;IAAW,CAAE;EAAC,CACnC,CAAC;EAEZ;AACD","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_context","_jsxRuntime","Provider","context","ShortcutProvider","props","keyboardShortcuts","useState","Set","onKeyDown","event","keyboardShortcut","jsx","value","children"],"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n * Adding a provider allows to register contextual shortcuts\n * that are only active when a certain part of the UI is focused.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {Element} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst [ keyboardShortcuts ] = useState( () => new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) {\n\t\t\tprops.onKeyDown( event );\n\t\t}\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAAqC,IAAAE,WAAA,GAAAF,OAAA;AARrC;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEG;AAAS,CAAC,GAAGC,gBAAO;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAEC,KAAK,EAAG;EACzC,MAAM,CAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,MAAM,IAAIC,GAAG,CAAC,CAAE,CAAC;EAEzD,SAASC,SAASA,CAAEC,KAAK,EAAG;IAC3B,IAAKL,KAAK,CAACI,SAAS,EAAG;MACtBJ,KAAK,CAACI,SAAS,CAAEC,KAAM,CAAC;IACzB;IAEA,KAAM,MAAMC,gBAAgB,IAAIL,iBAAiB,EAAG;MACnDK,gBAAgB,CAAED,KAAM,CAAC;IAC1B;EACD;;EAEA;EACA,oBACC,IAAAT,WAAA,CAAAW,GAAA,EAACV,QAAQ;IAACW,KAAK,EAAGP,iBAAmB;IAAAQ,QAAA,eACpC,IAAAb,WAAA,CAAAW,GAAA;MAAA,GAAUP,KAAK;MAAGI,SAAS,EAAGA;IAAW,CAAE;EAAC,CACnC,CAAC;EAEZ;AACD","ignoreList":[]}
package/build/context.js CHANGED
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","globalShortcuts","Set","globalListener","event","keyboardShortcut","context","exports","createContext","add","shortcut","size","document","addEventListener","delete","removeEventListener"],"sources":["@wordpress/keyboard-shortcuts/src/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst globalShortcuts = new Set();\nconst globalListener = ( event ) => {\n\tfor ( const keyboardShortcut of globalShortcuts ) {\n\t\tkeyboardShortcut( event );\n\t}\n};\n\nexport const context = createContext( {\n\tadd: ( shortcut ) => {\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.addEventListener( 'keydown', globalListener );\n\t\t}\n\t\tglobalShortcuts.add( shortcut );\n\t},\n\tdelete: ( shortcut ) => {\n\t\tglobalShortcuts.delete( shortcut );\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.removeEventListener( 'keydown', globalListener );\n\t\t}\n\t},\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AACjC,MAAMC,cAAc,GAAKC,KAAK,IAAM;EACnC,KAAM,MAAMC,gBAAgB,IAAIJ,eAAe,EAAG;IACjDI,gBAAgB,CAAED,KAAM,CAAC;EAC1B;AACD,CAAC;AAEM,MAAME,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,IAAAE,sBAAa,EAAE;EACrCC,GAAG,EAAIC,QAAQ,IAAM;IACpB,IAAKT,eAAe,CAACU,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACC,gBAAgB,CAAE,SAAS,EAAEV,cAAe,CAAC;IACvD;IACAF,eAAe,CAACQ,GAAG,CAAEC,QAAS,CAAC;EAChC,CAAC;EACDI,MAAM,EAAIJ,QAAQ,IAAM;IACvBT,eAAe,CAACa,MAAM,CAAEJ,QAAS,CAAC;IAClC,IAAKT,eAAe,CAACU,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACG,mBAAmB,CAAE,SAAS,EAAEZ,cAAe,CAAC;IAC1D;EACD;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","globalShortcuts","Set","globalListener","event","keyboardShortcut","context","exports","createContext","add","shortcut","size","document","addEventListener","delete","removeEventListener"],"sources":["@wordpress/keyboard-shortcuts/src/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst globalShortcuts = new Set();\nconst globalListener = ( event ) => {\n\tfor ( const keyboardShortcut of globalShortcuts ) {\n\t\tkeyboardShortcut( event );\n\t}\n};\n\nexport const context = createContext( {\n\tadd: ( shortcut ) => {\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.addEventListener( 'keydown', globalListener );\n\t\t}\n\t\tglobalShortcuts.add( shortcut );\n\t},\n\tdelete: ( shortcut ) => {\n\t\tglobalShortcuts.delete( shortcut );\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.removeEventListener( 'keydown', globalListener );\n\t\t}\n\t},\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AACjC,MAAMC,cAAc,GAAKC,KAAK,IAAM;EACnC,KAAM,MAAMC,gBAAgB,IAAIJ,eAAe,EAAG;IACjDI,gBAAgB,CAAED,KAAM,CAAC;EAC1B;AACD,CAAC;AAEM,MAAME,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,IAAAE,sBAAa,EAAE;EACrCC,GAAG,EAAIC,QAAQ,IAAM;IACpB,IAAKT,eAAe,CAACU,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACC,gBAAgB,CAAE,SAAS,EAAEV,cAAe,CAAC;IACvD;IACAF,eAAe,CAACQ,GAAG,CAAEC,QAAS,CAAC;EAChC,CAAC;EACDI,MAAM,EAAIJ,QAAQ,IAAM;IACvBT,eAAe,CAACa,MAAM,CAAEJ,QAAS,CAAC;IAClC,IAAKT,eAAe,CAACU,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACG,mBAAmB,CAAE,SAAS,EAAEZ,cAAe,CAAC;IAC1D;EACD;AACD,CAAE,CAAC","ignoreList":[]}
@@ -46,7 +46,7 @@ const FORMATTING_METHODS = {
46
46
  * @param {keyof FORMATTING_METHODS} representation Type of representation
47
47
  * (display, raw, ariaLabel).
48
48
  *
49
- * @return {string?} Shortcut representation.
49
+ * @return {?string} Shortcut representation.
50
50
  */
51
51
  function getKeyCombinationRepresentation(shortcut, representation) {
52
52
  if (!shortcut) {
@@ -136,7 +136,7 @@ function getShortcutKeyCombination(state, name) {
136
136
  * };
137
137
  *```
138
138
  *
139
- * @return {string?} Shortcut representation.
139
+ * @return {?string} Shortcut representation.
140
140
  */
141
141
  function getShortcutRepresentation(state, name, representation = 'display') {
142
142
  const shortcut = getShortcutKeyCombination(state, name);
@@ -169,7 +169,7 @@ function getShortcutRepresentation(state, name, representation = 'display') {
169
169
  * );
170
170
  * };
171
171
  *```
172
- * @return {string?} Shortcut description.
172
+ * @return {?string} Shortcut description.
173
173
  */
174
174
  function getShortcutDescription(state, name) {
175
175
  return state[name] ? state[name].description : null;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_keycodes","EMPTY_ARRAY","FORMATTING_METHODS","display","displayShortcut","raw","rawShortcut","ariaLabel","shortcutAriaLabel","getKeyCombinationRepresentation","shortcut","representation","modifier","character","getShortcutKeyCombination","state","name","keyCombination","getShortcutRepresentation","getShortcutDescription","description","getShortcutAliases","aliases","getAllShortcutKeyCombinations","exports","createSelector","filter","Boolean","getAllShortcutRawKeyCombinations","map","combination","getCategoryShortcuts","categoryName","Object","entries","category"],"sources":["@wordpress/keyboard-shortcuts/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\nimport {\n\tdisplayShortcut,\n\tshortcutAriaLabel,\n\trawShortcut,\n} from '@wordpress/keycodes';\n\n/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */\n\n/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Shortcut formatting methods.\n *\n * @property {WPKeycodeHandlerByModifier} display Display formatting.\n * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.\n * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.\n */\nconst FORMATTING_METHODS = {\n\tdisplay: displayShortcut,\n\traw: rawShortcut,\n\tariaLabel: shortcutAriaLabel,\n};\n\n/**\n * Returns a string representing the key combination.\n *\n * @param {?WPShortcutKeyCombination} shortcut Key combination.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n *\n * @return {string?} Shortcut representation.\n */\nfunction getKeyCombinationRepresentation( shortcut, representation ) {\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\treturn shortcut.modifier\n\t\t? FORMATTING_METHODS[ representation ][ shortcut.modifier ](\n\t\t\t\tshortcut.character\n\t\t )\n\t\t: shortcut.character;\n}\n\n/**\n * Returns the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const {character, modifier} = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutKeyCombination(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * <div>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </div>\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination?} Key combination.\n */\nexport function getShortcutKeyCombination( state, name ) {\n\treturn state[ name ] ? state[ name ].keyCombination : null;\n}\n\n/**\n * Returns a string representing the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const {display, raw, ariaLabel} = useSelect(\n * ( select ) =>{\n * return {\n * display: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region' ),\n * raw: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region','raw' ),\n * ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region', 'ariaLabel')\n * }\n * },\n * []\n * );\n *\n * return (\n * <ul>\n * <li>{ sprintf( 'display string: %s', display ) }</li>\n * <li>{ sprintf( 'raw string: %s', raw ) }</li>\n * <li>{ sprintf( 'ariaLabel string: %s', ariaLabel ) }</li>\n * </ul>\n * );\n * };\n *```\n *\n * @return {string?} Shortcut representation.\n */\nexport function getShortcutRepresentation(\n\tstate,\n\tname,\n\trepresentation = 'display'\n) {\n\tconst shortcut = getShortcutKeyCombination( state, name );\n\treturn getKeyCombinationRepresentation( shortcut, representation );\n}\n\n/**\n * Returns the shortcut description given its name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutDescription = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutDescription( 'core/editor/next-region' ),\n * []\n * );\n *\n * return shortcutDescription ? (\n * <div>{ shortcutDescription }</div>\n * ) : (\n * <div>{ __( 'No description.' ) }</div>\n * );\n * };\n *```\n * @return {string?} Shortcut description.\n */\nexport function getShortcutDescription( state, name ) {\n\treturn state[ name ] ? state[ name ].description : null;\n}\n\n/**\n * Returns the aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutAliases = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutAliases(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * shortcutAliases.length > 0 && (\n * <ul>\n * { shortcutAliases.map( ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport function getShortcutAliases( state, name ) {\n\treturn state[ name ] && state[ name ].aliases\n\t\t? state[ name ].aliases\n\t\t: EMPTY_ARRAY;\n}\n\n/**\n * Returns the shortcuts that include aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutKeyCombinations.map(\n * ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport const getAllShortcutKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn [\n\t\t\tgetShortcutKeyCombination( state, name ),\n\t\t\t...getShortcutAliases( state, name ),\n\t\t].filter( Boolean );\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the raw representation of all the keyboard combinations of a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutRawKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutRawKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutRawKeyCombinations.map(\n * ( shortcutRawKeyCombination, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * ' <code>%s</code>',\n * shortcutRawKeyCombination\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {string[]} Shortcuts.\n */\nexport const getAllShortcutRawKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn getAllShortcutKeyCombinations( state, name ).map(\n\t\t\t( combination ) =>\n\t\t\t\tgetKeyCombinationRepresentation( combination, 'raw' )\n\t\t);\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the shortcut names list for a given category name.\n *\n * @param {Object} state Global state.\n * @param {string} name Category name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const categoryShortcuts = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getCategoryShortcuts(\n * 'block'\n * ),\n * []\n * );\n *\n * return (\n * categoryShortcuts.length > 0 && (\n * <ul>\n * { categoryShortcuts.map( ( categoryShortcut ) => (\n * <li key={ categoryShortcut }>{ categoryShortcut }</li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n * @return {string[]} Shortcut names.\n */\nexport const getCategoryShortcuts = createSelector(\n\t( state, categoryName ) => {\n\t\treturn Object.entries( state )\n\t\t\t.filter( ( [ , shortcut ] ) => shortcut.category === categoryName )\n\t\t\t.map( ( [ name ] ) => name );\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAQA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;EAC1BC,OAAO,EAAEC,yBAAe;EACxBC,GAAG,EAAEC,qBAAW;EAChBC,SAAS,EAAEC;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAEC,QAAQ,EAAEC,cAAc,EAAG;EACpE,IAAK,CAAED,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOA,QAAQ,CAACE,QAAQ,GACrBV,kBAAkB,CAAES,cAAc,CAAE,CAAED,QAAQ,CAACE,QAAQ,CAAE,CACzDF,QAAQ,CAACG,SACT,CAAC,GACDH,QAAQ,CAACG,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EACxD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACC,cAAc,GAAG,IAAI;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CACxCH,KAAK,EACLC,IAAI,EACJL,cAAc,GAAG,SAAS,EACzB;EACD,MAAMD,QAAQ,GAAGI,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC;EACzD,OAAOP,+BAA+B,CAAEC,QAAQ,EAAEC,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,sBAAsBA,CAAEJ,KAAK,EAAEC,IAAI,EAAG;EACrD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACI,WAAW,GAAG,IAAI;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAAEN,KAAK,EAAEC,IAAI,EAAG;EACjD,OAAOD,KAAK,CAAEC,IAAI,CAAE,IAAID,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GAC1CP,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GACrBrB,WAAW;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMsB,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,IAAAE,oBAAc,EAC1D,CAAEV,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAO,CACNF,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC,EACxC,GAAGK,kBAAkB,CAAEN,KAAK,EAAEC,IAAK,CAAC,CACpC,CAACU,MAAM,CAAEC,OAAQ,CAAC;AACpB,CAAC,EACD,CAAEZ,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMY,gCAAgC,GAAAJ,OAAA,CAAAI,gCAAA,GAAG,IAAAH,oBAAc,EAC7D,CAAEV,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAOO,6BAA6B,CAAER,KAAK,EAAEC,IAAK,CAAC,CAACa,GAAG,CACpDC,WAAW,IACZrB,+BAA+B,CAAEqB,WAAW,EAAE,KAAM,CACtD,CAAC;AACF,CAAC,EACD,CAAEf,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMe,oBAAoB,GAAAP,OAAA,CAAAO,oBAAA,GAAG,IAAAN,oBAAc,EACjD,CAAEV,KAAK,EAAEiB,YAAY,KAAM;EAC1B,OAAOC,MAAM,CAACC,OAAO,CAAEnB,KAAM,CAAC,CAC5BW,MAAM,CAAE,CAAE,GAAIhB,QAAQ,CAAE,KAAMA,QAAQ,CAACyB,QAAQ,KAAKH,YAAa,CAAC,CAClEH,GAAG,CAAE,CAAE,CAAEb,IAAI,CAAE,KAAMA,IAAK,CAAC;AAC9B,CAAC,EACCD,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_keycodes","EMPTY_ARRAY","FORMATTING_METHODS","display","displayShortcut","raw","rawShortcut","ariaLabel","shortcutAriaLabel","getKeyCombinationRepresentation","shortcut","representation","modifier","character","getShortcutKeyCombination","state","name","keyCombination","getShortcutRepresentation","getShortcutDescription","description","getShortcutAliases","aliases","getAllShortcutKeyCombinations","exports","createSelector","filter","Boolean","getAllShortcutRawKeyCombinations","map","combination","getCategoryShortcuts","categoryName","Object","entries","category"],"sources":["@wordpress/keyboard-shortcuts/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\nimport {\n\tdisplayShortcut,\n\tshortcutAriaLabel,\n\trawShortcut,\n} from '@wordpress/keycodes';\n\n/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */\n\n/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Shortcut formatting methods.\n *\n * @property {WPKeycodeHandlerByModifier} display Display formatting.\n * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.\n * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.\n */\nconst FORMATTING_METHODS = {\n\tdisplay: displayShortcut,\n\traw: rawShortcut,\n\tariaLabel: shortcutAriaLabel,\n};\n\n/**\n * Returns a string representing the key combination.\n *\n * @param {?WPShortcutKeyCombination} shortcut Key combination.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n *\n * @return {?string} Shortcut representation.\n */\nfunction getKeyCombinationRepresentation( shortcut, representation ) {\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\treturn shortcut.modifier\n\t\t? FORMATTING_METHODS[ representation ][ shortcut.modifier ](\n\t\t\t\tshortcut.character\n\t\t )\n\t\t: shortcut.character;\n}\n\n/**\n * Returns the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const {character, modifier} = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutKeyCombination(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * <div>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </div>\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination?} Key combination.\n */\nexport function getShortcutKeyCombination( state, name ) {\n\treturn state[ name ] ? state[ name ].keyCombination : null;\n}\n\n/**\n * Returns a string representing the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const {display, raw, ariaLabel} = useSelect(\n * ( select ) =>{\n * return {\n * display: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region' ),\n * raw: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region','raw' ),\n * ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region', 'ariaLabel')\n * }\n * },\n * []\n * );\n *\n * return (\n * <ul>\n * <li>{ sprintf( 'display string: %s', display ) }</li>\n * <li>{ sprintf( 'raw string: %s', raw ) }</li>\n * <li>{ sprintf( 'ariaLabel string: %s', ariaLabel ) }</li>\n * </ul>\n * );\n * };\n *```\n *\n * @return {?string} Shortcut representation.\n */\nexport function getShortcutRepresentation(\n\tstate,\n\tname,\n\trepresentation = 'display'\n) {\n\tconst shortcut = getShortcutKeyCombination( state, name );\n\treturn getKeyCombinationRepresentation( shortcut, representation );\n}\n\n/**\n * Returns the shortcut description given its name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutDescription = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutDescription( 'core/editor/next-region' ),\n * []\n * );\n *\n * return shortcutDescription ? (\n * <div>{ shortcutDescription }</div>\n * ) : (\n * <div>{ __( 'No description.' ) }</div>\n * );\n * };\n *```\n * @return {?string} Shortcut description.\n */\nexport function getShortcutDescription( state, name ) {\n\treturn state[ name ] ? state[ name ].description : null;\n}\n\n/**\n * Returns the aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutAliases = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutAliases(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * shortcutAliases.length > 0 && (\n * <ul>\n * { shortcutAliases.map( ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport function getShortcutAliases( state, name ) {\n\treturn state[ name ] && state[ name ].aliases\n\t\t? state[ name ].aliases\n\t\t: EMPTY_ARRAY;\n}\n\n/**\n * Returns the shortcuts that include aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutKeyCombinations.map(\n * ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport const getAllShortcutKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn [\n\t\t\tgetShortcutKeyCombination( state, name ),\n\t\t\t...getShortcutAliases( state, name ),\n\t\t].filter( Boolean );\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the raw representation of all the keyboard combinations of a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutRawKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutRawKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutRawKeyCombinations.map(\n * ( shortcutRawKeyCombination, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * ' <code>%s</code>',\n * shortcutRawKeyCombination\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {string[]} Shortcuts.\n */\nexport const getAllShortcutRawKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn getAllShortcutKeyCombinations( state, name ).map(\n\t\t\t( combination ) =>\n\t\t\t\tgetKeyCombinationRepresentation( combination, 'raw' )\n\t\t);\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the shortcut names list for a given category name.\n *\n * @param {Object} state Global state.\n * @param {string} name Category name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const categoryShortcuts = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getCategoryShortcuts(\n * 'block'\n * ),\n * []\n * );\n *\n * return (\n * categoryShortcuts.length > 0 && (\n * <ul>\n * { categoryShortcuts.map( ( categoryShortcut ) => (\n * <li key={ categoryShortcut }>{ categoryShortcut }</li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n * @return {string[]} Shortcut names.\n */\nexport const getCategoryShortcuts = createSelector(\n\t( state, categoryName ) => {\n\t\treturn Object.entries( state )\n\t\t\t.filter( ( [ , shortcut ] ) => shortcut.category === categoryName )\n\t\t\t.map( ( [ name ] ) => name );\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAQA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;EAC1BC,OAAO,EAAEC,yBAAe;EACxBC,GAAG,EAAEC,qBAAW;EAChBC,SAAS,EAAEC;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAEC,QAAQ,EAAEC,cAAc,EAAG;EACpE,IAAK,CAAED,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOA,QAAQ,CAACE,QAAQ,GACrBV,kBAAkB,CAAES,cAAc,CAAE,CAAED,QAAQ,CAACE,QAAQ,CAAE,CACzDF,QAAQ,CAACG,SACT,CAAC,GACDH,QAAQ,CAACG,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EACxD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACC,cAAc,GAAG,IAAI;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CACxCH,KAAK,EACLC,IAAI,EACJL,cAAc,GAAG,SAAS,EACzB;EACD,MAAMD,QAAQ,GAAGI,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC;EACzD,OAAOP,+BAA+B,CAAEC,QAAQ,EAAEC,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,sBAAsBA,CAAEJ,KAAK,EAAEC,IAAI,EAAG;EACrD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACI,WAAW,GAAG,IAAI;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAAEN,KAAK,EAAEC,IAAI,EAAG;EACjD,OAAOD,KAAK,CAAEC,IAAI,CAAE,IAAID,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GAC1CP,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GACrBrB,WAAW;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMsB,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,IAAAE,oBAAc,EAC1D,CAAEV,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAO,CACNF,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC,EACxC,GAAGK,kBAAkB,CAAEN,KAAK,EAAEC,IAAK,CAAC,CACpC,CAACU,MAAM,CAAEC,OAAQ,CAAC;AACpB,CAAC,EACD,CAAEZ,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMY,gCAAgC,GAAAJ,OAAA,CAAAI,gCAAA,GAAG,IAAAH,oBAAc,EAC7D,CAAEV,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAOO,6BAA6B,CAAER,KAAK,EAAEC,IAAK,CAAC,CAACa,GAAG,CACpDC,WAAW,IACZrB,+BAA+B,CAAEqB,WAAW,EAAE,KAAM,CACtD,CAAC;AACF,CAAC,EACD,CAAEf,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMe,oBAAoB,GAAAP,OAAA,CAAAO,oBAAA,GAAG,IAAAN,oBAAc,EACjD,CAAEV,KAAK,EAAEiB,YAAY,KAAM;EAC1B,OAAOC,MAAM,CAACC,OAAO,CAAEnB,KAAM,CAAC,CAC5BW,MAAM,CAAE,CAAE,GAAIhB,QAAQ,CAAE,KAAMA,QAAQ,CAACyB,QAAQ,KAAKH,YAAa,CAAC,CAClEH,GAAG,CAAE,CAAE,CAAEb,IAAI,CAAE,KAAMA,IAAK,CAAC;AAC9B,CAAC,EACCD,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useState","context","jsx","_jsx","Provider","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","value","children"],"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n * Adding a provider allows to register contextual shortcuts\n * that are only active when a certain part of the UI is focused.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {Element} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst [ keyboardShortcuts ] = useState( () => new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) {\n\t\t\tprops.onKeyDown( event );\n\t\t}\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErC,MAAM;EAAEC;AAAS,CAAC,GAAGH,OAAO;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgBA,CAAEC,KAAK,EAAG;EACzC,MAAM,CAAEC,iBAAiB,CAAE,GAAGP,QAAQ,CAAE,MAAM,IAAIQ,GAAG,CAAC,CAAE,CAAC;EAEzD,SAASC,SAASA,CAAEC,KAAK,EAAG;IAC3B,IAAKJ,KAAK,CAACG,SAAS,EAAG;MACtBH,KAAK,CAACG,SAAS,CAAEC,KAAM,CAAC;IACzB;IAEA,KAAM,MAAMC,gBAAgB,IAAIJ,iBAAiB,EAAG;MACnDI,gBAAgB,CAAED,KAAM,CAAC;IAC1B;EACD;;EAEA;EACA,oBACCP,IAAA,CAACC,QAAQ;IAACQ,KAAK,EAAGL,iBAAmB;IAAAM,QAAA,eACpCV,IAAA;MAAA,GAAUG,KAAK;MAAGG,SAAS,EAAGA;IAAW,CAAE;EAAC,CACnC,CAAC;EAEZ;AACD","ignoreList":[]}
1
+ {"version":3,"names":["useState","context","jsx","_jsx","Provider","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","value","children"],"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n * Adding a provider allows to register contextual shortcuts\n * that are only active when a certain part of the UI is focused.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {Element} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst [ keyboardShortcuts ] = useState( () => new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) {\n\t\t\tprops.onKeyDown( event );\n\t\t}\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErC,MAAM;EAAEC;AAAS,CAAC,GAAGH,OAAO;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgBA,CAAEC,KAAK,EAAG;EACzC,MAAM,CAAEC,iBAAiB,CAAE,GAAGP,QAAQ,CAAE,MAAM,IAAIQ,GAAG,CAAC,CAAE,CAAC;EAEzD,SAASC,SAASA,CAAEC,KAAK,EAAG;IAC3B,IAAKJ,KAAK,CAACG,SAAS,EAAG;MACtBH,KAAK,CAACG,SAAS,CAAEC,KAAM,CAAC;IACzB;IAEA,KAAM,MAAMC,gBAAgB,IAAIJ,iBAAiB,EAAG;MACnDI,gBAAgB,CAAED,KAAM,CAAC;IAC1B;EACD;;EAEA;EACA,oBACCP,IAAA,CAACC,QAAQ;IAACQ,KAAK,EAAGL,iBAAmB;IAAAM,QAAA,eACpCV,IAAA;MAAA,GAAUG,KAAK;MAAGG,SAAS,EAAGA;IAAW,CAAE;EAAC,CACnC,CAAC;EAEZ;AACD","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","globalShortcuts","Set","globalListener","event","keyboardShortcut","context","add","shortcut","size","document","addEventListener","delete","removeEventListener"],"sources":["@wordpress/keyboard-shortcuts/src/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst globalShortcuts = new Set();\nconst globalListener = ( event ) => {\n\tfor ( const keyboardShortcut of globalShortcuts ) {\n\t\tkeyboardShortcut( event );\n\t}\n};\n\nexport const context = createContext( {\n\tadd: ( shortcut ) => {\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.addEventListener( 'keydown', globalListener );\n\t\t}\n\t\tglobalShortcuts.add( shortcut );\n\t},\n\tdelete: ( shortcut ) => {\n\t\tglobalShortcuts.delete( shortcut );\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.removeEventListener( 'keydown', globalListener );\n\t\t}\n\t},\n} );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AACjC,MAAMC,cAAc,GAAKC,KAAK,IAAM;EACnC,KAAM,MAAMC,gBAAgB,IAAIJ,eAAe,EAAG;IACjDI,gBAAgB,CAAED,KAAM,CAAC;EAC1B;AACD,CAAC;AAED,OAAO,MAAME,OAAO,GAAGN,aAAa,CAAE;EACrCO,GAAG,EAAIC,QAAQ,IAAM;IACpB,IAAKP,eAAe,CAACQ,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACC,gBAAgB,CAAE,SAAS,EAAER,cAAe,CAAC;IACvD;IACAF,eAAe,CAACM,GAAG,CAAEC,QAAS,CAAC;EAChC,CAAC;EACDI,MAAM,EAAIJ,QAAQ,IAAM;IACvBP,eAAe,CAACW,MAAM,CAAEJ,QAAS,CAAC;IAClC,IAAKP,eAAe,CAACQ,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACG,mBAAmB,CAAE,SAAS,EAAEV,cAAe,CAAC;IAC1D;EACD;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","globalShortcuts","Set","globalListener","event","keyboardShortcut","context","add","shortcut","size","document","addEventListener","delete","removeEventListener"],"sources":["@wordpress/keyboard-shortcuts/src/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst globalShortcuts = new Set();\nconst globalListener = ( event ) => {\n\tfor ( const keyboardShortcut of globalShortcuts ) {\n\t\tkeyboardShortcut( event );\n\t}\n};\n\nexport const context = createContext( {\n\tadd: ( shortcut ) => {\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.addEventListener( 'keydown', globalListener );\n\t\t}\n\t\tglobalShortcuts.add( shortcut );\n\t},\n\tdelete: ( shortcut ) => {\n\t\tglobalShortcuts.delete( shortcut );\n\t\tif ( globalShortcuts.size === 0 ) {\n\t\t\tdocument.removeEventListener( 'keydown', globalListener );\n\t\t}\n\t},\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC;AACjC,MAAMC,cAAc,GAAKC,KAAK,IAAM;EACnC,KAAM,MAAMC,gBAAgB,IAAIJ,eAAe,EAAG;IACjDI,gBAAgB,CAAED,KAAM,CAAC;EAC1B;AACD,CAAC;AAED,OAAO,MAAME,OAAO,GAAGN,aAAa,CAAE;EACrCO,GAAG,EAAIC,QAAQ,IAAM;IACpB,IAAKP,eAAe,CAACQ,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACC,gBAAgB,CAAE,SAAS,EAAER,cAAe,CAAC;IACvD;IACAF,eAAe,CAACM,GAAG,CAAEC,QAAS,CAAC;EAChC,CAAC;EACDI,MAAM,EAAIJ,QAAQ,IAAM;IACvBP,eAAe,CAACW,MAAM,CAAEJ,QAAS,CAAC;IAClC,IAAKP,eAAe,CAACQ,IAAI,KAAK,CAAC,EAAG;MACjCC,QAAQ,CAACG,mBAAmB,CAAE,SAAS,EAAEV,cAAe,CAAC;IAC1D;EACD;AACD,CAAE,CAAC","ignoreList":[]}
@@ -36,7 +36,7 @@ const FORMATTING_METHODS = {
36
36
  * @param {keyof FORMATTING_METHODS} representation Type of representation
37
37
  * (display, raw, ariaLabel).
38
38
  *
39
- * @return {string?} Shortcut representation.
39
+ * @return {?string} Shortcut representation.
40
40
  */
41
41
  function getKeyCombinationRepresentation(shortcut, representation) {
42
42
  if (!shortcut) {
@@ -126,7 +126,7 @@ export function getShortcutKeyCombination(state, name) {
126
126
  * };
127
127
  *```
128
128
  *
129
- * @return {string?} Shortcut representation.
129
+ * @return {?string} Shortcut representation.
130
130
  */
131
131
  export function getShortcutRepresentation(state, name, representation = 'display') {
132
132
  const shortcut = getShortcutKeyCombination(state, name);
@@ -159,7 +159,7 @@ export function getShortcutRepresentation(state, name, representation = 'display
159
159
  * );
160
160
  * };
161
161
  *```
162
- * @return {string?} Shortcut description.
162
+ * @return {?string} Shortcut description.
163
163
  */
164
164
  export function getShortcutDescription(state, name) {
165
165
  return state[name] ? state[name].description : null;
@@ -1 +1 @@
1
- {"version":3,"names":["createSelector","displayShortcut","shortcutAriaLabel","rawShortcut","EMPTY_ARRAY","FORMATTING_METHODS","display","raw","ariaLabel","getKeyCombinationRepresentation","shortcut","representation","modifier","character","getShortcutKeyCombination","state","name","keyCombination","getShortcutRepresentation","getShortcutDescription","description","getShortcutAliases","aliases","getAllShortcutKeyCombinations","filter","Boolean","getAllShortcutRawKeyCombinations","map","combination","getCategoryShortcuts","categoryName","Object","entries","category"],"sources":["@wordpress/keyboard-shortcuts/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\nimport {\n\tdisplayShortcut,\n\tshortcutAriaLabel,\n\trawShortcut,\n} from '@wordpress/keycodes';\n\n/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */\n\n/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Shortcut formatting methods.\n *\n * @property {WPKeycodeHandlerByModifier} display Display formatting.\n * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.\n * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.\n */\nconst FORMATTING_METHODS = {\n\tdisplay: displayShortcut,\n\traw: rawShortcut,\n\tariaLabel: shortcutAriaLabel,\n};\n\n/**\n * Returns a string representing the key combination.\n *\n * @param {?WPShortcutKeyCombination} shortcut Key combination.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n *\n * @return {string?} Shortcut representation.\n */\nfunction getKeyCombinationRepresentation( shortcut, representation ) {\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\treturn shortcut.modifier\n\t\t? FORMATTING_METHODS[ representation ][ shortcut.modifier ](\n\t\t\t\tshortcut.character\n\t\t )\n\t\t: shortcut.character;\n}\n\n/**\n * Returns the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const {character, modifier} = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutKeyCombination(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * <div>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </div>\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination?} Key combination.\n */\nexport function getShortcutKeyCombination( state, name ) {\n\treturn state[ name ] ? state[ name ].keyCombination : null;\n}\n\n/**\n * Returns a string representing the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const {display, raw, ariaLabel} = useSelect(\n * ( select ) =>{\n * return {\n * display: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region' ),\n * raw: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region','raw' ),\n * ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region', 'ariaLabel')\n * }\n * },\n * []\n * );\n *\n * return (\n * <ul>\n * <li>{ sprintf( 'display string: %s', display ) }</li>\n * <li>{ sprintf( 'raw string: %s', raw ) }</li>\n * <li>{ sprintf( 'ariaLabel string: %s', ariaLabel ) }</li>\n * </ul>\n * );\n * };\n *```\n *\n * @return {string?} Shortcut representation.\n */\nexport function getShortcutRepresentation(\n\tstate,\n\tname,\n\trepresentation = 'display'\n) {\n\tconst shortcut = getShortcutKeyCombination( state, name );\n\treturn getKeyCombinationRepresentation( shortcut, representation );\n}\n\n/**\n * Returns the shortcut description given its name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutDescription = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutDescription( 'core/editor/next-region' ),\n * []\n * );\n *\n * return shortcutDescription ? (\n * <div>{ shortcutDescription }</div>\n * ) : (\n * <div>{ __( 'No description.' ) }</div>\n * );\n * };\n *```\n * @return {string?} Shortcut description.\n */\nexport function getShortcutDescription( state, name ) {\n\treturn state[ name ] ? state[ name ].description : null;\n}\n\n/**\n * Returns the aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutAliases = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutAliases(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * shortcutAliases.length > 0 && (\n * <ul>\n * { shortcutAliases.map( ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport function getShortcutAliases( state, name ) {\n\treturn state[ name ] && state[ name ].aliases\n\t\t? state[ name ].aliases\n\t\t: EMPTY_ARRAY;\n}\n\n/**\n * Returns the shortcuts that include aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutKeyCombinations.map(\n * ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport const getAllShortcutKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn [\n\t\t\tgetShortcutKeyCombination( state, name ),\n\t\t\t...getShortcutAliases( state, name ),\n\t\t].filter( Boolean );\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the raw representation of all the keyboard combinations of a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutRawKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutRawKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutRawKeyCombinations.map(\n * ( shortcutRawKeyCombination, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * ' <code>%s</code>',\n * shortcutRawKeyCombination\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {string[]} Shortcuts.\n */\nexport const getAllShortcutRawKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn getAllShortcutKeyCombinations( state, name ).map(\n\t\t\t( combination ) =>\n\t\t\t\tgetKeyCombinationRepresentation( combination, 'raw' )\n\t\t);\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the shortcut names list for a given category name.\n *\n * @param {Object} state Global state.\n * @param {string} name Category name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const categoryShortcuts = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getCategoryShortcuts(\n * 'block'\n * ),\n * []\n * );\n *\n * return (\n * categoryShortcuts.length > 0 && (\n * <ul>\n * { categoryShortcuts.map( ( categoryShortcut ) => (\n * <li key={ categoryShortcut }>{ categoryShortcut }</li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n * @return {string[]} Shortcut names.\n */\nexport const getCategoryShortcuts = createSelector(\n\t( state, categoryName ) => {\n\t\treturn Object.entries( state )\n\t\t\t.filter( ( [ , shortcut ] ) => shortcut.category === categoryName )\n\t\t\t.map( ( [ name ] ) => name );\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SACCC,eAAe,EACfC,iBAAiB,EACjBC,WAAW,QACL,qBAAqB;;AAE5B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;EAC1BC,OAAO,EAAEL,eAAe;EACxBM,GAAG,EAAEJ,WAAW;EAChBK,SAAS,EAAEN;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,+BAA+BA,CAAEC,QAAQ,EAAEC,cAAc,EAAG;EACpE,IAAK,CAAED,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOA,QAAQ,CAACE,QAAQ,GACrBP,kBAAkB,CAAEM,cAAc,CAAE,CAAED,QAAQ,CAACE,QAAQ,CAAE,CACzDF,QAAQ,CAACG,SACT,CAAC,GACDH,QAAQ,CAACG,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EACxD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACC,cAAc,GAAG,IAAI;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACxCH,KAAK,EACLC,IAAI,EACJL,cAAc,GAAG,SAAS,EACzB;EACD,MAAMD,QAAQ,GAAGI,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC;EACzD,OAAOP,+BAA+B,CAAEC,QAAQ,EAAEC,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,sBAAsBA,CAAEJ,KAAK,EAAEC,IAAI,EAAG;EACrD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACI,WAAW,GAAG,IAAI;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEN,KAAK,EAAEC,IAAI,EAAG;EACjD,OAAOD,KAAK,CAAEC,IAAI,CAAE,IAAID,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GAC1CP,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GACrBlB,WAAW;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMmB,6BAA6B,GAAGvB,cAAc,CAC1D,CAAEe,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAO,CACNF,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC,EACxC,GAAGK,kBAAkB,CAAEN,KAAK,EAAEC,IAAK,CAAC,CACpC,CAACQ,MAAM,CAAEC,OAAQ,CAAC;AACpB,CAAC,EACD,CAAEV,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,gCAAgC,GAAG1B,cAAc,CAC7D,CAAEe,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAOO,6BAA6B,CAAER,KAAK,EAAEC,IAAK,CAAC,CAACW,GAAG,CACpDC,WAAW,IACZnB,+BAA+B,CAAEmB,WAAW,EAAE,KAAM,CACtD,CAAC;AACF,CAAC,EACD,CAAEb,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,oBAAoB,GAAG7B,cAAc,CACjD,CAAEe,KAAK,EAAEe,YAAY,KAAM;EAC1B,OAAOC,MAAM,CAACC,OAAO,CAAEjB,KAAM,CAAC,CAC5BS,MAAM,CAAE,CAAE,GAAId,QAAQ,CAAE,KAAMA,QAAQ,CAACuB,QAAQ,KAAKH,YAAa,CAAC,CAClEH,GAAG,CAAE,CAAE,CAAEX,IAAI,CAAE,KAAMA,IAAK,CAAC;AAC9B,CAAC,EACCD,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createSelector","displayShortcut","shortcutAriaLabel","rawShortcut","EMPTY_ARRAY","FORMATTING_METHODS","display","raw","ariaLabel","getKeyCombinationRepresentation","shortcut","representation","modifier","character","getShortcutKeyCombination","state","name","keyCombination","getShortcutRepresentation","getShortcutDescription","description","getShortcutAliases","aliases","getAllShortcutKeyCombinations","filter","Boolean","getAllShortcutRawKeyCombinations","map","combination","getCategoryShortcuts","categoryName","Object","entries","category"],"sources":["@wordpress/keyboard-shortcuts/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\nimport {\n\tdisplayShortcut,\n\tshortcutAriaLabel,\n\trawShortcut,\n} from '@wordpress/keycodes';\n\n/** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */\n\n/** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Shortcut formatting methods.\n *\n * @property {WPKeycodeHandlerByModifier} display Display formatting.\n * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.\n * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting.\n */\nconst FORMATTING_METHODS = {\n\tdisplay: displayShortcut,\n\traw: rawShortcut,\n\tariaLabel: shortcutAriaLabel,\n};\n\n/**\n * Returns a string representing the key combination.\n *\n * @param {?WPShortcutKeyCombination} shortcut Key combination.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n *\n * @return {?string} Shortcut representation.\n */\nfunction getKeyCombinationRepresentation( shortcut, representation ) {\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\treturn shortcut.modifier\n\t\t? FORMATTING_METHODS[ representation ][ shortcut.modifier ](\n\t\t\t\tshortcut.character\n\t\t )\n\t\t: shortcut.character;\n}\n\n/**\n * Returns the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const {character, modifier} = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutKeyCombination(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * <div>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </div>\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination?} Key combination.\n */\nexport function getShortcutKeyCombination( state, name ) {\n\treturn state[ name ] ? state[ name ].keyCombination : null;\n}\n\n/**\n * Returns a string representing the main key combination for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @param {keyof FORMATTING_METHODS} representation Type of representation\n * (display, raw, ariaLabel).\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const {display, raw, ariaLabel} = useSelect(\n * ( select ) =>{\n * return {\n * display: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region' ),\n * raw: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region','raw' ),\n * ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region', 'ariaLabel')\n * }\n * },\n * []\n * );\n *\n * return (\n * <ul>\n * <li>{ sprintf( 'display string: %s', display ) }</li>\n * <li>{ sprintf( 'raw string: %s', raw ) }</li>\n * <li>{ sprintf( 'ariaLabel string: %s', ariaLabel ) }</li>\n * </ul>\n * );\n * };\n *```\n *\n * @return {?string} Shortcut representation.\n */\nexport function getShortcutRepresentation(\n\tstate,\n\tname,\n\trepresentation = 'display'\n) {\n\tconst shortcut = getShortcutKeyCombination( state, name );\n\treturn getKeyCombinationRepresentation( shortcut, representation );\n}\n\n/**\n * Returns the shortcut description given its name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutDescription = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutDescription( 'core/editor/next-region' ),\n * []\n * );\n *\n * return shortcutDescription ? (\n * <div>{ shortcutDescription }</div>\n * ) : (\n * <div>{ __( 'No description.' ) }</div>\n * );\n * };\n *```\n * @return {?string} Shortcut description.\n */\nexport function getShortcutDescription( state, name ) {\n\treturn state[ name ] ? state[ name ].description : null;\n}\n\n/**\n * Returns the aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n * const ExampleComponent = () => {\n * const shortcutAliases = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getShortcutAliases(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * shortcutAliases.length > 0 && (\n * <ul>\n * { shortcutAliases.map( ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport function getShortcutAliases( state, name ) {\n\treturn state[ name ] && state[ name ].aliases\n\t\t? state[ name ].aliases\n\t\t: EMPTY_ARRAY;\n}\n\n/**\n * Returns the shortcuts that include aliases for a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutKeyCombinations.map(\n * ( { character, modifier }, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * 'Character: <code>%s</code> / Modifier: <code>%s</code>',\n * character,\n * modifier\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {WPShortcutKeyCombination[]} Key combinations.\n */\nexport const getAllShortcutKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn [\n\t\t\tgetShortcutKeyCombination( state, name ),\n\t\t\t...getShortcutAliases( state, name ),\n\t\t].filter( Boolean );\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the raw representation of all the keyboard combinations of a given shortcut name.\n *\n * @param {Object} state Global state.\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n * import { createInterpolateElement } from '@wordpress/element';\n * import { sprintf } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n * const allShortcutRawKeyCombinations = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations(\n * 'core/editor/next-region'\n * ),\n * []\n * );\n *\n * return (\n * allShortcutRawKeyCombinations.length > 0 && (\n * <ul>\n * { allShortcutRawKeyCombinations.map(\n * ( shortcutRawKeyCombination, index ) => (\n * <li key={ index }>\n * { createInterpolateElement(\n * sprintf(\n * ' <code>%s</code>',\n * shortcutRawKeyCombination\n * ),\n * {\n * code: <code />,\n * }\n * ) }\n * </li>\n * )\n * ) }\n * </ul>\n * )\n * );\n * };\n *```\n *\n * @return {string[]} Shortcuts.\n */\nexport const getAllShortcutRawKeyCombinations = createSelector(\n\t( state, name ) => {\n\t\treturn getAllShortcutKeyCombinations( state, name ).map(\n\t\t\t( combination ) =>\n\t\t\t\tgetKeyCombinationRepresentation( combination, 'raw' )\n\t\t);\n\t},\n\t( state, name ) => [ state[ name ] ]\n);\n\n/**\n * Returns the shortcut names list for a given category name.\n *\n * @param {Object} state Global state.\n * @param {string} name Category name.\n * @example\n *\n *```js\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const categoryShortcuts = useSelect(\n * ( select ) =>\n * select( keyboardShortcutsStore ).getCategoryShortcuts(\n * 'block'\n * ),\n * []\n * );\n *\n * return (\n * categoryShortcuts.length > 0 && (\n * <ul>\n * { categoryShortcuts.map( ( categoryShortcut ) => (\n * <li key={ categoryShortcut }>{ categoryShortcut }</li>\n * ) ) }\n * </ul>\n * )\n * );\n * };\n *```\n * @return {string[]} Shortcut names.\n */\nexport const getCategoryShortcuts = createSelector(\n\t( state, categoryName ) => {\n\t\treturn Object.entries( state )\n\t\t\t.filter( ( [ , shortcut ] ) => shortcut.category === categoryName )\n\t\t\t.map( ( [ name ] ) => name );\n\t},\n\t( state ) => [ state ]\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SACCC,eAAe,EACfC,iBAAiB,EACjBC,WAAW,QACL,qBAAqB;;AAE5B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;EAC1BC,OAAO,EAAEL,eAAe;EACxBM,GAAG,EAAEJ,WAAW;EAChBK,SAAS,EAAEN;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,+BAA+BA,CAAEC,QAAQ,EAAEC,cAAc,EAAG;EACpE,IAAK,CAAED,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOA,QAAQ,CAACE,QAAQ,GACrBP,kBAAkB,CAAEM,cAAc,CAAE,CAAED,QAAQ,CAACE,QAAQ,CAAE,CACzDF,QAAQ,CAACG,SACT,CAAC,GACDH,QAAQ,CAACG,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EACxD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACC,cAAc,GAAG,IAAI;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACxCH,KAAK,EACLC,IAAI,EACJL,cAAc,GAAG,SAAS,EACzB;EACD,MAAMD,QAAQ,GAAGI,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC;EACzD,OAAOP,+BAA+B,CAAEC,QAAQ,EAAEC,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,sBAAsBA,CAAEJ,KAAK,EAAEC,IAAI,EAAG;EACrD,OAAOD,KAAK,CAAEC,IAAI,CAAE,GAAGD,KAAK,CAAEC,IAAI,CAAE,CAACI,WAAW,GAAG,IAAI;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEN,KAAK,EAAEC,IAAI,EAAG;EACjD,OAAOD,KAAK,CAAEC,IAAI,CAAE,IAAID,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GAC1CP,KAAK,CAAEC,IAAI,CAAE,CAACM,OAAO,GACrBlB,WAAW;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMmB,6BAA6B,GAAGvB,cAAc,CAC1D,CAAEe,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAO,CACNF,yBAAyB,CAAEC,KAAK,EAAEC,IAAK,CAAC,EACxC,GAAGK,kBAAkB,CAAEN,KAAK,EAAEC,IAAK,CAAC,CACpC,CAACQ,MAAM,CAAEC,OAAQ,CAAC;AACpB,CAAC,EACD,CAAEV,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,gCAAgC,GAAG1B,cAAc,CAC7D,CAAEe,KAAK,EAAEC,IAAI,KAAM;EAClB,OAAOO,6BAA6B,CAAER,KAAK,EAAEC,IAAK,CAAC,CAACW,GAAG,CACpDC,WAAW,IACZnB,+BAA+B,CAAEmB,WAAW,EAAE,KAAM,CACtD,CAAC;AACF,CAAC,EACD,CAAEb,KAAK,EAAEC,IAAI,KAAM,CAAED,KAAK,CAAEC,IAAI,CAAE,CACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,oBAAoB,GAAG7B,cAAc,CACjD,CAAEe,KAAK,EAAEe,YAAY,KAAM;EAC1B,OAAOC,MAAM,CAACC,OAAO,CAAEjB,KAAM,CAAC,CAC5BS,MAAM,CAAE,CAAE,GAAId,QAAQ,CAAE,KAAMA,QAAQ,CAACuB,QAAQ,KAAKH,YAAa,CAAC,CAClEH,GAAG,CAAE,CAAE,CAAEX,IAAI,CAAE,KAAMA,IAAK,CAAC;AAC9B,CAAC,EACCD,KAAK,IAAM,CAAEA,KAAK,CACrB,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/keyboard-shortcuts",
3
- "version": "5.13.0",
3
+ "version": "5.13.1-next.cd6172eb0.0",
4
4
  "description": "Handling keyboard shortcuts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,9 +28,9 @@
28
28
  "wpScript": true,
29
29
  "dependencies": {
30
30
  "@babel/runtime": "7.25.7",
31
- "@wordpress/data": "*",
32
- "@wordpress/element": "*",
33
- "@wordpress/keycodes": "*"
31
+ "@wordpress/data": "^10.13.1-next.cd6172eb0.0",
32
+ "@wordpress/element": "^6.13.1-next.cd6172eb0.0",
33
+ "@wordpress/keycodes": "^4.13.1-next.cd6172eb0.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0"
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "cce81c13739c2a8b53d91df90c4f037cb68c2665"
41
+ "gitHead": "4cc93dc1781d8a7bc2bbde265913917920e2bd45"
42
42
  }
@@ -40,7 +40,7 @@ const FORMATTING_METHODS = {
40
40
  * @param {keyof FORMATTING_METHODS} representation Type of representation
41
41
  * (display, raw, ariaLabel).
42
42
  *
43
- * @return {string?} Shortcut representation.
43
+ * @return {?string} Shortcut representation.
44
44
  */
45
45
  function getKeyCombinationRepresentation( shortcut, representation ) {
46
46
  if ( ! shortcut ) {
@@ -135,7 +135,7 @@ export function getShortcutKeyCombination( state, name ) {
135
135
  * };
136
136
  *```
137
137
  *
138
- * @return {string?} Shortcut representation.
138
+ * @return {?string} Shortcut representation.
139
139
  */
140
140
  export function getShortcutRepresentation(
141
141
  state,
@@ -172,7 +172,7 @@ export function getShortcutRepresentation(
172
172
  * );
173
173
  * };
174
174
  *```
175
- * @return {string?} Shortcut description.
175
+ * @return {?string} Shortcut description.
176
176
  */
177
177
  export function getShortcutDescription( state, name ) {
178
178
  return state[ name ] ? state[ name ].description : null;