UNPKG

@wordpress/commands

Version:
30 lines (29 loc) 935 B
// packages/commands/src/store/selectors.js import { createSelector } from "@wordpress/data"; var getCommands = createSelector( (state, contextual = false) => Object.values(state.commands).filter((command) => { const isContextual = command.context && command.context === state.context; return contextual ? isContextual : !isContextual; }), (state) => [state.commands, state.context] ); var getCommandLoaders = createSelector( (state, contextual = false) => Object.values(state.commandLoaders).filter((loader) => { const isContextual = loader.context && loader.context === state.context; return contextual ? isContextual : !isContextual; }), (state) => [state.commandLoaders, state.context] ); function isOpen(state) { return state.isOpen; } function getContext(state) { return state.context; } export { getCommandLoaders, getCommands, getContext, isOpen }; //# sourceMappingURL=selectors.js.map