@wordpress/commands 0.9.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.
- package/CHANGELOG.md +4 -0
- package/build/components/command-menu.js +67 -46
- package/build/components/command-menu.js.map +1 -1
- package/build/hooks/use-command-context.js +3 -7
- package/build/hooks/use-command-context.js.map +1 -1
- package/build/hooks/use-command-loader.js +0 -4
- package/build/hooks/use-command-loader.js.map +1 -1
- package/build/hooks/use-command.js +0 -4
- package/build/hooks/use-command.js.map +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +1 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +5 -11
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +2 -11
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +0 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +7 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -4
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/command-menu.js +70 -42
- package/build-module/components/command-menu.js.map +1 -1
- package/build-module/hooks/use-command-context.js +5 -4
- package/build-module/hooks/use-command-context.js.map +1 -1
- package/build-module/hooks/use-command-loader.js +2 -2
- package/build-module/hooks/use-command-loader.js.map +1 -1
- package/build-module/hooks/use-command.js +2 -2
- package/build-module/hooks/use-command.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +5 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +2 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +8 -17
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +34 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +36 -18
- package/build-style/style.css +36 -18
- package/package.json +12 -10
- package/src/components/command-menu.js +78 -22
- package/src/components/style.scss +38 -19
- package/src/store/selectors.js +30 -0
package/build/store/index.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.store = void 0;
|
|
9
|
-
|
|
10
8
|
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
9
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
13
|
-
|
|
14
10
|
var actions = _interopRequireWildcard(require("./actions"));
|
|
15
|
-
|
|
16
11
|
var selectors = _interopRequireWildcard(require("./selectors"));
|
|
17
|
-
|
|
18
12
|
var privateActions = _interopRequireWildcard(require("./private-actions"));
|
|
19
|
-
|
|
20
13
|
var _lockUnlock = require("../lock-unlock");
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
* WordPress dependencies
|
|
28
18
|
*/
|
|
@@ -30,7 +20,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
20
|
/**
|
|
31
21
|
* Internal dependencies
|
|
32
22
|
*/
|
|
23
|
+
|
|
33
24
|
const STORE_NAME = 'core/commands';
|
|
25
|
+
|
|
34
26
|
/**
|
|
35
27
|
* Store definition for the commands namespace.
|
|
36
28
|
*
|
|
@@ -38,7 +30,6 @@ const STORE_NAME = 'core/commands';
|
|
|
38
30
|
*
|
|
39
31
|
* @type {Object}
|
|
40
32
|
*/
|
|
41
|
-
|
|
42
33
|
const store = (0, _data.createReduxStore)(STORE_NAME, {
|
|
43
34
|
reducer: _reducer.default,
|
|
44
35
|
actions,
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","privateActions","_lockUnlock","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","STORE_NAME","store","createReduxStore","reducer","exports","register","unlock","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,cAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAAwC,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAZxC;AACA;AACA;;AAGA;AACA;AACA;;AAOA,MAAMW,UAAU,GAAG,eAAe;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,KAAK,GAAG,IAAAC,sBAAgB,EAAEF,UAAU,EAAE;EAClDG,OAAO,EAAPA,gBAAO;EACP9B,OAAO;EACPE;AACD,CAAE,CAAC;AAAC6B,OAAA,CAAAH,KAAA,GAAAA,KAAA;AAEJ,IAAAI,cAAQ,EAAEJ,KAAM,CAAC;AACjB,IAAAK,kBAAM,EAAEL,KAAM,CAAC,CAACM,sBAAsB,CAAE/B,cAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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;AACO,SAASA,UAAUA,CAAEC,OAAO,EAAG;EACrC,OAAO;IACNC,IAAI,EAAE,aAAa;IACnBD;EACD,CAAC;AACF"}
|
package/build/store/reducer.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _data = require("@wordpress/data");
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* WordPress dependencies
|
|
12
10
|
*/
|
|
@@ -22,7 +20,8 @@ var _data = require("@wordpress/data");
|
|
|
22
20
|
function commands(state = {}, action) {
|
|
23
21
|
switch (action.type) {
|
|
24
22
|
case 'REGISTER_COMMAND':
|
|
25
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
...state,
|
|
26
25
|
[action.name]: {
|
|
27
26
|
name: action.name,
|
|
28
27
|
label: action.label,
|
|
@@ -32,7 +31,6 @@ function commands(state = {}, action) {
|
|
|
32
31
|
icon: action.icon
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
case 'UNREGISTER_COMMAND':
|
|
37
35
|
{
|
|
38
36
|
const {
|
|
@@ -42,9 +40,9 @@ function commands(state = {}, action) {
|
|
|
42
40
|
return remainingState;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
return state;
|
|
47
44
|
}
|
|
45
|
+
|
|
48
46
|
/**
|
|
49
47
|
* Reducer returning the command loaders
|
|
50
48
|
*
|
|
@@ -53,19 +51,17 @@ function commands(state = {}, action) {
|
|
|
53
51
|
*
|
|
54
52
|
* @return {Object} Updated state.
|
|
55
53
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
54
|
function commandLoaders(state = {}, action) {
|
|
59
55
|
switch (action.type) {
|
|
60
56
|
case 'REGISTER_COMMAND_LOADER':
|
|
61
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...state,
|
|
62
59
|
[action.name]: {
|
|
63
60
|
name: action.name,
|
|
64
61
|
context: action.context,
|
|
65
62
|
hook: action.hook
|
|
66
63
|
}
|
|
67
64
|
};
|
|
68
|
-
|
|
69
65
|
case 'UNREGISTER_COMMAND_LOADER':
|
|
70
66
|
{
|
|
71
67
|
const {
|
|
@@ -75,9 +71,9 @@ function commandLoaders(state = {}, action) {
|
|
|
75
71
|
return remainingState;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
|
|
79
74
|
return state;
|
|
80
75
|
}
|
|
76
|
+
|
|
81
77
|
/**
|
|
82
78
|
* Reducer returning the command palette open state.
|
|
83
79
|
*
|
|
@@ -86,19 +82,16 @@ function commandLoaders(state = {}, action) {
|
|
|
86
82
|
*
|
|
87
83
|
* @return {boolean} Updated state.
|
|
88
84
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
85
|
function isOpen(state = false, action) {
|
|
92
86
|
switch (action.type) {
|
|
93
87
|
case 'OPEN':
|
|
94
88
|
return true;
|
|
95
|
-
|
|
96
89
|
case 'CLOSE':
|
|
97
90
|
return false;
|
|
98
91
|
}
|
|
99
|
-
|
|
100
92
|
return state;
|
|
101
93
|
}
|
|
94
|
+
|
|
102
95
|
/**
|
|
103
96
|
* Reducer returning the command palette's active context.
|
|
104
97
|
*
|
|
@@ -107,17 +100,13 @@ function isOpen(state = false, action) {
|
|
|
107
100
|
*
|
|
108
101
|
* @return {boolean} Updated state.
|
|
109
102
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
103
|
function context(state = 'root', action) {
|
|
113
104
|
switch (action.type) {
|
|
114
105
|
case 'SET_CONTEXT':
|
|
115
106
|
return action.context;
|
|
116
107
|
}
|
|
117
|
-
|
|
118
108
|
return state;
|
|
119
109
|
}
|
|
120
|
-
|
|
121
110
|
const reducer = (0, _data.combineReducers)({
|
|
122
111
|
commands,
|
|
123
112
|
commandLoaders,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_data","require","commands","state","action","type","name","label","searchLabel","context","callback","icon","_","remainingState","commandLoaders","hook","isOpen","reducer","combineReducers","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;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,GAAG,IAAAC,qBAAe,EAAE;EAChChB,QAAQ;EACRY,cAAc;EACdE,MAAM;EACNP;AACD,CAAE,CAAC;AAAC,IAAAU,QAAA,GAEWF,OAAO;AAAAG,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/build/store/selectors.js
CHANGED
|
@@ -1,34 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.getCommands = exports.getCommandLoaders = void 0;
|
|
9
8
|
exports.getContext = getContext;
|
|
10
9
|
exports.isOpen = isOpen;
|
|
11
|
-
|
|
12
10
|
var _rememo = _interopRequireDefault(require("rememo"));
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* External dependencies
|
|
16
13
|
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns the registered static commands.
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} state State tree.
|
|
19
|
+
* @param {boolean} contextual Whether to return only contextual commands.
|
|
20
|
+
*
|
|
21
|
+
* @return {import('./actions').WPCommandConfig[]} The list of registered commands.
|
|
22
|
+
*/
|
|
17
23
|
const getCommands = (0, _rememo.default)((state, contextual = false) => Object.values(state.commands).filter(command => {
|
|
18
24
|
const isContextual = command.context && command.context === state.context;
|
|
19
25
|
return contextual ? isContextual : !isContextual;
|
|
20
26
|
}), state => [state.commands, state.context]);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the registered command loaders.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} state State tree.
|
|
32
|
+
* @param {boolean} contextual Whether to return only contextual command loaders.
|
|
33
|
+
*
|
|
34
|
+
* @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.
|
|
35
|
+
*/
|
|
21
36
|
exports.getCommands = getCommands;
|
|
22
37
|
const getCommandLoaders = (0, _rememo.default)((state, contextual = false) => Object.values(state.commandLoaders).filter(loader => {
|
|
23
38
|
const isContextual = loader.context && loader.context === state.context;
|
|
24
39
|
return contextual ? isContextual : !isContextual;
|
|
25
40
|
}), state => [state.commandLoaders, state.context]);
|
|
26
|
-
exports.getCommandLoaders = getCommandLoaders;
|
|
27
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the command palette is open.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} state State tree.
|
|
46
|
+
*
|
|
47
|
+
* @return {boolean} Returns whether the command palette is open.
|
|
48
|
+
*/
|
|
49
|
+
exports.getCommandLoaders = getCommandLoaders;
|
|
28
50
|
function isOpen(state) {
|
|
29
51
|
return state.isOpen;
|
|
30
52
|
}
|
|
31
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Returns whether the active context.
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} state State tree.
|
|
58
|
+
*
|
|
59
|
+
* @return {string} Context.
|
|
60
|
+
*/
|
|
32
61
|
function getContext(state) {
|
|
33
62
|
return state.context;
|
|
34
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_rememo","_interopRequireDefault","require","getCommands","createSelector","state","contextual","Object","values","commands","filter","command","isContextual","context","exports","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":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAG,IA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|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* External dependencies
|
|
5
4
|
*/
|
|
6
|
-
import { Command } from 'cmdk';
|
|
5
|
+
import { Command, useCommandState } from 'cmdk';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* WordPress dependencies
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { useState, useEffect, useRef, useCallback } from '@wordpress/element';
|
|
12
|
+
import { useState, useEffect, useRef, useCallback, useMemo } from '@wordpress/element';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { Modal, TextHighlight, __experimentalHStack as HStack } from '@wordpress/components';
|
|
15
15
|
import { store as keyboardShortcutsStore, useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
16
|
-
import { Icon } from '@wordpress/icons';
|
|
16
|
+
import { Icon, search as inputIcon } from '@wordpress/icons';
|
|
17
|
+
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
21
|
import { store as commandsStore } from '../store';
|
|
22
|
-
|
|
23
22
|
function CommandMenuLoader({
|
|
24
23
|
name,
|
|
25
24
|
search,
|
|
@@ -28,7 +27,6 @@ function CommandMenuLoader({
|
|
|
28
27
|
close
|
|
29
28
|
}) {
|
|
30
29
|
var _hook;
|
|
31
|
-
|
|
32
30
|
const {
|
|
33
31
|
isLoading,
|
|
34
32
|
commands = []
|
|
@@ -38,24 +36,24 @@ function CommandMenuLoader({
|
|
|
38
36
|
useEffect(() => {
|
|
39
37
|
setLoader(name, isLoading);
|
|
40
38
|
}, [setLoader, name, isLoading]);
|
|
41
|
-
|
|
42
39
|
if (!commands.length) {
|
|
43
40
|
return null;
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
return createElement(Fragment, null, createElement(Command.List, null, commands.map(command => {
|
|
47
43
|
var _command$searchLabel;
|
|
48
|
-
|
|
49
44
|
return createElement(Command.Item, {
|
|
50
45
|
key: command.name,
|
|
51
46
|
value: (_command$searchLabel = command.searchLabel) !== null && _command$searchLabel !== void 0 ? _command$searchLabel : command.label,
|
|
52
47
|
onSelect: () => command.callback({
|
|
53
48
|
close
|
|
54
|
-
})
|
|
49
|
+
}),
|
|
50
|
+
id: command.name
|
|
55
51
|
}, createElement(HStack, {
|
|
56
52
|
alignment: "left",
|
|
57
|
-
className:
|
|
58
|
-
|
|
53
|
+
className: classnames('commands-command-menu__item', {
|
|
54
|
+
'has-icon': command.icon
|
|
55
|
+
})
|
|
56
|
+
}, command.icon && createElement(Icon, {
|
|
59
57
|
icon: command.icon
|
|
60
58
|
}), createElement("span", null, createElement(TextHighlight, {
|
|
61
59
|
text: command.label,
|
|
@@ -63,7 +61,6 @@ function CommandMenuLoader({
|
|
|
63
61
|
}))));
|
|
64
62
|
})));
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
export function CommandMenuLoaderWrapper({
|
|
68
65
|
hook,
|
|
69
66
|
search,
|
|
@@ -110,24 +107,24 @@ export function CommandMenuGroup({
|
|
|
110
107
|
loaders: getCommandLoaders(isContextual)
|
|
111
108
|
};
|
|
112
109
|
}, [isContextual]);
|
|
113
|
-
|
|
114
110
|
if (!commands.length && !loaders.length) {
|
|
115
111
|
return null;
|
|
116
112
|
}
|
|
117
|
-
|
|
118
113
|
return createElement(Command.Group, null, commands.map(command => {
|
|
119
114
|
var _command$searchLabel2;
|
|
120
|
-
|
|
121
115
|
return createElement(Command.Item, {
|
|
122
116
|
key: command.name,
|
|
123
117
|
value: (_command$searchLabel2 = command.searchLabel) !== null && _command$searchLabel2 !== void 0 ? _command$searchLabel2 : command.label,
|
|
124
118
|
onSelect: () => command.callback({
|
|
125
119
|
close
|
|
126
|
-
})
|
|
120
|
+
}),
|
|
121
|
+
id: command.name
|
|
127
122
|
}, createElement(HStack, {
|
|
128
123
|
alignment: "left",
|
|
129
|
-
className:
|
|
130
|
-
|
|
124
|
+
className: classnames('commands-command-menu__item', {
|
|
125
|
+
'has-icon': command.icon
|
|
126
|
+
})
|
|
127
|
+
}, command.icon && createElement(Icon, {
|
|
131
128
|
icon: command.icon
|
|
132
129
|
}), createElement("span", null, createElement(TextHighlight, {
|
|
133
130
|
text: command.label,
|
|
@@ -141,6 +138,32 @@ export function CommandMenuGroup({
|
|
|
141
138
|
close: close
|
|
142
139
|
})));
|
|
143
140
|
}
|
|
141
|
+
function CommandInput({
|
|
142
|
+
isOpen,
|
|
143
|
+
search,
|
|
144
|
+
setSearch
|
|
145
|
+
}) {
|
|
146
|
+
const commandMenuInput = useRef();
|
|
147
|
+
const _value = useCommandState(state => state.value);
|
|
148
|
+
const selectedItemId = useMemo(() => {
|
|
149
|
+
const item = document.querySelector(`[cmdk-item=""][data-value="${_value}"]`);
|
|
150
|
+
return item?.getAttribute('id');
|
|
151
|
+
}, [_value]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
// Focus the command palette input when mounting the modal.
|
|
154
|
+
if (isOpen) {
|
|
155
|
+
commandMenuInput.current.focus();
|
|
156
|
+
}
|
|
157
|
+
}, [isOpen]);
|
|
158
|
+
return createElement(Command.Input, {
|
|
159
|
+
ref: commandMenuInput,
|
|
160
|
+
value: search,
|
|
161
|
+
onValueChange: setSearch,
|
|
162
|
+
placeholder: __('Search for commands'),
|
|
163
|
+
"aria-activedescendant": selectedItemId,
|
|
164
|
+
icon: search
|
|
165
|
+
});
|
|
166
|
+
}
|
|
144
167
|
export function CommandMenu() {
|
|
145
168
|
const {
|
|
146
169
|
registerShortcut
|
|
@@ -152,21 +175,22 @@ export function CommandMenu() {
|
|
|
152
175
|
close
|
|
153
176
|
} = useDispatch(commandsStore);
|
|
154
177
|
const [loaders, setLoaders] = useState({});
|
|
155
|
-
const commandMenuInput = useRef();
|
|
156
178
|
useEffect(() => {
|
|
157
179
|
registerShortcut({
|
|
158
180
|
name: 'core/commands',
|
|
159
181
|
category: 'global',
|
|
160
|
-
description: __('Open the command palette'),
|
|
182
|
+
description: __('Open the command palette.'),
|
|
161
183
|
keyCombination: {
|
|
162
184
|
modifier: 'primary',
|
|
163
185
|
character: 'k'
|
|
164
186
|
}
|
|
165
187
|
});
|
|
166
188
|
}, [registerShortcut]);
|
|
167
|
-
useShortcut('core/commands',
|
|
189
|
+
useShortcut('core/commands', /** @type {import('react').KeyboardEventHandler} */
|
|
190
|
+
event => {
|
|
191
|
+
// Bails to avoid obscuring the effect of the preceding handler(s).
|
|
192
|
+
if (event.defaultPrevented) return;
|
|
168
193
|
event.preventDefault();
|
|
169
|
-
|
|
170
194
|
if (isOpen) {
|
|
171
195
|
close();
|
|
172
196
|
} else {
|
|
@@ -175,26 +199,28 @@ export function CommandMenu() {
|
|
|
175
199
|
}, {
|
|
176
200
|
bindGlobal: true
|
|
177
201
|
});
|
|
178
|
-
const setLoader = useCallback((name, value) => setLoaders(current => ({
|
|
202
|
+
const setLoader = useCallback((name, value) => setLoaders(current => ({
|
|
203
|
+
...current,
|
|
179
204
|
[name]: value
|
|
180
205
|
})), []);
|
|
181
|
-
|
|
182
206
|
const closeAndReset = () => {
|
|
183
207
|
setSearch('');
|
|
184
208
|
close();
|
|
185
209
|
};
|
|
186
|
-
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
// Focus the command palette input when mounting the modal.
|
|
189
|
-
if (isOpen) {
|
|
190
|
-
commandMenuInput.current.focus();
|
|
191
|
-
}
|
|
192
|
-
}, [isOpen]);
|
|
193
|
-
|
|
194
210
|
if (!isOpen) {
|
|
195
211
|
return false;
|
|
196
212
|
}
|
|
197
|
-
|
|
213
|
+
const onKeyDown = event => {
|
|
214
|
+
if (
|
|
215
|
+
// Ignore keydowns from IMEs
|
|
216
|
+
event.nativeEvent.isComposing ||
|
|
217
|
+
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
|
|
218
|
+
// is `isComposing=false`, even though it's technically still part of the composition.
|
|
219
|
+
// These can only be detected by keyCode.
|
|
220
|
+
event.keyCode === 229) {
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
198
224
|
const isLoading = Object.values(loaders).some(Boolean);
|
|
199
225
|
return createElement(Modal, {
|
|
200
226
|
className: "commands-command-menu",
|
|
@@ -204,14 +230,16 @@ export function CommandMenu() {
|
|
|
204
230
|
}, createElement("div", {
|
|
205
231
|
className: "commands-command-menu__container"
|
|
206
232
|
}, createElement(Command, {
|
|
207
|
-
label: __('Command palette')
|
|
233
|
+
label: __('Command palette'),
|
|
234
|
+
onKeyDown: onKeyDown
|
|
208
235
|
}, createElement("div", {
|
|
209
236
|
className: "commands-command-menu__header"
|
|
210
|
-
}, createElement(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
}, createElement(Icon, {
|
|
238
|
+
icon: inputIcon
|
|
239
|
+
}), createElement(CommandInput, {
|
|
240
|
+
search: search,
|
|
241
|
+
setSearch: setSearch,
|
|
242
|
+
isOpen: isOpen
|
|
215
243
|
})), createElement(Command.List, null, search && !isLoading && createElement(Command.Empty, null, __('No results found.')), createElement(CommandMenuGroup, {
|
|
216
244
|
search: search,
|
|
217
245
|
setLoader: setLoader,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/commands/src/components/command-menu.js"],"names":["Command","useSelect","useDispatch","useState","useEffect","useRef","useCallback","__","Modal","TextHighlight","__experimentalHStack","HStack","store","keyboardShortcutsStore","useShortcut","Icon","commandsStore","CommandMenuLoader","name","search","hook","setLoader","close","isLoading","commands","length","map","command","searchLabel","label","callback","icon","CommandMenuLoaderWrapper","currentLoader","key","setKey","current","prevKey","CommandMenuGroup","isContextual","loaders","select","getCommands","getCommandLoaders","loader","CommandMenu","registerShortcut","setSearch","isOpen","open","setLoaders","commandMenuInput","category","description","keyCombination","modifier","character","event","preventDefault","bindGlobal","value","closeAndReset","focus","Object","values","some","Boolean"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,MAAxB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HT;AAIC,IAAA,YAAY;AAJb,IAND,EAYG1C,MAAM,IACP,cAAC,gBAAD;AACC,IAAA,MAAM,EAAGA,MADV;AAEC,IAAA,SAAS,EAAGE,SAFb;AAGC,IAAA,KAAK,EAAGwC;AAHT,IAbF,CATD,CADD,CAND,CADD;AAyCA","sourcesContent":["/**\n * External dependencies\n */\nimport { Command } from 'cmdk';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tModal,\n\tTextHighlight,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport {\n\tstore as keyboardShortcutsStore,\n\tuseShortcut,\n} from '@wordpress/keyboard-shortcuts';\nimport { Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\nfunction CommandMenuLoader( { name, search, hook, setLoader, close } ) {\n\tconst { isLoading, commands = [] } = hook( { search } ) ?? {};\n\tuseEffect( () => {\n\t\tsetLoader( name, isLoading );\n\t}, [ setLoader, name, isLoading ] );\n\n\tif ( ! commands.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Command.List>\n\t\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t\t<Command.Item\n\t\t\t\t\t\tkey={ command.name }\n\t\t\t\t\t\tvalue={ command.searchLabel ?? command.label }\n\t\t\t\t\t\tonSelect={ () => command.callback( { close } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tclassName=\"commands-command-menu__item\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon icon={ command.icon } />\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Command.Item>\n\t\t\t\t) ) }\n\t\t\t</Command.List>\n\t\t</>\n\t);\n}\n\nexport function CommandMenuLoaderWrapper( { hook, search, setLoader, close } ) {\n\t// The \"hook\" prop is actually a custom React hook\n\t// so to avoid breaking the rules of hooks\n\t// the CommandMenuLoaderWrapper component need to be\n\t// remounted on each hook prop change\n\t// We use the key state to make sure we do that properly.\n\tconst currentLoader = useRef( hook );\n\tconst [ key, setKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( currentLoader.current !== hook ) {\n\t\t\tcurrentLoader.current = hook;\n\t\t\tsetKey( ( prevKey ) => prevKey + 1 );\n\t\t}\n\t}, [ hook ] );\n\n\treturn (\n\t\t<CommandMenuLoader\n\t\t\tkey={ key }\n\t\t\thook={ currentLoader.current }\n\t\t\tsearch={ search }\n\t\t\tsetLoader={ setLoader }\n\t\t\tclose={ close }\n\t\t/>\n\t);\n}\n\nexport function CommandMenuGroup( { isContextual, search, setLoader, close } ) {\n\tconst { commands, loaders } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCommands, getCommandLoaders } = select( commandsStore );\n\t\t\treturn {\n\t\t\t\tcommands: getCommands( isContextual ),\n\t\t\t\tloaders: getCommandLoaders( isContextual ),\n\t\t\t};\n\t\t},\n\t\t[ isContextual ]\n\t);\n\n\tif ( ! commands.length && ! loaders.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Command.Group>\n\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t<Command.Item\n\t\t\t\t\tkey={ command.name }\n\t\t\t\t\tvalue={ command.searchLabel ?? command.label }\n\t\t\t\t\tonSelect={ () => command.callback( { close } ) }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\tclassName=\"commands-command-menu__item\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ command.icon } />\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</HStack>\n\t\t\t\t</Command.Item>\n\t\t\t) ) }\n\t\t\t{ loaders.map( ( loader ) => (\n\t\t\t\t<CommandMenuLoaderWrapper\n\t\t\t\t\tkey={ loader.name }\n\t\t\t\t\thook={ loader.hook }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\tclose={ close }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Command.Group>\n\t);\n}\n\nexport function CommandMenu() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst isOpen = useSelect(\n\t\t( select ) => select( commandsStore ).isOpen(),\n\t\t[]\n\t);\n\tconst { open, close } = useDispatch( commandsStore );\n\tconst [ loaders, setLoaders ] = useState( {} );\n\tconst commandMenuInput = useRef();\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/commands',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the command palette' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'k',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/commands',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\tif ( isOpen ) {\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\topen();\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tbindGlobal: true,\n\t\t}\n\t);\n\n\tconst setLoader = useCallback(\n\t\t( name, value ) =>\n\t\t\tsetLoaders( ( current ) => ( {\n\t\t\t\t...current,\n\t\t\t\t[ name ]: value,\n\t\t\t} ) ),\n\t\t[]\n\t);\n\tconst closeAndReset = () => {\n\t\tsetSearch( '' );\n\t\tclose();\n\t};\n\n\tuseEffect( () => {\n\t\t// Focus the command palette input when mounting the modal.\n\t\tif ( isOpen ) {\n\t\t\tcommandMenuInput.current.focus();\n\t\t}\n\t}, [ isOpen ] );\n\n\tif ( ! isOpen ) {\n\t\treturn false;\n\t}\n\tconst isLoading = Object.values( loaders ).some( Boolean );\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"commands-command-menu\"\n\t\t\toverlayClassName=\"commands-command-menu__overlay\"\n\t\t\tonRequestClose={ closeAndReset }\n\t\t\t__experimentalHideHeader\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command label={ __( 'Command palette' ) }>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\n\t\t\t\t\t\t<Command.Input\n\t\t\t\t\t\t\tref={ commandMenuInput }\n\t\t\t\t\t\t\tvalue={ search }\n\t\t\t\t\t\t\tonValueChange={ setSearch }\n\t\t\t\t\t\t\tplaceholder={ __( 'Type a command or search' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Command.List>\n\t\t\t\t\t\t{ search && ! isLoading && (\n\t\t\t\t\t\t\t<Command.Empty>\n\t\t\t\t\t\t\t\t{ __( 'No results found.' ) }\n\t\t\t\t\t\t\t</Command.Empty>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<CommandMenuGroup\n\t\t\t\t\t\t\tsearch={ search }\n\t\t\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\t\t\tclose={ closeAndReset }\n\t\t\t\t\t\t\tisContextual\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ search && (\n\t\t\t\t\t\t\t<CommandMenuGroup\n\t\t\t\t\t\t\t\tsearch={ search }\n\t\t\t\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\t\t\t\tclose={ closeAndReset }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Command.List>\n\t\t\t\t</Command>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"names":["Command","useCommandState","classnames","useSelect","useDispatch","useState","useEffect","useRef","useCallback","useMemo","__","Modal","TextHighlight","__experimentalHStack","HStack","store","keyboardShortcutsStore","useShortcut","Icon","search","inputIcon","commandsStore","CommandMenuLoader","name","hook","setLoader","close","_hook","isLoading","commands","length","createElement","Fragment","List","map","command","_command$searchLabel","Item","key","value","searchLabel","label","onSelect","callback","id","alignment","className","icon","text","highlight","CommandMenuLoaderWrapper","currentLoader","setKey","current","prevKey","CommandMenuGroup","isContextual","loaders","select","getCommands","getCommandLoaders","Group","_command$searchLabel2","loader","CommandInput","isOpen","setSearch","commandMenuInput","_value","state","selectedItemId","item","document","querySelector","getAttribute","focus","Input","ref","onValueChange","placeholder","CommandMenu","registerShortcut","open","setLoaders","category","description","keyCombination","modifier","character","event","defaultPrevented","preventDefault","bindGlobal","closeAndReset","onKeyDown","nativeEvent","isComposing","keyCode","Object","values","some","Boolean","overlayClassName","onRequestClose","__experimentalHideHeader","Empty"],"sources":["@wordpress/commands/src/components/command-menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Command, useCommandState } from 'cmdk';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tModal,\n\tTextHighlight,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport {\n\tstore as keyboardShortcutsStore,\n\tuseShortcut,\n} from '@wordpress/keyboard-shortcuts';\nimport { Icon, search as inputIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\nfunction CommandMenuLoader( { name, search, hook, setLoader, close } ) {\n\tconst { isLoading, commands = [] } = hook( { search } ) ?? {};\n\tuseEffect( () => {\n\t\tsetLoader( name, isLoading );\n\t}, [ setLoader, name, isLoading ] );\n\n\tif ( ! commands.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Command.List>\n\t\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t\t<Command.Item\n\t\t\t\t\t\tkey={ command.name }\n\t\t\t\t\t\tvalue={ command.searchLabel ?? command.label }\n\t\t\t\t\t\tonSelect={ () => command.callback( { close } ) }\n\t\t\t\t\t\tid={ command.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'commands-command-menu__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-icon': command.icon,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ command.icon && <Icon icon={ command.icon } /> }\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Command.Item>\n\t\t\t\t) ) }\n\t\t\t</Command.List>\n\t\t</>\n\t);\n}\n\nexport function CommandMenuLoaderWrapper( { hook, search, setLoader, close } ) {\n\t// The \"hook\" prop is actually a custom React hook\n\t// so to avoid breaking the rules of hooks\n\t// the CommandMenuLoaderWrapper component need to be\n\t// remounted on each hook prop change\n\t// We use the key state to make sure we do that properly.\n\tconst currentLoader = useRef( hook );\n\tconst [ key, setKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( currentLoader.current !== hook ) {\n\t\t\tcurrentLoader.current = hook;\n\t\t\tsetKey( ( prevKey ) => prevKey + 1 );\n\t\t}\n\t}, [ hook ] );\n\n\treturn (\n\t\t<CommandMenuLoader\n\t\t\tkey={ key }\n\t\t\thook={ currentLoader.current }\n\t\t\tsearch={ search }\n\t\t\tsetLoader={ setLoader }\n\t\t\tclose={ close }\n\t\t/>\n\t);\n}\n\nexport function CommandMenuGroup( { isContextual, search, setLoader, close } ) {\n\tconst { commands, loaders } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCommands, getCommandLoaders } = select( commandsStore );\n\t\t\treturn {\n\t\t\t\tcommands: getCommands( isContextual ),\n\t\t\t\tloaders: getCommandLoaders( isContextual ),\n\t\t\t};\n\t\t},\n\t\t[ isContextual ]\n\t);\n\n\tif ( ! commands.length && ! loaders.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Command.Group>\n\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t<Command.Item\n\t\t\t\t\tkey={ command.name }\n\t\t\t\t\tvalue={ command.searchLabel ?? command.label }\n\t\t\t\t\tonSelect={ () => command.callback( { close } ) }\n\t\t\t\t\tid={ command.name }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\tclassName={ classnames( 'commands-command-menu__item', {\n\t\t\t\t\t\t\t'has-icon': command.icon,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ command.icon && <Icon icon={ command.icon } /> }\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</HStack>\n\t\t\t\t</Command.Item>\n\t\t\t) ) }\n\t\t\t{ loaders.map( ( loader ) => (\n\t\t\t\t<CommandMenuLoaderWrapper\n\t\t\t\t\tkey={ loader.name }\n\t\t\t\t\thook={ loader.hook }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\tclose={ close }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Command.Group>\n\t);\n}\n\nfunction CommandInput( { isOpen, search, setSearch } ) {\n\tconst commandMenuInput = useRef();\n\tconst _value = useCommandState( ( state ) => state.value );\n\tconst selectedItemId = useMemo( () => {\n\t\tconst item = document.querySelector(\n\t\t\t`[cmdk-item=\"\"][data-value=\"${ _value }\"]`\n\t\t);\n\t\treturn item?.getAttribute( 'id' );\n\t}, [ _value ] );\n\tuseEffect( () => {\n\t\t// Focus the command palette input when mounting the modal.\n\t\tif ( isOpen ) {\n\t\t\tcommandMenuInput.current.focus();\n\t\t}\n\t}, [ isOpen ] );\n\treturn (\n\t\t<Command.Input\n\t\t\tref={ commandMenuInput }\n\t\t\tvalue={ search }\n\t\t\tonValueChange={ setSearch }\n\t\t\tplaceholder={ __( 'Search for commands' ) }\n\t\t\taria-activedescendant={ selectedItemId }\n\t\t\ticon={ search }\n\t\t/>\n\t);\n}\n\nexport function CommandMenu() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst isOpen = useSelect(\n\t\t( select ) => select( commandsStore ).isOpen(),\n\t\t[]\n\t);\n\tconst { open, close } = useDispatch( commandsStore );\n\tconst [ loaders, setLoaders ] = useState( {} );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/commands',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the command palette.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'k',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/commands',\n\t\t/** @type {import('react').KeyboardEventHandler} */\n\t\t( event ) => {\n\t\t\t// Bails to avoid obscuring the effect of the preceding handler(s).\n\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\tevent.preventDefault();\n\t\t\tif ( isOpen ) {\n\t\t\t\tclose();\n\t\t\t} else {\n\t\t\t\topen();\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tbindGlobal: true,\n\t\t}\n\t);\n\n\tconst setLoader = useCallback(\n\t\t( name, value ) =>\n\t\t\tsetLoaders( ( current ) => ( {\n\t\t\t\t...current,\n\t\t\t\t[ name ]: value,\n\t\t\t} ) ),\n\t\t[]\n\t);\n\tconst closeAndReset = () => {\n\t\tsetSearch( '' );\n\t\tclose();\n\t};\n\n\tif ( ! isOpen ) {\n\t\treturn false;\n\t}\n\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.nativeEvent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLoading = Object.values( loaders ).some( Boolean );\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"commands-command-menu\"\n\t\t\toverlayClassName=\"commands-command-menu__overlay\"\n\t\t\tonRequestClose={ closeAndReset }\n\t\t\t__experimentalHideHeader\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command\n\t\t\t\t\tlabel={ __( 'Command palette' ) }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\n\t\t\t\t\t\t<Icon icon={ inputIcon } />\n\t\t\t\t\t\t<CommandInput\n\t\t\t\t\t\t\tsearch={ search }\n\t\t\t\t\t\t\tsetSearch={ setSearch }\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Command.List>\n\t\t\t\t\t\t{ search && ! isLoading && (\n\t\t\t\t\t\t\t<Command.Empty>\n\t\t\t\t\t\t\t\t{ __( 'No results found.' ) }\n\t\t\t\t\t\t\t</Command.Empty>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<CommandMenuGroup\n\t\t\t\t\t\t\tsearch={ search }\n\t\t\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\t\t\tclose={ closeAndReset }\n\t\t\t\t\t\t\tisContextual\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ search && (\n\t\t\t\t\t\t\t<CommandMenuGroup\n\t\t\t\t\t\t\t\tsearch={ search }\n\t\t\t\t\t\t\t\tsetLoader={ setLoader }\n\t\t\t\t\t\t\t\tclose={ closeAndReset }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Command.List>\n\t\t\t\t</Command>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,eAAe,QAAQ,MAAM;AAC/C,OAAOC,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,QAAQ,EACRC,SAAS,EACTC,MAAM,EACNC,WAAW,EACXC,OAAO,QACD,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,KAAK,EACLC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SACCC,KAAK,IAAIC,sBAAsB,EAC/BC,WAAW,QACL,+BAA+B;AACtC,SAASC,IAAI,EAAEC,MAAM,IAAIC,SAAS,QAAQ,kBAAkB;;AAE5D;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,UAAU;AAEjD,SAASC,iBAAiBA,CAAE;EAAEC,IAAI;EAAEJ,MAAM;EAAEK,IAAI;EAAEC,SAAS;EAAEC;AAAM,CAAC,EAAG;EAAA,IAAAC,KAAA;EACtE,MAAM;IAAEC,SAAS;IAAEC,QAAQ,GAAG;EAAG,CAAC,IAAAF,KAAA,GAAGH,IAAI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aAAe;IAChCW,wBAAwB;EAAA,GAExBzE,aAAA;IAAKe,SAAS,EAAC;EAAkC,GAChDf,aAAA,CAAC/B,OAAO;IACPyC,KAAK,EAAG/B,EAAE,CAAE,iBAAkB,CAAG;IACjCoF,SAAS,EAAGA;EAAW,GAEvB/D,aAAA;IAAKe,SAAS,EAAC;EAA+B,GAC7Cf,aAAA,CAACb,IAAI;IAAC6B,IAAI,EAAG3B;EAAW,CAAE,CAAC,EAC3BW,aAAA,CAACiC,YAAY;IACZ7C,MAAM,EAAGA,MAAQ;IACjB+C,SAAS,EAAGA,SAAW;IACvBD,MAAM,EAAGA;EAAQ,CACjB,CACG,CAAC,EACNlC,aAAA,CAAC/B,OAAO,CAACiC,IAAI,QACVd,MAAM,IAAI,CAAES,SAAS,IACtBG,aAAA,CAAC/B,OAAO,CAACyG,KAAK,QACX/F,EAAE,CAAE,mBAAoB,CACZ,CACf,EACDqB,aAAA,CAACwB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBM,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGmE,aAAe;IACvBrC,YAAY;EAAA,CACZ,CAAC,EACArC,MAAM,IACPY,aAAA,CAACwB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBM,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGmE;EAAe,CACvB,CAEW,CACN,CACL,CACC,CAAC;AAEV"}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect, useRef } from '@wordpress/element';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
import { store as commandsStore } from '../store';
|
|
11
11
|
import { unlock } from '../lock-unlock';
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Sets the active context of the command palette
|
|
14
15
|
*
|
|
15
16
|
* @param {string} context Context to set.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
export default function useCommandContext(context) {
|
|
19
19
|
const {
|
|
20
20
|
getContext
|
|
@@ -25,9 +25,10 @@ export default function useCommandContext(context) {
|
|
|
25
25
|
} = unlock(useDispatch(commandsStore));
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
setContext(context);
|
|
28
|
-
}, [context, setContext]);
|
|
29
|
-
// that was set before the component actually mounts.
|
|
28
|
+
}, [context, setContext]);
|
|
30
29
|
|
|
30
|
+
// This effects ensures that on unmount, we restore the context
|
|
31
|
+
// that was set before the component actually mounts.
|
|
31
32
|
useEffect(() => {
|
|
32
33
|
const initialContextRef = initialContext.current;
|
|
33
34
|
return () => setContext(initialContextRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useDispatch","useSelect","store","commandsStore","unlock","useCommandContext","context","getContext","initialContext","setContext","initialContextRef","current"],"sources":["@wordpress/commands/src/hooks/use-command-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Sets the active context of the command palette\n *\n * @param {string} context Context to set.\n */\nexport default function useCommandContext( context ) {\n\tconst { getContext } = useSelect( commandsStore );\n\tconst initialContext = useRef( getContext() );\n\tconst { setContext } = unlock( useDispatch( commandsStore ) );\n\n\tuseEffect( () => {\n\t\tsetContext( context );\n\t}, [ context, setContext ] );\n\n\t// This effects ensures that on unmount, we restore the context\n\t// that was set before the component actually mounts.\n\tuseEffect( () => {\n\t\tconst initialContextRef = initialContext.current;\n\t\treturn () => setContext( initialContextRef );\n\t}, [ setContext ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,UAAU;AACjD,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,iBAAiBA,CAAEC,OAAO,EAAG;EACpD,MAAM;IAAEC;EAAW,CAAC,GAAGN,SAAS,CAAEE,aAAc,CAAC;EACjD,MAAMK,cAAc,GAAGT,MAAM,CAAEQ,UAAU,CAAC,CAAE,CAAC;EAC7C,MAAM;IAAEE;EAAW,CAAC,GAAGL,MAAM,CAAEJ,WAAW,CAAEG,aAAc,CAAE,CAAC;EAE7DL,SAAS,CAAE,MAAM;IAChBW,UAAU,CAAEH,OAAQ,CAAC;EACtB,CAAC,EAAE,CAAEA,OAAO,EAAEG,UAAU,CAAG,CAAC;;EAE5B;EACA;EACAX,SAAS,CAAE,MAAM;IAChB,MAAMY,iBAAiB,GAAGF,cAAc,CAACG,OAAO;IAChD,OAAO,MAAMF,UAAU,CAAEC,iBAAkB,CAAC;EAC7C,CAAC,EAAE,CAAED,UAAU,CAAG,CAAC;AACpB"}
|