@wordpress/commands 0.10.0 → 0.11.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 (51) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/command-menu.js +25 -40
  3. package/build/components/command-menu.js.map +1 -1
  4. package/build/hooks/use-command-context.js +3 -7
  5. package/build/hooks/use-command-context.js.map +1 -1
  6. package/build/hooks/use-command-loader.js +0 -4
  7. package/build/hooks/use-command-loader.js.map +1 -1
  8. package/build/hooks/use-command.js +0 -4
  9. package/build/hooks/use-command.js.map +1 -1
  10. package/build/index.js +0 -6
  11. package/build/index.js.map +1 -1
  12. package/build/lock-unlock.js +1 -2
  13. package/build/lock-unlock.js.map +1 -1
  14. package/build/private-apis.js +1 -4
  15. package/build/private-apis.js.map +1 -1
  16. package/build/store/actions.js +5 -11
  17. package/build/store/actions.js.map +1 -1
  18. package/build/store/index.js +2 -11
  19. package/build/store/index.js.map +1 -1
  20. package/build/store/private-actions.js +0 -1
  21. package/build/store/private-actions.js.map +1 -1
  22. package/build/store/reducer.js +7 -18
  23. package/build/store/reducer.js.map +1 -1
  24. package/build/store/selectors.js +33 -4
  25. package/build/store/selectors.js.map +1 -1
  26. package/build-module/components/command-menu.js +26 -35
  27. package/build-module/components/command-menu.js.map +1 -1
  28. package/build-module/hooks/use-command-context.js +5 -4
  29. package/build-module/hooks/use-command-context.js.map +1 -1
  30. package/build-module/hooks/use-command-loader.js +2 -2
  31. package/build-module/hooks/use-command-loader.js.map +1 -1
  32. package/build-module/hooks/use-command.js +2 -2
  33. package/build-module/hooks/use-command.js.map +1 -1
  34. package/build-module/index.js.map +1 -1
  35. package/build-module/lock-unlock.js.map +1 -1
  36. package/build-module/private-apis.js.map +1 -1
  37. package/build-module/store/actions.js +5 -5
  38. package/build-module/store/actions.js.map +1 -1
  39. package/build-module/store/index.js +2 -2
  40. package/build-module/store/index.js.map +1 -1
  41. package/build-module/store/private-actions.js.map +1 -1
  42. package/build-module/store/reducer.js +8 -17
  43. package/build-module/store/reducer.js.map +1 -1
  44. package/build-module/store/selectors.js +34 -0
  45. package/build-module/store/selectors.js.map +1 -1
  46. package/build-style/style-rtl.css +36 -18
  47. package/build-style/style.css +36 -18
  48. package/package.json +12 -10
  49. package/src/components/command-menu.js +17 -7
  50. package/src/components/style.scss +38 -19
  51. package/src/store/selectors.js +30 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/index.js"],"names":["CommandMenu","privateApis","default","useCommand","useCommandLoader","store"],"mappings":"AAAA,SAASA,WAAT,QAA4B,2BAA5B;AACA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASC,OAAO,IAAIC,UAApB,QAAsC,qBAAtC;AACA,SAASD,OAAO,IAAIE,gBAApB,QAA4C,4BAA5C;AACA,SAASC,KAAT,QAAsB,SAAtB","sourcesContent":["export { CommandMenu } from './components/command-menu';\nexport { privateApis } from './private-apis';\nexport { default as useCommand } from './hooks/use-command';\nexport { default as useCommandLoader } from './hooks/use-command-loader';\nexport { store } from './store';\n"]}
