@wordpress/keyboard-shortcuts 5.34.0 → 5.35.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/shortcut-provider.js +4 -2
  3. package/build/components/shortcut-provider.js.map +1 -1
  4. package/build/context.js +5 -3
  5. package/build/context.js.map +1 -1
  6. package/build/hooks/use-shortcut-event-match.js +2 -0
  7. package/build/hooks/use-shortcut-event-match.js.map +1 -1
  8. package/build/hooks/use-shortcut.js +2 -0
  9. package/build/hooks/use-shortcut.js.map +1 -1
  10. package/build/index.js +2 -0
  11. package/build/index.js.map +1 -1
  12. package/build/store/actions.js +2 -0
  13. package/build/store/actions.js.map +1 -1
  14. package/build/store/index.js +4 -2
  15. package/build/store/index.js.map +1 -1
  16. package/build/store/reducer.js +2 -0
  17. package/build/store/reducer.js.map +1 -1
  18. package/build/store/selectors.js +7 -5
  19. package/build/store/selectors.js.map +1 -1
  20. package/build-module/components/shortcut-provider.js +3 -2
  21. package/build-module/components/shortcut-provider.js.map +1 -1
  22. package/build-module/context.js +4 -3
  23. package/build-module/context.js.map +1 -1
  24. package/build-module/hooks/use-shortcut-event-match.js +1 -0
  25. package/build-module/hooks/use-shortcut-event-match.js.map +1 -1
  26. package/build-module/hooks/use-shortcut.js +1 -0
  27. package/build-module/hooks/use-shortcut.js.map +1 -1
  28. package/build-module/index.js +1 -0
  29. package/build-module/index.js.map +1 -1
  30. package/build-module/store/actions.js +1 -0
  31. package/build-module/store/actions.js.map +1 -1
  32. package/build-module/store/index.js +3 -2
  33. package/build-module/store/index.js.map +1 -1
  34. package/build-module/store/reducer.js +1 -0
  35. package/build-module/store/reducer.js.map +1 -1
  36. package/build-module/store/selectors.js +6 -5
  37. package/build-module/store/selectors.js.map +1 -1
  38. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.35.0 (2025-11-12)
6
+
5
7
  ## 5.34.0 (2025-10-29)
6
8
 
7
9
  ## 5.33.0 (2025-10-17)
@@ -15,15 +15,17 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/components/shortcut-provider.js
18
20
  var shortcut_provider_exports = {};
19
21
  __export(shortcut_provider_exports, {
20
22
  ShortcutProvider: () => ShortcutProvider
21
23
  });
22
24
  module.exports = __toCommonJS(shortcut_provider_exports);
23
- var import_jsx_runtime = require("react/jsx-runtime");
24
25
  var import_element = require("@wordpress/element");
25
26
  var import_context = require("../context");
26
- const { Provider } = import_context.context;
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var { Provider } = import_context.context;
27
29
  function ShortcutProvider(props) {
28
30
  const [keyboardShortcuts] = (0, import_element.useState)(() => /* @__PURE__ */ new Set());
29
31
  function onKeyDown(event) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/shortcut-provider.js"],
4
4
  "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCG;AAlCH,qBAAyB;AAKzB,qBAAwB;AAExB,MAAM,EAAE,SAAS,IAAI;AAWd,SAAS,iBAAkB,OAAQ;AACzC,QAAM,CAAE,iBAAkB,QAAI,yBAAU,MAAM,oBAAI,IAAI,CAAE;AAExD,WAAS,UAAW,OAAQ;AAC3B,QAAK,MAAM,WAAY;AACtB,YAAM,UAAW,KAAM;AAAA,IACxB;AAEA,eAAY,oBAAoB,mBAAoB;AACnD,uBAAkB,KAAM;AAAA,IACzB;AAAA,EACD;AAGA,SACC,4CAAC,YAAS,OAAQ,mBACjB,sDAAC,SAAM,GAAG,OAAQ,WAAwB,GAC3C;AAGF;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyB;AAKzB,qBAAwB;AA6BrB;AA3BH,IAAM,EAAE,SAAS,IAAI;AAWd,SAAS,iBAAkB,OAAQ;AACzC,QAAM,CAAE,iBAAkB,QAAI,yBAAU,MAAM,oBAAI,IAAI,CAAE;AAExD,WAAS,UAAW,OAAQ;AAC3B,QAAK,MAAM,WAAY;AACtB,YAAM,UAAW,KAAM;AAAA,IACxB;AAEA,eAAY,oBAAoB,mBAAoB;AACnD,uBAAkB,KAAM;AAAA,IACzB;AAAA,EACD;AAGA,SACC,4CAAC,YAAS,OAAQ,mBACjB,sDAAC,SAAM,GAAG,OAAQ,WAAwB,GAC3C;AAGF;",
6
6
  "names": []
7
7
  }
package/build/context.js CHANGED
@@ -15,19 +15,21 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/context.js
18
20
  var context_exports = {};
