@wordpress/block-library 8.17.0 → 8.18.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 (134) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +19 -0
  3. package/build/cover/edit/index.js +3 -1
  4. package/build/cover/edit/index.js.map +1 -1
  5. package/build/cover/shared.js +26 -21
  6. package/build/cover/shared.js.map +1 -1
  7. package/build/embed/embed-link-settings.native.js +0 -1
  8. package/build/embed/embed-link-settings.native.js.map +1 -1
  9. package/build/footnotes/init.js +13 -0
  10. package/build/footnotes/init.js.map +1 -0
  11. package/build/list/edit.js +2 -1
  12. package/build/list/edit.js.map +1 -1
  13. package/build/navigation/edit/inner-blocks.js +2 -1
  14. package/build/navigation/edit/inner-blocks.js.map +1 -1
  15. package/build/post-content/edit.js +1 -1
  16. package/build/post-content/edit.js.map +1 -1
  17. package/build/post-template/index.js +1 -1
  18. package/build/query/edit/inspector-controls/index.js +28 -3
  19. package/build/query/edit/inspector-controls/index.js.map +1 -1
  20. package/build/query/edit/query-content.js +2 -1
  21. package/build/query/edit/query-content.js.map +1 -1
  22. package/build/query/index.js +9 -2
  23. package/build/query/index.js.map +1 -1
  24. package/build/query/view.js +75 -0
  25. package/build/query/view.js.map +1 -0
  26. package/build/query-pagination-next/index.js +1 -1
  27. package/build/query-pagination-numbers/edit.js +50 -5
  28. package/build/query-pagination-numbers/edit.js.map +1 -1
  29. package/build/query-pagination-numbers/index.js +7 -1
  30. package/build/query-pagination-numbers/index.js.map +1 -1
  31. package/build/query-pagination-previous/index.js +1 -1
  32. package/build/quote/edit.js +2 -1
  33. package/build/quote/edit.js.map +1 -1
  34. package/build/search/edit.js +3 -1
  35. package/build/search/edit.js.map +1 -1
  36. package/build/search/utils.js +2 -4
  37. package/build/search/utils.js.map +1 -1
  38. package/build/social-link/edit.native.js +1 -3
  39. package/build/social-link/edit.native.js.map +1 -1
  40. package/build/template-part/edit/index.js +22 -15
  41. package/build/template-part/edit/index.js.map +1 -1
  42. package/build-module/cover/edit/index.js +3 -1
  43. package/build-module/cover/edit/index.js.map +1 -1
  44. package/build-module/cover/shared.js +26 -21
  45. package/build-module/cover/shared.js.map +1 -1
  46. package/build-module/embed/embed-link-settings.native.js +0 -1
  47. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  48. package/build-module/footnotes/init.js +6 -0
  49. package/build-module/footnotes/init.js.map +1 -0
  50. package/build-module/list/edit.js +2 -1
  51. package/build-module/list/edit.js.map +1 -1
  52. package/build-module/navigation/edit/inner-blocks.js +2 -1
  53. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  54. package/build-module/post-content/edit.js +1 -1
  55. package/build-module/post-content/edit.js.map +1 -1
  56. package/build-module/post-template/index.js +1 -1
  57. package/build-module/query/edit/inspector-controls/index.js +29 -4
  58. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  59. package/build-module/query/edit/query-content.js +2 -1
  60. package/build-module/query/edit/query-content.js.map +1 -1
  61. package/build-module/query/index.js +9 -2
  62. package/build-module/query/index.js.map +1 -1
  63. package/build-module/query/view.js +72 -0
  64. package/build-module/query/view.js.map +1 -0
  65. package/build-module/query-pagination-next/index.js +1 -1
  66. package/build-module/query-pagination-numbers/edit.js +51 -6
  67. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  68. package/build-module/query-pagination-numbers/index.js +7 -1
  69. package/build-module/query-pagination-numbers/index.js.map +1 -1
  70. package/build-module/query-pagination-previous/index.js +1 -1
  71. package/build-module/quote/edit.js +2 -1
  72. package/build-module/quote/edit.js.map +1 -1
  73. package/build-module/search/edit.js +4 -2
  74. package/build-module/search/edit.js.map +1 -1
  75. package/build-module/search/utils.js +0 -1
  76. package/build-module/search/utils.js.map +1 -1
  77. package/build-module/social-link/edit.native.js +1 -3
  78. package/build-module/social-link/edit.native.js.map +1 -1
  79. package/build-module/template-part/edit/index.js +22 -15
  80. package/build-module/template-part/edit/index.js.map +1 -1
  81. package/build-style/editor-rtl.css +2 -1
  82. package/build-style/editor.css +2 -1
  83. package/build-style/query/style-rtl.css +140 -0
  84. package/build-style/query/style.css +140 -0
  85. package/build-style/site-logo/style-rtl.css +1 -0
  86. package/build-style/site-logo/style.css +1 -0
  87. package/build-style/social-links/editor-rtl.css +2 -1
  88. package/build-style/social-links/editor.css +2 -1
  89. package/build-style/style-rtl.css +1 -0
  90. package/build-style/style.css +1 -0
  91. package/package.json +32 -32
  92. package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
  93. package/src/cover/edit/index.js +3 -1
  94. package/src/cover/shared.js +25 -20
  95. package/src/cover/test/edit.native.js +1 -5
  96. package/src/embed/embed-link-settings.native.js +0 -1
  97. package/src/embed/test/index.native.js +9 -9
  98. package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
  99. package/src/footnotes/init.js +6 -0
  100. package/src/image/index.php +5 -0
  101. package/src/list/edit.js +1 -0
  102. package/src/navigation/edit/inner-blocks.js +1 -0
  103. package/src/post-content/edit.js +2 -2
  104. package/src/post-content/index.php +0 -6
  105. package/src/post-featured-image/index.php +0 -6
  106. package/src/post-navigation-link/index.php +2 -2
  107. package/src/post-template/block.json +2 -1
  108. package/src/post-template/index.php +19 -4
  109. package/src/query/block.json +9 -2
  110. package/src/query/edit/inspector-controls/index.js +46 -3
  111. package/src/query/edit/query-content.js +1 -0
  112. package/src/query/index.php +94 -1
  113. package/src/query/style.scss +63 -0
  114. package/src/query/view.js +82 -0
  115. package/src/query-no-results/index.php +1 -5
  116. package/src/query-pagination-next/block.json +7 -1
  117. package/src/query-pagination-next/index.php +20 -3
  118. package/src/query-pagination-numbers/block.json +7 -1
  119. package/src/query-pagination-numbers/edit.js +64 -16
  120. package/src/query-pagination-numbers/index.php +27 -4
  121. package/src/query-pagination-previous/block.json +7 -1
  122. package/src/query-pagination-previous/index.php +19 -2
  123. package/src/quote/edit.js +1 -0
  124. package/src/search/edit.js +8 -2
  125. package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
  126. package/src/search/utils.js +0 -1
  127. package/src/site-logo/style.scss +1 -0
  128. package/src/social-link/edit.native.js +1 -1
  129. package/src/social-link/editor.native.scss +0 -4
  130. package/src/social-links/editor.scss +2 -1
  131. package/src/social-links/test/edit.native.js +30 -0
  132. package/src/template-part/edit/index.js +35 -22
  133. package/tsconfig.tsbuildinfo +1 -1
  134. package/src/social-link/test/index.native.js +0 -132
