{
  "version": 3,
  "sources": ["../../src/store/actions.ts"],
  "sourcesContent": ["import type { WPKeycodeModifier } from '@wordpress/keycodes';\n\n/**\n * Keyboard key combination.\n */\nexport interface ShortcutKeyCombination {\n\tcharacter: string;\n\tmodifier: WPKeycodeModifier | undefined;\n}\n\n/**\n * Configuration of a registered keyboard shortcut.\n */\nexport interface ShortcutConfig {\n\tname: string;\n\tcategory: string;\n\tdescription: string;\n\tkeyCombination: ShortcutKeyCombination;\n\taliases?: ShortcutKeyCombination[];\n}\n\nexport type ShortcutAction =\n\t| ReturnType< typeof registerShortcut >\n\t| ReturnType< typeof unregisterShortcut >;\n\n/**\n * Returns an action object used to register a new keyboard shortcut.\n *\n * @param {ShortcutConfig} config Shortcut config.\n *\n * @example\n *\n *```js\n * import { useEffect } from 'react';\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect, useDispatch } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n *     const { registerShortcut } = useDispatch( keyboardShortcutsStore );\n *\n *     useEffect( () => {\n *         registerShortcut( {\n *             name: 'custom/my-custom-shortcut',\n *             category: 'my-category',\n *             description: __( 'My custom shortcut' ),\n *             keyCombination: {\n *                 modifier: 'primary',\n *                 character: 'j',\n *             },\n *         } );\n *     }, [] );\n *\n *     const shortcut = useSelect(\n *         ( select ) =>\n *             select( keyboardShortcutsStore ).getShortcutKeyCombination(\n *                 'custom/my-custom-shortcut'\n *             ),\n *         []\n *     );\n *\n *     return shortcut ? (\n *         <p>{ __( 'Shortcut is registered.' ) }</p>\n *     ) : (\n *         <p>{ __( 'Shortcut is not registered.' ) }</p>\n *     );\n * };\n *```\n * @return {Object} action.\n */\nexport function registerShortcut( {\n\tname,\n\tcategory,\n\tdescription,\n\tkeyCombination,\n\taliases,\n}: ShortcutConfig ) {\n\treturn {\n\t\ttype: 'REGISTER_SHORTCUT' as const,\n\t\tname,\n\t\tcategory,\n\t\tkeyCombination,\n\t\taliases,\n\t\tdescription,\n\t};\n}\n\n/**\n * Returns an action object used to unregister a keyboard shortcut.\n *\n * @param {string} name Shortcut name.\n *\n * @example\n *\n *```js\n * import { useEffect } from 'react';\n * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n * import { useSelect, useDispatch } from '@wordpress/data';\n * import { __ } from '@wordpress/i18n';\n *\n * const ExampleComponent = () => {\n *     const { unregisterShortcut } = useDispatch( keyboardShortcutsStore );\n *\n *     useEffect( () => {\n *         unregisterShortcut( 'core/editor/next-region' );\n *     }, [] );\n *\n *     const shortcut = useSelect(\n *         ( select ) =>\n *             select( keyboardShortcutsStore ).getShortcutKeyCombination(\n *                 'core/editor/next-region'\n *             ),\n *         []\n *     );\n *\n *     return shortcut ? (\n *         <p>{ __( 'Shortcut is not unregistered.' ) }</p>\n *     ) : (\n *         <p>{ __( 'Shortcut is unregistered.' ) }</p>\n *     );\n * };\n *```\n * @return {Object} action.\n */\nexport function unregisterShortcut( name: string ) {\n\treturn {\n\t\ttype: 'UNREGISTER_SHORTCUT' as const,\n\t\tname,\n\t};\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsEO,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAoB;AACnB,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAuCO,SAAS,mBAAoB,MAAe;AAClD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
  "names": []
}