19
21
  __export(context_exports, {
20
22
  context: () => context
21
23
  });
22
24
  module.exports = __toCommonJS(context_exports);
23
25
  var import_element = require("@wordpress/element");
24
- const globalShortcuts = /* @__PURE__ */ new Set();
25
- const globalListener = (event) => {
26
+ var globalShortcuts = /* @__PURE__ */ new Set();
27
+ var globalListener = (event) => {
26
28
  for (const keyboardShortcut of globalShortcuts) {
27
29
  keyboardShortcut(event);
28
30
  }
29
31
  };
30
- const context = (0, import_element.createContext)({
32
+ var context = (0, import_element.createContext)({
31
33
  add: (shortcut) => {
32
34
  if (globalShortcuts.size === 0) {
33
35
  document.addEventListener("keydown", globalListener);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/context.js"],
4
4
  "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\ncontext.displayName = 'KeyboardShortcutsContext';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA8B;AAE9B,MAAM,kBAAkB,oBAAI,IAAI;AAChC,MAAM,iBAAiB,CAAE,UAAW;AACnC,aAAY,oBAAoB,iBAAkB;AACjD,qBAAkB,KAAM;AAAA,EACzB;AACD;AAEO,MAAM,cAAU,8BAAe;AAAA,EACrC,KAAK,CAAE,aAAc;AACpB,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,iBAAkB,WAAW,cAAe;AAAA,IACtD;AACA,oBAAgB,IAAK,QAAS;AAAA,EAC/B;AAAA,EACA,QAAQ,CAAE,aAAc;AACvB,oBAAgB,OAAQ,QAAS;AACjC,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,oBAAqB,WAAW,cAAe;AAAA,IACzD;AAAA,EACD;AACD,CAAE;AAEF,QAAQ,cAAc;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA8B;AAE9B,IAAM,kBAAkB,oBAAI,IAAI;AAChC,IAAM,iBAAiB,CAAE,UAAW;AACnC,aAAY,oBAAoB,iBAAkB;AACjD,qBAAkB,KAAM;AAAA,EACzB;AACD;AAEO,IAAM,cAAU,8BAAe;AAAA,EACrC,KAAK,CAAE,aAAc;AACpB,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,iBAAkB,WAAW,cAAe;AAAA,IACtD;AACA,oBAAgB,IAAK,QAAS;AAAA,EAC/B;AAAA,EACA,QAAQ,CAAE,aAAc;AACvB,oBAAgB,OAAQ,QAAS;AACjC,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,oBAAqB,WAAW,cAAe;AAAA,IACzD;AAAA,EACD;AACD,CAAE;AAEF,QAAQ,cAAc;",
6
6
  "names": []
7
7
  }
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/hooks/use-shortcut-event-match.js
18
20
  var use_shortcut_event_match_exports = {};
19
21
  __export(use_shortcut_event_match_exports, {
20
22
  default: () => useShortcutEventMatch
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/use-shortcut-event-match.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as keyboardShortcutsStore } from '../store';\n\n/**\n * Returns a function to check if a keyboard event matches a shortcut name.\n *\n * @return {Function} A function to check if a keyboard event matches a\n * predefined shortcut combination.\n */\nexport default function useShortcutEventMatch() {\n\tconst { getAllShortcutKeyCombinations } = useSelect(\n\t\tkeyboardShortcutsStore\n\t);\n\n\t/**\n\t * A function to check if a keyboard event matches a predefined shortcut\n\t * combination.\n\t *\n\t * @param {string} name Shortcut name.\n\t * @param {KeyboardEvent} event Event to check.\n\t *\n\t * @return {boolean} True if the event matches any shortcuts, false if not.\n\t */\n\tfunction isMatch( name, event ) {\n\t\treturn getAllShortcutKeyCombinations( name ).some(\n\t\t\t( { modifier, character } ) => {\n\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t}\n\t\t);\n\t}\n\n\treturn isMatch;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,sBAAgC;AAKhC,mBAAgD;AAQjC,SAAR,wBAAyC;AAC/C,QAAM,EAAE,8BAA8B,QAAI;AAAA,IACzC,aAAAA;AAAA,EACD;AAWA,WAAS,QAAS,MAAM,OAAQ;AAC/B,WAAO,8BAA+B,IAAK,EAAE;AAAA,MAC5C,CAAE,EAAE,UAAU,UAAU,MAAO;AAC9B,eAAO,gCAAiB,QAAS,EAAG,OAAO,SAAU;AAAA,MACtD;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,sBAAgC;AAKhC,mBAAgD;AAQjC,SAAR,wBAAyC;AAC/C,QAAM,EAAE,8BAA8B,QAAI;AAAA,IACzC,aAAAA;AAAA,EACD;AAWA,WAAS,QAAS,MAAM,OAAQ;AAC/B,WAAO,8BAA+B,IAAK,EAAE;AAAA,MAC5C,CAAE,EAAE,UAAU,UAAU,MAAO;AAC9B,eAAO,gCAAiB,QAAS,EAAG,OAAO,SAAU;AAAA,MACtD;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
6
6
  "names": ["keyboardShortcutsStore"]
7
7
  }
@@ -25,6 +25,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/keyboard-shortcuts/src/hooks/use-shortcut.js
28
30
  var use_shortcut_exports = {};
29
31
  __export(use_shortcut_exports, {
30
32
  default: () => useShortcut
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/use-shortcut.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useShortcutEventMatch from './use-shortcut-event-match';\nimport { context } from '../context';\n\n/**\n * Attach a keyboard shortcut handler.\n *\n * @param {string} name Shortcut name.\n * @param {Function} callback Shortcut callback.\n * @param {Object} options Shortcut options.\n * @param {boolean} options.isDisabled Whether to disable to shortut.\n */\nexport default function useShortcut(\n\tname,\n\tcallback,\n\t{ isDisabled = false } = {}\n) {\n\tconst shortcuts = useContext( context );\n\tconst isMatch = useShortcutEventMatch();\n\tconst callbackRef = useRef();\n\n\tuseEffect( () => {\n\t\tcallbackRef.current = callback;\n\t}, [ callback ] );\n\n\tuseEffect( () => {\n\t\tif ( isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction _callback( event ) {\n\t\t\tif ( isMatch( name, event ) ) {\n\t\t\t\tcallbackRef.current( event );\n\t\t\t}\n\t\t}\n\n\t\tshortcuts.add( _callback );\n\t\treturn () => {\n\t\t\tshortcuts.delete( _callback );\n\t\t};\n\t}, [ name, isDisabled,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,MAAM;AACZ,gBAAU,OAAQ,SAAU;AAAA,IAC7B;AAAA,EACD,GAAG,CAAE,MAAM,YAAY,SAAU,CAAE;AACpC;",
6
6
  "names": ["useShortcutEventMatch"]
7
7
  }
package/build/index.js CHANGED
@@ -25,6 +25,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/keyboard-shortcuts/src/index.js
28
30
  var index_exports = {};
29
31
  __export(index_exports, {
30
32
  ShortcutProvider: () => import_shortcut_provider.ShortcutProvider,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["export { store } from './store';\nexport { default as useShortcut } from './hooks/use-shortcut';\nexport { ShortcutProvider } from './components/shortcut-provider';\nexport { default as __unstableUseShortcutEventMatch } from './hooks/use-shortcut-event-match';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,0BAAuC;AACvC,+BAAiC;AACjC,sCAA2D;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,0BAAuC;AACvC,+BAAiC;AACjC,sCAA2D;",
6
6
  "names": []
7
7
  }
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/store/actions.js
18
20
  var actions_exports = {};
19
21
  __export(actions_exports, {
20
22
  registerShortcut: () => registerShortcut,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.js"],
4
4
  "sourcesContent": ["/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */\n\n/**\n * Keyboard key combination.\n *\n * @typedef {Object} WPShortcutKeyCombination\n *\n * @property {string} character Character.\n * @property {WPKeycodeModifier|undefined} modifier Modifier.\n */\n\n/**\n * Configuration of a registered keyboard shortcut.\n *\n * @typedef {Object} WPShortcutConfig\n *\n * @property {string} name Shortcut name.\n * @property {string} category Shortcut category.\n * @property {string} description Shortcut description.\n * @property {WPShortcutKeyCombination} keyCombination Shortcut key combination.\n * @property {WPShortcutKeyCombination[]} [aliases] Shortcut aliases.\n */\n\n/**\n * Returns an action object used to register a new keyboard shortcut.\n *\n * @param {WPShortcutConfig} 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} ) {\n\treturn {\n\t\ttype: 'REGISTER_SHORTCUT',\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 ) {\n\treturn {\n\t\ttype: 'UNREGISTER_SHORTCUT',\n\t\tname,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoEO,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAuCO,SAAS,mBAAoB,MAAO;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoEO,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAuCO,SAAS,mBAAoB,MAAO;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -25,6 +25,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/keyboard-shortcuts/src/store/index.js
28
30
  var store_exports = {};
29
31
  __export(store_exports, {
30
32
  store: () => store
@@ -34,8 +36,8 @@ var import_data = require("@wordpress/data");
34
36
  var import_reducer = __toESM(require("./reducer"));
35
37
  var actions = __toESM(require("./actions"));
36
38
  var selectors = __toESM(require("./selectors"));
37
- const STORE_NAME = "core/keyboard-shortcuts";
38
- const store = (0, import_data.createReduxStore)(STORE_NAME, {
39
+ var STORE_NAME = "core/keyboard-shortcuts";
40
+ var store = (0, import_data.createReduxStore)(STORE_NAME, {
39
41
  reducer: import_reducer.default,
40
42
  actions,
41
43
  selectors
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\nconst STORE_NAME = 'core/keyboard-shortcuts';\n\n/**\n * Store definition for the keyboard shortcuts namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAE3B,MAAM,aAAa;AASZ,MAAM,YAAQ,8BAAkB,YAAY;AAAA,EAClD,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAE3B,IAAM,aAAa;AASZ,IAAM,YAAQ,8BAAkB,YAAY;AAAA,EAClD,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
6
6
  "names": ["reducer"]
7
7
  }
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/store/reducer.js
18
20
  var reducer_exports = {};
19
21
  __export(reducer_exports, {
20
22
  default: () => reducer_default
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/reducer.js"],
4
4
  "sourcesContent": ["/**\n * Reducer returning the registered shortcuts\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction reducer( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_SHORTCUT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tcategory: action.category,\n\t\t\t\t\tkeyCombination: action.keyCombination,\n\t\t\t\t\taliases: action.aliases,\n\t\t\t\t\tdescription: action.description,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_SHORTCUT':\n\t\t\tconst { [ action.name ]: actionName, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t}\n\n\treturn state;\n}\n\nexport default reducer;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAS,QAAS,QAAQ,CAAC,GAAG,QAAS;AACtC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,gBAAgB,OAAO;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,aAAa,OAAO;AAAA,QACrB;AAAA,MACD;AAAA,IACD,KAAK;AACJ,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,YAAY,GAAG,eAAe,IAAI;AAC3D,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAS,QAAS,QAAQ,CAAC,GAAG,QAAS;AACtC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,gBAAgB,OAAO;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,aAAa,OAAO;AAAA,QACrB;AAAA,MACD;AAAA,IACD,KAAK;AACJ,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,YAAY,GAAG,eAAe,IAAI;AAC3D,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ;",
6
6
  "names": []
7
7
  }
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/keyboard-shortcuts/src/store/selectors.js
18
20
  var selectors_exports = {};
19
21
  __export(selectors_exports, {
20
22
  getAllShortcutKeyCombinations: () => getAllShortcutKeyCombinations,
@@ -28,8 +30,8 @@ __export(selectors_exports, {
28
30
  module.exports = __toCommonJS(selectors_exports);
29
31
  var import_data = require("@wordpress/data");
30
32
  var import_keycodes = require("@wordpress/keycodes");
31
- const EMPTY_ARRAY = [];
32
- const FORMATTING_METHODS = {
33
+ var EMPTY_ARRAY = [];
34
+ var FORMATTING_METHODS = {
33
35
  display: import_keycodes.displayShortcut,
34
36
  raw: import_keycodes.rawShortcut,
35
37
  ariaLabel: import_keycodes.shortcutAriaLabel
@@ -55,7 +57,7 @@ function getShortcutDescription(state, name) {
55
57
  function getShortcutAliases(state, name) {
56
58
  return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
57
59
  }
58
- const getAllShortcutKeyCombinations = (0, import_data.createSelector)(
60
+ var getAllShortcutKeyCombinations = (0, import_data.createSelector)(
59
61
  (state, name) => {
60
62
  return [
61
63
  getShortcutKeyCombination(state, name),
@@ -64,7 +66,7 @@ const getAllShortcutKeyCombinations = (0, import_data.createSelector)(
64
66
  },
65
67
  (state, name) => [state[name]]
66
68
  );
67
- const getAllShortcutRawKeyCombinations = (0, import_data.createSelector)(
69
+ var getAllShortcutRawKeyCombinations = (0, import_data.createSelector)(
68
70
  (state, name) => {
69
71
  return getAllShortcutKeyCombinations(state, name).map(
70
72
  (combination) => getKeyCombinationRepresentation(combination, "raw")
@@ -72,7 +74,7 @@ const getAllShortcutRawKeyCombinations = (0, import_data.createSelector)(
72
74
  },
73
75
  (state, name) => [state[name]]
74
76
  );
75
- const getCategoryShortcuts = (0, import_data.createSelector)(
77
+ var getCategoryShortcuts = (0, import_data.createSelector)(
76
78
  (state, categoryName) => {
77
79
  return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name);
78
80
  },
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.js"],
4
4
  "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAC/B,sBAIO;AAYP,MAAM,cAAc,CAAC;AASrB,MAAM,qBAAqB;AAAA,EAC1B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,WAAW;AACZ;AAWA,SAAS,gCAAiC,UAAU,gBAAiB;AACpE,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,WACb,mBAAoB,cAAe,EAAG,SAAS,QAAS;AAAA,IACxD,SAAS;AAAA,EACT,IACA,SAAS;AACb;AA2CO,SAAS,0BAA2B,OAAO,MAAO;AACxD,SAAO,MAAO,IAAK,IAAI,MAAO,IAAK,EAAE,iBAAiB;AACvD;AAwCO,SAAS,0BACf,OACA,MACA,iBAAiB,WAChB;AACD,QAAM,WAAW,0BAA2B,OAAO,IAAK;AACxD,SAAO,gCAAiC,UAAU,cAAe;AAClE;AA8BO,SA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  }
@@ -1,7 +1,8 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/keyboard-shortcuts/src/components/shortcut-provider.js
2
2
  import { useState } from "@wordpress/element";
3
3
  import { context } from "../context";
4
- const { Provider } = context;
4
+ import { jsx } from "react/jsx-runtime";
5
+ var { Provider } = context;
5
6
  function ShortcutProvider(props) {
6
7
  const [keyboardShortcuts] = useState(() => /* @__PURE__ */ new Set());
7
8
  function onKeyDown(event) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/shortcut-provider.js"],
4
4
  "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"],
5
- "mappings": "AAqCG;AAlCH,SAAS,gBAAgB;AAKzB,SAAS,eAAe;AAExB,MAAM,EAAE,SAAS,IAAI;AAWd,SAAS,iBAAkB,OAAQ;AACzC,QAAM,CAAE,iBAAkB,IAAI,SAAU,MAAM,oBAAI,IAAI,CAAE;AAExD,WAAS,UAAW,OAAQ;AAC3B,QAAK,MAAM,WAAY;AACtB,YAAM,UAAW,KAAM;AAAA,IACxB;AAEA,eAAY,oBAAoB,mBAAoB;AACnD,uBAAkB,KAAM;AAAA,IACzB;AAAA,EACD;AAGA,SACC,oBAAC,YAAS,OAAQ,mBACjB,8BAAC,SAAM,GAAG,OAAQ,WAAwB,GAC3C;AAGF;",
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AAKzB,SAAS,eAAe;AA6BrB;AA3BH,IAAM,EAAE,SAAS,IAAI;AAWd,SAAS,iBAAkB,OAAQ;AACzC,QAAM,CAAE,iBAAkB,IAAI,SAAU,MAAM,oBAAI,IAAI,CAAE;AAExD,WAAS,UAAW,OAAQ;AAC3B,QAAK,MAAM,WAAY;AACtB,YAAM,UAAW,KAAM;AAAA,IACxB;AAEA,eAAY,oBAAoB,mBAAoB;AACnD,uBAAkB,KAAM;AAAA,IACzB;AAAA,EACD;AAGA,SACC,oBAAC,YAAS,OAAQ,mBACjB,8BAAC,SAAM,GAAG,OAAQ,WAAwB,GAC3C;AAGF;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,12 @@
1
+ // packages/keyboard-shortcuts/src/context.js
1
2
  import { createContext } from "@wordpress/element";
2
- const globalShortcuts = /* @__PURE__ */ new Set();
3
- const globalListener = (event) => {
3
+ var globalShortcuts = /* @__PURE__ */ new Set();
4
+ var globalListener = (event) => {
4
5
  for (const keyboardShortcut of globalShortcuts) {
5
6
  keyboardShortcut(event);
6
7
  }
7
8
  };
8
- const context = createContext({
9
+ var context = createContext({
9
10
  add: (shortcut) => {
10
11
  if (globalShortcuts.size === 0) {
11
12
  document.addEventListener("keydown", globalListener);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/context.js"],
4
4
  "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\ncontext.displayName = 'KeyboardShortcutsContext';\n"],
5
- "mappings": "AAGA,SAAS,qBAAqB;AAE9B,MAAM,kBAAkB,oBAAI,IAAI;AAChC,MAAM,iBAAiB,CAAE,UAAW;AACnC,aAAY,oBAAoB,iBAAkB;AACjD,qBAAkB,KAAM;AAAA,EACzB;AACD;AAEO,MAAM,UAAU,cAAe;AAAA,EACrC,KAAK,CAAE,aAAc;AACpB,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,iBAAkB,WAAW,cAAe;AAAA,IACtD;AACA,oBAAgB,IAAK,QAAS;AAAA,EAC/B;AAAA,EACA,QAAQ,CAAE,aAAc;AACvB,oBAAgB,OAAQ,QAAS;AACjC,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,oBAAqB,WAAW,cAAe;AAAA,IACzD;AAAA,EACD;AACD,CAAE;AAEF,QAAQ,cAAc;",
5
+ "mappings": ";AAGA,SAAS,qBAAqB;AAE9B,IAAM,kBAAkB,oBAAI,IAAI;AAChC,IAAM,iBAAiB,CAAE,UAAW;AACnC,aAAY,oBAAoB,iBAAkB;AACjD,qBAAkB,KAAM;AAAA,EACzB;AACD;AAEO,IAAM,UAAU,cAAe;AAAA,EACrC,KAAK,CAAE,aAAc;AACpB,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,iBAAkB,WAAW,cAAe;AAAA,IACtD;AACA,oBAAgB,IAAK,QAAS;AAAA,EAC/B;AAAA,EACA,QAAQ,CAAE,aAAc;AACvB,oBAAgB,OAAQ,QAAS;AACjC,QAAK,gBAAgB,SAAS,GAAI;AACjC,eAAS,oBAAqB,WAAW,cAAe;AAAA,IACzD;AAAA,EACD;AACD,CAAE;AAEF,QAAQ,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/keyboard-shortcuts/src/hooks/use-shortcut-event-match.js
1
2
  import { useSelect } from "@wordpress/data";
2
3
  import { isKeyboardEvent } from "@wordpress/keycodes";
3
4
  import { store as keyboardShortcutsStore } from "../store";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/use-shortcut-event-match.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as keyboardShortcutsStore } from '../store';\n\n/**\n * Returns a function to check if a keyboard event matches a shortcut name.\n *\n * @return {Function} A function to check if a keyboard event matches a\n * predefined shortcut combination.\n */\nexport default function useShortcutEventMatch() {\n\tconst { getAllShortcutKeyCombinations } = useSelect(\n\t\tkeyboardShortcutsStore\n\t);\n\n\t/**\n\t * A function to check if a keyboard event matches a predefined shortcut\n\t * combination.\n\t *\n\t * @param {string} name Shortcut name.\n\t * @param {KeyboardEvent} event Event to check.\n\t *\n\t * @return {boolean} True if the event matches any shortcuts, false if not.\n\t */\n\tfunction isMatch( name, event ) {\n\t\treturn getAllShortcutKeyCombinations( name ).some(\n\t\t\t( { modifier, character } ) => {\n\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t}\n\t\t);\n\t}\n\n\treturn isMatch;\n}\n"],
5
- "mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAKhC,SAAS,SAAS,8BAA8B;AAQjC,SAAR,wBAAyC;AAC/C,QAAM,EAAE,8BAA8B,IAAI;AAAA,IACzC;AAAA,EACD;AAWA,WAAS,QAAS,MAAM,OAAQ;AAC/B,WAAO,8BAA+B,IAAK,EAAE;AAAA,MAC5C,CAAE,EAAE,UAAU,UAAU,MAAO;AAC9B,eAAO,gBAAiB,QAAS,EAAG,OAAO,SAAU;AAAA,MACtD;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAKhC,SAAS,SAAS,8BAA8B;AAQjC,SAAR,wBAAyC;AAC/C,QAAM,EAAE,8BAA8B,IAAI;AAAA,IACzC;AAAA,EACD;AAWA,WAAS,QAAS,MAAM,OAAQ;AAC/B,WAAO,8BAA+B,IAAK,EAAE;AAAA,MAC5C,CAAE,EAAE,UAAU,UAAU,MAAO;AAC9B,eAAO,gBAAiB,QAAS,EAAG,OAAO,SAAU;AAAA,MACtD;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/keyboard-shortcuts/src/hooks/use-shortcut.js
1
2
  import { useContext, useEffect, useRef } from "@wordpress/element";
2
3
  import useShortcutEventMatch from "./use-shortcut-event-match";
3
4
  import { context } from "../context";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/use-shortcut.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useShortcutEventMatch from './use-shortcut-event-match';\nimport { context } from '../context';\n\n/**\n * Attach a keyboard shortcut handler.\n *\n * @param {string} name Shortcut name.\n * @param {Function} callback Shortcut callback.\n * @param {Object} options Shortcut options.\n * @param {boolean} options.isDisabled Whether to disable to shortut.\n */\nexport default function useShortcut(\n\tname,\n\tcallback,\n\t{ isDisabled = false } = {}\n) {\n\tconst shortcuts = useContext( context );\n\tconst isMatch = useShortcutEventMatch();\n\tconst callbackRef = useRef();\n\n\tuseEffect( () => {\n\t\tcallbackRef.current = callback;\n\t}, [ callback ] );\n\n\tuseEffect( () => {\n\t\tif ( isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction _callback( event ) {\n\t\t\tif ( isMatch( name, event ) ) {\n\t\t\t\tcallbackRef.current( event );\n\t\t\t}\n\t\t}\n\n\t\tshortcuts.add( _callback );\n\t\treturn () => {\n\t\t\tshortcuts.delete( _callback );\n\t\t};\n\t}, [ name, isDisabled, shortcuts ] );\n}\n"],
5
- "mappings": "AAGA,SAAS,YAAY,WAAW,cAAc;AAK9C,OAAO,2BAA2B;AAClC,SAAS,eAAe;AAUT,SAAR,YACN,MACA,UACA,EAAE,aAAa,MAAM,IAAI,CAAC,GACzB;AACD,QAAM,YAAY,WAAY,OAAQ;AACtC,QAAM,UAAU,sBAAsB;AACtC,QAAM,cAAc,OAAO;AAE3B,YAAW,MAAM;AAChB,gBAAY,UAAU;AAAA,EACvB,GAAG,CAAE,QAAS,CAAE;AAEhB,YAAW,MAAM;AAChB,QAAK,YAAa;AACjB;AAAA,IACD;AAEA,aAAS,UAAW,OAAQ;AAC3B,UAAK,QAAS,MAAM,KAAM,GAAI;AAC7B,oBAAY,QAAS,KAAM;AAAA,MAC5B;AAAA,IACD;AAEA,cAAU,IAAK,SAAU;AACzB,WAAO,MAAM;AACZ,gBAAU,OAAQ,SAAU;AAAA,IAC7B;AAAA,EACD,GAAG,CAAE,MAAM,YAAY,SAAU,CAAE;AACpC;",
5
+ "mappings": ";AAGA,SAAS,YAAY,WAAW,cAAc;AAK9C,OAAO,2BAA2B;AAClC,SAAS,eAAe;AAUT,SAAR,YACN,MACA,UACA,EAAE,aAAa,MAAM,IAAI,CAAC,GACzB;AACD,QAAM,YAAY,WAAY,OAAQ;AACtC,QAAM,UAAU,sBAAsB;AACtC,QAAM,cAAc,OAAO;AAE3B,YAAW,MAAM;AAChB,gBAAY,UAAU;AAAA,EACvB,GAAG,CAAE,QAAS,CAAE;AAEhB,YAAW,MAAM;AAChB,QAAK,YAAa;AACjB;AAAA,IACD;AAEA,aAAS,UAAW,OAAQ;AAC3B,UAAK,QAAS,MAAM,KAAM,GAAI;AAC7B,oBAAY,QAAS,KAAM;AAAA,MAC5B;AAAA,IACD;AAEA,cAAU,IAAK,SAAU;AACzB,WAAO,MAAM;AACZ,gBAAU,OAAQ,SAAU;AAAA,IAC7B;AAAA,EACD,GAAG,CAAE,MAAM,YAAY,SAAU,CAAE;AACpC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/keyboard-shortcuts/src/index.js
1
2
  import { store } from "./store";
2
3
  import { default as default2 } from "./hooks/use-shortcut";
3
4
  import { ShortcutProvider } from "./components/shortcut-provider";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["export { store } from './store';\nexport { default as useShortcut } from './hooks/use-shortcut';\nexport { ShortcutProvider } from './components/shortcut-provider';\nexport { default as __unstableUseShortcutEventMatch } from './hooks/use-shortcut-event-match';\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,SAAoB,WAAXA,gBAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAoB,WAAXA,gBAAkD;",
5
+ "mappings": ";AAAA,SAAS,aAAa;AACtB,SAAoB,WAAXA,gBAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAoB,WAAXA,gBAAkD;",
6
6
  "names": ["default"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/keyboard-shortcuts/src/store/actions.js
1
2
  function registerShortcut({
2
3
  name,
3
4
  category,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.js"],
4
4
  "sourcesContent": ["/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */\n\n/**\n * Keyboard key combination.\n *\n * @typedef {Object} WPShortcutKeyCombination\n *\n * @property {string} character Character.\n * @property {WPKeycodeModifier|undefined} modifier Modifier.\n */\n\n/**\n * Configuration of a registered keyboard shortcut.\n *\n * @typedef {Object} WPShortcutConfig\n *\n * @property {string} name Shortcut name.\n * @property {string} category Shortcut category.\n * @property {string} description Shortcut description.\n * @property {WPShortcutKeyCombination} keyCombination Shortcut key combination.\n * @property {WPShortcutKeyCombination[]} [aliases] Shortcut aliases.\n */\n\n/**\n * Returns an action object used to register a new keyboard shortcut.\n *\n * @param {WPShortcutConfig} 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} ) {\n\treturn {\n\t\ttype: 'REGISTER_SHORTCUT',\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 ) {\n\treturn {\n\t\ttype: 'UNREGISTER_SHORTCUT',\n\t\tname,\n\t};\n}\n"],
5
- "mappings": "AAoEO,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAuCO,SAAS,mBAAoB,MAAO;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
5
+ "mappings": ";AAoEO,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAuCO,SAAS,mBAAoB,MAAO;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,10 @@
1
+ // packages/keyboard-shortcuts/src/store/index.js
1
2
  import { createReduxStore, register } from "@wordpress/data";
2
3
  import reducer from "./reducer";
3
4
  import * as actions from "./actions";
4
5
  import * as selectors from "./selectors";
5
- const STORE_NAME = "core/keyboard-shortcuts";
6
- const store = createReduxStore(STORE_NAME, {
6
+ var STORE_NAME = "core/keyboard-shortcuts";
7
+ var store = createReduxStore(STORE_NAME, {
7
8
  reducer,
8
9
  actions,
9
10
  selectors
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\nconst STORE_NAME = 'core/keyboard-shortcuts';\n\n/**\n * Store definition for the keyboard shortcuts namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],
5
- "mappings": "AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,eAAe;AAE3B,MAAM,aAAa;AASZ,MAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;",
5
+ "mappings": ";AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,eAAe;AAE3B,IAAM,aAAa;AASZ,IAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/keyboard-shortcuts/src/store/reducer.js
1
2
  function reducer(state = {}, action) {
2
3
  switch (action.type) {
3
4
  case "REGISTER_SHORTCUT":
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/reducer.js"],
4
4
  "sourcesContent": ["/**\n * Reducer returning the registered shortcuts\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction reducer( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_SHORTCUT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tcategory: action.category,\n\t\t\t\t\tkeyCombination: action.keyCombination,\n\t\t\t\t\taliases: action.aliases,\n\t\t\t\t\tdescription: action.description,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_SHORTCUT':\n\t\t\tconst { [ action.name ]: actionName, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t}\n\n\treturn state;\n}\n\nexport default reducer;\n"],
5
- "mappings": "AAQA,SAAS,QAAS,QAAQ,CAAC,GAAG,QAAS;AACtC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,gBAAgB,OAAO;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,aAAa,OAAO;AAAA,QACrB;AAAA,MACD;AAAA,IACD,KAAK;AACJ,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,YAAY,GAAG,eAAe,IAAI;AAC3D,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ;",
5
+ "mappings": ";AAQA,SAAS,QAAS,QAAQ,CAAC,GAAG,QAAS;AACtC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,gBAAgB,OAAO;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,aAAa,OAAO;AAAA,QACrB;AAAA,MACD;AAAA,IACD,KAAK;AACJ,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,YAAY,GAAG,eAAe,IAAI;AAC3D,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,12 @@
1
+ // packages/keyboard-shortcuts/src/store/selectors.js
1
2
  import { createSelector } from "@wordpress/data";
2
3
  import {
3
4
  displayShortcut,
4
5
  shortcutAriaLabel,
5
6
  rawShortcut
6
7
  } from "@wordpress/keycodes";
7
- const EMPTY_ARRAY = [];
8
- const FORMATTING_METHODS = {
8
+ var EMPTY_ARRAY = [];
9
+ var FORMATTING_METHODS = {
9
10
  display: displayShortcut,
10
11
  raw: rawShortcut,
11
12
  ariaLabel: shortcutAriaLabel
@@ -31,7 +32,7 @@ function getShortcutDescription(state, name) {
31
32
  function getShortcutAliases(state, name) {
32
33
  return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
33
34
  }
34
- const getAllShortcutKeyCombinations = createSelector(
35
+ var getAllShortcutKeyCombinations = createSelector(
35
36
  (state, name) => {
36
37
  return [
37
38
  getShortcutKeyCombination(state, name),
@@ -40,7 +41,7 @@ const getAllShortcutKeyCombinations = createSelector(
40
41
  },
41
42
  (state, name) => [state[name]]
42
43
  );
43
- const getAllShortcutRawKeyCombinations = createSelector(
44
+ var getAllShortcutRawKeyCombinations = createSelector(
44
45
  (state, name) => {
45
46
  return getAllShortcutKeyCombinations(state, name).map(
46
47
  (combination) => getKeyCombinationRepresentation(combination, "raw")
@@ -48,7 +49,7 @@ const getAllShortcutRawKeyCombinations = createSelector(
48
49
  },
49
50
  (state, name) => [state[name]]
50
51
  );
51
- const getCategoryShortcuts = createSelector(
52
+ var getCategoryShortcuts = createSelector(
52
53
  (state, categoryName) => {
53
54
  return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name);
54
55
  },
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.js"],
4
4
  "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"],
5
- "mappings": "AAGA,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAYP,MAAM,cAAc,CAAC;AASrB,MAAM,qBAAqB;AAAA,EAC1B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,WAAW;AACZ;AAWA,SAAS,gCAAiC,UAAU,gBAAiB;AACpE,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,WACb,mBAAoB,cAAe,EAAG,SAAS,QAAS;AAAA,IACxD,SAAS;AAAA,EACT,IACA,SAAS;AACb;AA2CO,SAAS,0BAA2B,OAAO,MAAO;AACxD,SAAO,MAAO,IAAK,IAAI,MAAO,IAAK,EAAE,iBAAiB;AACvD;AAwCO,SAAS,0BACf,OACA,MACA,iBAAiB,WAChB;AACD,QAAM,WAAW,0BAA2B,OAAO,IAAK;AACxD,SAAO,gCAAiC,UAAU,cAAe;AAClE;AA8BO,SAAS,uBAAwB,OAAO,MAAO;AACrD,SAAO,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version": "5.34.0",
3
+ "version": "5.35.0",
4
4
  "description": "Handling keyboard shortcuts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,9 +34,9 @@
34
34
  "react-native": "src/index",
35
35
  "wpScript": true,
36
36
  "dependencies": {
37
- "@wordpress/data": "^10.34.0",
38
- "@wordpress/element": "^6.34.0",
39
- "@wordpress/keycodes": "^4.34.0"
37
+ "@wordpress/data": "^10.35.0",
38
+ "@wordpress/element": "^6.35.0",
39
+ "@wordpress/keycodes": "^4.35.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.0.0"
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "ceebff807958d2e8fc755b5a20473939c78b4d1d"
47
+ "gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
48
48
  }