@@ -1 +1 @@
1
- {"version":3,"names":["View","Animated","Easing","TouchableWithoutFeedback","BlockControls","store","blockEditorStore","useEffect","useState","useRef","useCallback","ToolbarGroup","ToolbarButton","LinkSettingsNavigation","compose","usePreferredColorSchemeStyle","__","sprintf","link","Icon","withSelect","getIconBySite","getNameBySite","styles","DEFAULT_ACTIVE_ICON_STYLES","backgroundColor","color","DEFAULT_INACTIVE_ICON_STYLES","ANIMATION_DELAY","ANIMATION_DURATION","linkSettingsOptions","url","label","placeholder","autoFocus","linkLabel","footer","SocialLinkEdit","attributes","setAttributes","isSelected","onFocus","name","service","isLinkSheetVisible","setIsLinkSheetVisible","hasUrl","setHasUrl","activeIcon","inactiveIcon","inactiveIconDark","animatedValue","Value","current","IconComponent","socialLinkName","setValue","animateColors","interpolationColors","interpolate","inputRange","outputRange","stroke","sequence","delay","timing","toValue","duration","easing","circle","useNativeDriver","start","onCloseSettingsSheet","onOpenSettingsSheet","onEmptyURL","onIconPress","accessibilityHint","createElement","style","container","Fragment","title","icon","onClick","isActive","isVisible","rel","onClose","options","withBottomSheet","onPress","accessibilityRole","accessibilityLabel","iconContainer","animated","select","clientId","getBlock","block","substring"],"sources":["@wordpress/block-library/src/social-link/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Animated, Easing, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect, useState, useRef, useCallback } from '@wordpress/element';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tLinkSettingsNavigation,\n} from '@wordpress/components';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { link, Icon } from '@wordpress/icons';\nimport { withSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\nimport styles from './editor.scss';\n\nconst DEFAULT_ACTIVE_ICON_STYLES = {\n\tbackgroundColor: '#f0f0f0',\n\tcolor: '#444',\n};\nconst DEFAULT_INACTIVE_ICON_STYLES = {\n\tbackgroundColor: '#0000003f',\n\tcolor: '#fff',\n};\nconst ANIMATION_DELAY = 300;\nconst ANIMATION_DURATION = 400;\n\nconst linkSettingsOptions = {\n\turl: {\n\t\tlabel: __( 'URL' ),\n\t\tplaceholder: __( 'Add URL' ),\n\t\tautoFocus: true,\n\t},\n\tlinkLabel: {\n\t\tlabel: __( 'Link label' ),\n\t\tplaceholder: __( 'None' ),\n\t},\n\tfooter: {\n\t\tlabel: __( 'Briefly describe the link to help screen reader user' ),\n\t},\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tonFocus,\n\tname,\n} ) => {\n\tconst { url, service = name } = attributes;\n\tconst [ isLinkSheetVisible, setIsLinkSheetVisible ] = useState( false );\n\tconst [ hasUrl, setHasUrl ] = useState( !! url );\n\tconst activeIcon =\n\t\tstyles[ `wp-social-link-${ service }` ] ||\n\t\tstyles[ `wp-social-link` ] ||\n\t\tDEFAULT_ACTIVE_ICON_STYLES;\n\tconst inactiveIcon =\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.inactiveIcon,\n\t\t\tstyles.inactiveIconDark\n\t\t) || DEFAULT_INACTIVE_ICON_STYLES;\n\n\tconst animatedValue = useRef( new Animated.Value( 0 ) ).current;\n\n\tconst IconComponent = getIconBySite( service )();\n\tconst socialLinkName = getNameBySite( service );\n\n\t// When new social icon is added link sheet is opened automatically.\n\tuseEffect( () => {\n\t\tif ( isSelected && ! url ) {\n\t\t\tsetIsLinkSheetVisible( true );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! url ) {\n\t\t\tsetHasUrl( false );\n\t\t\tanimatedValue.setValue( 0 );\n\t\t} else if ( url ) {\n\t\t\tanimateColors();\n\t\t}\n\t}, [ url ] );\n\n\tconst interpolationColors = {\n\t\tbackgroundColor: animatedValue.interpolate( {\n\t\t\tinputRange: [ 0, 1 ],\n\t\t\toutputRange: [\n\t\t\t\tinactiveIcon.backgroundColor,\n\t\t\t\tactiveIcon.backgroundColor,\n\t\t\t],\n\t\t} ),\n\t\tcolor: animatedValue.interpolate( {\n\t\t\tinputRange: [ 0, 1 ],\n\t\t\toutputRange: [ inactiveIcon.color, activeIcon.color ],\n\t\t} ),\n\t\tstroke: '',\n\t};\n\n\tconst { backgroundColor, color, stroke } = hasUrl\n\t\t? activeIcon\n\t\t: interpolationColors;\n\n\tfunction animateColors() {\n\t\tAnimated.sequence( [\n\t\t\tAnimated.delay( ANIMATION_DELAY ),\n\t\t\tAnimated.timing( animatedValue, {\n\t\t\t\ttoValue: 1,\n\t\t\t\tduration: ANIMATION_DURATION,\n\t\t\t\teasing: Easing.circle,\n\t\t\t\tuseNativeDriver: false,\n\t\t\t} ),\n\t\t] ).start( () => setHasUrl( true ) );\n\t}\n\n\tconst onCloseSettingsSheet = useCallback( () => {\n\t\tsetIsLinkSheetVisible( false );\n\t}, [] );\n\n\tconst onOpenSettingsSheet = useCallback( () => {\n\t\tsetIsLinkSheetVisible( true );\n\t}, [] );\n\n\tconst onEmptyURL = useCallback( () => {\n\t\tanimatedValue.setValue( 0 );\n\t\tsetHasUrl( false );\n\t}, [ animatedValue ] );\n\n\tfunction onIconPress() {\n\t\tif ( isSelected ) {\n\t\t\tsetIsLinkSheetVisible( true );\n\t\t} else {\n\t\t\tonFocus();\n\t\t}\n\t}\n\n\tconst accessibilityHint = url\n\t\t? sprintf(\n\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t__( '%s has URL set' ),\n\t\t\t\tsocialLinkName\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t__( '%s has no URL set' ),\n\t\t\t\tsocialLinkName\n\t\t );\n\n\treturn (\n\t\t<View style={ styles.container }>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t\t\t\t\t\t__( 'Add link to %s' ),\n\t\t\t\t\t\t\t\t\tsocialLinkName\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\t\t\tonClick={ onOpenSettingsSheet }\n\t\t\t\t\t\t\t\tisActive={ url }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<LinkSettingsNavigation\n\t\t\t\t\t\tisVisible={ isLinkSheetVisible }\n\t\t\t\t\t\turl={ attributes.url }\n\t\t\t\t\t\tlabel={ attributes.label }\n\t\t\t\t\t\trel={ attributes.rel }\n\t\t\t\t\t\tonEmptyURL={ onEmptyURL }\n\t\t\t\t\t\tonClose={ onCloseSettingsSheet }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\toptions={ linkSettingsOptions }\n\t\t\t\t\t\twithBottomSheet\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ onIconPress }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t\t__( '%s social icon' ),\n\t\t\t\t\tsocialLinkName\n\t\t\t\t) }\n\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t>\n\t\t\t\t<Animated.View\n\t\t\t\t\tstyle={ [ styles.iconContainer, { backgroundColor } ] }\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tanimated\n\t\t\t\t\t\ticon={ IconComponent }\n\t\t\t\t\t\tstyle={ { stroke, color } }\n\t\t\t\t\t/>\n\t\t\t\t</Animated.View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\n\t\tconst block = getBlock( clientId );\n\t\tconst name = block?.name.substring( 17 );\n\n\t\treturn {\n\t\t\tname,\n\t\t};\n\t} ),\n] )( SocialLinkEdit );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,wBAAwB,QAAQ,cAAc;;AAE/E;AACA;AACA;AACA,SACCC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,oBAAoB;AAC7E,SACCC,YAAY,EACZC,aAAa,EACbC,sBAAsB,QAChB,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,4BAA4B,QAAQ,oBAAoB;AAC1E,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C;AACA;AACA;AACA,SAASC,aAAa,EAAEC,aAAa,QAAQ,eAAe;AAC5D,OAAOC,MAAM,MAAM,eAAe;AAElC,MAAMC,0BAA0B,GAAG;EAClCC,eAAe,EAAE,SAAS;EAC1BC,KAAK,EAAE;AACR,CAAC;AACD,MAAMC,4BAA4B,GAAG;EACpCF,eAAe,EAAE,WAAW;EAC5BC,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version":3,"names":["View","Animated","Easing","TouchableWithoutFeedback","BlockControls","store","blockEditorStore","useEffect","useState","useRef","useCallback","ToolbarGroup","ToolbarButton","LinkSettingsNavigation","compose","usePreferredColorSchemeStyle","__","sprintf","link","Icon","withSelect","getIconBySite","getNameBySite","styles","DEFAULT_ACTIVE_ICON_STYLES","backgroundColor","color","DEFAULT_INACTIVE_ICON_STYLES","ANIMATION_DELAY","ANIMATION_DURATION","linkSettingsOptions","url","label","placeholder","autoFocus","linkLabel","footer","SocialLinkEdit","attributes","setAttributes","isSelected","onFocus","name","service","isLinkSheetVisible","setIsLinkSheetVisible","hasUrl","setHasUrl","activeIcon","inactiveIcon","inactiveIconDark","animatedValue","Value","current","IconComponent","socialLinkName","setValue","animateColors","interpolationColors","interpolate","inputRange","outputRange","stroke","sequence","delay","timing","toValue","duration","easing","circle","useNativeDriver","start","onCloseSettingsSheet","onOpenSettingsSheet","onEmptyURL","onIconPress","accessibilityHint","createElement","Fragment","title","icon","onClick","isActive","isVisible","rel","onClose","options","withBottomSheet","onPress","accessibilityRole","accessibilityLabel","style","iconContainer","animated","select","clientId","getBlock","block","substring"],"sources":["@wordpress/block-library/src/social-link/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Animated, Easing, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect, useState, useRef, useCallback } from '@wordpress/element';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tLinkSettingsNavigation,\n} from '@wordpress/components';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { link, Icon } from '@wordpress/icons';\nimport { withSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\nimport styles from './editor.scss';\n\nconst DEFAULT_ACTIVE_ICON_STYLES = {\n\tbackgroundColor: '#f0f0f0',\n\tcolor: '#444',\n};\nconst DEFAULT_INACTIVE_ICON_STYLES = {\n\tbackgroundColor: '#0000003f',\n\tcolor: '#fff',\n};\nconst ANIMATION_DELAY = 300;\nconst ANIMATION_DURATION = 400;\n\nconst linkSettingsOptions = {\n\turl: {\n\t\tlabel: __( 'URL' ),\n\t\tplaceholder: __( 'Add URL' ),\n\t\tautoFocus: true,\n\t},\n\tlinkLabel: {\n\t\tlabel: __( 'Link label' ),\n\t\tplaceholder: __( 'None' ),\n\t},\n\tfooter: {\n\t\tlabel: __( 'Briefly describe the link to help screen reader user' ),\n\t},\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tonFocus,\n\tname,\n} ) => {\n\tconst { url, service = name } = attributes;\n\tconst [ isLinkSheetVisible, setIsLinkSheetVisible ] = useState( false );\n\tconst [ hasUrl, setHasUrl ] = useState( !! url );\n\tconst activeIcon =\n\t\tstyles[ `wp-social-link-${ service }` ] ||\n\t\tstyles[ `wp-social-link` ] ||\n\t\tDEFAULT_ACTIVE_ICON_STYLES;\n\tconst inactiveIcon =\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.inactiveIcon,\n\t\t\tstyles.inactiveIconDark\n\t\t) || DEFAULT_INACTIVE_ICON_STYLES;\n\n\tconst animatedValue = useRef( new Animated.Value( 0 ) ).current;\n\n\tconst IconComponent = getIconBySite( service )();\n\tconst socialLinkName = getNameBySite( service );\n\n\t// When new social icon is added link sheet is opened automatically.\n\tuseEffect( () => {\n\t\tif ( isSelected && ! url ) {\n\t\t\tsetIsLinkSheetVisible( true );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! url ) {\n\t\t\tsetHasUrl( false );\n\t\t\tanimatedValue.setValue( 0 );\n\t\t} else if ( url ) {\n\t\t\tanimateColors();\n\t\t}\n\t}, [ url ] );\n\n\tconst interpolationColors = {\n\t\tbackgroundColor: animatedValue.interpolate( {\n\t\t\tinputRange: [ 0, 1 ],\n\t\t\toutputRange: [\n\t\t\t\tinactiveIcon.backgroundColor,\n\t\t\t\tactiveIcon.backgroundColor,\n\t\t\t],\n\t\t} ),\n\t\tcolor: animatedValue.interpolate( {\n\t\t\tinputRange: [ 0, 1 ],\n\t\t\toutputRange: [ inactiveIcon.color, activeIcon.color ],\n\t\t} ),\n\t\tstroke: '',\n\t};\n\n\tconst { backgroundColor, color, stroke } = hasUrl\n\t\t? activeIcon\n\t\t: interpolationColors;\n\n\tfunction animateColors() {\n\t\tAnimated.sequence( [\n\t\t\tAnimated.delay( ANIMATION_DELAY ),\n\t\t\tAnimated.timing( animatedValue, {\n\t\t\t\ttoValue: 1,\n\t\t\t\tduration: ANIMATION_DURATION,\n\t\t\t\teasing: Easing.circle,\n\t\t\t\tuseNativeDriver: false,\n\t\t\t} ),\n\t\t] ).start( () => setHasUrl( true ) );\n\t}\n\n\tconst onCloseSettingsSheet = useCallback( () => {\n\t\tsetIsLinkSheetVisible( false );\n\t}, [] );\n\n\tconst onOpenSettingsSheet = useCallback( () => {\n\t\tsetIsLinkSheetVisible( true );\n\t}, [] );\n\n\tconst onEmptyURL = useCallback( () => {\n\t\tanimatedValue.setValue( 0 );\n\t\tsetHasUrl( false );\n\t}, [ animatedValue ] );\n\n\tfunction onIconPress() {\n\t\tif ( isSelected ) {\n\t\t\tsetIsLinkSheetVisible( true );\n\t\t} else {\n\t\t\tonFocus();\n\t\t}\n\t}\n\n\tconst accessibilityHint = url\n\t\t? sprintf(\n\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t__( '%s has URL set' ),\n\t\t\t\tsocialLinkName\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t__( '%s has no URL set' ),\n\t\t\t\tsocialLinkName\n\t\t );\n\n\treturn (\n\t\t<View>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t\t\t\t\t\t__( 'Add link to %s' ),\n\t\t\t\t\t\t\t\t\tsocialLinkName\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\t\t\tonClick={ onOpenSettingsSheet }\n\t\t\t\t\t\t\t\tisActive={ url }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<LinkSettingsNavigation\n\t\t\t\t\t\tisVisible={ isLinkSheetVisible }\n\t\t\t\t\t\turl={ attributes.url }\n\t\t\t\t\t\tlabel={ attributes.label }\n\t\t\t\t\t\trel={ attributes.rel }\n\t\t\t\t\t\tonEmptyURL={ onEmptyURL }\n\t\t\t\t\t\tonClose={ onCloseSettingsSheet }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\toptions={ linkSettingsOptions }\n\t\t\t\t\t\twithBottomSheet\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ onIconPress }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t// translators: %s: social link name e.g: \"Instagram\".\n\t\t\t\t\t__( '%s social icon' ),\n\t\t\t\t\tsocialLinkName\n\t\t\t\t) }\n\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t>\n\t\t\t\t<Animated.View\n\t\t\t\t\tstyle={ [ styles.iconContainer, { backgroundColor } ] }\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tanimated\n\t\t\t\t\t\ticon={ IconComponent }\n\t\t\t\t\t\tstyle={ { stroke, color } }\n\t\t\t\t\t/>\n\t\t\t\t</Animated.View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\n\t\tconst block = getBlock( clientId );\n\t\tconst name = block?.name.substring( 17 );\n\n\t\treturn {\n\t\t\tname,\n\t\t};\n\t} ),\n] )( SocialLinkEdit );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,wBAAwB,QAAQ,cAAc;;AAE/E;AACA;AACA;AACA,SACCC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,oBAAoB;AAC7E,SACCC,YAAY,EACZC,aAAa,EACbC,sBAAsB,QAChB,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,4BAA4B,QAAQ,oBAAoB;AAC1E,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C;AACA;AACA;AACA,SAASC,aAAa,EAAEC,aAAa,QAAQ,eAAe;AAC5D,OAAOC,MAAM,MAAM,eAAe;AAElC,MAAMC,0BAA0B,GAAG;EAClCC,eAAe,EAAE,SAAS;EAC1BC,KAAK,EAAE;AACR,CAAC;AACD,MAAMC,4BAA4B,GAAG;EACpCF,eAAe,EAAE,WAAW;EAC5BC,KAAK,EAAE;AACR,CAAC;AACD,MAAME,eAAe,GAAG,GAAG;AAC3B,MAAMC,kBAAkB,GAAG,GAAG;AAE9B,MAAMC,mBAAmB,GAAG;EAC3BC,GAAG,EAAE;IACJC,KAAK,EAAEhB,EAAE,CAAE,KAAM,CAAC;IAClBiB,WAAW,EAAEjB,EAAE,CAAE,SAAU,CAAC;IAC5BkB,SAAS,EAAE;EACZ,CAAC;EACDC,SAAS,E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IAC/ByD,eAAe;EAAA,CACf,CACA,CACF,EAEDV,aAAA,CAAC1E,wBAAwB;IACxBqF,OAAO,EAAGb,WAAa;IACvBc,iBAAiB,EAAG,QAAU;IAC9BC,kBAAkB,EAAGzE,OAAO;IAC3B;IACAD,EAAE,CAAE,gBAAiB,CAAC,EACtBuC,cACD,CAAG;IACHqB,iBAAiB,EAAGA;EAAmB,GAEvCC,aAAA,CAAC5E,QAAQ,CAACD,IAAI;IACb2F,KAAK,EAAG,CAAEpE,MAAM,CAACqE,aAAa,EAAE;MAAEnE;IAAgB,CAAC;EAAI,GAEvDoD,aAAA,CAAC1D,IAAI;IACJ0E,QAAQ;IACRb,IAAI,EAAG1B,aAAe;IACtBqC,KAAK,EAAG;MAAE7B,MAAM;MAAEpC;IAAM;EAAG,CAC3B,CACa,CACU,CACrB,CAAC;AAET,CAAC;AAED,eAAeZ,OAAO,CAAE,CACvBM,UAAU,CAAE,CAAE0E,MAAM,EAAE;EAAEC;AAAS,CAAC,KAAM;EACvC,MAAM;IAAEC;EAAS,CAAC,GAAGF,MAAM,CAAExF,gBAAiB,CAAC;EAE/C,MAAM2F,KAAK,GAAGD,QAAQ,CAAED,QAAS,CAAC;EAClC,MAAMrD,IAAI,GAAGuD,KAAK,EAAEvD,IAAI,CAACwD,SAAS,CAAE,EAAG,CAAC;EAExC,OAAO;IACNxD;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEL,cAAe,CAAC"}
@@ -21,8 +21,7 @@ import { useAlternativeBlockPatterns, useAlternativeTemplateParts, useTemplatePa
21
21
  export default function TemplatePartEdit({
22
22
  attributes,
23
23
  setAttributes,
24
- clientId,
25
- isSelected
24
+ clientId
26
25
  }) {
27
26
  const {
28
27
  slug,
@@ -71,10 +70,7 @@ export default function TemplatePartEdit({
71
70
  const isPlaceholder = !slug;
72
71
  const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
73
72
  const TagName = tagName || areaObject.tagName;
74
-
75
- // The `isSelected` check ensures the `BlockSettingsMenuControls` fill
76
- // doesn't render multiple times. The block controls has similar internal check.
77
- const canReplace = isSelected && isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
73
+ const canReplace = isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
78
74
 
79
75
  // We don't want to render a missing state if we have any inner blocks.
80
76
  // A new template part is automatically created if we have any inner blocks but no entity.
@@ -106,16 +102,27 @@ export default function TemplatePartEdit({
106
102
  clientId: clientId,
107
103
  setAttributes: setAttributes,
108
104
  onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
109
- })), canReplace && createElement(BlockSettingsMenuControls, null, () => createElement(MenuItem, {
110
- onClick: () => {
111
- setIsTemplatePartSelectionOpen(true);
105
+ })), canReplace && createElement(BlockSettingsMenuControls, null, ({
106
+ selectedClientIds
107
+ }) => {
108
+ // Only enable for single selection that matches the current block.
109
+ // Ensures menu item doesn't render multiple times.
110
+ if (!(selectedClientIds.length === 1 && clientId === selectedClientIds[0])) {
111
+ return null;
112
112
  }
113
- }, createInterpolateElement(__('Replace <BlockTitle />'), {
114
- BlockTitle: createElement(BlockTitle, {
115
- clientId: clientId,
116
- maximumLength: 25
117
- })
118
- }))), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
113
+ return createElement(MenuItem, {
114
+ onClick: () => {
115
+ setIsTemplatePartSelectionOpen(true);
116
+ },
117
+ "aria-expanded": isTemplatePartSelectionOpen,
118
+ "aria-haspopup": "dialog"
119
+ }, createInterpolateElement(__('Replace <BlockTitle />'), {
120
+ BlockTitle: createElement(BlockTitle, {
121
+ clientId: clientId,
122
+ maximumLength: 25
123
+ })
124
+ }));
125
+ }), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
119
126
  tagName: TagName,
120
127
  blockProps: blockProps,
121
128
  postId: templatePartId,
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","BlockSettingsMenuControls","BlockTitle","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","createInterpolateElement","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","isSelected","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","onClick","maximumLength","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tisSelected,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\t// The `isSelected` check ensures the `BlockSettingsMenuControls` fill\n\t// doesn't render multiple times. The block controls has similar internal check.\n\tconst canReplace =\n\t\tisSelected &&\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t/>\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\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</MenuItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen={ true }\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,UAAU,EACVC,aAAa,EACbC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,yBAAyB;AAChC,SAASC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,uBAAuB;AAChE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASV,KAAK,IAAIW,SAAS,QAA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,EAAG;IAAI,CACpB;EAEH,CACD,CACS,CAEe,CAC3B,EACCV,iBAAiB,IAClBG,aAAA,CAAC1C,uBAAuB;IACvBY,OAAO,EAAG4B,OAAS;IACnBH,UAAU,EAAGA,UAAY;IACzBa,MAAM,EAAGpC,cAAgB;IACzBgC,cAAc,EAAG3B,WAAW,CAACa,MAAM,GAAG,CAAG;IACzCnB,MAAM,EAAGA;EAAQ,CACjB,CACD,EACC,CAAEyB,aAAa,IAAI,CAAEpB,UAAU,IAChCwB,aAAA,CAACF,OAAO;IAAA,GAAMH;EAAU,GACvBK,aAAA,CAACrD,OAAO,MAAE,CACF,CAEQ,CAAC,EAClB2B,2BAA2B,IAC5B0B,aAAA,CAACpD,KAAK;IACL6D,gBAAgB,EAAC,6CAA6C;IAC9DC,KAAK,EAAG3D,OAAO;IACd;IACAD,EAAE,CAAE,aAAc,CAAC,EACnB4C,UAAU,CAACiB,KAAK,CAACC,WAAW,CAAC,CAC9B,CAAG;IACHC,cAAc,EAAGA,CAAA,KAChBtC,8BAA8B,CAAE,KAAM,CACtC;IACDuC,YAAY,EAAG;EAAM,GAErBd,aAAA,CAAC5C,0BAA0B;IAC1BgB,cAAc,EAAGA,cAAgB;IACjCN,QAAQ,EAAGA,QAAU;IACrBa,IAAI,EAAGA,IAAM;IACbd,aAAa,EAAGA,aAAe;IAC/BkD,OAAO,EAAGA,CAAA,KACTxC,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
1
+ {"version":3,"names":["useSelect","BlockSettingsMenuControls","BlockTitle","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","createInterpolateElement","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","selectedClientIds","onClick","maximumLength","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t/>\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen={ true }\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,UAAU,EACVC,aAAa,EACbC,O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AI,EAAGA,IAAM;IACbb,aAAa,EAAGA,aAAe;IAC/BkD,OAAO,EAAGA,CAAA,KACTzC,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
@@ -2589,7 +2589,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2589
2589
  padding-left: 8px;
2590
2590
  }
2591
2591
 
2592
- .wp-block[data-align=center] > .wp-block-social-links {
2592
+ .wp-block[data-align=center] > .wp-block-social-links,
2593
+ .wp-block.wp-block-social-links.aligncenter {
2593
2594
  justify-content: center;
2594
2595
  }
2595
2596
 
@@ -2597,7 +2597,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2597
2597
  padding-right: 8px;
2598
2598
  }
2599
2599
 
2600
- .wp-block[data-align=center] > .wp-block-social-links {
2600
+ .wp-block[data-align=center] > .wp-block-social-links,
2601
+ .wp-block.wp-block-social-links.aligncenter {
2601
2602
  justify-content: center;
2602
2603
  }
2603
2604
 
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Converts a hex value into the rgb equivalent.
3
+ *
4
+ * @param {string} hex - the hexadecimal value to convert
5
+ * @return {string} comma separated rgb values
6
+ */
7
+ /**
8
+ * Colors
9
+ */
10
+ /**
11
+ * Breakpoints & Media Queries
12
+ */
13
+ /**
14
+ * SCSS Variables.
15
+ *
16
+ * Please use variables from this sheet to ensure consistency across the UI.
17
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
18
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
19
+ */
20
+ /**
21
+ * Converts a hex value into the rgb equivalent.
22
+ *
23
+ * @param {string} hex - the hexadecimal value to convert
24
+ * @return {string} comma separated rgb values
25
+ */
26
+ /**
27
+ * Colors
28
+ */
29
+ /**
30
+ * Fonts & basic variables.
31
+ */
32
+ /**
33
+ * Grid System.
34
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
35
+ */
36
+ /**
37
+ * Dimensions.
38
+ */
39
+ /**
40
+ * Shadows.
41
+ */
42
+ /**
43
+ * Editor widths.
44
+ */
45
+ /**
46
+ * Block & Editor UI.
47
+ */
48
+ /**
49
+ * Block paddings.
50
+ */
51
+ /**
52
+ * React Native specific.
53
+ * These variables do not appear to be used anywhere else.
54
+ */
55
+ /**
56
+ * Converts a hex value into the rgb equivalent.
57
+ *
58
+ * @param {string} hex - the hexadecimal value to convert
59
+ * @return {string} comma separated rgb values
60
+ */
61
+ /**
62
+ * Long content fade mixin
63
+ *
64
+ * Creates a fading overlay to signify that the content is longer
65
+ * than the space allows.
66
+ */
67
+ /**
68
+ * Breakpoint mixins
69
+ */
70
+ /**
71
+ * Focus styles.
72
+ */
73
+ /**
74
+ * Applies editor left position to the selector passed as argument
75
+ */
76
+ /**
77
+ * Styles that are reused verbatim in a few places
78
+ */
79
+ /**
80
+ * Allows users to opt-out of animations via OS-level preferences.
81
+ */
82
+ /**
83
+ * Reset default styles for JavaScript UI based pages.
84
+ * This is a WP-admin agnostic reset
85
+ */
86
+ /**
87
+ * Reset the WP Admin page styles for Gutenberg-like pages.
88
+ */
89
+ .wp-block-query__enhanced-pagination-animation {
90
+ position: fixed;
91
+ top: 0;
92
+ right: 0;
93
+ margin: 0;
94
+ padding: 0;
95
+ width: 100vw;
96
+ max-width: 100vw !important;
97
+ height: 4px;
98
+ background-color: var(--wp--preset--color--primary, #000);
99
+ opacity: 0;
100
+ }
101
+ .wp-block-query__enhanced-pagination-animation.start-animation {
102
+ animation: wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(0, 1, 0, 1) infinite;
103
+ }
104
+ .wp-block-query__enhanced-pagination-animation.finish-animation {
105
+ animation: wp-block-query__enhanced-pagination-finish-animation 300ms ease-in;
106
+ }
107
+
108
+ @keyframes wp-block-query__enhanced-pagination-start-animation {
109
+ 0% {
110
+ transform: scaleX(0);
111
+ transform-origin: 100% 0%;
112
+ opacity: 1;
113
+ }
114
+ 100% {
115
+ transform: scaleX(1);
116
+ transform-origin: 100% 0%;
117
+ opacity: 1;
118
+ }
119
+ }
120
+ @keyframes wp-block-query__enhanced-pagination-finish-animation {
121
+ 0% {
122
+ opacity: 1;
123
+ }
124
+ 50% {
125
+ opacity: 1;
126
+ }
127
+ 100% {
128
+ opacity: 0;
129
+ }
130
+ }
131
+ .wp-block-query__enhanced-pagination-navigation-announce {
132
+ position: absolute;
133
+ clip: rect(0, 0, 0, 0);
134
+ width: 1px;
135
+ height: 1px;
136
+ padding: 0;
137
+ margin: -1px;
138
+ overflow: hidden;
139
+ border: 0;
140
+ }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Converts a hex value into the rgb equivalent.
3
+ *
4
+ * @param {string} hex - the hexadecimal value to convert
5
+ * @return {string} comma separated rgb values
6
+ */
7
+ /**
8
+ * Colors
9
+ */
10
+ /**
11
+ * Breakpoints & Media Queries
12
+ */
13
+ /**
14
+ * SCSS Variables.
15
+ *
16
+ * Please use variables from this sheet to ensure consistency across the UI.
17
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
18
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
19
+ */
20
+ /**
21
+ * Converts a hex value into the rgb equivalent.
22
+ *
23
+ * @param {string} hex - the hexadecimal value to convert
24
+ * @return {string} comma separated rgb values
25
+ */
26
+ /**
27
+ * Colors
28
+ */
29
+ /**
30
+ * Fonts & basic variables.
31
+ */
32
+ /**
33
+ * Grid System.
34
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
35
+ */
36
+ /**
37
+ * Dimensions.
38
+ */
39
+ /**
40
+ * Shadows.
41
+ */
42
+ /**
43
+ * Editor widths.
44
+ */
45
+ /**
46
+ * Block & Editor UI.
47
+ */
48
+ /**
49
+ * Block paddings.
50
+ */
51
+ /**
52
+ * React Native specific.
53
+ * These variables do not appear to be used anywhere else.
54
+ */
55
+ /**
56
+ * Converts a hex value into the rgb equivalent.
57
+ *
58
+ * @param {string} hex - the hexadecimal value to convert
59
+ * @return {string} comma separated rgb values
60
+ */
61
+ /**
62
+ * Long content fade mixin
63
+ *
64
+ * Creates a fading overlay to signify that the content is longer
65
+ * than the space allows.
66
+ */
67
+ /**
68
+ * Breakpoint mixins
69
+ */
70
+ /**
71
+ * Focus styles.
72
+ */
73
+ /**
74
+ * Applies editor left position to the selector passed as argument
75
+ */
76
+ /**
77
+ * Styles that are reused verbatim in a few places
78
+ */
79
+ /**
80
+ * Allows users to opt-out of animations via OS-level preferences.
81
+ */
82
+ /**
83
+ * Reset default styles for JavaScript UI based pages.
84
+ * This is a WP-admin agnostic reset
85
+ */
86
+ /**
87
+ * Reset the WP Admin page styles for Gutenberg-like pages.
88
+ */
89
+ .wp-block-query__enhanced-pagination-animation {
90
+ position: fixed;
91
+ top: 0;
92
+ left: 0;
93
+ margin: 0;
94
+ padding: 0;
95
+ width: 100vw;
96
+ max-width: 100vw !important;
97
+ height: 4px;
98
+ background-color: var(--wp--preset--color--primary, #000);
99
+ opacity: 0;
100
+ }
101
+ .wp-block-query__enhanced-pagination-animation.start-animation {
102
+ animation: wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(0, 1, 0, 1) infinite;
103
+ }
104
+ .wp-block-query__enhanced-pagination-animation.finish-animation {
105
+ animation: wp-block-query__enhanced-pagination-finish-animation 300ms ease-in;
106
+ }
107
+
108
+ @keyframes wp-block-query__enhanced-pagination-start-animation {
109
+ 0% {
110
+ transform: scaleX(0);
111
+ transform-origin: 0% 0%;
112
+ opacity: 1;
113
+ }
114
+ 100% {
115
+ transform: scaleX(1);
116
+ transform-origin: 0% 0%;
117
+ opacity: 1;
118
+ }
119
+ }
120
+ @keyframes wp-block-query__enhanced-pagination-finish-animation {
121
+ 0% {
122
+ opacity: 1;
123
+ }
124
+ 50% {
125
+ opacity: 1;
126
+ }
127
+ 100% {
128
+ opacity: 0;
129
+ }
130
+ }
131
+ .wp-block-query__enhanced-pagination-navigation-announce {
132
+ position: absolute;
133
+ clip: rect(0, 0, 0, 0);
134
+ width: 1px;
135
+ height: 1px;
136
+ padding: 0;
137
+ margin: -1px;
138
+ overflow: hidden;
139
+ border: 0;
140
+ }
@@ -92,6 +92,7 @@
92
92
  }
93
93
  .wp-block-site-logo a {
94
94
  display: inline-block;
95
+ line-height: 0;
95
96
  }
96
97
  .wp-block-site-logo.is-default-size img {
97
98
  width: 120px;
@@ -92,6 +92,7 @@
92
92
  }
93
93
  .wp-block-site-logo a {
94
94
  display: inline-block;
95
+ line-height: 0;
95
96
  }
96
97
  .wp-block-site-logo.is-default-size img {
97
98
  width: 120px;
@@ -152,7 +152,8 @@
152
152
  padding-left: 8px;
153
153
  }
154
154
 
155
- .wp-block[data-align=center] > .wp-block-social-links {
155
+ .wp-block[data-align=center] > .wp-block-social-links,
156
+ .wp-block.wp-block-social-links.aligncenter {
156
157
  justify-content: center;
157
158
  }
158
159
 
@@ -152,7 +152,8 @@
152
152
  padding-right: 8px;
153
153
  }
154
154
 
155
- .wp-block[data-align=center] > .wp-block-social-links {
155
+ .wp-block[data-align=center] > .wp-block-social-links,
156
+ .wp-block.wp-block-social-links.aligncenter {
156
157
  justify-content: center;
157
158
  }
158
159
 
@@ -3169,6 +3169,7 @@ ul.wp-block-rss.is-grid li {
3169
3169
  }
3170
3170
  .wp-block-site-logo a {
3171
3171
  display: inline-block;
3172
+ line-height: 0;
3172
3173
  }
3173
3174
  .wp-block-site-logo.is-default-size img {
3174
3175
  width: 120px;
@@ -3204,6 +3204,7 @@ ul.wp-block-rss.is-grid li {
3204
3204
  }
3205
3205
  .wp-block-site-logo a {
3206
3206
  display: inline-block;
3207
+ line-height: 0;
3207
3208
  }
3208
3209
  .wp-block-site-logo.is-default-size img {
3209
3210
  width: 120px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.17.0",
3
+ "version": "8.18.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,36 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.40.0",
35
- "@wordpress/api-fetch": "^6.37.0",
36
- "@wordpress/autop": "^3.40.0",
37
- "@wordpress/blob": "^3.40.0",
38
- "@wordpress/block-editor": "^12.8.0",
39
- "@wordpress/blocks": "^12.17.0",
40
- "@wordpress/components": "^25.6.0",
41
- "@wordpress/compose": "^6.17.0",
42
- "@wordpress/core-data": "^6.17.0",
43
- "@wordpress/data": "^9.10.0",
44
- "@wordpress/date": "^4.40.0",
45
- "@wordpress/deprecated": "^3.40.0",
46
- "@wordpress/dom": "^3.40.0",
47
- "@wordpress/element": "^5.17.0",
48
- "@wordpress/escape-html": "^2.40.0",
49
- "@wordpress/hooks": "^3.40.0",
50
- "@wordpress/html-entities": "^3.40.0",
51
- "@wordpress/i18n": "^4.40.0",
52
- "@wordpress/icons": "^9.31.0",
53
- "@wordpress/interactivity": "^2.1.0",
54
- "@wordpress/keycodes": "^3.40.0",
55
- "@wordpress/notices": "^4.8.0",
56
- "@wordpress/primitives": "^3.38.0",
57
- "@wordpress/private-apis": "^0.22.0",
58
- "@wordpress/reusable-blocks": "^4.17.0",
59
- "@wordpress/rich-text": "^6.17.0",
60
- "@wordpress/server-side-render": "^4.17.0",
61
- "@wordpress/url": "^3.41.0",
62
- "@wordpress/viewport": "^5.17.0",
63
- "@wordpress/wordcount": "^3.40.0",
34
+ "@wordpress/a11y": "^3.41.0",
35
+ "@wordpress/api-fetch": "^6.38.0",
36
+ "@wordpress/autop": "^3.41.0",
37
+ "@wordpress/blob": "^3.41.0",
38
+ "@wordpress/block-editor": "^12.9.0",
39
+ "@wordpress/blocks": "^12.18.0",
40
+ "@wordpress/components": "^25.7.0",
41
+ "@wordpress/compose": "^6.18.0",
42
+ "@wordpress/core-data": "^6.18.0",
43
+ "@wordpress/data": "^9.11.0",
44
+ "@wordpress/date": "^4.41.0",
45
+ "@wordpress/deprecated": "^3.41.0",
46
+ "@wordpress/dom": "^3.41.0",
47
+ "@wordpress/element": "^5.18.0",
48
+ "@wordpress/escape-html": "^2.41.0",
49
+ "@wordpress/hooks": "^3.41.0",
50
+ "@wordpress/html-entities": "^3.41.0",
51
+ "@wordpress/i18n": "^4.41.0",
52
+ "@wordpress/icons": "^9.32.0",
53
+ "@wordpress/interactivity": "^2.2.0",
54
+ "@wordpress/keycodes": "^3.41.0",
55
+ "@wordpress/notices": "^4.9.0",
56
+ "@wordpress/primitives": "^3.39.0",
57
+ "@wordpress/private-apis": "^0.23.0",
58
+ "@wordpress/reusable-blocks": "^4.18.0",
59
+ "@wordpress/rich-text": "^6.18.0",
60
+ "@wordpress/server-side-render": "^4.18.0",
61
+ "@wordpress/url": "^3.42.0",
62
+ "@wordpress/viewport": "^5.18.0",
63
+ "@wordpress/wordcount": "^3.41.0",
64
64
  "change-case": "^4.1.2",
65
65
  "classnames": "^2.3.1",
66
66
  "colord": "^2.7.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "78a288d55b83a713b2f7d98d5a855c0771a2afc6"
82
+ "gitHead": "5eac1734bcdca2301fdd37ec8cfe2a45e722a2c4"
83
83
  }