@wordpress/block-library 8.25.0 → 8.25.1-next.79a6196f.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 (250) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/audio/edit.js +10 -12
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/block/edit.js +81 -34
  5. package/build/block/edit.js.map +1 -1
  6. package/build/comments-title/deprecated.js +1 -1
  7. package/build/comments-title/index.js +1 -1
  8. package/build/cover/edit/inspector-controls.js +1 -1
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/edit.native.js +1 -0
  11. package/build/cover/edit.native.js.map +1 -1
  12. package/build/embed/util.js +4 -4
  13. package/build/embed/util.js.map +1 -1
  14. package/build/file/edit.js +19 -27
  15. package/build/file/edit.js.map +1 -1
  16. package/build/gallery/edit.js +36 -17
  17. package/build/gallery/edit.js.map +1 -1
  18. package/build/gallery/gallery.js +3 -2
  19. package/build/gallery/gallery.js.map +1 -1
  20. package/build/gallery/index.js +4 -0
  21. package/build/gallery/index.js.map +1 -1
  22. package/build/gallery/transforms.js +4 -68
  23. package/build/gallery/transforms.js.map +1 -1
  24. package/build/group/index.js +5 -1
  25. package/build/group/index.js.map +1 -1
  26. package/build/image/deprecated.js +11 -0
  27. package/build/image/deprecated.js.map +1 -1
  28. package/build/image/edit.native.js +3 -0
  29. package/build/image/edit.native.js.map +1 -1
  30. package/build/image/image.js +22 -21
  31. package/build/image/image.js.map +1 -1
  32. package/build/image/view.js +7 -1
  33. package/build/image/view.js.map +1 -1
  34. package/build/list/edit.js +10 -15
  35. package/build/list/edit.js.map +1 -1
  36. package/build/list-item/edit.js +17 -2
  37. package/build/list-item/edit.js.map +1 -1
  38. package/build/list-item/hooks/use-enter.js +5 -3
  39. package/build/list-item/hooks/use-enter.js.map +1 -1
  40. package/build/list-item/hooks/use-enter.native.js +4 -3
  41. package/build/list-item/hooks/use-enter.native.js.map +1 -1
  42. package/build/list-item/hooks/use-indent-list-item.js +2 -3
  43. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  44. package/build/list-item/hooks/use-merge.js +1 -1
  45. package/build/list-item/hooks/use-merge.js.map +1 -1
  46. package/build/list-item/hooks/use-outdent-list-item.js +3 -17
  47. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  48. package/build/list-item/hooks/use-space.js +8 -4
  49. package/build/list-item/hooks/use-space.js.map +1 -1
  50. package/build/media-text/media-container.native.js +3 -0
  51. package/build/media-text/media-container.native.js.map +1 -1
  52. package/build/navigation/constants.js +3 -1
  53. package/build/navigation/constants.js.map +1 -1
  54. package/build/navigation/edit/index.js +4 -0
  55. package/build/navigation/edit/index.js.map +1 -1
  56. package/build/navigation/view.js +25 -1
  57. package/build/navigation/view.js.map +1 -1
  58. package/build/paragraph/index.js +0 -1
  59. package/build/paragraph/index.js.map +1 -1
  60. package/build/paragraph/transforms.js +0 -1
  61. package/build/paragraph/transforms.js.map +1 -1
  62. package/build/pattern/edit.js +24 -2
  63. package/build/pattern/edit.js.map +1 -1
  64. package/build/pattern/recursion-detector.js +147 -0
  65. package/build/pattern/recursion-detector.js.map +1 -0
  66. package/build/post-featured-image/edit.js +19 -2
  67. package/build/post-featured-image/edit.js.map +1 -1
  68. package/build/post-featured-image/index.js +4 -0
  69. package/build/post-featured-image/index.js.map +1 -1
  70. package/build/query/edit/inspector-controls/index.js +3 -1
  71. package/build/query/edit/inspector-controls/index.js.map +1 -1
  72. package/build/query-pagination-numbers/index.js +1 -1
  73. package/build/search/edit.js +3 -5
  74. package/build/search/edit.js.map +1 -1
  75. package/build/search/index.js +0 -4
  76. package/build/search/index.js.map +1 -1
  77. package/build/site-logo/edit.js +7 -6
  78. package/build/site-logo/edit.js.map +1 -1
  79. package/build/spacer/edit.native.js +2 -2
  80. package/build/spacer/edit.native.js.map +1 -1
  81. package/build/tag-cloud/edit.js +5 -9
  82. package/build/tag-cloud/edit.js.map +1 -1
  83. package/build/utils/constants.js +16 -0
  84. package/build/utils/constants.js.map +1 -0
  85. package/build/video/edit.js +11 -8
  86. package/build/video/edit.js.map +1 -1
  87. package/build-module/audio/edit.js +10 -12
  88. package/build-module/audio/edit.js.map +1 -1
  89. package/build-module/block/edit.js +85 -38
  90. package/build-module/block/edit.js.map +1 -1
  91. package/build-module/comments-title/deprecated.js +1 -1
  92. package/build-module/comments-title/index.js +1 -1
  93. package/build-module/cover/edit/inspector-controls.js +1 -1
  94. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  95. package/build-module/cover/edit.native.js +1 -0
  96. package/build-module/cover/edit.native.js.map +1 -1
  97. package/build-module/embed/util.js +4 -4
  98. package/build-module/embed/util.js.map +1 -1
  99. package/build-module/file/edit.js +19 -27
  100. package/build-module/file/edit.js.map +1 -1
  101. package/build-module/gallery/edit.js +36 -17
  102. package/build-module/gallery/edit.js.map +1 -1
  103. package/build-module/gallery/gallery.js +3 -2
  104. package/build-module/gallery/gallery.js.map +1 -1
  105. package/build-module/gallery/index.js +4 -0
  106. package/build-module/gallery/index.js.map +1 -1
  107. package/build-module/gallery/transforms.js +4 -68
  108. package/build-module/gallery/transforms.js.map +1 -1
  109. package/build-module/group/index.js +5 -1
  110. package/build-module/group/index.js.map +1 -1
  111. package/build-module/image/deprecated.js +11 -0
  112. package/build-module/image/deprecated.js.map +1 -1
  113. package/build-module/image/edit.native.js +3 -0
  114. package/build-module/image/edit.native.js.map +1 -1
  115. package/build-module/image/image.js +17 -16
  116. package/build-module/image/image.js.map +1 -1
  117. package/build-module/image/view.js +7 -1
  118. package/build-module/image/view.js.map +1 -1
  119. package/build-module/list/edit.js +10 -15
  120. package/build-module/list/edit.js.map +1 -1
  121. package/build-module/list-item/edit.js +18 -3
  122. package/build-module/list-item/edit.js.map +1 -1
  123. package/build-module/list-item/hooks/use-enter.js +5 -3
  124. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  125. package/build-module/list-item/hooks/use-enter.native.js +4 -3
  126. package/build-module/list-item/hooks/use-enter.native.js.map +1 -1
  127. package/build-module/list-item/hooks/use-indent-list-item.js +2 -3
  128. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  129. package/build-module/list-item/hooks/use-merge.js +1 -1
  130. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  131. package/build-module/list-item/hooks/use-outdent-list-item.js +3 -17
  132. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  133. package/build-module/list-item/hooks/use-space.js +8 -4
  134. package/build-module/list-item/hooks/use-space.js.map +1 -1
  135. package/build-module/media-text/media-container.native.js +3 -0
  136. package/build-module/media-text/media-container.native.js.map +1 -1
  137. package/build-module/navigation/constants.js +1 -0
  138. package/build-module/navigation/constants.js.map +1 -1
  139. package/build-module/navigation/edit/index.js +5 -1
  140. package/build-module/navigation/edit/index.js.map +1 -1
  141. package/build-module/navigation/view.js +25 -1
  142. package/build-module/navigation/view.js.map +1 -1
  143. package/build-module/paragraph/index.js +0 -1
  144. package/build-module/paragraph/index.js.map +1 -1
  145. package/build-module/paragraph/transforms.js +0 -1
  146. package/build-module/paragraph/transforms.js.map +1 -1
  147. package/build-module/pattern/edit.js +26 -4
  148. package/build-module/pattern/edit.js.map +1 -1
  149. package/build-module/pattern/recursion-detector.js +139 -0
  150. package/build-module/pattern/recursion-detector.js.map +1 -0
  151. package/build-module/post-featured-image/edit.js +19 -2
  152. package/build-module/post-featured-image/edit.js.map +1 -1
  153. package/build-module/post-featured-image/index.js +4 -0
  154. package/build-module/post-featured-image/index.js.map +1 -1
  155. package/build-module/query/edit/inspector-controls/index.js +3 -1
  156. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  157. package/build-module/query-pagination-numbers/index.js +1 -1
  158. package/build-module/search/edit.js +3 -5
  159. package/build-module/search/edit.js.map +1 -1
  160. package/build-module/search/index.js +0 -4
  161. package/build-module/search/index.js.map +1 -1
  162. package/build-module/site-logo/edit.js +7 -6
  163. package/build-module/site-logo/edit.js.map +1 -1
  164. package/build-module/spacer/edit.native.js +2 -2
  165. package/build-module/spacer/edit.native.js.map +1 -1
  166. package/build-module/tag-cloud/edit.js +6 -10
  167. package/build-module/tag-cloud/edit.js.map +1 -1
  168. package/build-module/utils/constants.js +9 -0
  169. package/build-module/utils/constants.js.map +1 -0
  170. package/build-module/video/edit.js +11 -8
  171. package/build-module/video/edit.js.map +1 -1
  172. package/build-style/button/editor-rtl.css +0 -37
  173. package/build-style/button/editor.css +0 -37
  174. package/build-style/button/style-rtl.css +6 -6
  175. package/build-style/button/style.css +6 -6
  176. package/build-style/editor-rtl.css +2 -44
  177. package/build-style/editor.css +2 -44
  178. package/build-style/navigation/editor-rtl.css +2 -4
  179. package/build-style/navigation/editor.css +2 -4
  180. package/build-style/navigation/style-rtl.css +14 -18
  181. package/build-style/navigation/style.css +14 -18
  182. package/build-style/search/style-rtl.css +26 -27
  183. package/build-style/search/style.css +26 -27
  184. package/build-style/style-rtl.css +46 -51
  185. package/build-style/style.css +46 -51
  186. package/build-style/table/editor-rtl.css +0 -3
  187. package/build-style/table/editor.css +0 -3
  188. package/package.json +32 -32
  189. package/src/audio/edit.js +19 -19
  190. package/src/audio/test/__snapshots__/edit.native.js.snap +12 -0
  191. package/src/audio/test/edit.native.js +29 -0
  192. package/src/block/edit.js +120 -66
  193. package/src/button/editor.scss +0 -43
  194. package/src/button/style.scss +6 -6
  195. package/src/buttons/test/__snapshots__/edit.native.js.snap +6 -0
  196. package/src/buttons/test/edit.native.js +49 -0
  197. package/src/comments-title/block.json +1 -1
  198. package/src/cover/edit/inspector-controls.js +1 -1
  199. package/src/cover/edit.native.js +1 -0
  200. package/src/embed/util.js +2 -2
  201. package/src/file/edit.js +17 -24
  202. package/src/gallery/block.json +4 -0
  203. package/src/gallery/edit.js +69 -42
  204. package/src/gallery/gallery.js +4 -1
  205. package/src/gallery/index.php +15 -0
  206. package/src/gallery/transforms.js +2 -55
  207. package/src/group/block.json +5 -1
  208. package/src/image/deprecated.js +8 -0
  209. package/src/image/edit.native.js +3 -0
  210. package/src/image/image.js +54 -35
  211. package/src/image/index.php +1 -6
  212. package/src/image/view.js +5 -2
  213. package/src/list/edit.js +27 -35
  214. package/src/list-item/edit.js +18 -2
  215. package/src/list-item/hooks/use-enter.js +63 -62
  216. package/src/list-item/hooks/use-enter.native.js +9 -5
  217. package/src/list-item/hooks/use-indent-list-item.js +43 -53
  218. package/src/list-item/hooks/use-merge.js +1 -1
  219. package/src/list-item/hooks/use-outdent-list-item.js +50 -69
  220. package/src/list-item/hooks/use-space.js +7 -4
  221. package/src/media-text/media-container.native.js +3 -1
  222. package/src/navigation/constants.js +2 -0
  223. package/src/navigation/edit/index.js +11 -1
  224. package/src/navigation/editor.scss +1 -1
  225. package/src/navigation/style.scss +18 -16
  226. package/src/navigation/view.js +29 -3
  227. package/src/paragraph/block.json +0 -1
  228. package/src/paragraph/test/__snapshots__/edit.native.js.snap +12 -0
  229. package/src/paragraph/test/edit.native.js +114 -0
  230. package/src/pattern/edit.js +35 -3
  231. package/src/pattern/index.php +16 -0
  232. package/src/pattern/recursion-detector.js +145 -0
  233. package/src/pattern/test/index.js +74 -0
  234. package/src/post-featured-image/block.json +4 -0
  235. package/src/post-featured-image/edit.js +32 -1
  236. package/src/post-featured-image/index.php +31 -0
  237. package/src/query/edit/inspector-controls/index.js +2 -0
  238. package/src/query-pagination-numbers/block.json +1 -1
  239. package/src/search/block.json +0 -4
  240. package/src/search/edit.js +2 -8
  241. package/src/search/index.php +3 -7
  242. package/src/search/style.scss +27 -29
  243. package/src/site-logo/edit.js +3 -4
  244. package/src/social-link/index.php +1 -1
  245. package/src/spacer/edit.native.js +4 -2
  246. package/src/table/editor.scss +0 -3
  247. package/src/tag-cloud/edit.js +7 -7
  248. package/src/template-part/index.php +6 -0
  249. package/src/utils/constants.js +8 -0
  250. package/src/video/edit.js +29 -27
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useRegistry","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityProp","useEntityRecord","Placeholder","Spinner","TextControl","PanelBody","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","InspectorControls","useBlockProps","Warning","privateApis","blockEditorPrivateApis","store","blockEditorStore","getBlockSupport","parse","unlock","useLayoutClasses","isPartiallySynced","block","name","attributes","connections","Object","values","some","connection","source","getPartiallySyncedAttributes","entries","filter","map","attributeKey","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","includes","align","layout","applyInitialOverrides","overrides","defaultValues","innerBlocks","blockId","metadata","id","newAttributes","getOverridesFromBlocks","assign","keys","ReusableBlockEdit","ref","__unstableParentLayout","clientId","patternClientId","registry","hasAlreadyRendered","record","hasResolved","isMissing","initialOverrides","defaultValuesRef","replaceInnerBlocks","__unstableMarkNextChangeAsNotPersistent","setBlockEditingMode","getBlockEditingMode","content","raw","initialBlocks","editingMode","batch","select","getBlocks","title","setTitle","layoutClasses","blockProps","className","innerBlocksProps","renderAppender","ButtonBlockAppender","syncDerivedBlockAttributes","dispatch","prevBlocks","subscribe","children","createElement","uniqueId","label","value","onChange","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo, useEffect } from '@wordpress/element';\nimport { useEntityProp, useEntityRecord } from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tTextControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getBlockSupport, parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\n\nfunction isPartiallySynced( block ) {\n\treturn (\n\t\t!! getBlockSupport( block.name, '__experimentalConnections', false ) &&\n\t\t!! block.attributes.connections?.attributes &&\n\t\tObject.values( block.attributes.connections.attributes ).some(\n\t\t\t( connection ) => connection.source === 'pattern_attributes'\n\t\t)\n\t);\n}\nfunction getPartiallySyncedAttributes( block ) {\n\treturn Object.entries( block.attributes.connections.attributes )\n\t\t.filter(\n\t\t\t( [ , connection ] ) => connection.source === 'pattern_attributes'\n\t\t)\n\t\t.map( ( [ attributeKey ] ) => attributeKey );\n}\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction applyInitialOverrides( blocks, overrides = {}, defaultValues ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst innerBlocks = applyInitialOverrides(\n\t\t\tblock.innerBlocks,\n\t\t\toverrides,\n\t\t\tdefaultValues\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId )\n\t\t\treturn { ...block, innerBlocks };\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tconst newAttributes = { ...block.attributes };\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tdefaultValues[ blockId ] = block.attributes[ attributeKey ];\n\t\t\tif ( overrides[ blockId ] ) {\n\t\t\t\tnewAttributes[ attributeKey ] = overrides[ blockId ];\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...block,\n\t\t\tattributes: newAttributes,\n\t\t\tinnerBlocks,\n\t\t};\n\t} );\n}\n\nfunction getOverridesFromBlocks( blocks, defaultValues ) {\n\t/** @type {Record<string, unknown>} */\n\tconst overrides = {};\n\tfor ( const block of blocks ) {\n\t\tObject.assign(\n\t\t\toverrides,\n\t\t\tgetOverridesFromBlocks( block.innerBlocks, defaultValues )\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId ) continue;\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tif (\n\t\t\t\tblock.attributes[ attributeKey ] !== defaultValues[ blockId ]\n\t\t\t) {\n\t\t\t\toverrides[ blockId ] = block.attributes[ attributeKey ];\n\t\t\t}\n\t\t}\n\t}\n\treturn Object.keys( overrides ).length > 0 ? overrides : undefined;\n}\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, overrides },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n} ) {\n\tconst registry = useRegistry();\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\tconst initialOverrides = useRef( overrides );\n\tconst defaultValuesRef = useRef( {} );\n\tconst {\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetBlockEditingMode,\n\t} = useDispatch( blockEditorStore );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! record?.content?.raw ) return;\n\t\tconst initialBlocks = parse( record.content.raw );\n\n\t\tconst editingMode = getBlockEditingMode( patternClientId );\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( patternClientId, 'default' );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks(\n\t\t\t\tpatternClientId,\n\t\t\t\tapplyInitialOverrides(\n\t\t\t\t\tinitialBlocks,\n\t\t\t\t\tinitialOverrides.current,\n\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t)\n\t\t\t);\n\t\t\tsetBlockEditingMode( patternClientId, editingMode );\n\t\t} );\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tpatternClientId,\n\t\trecord,\n\t\treplaceInnerBlocks,\n\t\tregistry,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t] );\n\n\tconst innerBlocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks( patternClientId ),\n\t\t[ patternClientId ]\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_block',\n\t\t'title',\n\t\tref\n\t);\n\n\tconst { alignment, layout } = useInferredLayout(\n\t\tinnerBlocks,\n\t\tparentLayout\n\t);\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tlayout,\n\t\trenderAppender: innerBlocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\t// Sync the `overrides` attribute from the updated blocks.\n\t// `syncDerivedBlockAttributes` is an action that just like `updateBlockAttributes`\n\t// but won't create an undo level.\n\t// This can be abstracted into a `useSyncDerivedAttributes` hook if needed.\n\tuseEffect( () => {\n\t\tconst { getBlocks } = registry.select( blockEditorStore );\n\t\tconst { syncDerivedBlockAttributes } = unlock(\n\t\t\tregistry.dispatch( blockEditorStore )\n\t\t);\n\t\tlet prevBlocks = getBlocks( patternClientId );\n\t\treturn registry.subscribe( () => {\n\t\t\tconst blocks = getBlocks( patternClientId );\n\t\t\tif ( blocks !== prevBlocks ) {\n\t\t\t\tprevBlocks = blocks;\n\t\t\t\tsyncDerivedBlockAttributes( patternClientId, {\n\t\t\t\t\toverrides: getOverridesFromBlocks(\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t}, blockEditorStore );\n\t}, [ patternClientId, registry ] );\n\n\tlet children = null;\n\n\tif ( hasAlreadyRendered ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,MAAM,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AAC/D,SAASC,aAAa,EAAEC,eAAe,QAAQ,sBAAsB;AACrE,SACCC,WAAW,EACXC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,eAAe,EAAEC,KAAK,QAAQ,mBAAmB;;AAE1D;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAEL,sBAAuB,CAAC;AAE7D,SAASO,iBAAiBA,CAAEC,KAAK,EAAG;EACnC,OACC,CAAC,CAAEL,eAAe,CAAEK,KAAK,CAACC,IAAI,EAAE,2BAA2B,EAAE,KAAM,CAAC,IACpE,CAAC,CAAED,KAAK,CAACE,UAAU,CAACC,WAAW,EAAED,UAAU,IAC3CE,MAAM,CAACC,MAAM,CAAEL,KAAK,CAACE,UAAU,CAACC,WAAW,CAACD,UAAW,CAAC,CAACI,IAAI,CAC1DC,UAAU,IAAMA,UAAU,CAACC,MAAM,KAAK,oBACzC,CA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F,QAAQ,EAAGpC;EAAK,GAClCmC,aAAA,CAACxF,iBAAiB,QACjBwF,aAAA,CAAChG,SAAS,QACTgG,aAAA,CAACjG,WAAW;IACXmG,KAAK,EAAGjG,EAAE,CAAE,MAAO,CAAG;IACtBkG,KAAK,EAAGhB,KAAO;IACfiB,QAAQ,EAAGhB,QAAU;IACrBiB,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CACS,CACO,CAAC,EAClBP,QAAQ,KAAK,IAAI,GAClBC,aAAA;IAAA,GAAUR;EAAgB,CAAI,CAAC,GAE/BQ,aAAA;IAAA,GAAUV;EAAU,GAAKS,QAAe,CAEvB,CAAC;AAEtB"}
1
+ {"version":3,"names":["classnames","useRegistry","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityRecord","store","coreStore","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","parse","cloneBlock","unlock","useLayoutClasses","isPartiallySynced","block","name","attributes","metadata","bindings","Object","values","some","binding","source","getPartiallySyncedAttributes","entries","filter","map","attributeKey","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","includes","align","layout","applyInitialOverrides","overrides","defaultValues","innerBlocks","blockId","id","newAttributes","_defaultValues$blockI","getOverridesFromBlocks","assign","_overrides$blockId","keys","setBlockEditMode","setEditMode","mode","forEach","editMode","clientId","ReusableBlockEdit","ref","__unstableParentLayout","patternClientId","setAttributes","registry","hasAlreadyRendered","record","editedRecord","hasResolved","isMissing","initialOverrides","defaultValuesRef","replaceInnerBlocks","__unstableMarkNextChangeAsNotPersistent","setBlockEditingMode","syncDerivedUpdates","userCanEdit","getBlockEditingMode","getPostLinkProps","select","canUser","getBlocks","editingMode","getSettings","canEdit","editOriginalProps","postId","postType","canvas","_editedRecord$blocks$","initialBlocks","content","batch","layoutClasses","blockProps","className","innerBlocksProps","templateLock","renderAppender","ButtonBlockAppender","prevBlocks","subscribe","handleEditOriginal","event","onClick","children","createElement","uniqueId","href"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo, useEffect } from '@wordpress/element';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport { parse, cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\n\nfunction isPartiallySynced( block ) {\n\treturn (\n\t\t'core/paragraph' === block.name &&\n\t\t!! block.attributes.metadata?.bindings &&\n\t\tObject.values( block.attributes.metadata.bindings ).some(\n\t\t\t( binding ) => binding.source.name === 'pattern_attributes'\n\t\t)\n\t);\n}\nfunction getPartiallySyncedAttributes( block ) {\n\treturn Object.entries( block.attributes.metadata.bindings )\n\t\t.filter(\n\t\t\t( [ , binding ] ) => binding.source.name === 'pattern_attributes'\n\t\t)\n\t\t.map( ( [ attributeKey ] ) => attributeKey );\n}\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction applyInitialOverrides( blocks, overrides = {}, defaultValues ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst innerBlocks = applyInitialOverrides(\n\t\t\tblock.innerBlocks,\n\t\t\toverrides,\n\t\t\tdefaultValues\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId )\n\t\t\treturn { ...block, innerBlocks };\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tconst newAttributes = { ...block.attributes };\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tdefaultValues[ blockId ] ??= {};\n\t\t\tdefaultValues[ blockId ][ attributeKey ] =\n\t\t\t\tblock.attributes[ attributeKey ];\n\t\t\tif ( overrides[ blockId ] ) {\n\t\t\t\tnewAttributes[ attributeKey ] =\n\t\t\t\t\toverrides[ blockId ][ attributeKey ];\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...block,\n\t\t\tattributes: newAttributes,\n\t\t\tinnerBlocks,\n\t\t};\n\t} );\n}\n\nfunction getOverridesFromBlocks( blocks, defaultValues ) {\n\t/** @type {Record<string, Record<string, unknown>>} */\n\tconst overrides = {};\n\tfor ( const block of blocks ) {\n\t\tObject.assign(\n\t\t\toverrides,\n\t\t\tgetOverridesFromBlocks( block.innerBlocks, defaultValues )\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId ) continue;\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tif (\n\t\t\t\tblock.attributes[ attributeKey ] !==\n\t\t\t\tdefaultValues[ blockId ][ attributeKey ]\n\t\t\t) {\n\t\t\t\toverrides[ blockId ] ??= {};\n\t\t\t\toverrides[ blockId ][ attributeKey ] =\n\t\t\t\t\tblock.attributes[ attributeKey ];\n\t\t\t}\n\t\t}\n\t}\n\treturn Object.keys( overrides ).length > 0 ? overrides : undefined;\n}\n\nfunction setBlockEditMode( setEditMode, blocks, mode ) {\n\tblocks.forEach( ( block ) => {\n\t\tconst editMode =\n\t\t\tmode || ( isPartiallySynced( block ) ? 'contentOnly' : 'disabled' );\n\t\tsetEditMode( block.clientId, editMode );\n\t\tsetBlockEditMode( setEditMode, block.innerBlocks, mode );\n\t} );\n}\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, overrides },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n\tsetAttributes,\n} ) {\n\tconst registry = useRegistry();\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, editedRecord, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\tconst initialOverrides = useRef( overrides );\n\tconst defaultValuesRef = useRef( {} );\n\n\tconst {\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetBlockEditingMode,\n\t} = useDispatch( blockEditorStore );\n\tconst { syncDerivedUpdates } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst { innerBlocks, userCanEdit, getBlockEditingMode, getPostLinkProps } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { canUser } = select( coreStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetBlocks,\n\t\t\t\t\tgetBlockEditingMode: editingMode,\n\t\t\t\t\tgetSettings,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst blocks = getBlocks( patternClientId );\n\t\t\t\tconst canEdit = canUser( 'update', 'blocks', ref );\n\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\treturn {\n\t\t\t\t\tinnerBlocks: blocks,\n\t\t\t\t\tuserCanEdit: canEdit,\n\t\t\t\t\tgetBlockEditingMode: editingMode,\n\t\t\t\t\tgetPostLinkProps: getSettings().getPostLinkProps,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ patternClientId, ref ]\n\t\t);\n\n\tconst editOriginalProps = getPostLinkProps\n\t\t? getPostLinkProps( {\n\t\t\t\tpostId: ref,\n\t\t\t\tpostType: 'wp_block',\n\t\t\t\tcanvas: 'edit',\n\t\t } )\n\t\t: {};\n\n\tuseEffect(\n\t\t() => setBlockEditMode( setBlockEditingMode, innerBlocks ),\n\t\t[ innerBlocks, setBlockEditingMode ]\n\t);\n\n\t// Apply the initial overrides from the pattern block to the inner blocks.\n\tuseEffect( () => {\n\t\tconst initialBlocks =\n\t\t\t// Clone the blocks to generate new client IDs.\n\t\t\teditedRecord.blocks?.map( ( block ) => cloneBlock( block ) ) ??\n\t\t\t( editedRecord.content && typeof editedRecord.content !== 'function'\n\t\t\t\t? parse( editedRecord.content )\n\t\t\t\t: [] );\n\n\t\tdefaultValuesRef.current = {};\n\t\tconst editingMode = getBlockEditingMode( patternClientId );\n\t\t// Replace the contents of the blocks with the overrides.\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( patternClientId, 'default' );\n\t\t\tsyncDerivedUpdates( () => {\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tpatternClientId,\n\t\t\t\t\tapplyInitialOverrides(\n\t\t\t\t\t\tinitialBlocks,\n\t\t\t\t\t\tinitialOverrides.current,\n\t\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t\tsetBlockEditingMode( patternClientId, editingMode );\n\t\t} );\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tpatternClientId,\n\t\teditedRecord,\n\t\treplaceInnerBlocks,\n\t\tregistry,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t\tsyncDerivedUpdates,\n\t] );\n\n\tconst { alignment, layout } = useInferredLayout(\n\t\tinnerBlocks,\n\t\tparentLayout\n\t);\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: 'all',\n\t\tlayout,\n\t\trenderAppender: innerBlocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\t// Sync the `overrides` attribute from the updated blocks to the pattern block.\n\t// `syncDerivedUpdates` is used here to avoid creating an additional undo level.\n\tuseEffect( () => {\n\t\tconst { getBlocks } = registry.select( blockEditorStore );\n\t\tlet prevBlocks = getBlocks( patternClientId );\n\t\treturn registry.subscribe( () => {\n\t\t\tconst blocks = getBlocks( patternClientId );\n\t\t\tif ( blocks !== prevBlocks ) {\n\t\t\t\tprevBlocks = blocks;\n\t\t\t\tsyncDerivedUpdates( () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\toverrides: getOverridesFromBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\t\t}, blockEditorStore );\n\t}, [ syncDerivedUpdates, patternClientId, registry, setAttributes ] );\n\n\tconst handleEditOriginal = ( event ) => {\n\t\tsetBlockEditMode( setBlockEditingMode, innerBlocks, 'default' );\n\t\teditOriginalProps.onClick( event );\n\t};\n\n\tlet children = null;\n\n\tif ( hasAlreadyRendered ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t{ userCanEdit && editOriginalProps && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\thref={ editOriginalProps.href }\n\t\t\t\t\t\t\tonClick={ handleEditOriginal }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,MAAM,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AAC/D,SAASC,eAAe,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC1E,SACCC,WAAW,EACXC,OAAO,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A,CAACzG,OAAO,QACLR,EAAE,CAAE,2CAA4C,CAC1C,CACT;EACF;EAEA,IAAK,CAAE2E,WAAW,EAAG;IACpBqC,QAAQ,GACPC,aAAA,CAACrH,WAAW,QACXqH,aAAA,CAACpH,OAAO,MAAE,CACE,CACb;EACF;EAEA,OACCoH,aAAA,CAAC9G,iBAAiB;IAAC+G,QAAQ,EAAG/C;EAAK,GAChCgB,WAAW,IAAIS,iBAAiB,IACjCqB,aAAA,CAACrG,aAAa,QACbqG,aAAA,CAAClH,YAAY,QACZkH,aAAA,CAACnH,aAAa;IACbqH,IAAI,EAAGvB,iBAAiB,CAACuB,IAAM;IAC/BJ,OAAO,EAAGF;EAAoB,GAE5B7G,EAAE,CAAE,eAAgB,CACR,CACF,CACA,CACf,EACCgH,QAAQ,KAAK,IAAI,GAClBC,aAAA;IAAA,GAAUV;EAAgB,CAAI,CAAC,GAE/BU,aAAA;IAAA,GAAUZ;EAAU,GAAKW,QAAe,CAEvB,CAAC;AAEtB"}
@@ -8,7 +8,7 @@ const metadata = {
8
8
  title: "Comments Title",
9
9
  category: "theme",
10
10
  ancestor: ["core/comments"],
11
- description: "Displays a title with the number of comments",
11
+ description: "Displays a title with the number of comments.",
12
12
  textdomain: "default",
13
13
  usesContext: ["postId", "postType"],
14
14
  attributes: {
@@ -14,7 +14,7 @@ const metadata = {
14
14
  title: "Comments Title",
15
15
  category: "theme",
16
16
  ancestor: ["core/comments"],
17
- description: "Displays a title with the number of comments",
17
+ description: "Displays a title with the number of comments.",
18
18
  textdomain: "default",
19
19
  usesContext: ["postId", "postType"],
20
20
  attributes: {
@@ -150,7 +150,7 @@ export default function CoverInspectorControls({
150
150
  }, __('Describe the purpose of the image.')), createElement("br", null), __('Leave empty if decorative.'))
151
151
  }), createElement(PanelRow, null, createElement(Button, {
152
152
  variant: "secondary",
153
- isSmall: true,
153
+ size: "small",
154
154
  className: "block-library-cover__reset-button",
155
155
  onClick: onClearMedia
156
156
  }, __('Clear Media'))))), colorGradientSettings.hasColorsOrGradients && createElement(InspectorControls, {
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","Button","ExternalLink","FocalPointPicker","PanelBody","PanelRow","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","__","COVER_MIN_HEIGHT","mediaPosition","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","createElement","label","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","Fragment","title","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","variant","isSmall","className","onClick","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","hasValue","onDeselect","newDimRatio","max","step","required","__next40pxDefaultSize","newMinHeight","nextUnit","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\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) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,MAAM,EACNC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,4BAA4B,IAAIC,cAAc,EAC9CC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,EACxCC,8CAA8C,IAAIC,gCAAgC,QAC5E,uBAAuB;AAC9B,SAASC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,KAAK,EAAE;IAAO,CAAC,EAClC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,SAAS;MAAEvB,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEuB,KAAK,EAAE,UAAU;MAAEvB,KAAK,EAAE;IAAS,CAAC,CACpC;IACHA,KAAK,EAAG4C,OAAS;IACjB/C,QAAQ,EAAKG,KAAK,IACjB6B,aAAa,CAAE;MAAEe,OAAO,EAAE5C;IAAM,CAAE,CAClC;IACD4E,IAAI,EAAGf,mBAAmB,CAAEjB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
1
+ {"version":3,"names":["useMemo","Button","ExternalLink","FocalPointPicker","PanelBody","PanelRow","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","__","COVER_MIN_HEIGHT","mediaPosition","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","createElement","label","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","Fragment","title","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","variant","size","className","onClick","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","hasValue","onDeselect","newDimRatio","max","step","required","__next40pxDefaultSize","newMinHeight","nextUnit","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\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) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes(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Q,IACxB3E,aAAa,CAAE;MACda,aAAa,EAAE8D;IAChB,CAAE;EACF,CACD,CACc,CACE,CAAC,EACpBlF,aAAA,CAACpC,iBAAiB;IAACiG,KAAK,EAAC;EAAU,GAClC7D,aAAA,CAAC9C,aAAa;IACb8F,uBAAuB;IACvBgC,qBAAqB;IACrB/E,KAAK,EAAG9B,EAAE,CAAE,cAAe,CAAG;IAC9BgH,OAAO,EAAG,CACT;MAAElF,KAAK,EAAE9B,EAAE,CAAE,iBAAkB,CAAC;MAAEO,KAAK,EAAE;IAAM,CAAC,EAChD;MAAEuB,KAAK,EAAE,UAAU;MAAEvB,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEuB,KAAK,EAAE,QAAQ;MAAEvB,KAAK,EAAE;IAAO,CAAC,EAClC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,SAAS;MAAEvB,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEuB,KAAK,EAAE,UAAU;MAAEvB,KAAK,EAAE;IAAS,CAAC,CACpC;IACHA,KAAK,EAAG4C,OAAS;IACjB/C,QAAQ,EAAKG,KAAK,IACjB6B,aAAa,CAAE;MAAEe,OAAO,EAAE5C;IAAM,CAAE,CAClC;IACD4E,IAAI,EAAGf,mBAAmB,CAAEjB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
@@ -335,6 +335,7 @@ const Cover = ({
335
335
  }, createElement(BottomSheetConsumer, null, ({
336
336
  shouldEnableBottomSheetScroll
337
337
  }) => createElement(ColorPalette, {
338
+ enableCustomColor: true,
338
339
  customColorIndicatorStyles: styles.paletteColorIndicator,
339
340
  customIndicatorWrapperStyles: styles.paletteCustomIndicatorWrapper,
340
341
  setColor: setColor,
@@ -1 +1 @@
1
- {"version":3,"names":["View","TouchableWithoutFeedback","InteractionManager","AccessibilityInfo","Text","Platform","Video","classnames","requestImageFailedRetryDialog","requestImageUploadCancelDialog","requestImageFullscreenPreview","mediaUploadSync","__","Icon","Image","ImageEditingButton","IMAGE_DEFAULT_FOCAL_POINT","ToolbarButton","Gradient","ColorPalette","ColorPicker","BottomSheetConsumer","useConvertUnitToMobile","useMobileGlobalStylesColors","BlockControls","InnerBlocks","InspectorControls","MEDIA_TYPE_IMAGE","MediaPlaceholder","MediaUpload","MediaUploadProgress","getColorObjectByColorValue","getColorObjectByAttributeValues","getGradientValueBySlug","store","blockEditorStore","compose","withPreferredColorScheme","useDispatch","withSelect","withDispatch","useEffect","useState","useRef","useCallback","useMemo","cover","icon","replace","image","warning","getProtocol","editPostStore","styles","attributesFromMedia","ALLOWED_MEDIA_TYPES","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_DEFAULT_HEIGHT","Controls","useCoverIsDark","INNER_BLOCKS_TEMPLATE","align","placeholder","useIsScreenReaderEnabled","isScreenReaderEnabled","setIsScreenReaderEnabled","mounted","changeListener","addEventListener","enabled","then","screenReaderEnabled","remove","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isDark","convertedMinHeight","isImage","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","mediaAttributes","undefined","useFeaturedImage","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","hasParallax","setColor","_colorValue$slug","_ref","colorValue","slug","openColorPicker","__unstableMarkNextChangeAsNotPersistent","isCoverDark","childrenStyles","defaultColor","defaultColorLightMode","className","includes","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","overlay","opacity","overlaySelected","placeholderIconStyle","iconDark","placeholderIcon","createElement","toolbarControls","open","group","title","onClick","accessibilityHint","OS","addMediaButton","accessibilityLabel","accessibilityRole","onPress","current","selectImageContainer","selectImage","size","selectImageIcon","onBottomSheetClosed","runAfterInteractions","selectedColorText","selectedColorTextDark","bottomLabelText","toUpperCase","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","onNavigationBack","renderContent","getMediaOptions","Fragment","renderBackground","accessible","disabled","mediaId","onUpdateMediaProgress","onFinishMediaUploadWithSuccess","mediaServerId","mediaUrl","onFinishMediaUploadWithFailure","onMediaUploadStateReset","imageContainer","editButton","isUploadFailed","onSelectMediaUploadOption","openMediaOptions","width","muted","disableFocus","repeat","resizeMode","source","uri","onLoad","onLoadStart","height","mediaPlaceholderEmptyStateContainer","hideContent","labels","onSelect","allowedTypes","colorPaletteWrapper","pointerEvents","customColorIndicatorStyles","paletteColorIndicator","customIndicatorWrapperStyles","paletteCustomIndicatorWrapper","onCustomPress","defaultSettings","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","backgroundContainer","content","template","templateInsertUpdatesSelection","overlayContainer","isReplacingMedia","render","imageEditButton","pickerOptions","destructiveButton","label","separated","value","uploadFailedContainer","uploadFailed","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","selectedBlockClientId","innerBlocks","length","dispatch","closeGeneralSidebar"],"sources":["@wordpress/block-library/src/cover/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tText,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useDispatch, withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\n// eslint-disable-next-line no-restricted-imports\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\nimport useCoverIsDark from './use-cover-is-dark';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nfunction useIsScreenReaderEnabled() {\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tlet mounted = true;\n\n\t\tconst changeListener = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\t( enabled ) => setIsScreenReaderEnabled( enabled )\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tif ( mounted && screenReaderEnabled ) {\n\t\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tmounted = false;\n\n\t\t\tchangeListener.remove();\n\t\t};\n\t}, [] );\n\n\treturn isScreenReaderEnabled;\n}\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t\tisDark,\n\t} = attributes;\n\tconst isScreenReaderEnabled = useIsScreenReaderEnabled();\n\n\tuseEffect( () => {\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [ isCustomColorPickerShowing, setCustomColorPickerShowing ] =\n\t\tuseState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\n\t\tconst mediaAttributes = attributesFromMedia( media );\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\tfocalPoint: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tisDark: undefined,\n\t\t} );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst isCoverDark = useCoverIsDark(\n\t\tisDark,\n\t\turl,\n\t\tdimRatio,\n\t\toverlayColorValue?.color\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t// Used to set a default color for its InnerBlocks\n\t\t// since there's no system to inherit styles yet\n\t\t// the RichText component will check if there are\n\t\t// parent styles for the current block. If there are,\n\t\t// it will use that color instead.\n\t\tsetAttributes( {\n\t\t\tisDark: isCoverDark,\n\t\t\tchildrenStyles: isCoverDark\n\t\t\t\t? styles.defaultColor\n\t\t\t\t: styles.defaultColorLightMode,\n\t\t} );\n\n\t\t// Ensure that \"is-light\" is removed from \"className\" attribute if cover background is dark.\n\t\tif ( isCoverDark && attributes.className?.includes( 'is-light' ) ) {\n\t\t\tconst className = classnames( attributes.className, {\n\t\t\t\t'is-light': false,\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tclassName: className !== '' ? className : undefined,\n\t\t\t} );\n\t\t}\n\t}, [ isCoverDark ] );\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst selectedColorText = getStylesFromColorScheme(\n\t\tstyles.selectedColorText,\n\t\tstyles.selectedColorTextDark\n\t);\n\n\tconst bottomLabelText = customOverlayColor ? (\n\t\t<Text style={ selectedColorText }>\n\t\t\t{ customOverlayColor.toUpperCase() }\n\t\t</Text>\n\t) : (\n\t\t__( 'Select a color' )\n\t);\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ bottomLabelText }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\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</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,wBAAwB,EACxBC,kBAAkB,EAClBC,iBAAiB,EACjBC,IAAI,EACJC,QAAQ,QACF,cAAc;AACrB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,UAAU,MAAM,mBAAmB;;AAE1C;AACA;AACA;AACA,SACCC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,eAAe,QACT,gCAAgC;AACvC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,yBAAyB,EACzBC,aAAa,EACbC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACXC,mBAAmB,EACnBC,sBAAsB,EACtBC,2BAA2B,QACrB,uBAAuB;AAC9B,SACCC,aAAa,EACbC,WAAW,EACXC,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BAAwB,CACvB,CAAC,CAAEqC,KAAM,CAAC"}
1
+ {"version":3,"names":["View","TouchableWithoutFeedback","InteractionManager","AccessibilityInfo","Text","Platform","Video","classnames","requestImageFailedRetryDialog","requestImageUploadCancelDialog","requestImageFullscreenPreview","mediaUploadSync","__","Icon","Image","ImageEditingButton","IMAGE_DEFAULT_FOCAL_POINT","ToolbarButton","Gradient","ColorPalette","ColorPicker","BottomSheetConsumer","useConvertUnitToMobile","useMobileGlobalStylesColors","BlockControls","InnerBlocks","InspectorControls","MEDIA_TYPE_IMAGE","MediaPlaceholder","MediaUpload","MediaUploadProgress","getColorObjectByColorValue","getColorObjectByAttributeValues","getGradientValueBySlug","store","blockEditorStore","compose","withPreferredColorScheme","useDispatch","withSelect","withDispatch","useEffect","useState","useRef","useCallback","useMemo","cover","icon","replace","image","warning","getProtocol","editPostStore","styles","attributesFromMedia","ALLOWED_MEDIA_TYPES","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_DEFAULT_HEIGHT","Controls","useCoverIsDark","INNER_BLOCKS_TEMPLATE","align","placeholder","useIsScreenReaderEnabled","isScreenReaderEnabled","setIsScreenReaderEnabled","mounted","changeListener","addEventListener","enabled","then","screenReaderEnabled","remove","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isDark","convertedMinHeight","isImage","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","mediaAttributes","undefined","useFeaturedImage","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","hasParallax","setColor","_colorValue$slug","_ref","colorValue","slug","openColorPicker","__unstableMarkNextChangeAsNotPersistent","isCoverDark","childrenStyles","defaultColor","defaultColorLightMode","className","includes","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","overlay","opacity","overlaySelected","placeholderIconStyle","iconDark","placeholderIcon","createElement","toolbarControls","open","group","title","onClick","accessibilityHint","OS","addMediaButton","accessibilityLabel","accessibilityRole","onPress","current","selectImageContainer","selectImage","size","selectImageIcon","onBottomSheetClosed","runAfterInteractions","selectedColorText","selectedColorTextDark","bottomLabelText","toUpperCase","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","onNavigationBack","renderContent","getMediaOptions","Fragment","renderBackground","accessible","disabled","mediaId","onUpdateMediaProgress","onFinishMediaUploadWithSuccess","mediaServerId","mediaUrl","onFinishMediaUploadWithFailure","onMediaUploadStateReset","imageContainer","editButton","isUploadFailed","onSelectMediaUploadOption","openMediaOptions","width","muted","disableFocus","repeat","resizeMode","source","uri","onLoad","onLoadStart","height","mediaPlaceholderEmptyStateContainer","hideContent","labels","onSelect","allowedTypes","colorPaletteWrapper","pointerEvents","enableCustomColor","customColorIndicatorStyles","paletteColorIndicator","customIndicatorWrapperStyles","paletteCustomIndicatorWrapper","onCustomPress","defaultSettings","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","backgroundContainer","content","template","templateInsertUpdatesSelection","overlayContainer","isReplacingMedia","render","imageEditButton","pickerOptions","destructiveButton","label","separated","value","uploadFailedContainer","uploadFailed","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","selectedBlockClientId","innerBlocks","length","dispatch","closeGeneralSidebar"],"sources":["@wordpress/block-library/src/cover/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tText,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useDispatch, withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\n// eslint-disable-next-line no-restricted-imports\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\nimport useCoverIsDark from './use-cover-is-dark';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nfunction useIsScreenReaderEnabled() {\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tlet mounted = true;\n\n\t\tconst changeListener = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\t( enabled ) => setIsScreenReaderEnabled( enabled )\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tif ( mounted && screenReaderEnabled ) {\n\t\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tmounted = false;\n\n\t\t\tchangeListener.remove();\n\t\t};\n\t}, [] );\n\n\treturn isScreenReaderEnabled;\n}\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t\tisDark,\n\t} = attributes;\n\tconst isScreenReaderEnabled = useIsScreenReaderEnabled();\n\n\tuseEffect( () => {\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [ isCustomColorPickerShowing, setCustomColorPickerShowing ] =\n\t\tuseState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\n\t\tconst mediaAttributes = attributesFromMedia( media );\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\tfocalPoint: undefined,\n\t\t\tuseFeaturedImage: undefined,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tisDark: undefined,\n\t\t} );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst isCoverDark = useCoverIsDark(\n\t\tisDark,\n\t\turl,\n\t\tdimRatio,\n\t\toverlayColorValue?.color\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t// Used to set a default color for its InnerBlocks\n\t\t// since there's no system to inherit styles yet\n\t\t// the RichText component will check if there are\n\t\t// parent styles for the current block. If there are,\n\t\t// it will use that color instead.\n\t\tsetAttributes( {\n\t\t\tisDark: isCoverDark,\n\t\t\tchildrenStyles: isCoverDark\n\t\t\t\t? styles.defaultColor\n\t\t\t\t: styles.defaultColorLightMode,\n\t\t} );\n\n\t\t// Ensure that \"is-light\" is removed from \"className\" attribute if cover background is dark.\n\t\tif ( isCoverDark && attributes.className?.includes( 'is-light' ) ) {\n\t\t\tconst className = classnames( attributes.className, {\n\t\t\t\t'is-light': false,\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tclassName: className !== '' ? className : undefined,\n\t\t\t} );\n\t\t}\n\t}, [ isCoverDark ] );\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst selectedColorText = getStylesFromColorScheme(\n\t\tstyles.selectedColorText,\n\t\tstyles.selectedColorTextDark\n\t);\n\n\tconst bottomLabelText = customOverlayColor ? (\n\t\t<Text style={ selectedColorText }>\n\t\t\t{ customOverlayColor.toUpperCase() }\n\t\t</Text>\n\t) : (\n\t\t__( 'Select a color' )\n\t);\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ bottomLabelText }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tenableCustomColor={ true }\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\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</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,wBAAwB,EACxBC,kBAAkB,EAClBC,iBAAiB,EACjBC,IAAI,EACJC,QAAQ,QACF,cAAc;AACrB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,UAAU,MAAM,mBAAmB;;AAE1C;AACA;AACA;AACA,SACCC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,eAAe,QACT,gCAAgC;AACvC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,yBAAyB,EACzBC,aAAa,EACb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,QAAQ,CAAE3M,aAAc,CAAC,CAAC4M,mBAAmB,CAAC,CAAC;IAChD,CAAC;IACD7K,WAAW,EAAEA,CAAA,KAAMA,WAAW,CAAEsK,QAAS;EAC1C,CAAC;AACF,CAAE,CAAC,EACHpN,wBAAwB,CACvB,CAAC,CAAEqC,KAAM,CAAC"}
@@ -8,7 +8,7 @@ import memoize from 'memize';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
11
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
11
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
12
12
  import { renderToString } from '@wordpress/element';
13
13
  import { createBlock, getBlockType, getBlockVariations } from '@wordpress/blocks';
14
14
 
@@ -71,9 +71,6 @@ import { unlock } from '../lock-unlock';
71
71
  const {
72
72
  name: DEFAULT_EMBED_BLOCK
73
73
  } = metadata;
74
- const {
75
- kebabCase
76
- } = unlock(blockEditorPrivateApis);
77
74
 
78
75
  /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
79
76
 
@@ -305,6 +302,9 @@ export const getAttributesFromPreview = memoize((preview, title, currentClassNam
305
302
  html,
306
303
  provider_name: providerName
307
304
  } = preview;
305
+ const {
306
+ kebabCase
307
+ } = unlock(componentsPrivateApis);
308
308
  const providerNameSlug = kebabCase((providerName || title).toLowerCase());
309
309
  if (isFromWordPress(html)) {
310
310
  type = WP_EMBED_TYPE;
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","memoize","privateApis","blockEditorPrivateApis","renderToString","createBlock","getBlockType","getBlockVariations","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","__experimentalRole","caption","source","selector","providerNameSlug","allowResponsive","responsive","previewable","supports","align","spacing","margin","editorStyle","style","ASPECT_RATIOS","WP_EMBED_TYPE","unlock","DEFAULT_EMBED_BLOCK","kebabCase","getEmbedInfoByProvider","provider","find","matchesPatterns","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","createElement","src","alt","width","createUpgradedEmbedBlock","props","attributesFromPreview","preview","restAttributes","matchedBlock","isCurrentBlockWP","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","href","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"sources":["@wordpress/block-library/src/embed/util.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\nimport { unlock } from '../lock-unlock';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\nconst { kebabCase } = unlock( blockEditorPrivateApis );\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromPreview(\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tclassName,\n\t\t\tisResponsive,\n\t\t\tallowResponsive\n\t\t),\n\t};\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,QAAQ;;AAE5B;AACA;AACA;AACA,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SACCC,WAAW,EACXC,YAAY,EACZC,kBAAkB,QACZ,mBAAmB;;AAE1B;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,GAAA;MAAAC,IAAA;MAAAC,kBAAA;IAAA;IAAAC,OAAA;MAAAF,IAAA;MAAAG,MAAA;MAAAC,QAAA;MAAAH,kBAA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,iBAAiB,EACjB1C,OAAO,EACPlD,KAAK,EACLuF,YAAY,KACR;EACJ,MAAM;IAAE3E,eAAe;IAAE8C;EAAU,CAAC,GAAGkC,iBAAiB;EAExD,OAAO;IACN,GAAGA,iBAAiB;IACpB,GAAGP,wBAAwB,CAC1BnC,OAAO,EACPlD,KAAK,EACL0D,SAAS,EACT6B,YAAY,EACZ3E,eACD;EACD,CAAC;AACF,CAAC"}
1
+ {"version":3,"names":["classnames","memoize","privateApis","componentsPrivateApis","renderToString","createBlock","getBlockType","getBlockVariations","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","__experimentalRole","caption","source","selector","providerNameSlug","allowResponsive","responsive","previewable","supports","align","spacing","margin","editorStyle","style","ASPECT_RATIOS","WP_EMBED_TYPE","unlock","DEFAULT_EMBED_BLOCK","getEmbedInfoByProvider","provider","find","matchesPatterns","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","createElement","src","alt","width","createUpgradedEmbedBlock","props","attributesFromPreview","preview","restAttributes","matchedBlock","isCurrentBlockWP","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","href","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","kebabCase","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"sources":["@wordpress/block-library/src/embed/util.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\nimport { unlock } from '../lock-unlock';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst { kebabCase } = unlock( componentsPrivateApis );\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromP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