@wordpress/commands 0.25.0 → 0.27.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 +4 -4
- package/build/components/command-menu.js.map +1 -1
- package/build/hooks/use-command-context.js.map +1 -1
- package/build/hooks/use-command-loader.js.map +1 -1
- package/build/hooks/use-command.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +4 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/command-menu.js +4 -4
- package/build-module/components/command-menu.js.map +1 -1
- package/build-module/hooks/use-command-context.js.map +1 -1
- package/build-module/hooks/use-command-loader.js.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +13 -10
- package/build-style/style.css +13 -10
- package/package.json +10 -11
- package/src/components/command-menu.js +2 -2
- package/src/components/style.scss +14 -9
- package/src/store/selectors.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -29,7 +29,7 @@ var _store = require("../store");
|
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
const inputLabel = (0, _i18n.__)('Search
|
|
32
|
+
const inputLabel = (0, _i18n.__)('Search commands and settings');
|
|
33
33
|
function CommandMenuLoader({
|
|
34
34
|
name,
|
|
35
35
|
search,
|
|
@@ -258,12 +258,12 @@ function CommandMenu() {
|
|
|
258
258
|
onKeyDown: onKeyDown
|
|
259
259
|
}, (0, _react.createElement)("div", {
|
|
260
260
|
className: "commands-command-menu__header"
|
|
261
|
-
}, (0, _react.createElement)(
|
|
262
|
-
icon: _icons.search
|
|
263
|
-
}), (0, _react.createElement)(CommandInput, {
|
|
261
|
+
}, (0, _react.createElement)(CommandInput, {
|
|
264
262
|
search: search,
|
|
265
263
|
setSearch: setSearch,
|
|
266
264
|
isOpen: isOpen
|
|
265
|
+
}), (0, _react.createElement)(_icons.Icon, {
|
|
266
|
+
icon: _icons.search
|
|
267
267
|
})), (0, _react.createElement)(_cmdk.Command.List, {
|
|
268
268
|
ref: commandListRef
|
|
269
269
|
}, search && !isLoading && (0, _react.createElement)(_cmdk.Command.Empty, null, (0, _i18n.__)('No results found.')), (0, _react.createElement)(CommandMenuGroup, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cmdk","require","_classnames","_interopRequireDefault","_data","_element","_i18n","_components","_keyboardShortcuts","_icons","_store","inputLabel","__","CommandMenuLoader","name","search","hook","setLoader","close","_hook","isLoading","commands","useEffect","length","_react","createElement","Fragment","map","command","_command$searchLabel","Command","Item","key","value","searchLabel","label","onSelect","callback","id","__experimentalHStack","alignment","className","classnames","icon","Icon","TextHighlight","text","highlight","CommandMenuLoaderWrapper","currentLoader","useRef","setKey","useState","current","prevKey","CommandMenuGroup","isContextual","loaders","useSelect","select","getCommands","getCommandLoaders","commandsStore","Group","_command$searchLabel2","loader","CommandInput","isOpen","setSearch","commandMenuInput","_value","useCommandState","state","selectedItemId","useMemo","item","document","querySelector","getAttribute","focus","Input","ref","onValueChange","placeholder","CommandMenu","registerShortcut","useDispatch","keyboardShortcutsStore","open","setLoaders","commandListRef","category","description","keyCombination","modifier","character","removeAttribute","setAttribute","useShortcut","event","defaultPrevented","preventDefault","bindGlobal","useCallback","closeAndReset","onKeyDown","nativeEvent","isComposing","keyCode","Object","values","some","Boolean","Modal","overlayClassName","onRequestClose","__experimentalHideHeader","contentLabel","inputIcon","List","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\nconst inputLabel = __( 'Search for commands' );\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{ 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</>\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={ inputLabel }\n\t\t\taria-activedescendant={ selectedItemId }\n\t\t\ticon={ search }\n\t\t/>\n\t);\n}\n\n/**\n * @ignore\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 commandListRef = 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\t// Temporary fix for the suggestions Listbox labeling.\n\t// See https://github.com/pacocoursey/cmdk/issues/196\n\tuseEffect( () => {\n\t\tcommandListRef.current?.removeAttribute( 'aria-labelledby' );\n\t\tcommandListRef.current?.setAttribute(\n\t\t\t'aria-label',\n\t\t\t__( 'Command suggestions' )\n\t\t);\n\t}, [ commandListRef.current ] );\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\tcontentLabel={ __( 'Command palette' ) }\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command label={ inputLabel } onKeyDown={ onKeyDown }>\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 ref={ commandListRef }>\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"],"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AS,MAAA,CAAAC,aAAA,EAAC8B,gBAAgB;IAChBxC,MAAM,EAAGA,MAAQ;IACjBE,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGsF;EAAe,CACvB,CAEW,CACN,CACL,CACC,CAAC;AAEV"}
|
|
1
|
+
{"version":3,"names":["_cmdk","require","_classnames","_interopRequireDefault","_data","_element","_i18n","_components","_keyboardShortcuts","_icons","_store","inputLabel","__","CommandMenuLoader","name","search","hook","setLoader","close","_hook","isLoading","commands","useEffect","length","_react","createElement","Fragment","map","command","_command$searchLabel","Command","Item","key","value","searchLabel","label","onSelect","callback","id","__experimentalHStack","alignment","className","classnames","icon","Icon","TextHighlight","text","highlight","CommandMenuLoaderWrapper","currentLoader","useRef","setKey","useState","current","prevKey","CommandMenuGroup","isContextual","loaders","useSelect","select","getCommands","getCommandLoaders","commandsStore","Group","_command$searchLabel2","loader","CommandInput","isOpen","setSearch","commandMenuInput","_value","useCommandState","state","selectedItemId","useMemo","item","document","querySelector","getAttribute","focus","Input","ref","onValueChange","placeholder","CommandMenu","registerShortcut","useDispatch","keyboardShortcutsStore","open","setLoaders","commandListRef","category","description","keyCombination","modifier","character","removeAttribute","setAttribute","useShortcut","event","defaultPrevented","preventDefault","bindGlobal","useCallback","closeAndReset","onKeyDown","nativeEvent","isComposing","keyCode","Object","values","some","Boolean","Modal","overlayClassName","onRequestClose","__experimentalHideHeader","contentLabel","inputIcon","List","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\nconst inputLabel = __( 'Search commands and settings' );\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{ 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</>\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={ inputLabel }\n\t\t\taria-activedescendant={ selectedItemId }\n\t\t\ticon={ search }\n\t\t/>\n\t);\n}\n\n/**\n * @ignore\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 commandListRef = 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\t// Temporary fix for the suggestions Listbox labeling.\n\t// See https://github.com/pacocoursey/cmdk/issues/196\n\tuseEffect( () => {\n\t\tcommandListRef.current?.removeAttribute( 'aria-labelledby' );\n\t\tcommandListRef.current?.setAttribute(\n\t\t\t'aria-label',\n\t\t\t__( 'Command suggestions' )\n\t\t);\n\t}, [ commandListRef.current ] );\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\tcontentLabel={ __( 'Command palette' ) }\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command label={ inputLabel } onKeyDown={ onKeyDown }>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\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\t<Icon icon={ inputIcon } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<Command.List ref={ commandListRef }>\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":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,kBAAA,GAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAqBA;AACA;AACA;;AAGA,MAAMU,UAAU,GAAG,IAAAC,QAAE,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AAA8B,OAAO;IAACK,KAAK,EAAGxB,UAAY;IAAC8F,SAAS,EAAGA;EAAW,GACpD,IAAAjF,MAAA,CAAAC,aAAA;IAAKgB,SAAS,EAAC;EAA+B,GAC7C,IAAAjB,MAAA,CAAAC,aAAA,EAACyC,YAAY;IACZnD,MAAM,EAAGA,MAAQ;IACjBqD,SAAS,EAAGA,SAAW;IACvBD,MAAM,EAAGA;EAAQ,CACjB,CAAC,EACF,IAAA3C,MAAA,CAAAC,aAAA,EAAChB,MAAA,CAAAmC,IAAI;IAACD,IAAI,EAAG2E;EAAW,CAAE,CACtB,CAAC,EACN,IAAA9F,MAAA,CAAAC,aAAA,EAACzB,KAAA,CAAA8B,OAAO,CAACyF,IAAI;IAACtC,GAAG,EAAGS;EAAgB,GACjC3E,MAAM,IAAI,CAAEK,SAAS,IACtB,IAAAI,MAAA,CAAAC,aAAA,EAACzB,KAAA,CAAA8B,OAAO,CAAC0F,KAAK,QACX,IAAA5G,QAAE,EAAE,mBAAoB,CACZ,CACf,EACD,IAAAY,MAAA,CAAAC,aAAA,EAAC8B,gBAAgB;IAChBxC,MAAM,EAAGA,MAAQ;IACjBE,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGsF,aAAe;IACvBhD,YAAY;EAAA,CACZ,CAAC,EACAzC,MAAM,IACP,IAAAS,MAAA,CAAAC,aAAA,EAAC8B,gBAAgB;IAChBxC,MAAM,EAAGA,MAAQ;IACjBE,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGsF;EAAe,CACvB,CAEW,CACN,CACL,CACC,CAAC;AAEV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_store","_lockUnlock","useCommandContext","context","getContext","useSelect","commandsStore","initialContext","useRef","setContext","unlock","useDispatch","useEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACe,SAASI,iBAAiBA,CAAEC,OAAO,EAAG;EACpD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAc,CAAC;EACjD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAEJ,UAAU,CAAC,CAAE,CAAC;EAC7C,MAAM;IAAEK;EAAW,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,EAAEL,YAAc,CAAE,CAAC;EAE7D,IAAAM,kBAAS,EAAE,MAAM;IAChBH,UAAU,CAAEN,OAAQ,CAAC;EACtB,CAAC,EAAE,CAAEA,OAAO,EAAEM,UAAU,CAAG,CAAC;;EAE5B;EACA;EACA,IAAAG,kBAAS,EAAE,MAAM;IAChB,MAAMC,iBAAiB,GAAGN,cAAc,CAACO,OAAO;IAChD,OAAO,MAAML,UAAU,CAAEI,iBAAkB,CAAC;EAC7C,CAAC,EAAE,CAAEJ,UAAU,CAAG,CAAC;AACpB"}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_store","_lockUnlock","useCommandContext","context","getContext","useSelect","commandsStore","initialContext","useRef","setContext","unlock","useDispatch","useEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACe,SAASI,iBAAiBA,CAAEC,OAAO,EAAG;EACpD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAc,CAAC;EACjD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAEJ,UAAU,CAAC,CAAE,CAAC;EAC7C,MAAM;IAAEK;EAAW,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,EAAEL,YAAc,CAAE,CAAC;EAE7D,IAAAM,kBAAS,EAAE,MAAM;IAChBH,UAAU,CAAEN,OAAQ,CAAC;EACtB,CAAC,EAAE,CAAEA,OAAO,EAAEM,UAAU,CAAG,CAAC;;EAE5B;EACA;EACA,IAAAG,kBAAS,EAAE,MAAM;IAChB,MAAMC,iBAAiB,GAAGN,cAAc,CAACO,OAAO;IAChD,OAAO,MAAML,UAAU,CAAEI,iBAAkB,CAAC;EAC7C,CAAC,EAAE,CAAEJ,UAAU,CAAG,CAAC;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_store","useCommandLoader","loader","registerCommandLoader","unregisterCommandLoader","useDispatch","commandsStore","useEffect","disabled","name","hook","context"],"sources":["@wordpress/commands/src/hooks/use-command-loader.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command loader to the command palette. Used for dynamic commands.\n *\n * @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.\n *\n * @example\n * ```js\n * import { useCommandLoader } from '@wordpress/commands';\n * import { post, page, layout, symbolFilled } from '@wordpress/icons';\n *\n * const icons = {\n * post,\n * page,\n * wp_template: layout,\n * wp_template_part: symbolFilled,\n * };\n *\n * function usePageSearchCommandLoader( { search } ) {\n * // Retrieve the pages for the \"search\" term.\n * const { records, isLoading } = useSelect( ( select ) => {\n * const { getEntityRecords } = select( coreStore );\n * const query = {\n * search: !! search ? search : undefined,\n * per_page: 10,\n * orderby: search ? 'relevance' : 'date',\n * };\n * return {\n * records: getEntityRecords( 'postType', 'page', query ),\n * isLoading: ! select( coreStore ).hasFinishedResolution(\n * 'getEntityRecords',\n * 'postType', 'page', query ]\n * ),\n * };\n * }, [ search ] );\n *\n * // Create the commands.\n * const commands = useMemo( () => {\n * return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n * return {\n * name: record.title?.rendered + ' ' + record.id,\n * label: record.title?.rendered\n * ? record.title?.rendered\n * : __( '(no title)' ),\n * icon: icons[ postType ],\n * callback: ( { close } ) => {\n * const args = {\n * postType,\n * postId: record.id,\n * ...extraArgs,\n * };\n * document.location = addQueryArgs( 'site-editor.php', args );\n * close();\n * },\n * };\n * } );\n * }, [ records, history ] );\n *\n * return {\n * commands,\n * isLoading,\n * };\n * }\n *\n * useCommandLoader( {\n * name: 'myplugin/page-search',\n * hook: usePageSearchCommandLoader,\n * } );\n * ```\n */\nexport default function useCommandLoader( loader ) {\n\tconst { registerCommandLoader, unregisterCommandLoader } =\n\t\tuseDispatch( commandsStore );\n\tuseEffect( () => {\n\t\tif ( loader.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommandLoader( {\n\t\t\tname: loader.name,\n\t\t\thook: loader.hook,\n\t\t\tcontext: loader.context,\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommandLoader( loader.name );\n\t\t};\n\t}, [\n\t\tloader.name,\n\t\tloader.hook,\n\t\tloader.context,\n\t\tloader.disabled,\n\t\tregisterCommandLoader,\n\t\tunregisterCommandLoader,\n\t] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,gBAAgBA,CAAEC,MAAM,EAAG;EAClD,MAAM;IAAEC,qBAAqB;IAAEC;EAAwB,CAAC,GACvD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,MAAM,CAACM,QAAQ,EAAG;MACtB;IACD;IACAL,qBAAqB,CAAE;MACtBM,IAAI,EAAEP,MAAM,CAACO,IAAI;MACjBC,IAAI,EAAER,MAAM,CAACQ,IAAI;MACjBC,OAAO,EAAET,MAAM,CAACS;IACjB,CAAE,CAAC;IACH,OAAO,MAAM;MACZP,uBAAuB,CAAEF,MAAM,CAACO,IAAK,CAAC;IACvC,CAAC;EACF,CAAC,EAAE,CACFP,MAAM,CAACO,IAAI,EACXP,MAAM,CAACQ,IAAI,EACXR,MAAM,CAACS,OAAO,EACdT,MAAM,CAACM,QAAQ,EACfL,qBAAqB,EACrBC,uBAAuB,CACtB,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_store","useCommandLoader","loader","registerCommandLoader","unregisterCommandLoader","useDispatch","commandsStore","useEffect","disabled","name","hook","context"],"sources":["@wordpress/commands/src/hooks/use-command-loader.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command loader to the command palette. Used for dynamic commands.\n *\n * @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.\n *\n * @example\n * ```js\n * import { useCommandLoader } from '@wordpress/commands';\n * import { post, page, layout, symbolFilled } from '@wordpress/icons';\n *\n * const icons = {\n * post,\n * page,\n * wp_template: layout,\n * wp_template_part: symbolFilled,\n * };\n *\n * function usePageSearchCommandLoader( { search } ) {\n * // Retrieve the pages for the \"search\" term.\n * const { records, isLoading } = useSelect( ( select ) => {\n * const { getEntityRecords } = select( coreStore );\n * const query = {\n * search: !! search ? search : undefined,\n * per_page: 10,\n * orderby: search ? 'relevance' : 'date',\n * };\n * return {\n * records: getEntityRecords( 'postType', 'page', query ),\n * isLoading: ! select( coreStore ).hasFinishedResolution(\n * 'getEntityRecords',\n * 'postType', 'page', query ]\n * ),\n * };\n * }, [ search ] );\n *\n * // Create the commands.\n * const commands = useMemo( () => {\n * return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n * return {\n * name: record.title?.rendered + ' ' + record.id,\n * label: record.title?.rendered\n * ? record.title?.rendered\n * : __( '(no title)' ),\n * icon: icons[ postType ],\n * callback: ( { close } ) => {\n * const args = {\n * postType,\n * postId: record.id,\n * ...extraArgs,\n * };\n * document.location = addQueryArgs( 'site-editor.php', args );\n * close();\n * },\n * };\n * } );\n * }, [ records, history ] );\n *\n * return {\n * commands,\n * isLoading,\n * };\n * }\n *\n * useCommandLoader( {\n * name: 'myplugin/page-search',\n * hook: usePageSearchCommandLoader,\n * } );\n * ```\n */\nexport default function useCommandLoader( loader ) {\n\tconst { registerCommandLoader, unregisterCommandLoader } =\n\t\tuseDispatch( commandsStore );\n\tuseEffect( () => {\n\t\tif ( loader.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommandLoader( {\n\t\t\tname: loader.name,\n\t\t\thook: loader.hook,\n\t\t\tcontext: loader.context,\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommandLoader( loader.name );\n\t\t};\n\t}, [\n\t\tloader.name,\n\t\tloader.hook,\n\t\tloader.context,\n\t\tloader.disabled,\n\t\tregisterCommandLoader,\n\t\tunregisterCommandLoader,\n\t] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,gBAAgBA,CAAEC,MAAM,EAAG;EAClD,MAAM;IAAEC,qBAAqB;IAAEC;EAAwB,CAAC,GACvD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,MAAM,CAACM,QAAQ,EAAG;MACtB;IACD;IACAL,qBAAqB,CAAE;MACtBM,IAAI,EAAEP,MAAM,CAACO,IAAI;MACjBC,IAAI,EAAER,MAAM,CAACQ,IAAI;MACjBC,OAAO,EAAET,MAAM,CAACS;IACjB,CAAE,CAAC;IACH,OAAO,MAAM;MACZP,uBAAuB,CAAEF,MAAM,CAACO,IAAK,CAAC;IACvC,CAAC;EACF,CAAC,EAAE,CACFP,MAAM,CAACO,IAAI,EACXP,MAAM,CAACQ,IAAI,EACXR,MAAM,CAACS,OAAO,EACdT,MAAM,CAACM,QAAQ,EACfL,qBAAqB,EACrBC,uBAAuB,CACtB,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_store","useCommand","command","registerCommand","unregisterCommand","useDispatch","commandsStore","currentCallback","useRef","callback","useEffect","current","disabled","name","context","label","searchLabel","icon","args"],"sources":["@wordpress/commands/src/hooks/use-command.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command to the command palette. Used for static commands.\n *\n * @param {import('../store/actions').WPCommandConfig} command command config.\n *\n * @example\n * ```js\n * import { useCommand } from '@wordpress/commands';\n * import { plus } from '@wordpress/icons';\n *\n * useCommand( {\n * name: 'myplugin/my-command-name',\n * label: __( 'Add new post' ),\n *\t icon: plus,\n * callback: ({ close }) => {\n * document.location.href = 'post-new.php';\n * close();\n * },\n * } );\n * ```\n */\nexport default function useCommand( command ) {\n\tconst { registerCommand, unregisterCommand } = useDispatch( commandsStore );\n\tconst currentCallback = useRef( command.callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = command.callback;\n\t}, [ command.callback ] );\n\n\tuseEffect( () => {\n\t\tif ( command.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommand( {\n\t\t\tname: command.name,\n\t\t\tcontext: command.context,\n\t\t\tlabel: command.label,\n\t\t\tsearchLabel: command.searchLabel,\n\t\t\ticon: command.icon,\n\t\t\tcallback: ( ...args ) => currentCallback.current( ...args ),\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommand( command.name );\n\t\t};\n\t}, [\n\t\tcommand.name,\n\t\tcommand.label,\n\t\tcommand.searchLabel,\n\t\tcommand.icon,\n\t\tcommand.context,\n\t\tcommand.disabled,\n\t\tregisterCommand,\n\t\tunregisterCommand,\n\t] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,UAAUA,CAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC3E,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAEN,OAAO,CAACO,QAAS,CAAC;EAClD,IAAAC,kBAAS,EAAE,MAAM;IAChBH,eAAe,CAACI,OAAO,GAAGT,OAAO,CAACO,QAAQ;EAC3C,CAAC,EAAE,CAAEP,OAAO,CAACO,QAAQ,CAAG,CAAC;EAEzB,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,OAAO,CAACU,QAAQ,EAAG;MACvB;IACD;IACAT,eAAe,CAAE;MAChBU,IAAI,EAAEX,OAAO,CAACW,IAAI;MAClBC,OAAO,EAAEZ,OAAO,CAACY,OAAO;MACxBC,KAAK,EAAEb,OAAO,CAACa,KAAK;MACpBC,WAAW,EAAEd,OAAO,CAACc,WAAW;MAChCC,IAAI,EAAEf,OAAO,CAACe,IAAI;MAClBR,QAAQ,EAAEA,CAAE,GAAGS,IAAI,KAAMX,eAAe,CAACI,OAAO,CAAE,GAAGO,IAAK;IAC3D,CAAE,CAAC;IACH,OAAO,MAAM;MACZd,iBAAiB,CAAEF,OAAO,CAACW,IAAK,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,CACFX,OAAO,CAACW,IAAI,EACZX,OAAO,CAACa,KAAK,EACbb,OAAO,CAACc,WAAW,EACnBd,OAAO,CAACe,IAAI,EACZf,OAAO,CAACY,OAAO,EACfZ,OAAO,CAACU,QAAQ,EAChBT,eAAe,EACfC,iBAAiB,CAChB,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_store","useCommand","command","registerCommand","unregisterCommand","useDispatch","commandsStore","currentCallback","useRef","callback","useEffect","current","disabled","name","context","label","searchLabel","icon","args"],"sources":["@wordpress/commands/src/hooks/use-command.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command to the command palette. Used for static commands.\n *\n * @param {import('../store/actions').WPCommandConfig} command command config.\n *\n * @example\n * ```js\n * import { useCommand } from '@wordpress/commands';\n * import { plus } from '@wordpress/icons';\n *\n * useCommand( {\n * name: 'myplugin/my-command-name',\n * label: __( 'Add new post' ),\n *\t icon: plus,\n * callback: ({ close }) => {\n * document.location.href = 'post-new.php';\n * close();\n * },\n * } );\n * ```\n */\nexport default function useCommand( command ) {\n\tconst { registerCommand, unregisterCommand } = useDispatch( commandsStore );\n\tconst currentCallback = useRef( command.callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = command.callback;\n\t}, [ command.callback ] );\n\n\tuseEffect( () => {\n\t\tif ( command.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommand( {\n\t\t\tname: command.name,\n\t\t\tcontext: command.context,\n\t\t\tlabel: command.label,\n\t\t\tsearchLabel: command.searchLabel,\n\t\t\ticon: command.icon,\n\t\t\tcallback: ( ...args ) => currentCallback.current( ...args ),\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommand( command.name );\n\t\t};\n\t}, [\n\t\tcommand.name,\n\t\tcommand.label,\n\t\tcommand.searchLabel,\n\t\tcommand.icon,\n\t\tcommand.context,\n\t\tcommand.disabled,\n\t\tregisterCommand,\n\t\tunregisterCommand,\n\t] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,UAAUA,CAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC3E,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAEN,OAAO,CAACO,QAAS,CAAC;EAClD,IAAAC,kBAAS,EAAE,MAAM;IAChBH,eAAe,CAACI,OAAO,GAAGT,OAAO,CAACO,QAAQ;EAC3C,CAAC,EAAE,CAAEP,OAAO,CAACO,QAAQ,CAAG,CAAC;EAEzB,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,OAAO,CAACU,QAAQ,EAAG;MACvB;IACD;IACAT,eAAe,CAAE;MAChBU,IAAI,EAAEX,OAAO,CAACW,IAAI;MAClBC,OAAO,EAAEZ,OAAO,CAACY,OAAO;MACxBC,KAAK,EAAEb,OAAO,CAACa,KAAK;MACpBC,WAAW,EAAEd,OAAO,CAACc,WAAW;MAChCC,IAAI,EAAEf,OAAO,CAACe,IAAI;MAClBR,QAAQ,EAAEA,CAAE,GAAGS,IAAI,KAAMX,eAAe,CAACI,OAAO,CAAE,GAAGO,IAAK;IAC3D,CAAE,CAAC;IACH,OAAO,MAAM;MACZd,iBAAiB,CAAEF,OAAO,CAACW,IAAK,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,CACFX,OAAO,CAACW,IAAI,EACZX,OAAO,CAACa,KAAK,EACbb,OAAO,CAACc,WAAW,EACnBd,OAAO,CAACe,IAAI,EACZf,OAAO,CAACY,OAAO,EACfZ,OAAO,CAACU,QAAQ,EAChBT,eAAe,EACfC,iBAAiB,CAChB,CAAC;AACJ","ignoreList":[]}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_commandMenu","require","_privateApis","_useCommand","_interopRequireDefault","_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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA"}
|
|
1
|
+
{"version":3,"names":["_commandMenu","require","_privateApis","_useCommand","_interopRequireDefault","_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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA","ignoreList":[]}
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"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 theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/commands'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,qBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"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 theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/commands'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,qBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useCommandContext","_interopRequireDefault","require","_lockUnlock","privateApis","exports","lock","useCommandContext"],"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\n/**\n * @private\n */\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommandContext,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,iBAAiB,EAAjBA;AACD,CAAE,CAAC"}
|
|
1
|
+
{"version":3,"names":["_useCommandContext","_interopRequireDefault","require","_lockUnlock","privateApis","exports","lock","useCommandContext"],"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\n/**\n * @private\n */\nexport const privateApis = {};\nlock( privateApis, {\n\tuseCommandContext,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,iBAAiB,EAAjBA;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 * @property {boolean} disabled Whether to disable the command.\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 * @property {boolean} disabled Whether to disable the command loader.\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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,MAAM,EAAG;EACzC,OAAO;IACNC,IAAI,EAAE,kBAAkB;IACxB,GAAGD;EACJ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,OAAO;IACNF,IAAI,EAAE,oBAAoB;IAC1BE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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;AACO,SAASK,uBAAuBA,CAAEF,IAAI,EAAG;EAC/C,OAAO;IACNF,IAAI,EAAE,2BAA2B;IACjCE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,IAAIA,CAAA,EAAG;EACtB,OAAO;IACNL,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,KAAKA,CAAA,EAAG;EACvB,OAAO;IACNN,IAAI,EAAE;EACP,CAAC;AACF"}
|
|
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 * @property {boolean} disabled Whether to disable the command.\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 * @property {boolean} disabled Whether to disable the command loader.\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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,MAAM,EAAG;EACzC,OAAO;IACNC,IAAI,EAAE,kBAAkB;IACxB,GAAGD;EACJ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,OAAO;IACNF,IAAI,EAAE,oBAAoB;IAC1BE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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;AACO,SAASK,uBAAuBA,CAAEF,IAAI,EAAG;EAC/C,OAAO;IACNF,IAAI,EAAE,2BAA2B;IACjCE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,IAAIA,CAAA,EAAG;EACtB,OAAO;IACNL,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,KAAKA,CAAA,EAAG;EACvB,OAAO;IACNN,IAAI,EAAE;EACP,CAAC;AACF","ignoreList":[]}
|
package/build/store/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var selectors = _interopRequireWildcard(require("./selectors"));
|
|
|
12
12
|
var privateActions = _interopRequireWildcard(require("./private-actions"));
|
|
13
13
|
var _lockUnlock = require("../lock-unlock");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
/**
|
|
17
17
|
* WordPress dependencies
|
|
18
18
|
*/
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","privateActions","_lockUnlock","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","privateActions","_lockUnlock","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","STORE_NAME","store","exports","createReduxStore","reducer","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 *\n * @example\n * ```js\n * import { store as commandsStore } from '@wordpress/commands';\n * import { useDispatch } from '@wordpress/data';\n * ...\n * const { open: openCommandCenter } = useDispatch( commandsStore );\n * ```\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,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAZxC;AACA;AACA;;AAGA;AACA;AACA;;AAOA,MAAMW,UAAU,GAAG,eAAe;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,sBAAgB,EAAEH,UAAU,EAAE;EAClDI,OAAO,EAAPA,gBAAO;EACP7B,OAAO;EACPE;AACD,CAAE,CAAC;AAEH,IAAA4B,cAAQ,EAAEJ,KAAM,CAAC;AACjB,IAAAK,kBAAM,EAAEL,KAAM,CAAC,CAACM,sBAAsB,CAAE7B,cAAe,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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,k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AEA,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,GAAAC,OAAA,CAAAC,OAAA,GAEWJ,OAAO"}
|
|
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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A,OAAON,KAAK;AACb;AAEA,MAAMc,OAAO,GAAG,IAAAC,qBAAe,EAAE;EAChChB,QAAQ;EACRY,cAAc;EACdE,MAAM;EACNP;AACD,CAAE,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEWJ,OAAO","ignoreList":[]}
|
package/build/store/selectors.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.getCommands = exports.getCommandLoaders = void 0;
|
|
8
7
|
exports.getContext = getContext;
|
|
9
8
|
exports.isOpen = isOpen;
|
|
10
|
-
var
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* WordPress dependencies
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -20,7 +19,7 @@ var _rememo = _interopRequireDefault(require("rememo"));
|
|
|
20
19
|
*
|
|
21
20
|
* @return {import('./actions').WPCommandConfig[]} The list of registered commands.
|
|
22
21
|
*/
|
|
23
|
-
const getCommands = exports.getCommands = (0,
|
|
22
|
+
const getCommands = exports.getCommands = (0, _data.createSelector)((state, contextual = false) => Object.values(state.commands).filter(command => {
|
|
24
23
|
const isContextual = command.context && command.context === state.context;
|
|
25
24
|
return contextual ? isContextual : !isContextual;
|
|
26
25
|
}), state => [state.commands, state.context]);
|
|
@@ -33,7 +32,7 @@ const getCommands = exports.getCommands = (0, _rememo.default)((state, contextua
|
|
|
33
32
|
*
|
|
34
33
|
* @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.
|
|
35
34
|
*/
|
|
36
|
-
const getCommandLoaders = exports.getCommandLoaders = (0,
|
|
35
|
+
const getCommandLoaders = exports.getCommandLoaders = (0, _data.createSelector)((state, contextual = false) => Object.values(state.commandLoaders).filter(loader => {
|
|
37
36
|
const isContextual = loader.context && loader.context === state.context;
|
|
38
37
|
return contextual ? isContextual : !isContextual;
|
|
39
38
|
}), state => [state.commandLoaders, state.context]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_data","require","getCommands","exports","createSelector","state","contextual","Object","values","commands","filter","command","isContextual","context","getCommandLoaders","commandLoaders","loader","isOpen","getContext"],"sources":["@wordpress/commands/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\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}\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AAG;EACnC,OAAOA,KAAK,CAACQ,OAAO;AACrB","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@ import { Icon, search as inputIcon } from '@wordpress/icons';
|
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
21
|
import { store as commandsStore } from '../store';
|
|
22
|
-
const inputLabel = __('Search
|
|
22
|
+
const inputLabel = __('Search commands and settings');
|
|
23
23
|
function CommandMenuLoader({
|
|
24
24
|
name,
|
|
25
25
|
search,
|
|
@@ -248,12 +248,12 @@ export function CommandMenu() {
|
|
|
248
248
|
onKeyDown: onKeyDown
|
|
249
249
|
}, createElement("div", {
|
|
250
250
|
className: "commands-command-menu__header"
|
|
251
|
-
}, createElement(
|
|
252
|
-
icon: inputIcon
|
|
253
|
-
}), createElement(CommandInput, {
|
|
251
|
+
}, createElement(CommandInput, {
|
|
254
252
|
search: search,
|
|
255
253
|
setSearch: setSearch,
|
|
256
254
|
isOpen: isOpen
|
|
255
|
+
}), createElement(Icon, {
|
|
256
|
+
icon: inputIcon
|
|
257
257
|
})), createElement(Command.List, {
|
|
258
258
|
ref: commandListRef
|
|
259
259
|
}, search && !isLoading && createElement(Command.Empty, null, __('No results found.')), createElement(CommandMenuGroup, {
|
|
@@ -1 +1 @@
|
|
|
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","inputLabel","CommandMenuLoader","name","hook","setLoader","close","_hook","isLoading","commands","length","createElement","Fragment","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","commandListRef","category","description","keyCombination","modifier","character","removeAttribute","setAttribute","event","defaultPrevented","preventDefault","bindGlobal","closeAndReset","onKeyDown","nativeEvent","isComposing","keyCode","Object","values","some","Boolean","overlayClassName","onRequestClose","__experimentalHideHeader","contentLabel","List","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\nconst inputLabel = __( 'Search for commands' );\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{ 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</>\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={ inputLabel }\n\t\t\taria-activedescendant={ selectedItemId }\n\t\t\ticon={ search }\n\t\t/>\n\t);\n}\n\n/**\n * @ignore\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 commandListRef = 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\t// Temporary fix for the suggestions Listbox labeling.\n\t// See https://github.com/pacocoursey/cmdk/issues/196\n\tuseEffect( () => {\n\t\tcommandListRef.current?.removeAttribute( 'aria-labelledby' );\n\t\tcommandListRef.current?.setAttribute(\n\t\t\t'aria-label',\n\t\t\t__( 'Command suggestions' )\n\t\t);\n\t}, [ commandListRef.current ] );\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\tcontentLabel={ __( 'Command palette' ) }\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command label={ inputLabel } onKeyDown={ onKeyDown }>\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 ref={ commandListRef }>\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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B;EAAG,GAExCsB,aAAA;IAAKc,SAAS,EAAC;EAAkC,GAChDd,aAAA,CAAChC,OAAO;IAACyC,KAAK,EAAGnB,UAAY;IAAC2E,SAAS,EAAGA;EAAW,GACpDjE,aAAA;IAAKc,SAAS,EAAC;EAA+B,GAC7Cd,aAAA,CAACd,IAAI;IAAC6B,IAAI,EAAG3B;EAAW,CAAE,CAAC,EAC3BY,aAAA,CAACgC,YAAY;IACZ7C,MAAM,EAAGA,MAAQ;IACjB+C,SAAS,EAAGA,SAAW;IACvBD,MAAM,EAAGA;EAAQ,CACjB,CACG,CAAC,EACNjC,aAAA,CAAChC,OAAO,CAAC6G,IAAI;IAAChC,GAAG,EAAGO;EAAgB,GACjCjE,MAAM,IAAI,CAAEU,SAAS,IACtBG,aAAA,CAAChC,OAAO,CAAC8G,KAAK,QACXpG,EAAE,CAAE,mBAAoB,CACZ,CACf,EACDsB,aAAA,CAACuB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBO,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGqE,aAAe;IACvBxC,YAAY;EAAA,CACZ,CAAC,EACArC,MAAM,IACPa,aAAA,CAACuB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBO,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGqE;EAAe,CACvB,CAEW,CACN,CACL,CACC,CAAC;AAEV"}
|
|
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","inputLabel","CommandMenuLoader","name","hook","setLoader","close","_hook","isLoading","commands","length","createElement","Fragment","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","commandListRef","category","description","keyCombination","modifier","character","removeAttribute","setAttribute","event","defaultPrevented","preventDefault","bindGlobal","closeAndReset","onKeyDown","nativeEvent","isComposing","keyCode","Object","values","some","Boolean","overlayClassName","onRequestClose","__experimentalHideHeader","contentLabel","List","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\nconst inputLabel = __( 'Search commands and settings' );\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{ 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</>\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={ inputLabel }\n\t\t\taria-activedescendant={ selectedItemId }\n\t\t\ticon={ search }\n\t\t/>\n\t);\n}\n\n/**\n * @ignore\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 commandListRef = 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\t// Temporary fix for the suggestions Listbox labeling.\n\t// See https://github.com/pacocoursey/cmdk/issues/196\n\tuseEffect( () => {\n\t\tcommandListRef.current?.removeAttribute( 'aria-labelledby' );\n\t\tcommandListRef.current?.setAttribute(\n\t\t\t'aria-label',\n\t\t\t__( 'Command suggestions' )\n\t\t);\n\t}, [ commandListRef.current ] );\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\tcontentLabel={ __( 'Command palette' ) }\n\t\t>\n\t\t\t<div className=\"commands-command-menu__container\">\n\t\t\t\t<Command label={ inputLabel } onKeyDown={ onKeyDown }>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\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\t<Icon icon={ inputIcon } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<Command.List ref={ commandListRef }>\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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ACjDC,cAAc,EAAGV,aAAe;IAChCW,wBAAwB;IACxBC,YAAY,EAAGlG,EAAE,CAAE,iBAAkB;EAAG,GAExCsB,aAAA;IAAKc,SAAS,EAAC;EAAkC,GAChDd,aAAA,CAAChC,OAAO;IAACyC,KAAK,EAAGnB,UAAY;IAAC2E,SAAS,EAAGA;EAAW,GACpDjE,aAAA;IAAKc,SAAS,EAAC;EAA+B,GAC7Cd,aAAA,CAACgC,YAAY;IACZ7C,MAAM,EAAGA,MAAQ;IACjB+C,SAAS,EAAGA,SAAW;IACvBD,MAAM,EAAGA;EAAQ,CACjB,CAAC,EACFjC,aAAA,CAACd,IAAI;IAAC6B,IAAI,EAAG3B;EAAW,CAAE,CACtB,CAAC,EACNY,aAAA,CAAChC,OAAO,CAAC6G,IAAI;IAAChC,GAAG,EAAGO;EAAgB,GACjCjE,MAAM,IAAI,CAAEU,SAAS,IACtBG,aAAA,CAAChC,OAAO,CAAC8G,KAAK,QACXpG,EAAE,CAAE,mBAAoB,CACZ,CACf,EACDsB,aAAA,CAACuB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBO,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGqE,aAAe;IACvBxC,YAAY;EAAA,CACZ,CAAC,EACArC,MAAM,IACPa,aAAA,CAACuB,gBAAgB;IAChBpC,MAAM,EAAGA,MAAQ;IACjBO,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGqE;EAAe,CACvB,CAEW,CACN,CACL,CACC,CAAC;AAEV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useDispatch","store","commandsStore","useCommandLoader","loader","registerCommandLoader","unregisterCommandLoader","disabled","name","hook","context"],"sources":["@wordpress/commands/src/hooks/use-command-loader.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command loader to the command palette. Used for dynamic commands.\n *\n * @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.\n *\n * @example\n * ```js\n * import { useCommandLoader } from '@wordpress/commands';\n * import { post, page, layout, symbolFilled } from '@wordpress/icons';\n *\n * const icons = {\n * post,\n * page,\n * wp_template: layout,\n * wp_template_part: symbolFilled,\n * };\n *\n * function usePageSearchCommandLoader( { search } ) {\n * // Retrieve the pages for the \"search\" term.\n * const { records, isLoading } = useSelect( ( select ) => {\n * const { getEntityRecords } = select( coreStore );\n * const query = {\n * search: !! search ? search : undefined,\n * per_page: 10,\n * orderby: search ? 'relevance' : 'date',\n * };\n * return {\n * records: getEntityRecords( 'postType', 'page', query ),\n * isLoading: ! select( coreStore ).hasFinishedResolution(\n * 'getEntityRecords',\n * 'postType', 'page', query ]\n * ),\n * };\n * }, [ search ] );\n *\n * // Create the commands.\n * const commands = useMemo( () => {\n * return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n * return {\n * name: record.title?.rendered + ' ' + record.id,\n * label: record.title?.rendered\n * ? record.title?.rendered\n * : __( '(no title)' ),\n * icon: icons[ postType ],\n * callback: ( { close } ) => {\n * const args = {\n * postType,\n * postId: record.id,\n * ...extraArgs,\n * };\n * document.location = addQueryArgs( 'site-editor.php', args );\n * close();\n * },\n * };\n * } );\n * }, [ records, history ] );\n *\n * return {\n * commands,\n * isLoading,\n * };\n * }\n *\n * useCommandLoader( {\n * name: 'myplugin/page-search',\n * hook: usePageSearchCommandLoader,\n * } );\n * ```\n */\nexport default function useCommandLoader( loader ) {\n\tconst { registerCommandLoader, unregisterCommandLoader } =\n\t\tuseDispatch( commandsStore );\n\tuseEffect( () => {\n\t\tif ( loader.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommandLoader( {\n\t\t\tname: loader.name,\n\t\t\thook: loader.hook,\n\t\t\tcontext: loader.context,\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommandLoader( loader.name );\n\t\t};\n\t}, [\n\t\tloader.name,\n\t\tloader.hook,\n\t\tloader.context,\n\t\tloader.disabled,\n\t\tregisterCommandLoader,\n\t\tunregisterCommandLoader,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,UAAU;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,MAAM,EAAG;EAClD,MAAM;IAAEC,qBAAqB;IAAEC;EAAwB,CAAC,GACvDN,WAAW,CAAEE,aAAc,CAAC;EAC7BH,SAAS,CAAE,MAAM;IAChB,IAAKK,MAAM,CAACG,QAAQ,EAAG;MACtB;IACD;IACAF,qBAAqB,CAAE;MACtBG,IAAI,EAAEJ,MAAM,CAACI,IAAI;MACjBC,IAAI,EAAEL,MAAM,CAACK,IAAI;MACjBC,OAAO,EAAEN,MAAM,CAACM;IACjB,CAAE,CAAC;IACH,OAAO,MAAM;MACZJ,uBAAuB,CAAEF,MAAM,CAACI,IAAK,CAAC;IACvC,CAAC;EACF,CAAC,EAAE,CACFJ,MAAM,CAACI,IAAI,EACXJ,MAAM,CAACK,IAAI,EACXL,MAAM,CAACM,OAAO,EACdN,MAAM,CAACG,QAAQ,EACfF,qBAAqB,EACrBC,uBAAuB,CACtB,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["useEffect","useDispatch","store","commandsStore","useCommandLoader","loader","registerCommandLoader","unregisterCommandLoader","disabled","name","hook","context"],"sources":["@wordpress/commands/src/hooks/use-command-loader.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command loader to the command palette. Used for dynamic commands.\n *\n * @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.\n *\n * @example\n * ```js\n * import { useCommandLoader } from '@wordpress/commands';\n * import { post, page, layout, symbolFilled } from '@wordpress/icons';\n *\n * const icons = {\n * post,\n * page,\n * wp_template: layout,\n * wp_template_part: symbolFilled,\n * };\n *\n * function usePageSearchCommandLoader( { search } ) {\n * // Retrieve the pages for the \"search\" term.\n * const { records, isLoading } = useSelect( ( select ) => {\n * const { getEntityRecords } = select( coreStore );\n * const query = {\n * search: !! search ? search : undefined,\n * per_page: 10,\n * orderby: search ? 'relevance' : 'date',\n * };\n * return {\n * records: getEntityRecords( 'postType', 'page', query ),\n * isLoading: ! select( coreStore ).hasFinishedResolution(\n * 'getEntityRecords',\n * 'postType', 'page', query ]\n * ),\n * };\n * }, [ search ] );\n *\n * // Create the commands.\n * const commands = useMemo( () => {\n * return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n * return {\n * name: record.title?.rendered + ' ' + record.id,\n * label: record.title?.rendered\n * ? record.title?.rendered\n * : __( '(no title)' ),\n * icon: icons[ postType ],\n * callback: ( { close } ) => {\n * const args = {\n * postType,\n * postId: record.id,\n * ...extraArgs,\n * };\n * document.location = addQueryArgs( 'site-editor.php', args );\n * close();\n * },\n * };\n * } );\n * }, [ records, history ] );\n *\n * return {\n * commands,\n * isLoading,\n * };\n * }\n *\n * useCommandLoader( {\n * name: 'myplugin/page-search',\n * hook: usePageSearchCommandLoader,\n * } );\n * ```\n */\nexport default function useCommandLoader( loader ) {\n\tconst { registerCommandLoader, unregisterCommandLoader } =\n\t\tuseDispatch( commandsStore );\n\tuseEffect( () => {\n\t\tif ( loader.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommandLoader( {\n\t\t\tname: loader.name,\n\t\t\thook: loader.hook,\n\t\t\tcontext: loader.context,\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommandLoader( loader.name );\n\t\t};\n\t}, [\n\t\tloader.name,\n\t\tloader.hook,\n\t\tloader.context,\n\t\tloader.disabled,\n\t\tregisterCommandLoader,\n\t\tunregisterCommandLoader,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,UAAU;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,MAAM,EAAG;EAClD,MAAM;IAAEC,qBAAqB;IAAEC;EAAwB,CAAC,GACvDN,WAAW,CAAEE,aAAc,CAAC;EAC7BH,SAAS,CAAE,MAAM;IAChB,IAAKK,MAAM,CAACG,QAAQ,EAAG;MACtB;IACD;IACAF,qBAAqB,CAAE;MACtBG,IAAI,EAAEJ,MAAM,CAACI,IAAI;MACjBC,IAAI,EAAEL,MAAM,CAACK,IAAI;MACjBC,OAAO,EAAEN,MAAM,CAACM;IACjB,CAAE,CAAC;IACH,OAAO,MAAM;MACZJ,uBAAuB,CAAEF,MAAM,CAACI,IAAK,CAAC;IACvC,CAAC;EACF,CAAC,EAAE,CACFJ,MAAM,CAACI,IAAI,EACXJ,MAAM,CAACK,IAAI,EACXL,MAAM,CAACM,OAAO,EACdN,MAAM,CAACG,QAAQ,EACfF,qBAAqB,EACrBC,uBAAuB,CACtB,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useDispatch","store","commandsStore","useCommand","command","registerCommand","unregisterCommand","currentCallback","callback","current","disabled","name","context","label","searchLabel","icon","args"],"sources":["@wordpress/commands/src/hooks/use-command.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command to the command palette. Used for static commands.\n *\n * @param {import('../store/actions').WPCommandConfig} command command config.\n *\n * @example\n * ```js\n * import { useCommand } from '@wordpress/commands';\n * import { plus } from '@wordpress/icons';\n *\n * useCommand( {\n * name: 'myplugin/my-command-name',\n * label: __( 'Add new post' ),\n *\t icon: plus,\n * callback: ({ close }) => {\n * document.location.href = 'post-new.php';\n * close();\n * },\n * } );\n * ```\n */\nexport default function useCommand( command ) {\n\tconst { registerCommand, unregisterCommand } = useDispatch( commandsStore );\n\tconst currentCallback = useRef( command.callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = command.callback;\n\t}, [ command.callback ] );\n\n\tuseEffect( () => {\n\t\tif ( command.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommand( {\n\t\t\tname: command.name,\n\t\t\tcontext: command.context,\n\t\t\tlabel: command.label,\n\t\t\tsearchLabel: command.searchLabel,\n\t\t\ticon: command.icon,\n\t\t\tcallback: ( ...args ) => currentCallback.current( ...args ),\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommand( command.name );\n\t\t};\n\t}, [\n\t\tcommand.name,\n\t\tcommand.label,\n\t\tcommand.searchLabel,\n\t\tcommand.icon,\n\t\tcommand.context,\n\t\tcommand.disabled,\n\t\tregisterCommand,\n\t\tunregisterCommand,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,UAAU;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,UAAUA,CAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAGN,WAAW,CAAEE,aAAc,CAAC;EAC3E,MAAMK,eAAe,GAAGR,MAAM,CAAEK,OAAO,CAACI,QAAS,CAAC;EAClDV,SAAS,CAAE,MAAM;IAChBS,eAAe,CAACE,OAAO,GAAGL,OAAO,CAACI,QAAQ;EAC3C,CAAC,EAAE,CAAEJ,OAAO,CAACI,QAAQ,CAAG,CAAC;EAEzBV,SAAS,CAAE,MAAM;IAChB,IAAKM,OAAO,CAACM,QAAQ,EAAG;MACvB;IACD;IACAL,eAAe,CAAE;MAChBM,IAAI,EAAEP,OAAO,CAACO,IAAI;MAClBC,OAAO,EAAER,OAAO,CAACQ,OAAO;MACxBC,KAAK,EAAET,OAAO,CAACS,KAAK;MACpBC,WAAW,EAAEV,OAAO,CAACU,WAAW;MAChCC,IAAI,EAAEX,OAAO,CAACW,IAAI;MAClBP,QAAQ,EAAEA,CAAE,GAAGQ,IAAI,KAAMT,eAAe,CAACE,OAAO,CAAE,GAAGO,IAAK;IAC3D,CAAE,CAAC;IACH,OAAO,MAAM;MACZV,iBAAiB,CAAEF,OAAO,CAACO,IAAK,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,CACFP,OAAO,CAACO,IAAI,EACZP,OAAO,CAACS,KAAK,EACbT,OAAO,CAACU,WAAW,EACnBV,OAAO,CAACW,IAAI,EACZX,OAAO,CAACQ,OAAO,EACfR,OAAO,CAACM,QAAQ,EAChBL,eAAe,EACfC,iBAAiB,CAChB,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useDispatch","store","commandsStore","useCommand","command","registerCommand","unregisterCommand","currentCallback","callback","current","disabled","name","context","label","searchLabel","icon","args"],"sources":["@wordpress/commands/src/hooks/use-command.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\n\n/**\n * Attach a command to the command palette. Used for static commands.\n *\n * @param {import('../store/actions').WPCommandConfig} command command config.\n *\n * @example\n * ```js\n * import { useCommand } from '@wordpress/commands';\n * import { plus } from '@wordpress/icons';\n *\n * useCommand( {\n * name: 'myplugin/my-command-name',\n * label: __( 'Add new post' ),\n *\t icon: plus,\n * callback: ({ close }) => {\n * document.location.href = 'post-new.php';\n * close();\n * },\n * } );\n * ```\n */\nexport default function useCommand( command ) {\n\tconst { registerCommand, unregisterCommand } = useDispatch( commandsStore );\n\tconst currentCallback = useRef( command.callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = command.callback;\n\t}, [ command.callback ] );\n\n\tuseEffect( () => {\n\t\tif ( command.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tregisterCommand( {\n\t\t\tname: command.name,\n\t\t\tcontext: command.context,\n\t\t\tlabel: command.label,\n\t\t\tsearchLabel: command.searchLabel,\n\t\t\ticon: command.icon,\n\t\t\tcallback: ( ...args ) => currentCallback.current( ...args ),\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterCommand( command.name );\n\t\t};\n\t}, [\n\t\tcommand.name,\n\t\tcommand.label,\n\t\tcommand.searchLabel,\n\t\tcommand.icon,\n\t\tcommand.context,\n\t\tcommand.disabled,\n\t\tregisterCommand,\n\t\tunregisterCommand,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,UAAU;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,UAAUA,CAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAGN,WAAW,CAAEE,aAAc,CAAC;EAC3E,MAAMK,eAAe,GAAGR,MAAM,CAAEK,OAAO,CAACI,QAAS,CAAC;EAClDV,SAAS,CAAE,MAAM;IAChBS,eAAe,CAACE,OAAO,GAAGL,OAAO,CAACI,QAAQ;EAC3C,CAAC,EAAE,CAAEJ,OAAO,CAACI,QAAQ,CAAG,CAAC;EAEzBV,SAAS,CAAE,MAAM;IAChB,IAAKM,OAAO,CAACM,QAAQ,EAAG;MACvB;IACD;IACAL,eAAe,CAAE;MAChBM,IAAI,EAAEP,OAAO,CAACO,IAAI;MAClBC,OAAO,EAAER,OAAO,CAACQ,OAAO;MACxBC,KAAK,EAAET,OAAO,CAACS,KAAK;MACpBC,WAAW,EAAEV,OAAO,CAACU,WAAW;MAChCC,IAAI,EAAEX,OAAO,CAACW,IAAI;MAClBP,QAAQ,EAAEA,CAAE,GAAGQ,IAAI,KAAMT,eAAe,CAACE,OAAO,CAAE,GAAGO,IAAK;IAC3D,CAAE,CAAC;IACH,OAAO,MAAM;MACZV,iBAAiB,CAAEF,OAAO,CAACO,IAAK,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,CACFP,OAAO,CAACO,IAAI,EACZP,OAAO,CAACS,KAAK,EACbT,OAAO,CAACU,WAAW,EACnBV,OAAO,CAACW,IAAI,EACZX,OAAO,CAACQ,OAAO,EACfR,OAAO,CAACM,QAAQ,EAChBL,eAAe,EACfC,iBAAiB,CAChB,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 theme or plugin will inevitably break in the next version of WordPress.',\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,iHAAiH,EACjH,qBACD,CAAC"}
|
|
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 theme or plugin will inevitably break in the next version of WordPress.',\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,iHAAiH,EACjH,qBACD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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\n/**\n * @private\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;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7BD,IAAI,CAAEC,WAAW,EAAE;EAClBF;AACD,CAAE,CAAC"}
|
|
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\n/**\n * @private\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;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7BD,IAAI,CAAEC,WAAW,EAAE;EAClBF;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 * @property {boolean} disabled Whether to disable the command.\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 * @property {boolean} disabled Whether to disable the command loader.\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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;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"}
|
|
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 * @property {boolean} disabled Whether to disable the command.\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 * @property {boolean} disabled Whether to disable the command loader.\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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 *\n * @example\n * ```js\n * import { store as commandsStore } from '@wordpress/commands';\n * import { useDispatch } from '@wordpress/data';\n * ...\n * const { open: openCommandCenter } = useDispatch( commandsStore );\n * ```\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;AACA;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
|
+
{"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 *\n * @example\n * ```js\n * import { store as commandsStore } from '@wordpress/commands';\n * import { useDispatch } from '@wordpress/data';\n * ...\n * const { open: openCommandCenter } = useDispatch( commandsStore );\n * ```\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;AACA;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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 *
|
|
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 * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\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,SAASA,cAAc,QAAQ,iBAAiB;;AAEhD;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","ignoreList":[]}
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
-
--wp-bound-block-color:
|
|
99
|
+
--wp-bound-block-color: var(--wp-block-synced-color);
|
|
100
100
|
}
|
|
101
101
|
@media (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
|
@@ -108,13 +108,13 @@
|
|
|
108
108
|
border-radius: 4px;
|
|
109
109
|
width: calc(100% - 32px);
|
|
110
110
|
margin: auto;
|
|
111
|
-
max-width:
|
|
111
|
+
max-width: 400px;
|
|
112
112
|
position: relative;
|
|
113
|
-
top: calc(
|
|
113
|
+
top: calc(5% + 60px);
|
|
114
114
|
}
|
|
115
115
|
@media (min-width: 600px) {
|
|
116
116
|
.commands-command-menu {
|
|
117
|
-
top:
|
|
117
|
+
top: calc(10% + 60px);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
.commands-command-menu .components-modal__content {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
.commands-command-menu__header {
|
|
131
131
|
display: flex;
|
|
132
132
|
align-items: center;
|
|
133
|
-
padding
|
|
133
|
+
padding: 0 16px;
|
|
134
134
|
}
|
|
135
135
|
.commands-command-menu__header .components-button {
|
|
136
136
|
height: 56px;
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
.commands-command-menu__container [cmdk-input] {
|
|
152
152
|
border: none;
|
|
153
153
|
width: 100%;
|
|
154
|
-
padding: 16px
|
|
154
|
+
padding: 16px 4px;
|
|
155
155
|
outline: none;
|
|
156
156
|
color: #1e1e1e;
|
|
157
157
|
margin: 0;
|
|
158
|
-
font-size:
|
|
158
|
+
font-size: 15px;
|
|
159
159
|
line-height: 28px;
|
|
160
160
|
border-radius: 0;
|
|
161
161
|
}
|
|
@@ -173,7 +173,6 @@
|
|
|
173
173
|
align-items: center;
|
|
174
174
|
color: #1e1e1e;
|
|
175
175
|
font-size: 13px;
|
|
176
|
-
min-height: 40px;
|
|
177
176
|
}
|
|
178
177
|
.commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
|
|
179
178
|
background: var(--wp-admin-theme-color);
|
|
@@ -190,7 +189,8 @@
|
|
|
190
189
|
fill: #1e1e1e;
|
|
191
190
|
}
|
|
192
191
|
.commands-command-menu__container [cmdk-item] > div {
|
|
193
|
-
|
|
192
|
+
min-height: 40px;
|
|
193
|
+
padding: 4px;
|
|
194
194
|
padding-right: 40px;
|
|
195
195
|
}
|
|
196
196
|
.commands-command-menu__container [cmdk-item] > .has-icon {
|
|
@@ -200,8 +200,11 @@
|
|
|
200
200
|
max-height: 368px;
|
|
201
201
|
overflow: auto;
|
|
202
202
|
}
|
|
203
|
+
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
|
|
204
|
+
padding-bottom: 8px;
|
|
205
|
+
}
|
|
203
206
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
|
|
204
|
-
padding: 0 8px
|
|
207
|
+
padding: 0 8px;
|
|
205
208
|
}
|
|
206
209
|
.commands-command-menu__container [cmdk-empty] {
|
|
207
210
|
display: flex;
|
package/build-style/style.css
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
-
--wp-bound-block-color:
|
|
99
|
+
--wp-bound-block-color: var(--wp-block-synced-color);
|
|
100
100
|
}
|
|
101
101
|
@media (min-resolution: 192dpi) {
|
|
102
102
|
:root {
|
|
@@ -108,13 +108,13 @@
|
|
|
108
108
|
border-radius: 4px;
|
|
109
109
|
width: calc(100% - 32px);
|
|
110
110
|
margin: auto;
|
|
111
|
-
max-width:
|
|
111
|
+
max-width: 400px;
|
|
112
112
|
position: relative;
|
|
113
|
-
top: calc(
|
|
113
|
+
top: calc(5% + 60px);
|
|
114
114
|
}
|
|
115
115
|
@media (min-width: 600px) {
|
|
116
116
|
.commands-command-menu {
|
|
117
|
-
top:
|
|
117
|
+
top: calc(10% + 60px);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
.commands-command-menu .components-modal__content {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
.commands-command-menu__header {
|
|
131
131
|
display: flex;
|
|
132
132
|
align-items: center;
|
|
133
|
-
padding
|
|
133
|
+
padding: 0 16px;
|
|
134
134
|
}
|
|
135
135
|
.commands-command-menu__header .components-button {
|
|
136
136
|
height: 56px;
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
.commands-command-menu__container [cmdk-input] {
|
|
152
152
|
border: none;
|
|
153
153
|
width: 100%;
|
|
154
|
-
padding: 16px
|
|
154
|
+
padding: 16px 4px;
|
|
155
155
|
outline: none;
|
|
156
156
|
color: #1e1e1e;
|
|
157
157
|
margin: 0;
|
|
158
|
-
font-size:
|
|
158
|
+
font-size: 15px;
|
|
159
159
|
line-height: 28px;
|
|
160
160
|
border-radius: 0;
|
|
161
161
|
}
|
|
@@ -173,7 +173,6 @@
|
|
|
173
173
|
align-items: center;
|
|
174
174
|
color: #1e1e1e;
|
|
175
175
|
font-size: 13px;
|
|
176
|
-
min-height: 40px;
|
|
177
176
|
}
|
|
178
177
|
.commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
|
|
179
178
|
background: var(--wp-admin-theme-color);
|
|
@@ -190,7 +189,8 @@
|
|
|
190
189
|
fill: #1e1e1e;
|
|
191
190
|
}
|
|
192
191
|
.commands-command-menu__container [cmdk-item] > div {
|
|
193
|
-
|
|
192
|
+
min-height: 40px;
|
|
193
|
+
padding: 4px;
|
|
194
194
|
padding-left: 40px;
|
|
195
195
|
}
|
|
196
196
|
.commands-command-menu__container [cmdk-item] > .has-icon {
|
|
@@ -200,8 +200,11 @@
|
|
|
200
200
|
max-height: 368px;
|
|
201
201
|
overflow: auto;
|
|
202
202
|
}
|
|
203
|
+
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
|
|
204
|
+
padding-bottom: 8px;
|
|
205
|
+
}
|
|
203
206
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
|
|
204
|
-
padding: 0 8px
|
|
207
|
+
padding: 0 8px;
|
|
205
208
|
}
|
|
206
209
|
.commands-command-menu__container [cmdk-empty] {
|
|
207
210
|
display: flex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/commands",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Handles the commands menu.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,16 +27,15 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/components": "^27.
|
|
31
|
-
"@wordpress/data": "^9.
|
|
32
|
-
"@wordpress/element": "^5.
|
|
33
|
-
"@wordpress/i18n": "^4.
|
|
34
|
-
"@wordpress/icons": "^9.
|
|
35
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
36
|
-
"@wordpress/private-apis": "^0.
|
|
30
|
+
"@wordpress/components": "^27.4.0",
|
|
31
|
+
"@wordpress/data": "^9.26.0",
|
|
32
|
+
"@wordpress/element": "^5.33.0",
|
|
33
|
+
"@wordpress/i18n": "^4.56.0",
|
|
34
|
+
"@wordpress/icons": "^9.47.0",
|
|
35
|
+
"@wordpress/keyboard-shortcuts": "^4.33.0",
|
|
36
|
+
"@wordpress/private-apis": "^0.38.0",
|
|
37
37
|
"classnames": "^2.3.1",
|
|
38
|
-
"cmdk": "^0.2.0"
|
|
39
|
-
"rememo": "^4.0.2"
|
|
38
|
+
"cmdk": "^0.2.0"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
42
41
|
"react": "^18.0.0",
|
|
@@ -45,5 +44,5 @@
|
|
|
45
44
|
"publishConfig": {
|
|
46
45
|
"access": "public"
|
|
47
46
|
},
|
|
48
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
|
|
49
48
|
}
|
|
@@ -32,7 +32,7 @@ import { Icon, search as inputIcon } from '@wordpress/icons';
|
|
|
32
32
|
*/
|
|
33
33
|
import { store as commandsStore } from '../store';
|
|
34
34
|
|
|
35
|
-
const inputLabel = __( 'Search
|
|
35
|
+
const inputLabel = __( 'Search commands and settings' );
|
|
36
36
|
|
|
37
37
|
function CommandMenuLoader( { name, search, hook, setLoader, close } ) {
|
|
38
38
|
const { isLoading, commands = [] } = hook( { search } ) ?? {};
|
|
@@ -278,12 +278,12 @@ export function CommandMenu() {
|
|
|
278
278
|
<div className="commands-command-menu__container">
|
|
279
279
|
<Command label={ inputLabel } onKeyDown={ onKeyDown }>
|
|
280
280
|
<div className="commands-command-menu__header">
|
|
281
|
-
<Icon icon={ inputIcon } />
|
|
282
281
|
<CommandInput
|
|
283
282
|
search={ search }
|
|
284
283
|
setSearch={ setSearch }
|
|
285
284
|
isOpen={ isOpen }
|
|
286
285
|
/>
|
|
286
|
+
<Icon icon={ inputIcon } />
|
|
287
287
|
</div>
|
|
288
288
|
<Command.List ref={ commandListRef }>
|
|
289
289
|
{ search && ! isLoading && (
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
border-radius: $grid-unit-05;
|
|
4
4
|
width: calc(100% - #{$grid-unit-40});
|
|
5
5
|
margin: auto;
|
|
6
|
-
max-width:
|
|
6
|
+
max-width: 400px;
|
|
7
7
|
position: relative;
|
|
8
|
-
top: calc(
|
|
8
|
+
top: calc(5% + #{$header-height});
|
|
9
9
|
|
|
10
10
|
@include break-small() {
|
|
11
|
-
top:
|
|
11
|
+
top: calc(10% + #{$header-height});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.components-modal__content {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.commands-command-menu__header {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
|
-
padding
|
|
28
|
+
padding: 0 $grid-unit-20;
|
|
29
29
|
|
|
30
30
|
.components-button {
|
|
31
31
|
height: $grid-unit-70;
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
[cmdk-input] {
|
|
50
50
|
border: none;
|
|
51
51
|
width: 100%;
|
|
52
|
-
padding: $grid-unit-20 $grid-unit-
|
|
52
|
+
padding: $grid-unit-20 $grid-unit-05;
|
|
53
53
|
outline: none;
|
|
54
54
|
color: $gray-900;
|
|
55
55
|
margin: 0;
|
|
56
|
-
font-size:
|
|
56
|
+
font-size: 15px;
|
|
57
57
|
line-height: 28px;
|
|
58
58
|
border-radius: 0;
|
|
59
59
|
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
align-items: center;
|
|
75
75
|
color: $gray-900;
|
|
76
76
|
font-size: $default-font-size;
|
|
77
|
-
min-height: $button-size-next-default-40px;
|
|
78
77
|
|
|
79
78
|
&[aria-selected="true"],
|
|
80
79
|
&:active {
|
|
@@ -96,7 +95,8 @@
|
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
> div {
|
|
99
|
-
|
|
98
|
+
min-height: $button-size-next-default-40px;
|
|
99
|
+
padding: $grid-unit-05;
|
|
100
100
|
padding-left: $grid-unit-50; // Account for commands without icons.
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -109,8 +109,13 @@
|
|
|
109
109
|
max-height: 368px; // Specific to not have commands overflow oddly.
|
|
110
110
|
overflow: auto;
|
|
111
111
|
|
|
112
|
+
// Ensures there is always padding bottom on the last group, when there are commands.
|
|
113
|
+
& [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
|
|
114
|
+
padding-bottom: $grid-unit-10;
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
& [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
|
|
113
|
-
padding: 0 $grid-unit
|
|
118
|
+
padding: 0 $grid-unit-10;
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
|