{"version":3,"file":"screen-block-list.mjs","names":["blockEditorPrivateApis","blocksStore","WCText","ItemGroup","HStack"],"sources":["../src/screen-block-list.tsx"],"sourcesContent":["import { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalText as WCText,\n} from '@wordpress/components';\nimport {\n\t// eslint-disable-next-line @wordpress/use-recommended-components -- Intentional early adoption of the new Menu, pending WordPress/gutenberg#76135.\n\tMenu,\n\tStack,\n} from '@wordpress/ui';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} from '@wordpress/element';\nimport type { BlockType, BlockTypeIcon } from '@wordpress/blocks';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport {\n\tbutton,\n\tcaption,\n\tformInput,\n\tformSelect,\n\tfunnel,\n\theading,\n\theadingLevel1,\n\theadingLevel2,\n\theadingLevel3,\n\theadingLevel4,\n\theadingLevel5,\n\theadingLevel6,\n\tlink,\n} from '@wordpress/icons';\nimport { useBlockVariations } from './variations/variations-panel';\nimport { ScreenHeader } from './screen-header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { ELEMENTS, type ElementName } from './screen-element';\nimport { Subtitle } from './subtitle';\nimport { useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\nimport { GlobalStylesContext } from './context';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasBackgroundPanel,\n\tsearchItems,\n} = unlock( blockEditorPrivateApis );\n\n// `text` is the site's base text, styled under Typography rather than listed.\ntype ListedElementName = Exclude< ElementName, 'text' >;\n\n/*\n * Elements are listed alongside blocks, grouped under subheadings, so that\n * anything styleable is one list away rather than behind its own drilldown.\n * Their labels are the titles of their screens, singular to match how blocks\n * are listed.\n */\nconst ELEMENT_GROUPS: { title: string; elements: ListedElementName[] }[] = [\n\t{\n\t\ttitle: __( 'Elements' ),\n\t\telements: [ 'link', 'caption', 'cite' ],\n\t},\n\t{\n\t\ttitle: __( 'Headings' ),\n\t\t// `heading` styles every level at once; each level can then override\n\t\t// it. Themes set most of their heading styles here.\n\t\telements: [ 'heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n\t{\n\t\ttitle: __( 'Form controls' ),\n\t\telements: [ 'textInput', 'select', 'button' ],\n\t},\n];\n\n// Where an element maps closely to a block, it reuses that block's icon, e.g.\n// the Heading block's icon for all headings and the Button block's for buttons.\nconst ELEMENT_ICONS: Record< ListedElementName, React.ReactElement > = {\n\tlink,\n\tcaption,\n\tcite: caption,\n\theading,\n\th1: headingLevel1,\n\th2: headingLevel2,\n\th3: headingLevel3,\n\th4: headingLevel4,\n\th5: headingLevel5,\n\th6: headingLevel6,\n\ttextInput: formInput,\n\tselect: formSelect,\n\tbutton,\n};\n\n/**\n * Whether a value, or anything nested inside it, holds a real user value.\n *\n * A user entry can survive as an empty husk: clearing a value writes\n * `undefined` in place rather than removing the key, so\n * `{ color: { text: undefined } }` means \"not customized\". An empty string\n * and zero are real values — an intentionally blank CSS string is still a\n * user entry.\n *\n * @param value The value to inspect.\n * @return Whether the value holds at least one leaf value.\n */\nfunction hasAnyValue( value: unknown ): boolean {\n\tif ( value === undefined || value === null ) {\n\t\treturn false;\n\t}\n\tif ( Array.isArray( value ) ) {\n\t\treturn value.length > 0;\n\t}\n\tif ( typeof value === 'object' ) {\n\t\treturn Object.values( value ).some( hasAnyValue );\n\t}\n\treturn true;\n}\n\n/**\n * Whether the user has customized a block.\n *\n * Per-block user data lives under two roots: `styles.blocks` for style values\n * and `settings.blocks` for things like a block-specific color palette. Either\n * one counts as a customization, and both are resettable by the user.\n *\n * Reads the user layer only. The merged config would match nearly every block,\n * because themes style most of them.\n *\n * @param user      The user's global styles config.\n * @param blockName The block to check, e.g. `core/quote`.\n * @return Whether the user has any styles or settings for that block.\n */\nexport function hasUserStylesForBlock(\n\tuser: GlobalStylesConfig | undefined,\n\tblockName: string\n): boolean {\n\treturn (\n\t\thasAnyValue( user?.styles?.blocks?.[ blockName ] ) ||\n\t\thasAnyValue( user?.settings?.blocks?.[ blockName ] )\n\t);\n}\n\ntype StyleFilter = 'all' | 'customized';\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks: any, block: any ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName: string ) {\n\tconst [ rawSettings ] = useSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasBackgroundPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\ninterface ListMenuItemProps {\n\tpath: string;\n\ticon: BlockTypeIcon;\n\ttitle: string;\n}\n\n// Shared by blocks and elements so that every row in the list looks the same.\nfunction ListMenuItem( { path, icon, title }: ListMenuItemProps ) {\n\treturn (\n\t\t<NavigationButtonAsItem path={ path }>\n\t\t\t<Stack direction=\"row\" align=\"center\" gap=\"sm\">\n\t\t\t\t<BlockIcon\n\t\t\t\t\tclassName=\"global-styles-ui-block-types-item__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<span>{ title }</span>\n\t\t\t</Stack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\ninterface BlockMenuItemProps {\n\tblock: any;\n}\n\nexport function BlockMenuItem( { block }: BlockMenuItemProps ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ListMenuItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\ticon={ block.icon }\n\t\t\ttitle={ block.title }\n\t\t/>\n\t);\n}\n\nfunction ElementMenuItem( { element }: { element: ListedElementName } ) {\n\treturn (\n\t\t<ListMenuItem\n\t\t\tpath={ '/blocks/elements/' + element }\n\t\t\ticon={ ELEMENT_ICONS[ element ] }\n\t\t\ttitle={ ELEMENTS[ element ].title }\n\t\t/>\n\t);\n}\n\ninterface ListGroupProps {\n\ttitle: string;\n\tchildren: React.ReactNode;\n}\n\nfunction ListGroup( { title, children }: ListGroupProps ) {\n\treturn (\n\t\t<div className=\"global-styles-ui-block-types-group\">\n\t\t\t<div className=\"global-styles-ui-block-types-group__title\">\n\t\t\t\t<Subtitle level={ 3 }>{ title }</Subtitle>\n\t\t\t</div>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nfunction EmptyList( {\n\tfilterValue,\n\tstyleFilter,\n}: {\n\tfilterValue: string;\n\tstyleFilter: StyleFilter;\n} ) {\n\t// While searching, an empty list means the search matched nothing, whether\n\t// or not the customized filter is also on.\n\tconst label =\n\t\t'customized' === styleFilter && ! filterValue\n\t\t\t? __( \"You haven't customized any blocks or elements yet.\" )\n\t\t\t: __( 'No results found.' );\n\treturn (\n\t\t<WCText\n\t\t\talign=\"center\"\n\t\t\tas=\"p\"\n\t\t\tclassName=\"global-styles-ui-block-types-item-list__no-results\"\n\t\t>\n\t\t\t{ label }\n\t\t</WCText>\n\t);\n}\n\ninterface ListProps {\n\tfilterValue: string;\n\tstyleFilter: StyleFilter;\n}\n\nfunction getFilteredElementGroups(\n\tfilterValue: string,\n\tstyleFilter: StyleFilter,\n\tcustomizedElementNames: Set< string >\n) {\n\tconst search = filterValue.trim().toLowerCase();\n\treturn ELEMENT_GROUPS.map( ( group ) => ( {\n\t\t...group,\n\t\telements: group.elements.filter(\n\t\t\t( element ) =>\n\t\t\t\t// The element's name and group title match too, so \"h1\" finds\n\t\t\t\t// Heading 1 and \"form\" lists the form controls.\n\t\t\t\t( ! search ||\n\t\t\t\t\t[ ELEMENTS[ element ].title, element, group.title ]\n\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t.includes( search ) ) &&\n\t\t\t\t( styleFilter !== 'customized' ||\n\t\t\t\t\tcustomizedElementNames.has( element ) )\n\t\t),\n\t} ) ).filter( ( group ) => group.elements.length > 0 );\n}\n\nfunction BlockAndElementList( { filterValue, styleFilter }: ListProps ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst { user } = useContext( GlobalStylesContext );\n\n\t// Computed once for the whole list rather than per row, so the list does\n\t// not open a context subscription for every registered block.\n\tconst customizedBlockNames = useMemo( () => {\n\t\tconst names = new Set< string >();\n\t\tconst blockNames = [\n\t\t\t...Object.keys( user?.styles?.blocks ?? {} ),\n\t\t\t...Object.keys( user?.settings?.blocks ?? {} ),\n\t\t];\n\t\tblockNames.forEach( ( blockName ) => {\n\t\t\tif ( hasUserStylesForBlock( user, blockName ) ) {\n\t\t\t\tnames.add( blockName );\n\t\t\t}\n\t\t} );\n\t\treturn names;\n\t}, [ user ] );\n\n\t// Reads the user layer only, for the same reason as blocks.\n\tconst customizedElementNames = useMemo( () => {\n\t\tconst names = new Set< string >();\n\t\tObject.entries( user?.styles?.elements ?? {} ).forEach(\n\t\t\t( [ name, styles ] ) => {\n\t\t\t\tif ( hasAnyValue( styles ) ) {\n\t\t\t\t\tnames.add( name );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\treturn names;\n\t}, [ user ] );\n\n\tconst filteredElementGroups = getFilteredElementGroups(\n\t\tfilterValue,\n\t\tstyleFilter,\n\t\tcustomizedElementNames\n\t);\n\n\t// Ranks title matches above keyword, category and description matches, the\n\t// same way the inserter does. Without a search value the list keeps its\n\t// registration order.\n\tconst searchedBlockTypes: BlockType[] = searchItems(\n\t\tsortedBlockTypes,\n\t\tfilterValue\n\t);\n\n\tconst filteredBlockTypes =\n\t\tstyleFilter === 'customized'\n\t\t\t? searchedBlockTypes.filter( ( blockType ) =>\n\t\t\t\t\tcustomizedBlockNames.has( blockType.name )\n\t\t\t\t)\n\t\t\t: searchedBlockTypes;\n\n\tconst blockTypesListRef = useRef< HTMLDivElement >( null );\n\tconst elementCount = filteredElementGroups.reduce(\n\t\t( total, group ) => total + group.elements.length,\n\t\t0\n\t);\n\n\t// Announce result count on change\n\tconst hasBlockResults = filteredBlockTypes.length > 0;\n\tuseEffect( () => {\n\t\tif ( ! filterValue && styleFilter === 'all' ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst blockCount = hasBlockResults\n\t\t\t? blockTypesListRef.current?.childElementCount || 0\n\t\t\t: 0;\n\t\tconst count = elementCount + blockCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, 'polite' );\n\t}, [\n\t\tfilterValue,\n\t\tstyleFilter,\n\t\thasBlockResults,\n\t\telementCount,\n\t\tdebouncedSpeak,\n\t] );\n\n\tif ( ! elementCount && ! hasBlockResults ) {\n\t\treturn (\n\t\t\t<EmptyList\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tstyleFilter={ styleFilter }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredElementGroups.map( ( group ) => (\n\t\t\t\t<ListGroup key={ group.title } title={ group.title }>\n\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\tclassName=\"global-styles-ui-block-types-item-list\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ group.elements.map( ( element ) => (\n\t\t\t\t\t\t\t<ElementMenuItem\n\t\t\t\t\t\t\t\tkey={ element }\n\t\t\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ListGroup>\n\t\t\t) ) }\n\t\t\t{ hasBlockResults && (\n\t\t\t\t<ListGroup title={ __( 'Blocks' ) }>\n\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\tref={ blockTypesListRef }\n\t\t\t\t\t\tclassName=\"global-styles-ui-block-types-item-list\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ListGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst MemoizedBlockAndElementList = memo( BlockAndElementList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ styleFilter, setStyleFilter ] = useState< StyleFilter >( 'all' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks & Elements' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t\"Customize how a block or element looks everywhere it's used.\"\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<HStack\n\t\t\t\tclassName=\"global-styles-ui-block-types-filter\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tspacing={ 2 }\n\t\t\t>\n\t\t\t\t<SearchControl\n\t\t\t\t\tclassName=\"global-styles-ui-block-types-search\"\n\t\t\t\t\tonChange={ setFilterValue }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<Menu.Root>\n\t\t\t\t\t<Menu.Trigger\n\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\ticon={ funnel }\n\t\t\t\t\t\t\t\tlabel={ __( 'Filter blocks' ) }\n\t\t\t\t\t\t\t\tisPressed={ styleFilter !== 'all' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<Menu.Popup>\n\t\t\t\t\t\t<Menu.RadioGroup\n\t\t\t\t\t\t\tvalue={ styleFilter }\n\t\t\t\t\t\t\tonValueChange={ ( value: StyleFilter ) =>\n\t\t\t\t\t\t\t\tsetStyleFilter( value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.RadioItem value=\"all\" closeOnClick>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'All blocks' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t<Menu.RadioItem value=\"customized\" closeOnClick>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'Customized' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t</Menu.RadioGroup>\n\t\t\t\t\t</Menu.Popup>\n\t\t\t\t</Menu.Root>\n\t\t\t</HStack>\n\t\t\t<MemoizedBlockAndElementList\n\t\t\t\tfilterValue={ deferredFilterValue }\n\t\t\t\tstyleFilter={ styleFilter }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwDA,MAAM,EACL,uBACA,uBACA,mBACA,4BACA,kBACA,uBACA,gBACG,OAAQA,WAAuB;AAWnC,MAAM,iBAAqE;CAC1E;EACC,OAAO,GAAI,UAAW;EACtB,UAAU;GAAE;GAAQ;GAAW;EAAO;CACvC;CACA;EACC,OAAO,GAAI,UAAW;EAGtB,UAAU;GAAE;GAAW;GAAM;GAAM;GAAM;GAAM;GAAM;EAAK;CAC3D;CACA;EACC,OAAO,GAAI,eAAgB;EAC3B,UAAU;GAAE;GAAa;GAAU;EAAS;CAC7C;AACD;AAIA,MAAM,gBAAiE;CACtE;CACA;CACA,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