@wordpress/block-library 9.19.0 → 9.20.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/archives/edit.js +2 -2
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/audio/edit.js +66 -33
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/avatar/index.js +8 -3
  7. package/build/avatar/index.js.map +1 -1
  8. package/build/button/edit.js +43 -16
  9. package/build/button/edit.js.map +1 -1
  10. package/build/comment-template/hooks.js +6 -0
  11. package/build/comment-template/hooks.js.map +1 -1
  12. package/build/cover/index.js +8 -1
  13. package/build/cover/index.js.map +1 -1
  14. package/build/image/constants.js +2 -1
  15. package/build/image/constants.js.map +1 -1
  16. package/build/image/image.js +85 -72
  17. package/build/image/image.js.map +1 -1
  18. package/build/latest-posts/edit.js +2 -1
  19. package/build/latest-posts/edit.js.map +1 -1
  20. package/build/navigation/use-template-part-area-label.js +7 -6
  21. package/build/navigation/use-template-part-area-label.js.map +1 -1
  22. package/build/post-author/edit.js +1 -1
  23. package/build/post-author/edit.js.map +1 -1
  24. package/build/post-author/index.js +8 -1
  25. package/build/post-author/index.js.map +1 -1
  26. package/build/post-author-name/edit.js +2 -2
  27. package/build/post-author-name/edit.js.map +1 -1
  28. package/build/query/edit/inspector-controls/index.js +2 -0
  29. package/build/query/edit/inspector-controls/index.js.map +1 -1
  30. package/build/query/edit/inspector-controls/order-control.js +3 -2
  31. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  32. package/build/query/utils.js +45 -0
  33. package/build/query/utils.js.map +1 -1
  34. package/build/query-total/index.js +2 -2
  35. package/build/query-total/index.js.map +1 -1
  36. package/build/site-logo/index.js +8 -1
  37. package/build/site-logo/index.js.map +1 -1
  38. package/build/social-links/index.js +1 -0
  39. package/build/social-links/index.js.map +1 -1
  40. package/build/table-of-contents/hooks.js +6 -3
  41. package/build/table-of-contents/hooks.js.map +1 -1
  42. package/build/template-part/edit/advanced-controls.js +1 -1
  43. package/build/template-part/edit/advanced-controls.js.map +1 -1
  44. package/build/template-part/edit/utils/hooks.js +1 -1
  45. package/build/template-part/edit/utils/hooks.js.map +1 -1
  46. package/build-module/archives/edit.js +2 -2
  47. package/build-module/archives/edit.js.map +1 -1
  48. package/build-module/audio/edit.js +68 -35
  49. package/build-module/audio/edit.js.map +1 -1
  50. package/build-module/avatar/index.js +8 -3
  51. package/build-module/avatar/index.js.map +1 -1
  52. package/build-module/button/edit.js +44 -17
  53. package/build-module/button/edit.js.map +1 -1
  54. package/build-module/comment-template/hooks.js +6 -0
  55. package/build-module/comment-template/hooks.js.map +1 -1
  56. package/build-module/cover/index.js +8 -1
  57. package/build-module/cover/index.js.map +1 -1
  58. package/build-module/image/constants.js +1 -0
  59. package/build-module/image/constants.js.map +1 -1
  60. package/build-module/image/image.js +88 -75
  61. package/build-module/image/image.js.map +1 -1
  62. package/build-module/latest-posts/edit.js +2 -1
  63. package/build-module/latest-posts/edit.js.map +1 -1
  64. package/build-module/navigation/use-template-part-area-label.js +7 -6
  65. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  66. package/build-module/post-author/edit.js +1 -1
  67. package/build-module/post-author/edit.js.map +1 -1
  68. package/build-module/post-author/index.js +8 -1
  69. package/build-module/post-author/index.js.map +1 -1
  70. package/build-module/post-author-name/edit.js +2 -2
  71. package/build-module/post-author-name/edit.js.map +1 -1
  72. package/build-module/query/edit/inspector-controls/index.js +3 -1
  73. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  74. package/build-module/query/edit/inspector-controls/order-control.js +3 -2
  75. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  76. package/build-module/query/utils.js +44 -0
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/query-total/index.js +2 -2
  79. package/build-module/query-total/index.js.map +1 -1
  80. package/build-module/site-logo/index.js +8 -1
  81. package/build-module/site-logo/index.js.map +1 -1
  82. package/build-module/social-links/index.js +1 -0
  83. package/build-module/social-links/index.js.map +1 -1
  84. package/build-module/table-of-contents/hooks.js +6 -3
  85. package/build-module/table-of-contents/hooks.js.map +1 -1
  86. package/build-module/template-part/edit/advanced-controls.js +1 -1
  87. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  88. package/build-module/template-part/edit/utils/hooks.js +1 -1
  89. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  90. package/build-style/editor-rtl.css +0 -9
  91. package/build-style/editor.css +0 -9
  92. package/build-style/image/editor-rtl.css +0 -9
  93. package/build-style/image/editor.css +0 -9
  94. package/package.json +35 -35
  95. package/src/archives/edit.js +2 -2
  96. package/src/audio/edit.js +84 -33
  97. package/src/avatar/block.json +8 -3
  98. package/src/button/edit.js +69 -24
  99. package/src/comment-template/hooks.js +14 -6
  100. package/src/cover/block.json +8 -1
  101. package/src/image/constants.js +1 -0
  102. package/src/image/editor.scss +0 -13
  103. package/src/image/image.js +115 -122
  104. package/src/latest-posts/edit.js +1 -0
  105. package/src/navigation/use-template-part-area-label.js +6 -6
  106. package/src/post-author/block.json +8 -1
  107. package/src/post-author/edit.js +1 -1
  108. package/src/post-author-name/edit.js +4 -4
  109. package/src/query/edit/inspector-controls/index.js +3 -1
  110. package/src/query/edit/inspector-controls/order-control.js +9 -3
  111. package/src/query/utils.js +58 -0
  112. package/src/query-total/block.json +2 -2
  113. package/src/query-total/index.php +2 -2
  114. package/src/site-logo/block.json +8 -1
  115. package/src/site-title/index.php +1 -1
  116. package/src/social-links/block.json +1 -0
  117. package/src/table-of-contents/hooks.js +5 -2
  118. package/src/template-part/edit/advanced-controls.js +1 -1
  119. package/src/template-part/edit/utils/hooks.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_coreData","_blockEditor","_htmlEntities","_blocks","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","exports","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","decodeEntities","usePostTypes","postTypes","useSelect","select","getPostTypes","coreStore","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","useMemo","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","postTypeFormatSupportMap","supports","useTaxonomies","postType","getTaxonomies","getPostType","visibility","publicly_queryable","useIsPostTypeHierarchical","hierarchical","useAllowedControls","attributes","blocksStore","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","namespace","clonedBlocks","block","cloneBlock","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","blockName","blockSupportsInteractivity","Object","is","getBlockSupport","blockSupportsInteractivityClientNavigation","blockInteractivity","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks","getQueryContextFromTemplate","templateSlug","isSingular","templateType","singularTemplates","templateTypeFromSlug","queryFromTemplateSlug","slice","join"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcloneBlock,\n\tgetBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n * 3. A helper map with post format support per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\tconst postTypeFormatSupportMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] =\n\t\t\t\ttype.supports?.[ 'post-formats' ] || false;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\treturn {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t};\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst activeVariationName = select(\n\t\t\t\tblocksStore\n\t\t\t).getActiveBlockVariation( 'core/query', attributes )?.name;\n\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn 'core/query';\n\t\t\t}\n\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\t`core/query/${ activeVariationName }`,\n\t\t\t\trootClientId\n\t\t\t);\n\n\t\t\treturn activePatterns.length > 0\n\t\t\t\t? `core/query/${ activeVariationName }`\n\t\t\t\t: 'core/query';\n\t\t},\n\t\t[ clientId, attributes ]\n\t);\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\t\t\t\t\tconst blockInteractivity =\n\t\t\t\t\t\tblockSupportsInteractivity ||\n\t\t\t\t\t\tblockSupportsInteractivityClientNavigation;\n\t\t\t\t\tif ( ! blockInteractivity ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n\n/**\n * Helper function that returns the query context from the editor based on the\n * available template slug.\n *\n * @param {string} templateSlug Current template slug based on context.\n * @return {Object} An object with isSingular and templateType properties.\n */\nexport function getQueryContextFromTemplate( templateSlug ) {\n\t// In the Post Editor, the template slug is not available.\n\tif ( ! templateSlug ) {\n\t\treturn { isSingular: true };\n\t}\n\tlet isSingular = false;\n\tlet templateType = templateSlug === 'wp' ? 'custom' : templateSlug;\n\tconst singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];\n\tconst templateTypeFromSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-', 1 )[ 0 ]\n\t\t: templateSlug;\n\tconst queryFromTemplateSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-' ).slice( 1 ).join( '-' )\n\t\t: '';\n\tif ( queryFromTemplateSlug ) {\n\t\ttemplateType = templateTypeFromSlug;\n\t}\n\tisSingular = singularTemplates.includes( templateType );\n\n\treturn { isSingular, templateType };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAYA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,eAAe,GAAKC,QAAQ,IAAM;EAC9C,MAAMC,OAAO,GAAGD,QAAQ,EAAEE,MAAM,CAC/B,CAAEC,WAAW,EAAEC,MAAM,KAAM;IAC1B,MAAM;MAAEC,OAAO;MAAEC,SAAS;MAAEC;IAAM,CAAC,GAAGJ,WAAW;IACjDE,OAAO,CAAED,MAAM,CAACI,EAAE,CAAE,GAAGJ,MAAM;IAC7BE,SAAS,CAAEF,MAAM,CAACK,IAAI,CAAE,GAAGL,MAAM;IACjCG,KAAK,CAACG,IAAI,CAAEN,MAAM,CAACK,IAAK,CAAC;IACzB,OAAON,WAAW;EACnB,CAAC,EACD;IAAEE,OAAO,EAAE,CAAC,CAAC;IAAEC,SAAS,EAAE,CAAC,CAAC;IAAEC,KAAK,EAAE;EAAG,CACzC,CAAC;EACD,OAAO;IACNP,QAAQ;IACR,GAAGC;EACJ,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAU,OAAA,CAAAZ,eAAA,GAAAA,eAAA;AASO,MAAMa,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,IAAI,KAAM;EACzD,MAAMC,cAAc,GAAGD,IAAI,CAACE,K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E,GAAG,EAAE,CAAE,CAAC,CAAE,CAAC,CAAE,GACjC4F,YAAY;EACf,MAAMK,qBAAqB,GAAGL,YAAY,CAACzE,QAAQ,CAAE,GAAI,CAAC,GACvDyE,YAAY,CAAC5F,KAAK,CAAE,GAAI,CAAC,CAACkG,KAAK,CAAE,CAAE,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC,GAChD,EAAE;EACL,IAAKF,qBAAqB,EAAG;IAC5BH,YAAY,GAAGE,oBAAoB;EACpC;EACAH,UAAU,GAAGE,iBAAiB,CAAC5E,QAAQ,CAAE2E,YAAa,CAAC;EAEvD,OAAO;IAAED,UAAU;IAAEC;EAAa,CAAC;AACpC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_coreData","_blockEditor","_htmlEntities","_i18n","_blocks","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","exports","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","decodeEntities","usePostTypes","postTypes","useSelect","select","getPostTypes","coreStore","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","useMemo","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","postTypeFormatSupportMap","supports","useTaxonomies","postType","getTaxonomies","getPostType","visibility","publicly_queryable","useIsPostTypeHierarchical","hierarchical","useOrderByOptions","supportsCustomOrder","orderByOptions","__","useAllowedControls","attributes","blocksStore","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","namespace","clonedBlocks","block","cloneBlock","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","blockName","blockSupportsInteractivity","Object","is","getBlockSupport","blockSupportsInteractivityClientNavigation","blockInteractivity","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks","getQueryContextFromTemplate","templateSlug","isSingular","templateType","singularTemplates","templateTypeFromSlug","queryFromTemplateSlug","slice","join"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcloneBlock,\n\tgetBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n/** @typedef {import('@wordpress/components/build-types/query-controls/types').OrderByOption} OrderByOption */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n * 3. A helper map with post format support per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\tconst postTypeFormatSupportMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] =\n\t\t\t\ttype.supports?.[ 'post-formats' ] || false;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\treturn {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t};\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * List of avaiable options to order by.\n *\n * @param {string} postType The post type to check.\n * @return {OrderByOption[]} List of order options.\n */\nexport function useOrderByOptions( postType ) {\n\tconst supportsCustomOrder = useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn !! type?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst orderByOptions = [\n\t\t\t{\n\t\t\t\tlabel: __( 'Newest to oldest' ),\n\t\t\t\tvalue: 'date/desc',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Oldest to newest' ),\n\t\t\t\tvalue: 'date/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\t\t\tlabel: __( 'A → Z' ),\n\t\t\t\tvalue: 'title/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\t\t\tlabel: __( 'Z → A' ),\n\t\t\t\tvalue: 'title/desc',\n\t\t\t},\n\t\t];\n\n\t\tif ( supportsCustomOrder ) {\n\t\t\torderByOptions.push(\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by ascending menu order. */\n\t\t\t\t\tlabel: __( 'Ascending by order' ),\n\t\t\t\t\tvalue: 'menu_order/asc',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by descending menu order. */\n\t\t\t\t\tlabel: __( 'Descending by order' ),\n\t\t\t\t\tvalue: 'menu_order/desc',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn orderByOptions;\n\t}, [ supportsCustomOrder ] );\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst activeVariationName = select(\n\t\t\t\tblocksStore\n\t\t\t).getActiveBlockVariation( 'core/query', attributes )?.name;\n\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn 'core/query';\n\t\t\t}\n\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\t`core/query/${ activeVariationName }`,\n\t\t\t\trootClientId\n\t\t\t);\n\n\t\t\treturn activePatterns.length > 0\n\t\t\t\t? `core/query/${ activeVariationName }`\n\t\t\t\t: 'core/query';\n\t\t},\n\t\t[ clientId, attributes ]\n\t);\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\t\t\t\t\tconst blockInteractivity =\n\t\t\t\t\t\tblockSupportsInteractivity ||\n\t\t\t\t\t\tblockSupportsInteractivityClientNavigation;\n\t\t\t\t\tif ( ! blockInteractivity ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n\n/**\n * Helper function that returns the query context from the editor based on the\n * available template slug.\n *\n * @param {string} templateSlug Current template slug based on context.\n * @return {Object} An object with isSingular and templateType properties.\n */\nexport function getQueryContextFromTemplate( templateSlug ) {\n\t// In the Post Editor, the template slug is not available.\n\tif ( ! templateSlug ) {\n\t\treturn { isSingular: true };\n\t}\n\tlet isSingular = false;\n\tlet templateType = templateSlug === 'wp' ? 'custom' : templateSlug;\n\tconst singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];\n\tconst templateTypeFromSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-', 1 )[ 0 ]\n\t\t: templateSlug;\n\tconst queryFromTemplateSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-' ).slice( 1 ).join( '-' )\n\t\t: '';\n\tif ( queryFromTemplateSlug ) {\n\t\ttemplateType = templateTypeFromSlug;\n\t}\n\tisSingular = singularTemplates.includes( templateType );\n\n\treturn { isSingular, templateType };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AATA;AACA;AACA;;AAaA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,eAAe,GAAKC,QAAQ,IAAM;EAC9C,MAAMC,OAAO,GAAGD,QAAQ,EAAEE,MAAM,CAC/B,CAAEC,WAAW,EAAEC,MAAM,KAAM;IAC1B,MAAM;MAAEC,OAAO;MAAEC,SAAS;MAAEC;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AAA;AAOO,SAASc,2BAA2BA,CAAEC,YAAY,EAAG;EAC3D;EACA,IAAK,CAAEA,YAAY,EAAG;IACrB,OAAO;MAAEC,UAAU,EAAE;IAAK,CAAC;EAC5B;EACA,IAAIA,UAAU,GAAG,KAAK;EACtB,IAAIC,YAAY,GAAGF,YAAY,KAAK,IAAI,GAAG,QAAQ,GAAGA,YAAY;EAClE,MAAMG,iBAAiB,GAAG,CAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAE;EACxE,MAAMC,oBAAoB,GAAGJ,YAAY,CAAC7E,QAAQ,CAAE,GAAI,CAAC,GACtD6E,YAAY,CAAChG,KAAK,CAAE,GAAG,EAAE,CAAE,CAAC,CAAE,CAAC,CAAE,GACjCgG,YAAY;EACf,MAAMK,qBAAqB,GAAGL,YAAY,CAAC7E,QAAQ,CAAE,GAAI,CAAC,GACvD6E,YAAY,CAAChG,KAAK,CAAE,GAAI,CAAC,CAACsG,KAAK,CAAE,CAAE,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC,GAChD,EAAE;EACL,IAAKF,qBAAqB,EAAG;IAC5BH,YAAY,GAAGE,oBAAoB;EACpC;EACAH,UAAU,GAAGE,iBAAiB,CAAChF,QAAQ,CAAE+E,YAAa,CAAC;EAEvD,OAAO;IAAED,UAAU;IAAEC;EAAa,CAAC;AACpC","ignoreList":[]}
@@ -36,9 +36,9 @@ const metadata = exports.metadata = {
36
36
  },
37
37
  color: {
38
38
  gradients: true,
39
- text: true,
40
39
  __experimentalDefaultControls: {
41
- background: true
40
+ background: true,
41
+ text: true
42
42
  }
43
43
  },
44
44
  typography: {
@@ -1 +1 @@
1
- {"version":3,"names":["_edit","_interopRequireDefault","require","_initBlock","_icons","metadata","exports","$schema","apiVersion","name","title","category","ancestor","description","textdomain","attributes","displayType","type","usesContext","supports","align","html","spacing","margin","padding","color","gradients","text","__experimentalDefaultControls","background","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalBorder","radius","width","style","settings","icon","queryTotal","edit","init","initBlock"],"sources":["@wordpress/block-library/src/query-total/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport initBlock from '../utils/init-block';\nimport { queryTotal } from './icons';\n\n/* Block settings */\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: queryTotal,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AANA;AACA;AACA;AAFA,MAAAG,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,WAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;EAAAC,WAAA;EAAAC,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;MAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAV,6BAAA;QAAAG,QAAA;MAAA;IAAA;IAAAQ,oBAAA;MAAAC,MAAA;MAAAf,KAAA;MAAAgB,KAAA;MAAAC,KAAA;MAAAd,6BAAA;QAAAY,MAAA;QAAAf,KAAA;QAAAgB,KAAA;QAAAC,KAAA;MAAA;IAAA;EAAA;EAAAA,KAAA;AAAA;AAQA;AACA,MAAM;EAAEjC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMkC,QAAQ,GAAArC,OAAA,CAAAqC,QAAA,GAAG;EACvBC,IAAI,EAAEC,iBAAU;EAChBC,IAAI,EAAJA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEsC;AAAS,CAAE,CAAC;AAACrC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_edit","_interopRequireDefault","require","_initBlock","_icons","metadata","exports","$schema","apiVersion","name","title","category","ancestor","description","textdomain","attributes","displayType","type","usesContext","supports","align","html","spacing","margin","padding","color","gradients","__experimentalDefaultControls","background","text","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalBorder","radius","width","style","settings","icon","queryTotal","edit","init","initBlock"],"sources":["@wordpress/block-library/src/query-total/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport initBlock from '../utils/init-block';\nimport { queryTotal } from './icons';\n\n/* Block settings */\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: queryTotal,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AANA;AACA;AACA;AAFA,MAAAG,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,WAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;EAAAC,WAAA;EAAAC,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;MAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAX,6BAAA;QAAAI,QAAA;MAAA;IAAA;IAAAQ,oBAAA;MAAAC,MAAA;MAAAf,KAAA;MAAAgB,KAAA;MAAAC,KAAA;MAAAf,6BAAA;QAAAa,MAAA;QAAAf,KAAA;QAAAgB,KAAA;QAAAC,KAAA;MAAA;IAAA;EAAA;EAAAA,KAAA;AAAA;AAQA;AACA,MAAM;EAAEjC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMkC,QAAQ,GAAArC,OAAA,CAAAqC,QAAA,GAAG;EACvBC,IAAI,EAAEC,iBAAU;EAChBC,IAAI,EAAJA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEsC;AAAS,CAAE,CAAC;AAACrC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -53,7 +53,6 @@ const metadata = exports.metadata = {
53
53
  align: true,
54
54
  alignWide: false,
55
55
  color: {
56
- __experimentalDuotone: "img, .components-placeholder__illustration, .components-placeholder::before",
57
56
  text: false,
58
57
  background: false
59
58
  },
@@ -67,6 +66,9 @@ const metadata = exports.metadata = {
67
66
  },
68
67
  interactivity: {
69
68
  clientNavigation: true
69
+ },
70
+ filter: {
71
+ duotone: true
70
72
  }
71
73
  },
72
74
  styles: [{
@@ -77,6 +79,11 @@ const metadata = exports.metadata = {
77
79
  name: "rounded",
78
80
  label: "Rounded"
79
81
  }],
82
+ selectors: {
83
+ filter: {
84
+ duotone: ".wp-block-site-logo img, .wp-block-site-logo .components-placeholder__illustration, .wp-block-site-logo .components-placeholder::before"
85
+ }
86
+ },
80
87
  editorStyle: "wp-block-site-logo-editor",
81
88
  style: "wp-block-site-logo"
82
89
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","width","type","isLink","role","linkTarget","shouldSyncIcon","example","viewportWidth","className","supports","html","align","alignWide","color","__experimentalDuotone","text","background","spacing","margin","padding","__experimentalDefaultControls","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","edit","transforms","init","initBlock"],"sources":["@wordpress/block-library/src/site-logo/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { siteLogo as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAK,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,MAAA;MAAAD,IAAA;MAAA;MAAAE,IAAA;IAAA;IAAAC,UAAA;MAAAH,IAAA;MAAA;MAAAE,IAAA;IAAA;IAAAE,cAAA;MAAAJ,IAAA;IAAA;EAAA;EAAAK,OAAA;IAAAC,aAAA;IAAAR,UAAA;MAAAC,KAAA;MAAAQ,SAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;IAAAC,SAAA;IAAAC,KAAA;MAAAC,qBAAA;MAAAC,IAAA;MAAAC,UAAA;IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAA7B,IAAA;IAAA8B,KAAA;IAAAC,SAAA;EAAA;IAAA/B,IAAA;IAAA8B,KAAA;EAAA;EAAAE,WAAA;EAAAC,KAAA;AAAA;AAQA,MAAM;EAAEjC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMkC,QAAQ,GAAArC,OAAA,CAAAqC,QAAA,GAAG;EACvBC,IAAI,EAAJA,eAAI;EACJvB,OAAO,EAAE,CAAC,CAAC;EACXwB,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEsC;AAAS,CAAE,CAAC;AAACrC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","width","type","isLink","role","linkTarget","shouldSyncIcon","example","viewportWidth","className","supports","html","align","alignWide","color","text","background","spacing","margin","padding","__experimentalDefaultControls","interactivity","clientNavigation","filter","duotone","styles","label","isDefault","selectors","editorStyle","style","settings","icon","edit","transforms","init","initBlock"],"sources":["@wordpress/block-library/src/site-logo/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { siteLogo as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAK,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,MAAA;MAAAD,IAAA;MAAA;MAAAE,IAAA;IAAA;IAAAC,UAAA;MAAAH,IAAA;MAAA;MAAAE,IAAA;IAAA;IAAAE,cAAA;MAAAJ,IAAA;IAAA;EAAA;EAAAK,OAAA;IAAAC,aAAA;IAAAR,UAAA;MAAAC,KAAA;MAAAQ,SAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;IAAAC,SAAA;IAAAC,KAAA;MAAAC,IAAA;MAAAC,UAAA;IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,aAAA;MAAAC,gBAAA;IAAA;IAAAC,MAAA;MAAAC,OAAA;IAAA;EAAA;EAAAC,MAAA;IAAA9B,IAAA;IAAA+B,KAAA;IAAAC,SAAA;EAAA;IAAAhC,IAAA;IAAA+B,KAAA;EAAA;EAAAE,SAAA;IAAAL,MAAA;MAAAC,OAAA;IAAA;EAAA;EAAAK,WAAA;EAAAC,KAAA;AAAA;AAQA,MAAM;EAAEnC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAMoC,QAAQ,GAAAvC,OAAA,CAAAuC,QAAA,GAAG;EACvBC,IAAI,EAAJA,eAAI;EACJzB,OAAO,EAAE,CAAC,CAAC;EACX0B,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEzC,IAAI;EAAEJ,QAAQ;EAAEwC;AAAS,CAAE,CAAC;AAACvC,OAAA,CAAA2C,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -68,6 +68,7 @@ const metadata = exports.metadata = {
68
68
  supports: {
69
69
  align: ["left", "center", "right"],
70
70
  anchor: true,
71
+ html: false,
71
72
  __experimentalExposeControlsToChildren: true,
72
73
  layout: {
73
74
  allowSwitching: false,
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","metadata","exports","$schema","apiVersion","name","title","category","allowedBlocks","description","keywords","textdomain","attributes","iconColor","type","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","showLabels","size","providesContext","supports","align","anchor","__experimentalExposeControlsToChildren","layout","allowSwitching","allowInheriting","allowVerticalAlignment","color","enableContrastChecker","background","gradients","text","__experimentalDefaultControls","spacing","blockGap","margin","padding","units","interactivity","clientNavigation","__experimentalBorder","radius","width","style","styles","label","isDefault","editorStyle","settings","example","innerBlocks","service","url","icon","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/social-links/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'wordpress',\n\t\t\t\t\turl: 'https://wordpress.org',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'facebook',\n\t\t\t\t\turl: 'https://www.facebook.com/WordPress/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'twitter',\n\t\t\t\t\turl: 'https://twitter.com/WordPress',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,KAAA,GAAAH,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAM,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,aAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,SAAA;MAAAC,IAAA;IAAA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D,OAAA,CAAAmD,QAAA,GAAG;EACvBC,OAAO,EAAE;IACRC,WAAW,EAAE,CACZ;MACClD,IAAI,EAAE,kBAAkB;MACxBO,UAAU,EAAE;QACX4C,OAAO,EAAE,WAAW;QACpBC,GAAG,EAAE;MACN;IACD,CAAC,EACD;MACCpD,IAAI,EAAE,kBAAkB;MACxBO,UAAU,EAAE;QACX4C,OAAO,EAAE,UAAU;QACnBC,GAAG,EAAE;MACN;IACD,CAAC,EACD;MACCpD,IAAI,EAAE,kBAAkB;MACxBO,UAAU,EAAE;QACX4C,OAAO,EAAE,SAAS;QAClBC,GAAG,EAAE;MACN;IACD,CAAC;EAEH,CAAC;EACDC,IAAI,EAAJA,YAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE1D,IAAI;EAAEJ,QAAQ;EAAEoD;AAAS,CAAE,CAAC;AAACnD,OAAA,CAAA4D,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","metadata","exports","$schema","apiVersion","name","title","category","allowedBlocks","description","keywords","textdomain","attributes","iconColor","type","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","showLabels","size","providesContext","supports","align","anchor","html","__experimentalExposeControlsToChildren","layout","allowSwitching","allowInheriting","allowVerticalAlignment","color","enableContrastChecker","background","gradients","text","__experimentalDefaultControls","spacing","blockGap","margin","padding","units","interactivity","clientNavigation","__experimentalBorder","radius","width","style","styles","label","isDefault","editorStyle","settings","example","innerBlocks","service","url","icon","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/social-links/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'wordpress',\n\t\t\t\t\turl: 'https://wordpress.org',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'facebook',\n\t\t\t\t\turl: 'https://www.facebook.com/WordPress/',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/social-link',\n\t\t\t\tattributes: {\n\t\t\t\t\tservice: 'twitter',\n\t\t\t\t\turl: 'https://twitter.com/WordPress',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,KAAA,GAAAH,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAM,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,aAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,SAAA;MAAAC,IAAA;IAAA;IAAAC,eAAA;MAAAD,IAAA;IAAA;IAAAE,cAAA;MAAAF,IAAA;IAAA;IAAAG,mBAAA;MAAAH,IAAA;IAAA;IAAAI,yBAAA;M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BO,UAAU,EAAE;QACX6C,OAAO,EAAE,WAAW;QACpBC,GAAG,EAAE;MACN;IACD,CAAC,EACD;MACCrD,IAAI,EAAE,kBAAkB;MACxBO,UAAU,EAAE;QACX6C,OAAO,EAAE,UAAU;QACnBC,GAAG,EAAE;MACN;IACD,CAAC,EACD;MACCrD,IAAI,EAAE,kBAAkB;MACxBO,UAAU,EAAE;QACX6C,OAAO,EAAE,SAAS;QAClBC,GAAG,EAAE;MACN;IACD,CAAC;EAEH,CAAC;EACDC,IAAI,EAAJA,YAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE3D,IAAI;EAAEJ,QAAQ;EAAEqD;AAAS,CAAE,CAAC;AAACpD,OAAA,CAAA6D,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -24,8 +24,8 @@ function getLatestHeadings(select, clientId) {
24
24
  const {
25
25
  getBlockAttributes,
26
26
  getBlockName,
27
- getClientIdsWithDescendants,
28
- getBlocksByName
27
+ getBlocksByName,
28
+ getClientIdsOfDescendants
29
29
  } = select(_blockEditor.store);
30
30
 
31
31
  // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
@@ -40,8 +40,11 @@ function getLatestHeadings(select, clientId) {
40
40
  onlyIncludeCurrentPage
41
41
  } = (_getBlockAttributes = getBlockAttributes(clientId)) !== null && _getBlockAttributes !== void 0 ? _getBlockAttributes : {};
42
42
 
43
+ // Get post-content block client ID.
44
+ const [postContentClientId = ''] = getBlocksByName('core/post-content');
45
+
43
46
  // Get the client ids of all blocks in the editor.
44
- const allBlockClientIds = getClientIdsWithDescendants();
47
+ const allBlockClientIds = getClientIdsOfDescendants(postContentClientId);
45
48
 
46
49
  // If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.
47
50
  let tocPage = 1;
@@ -1 +1 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getClientIdsWithDescendants","getBlocksByName","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","canBeLinked","anchor","push","content","stripHTML","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetClientIdsWithDescendants,\n\t\tgetBlocksByName,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,2BAA2B;IAC3BC;EACD,CAAC,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,SAAS,IAAAP,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACU,YAAY,CAAC,CAAC,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMS,WAAW,GAAGJ,eAAe,CAAE,eAAgB,CAAC,CAACK,MAAM,KAAK,CAAC;EACnE,MAAM;IAAEC;EAAuB,CAAC,IAAAV,mBAAA,GAAGC,kBAAkB,CAAEH,QAAS,CAAC,cAAAE,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;;EAEvE;EACA,MAAMW,iBAAiB,GAAGR,2BAA2B,CAAC,CAAC;;EAEvD;EACA,IAAIS,OAAO,GAAG,CAAC;EAEf,IAAKJ,WAAW,IAAIE,sBAAsB,EAAG;IAC5C;IACA;IACA,MAAMG,QAAQ,GAAGF,iBAAiB,CAACG,OAAO,CAAEhB,QAAS,CAAC;IAEtD,KAAM,MAAM,CACXiB,UAAU,EACV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;EACF,CAAC,EAAE,CAAE4C,QAAQ,EAAE5C,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
1
+ {"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","canBeLinked","anchor","push","content","stripHTML","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,eAAe;IACfC;EACD,CAAC,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,SAAS,IAAAP,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACU,YAAY,CAAC,CAAC,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMS,WAAW,GAAGL,eAAe,CAAE,eAAgB,CAAC,CAACM,MAAM,KAAK,CAAC;EACnE,MAAM;IAAEC;EAAuB,CAAC,IAAAV,mBAAA,GAAGC,kBAAkB,CAAEH,QAAS,CAAC,cAAAE,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;;EAEvE;EACA,MAAM,CAAEW,mBAAmB,GAAG,EAAE,CAAE,GAAGR,eAAe,CAAE,mBAAoB,CAAC;;EAE3E;EACA,MAAMS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,QAAQ,EAAG;EAC9C,MAAM6C,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA;IACA,OAAOF,QAAQ,CAACG,SAAS,CAAE,MAC1BX,eAAe,CAAEQ,QAAQ,CAAC9C,MAAM,EAAE8C,QAAQ,CAACP,QAAQ,EAAEtC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAE6C,QAAQ,EAAE7C,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
@@ -29,7 +29,7 @@ function TemplatePartAdvancedControls({
29
29
  }) {
30
30
  const [area, setArea] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'area', templatePartId);
31
31
  const [title, setTitle] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'title', templatePartId);
32
- const defaultTemplatePartAreas = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []);
32
+ const defaultTemplatePartAreas = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme()?.default_template_part_areas || [], []);
33
33
  const areaOptions = defaultTemplatePartAreas.map(({
34
34
  label,
35
35
  area: _area
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_messages","_jsxRuntime","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getEntityRecord","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","htmlElementMessages","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAZ3D;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASO,4BAA4BA,CAAE;EA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AA,CAAA4C,0BAA0B;MAC1BlC,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_messages","_jsxRuntime","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","htmlElementMessages","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAZ3D;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASO,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,IAAI,EAAEC,OAAO,CAAE,GAAG,IAAAC,uBAAa,EACtC,UAAU,EACV,kBAAkB,EAClB,MAAM,EACNL,cACD,CAAC;EAED,MAAM,CAAEM,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAF,uBAAa,EACxC,UAAU,EACV,kBAAkB,EAClB,OAAO,EACPL,cACD,CAAC;EAED,MAAMQ,wBAAwB,GAAG,IAAAC,eAAS,EACvCC,MAAM,IACPA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,EAClCC,2BAA2B,IAAI,EAAE,EACrC,EACD,CAAC;EAED,MAAMC,WAAW,GAAGN,wBAAwB,CAACO,GAAG,CAC/C,CAAE;IAAEC,KAAK;IAAEb,IAAI,EAAEc;EAAM,CAAC,MAAQ;IAC/BD,KAAK;IACLE,KAAK,EAAED;EACR,CAAC,CACF,CA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;QAAEF,KAAK,EAAE,WAAW;QAAEE,KAAK,EAAE;MAAU,CAAC,EACxC;QAAEF,KAAK,EAAE,WAAW;QAAEE,KAAK,EAAE;MAAU,CAAC,EACxC;QAAEF,KAAK,EAAE,SAAS;QAAEE,KAAK,EAAE;MAAQ,CAAC,EACpC;QAAEF,KAAK,EAAE,UAAU;QAAEE,KAAK,EAAE;MAAS,CAAC,EACtC;QAAEF,KAAK,EAAE,OAAO;QAAEE,KAAK,EAAE;MAAM,CAAC,CAC9B;MACHA,KAAK,EAAGrB,OAAO,IAAI,EAAI;MACvB8B,QAAQ,EAAKT,KAAK,IAAMpB,aAAa,CAAE;QAAED,OAAO,EAAEqB;MAAM,CAAE,CAAG;MAC7DiB,IAAI,EAAGC,6BAAmB,CAAEvC,OAAO;IAAI,CACvC,CAAC,EACA,CAAEK,cAAc,iBACjB,IAAAP,WAAA,CAAA2B,GAAA,EAAC7B,eAAA,CAAA4C,0BAA0B;MAC1BlC,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -123,7 +123,7 @@ function useCreateTemplatePartFromBlocks(area, setAttributes) {
123
123
  function useTemplatePartArea(area) {
124
124
  return (0, _data.useSelect)(select => {
125
125
  var _selectedArea$area_ta;
126
- const definedAreas = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [];
126
+ const definedAreas = select(_coreData.store).getCurrentTheme()?.default_template_part_areas || [];
127
127
  const selectedArea = definedAreas.find(definedArea => definedArea.area === area);
128
128
  const defaultArea = definedAreas.find(definedArea => definedArea.area === 'uncategorized');
129
129
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_changeCase","require","_data","_coreData","_blockEditor","_element","_blocks","_i18n","_createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","useSelect","select","getEntityRecords","_isResolving","coreStore","query","per_page","filteredTemplateParts","useMemo","filter","templatePart","createTemplatePartId","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","useDispatch","blocks","title","__","cleanSlug","kebabCase","replace","record","content","serialize","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","getEntityRecord","default_template_part_areas","selectedArea","find","definedArea","defaultArea","icon","label","tagName","area_tag"],"sources":["@wordpress/block-library/src/template-part/edit/utils/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * Retrieves the available template parts for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} excludedId Template part ID to exclude.\n *\n * @return {{ templateParts: Array, isResolving: boolean }} array of template parts.\n */\nexport function useAlternativeTemplateParts( area, excludedId ) {\n\tconst { templateParts, isResolving } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst query = { per_page: -1 };\n\t\treturn {\n\t\t\ttemplateParts: getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery\n\t\t\t),\n\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\ttemplateParts.filter(\n\t\t\t\t( templatePart ) =>\n\t\t\t\t\tcreateTemplatePartId(\n\t\t\t\t\t\ttemplatePart.theme,\n\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t) !== excludedId &&\n\t\t\t\t\t( ! area ||\n\t\t\t\t\t\t'uncategorized' === area ||\n\t\t\t\t\t\ttemplatePart.area === area )\n\t\t\t) || []\n\t\t);\n\t}, [ templateParts, area, excludedId ] );\n\n\treturn {\n\t\ttemplateParts: filteredTemplateParts,\n\t\tisResolving,\n\t};\n}\n\n/**\n * Retrieves the available block patterns for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).\n *\n * @return {Array} array of block patterns.\n */\nexport function useAlternativeBlockPatterns( area, clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNameWithArea = area\n\t\t\t\t? `core/template-part/${ area }`\n\t\t\t\t: 'core/template-part';\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( blockNameWithArea, rootClientId );\n\t\t},\n\t\t[ area, clientId ]\n\t);\n}\n\nexport function useCreateTemplatePartFromBlocks( area, setAttributes ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\treturn async ( blocks = [], title = __( 'Untitled Template Part' ) ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\t// If we have `area` set from block attributes, means an exposed\n\t\t// block variation was inserted. So add this prop to the template\n\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t// block attributes.\n\t\tconst record = {\n\t\t\ttitle,\n\t\t\tslug: cleanSlug,\n\t\t\tcontent: serialize( blocks ),\n\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t// if provided value is not allowed.\n\t\t\tarea,\n\t\t};\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\trecord\n\t\t);\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t};\n}\n\n/**\n * Retrieves the template part area object.\n *\n * @param {string} area Template part area identifier.\n *\n * @return {{icon: Object, label: string, tagName: string}} Template Part area.\n */\nexport function useTemplatePartArea( area ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst definedAreas =\n\t\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t\t?.default_template_part_areas || [];\n\n\t\t\tconst selectedArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === area\n\t\t\t);\n\t\t\tconst defaultArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === 'uncategorized'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ticon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tlabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t\ttagName: selectedArea?.area_tag ?? 'div',\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,qBAAA,GAAAP,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,2BAA2BA,CAAEC,IAAI,EAAEC,UAAU,EAAG;EAC/D,MAAM;IAAEC,aAAa;IAAEC;EAAY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AAW,CAAC9C,IAAI,KAAKA,IACzC,CAAC;IACD,MAAM+C,WAAW,GAAGN,YAAY,CAACI,IAAI,CAClCC,WAAW,IAAMA,WAAW,CAAC9C,IAAI,KAAK,eACzC,CAAC;IAED,OAAO;MACNgD,IAAI,EAAEJ,YAAY,EAAEI,IAAI,IAAID,WAAW,EAAEC,IAAI;MAC7CC,KAAK,EAAEL,YAAY,EAAEK,KAAK,IAAI,IAAAlB,QAAE,EAAE,eAAgB,CAAC;MACnDmB,OAAO,GAAAV,qBAAA,GAAEI,YAAY,EAAEO,QAAQ,cAAAX,qBAAA,cAAAA,qBAAA,GAAI;IACpC,CAAC;EACF,CAAC,EACD,CAAExC,IAAI,CACP,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_changeCase","require","_data","_coreData","_blockEditor","_element","_blocks","_i18n","_createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","useSelect","select","getEntityRecords","_isResolving","coreStore","query","per_page","filteredTemplateParts","useMemo","filter","templatePart","createTemplatePartId","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","useDispatch","blocks","title","__","cleanSlug","kebabCase","replace","record","content","serialize","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","getCurrentTheme","default_template_part_areas","selectedArea","find","definedArea","defaultArea","icon","label","tagName","area_tag"],"sources":["@wordpress/block-library/src/template-part/edit/utils/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * Retrieves the available template parts for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} excludedId Template part ID to exclude.\n *\n * @return {{ templateParts: Array, isResolving: boolean }} array of template parts.\n */\nexport function useAlternativeTemplateParts( area, excludedId ) {\n\tconst { templateParts, isResolving } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst query = { per_page: -1 };\n\t\treturn {\n\t\t\ttemplateParts: getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery\n\t\t\t),\n\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\ttemplateParts.filter(\n\t\t\t\t( templatePart ) =>\n\t\t\t\t\tcreateTemplatePartId(\n\t\t\t\t\t\ttemplatePart.theme,\n\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t) !== excludedId &&\n\t\t\t\t\t( ! area ||\n\t\t\t\t\t\t'uncategorized' === area ||\n\t\t\t\t\t\ttemplatePart.area === area )\n\t\t\t) || []\n\t\t);\n\t}, [ templateParts, area, excludedId ] );\n\n\treturn {\n\t\ttemplateParts: filteredTemplateParts,\n\t\tisResolving,\n\t};\n}\n\n/**\n * Retrieves the available block patterns for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).\n *\n * @return {Array} array of block patterns.\n */\nexport function useAlternativeBlockPatterns( area, clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNameWithArea = area\n\t\t\t\t? `core/template-part/${ area }`\n\t\t\t\t: 'core/template-part';\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( blockNameWithArea, rootClientId );\n\t\t},\n\t\t[ area, clientId ]\n\t);\n}\n\nexport function useCreateTemplatePartFromBlocks( area, setAttributes ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\treturn async ( blocks = [], title = __( 'Untitled Template Part' ) ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\t// If we have `area` set from block attributes, means an exposed\n\t\t// block variation was inserted. So add this prop to the template\n\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t// block attributes.\n\t\tconst record = {\n\t\t\ttitle,\n\t\t\tslug: cleanSlug,\n\t\t\tcontent: serialize( blocks ),\n\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t// if provided value is not allowed.\n\t\t\tarea,\n\t\t};\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\trecord\n\t\t);\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t};\n}\n\n/**\n * Retrieves the template part area object.\n *\n * @param {string} area Template part area identifier.\n *\n * @return {{icon: Object, label: string, tagName: string}} Template Part area.\n */\nexport function useTemplatePartArea( area ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst definedAreas =\n\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t?.default_template_part_areas || [];\n\n\t\t\tconst selectedArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === area\n\t\t\t);\n\t\t\tconst defaultArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === 'uncategorized'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ticon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tlabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t\ttagName: selectedArea?.area_tag ?? 'div',\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,qBAAA,GAAAP,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,2BAA2BA,CAAEC,IAAI,EAAEC,UAAU,EAAG;EAC/D,MAAM;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/D,MAAM;MAAEC,gBAAgB;MAAEH,WAAW,EAAEI;IAAa,CAAC,GACpDF,MAAM,CAAEG,eAAU,CAAC;IACpB,MAAMC,KAAK,GAAG;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAC;IAC9B,OAAO;MACNR,aAAa,EAAEI,gBAAgB,CAC9B,UAAU,EACV,kBAAkB,EAClBG,KACD,CAAC;MACDN,WAAW,EAAEI,YAAY,CAAE,kBAAkB,EAAE,CAC9C,UAAU,EACV,kBAAkB,EAClBE,KAAK,CACJ;IACH,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,qBAAqB,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC5C,IAAK,CAAEV,aAAa,EAAG;MACtB,OAAO,EAAE;IACV;IACA,OACCA,aAAa,CAACW,MAAM,CACjBC,YAAY,IACb,IAAAC,0CAAoB,EACnBD,Y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AAAC,iBAAS,EAAER,MAAO,CAAC;MAC5B;MACA;MACA7B;IACD,CAAC;IACD,MAAMc,YAAY,GAAG,MAAMa,gBAAgB,CAC1C,UAAU,EACV,kBAAkB,EAClBQ,MACD,CAAC;IACDT,aAAa,CAAE;MACdT,IAAI,EAAEH,YAAY,CAACG,IAAI;MACvBD,KAAK,EAAEF,YAAY,CAACE,KAAK;MACzBhB,IAAI,EAAEsC;IACP,CAAE,CAAC;EACJ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAEvC,IAAI,EAAG;EAC3C,OAAO,IAAAI,eAAS,EACbC,MAAM,IAAM;IAAA,IAAAmC,qBAAA;IACb,MAAMC,YAAY,GACjBpC,MAAM,CAAEG,eAAU,CAAC,CAACkC,eAAe,CAAC,CAAC,EAClCC,2BAA2B,IAAI,EAAE;IAErC,MAAMC,YAAY,GAAGH,YAAY,CAACI,IAAI,CACnCC,WAAW,IAAMA,WAAW,CAAC9C,IAAI,KAAKA,IACzC,CAAC;IACD,MAAM+C,WAAW,GAAGN,YAAY,CAACI,IAAI,CAClCC,WAAW,IAAMA,WAAW,CAAC9C,IAAI,KAAK,eACzC,CAAC;IAED,OAAO;MACNgD,IAAI,EAAEJ,YAAY,EAAEI,IAAI,IAAID,WAAW,EAAEC,IAAI;MAC7CC,KAAK,EAAEL,YAAY,EAAEK,KAAK,IAAI,IAAAlB,QAAE,EAAE,eAAgB,CAAC;MACnDmB,OAAO,GAAAV,qBAAA,GAAEI,YAAY,EAAEO,QAAQ,cAAAX,qBAAA,cAAAA,qBAAA,GAAI;IACpC,CAAC;EACF,CAAC,EACD,CAAExC,IAAI,CACP,CAAC;AACF","ignoreList":[]}
@@ -29,7 +29,7 @@ export default function ArchivesEdit({
29
29
  resetAll: () => {
30
30
  setAttributes({
31
31
  displayAsDropdown: false,
32
- showLabel: false,
32
+ showLabel: true,
33
33
  showPostCounts: false,
34
34
  type: 'monthly'
35
35
  });
@@ -55,7 +55,7 @@ export default function ArchivesEdit({
55
55
  isShownByDefault: true,
56
56
  hasValue: () => !showLabel,
57
57
  onDeselect: () => setAttributes({
58
- showLabel: false
58
+ showLabel: true
59
59
  }),
60
60
  children: /*#__PURE__*/_jsx(ToggleControl, {
61
61
  __nextHasNoMarginBottom: true,
@@ -1 +1 @@
1
- {"version":3,"names":["ToggleControl","SelectControl","Disabled","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","useBlockProps","ServerSideRender","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayAsDropdown","type","dropdownMenuProps","children","label","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","onChange","__next40pxDefaultSize","options","value","block","skipBlockSupportAttributes"],"sources":["@wordpress/block-library/src/archives/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdisplayAsDropdown: false,\n\t\t\t\t\t\t\tshowLabel: false,\n\t\t\t\t\t\t\tshowPostCounts: false,\n\t\t\t\t\t\t\ttype: 'monthly',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayAsDropdown }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAsDropdown: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabel: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showPostCounts }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showPostCounts: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => type !== 'monthly' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { type: 'monthly' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,aAAa,EACbC,QAAQ,EACRC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,yBAAyB;AAC1E,OAAOC,gBAAgB,MAAM,+BAA+B;;AAE5D;AACA;AACA;AACA,SAASC,8BAA8B,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEhE,eAAe,SAASC,YAAYA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM;IAAEC,SAAS;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC;EAAK,CAAC,GAAGL,UAAU;EAEzE,MAAMM,iBAAiB,GAAGd,8BAA8B,CAAC,CAAC;EAE1D,oBACCI,KAAA,CAAAE,SAAA;IAAAS,QAAA,gBACCb,IAAA,CAACL,iBAAiB;MAAAkB,QAAA,eACjBX,KAAA,CAACX,UAAU;QACVuB,KAAK,EAAGpB,EAAE,CAA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,CACa,CAAC;MAAA,CACN;IAAC,CACK,CAAC,eACpBxB,IAAA;MAAA,GAAUJ,aAAa,CAAC,CAAC;MAAAiB,QAAA,eACxBb,IAAA,CAACX,QAAQ;QAAAwB,QAAA,eACRb,IAAA,CAACH,gBAAgB;UAChB4B,KAAK,EAAC,eAAe;UACrBC,0BAA0B;UAC1BpB,UAAU,EAAGA;QAAY,CACzB;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["ToggleControl","SelectControl","Disabled","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","useBlockProps","ServerSideRender","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayAsDropdown","type","dropdownMenuProps","children","label","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","onChange","__next40pxDefaultSize","options","value","block","skipBlockSupportAttributes"],"sources":["@wordpress/block-library/src/archives/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdisplayAsDropdown: false,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tshowPostCounts: false,\n\t\t\t\t\t\t\ttype: 'monthly',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayAsDropdown }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAsDropdown: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabel: true } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showPostCounts }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showPostCounts: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => type !== 'monthly' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { type: 'monthly' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Group by' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,aAAa,EACbC,QAAQ,EACRC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,yBAAyB;AAC1E,OAAOC,gBAAgB,MAAM,+BAA+B;;AAE5D;AACA;AACA;AACA,SAASC,8BAA8B,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEhE,eAAe,SAASC,YAAYA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM;IAAEC,SAAS;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC;EAAK,CAAC,GAAGL,UAAU;EAEzE,MAAMM,iBAAiB,GAAGd,8BAA8B,CAAC,CAAC;EAE1D,oBACCI,KAAA,CAAAE,SAAA;IAAAS,QAAA,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