1
+ {"version":3,"names":["CommandMenu","privateApis","default","useCommand","useCommandLoader","store"],"sources":["@wordpress/commands/src/index.js"],"sourcesContent":["export { CommandMenu } from './components/command-menu';\nexport { privateApis } from './private-apis';\nexport { default as useCommand } from './hooks/use-command';\nexport { default as useCommandLoader } from './hooks/use-command-loader';\nexport { store } from './store';\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,2BAA2B;AACvD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,OAAO,IAAIC,UAAU,QAAQ,qBAAqB;AAC3D,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,4BAA4B;AACxE,SAASC,KAAK,QAAQ,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/lock-unlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,qBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/commands'\n\t);\n"]}
1
+ {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/commands/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/commands'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,8GAA8G,EAC9G,qBACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/private-apis.js"],"names":["default","useCommandContext","lock","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,6BAA7C;AACA,SAASC,IAAT,QAAqB,eAArB;AAEA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe;AAClBF,EAAAA;AADkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { default as useCommandContext } from './hooks/use-command-context';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommandContext,\n} );\n"]}
1
+ {"version":3,"names":["default","useCommandContext","lock","privateApis"],"sources":["@wordpress/commands/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { default as useCommandContext } from './hooks/use-command-context';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommandContext,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,iBAAiB,QAAQ,6BAA6B;AAC1E,SAASC,IAAI,QAAQ,eAAe;AAEpC,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7BD,IAAI,CAAEC,WAAW,EAAE;EAClBF;AACD,CAAE,CAAC"}
@@ -40,6 +40,7 @@ export function registerCommand(config) {
40
40
  ...config
41
41
  };
42
42
  }
43
+
43
44
  /**
44
45
  * Returns an action object used to unregister a command.
45
46
  *
@@ -47,13 +48,13 @@ export function registerCommand(config) {
47
48
  *
48
49
  * @return {Object} action.
49
50
  */
50
-
51
51
  export function unregisterCommand(name) {
52
52
  return {
53
53
  type: 'UNREGISTER_COMMAND',
54
54
  name
55
55
  };
56
56
  }
57
+
57
58
  /**
58
59
  * Register command loader.
59
60
  *
@@ -61,13 +62,13 @@ export function unregisterCommand(name) {
61
62
  *
62
63
  * @return {Object} action.
63
64
  */
64
-
65
65
  export function registerCommandLoader(config) {
66
66
  return {
67
67
  type: 'REGISTER_COMMAND_LOADER',
68
68
  ...config
69
69
  };
70
70
  }
71
+
71
72
  /**
72
73
  * Unregister command loader hook.
73
74
  *
@@ -75,30 +76,29 @@ export function registerCommandLoader(config) {
75
76
  *
76
77
  * @return {Object} action.
77
78
  */
78
-
79
79
  export function unregisterCommandLoader(name) {
80
80
  return {
81
81
  type: 'UNREGISTER_COMMAND_LOADER',
82
82
  name
83
83
  };
84
84
  }
85
+
85
86
  /**
86
87
  * Opens the command palette.
87
88
  *
88
89
  * @return {Object} action.
89
90
  */
90
-
91
91
  export function open() {
92
92
  return {
93
93
  type: 'OPEN'
94
94
  };
95
95
  }
96
+
96
97
  /**
97
98
  * Closes the command palette.
98
99
  *
99
100
  * @return {Object} action.
100
101
  */
101
-
102
102
  export function close() {
103
103
  return {
104
104
  type: 'CLOSE'
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/store/actions.js"],"names":["registerCommand","config","type","unregisterCommand","name","registerCommandLoader","unregisterCommandLoader","open","close"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAT,CAA0BC,MAA1B,EAAmC;AACzC,SAAO;AACNC,IAAAA,IAAI,EAAE,kBADA;AAEN,OAAGD;AAFG,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,SAAO;AACNF,IAAAA,IAAI,EAAE,oBADA;AAENE,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,qBAAT,CAAgCJ,MAAhC,EAAyC;AAC/C,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;AAEN,OAAGD;AAFG,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,uBAAT,CAAkCF,IAAlC,EAAyC;AAC/C,SAAO;AACNF,IAAAA,IAAI,EAAE,2BADA;AAENE,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,IAAT,GAAgB;AACtB,SAAO;AACNL,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,KAAT,GAAiB;AACvB,SAAO;AACNN,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","sourcesContent":["/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */\n\n/**\n * Configuration of a registered keyboard shortcut.\n *\n * @typedef {Object} WPCommandConfig\n *\n * @property {string} name Command name.\n * @property {string} label Command label.\n * @property {string=} searchLabel Command search label.\n * @property {string=} context Command context.\n * @property {JSX.Element} icon Command icon.\n * @property {Function} callback Command callback.\n */\n\n/**\n * @typedef {(search: string) => WPCommandConfig[]} WPCommandLoaderHook hoo\n */\n\n/**\n * Command loader config.\n *\n * @typedef {Object} WPCommandLoaderConfig\n *\n * @property {string} name Command loader name.\n * @property {string=} context Command loader context.\n * @property {WPCommandLoaderHook} hook Command loader hook.\n */\n\n/**\n * Returns an action object used to register a new command.\n *\n * @param {WPCommandConfig} config Command config.\n *\n * @return {Object} action.\n */\nexport function registerCommand( config ) {\n\treturn {\n\t\ttype: 'REGISTER_COMMAND',\n\t\t...config,\n\t};\n}\n\n/**\n * Returns an action object used to unregister a command.\n *\n * @param {string} name Command name.\n *\n * @return {Object} action.\n */\nexport function unregisterCommand( name ) {\n\treturn {\n\t\ttype: 'UNREGISTER_COMMAND',\n\t\tname,\n\t};\n}\n\n/**\n * Register command loader.\n *\n * @param {WPCommandLoaderConfig} config Command loader config.\n *\n * @return {Object} action.\n */\nexport function registerCommandLoader( config ) {\n\treturn {\n\t\ttype: 'REGISTER_COMMAND_LOADER',\n\t\t...config,\n\t};\n}\n\n/**\n * Unregister command loader hook.\n *\n * @param {string} name Command loader name.\n *\n * @return {Object} action.\n */\nexport function unregisterCommandLoader( name ) {\n\treturn {\n\t\ttype: 'UNREGISTER_COMMAND_LOADER',\n\t\tname,\n\t};\n}\n\n/**\n * Opens the command palette.\n *\n * @return {Object} action.\n */\nexport function open() {\n\treturn {\n\t\ttype: 'OPEN',\n\t};\n}\n\n/**\n * Closes the command palette.\n *\n * @return {Object} action.\n */\nexport function close() {\n\treturn {\n\t\ttype: 'CLOSE',\n\t};\n}\n"]}
1
+ {"version":3,"names":["registerCommand","config","type","unregisterCommand","name","registerCommandLoader","unregisterCommandLoader","open","close"],"sources":["@wordpress/commands/src/store/actions.js"],"sourcesContent":["/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */\n\n/**\n * Configuration of a registered keyboard shortcut.\n *\n * @typedef {Object} WPCommandConfig\n *\n * @property {string} name Command name.\n * @property {string} label Command label.\n * @property {string=} searchLabel Command search label.\n * @property {string=} context Command context.\n * @property {JSX.Element} icon Command icon.\n * @property {Function} callback Command callback.\n */\n\n/**\n * @typedef {(search: string) => WPCommandConfig[]} WPCommandLoaderHook hoo\n */\n\n/**\n * Command loader config.\n *\n * @typedef {Object} WPCommandLoaderConfig\n *\n * @property {string} name Command loader name.\n * @property {string=} context Command loader context.\n * @property {WPCommandLoaderHook} hook Command loader hook.\n */\n\n/**\n * Returns an action object used to register a new command.\n *\n * @param {WPCommandConfig} config Command config.\n *\n * @return {Object} action.\n */\nexport function registerCommand( config ) {\n\treturn {\n\t\ttype: 'REGISTER_COMMAND',\n\t\t...config,\n\t};\n}\n\n/**\n * Returns an action object used to unregister a command.\n *\n * @param {string} name Command name.\n *\n * @return {Object} action.\n */\nexport function unregisterCommand( name ) {\n\treturn {\n\t\ttype: 'UNREGISTER_COMMAND',\n\t\tname,\n\t};\n}\n\n/**\n * Register command loader.\n *\n * @param {WPCommandLoaderConfig} config Command loader config.\n *\n * @return {Object} action.\n */\nexport function registerCommandLoader( config ) {\n\treturn {\n\t\ttype: 'REGISTER_COMMAND_LOADER',\n\t\t...config,\n\t};\n}\n\n/**\n * Unregister command loader hook.\n *\n * @param {string} name Command loader name.\n *\n * @return {Object} action.\n */\nexport function unregisterCommandLoader( name ) {\n\treturn {\n\t\ttype: 'UNREGISTER_COMMAND_LOADER',\n\t\tname,\n\t};\n}\n\n/**\n * Opens the command palette.\n *\n * @return {Object} action.\n */\nexport function open() {\n\treturn {\n\t\ttype: 'OPEN',\n\t};\n}\n\n/**\n * Closes the command palette.\n *\n * @return {Object} action.\n */\nexport function close() {\n\treturn {\n\t\ttype: 'CLOSE',\n\t};\n}\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAAEC,MAAM,EAAG;EACzC,OAAO;IACNC,IAAI,EAAE,kBAAkB;IACxB,GAAGD;EACJ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,OAAO;IACNF,IAAI,EAAE,oBAAoB;IAC1BE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEJ,MAAM,EAAG;EAC/C,OAAO;IACNC,IAAI,EAAE,yBAAyB;IAC/B,GAAGD;EACJ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,uBAAuBA,CAAEF,IAAI,EAAG;EAC/C,OAAO;IACNF,IAAI,EAAE,2BAA2B;IACjCE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,IAAIA,CAAA,EAAG;EACtB,OAAO;IACNL,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,KAAKA,CAAA,EAAG;EACvB,OAAO;IACNN,IAAI,EAAE;EACP,CAAC;AACF"}
@@ -2,16 +2,17 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createReduxStore, register } from '@wordpress/data';
5
+
5
6
  /**
6
7
  * Internal dependencies
7
8
  */
8
-
9
9
  import reducer from './reducer';
10
10
  import * as actions from './actions';
11
11
  import * as selectors from './selectors';
12
12
  import * as privateActions from './private-actions';
13
13
  import { unlock } from '../lock-unlock';
14
14
  const STORE_NAME = 'core/commands';
15
+
15
16
  /**
16
17
  * Store definition for the commands namespace.
17
18
  *
@@ -19,7 +20,6 @@ const STORE_NAME = 'core/commands';
19
20
  *
20
21
  * @type {Object}
21
22
  */
22
-
23
23
  export const store = createReduxStore(STORE_NAME, {
24
24
  reducer,
25
25
  actions,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/store/index.js"],"names":["createReduxStore","register","reducer","actions","selectors","privateActions","unlock","STORE_NAME","store","registerPrivateActions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,cAAZ,MAAgC,mBAAhC;AACA,SAASC,MAAT,QAAuB,gBAAvB;AAEA,MAAMC,UAAU,GAAG,eAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,KAAK,GAAGR,gBAAgB,CAAEO,UAAF,EAAc;AAClDL,EAAAA,OADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA;AAHkD,CAAd,CAA9B;AAMPH,QAAQ,CAAEO,KAAF,CAAR;AACAF,MAAM,CAAEE,KAAF,CAAN,CAAgBC,sBAAhB,CAAwCJ,cAAxC","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';\nimport * as privateActions from './private-actions';\nimport { unlock } from '../lock-unlock';\n\nconst STORE_NAME = 'core/commands';\n\n/**\n * Store definition for the commands 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 );\nunlock( store ).registerPrivateActions( privateActions );\n"]}
1
+ {"version":3,"names":["createReduxStore","register","reducer","actions","selectors","privateActions","unlock","STORE_NAME","store","registerPrivateActions"],"sources":["@wordpress/commands/src/store/index.js"],"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';\nimport * as privateActions from './private-actions';\nimport { unlock } from '../lock-unlock';\n\nconst STORE_NAME = 'core/commands';\n\n/**\n * Store definition for the commands 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 );\nunlock( store ).registerPrivateActions( privateActions );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,QAAQ,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAMC,UAAU,GAAG,eAAe;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAGR,gBAAgB,CAAEO,UAAU,EAAE;EAClDL,OAAO;EACPC,OAAO;EACPC;AACD,CAAE,CAAC;AAEHH,QAAQ,CAAEO,KAAM,CAAC;AACjBF,MAAM,CAAEE,KAAM,CAAC,CAACC,sBAAsB,CAAEJ,cAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/store/private-actions.js"],"names":["setContext","context","type"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,UAAT,CAAqBC,OAArB,EAA+B;AACrC,SAAO;AACNC,IAAAA,IAAI,EAAE,aADA;AAEND,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Sets the active context.\n *\n * @param {string} context Context.\n *\n * @return {Object} action.\n */\nexport function setContext( context ) {\n\treturn {\n\t\ttype: 'SET_CONTEXT',\n\t\tcontext,\n\t};\n}\n"]}
1
+ {"version":3,"names":["setContext","context","type"],"sources":["@wordpress/commands/src/store/private-actions.js"],"sourcesContent":["/**\n * Sets the active context.\n *\n * @param {string} context Context.\n *\n * @return {Object} action.\n */\nexport function setContext( context ) {\n\treturn {\n\t\ttype: 'SET_CONTEXT',\n\t\tcontext,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,UAAUA,CAAEC,OAAO,EAAG;EACrC,OAAO;IACNC,IAAI,EAAE,aAAa;IACnBD;EACD,CAAC;AACF"}
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { combineReducers } from '@wordpress/data';
5
+
5
6
  /**
6
7
  * Reducer returning the registered commands
7
8
  *
@@ -10,11 +11,11 @@ import { combineReducers } from '@wordpress/data';
10
11
  *
11
12
  * @return {Object} Updated state.
12
13
  */
13
-
14
14
  function commands(state = {}, action) {
15
15
  switch (action.type) {
16
16
  case 'REGISTER_COMMAND':
17
- return { ...state,
17
+ return {
18
+ ...state,
18
19
  [action.name]: {
19
20
  name: action.name,
20
21
  label: action.label,
@@ -24,7 +25,6 @@ function commands(state = {}, action) {
24
25
  icon: action.icon
25
26
  }
26
27
  };
27
-
28
28
  case 'UNREGISTER_COMMAND':
29
29
  {
30
30
  const {
@@ -34,9 +34,9 @@ function commands(state = {}, action) {
34
34
  return remainingState;
35
35
  }
36
36
  }
37
-
38
37
  return state;
39
38
  }
39
+
40
40
  /**
41
41
  * Reducer returning the command loaders
42
42
  *
@@ -45,19 +45,17 @@ function commands(state = {}, action) {
45
45
  *
46
46
  * @return {Object} Updated state.
47
47
  */
48
-
49
-
50
48
  function commandLoaders(state = {}, action) {
51
49
  switch (action.type) {
52
50
  case 'REGISTER_COMMAND_LOADER':
53
- return { ...state,
51
+ return {
52
+ ...state,
54
53
  [action.name]: {
55
54
  name: action.name,
56
55
  context: action.context,
57
56
  hook: action.hook
58
57
  }
59
58
  };
60
-
61
59
  case 'UNREGISTER_COMMAND_LOADER':
62
60
  {
63
61
  const {
@@ -67,9 +65,9 @@ function commandLoaders(state = {}, action) {
67
65
  return remainingState;
68
66
  }
69
67
  }
70
-
71
68
  return state;
72
69
  }
70
+
73
71
  /**
74
72
  * Reducer returning the command palette open state.
75
73
  *
@@ -78,19 +76,16 @@ function commandLoaders(state = {}, action) {
78
76
  *
79
77
  * @return {boolean} Updated state.
80
78
  */
81
-
82
-
83
79
  function isOpen(state = false, action) {
84
80
  switch (action.type) {
85
81
  case 'OPEN':
86
82
  return true;
87
-
88
83
  case 'CLOSE':
89
84
  return false;
90
85
  }
91
-
92
86
  return state;
93
87
  }
88
+
94
89
  /**
95
90
  * Reducer returning the command palette's active context.
96
91
  *
@@ -99,17 +94,13 @@ function isOpen(state = false, action) {
99
94
  *
100
95
  * @return {boolean} Updated state.
101
96
  */
102
-
103
-
104
97
  function context(state = 'root', action) {
105
98
  switch (action.type) {
106
99
  case 'SET_CONTEXT':
107
100
  return action.context;
108
101
  }
109
-
110
102
  return state;
111
103
  }
112
-
113
104
  const reducer = combineReducers({
114
105
  commands,
115
106
  commandLoaders,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/store/reducer.js"],"names":["combineReducers","commands","state","action","type","name","label","searchLabel","context","callback","icon","_","remainingState","commandLoaders","hook","isOpen","reducer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAmBC,KAAK,GAAG,EAA3B,EAA+BC,MAA/B,EAAwC;AACvC,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,kBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACE,IAAT,GAAiB;AAChBA,UAAAA,IAAI,EAAEF,MAAM,CAACE,IADG;AAEhBC,UAAAA,KAAK,EAAEH,MAAM,CAACG,KAFE;AAGhBC,UAAAA,WAAW,EAAEJ,MAAM,CAACI,WAHJ;AAIhBC,UAAAA,OAAO,EAAEL,MAAM,CAACK,OAJA;AAKhBC,UAAAA,QAAQ,EAAEN,MAAM,CAACM,QALD;AAMhBC,UAAAA,IAAI,EAAEP,MAAM,CAACO;AANG;AAFX,OAAP;;AAWD,SAAK,oBAAL;AAA2B;AAC1B,cAAM;AAAE,WAAEP,MAAM,CAACE,IAAT,GAAiBM,CAAnB;AAAsB,aAAGC;AAAzB,YAA4CV,KAAlD;AACA,eAAOU,cAAP;AACA;AAhBF;;AAmBA,SAAOV,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASW,cAAT,CAAyBX,KAAK,GAAG,EAAjC,EAAqCC,MAArC,EAA8C;AAC7C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACE,IAAT,GAAiB;AAChBA,UAAAA,IAAI,EAAEF,MAAM,CAACE,IADG;AAEhBG,UAAAA,OAAO,EAAEL,MAAM,CAACK,OAFA;AAGhBM,UAAAA,IAAI,EAAEX,MAAM,CAACW;AAHG;AAFX,OAAP;;AAQD,SAAK,2BAAL;AAAkC;AACjC,cAAM;AAAE,WAAEX,MAAM,CAACE,IAAT,GAAiBM,CAAnB;AAAsB,aAAGC;AAAzB,YAA4CV,KAAlD;AACA,eAAOU,cAAP;AACA;AAbF;;AAgBA,SAAOV,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASa,MAAT,CAAiBb,KAAK,GAAG,KAAzB,EAAgCC,MAAhC,EAAyC;AACxC,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,MAAL;AACC,aAAO,IAAP;;AACD,SAAK,OAAL;AACC,aAAO,KAAP;AAJF;;AAOA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,OAAT,CAAkBN,KAAK,GAAG,MAA1B,EAAkCC,MAAlC,EAA2C;AAC1C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,aAAL;AACC,aAAOD,MAAM,CAACK,OAAd;AAFF;;AAKA,SAAON,KAAP;AACA;;AAED,MAAMc,OAAO,GAAGhB,eAAe,CAAE;AAChCC,EAAAA,QADgC;AAEhCY,EAAAA,cAFgC;AAGhCE,EAAAA,MAHgC;AAIhCP,EAAAA;AAJgC,CAAF,CAA/B;AAOA,eAAeQ,OAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the registered commands\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction commands( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_COMMAND':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tname: action.name,\n\t\t\t\t\tlabel: action.label,\n\t\t\t\t\tsearchLabel: action.searchLabel,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\tcallback: action.callback,\n\t\t\t\t\ticon: action.icon,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_COMMAND': {\n\t\t\tconst { [ action.name ]: _, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command loaders\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction commandLoaders( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_COMMAND_LOADER':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tname: action.name,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\thook: action.hook,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_COMMAND_LOADER': {\n\t\t\tconst { [ action.name ]: _, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command palette open state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nfunction isOpen( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN':\n\t\t\treturn true;\n\t\tcase 'CLOSE':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command palette's active context.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nfunction context( state = 'root', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CONTEXT':\n\t\t\treturn action.context;\n\t}\n\n\treturn state;\n}\n\nconst reducer = combineReducers( {\n\tcommands,\n\tcommandLoaders,\n\tisOpen,\n\tcontext,\n} );\n\nexport default reducer;\n"]}
1
+ {"version":3,"names":["combineReducers","commands","state","action","type","name","label","searchLabel","context","callback","icon","_","remainingState","commandLoaders","hook","isOpen","reducer"],"sources":["@wordpress/commands/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the registered commands\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction commands( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_COMMAND':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tname: action.name,\n\t\t\t\t\tlabel: action.label,\n\t\t\t\t\tsearchLabel: action.searchLabel,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\tcallback: action.callback,\n\t\t\t\t\ticon: action.icon,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_COMMAND': {\n\t\t\tconst { [ action.name ]: _, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command loaders\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nfunction commandLoaders( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_COMMAND_LOADER':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: {\n\t\t\t\t\tname: action.name,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\thook: action.hook,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_COMMAND_LOADER': {\n\t\t\tconst { [ action.name ]: _, ...remainingState } = state;\n\t\t\treturn remainingState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command palette open state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nfunction isOpen( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN':\n\t\t\treturn true;\n\t\tcase 'CLOSE':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the command palette's active context.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nfunction context( state = 'root', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CONTEXT':\n\t\t\treturn action.context;\n\t}\n\n\treturn state;\n}\n\nconst reducer = combineReducers( {\n\tcommands,\n\tcommandLoaders,\n\tisOpen,\n\tcontext,\n} );\n\nexport default reducer;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EACvC,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kBAAkB;MACtB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChBA,IAAI,EAAEF,MAAM,CAACE,IAAI;UACjBC,KAAK,EAAEH,MAAM,CAACG,KAAK;UACnBC,WAAW,EAAEJ,MAAM,CAACI,WAAW;UAC/BC,OAAO,EAAEL,MAAM,CAACK,OAAO;UACvBC,QAAQ,EAAEN,MAAM,CAACM,QAAQ;UACzBC,IAAI,EAAEP,MAAM,CAACO;QACd;MACD,CAAC;IACF,KAAK,oBAAoB;MAAE;QAC1B,MAAM;UAAE,CAAEP,MAAM,CAACE,IAAI,GAAIM,CAAC;UAAE,GAAGC;QAAe,CAAC,GAAGV,KAAK;QACvD,OAAOU,cAAc;MACtB;EACD;EAEA,OAAOV,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,cAAcA,CAAEX,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC7C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChBA,IAAI,EAAEF,MAAM,CAACE,IAAI;UACjBG,OAAO,EAAEL,MAAM,CAACK,OAAO;UACvBM,IAAI,EAAEX,MAAM,CAACW;QACd;MACD,CAAC;IACF,KAAK,2BAA2B;MAAE;QACjC,MAAM;UAAE,CAAEX,MAAM,CAACE,IAAI,GAAIM,CAAC;UAAE,GAAGC;QAAe,CAAC,GAAGV,KAAK;QACvD,OAAOU,cAAc;MACtB;EACD;EAEA,OAAOV,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,MAAMA,CAAEb,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACxC,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,MAAM;MACV,OAAO,IAAI;IACZ,KAAK,OAAO;MACX,OAAO,KAAK;EACd;EAEA,OAAOF,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASM,OAAOA,CAAEN,KAAK,GAAG,MAAM,EAAEC,MAAM,EAAG;EAC1C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,aAAa;MACjB,OAAOD,MAAM,CAACK,OAAO;EACvB;EAEA,OAAON,KAAK;AACb;AAEA,MAAMc,OAAO,GAAGhB,eAAe,CAAE;EAChCC,QAAQ;EACRY,cAAc;EACdE,MAAM;EACNP;AACD,CAAE,CAAC;AAEH,eAAeQ,OAAO"}
@@ -2,17 +2,51 @@
2
2
  * External dependencies
3
3
  */
4
4
  import createSelector from 'rememo';
5
+
6
+ /**
7
+ * Returns the registered static commands.
8
+ *
9
+ * @param {Object} state State tree.
10
+ * @param {boolean} contextual Whether to return only contextual commands.
11
+ *
12
+ * @return {import('./actions').WPCommandConfig[]} The list of registered commands.
13
+ */
5
14
  export const getCommands = createSelector((state, contextual = false) => Object.values(state.commands).filter(command => {
6
15
  const isContextual = command.context && command.context === state.context;
7
16
  return contextual ? isContextual : !isContextual;
8
17
  }), state => [state.commands, state.context]);
18
+
19
+ /**
20
+ * Returns the registered command loaders.
21
+ *
22
+ * @param {Object} state State tree.
23
+ * @param {boolean} contextual Whether to return only contextual command loaders.
24
+ *
25
+ * @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.
26
+ */
9
27
  export const getCommandLoaders = createSelector((state, contextual = false) => Object.values(state.commandLoaders).filter(loader => {
10
28
  const isContextual = loader.context && loader.context === state.context;
11
29
  return contextual ? isContextual : !isContextual;
12
30
  }), state => [state.commandLoaders, state.context]);
31
+
32
+ /**
33
+ * Returns whether the command palette is open.
34
+ *
35
+ * @param {Object} state State tree.
36
+ *
37
+ * @return {boolean} Returns whether the command palette is open.
38
+ */
13
39
  export function isOpen(state) {
14
40
  return state.isOpen;
15
41
  }
42
+
43
+ /**
44
+ * Returns whether the active context.
45
+ *
46
+ * @param {Object} state State tree.
47
+ *
48
+ * @return {string} Context.
49
+ */
16
50
  export function getContext(state) {
17
51
  return state.context;
18
52
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/commands/src/store/selectors.js"],"names":["createSelector","getCommands","state","contextual","Object","values","commands","filter","command","isContextual","context","getCommandLoaders","commandLoaders","loader","isOpen","getContext"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA,OAAO,MAAMC,WAAW,GAAGD,cAAc,CACxC,CAAEE,KAAF,EAASC,UAAU,GAAG,KAAtB,KACCC,MAAM,CAACC,MAAP,CAAeH,KAAK,CAACI,QAArB,EAAgCC,MAAhC,CAA0CC,OAAF,IAAe;AACtD,QAAMC,YAAY,GACjBD,OAAO,CAACE,OAAR,IAAmBF,OAAO,CAACE,OAAR,KAAoBR,KAAK,CAACQ,OAD9C;AAEA,SAAOP,UAAU,GAAGM,YAAH,GAAkB,CAAEA,YAArC;AACA,CAJD,CAFuC,EAOtCP,KAAF,IAAa,CAAEA,KAAK,CAACI,QAAR,EAAkBJ,KAAK,CAACQ,OAAxB,CAP2B,CAAlC;AAUP,OAAO,MAAMC,iBAAiB,GAAGX,cAAc,CAC9C,CAAEE,KAAF,EAASC,UAAU,GAAG,KAAtB,KACCC,MAAM,CAACC,MAAP,CAAeH,KAAK,CAACU,cAArB,EAAsCL,MAAtC,CAAgDM,MAAF,IAAc;AAC3D,QAAMJ,YAAY,GACjBI,MAAM,CAACH,OAAP,IAAkBG,MAAM,CAACH,OAAP,KAAmBR,KAAK,CAACQ,OAD5C;AAEA,SAAOP,UAAU,GAAGM,YAAH,GAAkB,CAAEA,YAArC;AACA,CAJD,CAF6C,EAO5CP,KAAF,IAAa,CAAEA,KAAK,CAACU,cAAR,EAAwBV,KAAK,CAACQ,OAA9B,CAPiC,CAAxC;AAUP,OAAO,SAASI,MAAT,CAAiBZ,KAAjB,EAAyB;AAC/B,SAAOA,KAAK,CAACY,MAAb;AACA;AAED,OAAO,SAASC,UAAT,CAAqBb,KAArB,EAA6B;AACnC,SAAOA,KAAK,CAACQ,OAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\nexport const getCommands = createSelector(\n\t( state, contextual = false ) =>\n\t\tObject.values( state.commands ).filter( ( command ) => {\n\t\t\tconst isContextual =\n\t\t\t\tcommand.context && command.context === state.context;\n\t\t\treturn contextual ? isContextual : ! isContextual;\n\t\t} ),\n\t( state ) => [ state.commands, state.context ]\n);\n\nexport const getCommandLoaders = createSelector(\n\t( state, contextual = false ) =>\n\t\tObject.values( state.commandLoaders ).filter( ( loader ) => {\n\t\t\tconst isContextual =\n\t\t\t\tloader.context && loader.context === state.context;\n\t\t\treturn contextual ? isContextual : ! isContextual;\n\t\t} ),\n\t( state ) => [ state.commandLoaders, state.context ]\n);\n\nexport function isOpen( state ) {\n\treturn state.isOpen;\n}\n\nexport function getContext( state ) {\n\treturn state.context;\n}\n"]}
1
+ {"version":3,"names":["createSelector","getCommands","state","contextual","Object","values","commands","filter","command","isContextual","context","getCommandLoaders","commandLoaders","loader","isOpen","getContext"],"sources":["@wordpress/commands/src/store/selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * Returns the registered static commands.\n *\n * @param {Object} state State tree.\n * @param {boolean} contextual Whether to return only contextual commands.\n *\n * @return {import('./actions').WPCommandConfig[]} The list of registered commands.\n */\nexport const getCommands = createSelector(\n\t( state, contextual = false ) =>\n\t\tObject.values( state.commands ).filter( ( command ) => {\n\t\t\tconst isContextual =\n\t\t\t\tcommand.context && command.context === state.context;\n\t\t\treturn contextual ? isContextual : ! isContextual;\n\t\t} ),\n\t( state ) => [ state.commands, state.context ]\n);\n\n/**\n * Returns the registered command loaders.\n *\n * @param {Object} state State tree.\n * @param {boolean} contextual Whether to return only contextual command loaders.\n *\n * @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.\n */\nexport const getCommandLoaders = createSelector(\n\t( state, contextual = false ) =>\n\t\tObject.values( state.commandLoaders ).filter( ( loader ) => {\n\t\t\tconst isContextual =\n\t\t\t\tloader.context && loader.context === state.context;\n\t\t\treturn contextual ? isContextual : ! isContextual;\n\t\t} ),\n\t( state ) => [ state.commandLoaders, state.context ]\n);\n\n/**\n * Returns whether the command palette is open.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Returns whether the command palette is open.\n */\nexport function isOpen( state ) {\n\treturn state.isOpen;\n}\n\n/**\n * Returns whether the active context.\n *\n * @param {Object} state State tree.\n *\n * @return {string} Context.\n */\nexport function getContext( state ) {\n\treturn state.context;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAc,MAAM,QAAQ;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGD,cAAc,CACxC,CAAEE,KAAK,EAAEC,UAAU,GAAG,KAAK,KAC1BC,MAAM,CAACC,MAAM,CAAEH,KAAK,CAACI,QAAS,CAAC,CAACC,MAAM,CAAIC,OAAO,IAAM;EACtD,MAAMC,YAAY,GACjBD,OAAO,CAACE,OAAO,IAAIF,OAAO,CAACE,OAAO,KAAKR,KAAK,CAACQ,OAAO;EACrD,OAAOP,UAAU,GAAGM,YAAY,GAAG,CAAEA,YAAY;AAClD,CAAE,CAAC,EACFP,KAAK,IAAM,CAAEA,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACQ,OAAO,CAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGX,cAAc,CAC9C,CAAEE,KAAK,EAAEC,UAAU,GAAG,KAAK,KAC1BC,MAAM,CAACC,MAAM,CAAEH,KAAK,CAACU,cAAe,CAAC,CAACL,MAAM,CAAIM,MAAM,IAAM;EAC3D,MAAMJ,YAAY,GACjBI,MAAM,CAACH,OAAO,IAAIG,MAAM,CAACH,OAAO,KAAKR,KAAK,CAACQ,OAAO;EACnD,OAAOP,UAAU,GAAGM,YAAY,GAAG,CAAEA,YAAY;AAClD,CAAE,CAAC,EACFP,KAAK,IAAM,CAAEA,KAAK,CAACU,cAAc,EAAEV,KAAK,CAACQ,OAAO,CACnD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,MAAMA,CAAEZ,KAAK,EAAG;EAC/B,OAAOA,KAAK,CAACY,MAAM;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAEb,KAAK,EAAG;EACnC,OAAOA,KAAK,CAACQ,OAAO;AACrB"}
@@ -104,10 +104,17 @@
104
104
  }
105
105
 
106
106
  .commands-command-menu {
107
- width: 100%;
108
- max-width: 480px;
107
+ border-radius: 4px;
108
+ width: calc(100% - 32px);
109
+ margin: auto;
110
+ max-width: 420px;
109
111
  position: relative;
110
- top: 15%;
112
+ top: calc(15% + 60px);
113
+ }
114
+ @media (min-width: 600px) {
115
+ .commands-command-menu {
116
+ top: 15%;
117
+ }
111
118
  }
112
119
  .commands-command-menu .components-modal__content {
113
120
  margin: 0;
@@ -122,6 +129,7 @@
122
129
  .commands-command-menu__header {
123
130
  display: flex;
124
131
  align-items: center;
132
+ padding-right: 16px;
125
133
  }
126
134
  .commands-command-menu__header .components-button {
127
135
  height: 56px;
@@ -142,30 +150,29 @@
142
150
  .commands-command-menu__container [cmdk-input] {
143
151
  border: none;
144
152
  width: 100%;
145
- padding: 16px;
153
+ padding: 16px 8px 16px 16px;
146
154
  outline: none;
147
155
  color: #1e1e1e;
148
156
  margin: 0;
149
- font-size: 20px;
157
+ font-size: 16px;
150
158
  line-height: 28px;
151
- border-bottom: 1px solid #e0e0e0;
152
159
  border-radius: 0;
153
160
  }
154
161
  .commands-command-menu__container [cmdk-input]::placeholder {
155
- color: #949494;
162
+ color: #757575;
156
163
  }
157
164
  .commands-command-menu__container [cmdk-input]:focus {
158
165
  box-shadow: none;
159
166
  outline: none;
160
- border-bottom: 1px solid #e0e0e0;
161
167
  }
162
168
  .commands-command-menu__container [cmdk-item] {
163
- border-radius: 4px;
169
+ border-radius: 2px;
164
170
  cursor: pointer;
165
171
  display: flex;
166
172
  align-items: center;
167
- padding: 8px;
168
173
  color: #1e1e1e;
174
+ font-size: 13px;
175
+ min-height: 40px;
169
176
  }
170
177
  .commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
171
178
  background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
@@ -179,22 +186,29 @@
179
186
  cursor: not-allowed;
180
187
  }
181
188
  .commands-command-menu__container [cmdk-item] svg {
182
- fill: #949494;
189
+ fill: #1e1e1e;
190
+ }
191
+ .commands-command-menu__container [cmdk-item] > div {
192
+ padding: 8px;
193
+ padding-right: 40px;
194
+ }
195
+ .commands-command-menu__container [cmdk-item] > .has-icon {
196
+ padding-right: 8px;
183
197
  }
184
198
  .commands-command-menu__container [cmdk-root] > [cmdk-list] {
185
- max-height: 400px;
199
+ max-height: 368px;
186
200
  overflow: auto;
187
201
  }
188
- .commands-command-menu__container [cmdk-root] > [cmdk-list] > [cmdk-list-sizer] :has([cmdk-group-items]:not(:empty)) {
189
- padding: 8px;
202
+ .commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
203
+ padding: 0 8px 8px;
190
204
  }
191
205
  .commands-command-menu__container [cmdk-empty] {
192
206
  display: flex;
193
207
  align-items: center;
194
208
  justify-content: center;
195
- height: 64px;
196
209
  white-space: pre-wrap;
197
- color: #2f2f2f;
210
+ color: #1e1e1e;
211
+ padding: 8px 0 32px;
198
212
  }
199
213
  .commands-command-menu__container [cmdk-loading] {
200
214
  padding: 16px;
@@ -202,8 +216,12 @@
202
216
  .commands-command-menu__container [cmdk-list-sizer] {
203
217
  position: relative;
204
218
  }
205
- .commands-command-menu__container [cmdk-group]:has([cmdk-group-items]:not(:empty)):not([hidden]) + [cmdk-group]:has([cmdk-group-items]:not(:empty)) {
206
- border-top: 1px solid #e0e0e0;
219
+
220
+ .commands-command-menu__item span {
221
+ display: inline-block;
222
+ overflow: hidden;
223
+ text-overflow: ellipsis;
224
+ white-space: nowrap;
207
225
  }
208
226
 
209
227
  .commands-command-menu__item mark {
@@ -104,10 +104,17 @@
104
104
  }
105
105
 
106
106
  .commands-command-menu {
107
- width: 100%;
108
- max-width: 480px;
107
+ border-radius: 4px;
108
+ width: calc(100% - 32px);
109
+ margin: auto;
110
+ max-width: 420px;
109
111
  position: relative;
110
- top: 15%;
112
+ top: calc(15% + 60px);
113
+ }
114
+ @media (min-width: 600px) {
115
+ .commands-command-menu {
116
+ top: 15%;
117
+ }
111
118
  }
112
119
  .commands-command-menu .components-modal__content {
113
120
  margin: 0;
@@ -122,6 +129,7 @@
122
129
  .commands-command-menu__header {
123
130
  display: flex;
124
131
  align-items: center;
132
+ padding-left: 16px;
125
133
  }
126
134
  .commands-command-menu__header .components-button {
127
135
  height: 56px;
@@ -142,30 +150,29 @@
142
150
  .commands-command-menu__container [cmdk-input] {
143
151
  border: none;
144
152
  width: 100%;
145
- padding: 16px;
153
+ padding: 16px 16px 16px 8px;
146
154
  outline: none;
147
155
  color: #1e1e1e;
148
156
  margin: 0;
149
- font-size: 20px;
157
+ font-size: 16px;
150
158
  line-height: 28px;
151
- border-bottom: 1px solid #e0e0e0;
152
159
  border-radius: 0;
153
160
  }
154
161
  .commands-command-menu__container [cmdk-input]::placeholder {
155
- color: #949494;
162
+ color: #757575;
156
163
  }
157
164
  .commands-command-menu__container [cmdk-input]:focus {
158
165
  box-shadow: none;
159
166
  outline: none;
160
- border-bottom: 1px solid #e0e0e0;
161
167
  }
162
168
  .commands-command-menu__container [cmdk-item] {
163
- border-radius: 4px;
169
+ border-radius: 2px;
164
170
  cursor: pointer;
165
171
  display: flex;
166
172
  align-items: center;
167
- padding: 8px;
168
173
  color: #1e1e1e;
174
+ font-size: 13px;
175
+ min-height: 40px;
169
176
  }
170
177
  .commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
171
178
  background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
@@ -179,22 +186,29 @@
179
186
  cursor: not-allowed;
180
187
  }
181
188
  .commands-command-menu__container [cmdk-item] svg {
182
- fill: #949494;
189
+ fill: #1e1e1e;
190
+ }
191
+ .commands-command-menu__container [cmdk-item] > div {
192
+ padding: 8px;
193
+ padding-left: 40px;
194
+ }
195
+ .commands-command-menu__container [cmdk-item] > .has-icon {
196
+ padding-left: 8px;
183
197
  }
184
198
  .commands-command-menu__container [cmdk-root] > [cmdk-list] {
185
- max-height: 400px;
199
+ max-height: 368px;
186
200
  overflow: auto;
187
201
  }
188
- .commands-command-menu__container [cmdk-root] > [cmdk-list] > [cmdk-list-sizer] :has([cmdk-group-items]:not(:empty)) {
189
- padding: 8px;
202
+ .commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
203
+ padding: 0 8px 8px;
190
204
  }
191
205
  .commands-command-menu__container [cmdk-empty] {
192
206
  display: flex;
193
207
  align-items: center;
194
208
  justify-content: center;
195
- height: 64px;
196
209
  white-space: pre-wrap;
197
- color: #2f2f2f;
210
+ color: #1e1e1e;
211
+ padding: 8px 0 32px;
198
212
  }
199
213
  .commands-command-menu__container [cmdk-loading] {
200
214
  padding: 16px;
@@ -202,8 +216,12 @@
202
216
  .commands-command-menu__container [cmdk-list-sizer] {
203
217
  position: relative;
204
218
  }
205
- .commands-command-menu__container [cmdk-group]:has([cmdk-group-items]:not(:empty)):not([hidden]) + [cmdk-group]:has([cmdk-group-items]:not(:empty)) {
206
- border-top: 1px solid #e0e0e0;
219
+
220
+ .commands-command-menu__item span {
221
+ display: inline-block;
222
+ overflow: hidden;
223
+ text-overflow: ellipsis;
224
+ white-space: nowrap;
207
225
  }
208
226
 
209
227
  .commands-command-menu__item mark {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/commands",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Handles the commands menu.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,21 +27,23 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/components": "^25.5.0",
31
- "@wordpress/data": "^9.9.0",
32
- "@wordpress/element": "^5.16.0",
33
- "@wordpress/i18n": "^4.39.0",
34
- "@wordpress/icons": "^9.30.0",
35
- "@wordpress/keyboard-shortcuts": "^4.16.0",
36
- "@wordpress/private-apis": "^0.21.0",
30
+ "@wordpress/components": "^25.6.0",
31
+ "@wordpress/data": "^9.10.0",
32
+ "@wordpress/element": "^5.17.0",
33
+ "@wordpress/i18n": "^4.40.0",
34
+ "@wordpress/icons": "^9.31.0",
35
+ "@wordpress/keyboard-shortcuts": "^4.17.0",
36
+ "@wordpress/private-apis": "^0.22.0",
37
+ "classnames": "^2.3.1",
37
38
  "cmdk": "^0.2.0",
38
39
  "rememo": "^4.0.2"
39
40
  },
40
41
  "peerDependencies": {
41
- "react": "^18.0.0"
42
+ "react": "^18.0.0",
43
+ "react-dom": "^18.0.0"
42
44
  },
43
45
  "publishConfig": {
44
46
  "access": "public"
45
47
  },
46
- "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
48
+ "gitHead": "78a288d55b83a713b2f7d98d5a855c0771a2afc6"
47
49
  }