@wordpress/commands 1.41.1-next.v.202603161435.0 → 1.43.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 +8 -1
- package/build/components/command-menu.cjs +156 -154
- package/build/components/command-menu.cjs.map +3 -3
- package/build/components/use-recent-commands.cjs +125 -0
- package/build/components/use-recent-commands.cjs.map +7 -0
- package/build/store/index.cjs +2 -0
- package/build/store/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +11 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +32 -0
- package/build/store/private-selectors.cjs.map +7 -0
- package/build/store/reducer.cjs +12 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build-module/components/command-menu.mjs +160 -154
- package/build-module/components/command-menu.mjs.map +2 -2
- package/build-module/components/use-recent-commands.mjs +104 -0
- package/build-module/components/use-recent-commands.mjs.map +7 -0
- package/build-module/store/index.mjs +2 -0
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +9 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +8 -0
- package/build-module/store/private-selectors.mjs.map +7 -0
- package/build-module/store/reducer.mjs +12 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-style/style-rtl.css +25 -21
- package/build-style/style.css +25 -21
- package/package.json +12 -11
- package/src/components/command-menu.js +179 -161
- package/src/components/style.scss +32 -29
- package/src/components/use-recent-commands.js +131 -0
- package/src/store/index.js +2 -0
- package/src/store/private-actions.js +16 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/reducer.js +13 -0
package/src/store/index.js
CHANGED
|
@@ -10,6 +10,7 @@ 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
|
+
import * as privateSelectors from './private-selectors';
|
|
13
14
|
import { unlock } from '../lock-unlock';
|
|
14
15
|
|
|
15
16
|
const STORE_NAME = 'core/commands';
|
|
@@ -37,3 +38,4 @@ export const store = createReduxStore( STORE_NAME, {
|
|
|
37
38
|
|
|
38
39
|
register( store );
|
|
39
40
|
unlock( store ).registerPrivateActions( privateActions );
|
|
41
|
+
unlock( store ).registerPrivateSelectors( privateSelectors );
|
|
@@ -11,3 +11,19 @@ export function setContext( context ) {
|
|
|
11
11
|
context,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sets whether a command loader is currently loading.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} name Command loader name.
|
|
19
|
+
* @param {boolean} isLoading Whether the loader is loading.
|
|
20
|
+
*
|
|
21
|
+
* @return {Object} action.
|
|
22
|
+
*/
|
|
23
|
+
export function setLoaderLoading( name, isLoading ) {
|
|
24
|
+
return {
|
|
25
|
+
type: 'SET_LOADER_LOADING',
|
|
26
|
+
name,
|
|
27
|
+
isLoading,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether any command loader is currently loading.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} state State tree.
|
|
5
|
+
*
|
|
6
|
+
* @return {boolean} Whether any loader is loading.
|
|
7
|
+
*/
|
|
8
|
+
export function isLoading( state ) {
|
|
9
|
+
return Object.values( state.loaderStates ).some( Boolean );
|
|
10
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -101,11 +101,24 @@ function context( state = 'root', action ) {
|
|
|
101
101
|
return state;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
function loaderStates( state = {}, action ) {
|
|
105
|
+
switch ( action.type ) {
|
|
106
|
+
case 'SET_LOADER_LOADING':
|
|
107
|
+
return {
|
|
108
|
+
...state,
|
|
109
|
+
[ action.name ]: action.isLoading,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return state;
|
|
114
|
+
}
|
|
115
|
+
|
|
104
116
|
const reducer = combineReducers( {
|
|
105
117
|
commands,
|
|
106
118
|
commandLoaders,
|
|
107
119
|
isOpen,
|
|
108
120
|
context,
|
|
121
|
+
loaderStates,
|
|
109
122
|
} );
|
|
110
123
|
|
|
111
124
|
export default reducer;
|