@wordpress/commands 1.41.1-next.v.202603161435.0 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/build/components/command-menu.cjs +156 -154
- package/build/components/command-menu.cjs.map +3 -3
- package/build/components/use-recent-commands.cjs +125 -0
- package/build/components/use-recent-commands.cjs.map +7 -0
- package/build/store/index.cjs +2 -0
- package/build/store/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +11 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +32 -0
- package/build/store/private-selectors.cjs.map +7 -0
- package/build/store/reducer.cjs +12 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build-module/components/command-menu.mjs +160 -154
- package/build-module/components/command-menu.mjs.map +2 -2
- package/build-module/components/use-recent-commands.mjs +104 -0
- package/build-module/components/use-recent-commands.mjs.map +7 -0
- package/build-module/store/index.mjs +2 -0
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +9 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +8 -0
- package/build-module/store/private-selectors.mjs.map +7 -0
- package/build-module/store/reducer.mjs +12 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-style/style-rtl.css +25 -21
- package/build-style/style.css +25 -21
- package/package.json +12 -11
- package/src/components/command-menu.js +179 -161
- package/src/components/style.scss +32 -29
- package/src/components/use-recent-commands.js +131 -0
- package/src/store/index.js +2 -0
- package/src/store/private-actions.js +16 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/reducer.js +13 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/command-menu.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { Command, useCommandState } from 'cmdk';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n\tisValidElement,\n\tComponent,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tModal,\n\tTextHighlight,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport {\n\tstore as keyboardShortcutsStore,\n\tuseShortcut,\n} from '@wordpress/keyboard-shortcuts';\nimport { Icon, search as inputIcon, arrowRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst { withIgnoreIMEEvents } = unlock( componentsPrivateApis );\n\nconst inputLabel = __( 'Search commands and settings' );\n\n/**\n * Icons enforced per command category.\n * Categories listed here will always use the specified icon,\n * ignoring whatever icon the command itself provides.\n */\nconst CATEGORY_ICONS = {\n\tview: arrowRight,\n};\n\n/**\n * Translatable labels for command categories.\n */\nconst CATEGORY_LABELS = {\n\tcommand: __( 'Command' ),\n\tview: __( 'View' ),\n\tedit: __( 'Edit' ),\n\taction: __( 'Action' ),\n\tworkflow: __( 'Workflow' ),\n};\n\n/**\n * Function that checks if the parameter is a valid icon.\n * Taken from @wordpress/blocks/src/api/utils.js and copied\n * in case requirements diverge and to avoid a dependency on @wordpress/blocks.\n *\n * @param {*} icon Parameter to be checked.\n *\n * @return {boolean} True if the parameter is a valid icon and false otherwise.\n */\n\nexport function isValidIcon( icon ) {\n\treturn (\n\t\t!! icon &&\n\t\t( typeof icon === 'string' ||\n\t\t\tisValidElement( icon ) ||\n\t\t\ttypeof icon === 'function' ||\n\t\t\ticon instanceof Component )\n\t);\n}\n\nfunction CommandMenuLoader( {\n\tname,\n\tsearch,\n\thook,\n\tsetLoader,\n\tclose,\n\tcategory,\n} ) {\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\tconst commandCategory = command.category ?? category;\n\t\t\t\treturn (\n\t\t\t\t\t<Command.Item\n\t\t\t\t\t\tkey={ command.name }\n\t\t\t\t\t\tvalue={ command.searchLabel ?? command.label }\n\t\t\t\t\t\tkeywords={ command.keywords }\n\t\t\t\t\t\tonSelect={ () => command.callback( { close } ) }\n\t\t\t\t\t\tid={ command.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tclassName={ clsx( 'commands-command-menu__item', {\n\t\t\t\t\t\t\t\t'has-icon':\n\t\t\t\t\t\t\t\t\tCATEGORY_ICONS[ commandCategory ] ||\n\t\t\t\t\t\t\t\t\tcommand.icon,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ CATEGORY_ICONS[ commandCategory ] && (\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\ticon={ CATEGORY_ICONS[ commandCategory ] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! CATEGORY_ICONS[ commandCategory ] &&\n\t\t\t\t\t\t\t\tisValidIcon( command.icon ) && (\n\t\t\t\t\t\t\t\t\t<Icon icon={ command.icon } />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<span className=\"commands-command-menu__item-label\">\n\t\t\t\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ CATEGORY_LABELS[ commandCategory ] && (\n\t\t\t\t\t\t\t\t<span className=\"commands-command-menu__item-category\">\n\t\t\t\t\t\t\t\t\t{ CATEGORY_LABELS[ commandCategory ] }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Command.Item>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport function CommandMenuLoaderWrapper( {\n\thook,\n\tsearch,\n\tsetLoader,\n\tclose,\n\tcategory,\n} ) {\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 currentLoaderRef = useRef( hook );\n\tconst [ key, setKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( currentLoaderRef.current !== hook ) {\n\t\t\tcurrentLoaderRef.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={ currentLoaderRef.current }\n\t\t\tsearch={ search }\n\t\t\tsetLoader={ setLoader }\n\t\t\tclose={ close }\n\t\t\tcategory={ category }\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\tkeywords={ command.keywords }\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={ clsx( 'commands-command-menu__item', {\n\t\t\t\t\t\t\t'has-icon':\n\t\t\t\t\t\t\t\tCATEGORY_ICONS[ command.category ] ||\n\t\t\t\t\t\t\t\tcommand.icon,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ CATEGORY_ICONS[ command.category ] ? (\n\t\t\t\t\t\t\t<Icon icon={ CATEGORY_ICONS[ command.category ] } />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tcommand.icon && <Icon icon={ command.icon } />\n\t\t\t\t\t\t) }\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\t{ CATEGORY_LABELS[ command.category ] && (\n\t\t\t\t\t\t\t<span className=\"commands-command-menu__item-category\">\n\t\t\t\t\t\t\t\t{ CATEGORY_LABELS[ command.category ] }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\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\tcategory={ loader.category }\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/>\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\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/commands',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the command palette.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'k',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/commands',\n\t\t/** @type {React.KeyboardEventHandler} */\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\t// Bails to avoid obscuring the effect of the preceding handler(s).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\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 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 }>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"commands-command-menu__header-search-icon\"\n\t\t\t\t\t\t\ticon={ inputIcon }\n\t\t\t\t\t\t/>\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 label={ __( 'Command suggestions' ) }>\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"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,uBAAuB;AACzC,OAAO,UAAU;AAKjB,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { Command, useCommandState } from 'cmdk';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tisValidElement,\n\tComponent,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tModal,\n\tTextHighlight,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport {\n\tstore as keyboardShortcutsStore,\n\tuseShortcut,\n} from '@wordpress/keyboard-shortcuts';\nimport { Icon, search as inputIcon, arrowRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport {\n\trecordUsage,\n\tuseLoaderCollector,\n\tuseRecentCommands,\n} from './use-recent-commands';\n\nconst { withIgnoreIMEEvents } = unlock( componentsPrivateApis );\n\n// Namespaces item ids to avoid collisions with other elements on the page.\nconst ITEM_ID_PREFIX = 'command-palette-item-';\nconst inputLabel = __( 'Search commands and settings' );\n\n/**\n * Icons enforced per command category.\n * Categories listed here will always use the specified icon,\n * ignoring whatever icon the command itself provides.\n */\nconst CATEGORY_ICONS = {\n\tview: arrowRight,\n};\n\n/**\n * Translatable labels for command categories.\n */\nconst CATEGORY_LABELS = {\n\tcommand: __( 'Command' ),\n\tview: __( 'View' ),\n\tedit: __( 'Edit' ),\n\taction: __( 'Action' ),\n\tworkflow: __( 'Workflow' ),\n};\n\n/**\n * Function that checks if the parameter is a valid icon.\n * Taken from @wordpress/blocks/src/api/utils.js and copied\n * in case requirements diverge and to avoid a dependency on @wordpress/blocks.\n *\n * @param {*} icon Parameter to be checked.\n *\n * @return {boolean} True if the parameter is a valid icon and false otherwise.\n */\n\nexport function isValidIcon( icon ) {\n\treturn (\n\t\t!! icon &&\n\t\t( typeof icon === 'string' ||\n\t\t\tisValidElement( icon ) ||\n\t\t\ttypeof icon === 'function' ||\n\t\t\ticon instanceof Component )\n\t);\n}\n\nfunction CommandItem( { command, search, category, valuePrefix } ) {\n\tconst { close } = useDispatch( commandsStore );\n\tconst commandCategory = category ?? command.category;\n\tconst label = command.searchLabel ?? command.label;\n\tconst value = valuePrefix ? `${ valuePrefix }${ command.name }` : label;\n\treturn (\n\t\t<Command.Item\n\t\t\tkey={ command.name }\n\t\t\tid={ `${ ITEM_ID_PREFIX }${ value.toLowerCase() }` }\n\t\t\tvalue={ value }\n\t\t\tkeywords={\n\t\t\t\tvaluePrefix\n\t\t\t\t\t? [ ...( command.keywords ?? [] ), label ]\n\t\t\t\t\t: command.keywords\n\t\t\t}\n\t\t\tonSelect={ () => {\n\t\t\t\trecordUsage( command.name );\n\t\t\t\tcommand.callback( { close } );\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\talignment=\"left\"\n\t\t\t\tclassName={ clsx( 'commands-command-menu__item', {\n\t\t\t\t\t'has-icon':\n\t\t\t\t\t\tCATEGORY_ICONS[ commandCategory ] || command.icon,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ CATEGORY_ICONS[ commandCategory ] ? (\n\t\t\t\t\t<Icon icon={ CATEGORY_ICONS[ commandCategory ] } />\n\t\t\t\t) : (\n\t\t\t\t\tisValidIcon( command.icon ) && (\n\t\t\t\t\t\t<Icon icon={ command.icon } />\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t\t<span className=\"commands-command-menu__item-label\">\n\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\ttext={ command.label }\n\t\t\t\t\t\thighlight={ search }\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t\t{ CATEGORY_LABELS[ commandCategory ] && (\n\t\t\t\t\t<span className=\"commands-command-menu__item-category\">\n\t\t\t\t\t\t{ CATEGORY_LABELS[ commandCategory ] }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</Command.Item>\n\t);\n}\n\nfunction CommandMenuLoader( { name, search, hook, category, valuePrefix } ) {\n\tconst { setLoaderLoading } = unlock( useDispatch( commandsStore ) );\n\tconst { isLoading: loading, commands = [] } = hook( { search } ) ?? {};\n\tuseEffect( () => {\n\t\tsetLoaderLoading( name, loading );\n\t}, [ setLoaderLoading, name, loading ] );\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<CommandItem\n\t\t\t\t\tkey={ command.name }\n\t\t\t\t\tcommand={ command }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tcategory={ command.category ?? category }\n\t\t\t\t\tvaluePrefix={ valuePrefix }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction CommandMenuLoaderWrapper( { hook, ...props } ) {\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\tconst currentLoaderRef = useRef( hook );\n\tconst [ key, setKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( currentLoaderRef.current !== hook ) {\n\t\t\tcurrentLoaderRef.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={ currentLoaderRef.current }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction CommandList( { search, commands, loaders, valuePrefix } ) {\n\treturn (\n\t\t<>\n\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t<CommandItem\n\t\t\t\t\tkey={ command.name }\n\t\t\t\t\tcommand={ command }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tvaluePrefix={ valuePrefix }\n\t\t\t\t/>\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\tname={ loader.name }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\thook={ loader.hook }\n\t\t\t\t\tcategory={ loader.category }\n\t\t\t\t\tvaluePrefix={ valuePrefix }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction RecentLoaderRunner( { hook, name, filterNames, onResolved } ) {\n\tuseLoaderCollector( hook, name, filterNames, onResolved );\n\treturn null;\n}\n\nfunction RecentGroup() {\n\tconst { commands, loaders, recentSet, onResolved } = useRecentCommands();\n\n\tif ( ! commands.length && ! loaders.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Command.Group heading={ __( 'Recent' ) }>\n\t\t\t{ loaders.map( ( loader ) => (\n\t\t\t\t<RecentLoaderRunner\n\t\t\t\t\tkey={ loader.name }\n\t\t\t\t\tname={ loader.name }\n\t\t\t\t\thook={ loader.hook }\n\t\t\t\t\tfilterNames={ recentSet }\n\t\t\t\t\tonResolved={ onResolved }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ commands.map( ( command ) => (\n\t\t\t\t<CommandItem\n\t\t\t\t\tkey={ command.name }\n\t\t\t\t\tcommand={ command }\n\t\t\t\t\tsearch=\"\"\n\t\t\t\t\tvaluePrefix=\"recent-\"\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Command.Group>\n\t);\n}\n\nfunction SuggestionsGroup() {\n\tconst { commands, loaders } = useSelect( ( select ) => {\n\t\tconst { getCommands, getCommandLoaders } = select( commandsStore );\n\t\treturn {\n\t\t\tcommands: getCommands( true ),\n\t\t\tloaders: getCommandLoaders( true ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Command.Group heading={ __( 'Suggestions' ) }>\n\t\t\t<CommandList search=\"\" commands={ commands } loaders={ loaders } />\n\t\t</Command.Group>\n\t);\n}\n\nfunction ResultsGroup( { search } ) {\n\tconst { commands, contextualCommands, loaders, contextualLoaders } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getCommands, getCommandLoaders } = select( commandsStore );\n\t\t\treturn {\n\t\t\t\tcommands: getCommands( false ),\n\t\t\t\tcontextualCommands: getCommands( true ),\n\t\t\t\tloaders: getCommandLoaders( false ),\n\t\t\t\tcontextualLoaders: getCommandLoaders( true ),\n\t\t\t};\n\t\t}, [] );\n\n\treturn (\n\t\t<Command.Group heading={ __( 'Results' ) }>\n\t\t\t<CommandList\n\t\t\t\tsearch={ search }\n\t\t\t\tcommands={ commands }\n\t\t\t\tloaders={ loaders }\n\t\t\t/>\n\t\t\t<CommandList\n\t\t\t\tsearch={ search }\n\t\t\t\tcommands={ contextualCommands }\n\t\t\t\tloaders={ contextualLoaders }\n\t\t\t/>\n\t\t</Command.Group>\n\t);\n}\n\nfunction CommandInput( { search, setSearch } ) {\n\tconst commandMenuInput = useRef();\n\tconst _value = useCommandState( ( state ) => state.value );\n\tconst selectedItemId = _value ? `${ ITEM_ID_PREFIX }${ _value }` : null;\n\tuseEffect( () => {\n\t\t// Focus the command palette input when mounting the modal.\n\t\tcommandMenuInput.current.focus();\n\t}, [] );\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/>\n\t);\n}\n\n/**\n * @ignore\n */\nexport function CommandMenu() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst { isOpen: paletteIsOpen, loadersLoading } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisOpen: select( commandsStore ).isOpen(),\n\t\t\tloadersLoading: unlock( select( commandsStore ) ).isLoading(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { open, close } = useDispatch( commandsStore );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/commands',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the command palette.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'k',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\tuseShortcut(\n\t\t'core/commands',\n\t\t/** @type {React.KeyboardEventHandler} */\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\t// Bails to avoid obscuring the effect of the preceding handler(s).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\t\t\tif ( paletteIsOpen ) {\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 closeAndReset = () => {\n\t\tsetSearch( '' );\n\t\tclose();\n\t};\n\n\tif ( ! paletteIsOpen ) {\n\t\treturn false;\n\t}\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\tsize=\"medium\"\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 } loop>\n\t\t\t\t\t<div className=\"commands-command-menu__header\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"commands-command-menu__header-search-icon\"\n\t\t\t\t\t\t\ticon={ inputIcon }\n\t\t\t\t\t\t/>\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/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Command.List label={ __( 'Command suggestions' ) }>\n\t\t\t\t\t\t{ search && ! loadersLoading && (\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{ ! search && <RecentGroup /> }\n\t\t\t\t\t\t{ ! search && <SuggestionsGroup /> }\n\t\t\t\t\t\t{ search && <ResultsGroup search={ search } /> }\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"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,uBAAuB;AACzC,OAAO,UAAU;AAKjB,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,eAAe;AAAA,OACT;AACP;AAAA,EACC,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,MAAM,UAAU,WAAW,kBAAkB;AAKtD,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAoEJ,SA0CD,UAlCG,KARF;AAlEH,IAAM,EAAE,oBAAoB,IAAI,OAAQ,qBAAsB;AAG9D,IAAM,iBAAiB;AACvB,IAAM,aAAa,GAAI,8BAA+B;AAOtD,IAAM,iBAAiB;AAAA,EACtB,MAAM;AACP;AAKA,IAAM,kBAAkB;AAAA,EACvB,SAAS,GAAI,SAAU;AAAA,EACvB,MAAM,GAAI,MAAO;AAAA,EACjB,MA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UAEC,CAAE,UAAU,oBAAC,eAAY;AAAA,UACzB,CAAE,UAAU,oBAAC,oBAAiB;AAAA,UAC9B,UAAU,oBAAC,gBAAa,QAAkB;AAAA,WAC7C;AAAA,SACD,GACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// packages/commands/src/components/use-recent-commands.js
|
|
2
|
+
import {
|
|
3
|
+
useSelect,
|
|
4
|
+
useDispatch,
|
|
5
|
+
select as globalSelect,
|
|
6
|
+
dispatch
|
|
7
|
+
} from "@wordpress/data";
|
|
8
|
+
import { store as preferencesStore } from "@wordpress/preferences";
|
|
9
|
+
import { useCallback, useEffect, useMemo, useState } from "@wordpress/element";
|
|
10
|
+
import { store as commandsStore } from "../store/index.mjs";
|
|
11
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
12
|
+
var MAX_RECENTLY_SAVED = 30;
|
|
13
|
+
var MAX_RECENTLY_DISPLAYED = 5;
|
|
14
|
+
var EMPTY_ARRAY = [];
|
|
15
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
16
|
+
function recordUsage(name) {
|
|
17
|
+
const current = globalSelect(preferencesStore).get(
|
|
18
|
+
"core/commands",
|
|
19
|
+
"recentlyUsed"
|
|
20
|
+
) ?? [];
|
|
21
|
+
const next = [name, ...current.filter((n) => n !== name)].slice(
|
|
22
|
+
0,
|
|
23
|
+
MAX_RECENTLY_SAVED
|
|
24
|
+
);
|
|
25
|
+
dispatch(preferencesStore).set("core/commands", "recentlyUsed", next);
|
|
26
|
+
}
|
|
27
|
+
function useLoaderCollector(hook, name, filterNames, onResolved) {
|
|
28
|
+
const { setLoaderLoading } = unlock(useDispatch(commandsStore));
|
|
29
|
+
const { isLoading: loading, commands = [] } = hook({ search: "" }) ?? {};
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setLoaderLoading(name, loading);
|
|
32
|
+
}, [setLoaderLoading, name, loading]);
|
|
33
|
+
const filtered = filterNames ? commands.filter((c) => filterNames.has(c.name)) : commands;
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
onResolved(name, filtered);
|
|
36
|
+
}, [onResolved, name, filtered]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
return () => onResolved(name, []);
|
|
39
|
+
}, [onResolved, name]);
|
|
40
|
+
}
|
|
41
|
+
function useRecentCommands() {
|
|
42
|
+
const {
|
|
43
|
+
contextualCommands,
|
|
44
|
+
staticCommands,
|
|
45
|
+
contextualLoaders,
|
|
46
|
+
staticLoaders,
|
|
47
|
+
recentlyUsedNames = EMPTY_ARRAY
|
|
48
|
+
} = useSelect((select) => {
|
|
49
|
+
const { getCommands, getCommandLoaders } = select(commandsStore);
|
|
50
|
+
return {
|
|
51
|
+
contextualCommands: getCommands(true),
|
|
52
|
+
staticCommands: getCommands(false),
|
|
53
|
+
contextualLoaders: getCommandLoaders(true),
|
|
54
|
+
staticLoaders: getCommandLoaders(false),
|
|
55
|
+
recentlyUsedNames: select(preferencesStore).get(
|
|
56
|
+
"core/commands",
|
|
57
|
+
"recentlyUsed"
|
|
58
|
+
)
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
const [resolvedMap, setResolvedMap] = useState(() => /* @__PURE__ */ new Map());
|
|
62
|
+
const onResolved = useCallback((loaderName, cmds) => {
|
|
63
|
+
setResolvedMap((prev) => {
|
|
64
|
+
const prevCmds = prev.get(loaderName);
|
|
65
|
+
if (prevCmds && prevCmds.length === cmds.length && prevCmds.every((c, i) => c.name === cmds[i].name)) {
|
|
66
|
+
return prev;
|
|
67
|
+
}
|
|
68
|
+
const next = new Map(prev);
|
|
69
|
+
next.set(loaderName, cmds);
|
|
70
|
+
return next;
|
|
71
|
+
});
|
|
72
|
+
}, []);
|
|
73
|
+
const { recentNames, recentSet } = useMemo(() => {
|
|
74
|
+
const names = recentlyUsedNames.slice(0, MAX_RECENTLY_DISPLAYED);
|
|
75
|
+
return { recentNames: names, recentSet: new Set(names) };
|
|
76
|
+
}, [recentlyUsedNames]);
|
|
77
|
+
if (!recentlyUsedNames.length) {
|
|
78
|
+
return {
|
|
79
|
+
commands: [],
|
|
80
|
+
loaders: [],
|
|
81
|
+
recentSet: EMPTY_SET,
|
|
82
|
+
onResolved
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const allStaticCommands = [...contextualCommands, ...staticCommands];
|
|
86
|
+
const loaders = [...contextualLoaders, ...staticLoaders];
|
|
87
|
+
const allByName = /* @__PURE__ */ new Map();
|
|
88
|
+
allStaticCommands.forEach((c) => allByName.set(c.name, c));
|
|
89
|
+
for (const cmds of resolvedMap.values()) {
|
|
90
|
+
cmds.forEach((c) => {
|
|
91
|
+
if (!allByName.has(c.name)) {
|
|
92
|
+
allByName.set(c.name, c);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const commands = recentNames.map((n) => allByName.get(n)).filter(Boolean);
|
|
97
|
+
return { commands, loaders, recentSet, onResolved };
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
recordUsage,
|
|
101
|
+
useLoaderCollector,
|
|
102
|
+
useRecentCommands
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=use-recent-commands.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/use-recent-commands.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseSelect,\n\tuseDispatch,\n\tselect as globalSelect,\n\tdispatch,\n} from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useCallback, useEffect, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as commandsStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst MAX_RECENTLY_SAVED = 30;\nconst MAX_RECENTLY_DISPLAYED = 5;\nconst EMPTY_ARRAY = [];\nconst EMPTY_SET = new Set();\n\nexport function recordUsage( name ) {\n\tconst current =\n\t\tglobalSelect( preferencesStore ).get(\n\t\t\t'core/commands',\n\t\t\t'recentlyUsed'\n\t\t) ?? [];\n\tconst next = [ name, ...current.filter( ( n ) => n !== name ) ].slice(\n\t\t0,\n\t\tMAX_RECENTLY_SAVED\n\t);\n\tdispatch( preferencesStore ).set( 'core/commands', 'recentlyUsed', next );\n}\n\nexport function useLoaderCollector( hook, name, filterNames, onResolved ) {\n\tconst { setLoaderLoading } = unlock( useDispatch( commandsStore ) );\n\tconst { isLoading: loading, commands = [] } = hook( { search: '' } ) ?? {};\n\n\tuseEffect( () => {\n\t\tsetLoaderLoading( name, loading );\n\t}, [ setLoaderLoading, name, loading ] );\n\n\tconst filtered = filterNames\n\t\t? commands.filter( ( c ) => filterNames.has( c.name ) )\n\t\t: commands;\n\n\tuseEffect( () => {\n\t\tonResolved( name, filtered );\n\t}, [ onResolved, name, filtered ] );\n\n\t// Clear this loader's entries when it unmounts.\n\tuseEffect( () => {\n\t\treturn () => onResolved( name, [] );\n\t}, [ onResolved, name ] );\n}\n\nexport function useRecentCommands() {\n\tconst {\n\t\tcontextualCommands,\n\t\tstaticCommands,\n\t\tcontextualLoaders,\n\t\tstaticLoaders,\n\t\trecentlyUsedNames = EMPTY_ARRAY,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCommands, getCommandLoaders } = select( commandsStore );\n\t\treturn {\n\t\t\tcontextualCommands: getCommands( true ),\n\t\t\tstaticCommands: getCommands( false ),\n\t\t\tcontextualLoaders: getCommandLoaders( true ),\n\t\t\tstaticLoaders: getCommandLoaders( false ),\n\t\t\trecentlyUsedNames: select( preferencesStore ).get(\n\t\t\t\t'core/commands',\n\t\t\t\t'recentlyUsed'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst [ resolvedMap, setResolvedMap ] = useState( () => new Map() );\n\n\tconst onResolved = useCallback( ( loaderName, cmds ) => {\n\t\tsetResolvedMap( ( prev ) => {\n\t\t\tconst prevCmds = prev.get( loaderName );\n\t\t\tif (\n\t\t\t\tprevCmds &&\n\t\t\t\tprevCmds.length === cmds.length &&\n\t\t\t\tprevCmds.every( ( c, i ) => c.name === cmds[ i ].name )\n\t\t\t) {\n\t\t\t\treturn prev;\n\t\t\t}\n\t\t\tconst next = new Map( prev );\n\t\t\tnext.set( loaderName, cmds );\n\t\t\treturn next;\n\t\t} );\n\t}, [] );\n\n\tconst { recentNames, recentSet } = useMemo( () => {\n\t\tconst names = recentlyUsedNames.slice( 0, MAX_RECENTLY_DISPLAYED );\n\t\treturn { recentNames: names, recentSet: new Set( names ) };\n\t}, [ recentlyUsedNames ] );\n\n\tif ( ! recentlyUsedNames.length ) {\n\t\treturn {\n\t\t\tcommands: [],\n\t\t\tloaders: [],\n\t\t\trecentSet: EMPTY_SET,\n\t\t\tonResolved,\n\t\t};\n\t}\n\n\tconst allStaticCommands = [ ...contextualCommands, ...staticCommands ];\n\tconst loaders = [ ...contextualLoaders, ...staticLoaders ];\n\n\t// Merge static commands with loader-resolved commands.\n\tconst allByName = new Map();\n\tallStaticCommands.forEach( ( c ) => allByName.set( c.name, c ) );\n\tfor ( const cmds of resolvedMap.values() ) {\n\t\tcmds.forEach( ( c ) => {\n\t\t\tif ( ! allByName.has( c.name ) ) {\n\t\t\t\tallByName.set( c.name, c );\n\t\t\t}\n\t\t} );\n\t}\n\t// Return in recency order.\n\tconst commands = recentNames\n\t\t.map( ( n ) => allByName.get( n ) )\n\t\t.filter( Boolean );\n\n\treturn { commands, loaders, recentSet, onResolved };\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,OACM;AACP,SAAS,SAAS,wBAAwB;AAC1C,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAK1D,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AAEvB,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAC/B,IAAM,cAAc,CAAC;AACrB,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AM,CAAE;AAAA,MAC1B;AAAA,IACD,CAAE;AAAA,EACH;AAEA,QAAM,WAAW,YACf,IAAK,CAAE,MAAO,UAAU,IAAK,CAAE,CAAE,EACjC,OAAQ,OAAQ;AAElB,SAAO,EAAE,UAAU,SAAS,WAAW,WAAW;AACnD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -4,6 +4,7 @@ import reducer from "./reducer.mjs";
|
|
|
4
4
|
import * as actions from "./actions.mjs";
|
|
5
5
|
import * as selectors from "./selectors.mjs";
|
|
6
6
|
import * as privateActions from "./private-actions.mjs";
|
|
7
|
+
import * as privateSelectors from "./private-selectors.mjs";
|
|
7
8
|
import { unlock } from "../lock-unlock.mjs";
|
|
8
9
|
var STORE_NAME = "core/commands";
|
|
9
10
|
var store = createReduxStore(STORE_NAME, {
|
|
@@ -13,6 +14,7 @@ var store = createReduxStore(STORE_NAME, {
|
|
|
13
14
|
});
|
|
14
15
|
register(store);
|
|
15
16
|
unlock(store).registerPrivateActions(privateActions);
|
|
17
|
+
unlock(store).registerPrivateSelectors(privateSelectors);
|
|
16
18
|
export {
|
|
17
19
|
store
|
|
18
20
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/index.js"],
|
|
4
|
-
"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"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,oBAAoB;AAChC,SAAS,cAAc;AAEvB,IAAM,aAAa;AAiBZ,IAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;AAChB,OAAQ,KAAM,EAAE,uBAAwB,cAAe;",
|
|
4
|
+
"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 * as privateSelectors from './private-selectors';\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 );\nunlock( store ).registerPrivateSelectors( privateSelectors );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,oBAAoB;AAChC,YAAY,sBAAsB;AAClC,SAAS,cAAc;AAEvB,IAAM,aAAa;AAiBZ,IAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;AAChB,OAAQ,KAAM,EAAE,uBAAwB,cAAe;AACvD,OAAQ,KAAM,EAAE,yBAA0B,gBAAiB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,15 @@ function setContext(context) {
|
|
|
5
5
|
context
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
+
function setLoaderLoading(name, isLoading) {
|
|
9
|
+
return {
|
|
10
|
+
type: "SET_LOADER_LOADING",
|
|
11
|
+
name,
|
|
12
|
+
isLoading
|
|
13
|
+
};
|
|
14
|
+
}
|
|
8
15
|
export {
|
|
9
|
-
setContext
|
|
16
|
+
setContext,
|
|
17
|
+
setLoaderLoading
|
|
10
18
|
};
|
|
11
19
|
//# sourceMappingURL=private-actions.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-actions.js"],
|
|
4
|
-
"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"],
|
|
5
|
-
"mappings": ";AAOO,SAAS,WAAY,SAAU;AACrC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
|
|
4
|
+
"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\n/**\n * Sets whether a command loader is currently loading.\n *\n * @param {string} name Command loader name.\n * @param {boolean} isLoading Whether the loader is loading.\n *\n * @return {Object} action.\n */\nexport function setLoaderLoading( name, isLoading ) {\n\treturn {\n\t\ttype: 'SET_LOADER_LOADING',\n\t\tname,\n\t\tisLoading,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAOO,SAAS,WAAY,SAAU;AACrC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,iBAAkB,MAAM,WAAY;AACnD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/store/private-selectors.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Returns whether any command loader is currently loading.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether any loader is loading.\n */\nexport function isLoading( state ) {\n\treturn Object.values( state.loaderStates ).some( Boolean );\n}\n"],
|
|
5
|
+
"mappings": ";AAOO,SAAS,UAAW,OAAQ;AAClC,SAAO,OAAO,OAAQ,MAAM,YAAa,EAAE,KAAM,OAAQ;AAC1D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -58,11 +58,22 @@ function context(state = "root", action) {
|
|
|
58
58
|
}
|
|
59
59
|
return state;
|
|
60
60
|
}
|
|
61
|
+
function loaderStates(state = {}, action) {
|
|
62
|
+
switch (action.type) {
|
|
63
|
+
case "SET_LOADER_LOADING":
|
|
64
|
+
return {
|
|
65
|
+
...state,
|
|
66
|
+
[action.name]: action.isLoading
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return state;
|
|
70
|
+
}
|
|
61
71
|
var reducer = combineReducers({
|
|
62
72
|
commands,
|
|
63
73
|
commandLoaders,
|
|
64
74
|
isOpen,
|
|
65
|
-
context
|
|
75
|
+
context,
|
|
76
|
+
loaderStates
|
|
66
77
|
});
|
|
67
78
|
var reducer_default = reducer;
|
|
68
79
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/reducer.js"],
|
|
4
|
-
"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\tcategory: action.category,\n\t\t\t\t\tcallback: action.callback,\n\t\t\t\t\ticon: action.icon,\n\t\t\t\t\tkeywords: action.keywords,\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\tcategory: action.category,\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"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,uBAAuB;AAUhC,SAAS,SAAU,QAAQ,CAAC,GAAG,QAAS;AACvC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,MAAM,OAAO;AAAA,UACb,OAAO,OAAO;AAAA,UACd,aAAa,OAAO;AAAA,UACpB,SAAS,OAAO;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,UAAU,OAAO;AAAA,UACjB,MAAM,OAAO;AAAA,UACb,UAAU,OAAO;AAAA,QAClB;AAAA,MACD;AAAA,IACD,KAAK,sBAAsB;AAC1B,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,GAAG,GAAG,eAAe,IAAI;AAClD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,eAAgB,QAAQ,CAAC,GAAG,QAAS;AAC7C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,MAAM,OAAO;AAAA,UACb,SAAS,OAAO;AAAA,UAChB,UAAU,OAAO;AAAA,UACjB,MAAM,OAAO;AAAA,QACd;AAAA,MACD;AAAA,IACD,KAAK,6BAA6B;AACjC,YAAM,EAAE,CAAE,OAAO,IAAK,GAAG,GAAG,GAAG,eAAe,IAAI;AAClD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,OAAQ,QAAQ,OAAO,QAAS;AACxC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAUA,SAAS,QAAS,QAAQ,QAAQ,QAAS;AAC1C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,OAAO;AAAA,EAChB;AAEA,SAAO;AACR;AAEA,IAAM,UAAU,gBAAiB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,IAAO,kBAAQ;",
|
|
4
|
+
"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\tcategory: action.category,\n\t\t\t\t\tcallback: action.callback,\n\t\t\t\t\ticon: action.icon,\n\t\t\t\t\tkeywords: action.keywords,\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\tcategory: action.category,\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\nfunction loaderStates( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_LOADER_LOADING':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.name ]: action.isLoading,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nconst reducer = combineReducers( {\n\tcommands,\n\tcommandLoaders,\n\tisOpen,\n\tcontext,\n\tloaderStates,\n} );\n\nexport default reducer;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,uBAAuB;AAUhC,SAAS,SAAU,QAAQ,CAAC,GAAG,QAAS;AACvC,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,IAAK,GAAG;AAAA,UAChB,MAAM,OAAO;AAAA,UACb,OAAO,OAAO;AAAA,UACd,aAAa,OAAO;AAAA,UACpB,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A,EACA;AACD,CAAE;AAEF,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -107,10 +107,7 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
.commands-command-menu {
|
|
110
|
-
border-radius: 4px;
|
|
111
|
-
width: calc(100% - 32px);
|
|
112
110
|
margin: auto;
|
|
113
|
-
max-width: 400px;
|
|
114
111
|
position: relative;
|
|
115
112
|
top: calc(5% + 64px);
|
|
116
113
|
}
|
|
@@ -159,7 +156,7 @@
|
|
|
159
156
|
.commands-command-menu__container [cmdk-input] {
|
|
160
157
|
border: none;
|
|
161
158
|
width: 100%;
|
|
162
|
-
padding:
|
|
159
|
+
padding: 12px 4px;
|
|
163
160
|
outline: none;
|
|
164
161
|
color: #1e1e1e;
|
|
165
162
|
margin: 0;
|
|
@@ -175,20 +172,13 @@
|
|
|
175
172
|
outline: none;
|
|
176
173
|
}
|
|
177
174
|
.commands-command-menu__container [cmdk-item] {
|
|
178
|
-
border-radius: 2px;
|
|
179
175
|
cursor: pointer;
|
|
180
176
|
display: flex;
|
|
181
177
|
align-items: center;
|
|
178
|
+
padding: 4px 0;
|
|
182
179
|
color: #1e1e1e;
|
|
183
180
|
font-size: 13px;
|
|
184
181
|
}
|
|
185
|
-
.commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
|
|
186
|
-
background: var(--wp-admin-theme-color);
|
|
187
|
-
color: #fff;
|
|
188
|
-
}
|
|
189
|
-
.commands-command-menu__container [cmdk-item][aria-selected=true] svg, .commands-command-menu__container [cmdk-item]:active svg {
|
|
190
|
-
fill: #fff;
|
|
191
|
-
}
|
|
192
182
|
.commands-command-menu__container [cmdk-item][aria-disabled=true] {
|
|
193
183
|
color: #949494;
|
|
194
184
|
cursor: not-allowed;
|
|
@@ -197,16 +187,27 @@
|
|
|
197
187
|
fill: #1e1e1e;
|
|
198
188
|
}
|
|
199
189
|
.commands-command-menu__container [cmdk-item] > div {
|
|
200
|
-
|
|
190
|
+
border-radius: 2px;
|
|
191
|
+
min-height: 32px;
|
|
201
192
|
padding: 4px;
|
|
202
193
|
padding-right: 40px;
|
|
203
194
|
padding-left: 16px;
|
|
204
195
|
}
|
|
196
|
+
.commands-command-menu__container [cmdk-item][aria-selected=true] > div, .commands-command-menu__container [cmdk-item]:active > div {
|
|
197
|
+
background: var(--wp-admin-theme-color);
|
|
198
|
+
color: #fff;
|
|
199
|
+
}
|
|
200
|
+
.commands-command-menu__container [cmdk-item][aria-selected=true] > div svg, .commands-command-menu__container [cmdk-item]:active > div svg {
|
|
201
|
+
fill: #fff;
|
|
202
|
+
}
|
|
205
203
|
.commands-command-menu__container [cmdk-item] > .has-icon {
|
|
206
204
|
padding-right: 8px;
|
|
207
205
|
}
|
|
206
|
+
.commands-command-menu__container [cmdk-group]:has([cmdk-group-items]:empty) {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
208
209
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] {
|
|
209
|
-
max-height:
|
|
210
|
+
max-height: min(328px, 70vh - 48px);
|
|
210
211
|
overflow: auto;
|
|
211
212
|
scroll-padding-top: 8px;
|
|
212
213
|
scroll-padding-bottom: 8px;
|
|
@@ -214,14 +215,17 @@
|
|
|
214
215
|
.commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-group-items]:not(:empty)), .commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-empty]) {
|
|
215
216
|
border-top: 1px solid #ddd;
|
|
216
217
|
}
|
|
217
|
-
.commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-group-items]:not(:empty)) {
|
|
218
|
-
padding-top: 8px;
|
|
219
|
-
}
|
|
220
|
-
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
|
|
221
|
-
padding-bottom: 8px;
|
|
222
|
-
}
|
|
223
218
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
|
|
224
|
-
padding: 0 8px;
|
|
219
|
+
padding: 0 8px 4px;
|
|
220
|
+
}
|
|
221
|
+
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-group-heading] {
|
|
222
|
+
margin-top: 8px;
|
|
223
|
+
padding: 8px 16px;
|
|
224
|
+
line-height: 16px;
|
|
225
|
+
font-size: 11px;
|
|
226
|
+
font-weight: 499;
|
|
227
|
+
text-transform: uppercase;
|
|
228
|
+
color: #1e1e1e;
|
|
225
229
|
}
|
|
226
230
|
.commands-command-menu__container [cmdk-empty] {
|
|
227
231
|
display: flex;
|
package/build-style/style.css
CHANGED
|
@@ -107,10 +107,7 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
.commands-command-menu {
|
|
110
|
-
border-radius: 4px;
|
|
111
|
-
width: calc(100% - 32px);
|
|
112
110
|
margin: auto;
|
|
113
|
-
max-width: 400px;
|
|
114
111
|
position: relative;
|
|
115
112
|
top: calc(5% + 64px);
|
|
116
113
|
}
|
|
@@ -159,7 +156,7 @@
|
|
|
159
156
|
.commands-command-menu__container [cmdk-input] {
|
|
160
157
|
border: none;
|
|
161
158
|
width: 100%;
|
|
162
|
-
padding:
|
|
159
|
+
padding: 12px 4px;
|
|
163
160
|
outline: none;
|
|
164
161
|
color: #1e1e1e;
|
|
165
162
|
margin: 0;
|
|
@@ -175,20 +172,13 @@
|
|
|
175
172
|
outline: none;
|
|
176
173
|
}
|
|
177
174
|
.commands-command-menu__container [cmdk-item] {
|
|
178
|
-
border-radius: 2px;
|
|
179
175
|
cursor: pointer;
|
|
180
176
|
display: flex;
|
|
181
177
|
align-items: center;
|
|
178
|
+
padding: 4px 0;
|
|
182
179
|
color: #1e1e1e;
|
|
183
180
|
font-size: 13px;
|
|
184
181
|
}
|
|
185
|
-
.commands-command-menu__container [cmdk-item][aria-selected=true], .commands-command-menu__container [cmdk-item]:active {
|
|
186
|
-
background: var(--wp-admin-theme-color);
|
|
187
|
-
color: #fff;
|
|
188
|
-
}
|
|
189
|
-
.commands-command-menu__container [cmdk-item][aria-selected=true] svg, .commands-command-menu__container [cmdk-item]:active svg {
|
|
190
|
-
fill: #fff;
|
|
191
|
-
}
|
|
192
182
|
.commands-command-menu__container [cmdk-item][aria-disabled=true] {
|
|
193
183
|
color: #949494;
|
|
194
184
|
cursor: not-allowed;
|
|
@@ -197,16 +187,27 @@
|
|
|
197
187
|
fill: #1e1e1e;
|
|
198
188
|
}
|
|
199
189
|
.commands-command-menu__container [cmdk-item] > div {
|
|
200
|
-
|
|
190
|
+
border-radius: 2px;
|
|
191
|
+
min-height: 32px;
|
|
201
192
|
padding: 4px;
|
|
202
193
|
padding-left: 40px;
|
|
203
194
|
padding-right: 16px;
|
|
204
195
|
}
|
|
196
|
+
.commands-command-menu__container [cmdk-item][aria-selected=true] > div, .commands-command-menu__container [cmdk-item]:active > div {
|
|
197
|
+
background: var(--wp-admin-theme-color);
|
|
198
|
+
color: #fff;
|
|
199
|
+
}
|
|
200
|
+
.commands-command-menu__container [cmdk-item][aria-selected=true] > div svg, .commands-command-menu__container [cmdk-item]:active > div svg {
|
|
201
|
+
fill: #fff;
|
|
202
|
+
}
|
|
205
203
|
.commands-command-menu__container [cmdk-item] > .has-icon {
|
|
206
204
|
padding-left: 8px;
|
|
207
205
|
}
|
|
206
|
+
.commands-command-menu__container [cmdk-group]:has([cmdk-group-items]:empty) {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
208
209
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] {
|
|
209
|
-
max-height:
|
|
210
|
+
max-height: min(328px, 70vh - 48px);
|
|
210
211
|
overflow: auto;
|
|
211
212
|
scroll-padding-top: 8px;
|
|
212
213
|
scroll-padding-bottom: 8px;
|
|
@@ -214,14 +215,17 @@
|
|
|
214
215
|
.commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-group-items]:not(:empty)), .commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-empty]) {
|
|
215
216
|
border-top: 1px solid #ddd;
|
|
216
217
|
}
|
|
217
|
-
.commands-command-menu__container [cmdk-root] > [cmdk-list]:has([cmdk-group-items]:not(:empty)) {
|
|
218
|
-
padding-top: 8px;
|
|
219
|
-
}
|
|
220
|
-
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
|
|
221
|
-
padding-bottom: 8px;
|
|
222
|
-
}
|
|
223
218
|
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
|
|
224
|
-
padding: 0 8px;
|
|
219
|
+
padding: 0 8px 4px;
|
|
220
|
+
}
|
|
221
|
+
.commands-command-menu__container [cmdk-root] > [cmdk-list] [cmdk-group-heading] {
|
|
222
|
+
margin-top: 8px;
|
|
223
|
+
padding: 8px 16px;
|
|
224
|
+
line-height: 16px;
|
|
225
|
+
font-size: 11px;
|
|
226
|
+
font-weight: 499;
|
|
227
|
+
text-transform: uppercase;
|
|
228
|
+
color: #1e1e1e;
|
|
225
229
|
}
|
|
226
230
|
.commands-command-menu__container [cmdk-empty] {
|
|
227
231
|
display: flex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/commands",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Handles the commands menu.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,15 +44,16 @@
|
|
|
44
44
|
"react-native": "src/index",
|
|
45
45
|
"wpScript": true,
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@wordpress/base-styles": "^6.
|
|
48
|
-
"@wordpress/components": "^32.
|
|
49
|
-
"@wordpress/data": "^10.
|
|
50
|
-
"@wordpress/element": "^6.
|
|
51
|
-
"@wordpress/i18n": "^6.
|
|
52
|
-
"@wordpress/icons": "^12.
|
|
53
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
47
|
+
"@wordpress/base-styles": "^6.19.0",
|
|
48
|
+
"@wordpress/components": "^32.5.0",
|
|
49
|
+
"@wordpress/data": "^10.43.0",
|
|
50
|
+
"@wordpress/element": "^6.43.0",
|
|
51
|
+
"@wordpress/i18n": "^6.16.0",
|
|
52
|
+
"@wordpress/icons": "^12.1.0",
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^5.43.0",
|
|
54
|
+
"@wordpress/preferences": "^4.43.0",
|
|
55
|
+
"@wordpress/private-apis": "^1.43.0",
|
|
56
|
+
"@wordpress/warning": "^3.43.0",
|
|
56
57
|
"clsx": "^2.1.1",
|
|
57
58
|
"cmdk": "^1.0.0"
|
|
58
59
|
},
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|
|
65
66
|
},
|
|
66
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "2cea90674d11aa521ec3f71652fb3a6a4c383969"
|
|
67
68
|
}
|