@wordpress/block-library 8.28.5 → 8.30.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 (289) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/audio/edit.js +7 -17
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/audio/edit.native.js.map +1 -1
  5. package/build/avatar/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/edit.js +1 -6
  9. package/build/buttons/edit.js.map +1 -1
  10. package/build/buttons/edit.native.js +1 -7
  11. package/build/buttons/edit.native.js.map +1 -1
  12. package/build/columns/edit.js +8 -2
  13. package/build/columns/edit.js.map +1 -1
  14. package/build/comment-author-avatar/edit.js +1 -1
  15. package/build/comment-author-avatar/edit.js.map +1 -1
  16. package/build/cover/edit/index.js.map +1 -1
  17. package/build/cover/edit/inspector-controls.js.map +1 -1
  18. package/build/cover/edit/resizable-cover-popover.js +0 -6
  19. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  20. package/build/cover/edit.native.js.map +1 -1
  21. package/build/details/index.js +1 -0
  22. package/build/details/index.js.map +1 -1
  23. package/build/file/deprecated.js.map +1 -1
  24. package/build/file/edit.js +6 -13
  25. package/build/file/edit.js.map +1 -1
  26. package/build/file/edit.native.js.map +1 -1
  27. package/build/file/save.js.map +1 -1
  28. package/build/form-input/edit.js +1 -1
  29. package/build/form-input/edit.js.map +1 -1
  30. package/build/gallery/edit.js +5 -5
  31. package/build/gallery/edit.js.map +1 -1
  32. package/build/gallery/gallery.native.js.map +1 -1
  33. package/build/gallery/v1/edit.js.map +1 -1
  34. package/build/gallery/v1/gallery.native.js.map +1 -1
  35. package/build/group/variations.js +12 -15
  36. package/build/group/variations.js.map +1 -1
  37. package/build/image/edit.js.map +1 -1
  38. package/build/image/edit.native.js.map +1 -1
  39. package/build/image/image.js.map +1 -1
  40. package/build/latest-posts/edit.native.js.map +1 -1
  41. package/build/list/edit.js +5 -0
  42. package/build/list/edit.js.map +1 -1
  43. package/build/list/ordered-list-settings.js +1 -1
  44. package/build/list/ordered-list-settings.js.map +1 -1
  45. package/build/list-item/edit.native.js.map +1 -1
  46. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  47. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  48. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  49. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  50. package/build/list-item/hooks/use-space.js +16 -7
  51. package/build/list-item/hooks/use-space.js.map +1 -1
  52. package/build/media-text/media-container.native.js +1 -1
  53. package/build/media-text/media-container.native.js.map +1 -1
  54. package/build/navigation/edit/index.js.map +1 -1
  55. package/build/navigation-link/link-ui.js.map +1 -1
  56. package/build/paragraph/edit.native.js.map +1 -1
  57. package/build/pattern/edit.js +23 -9
  58. package/build/pattern/edit.js.map +1 -1
  59. package/build/post-excerpt/edit.js.map +1 -1
  60. package/build/post-featured-image/dimension-controls.js.map +1 -1
  61. package/build/post-featured-image/edit.js.map +1 -1
  62. package/build/post-navigation-link/edit.js.map +1 -1
  63. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  64. package/build/query/utils.js +7 -5
  65. package/build/query/utils.js.map +1 -1
  66. package/build/query-pagination-next/edit.js.map +1 -1
  67. package/build/query-pagination-previous/edit.js.map +1 -1
  68. package/build/quote/deprecated.js +111 -12
  69. package/build/quote/deprecated.js.map +1 -1
  70. package/build/quote/edit.js +5 -5
  71. package/build/quote/edit.js.map +1 -1
  72. package/build/quote/index.js +1 -1
  73. package/build/quote/index.js.map +1 -1
  74. package/build/quote/save.js +2 -2
  75. package/build/quote/save.js.map +1 -1
  76. package/build/read-more/edit.js.map +1 -1
  77. package/build/search/edit.js +1 -1
  78. package/build/search/edit.js.map +1 -1
  79. package/build/search/edit.native.js.map +1 -1
  80. package/build/site-logo/edit.js.map +1 -1
  81. package/build/site-title/{edit/index.js → edit.js} +1 -1
  82. package/build/site-title/edit.js.map +1 -0
  83. package/build/social-link/edit.js.map +1 -1
  84. package/build/social-links/edit.native.js.map +1 -1
  85. package/build/spacer/edit.js.map +1 -1
  86. package/build/table-of-contents/edit.js.map +1 -1
  87. package/build/template-part/edit/index.js +53 -1
  88. package/build/template-part/edit/index.js.map +1 -1
  89. package/build/template-part/edit/selection-modal.js +2 -8
  90. package/build/template-part/edit/selection-modal.js.map +1 -1
  91. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  92. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  93. package/build/utils/hooks.js +55 -4
  94. package/build/utils/hooks.js.map +1 -1
  95. package/build/video/edit-common-settings.js.map +1 -1
  96. package/build/video/edit.js +7 -16
  97. package/build/video/edit.js.map +1 -1
  98. package/build/video/edit.native.js +2 -7
  99. package/build/video/edit.native.js.map +1 -1
  100. package/build-module/audio/edit.js +10 -20
  101. package/build-module/audio/edit.js.map +1 -1
  102. package/build-module/audio/edit.native.js.map +1 -1
  103. package/build-module/avatar/edit.js.map +1 -1
  104. package/build-module/button/edit.js +1 -1
  105. package/build-module/button/edit.js.map +1 -1
  106. package/build-module/buttons/edit.js +2 -7
  107. package/build-module/buttons/edit.js.map +1 -1
  108. package/build-module/buttons/edit.native.js +1 -7
  109. package/build-module/buttons/edit.native.js.map +1 -1
  110. package/build-module/columns/edit.js +8 -2
  111. package/build-module/columns/edit.js.map +1 -1
  112. package/build-module/comment-author-avatar/edit.js +1 -1
  113. package/build-module/comment-author-avatar/edit.js.map +1 -1
  114. package/build-module/cover/edit/index.js.map +1 -1
  115. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  116. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  117. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  118. package/build-module/cover/edit.native.js.map +1 -1
  119. package/build-module/details/index.js +1 -0
  120. package/build-module/details/index.js.map +1 -1
  121. package/build-module/file/deprecated.js.map +1 -1
  122. package/build-module/file/edit.js +7 -14
  123. package/build-module/file/edit.js.map +1 -1
  124. package/build-module/file/edit.native.js.map +1 -1
  125. package/build-module/file/save.js.map +1 -1
  126. package/build-module/form-input/edit.js +1 -1
  127. package/build-module/form-input/edit.js.map +1 -1
  128. package/build-module/gallery/edit.js +5 -5
  129. package/build-module/gallery/edit.js.map +1 -1
  130. package/build-module/gallery/gallery.native.js.map +1 -1
  131. package/build-module/gallery/v1/edit.js.map +1 -1
  132. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  133. package/build-module/group/variations.js +12 -15
  134. package/build-module/group/variations.js.map +1 -1
  135. package/build-module/image/edit.js.map +1 -1
  136. package/build-module/image/edit.native.js.map +1 -1
  137. package/build-module/image/image.js.map +1 -1
  138. package/build-module/latest-posts/edit.native.js.map +1 -1
  139. package/build-module/list/edit.js +5 -0
  140. package/build-module/list/edit.js.map +1 -1
  141. package/build-module/list/ordered-list-settings.js +1 -1
  142. package/build-module/list/ordered-list-settings.js.map +1 -1
  143. package/build-module/list-item/edit.native.js.map +1 -1
  144. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  145. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  146. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  147. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  148. package/build-module/list-item/hooks/use-space.js +17 -8
  149. package/build-module/list-item/hooks/use-space.js.map +1 -1
  150. package/build-module/media-text/media-container.native.js +1 -1
  151. package/build-module/media-text/media-container.native.js.map +1 -1
  152. package/build-module/navigation/edit/index.js.map +1 -1
  153. package/build-module/navigation-link/link-ui.js.map +1 -1
  154. package/build-module/paragraph/edit.native.js.map +1 -1
  155. package/build-module/pattern/edit.js +24 -10
  156. package/build-module/pattern/edit.js.map +1 -1
  157. package/build-module/post-excerpt/edit.js.map +1 -1
  158. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  159. package/build-module/post-featured-image/edit.js.map +1 -1
  160. package/build-module/post-navigation-link/edit.js.map +1 -1
  161. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  162. package/build-module/query/utils.js +7 -5
  163. package/build-module/query/utils.js.map +1 -1
  164. package/build-module/query-pagination-next/edit.js.map +1 -1
  165. package/build-module/query-pagination-previous/edit.js.map +1 -1
  166. package/build-module/quote/deprecated.js +112 -13
  167. package/build-module/quote/deprecated.js.map +1 -1
  168. package/build-module/quote/edit.js +5 -5
  169. package/build-module/quote/edit.js.map +1 -1
  170. package/build-module/quote/index.js +1 -1
  171. package/build-module/quote/index.js.map +1 -1
  172. package/build-module/quote/save.js +2 -2
  173. package/build-module/quote/save.js.map +1 -1
  174. package/build-module/read-more/edit.js.map +1 -1
  175. package/build-module/search/edit.js +1 -1
  176. package/build-module/search/edit.js.map +1 -1
  177. package/build-module/search/edit.native.js.map +1 -1
  178. package/build-module/site-logo/edit.js.map +1 -1
  179. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  180. package/build-module/site-title/edit.js.map +1 -0
  181. package/build-module/social-link/edit.js.map +1 -1
  182. package/build-module/social-links/edit.native.js.map +1 -1
  183. package/build-module/spacer/edit.js.map +1 -1
  184. package/build-module/table-of-contents/edit.js.map +1 -1
  185. package/build-module/template-part/edit/index.js +57 -5
  186. package/build-module/template-part/edit/index.js.map +1 -1
  187. package/build-module/template-part/edit/selection-modal.js +2 -8
  188. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  189. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  190. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  191. package/build-module/utils/hooks.js +54 -3
  192. package/build-module/utils/hooks.js.map +1 -1
  193. package/build-module/video/edit-common-settings.js.map +1 -1
  194. package/build-module/video/edit.js +10 -19
  195. package/build-module/video/edit.js.map +1 -1
  196. package/build-module/video/edit.native.js +2 -7
  197. package/build-module/video/edit.native.js.map +1 -1
  198. package/build-style/editor-rtl.css +4 -1
  199. package/build-style/editor.css +4 -1
  200. package/build-style/group/editor-rtl.css +1 -1
  201. package/build-style/group/editor.css +1 -1
  202. package/build-style/image/editor-rtl.css +3 -0
  203. package/build-style/image/editor.css +3 -0
  204. package/package.json +34 -34
  205. package/src/audio/edit.js +9 -19
  206. package/src/audio/edit.native.js +3 -3
  207. package/src/avatar/edit.js +1 -1
  208. package/src/avatar/index.php +12 -1
  209. package/src/block/index.php +2 -0
  210. package/src/button/edit.js +2 -2
  211. package/src/buttons/edit.js +3 -16
  212. package/src/buttons/edit.native.js +2 -18
  213. package/src/calendar/index.php +5 -0
  214. package/src/columns/edit.js +9 -2
  215. package/src/comment-author-avatar/edit.js +1 -1
  216. package/src/comments/index.php +2 -0
  217. package/src/cover/edit/index.js +2 -2
  218. package/src/cover/edit/inspector-controls.js +1 -1
  219. package/src/cover/edit/resizable-cover-popover.js +1 -6
  220. package/src/cover/edit.native.js +1 -1
  221. package/src/details/block.json +1 -0
  222. package/src/file/deprecated.js +3 -3
  223. package/src/file/edit.js +8 -15
  224. package/src/file/edit.native.js +4 -4
  225. package/src/file/save.js +1 -1
  226. package/src/form-input/edit.js +1 -1
  227. package/src/gallery/edit.js +6 -12
  228. package/src/gallery/gallery.native.js +1 -1
  229. package/src/gallery/test/index.native.js +1 -1
  230. package/src/gallery/v1/edit.js +2 -2
  231. package/src/gallery/v1/gallery.native.js +1 -1
  232. package/src/group/editor.scss +1 -1
  233. package/src/group/variations.js +3 -6
  234. package/src/image/edit.js +1 -1
  235. package/src/image/edit.native.js +1 -1
  236. package/src/image/editor.scss +6 -0
  237. package/src/image/image.js +2 -2
  238. package/src/latest-posts/edit.native.js +1 -1
  239. package/src/list/edit.js +5 -0
  240. package/src/list/ordered-list-settings.js +1 -1
  241. package/src/list-item/edit.native.js +1 -1
  242. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  243. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  244. package/src/list-item/hooks/use-space.js +16 -9
  245. package/src/media-text/media-container.native.js +5 -3
  246. package/src/media-text/test/edit.native.js +58 -0
  247. package/src/missing/test/edit-integration.native.js +2 -1
  248. package/src/navigation/edit/index.js +1 -1
  249. package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
  250. package/src/navigation/index.php +18 -13
  251. package/src/navigation-link/link-ui.js +2 -2
  252. package/src/paragraph/edit.native.js +1 -1
  253. package/src/paragraph/test/edit.native.js +36 -0
  254. package/src/pattern/edit.js +27 -10
  255. package/src/post-author-biography/index.php +4 -3
  256. package/src/post-author-name/index.php +4 -3
  257. package/src/post-excerpt/edit.js +1 -1
  258. package/src/post-featured-image/dimension-controls.js +4 -4
  259. package/src/post-featured-image/edit.js +1 -1
  260. package/src/post-navigation-link/edit.js +1 -1
  261. package/src/post-template/index.php +2 -0
  262. package/src/query/edit/pattern-selection-modal.js +1 -1
  263. package/src/query/utils.js +6 -4
  264. package/src/query-pagination-next/edit.js +1 -1
  265. package/src/query-pagination-previous/edit.js +1 -1
  266. package/src/quote/block.json +1 -1
  267. package/src/quote/deprecated.js +110 -15
  268. package/src/quote/edit.js +5 -5
  269. package/src/quote/save.js +2 -2
  270. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  271. package/src/read-more/edit.js +1 -1
  272. package/src/search/edit.js +1 -1
  273. package/src/search/edit.native.js +4 -4
  274. package/src/site-logo/edit.js +1 -1
  275. package/src/social-link/edit.js +1 -1
  276. package/src/social-links/edit.native.js +1 -1
  277. package/src/spacer/edit.js +1 -1
  278. package/src/table-of-contents/edit.js +1 -1
  279. package/src/template-part/edit/index.js +91 -4
  280. package/src/template-part/edit/selection-modal.js +4 -8
  281. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  282. package/src/utils/hooks.js +53 -3
  283. package/src/video/edit-common-settings.js +1 -1
  284. package/src/video/edit.js +10 -18
  285. package/src/video/edit.native.js +5 -8
  286. package/src/video/test/edit.native.js +0 -14
  287. package/build/site-title/edit/index.js.map +0 -1
  288. package/build-module/site-title/edit/index.js.map +0 -1
  289. /package/src/site-title/{edit/index.js → edit.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_coreData","_element","_blockEditor","_components","_i18n","_data","_hooks","ELLIPSIS","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","useCanEditEntity","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","useEntityProp","postTypeSupportsExcerpts","useSelect","select","coreStore","getPostType","supports","excerpt","isEditable","blockProps","useBlockProps","className","classnames","wordCountType","_x","strippedRenderedExcerpt","useMemo","document","window","DOMParser","parseFromString","body","textContent","innerText","_react","createElement","Fragment","BlockControls","AlignmentToolbar","value","onChange","newAlign","__","Warning","readMoreLink","RichText","tagName","placeholder","newMoreText","withoutInteractiveFormatting","excerptClassName","rawOrRenderedExcerpt","trim","trimmedExcerpt","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","isTrimmed","excerptContent","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","newShowMoreOnNewLine","RangeControl","min","max"],"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nconst ELLIPSIS = '…';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\n\t/**\n\t * Check if the post type supports excerpts.\n\t * Add an exception and return early for the \"page\" post type,\n\t * which is registered without support for the excerpt UI,\n\t * but supports saving the excerpt to the database.\n\t * See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65\n\t * Without this exception, users that have excerpts saved to the database will\n\t * not be able to edit the excerpts.\n\t */\n\tconst postTypeSupportsExcerpts = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !! select( coreStore ).getPostType( postType )?.supports\n\t\t\t\t?.excerpt;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t/**\n\t * The excerpt is editable if:\n\t * - The user can edit the post\n\t * - It is not a descendent of a Query Loop block\n\t * - The post type supports excerpts\n\t */\n\tconst isEditable =\n\t\tuserCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>{ __( 'This block will display the excerpt.' ) }</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'The content is currently protected and does not have the available excerpt.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = (\n\t\trawExcerpt || strippedRenderedExcerpt\n\t).trim();\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( ! isTrimmed\n\t\t\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t\t\t: trimmedExcerpt + ELLIPSIS ) ||\n\t\t\t\t\t __( 'No excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ ! isTrimmed\n\t\t\t\t? rawOrRenderedExcerpt || __( 'No excerpt found' )\n\t\t\t\t: trimmedExcerpt + ELLIPSIS }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;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;IAAS,CAAE;EACvC,CACD,CACa,CAAC,EAChB,IAAAP,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAAiF,iBAAiB,QACjB,IAAA5B,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAiF,SAAS;IAACC,KAAK,EAAG,IAAAtB,QAAE,EAAE,UAAW;EAAG,GACpC,IAAAR,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAmF,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAzB,QAAE,EAAE,uBAAwB,CAAG;IACvC0B,OAAO,EAAG7E,iBAAmB;IAC7BiD,QAAQ,EAAK6B,oBAAoB,IAChC5E,aAAa,CAAE;MACdF,iBAAiB,EAAE8E;IACpB,CAAE;EACF,CACD,CAAC,EACF,IAAAnC,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAwF,YAAY;IACZH,KAAK,EAAG,IAAAzB,QAAE,EAAE,qBAAsB,CAAG;IACrCH,KAAK,EAAG/C,aAAe;IACvBgD,QAAQ,EAAKD,KAAK,IAAM;MACvB9C,aAAa,CAAE;QAAED,aAAa,EAAE+C;MAAM,CAAE,CAAC;IAC1C,CAAG;IACHgC,GAAG,EAAC,IAAI;IACRC,GAAG,EAAC;EAAK,CACT,CACS,CACO,CAAC,EACpB,IAAAtC,MAAA,CAAAC,aAAA;IAAA,GAAUhB;EAAU,GACjB0C,cAAc,EACd,CAAEtE,iBAAiB,IAAI,GAAG,EAC1BA,iBAAiB,GAClB,IAAA2C,MAAA,CAAAC,aAAA;IAAGd,SAAS,EAAC;EAAkC,GAC5CuB,YACA,CAAC,GAEJA,YAEG,CACJ,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_coreData","_element","_blockEditor","_components","_i18n","_data","_hooks","ELLIPSIS","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","useCanEditEntity","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","useEntityProp","postTypeSupportsExcerpts","useSelect","select","coreStore","getPostType","supports","excerpt","isEditable","blockProps","useBlockProps","className","classnames","wordCountType","_x","strippedRenderedExcerpt","useMemo","document","window","DOMParser","parseFromString","body","textContent","innerText","_react","createElement","Fragment","BlockControls","AlignmentToolbar","value","onChange","newAlign","__","Warning","readMoreLink","RichText","tagName","placeholder","newMoreText","withoutInteractiveFormatting","excerptClassName","rawOrRenderedExcerpt","trim","trimmedExcerpt","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","isTrimmed","excerptContent","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","newShowMoreOnNewLine","RangeControl","min","max"],"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nconst ELLIPSIS = '…';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\n\t/**\n\t * Check if the post type supports excerpts.\n\t * Add an exception and return early for the \"page\" post type,\n\t * which is registered without support for the excerpt UI,\n\t * but supports saving the excerpt to the database.\n\t * See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65\n\t * Without this exception, users that have excerpts saved to the database will\n\t * not be able to edit the excerpts.\n\t */\n\tconst postTypeSupportsExcerpts = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !! select( coreStore ).getPostType( postType )?.supports\n\t\t\t\t?.excerpt;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t/**\n\t * The excerpt is editable if:\n\t * - The user can edit the post\n\t * - It is not a descendent of a Query Loop block\n\t * - The post type supports excerpts\n\t */\n\tconst isEditable =\n\t\tuserCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>{ __( 'This block will display the excerpt.' ) }</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'The content is currently protected and does not have the available excerpt.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = (\n\t\trawExcerpt || strippedRenderedExcerpt\n\t).trim();\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( ! isTrimmed\n\t\t\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t\t\t: trimmedExcerpt + ELLIPSIS ) ||\n\t\t\t\t\t __( 'No excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ ! isTrimmed\n\t\t\t\t? rawOrRenderedExcerpt || __( 'No excerpt found' )\n\t\t\t\t: trimmedExcerpt + ELLIPSIS }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA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,EAACrD,WAAA,CAAAmF,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAzB,QAAE,EAAE,uBAAwB,CAAG;IACvC0B,OAAO,EAAG7E,iBAAmB;IAC7BiD,QAAQ,EAAK6B,oBAAoB,IAChC5E,aAAa,CAAE;MACdF,iBAAiB,EAAE8E;IACpB,CAAE;EACF,CACD,CAAC,EACF,IAAAnC,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAwF,YAAY;IACZH,KAAK,EAAG,IAAAzB,QAAE,EAAE,qBAAsB,CAAG;IACrCH,KAAK,EAAG/C,aAAe;IACvBgD,QAAQ,EAAKD,KAAK,IAAM;MACvB9C,aAAa,CAAE;QAAED,aAAa,EAAE+C;MAAM,CAAE,CAAC;IAC1C,CAAG;IACHgC,GAAG,EAAC,IAAI;IACRC,GAAG,EAAC;EAAK,CACT,CACS,CACO,CAAC,EACpB,IAAAtC,MAAA,CAAAC,aAAA;IAAA,GAAUhB;EAAU,GACjB0C,cAAc,EACd,CAAEtE,iBAAiB,IAAI,GAAG,EAC1BA,iBAAiB,GAClB,IAAA2C,MAAA,CAAAC,aAAA;IAAGd,SAAS,EAAC;EAAkC,GAC5CuB,YACA,CAAC,GAEJA,YAEG,CACJ,CAAC;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_blockEditor","SCALE_OPTIONS","_react","createElement","Fragment","__experimentalToggleGroupControlOption","value","label","_x","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","__","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","availableUnits","useSettings","units","useCustomUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","showScaleControl","InspectorControls","group","__experimentalToolsPanelItem","hasValue","onDeselect","undefined","resetAllFilter","isShownByDefault","panelId","SelectControl","__nextHasNoMarginBottom","options","onChange","nextAspectRatio","className","__experimentalUnitControl","labelPosition","min","nextHeight","nextWidth","__experimentalToggleGroupControl","help","isBlock","length","nextSizeSlug","_default","exports","default"],"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSettings } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', '%', 'vw', 'em', 'rem' ],\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\n\tconst showScaleControl =\n\t\theight || ( aspectRatio && aspectRatio !== 'auto' );\n\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ showScaleControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\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\tscale: DEFAULT_SCALE,\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<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,YAAA,GAAAF,OAAA;AAZA;AACA;AACA;;AAYA,MAAMG,aAAa,GAClB,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAM,sCAAwB;EACxBC,KAAK,EAAC,OAAO;EACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,0CAA2C;AAAG,CACnE,CAAC,EACF,IAAAN,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAM,sCAAwB;EACxBC,KAAK,EAAC,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F;IACDsD,OAAO;EAAA,GAEL3D,aACiB,CACL,CAChB,EACC,CAAC,CAAEwB,gBAAgB,CAACoC,MAAM,IAC3B,IAAA3D,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAyC,4BAAc;IACdC,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAElB,QAAU;IAC9BhB,KAAK,EAAG,IAAAM,QAAE,EAAE,YAAa,CAAG;IAC5B6B,UAAU,EAAGA,CAAA,KACZlB,aAAa,CAAE;MAAED,QAAQ,EAAEoB;IAAU,CAAE,CACvC;IACDC,cAAc,EAAGA,CAAA,MAAQ;MACxBrB,QAAQ,EAAEoB;IACX,CAAC,CAAI;IACLE,gBAAgB,EAAG,KAAO;IAC1BC,OAAO,EAAG7B;EAAU,GAEpB,IAAAf,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAgD,aAAa;IACbC,uBAAuB;IACvBzC,KAAK,EAAG,IAAAM,QAAE,EAAE,YAAa,CAAG;IAC5BP,KAAK,EAAGiB,QAAQ,IAAIb,YAAc;IAClCuC,OAAO,EAAGxB,gBAAkB;IAC5ByB,QAAQ,EAAKY,YAAY,IACxBtC,aAAa,CAAE;MAAED,QAAQ,EAAEuC;IAAa,CAAE,CAC1C;IACDH,IAAI,EAAG,IAAA9C,QAAE,EAAE,sCAAuC;EAAG,CACrD,CACc,CAEC,CAAC;AAEtB,CAAC;AAAC,IAAAkD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajD,iBAAiB"}
1
+ {"version":3,"names":["_i18n","require","_components","_blockEditor","SCALE_OPTIONS","_react","createElement","Fragment","__experimentalToggleGroupControlOption","value","label","_x","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","__","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","availableUnits","useSettings","units","useCustomUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","showScaleControl","InspectorControls","group","__experimentalToolsPanelItem","hasValue","onDeselect","undefined","resetAllFilter","isShownByDefault","panelId","SelectControl","__nextHasNoMarginBottom","options","onChange","nextAspectRatio","className","__experimentalUnitControl","labelPosition","min","nextHeight","nextWidth","__experimentalToggleGroupControl","help","isBlock","length","nextSizeSlug","_default","exports","default"],"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSettings } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', '%', 'vw', 'em', 'rem' ],\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\n\tconst showScaleControl =\n\t\theight || ( aspectRatio && aspectRatio !== 'auto' );\n\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ showScaleControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\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\tscale: DEFAULT_SCALE,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,YAAA,GAAAF,OAAA;AAZA;AACA;AACA;;AAYA,MAAMG,aAAa,GAClB,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAM,sCAAwB;EACxBC,KAAK,EAAC,OAAO;EACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,0C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,IACjBkB,aAAa,CAAE;MACdF,KAAK,EAAEhB;IACR,CAAE,CACF;IACDsD,OAAO;EAAA,GAEL3D,aACiB,CACL,CAChB,EACC,CAAC,CAAEwB,gBAAgB,CAACoC,MAAM,IAC3B,IAAA3D,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAyC,4BAAc;IACdC,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAElB,QAAU;IAC9BhB,KAAK,EAAG,IAAAM,QAAE,EAAE,YAAa,CAAG;IAC5B6B,UAAU,EAAGA,CAAA,KACZlB,aAAa,CAAE;MAAED,QAAQ,EAAEoB;IAAU,CAAE,CACvC;IACDC,cAAc,EAAGA,CAAA,MAAQ;MACxBrB,QAAQ,EAAEoB;IACX,CAAC,CAAI;IACLE,gBAAgB,EAAG,KAAO;IAC1BC,OAAO,EAAG7B;EAAU,GAEpB,IAAAf,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAgD,aAAa;IACbC,uBAAuB;IACvBzC,KAAK,EAAG,IAAAM,QAAE,EAAE,YAAa,CAAG;IAC5BP,KAAK,EAAGiB,QAAQ,IAAIb,YAAc;IAClCuC,OAAO,EAAGxB,gBAAkB;IAC5ByB,QAAQ,EAAKY,YAAY,IACxBtC,aAAa,CAAE;MAAED,QAAQ,EAAEuC;IAAa,CAAE,CAC1C;IACDH,IAAI,EAAG,IAAA9C,QAAE,EAAE,sCAAuC;EAAG,CACrD,CACc,CAEC,CAAC;AAEtB,CAAC;AAAC,IAAAkD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajD,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_coreData","_data","_components","_blockEditor","_element","_i18n","_icons","_notices","_dimensionControls","_overlay","ALLOWED_MEDIA_TYPES","getMediaSourceUrlBySizeSlug","media","slug","media_details","sizes","source_url","disabledClickProps","onClick","event","preventDefault","PostFeaturedImageEdit","clientId","attributes","setAttributes","context","postId","postType","postTypeSlug","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","aspectRatio","height","width","scale","sizeSlug","rel","linkTarget","useFirstImageFromPost","storedFeaturedImage","setFeaturedImage","useEntityProp","postContent","featuredImage","useMemo","imageOpener","exec","imageId","groups","attrs","JSON","parse","id","postPermalink","useSelect","select","getMedia","getPostType","getEditedEntityRecord","coreStore","link","mediaUrl","imageSizes","blockEditorStore","getSettings","imageSizeOptions","filter","map","name","value","label","blockProps","useBlockProps","style","borderProps","useBorderProps","blockEditingMode","useBlockEditingMode","placeholder","content","_react","createElement","Placeholder","className","classnames","withIllustration","onSelectImage","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","controls","Fragment","default","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","labels","singular_name","sprintf","onChange","checked","TextControl","newRel","image","href","target","imageStyles","objectFit","MediaPlaceholder","onSelect","accept","allowedTypes","onError","mediaLibraryButton","open","Button","icon","upload","variant","showTooltip","tooltipPosition","src","alt","alt_text","BlockControls","group","MediaReplaceFlow","mediaId","mediaURL","MenuItem"],"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tMenuItem,\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n\tTextControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport Overlay from './overlay';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nfunction getMediaSourceUrlBySizeSlug( media, slug ) {\n\treturn (\n\t\tmedia?.media_details?.sizes?.[ slug ]?.source_url || media?.source_url\n\t);\n}\n\nconst disabledClickProps = {\n\tonClick: ( event ) => event.preventDefault(),\n\t'aria-disabled': true,\n};\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetMedia( featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t};\n\t\t},\n\t\t[ featuredImage, postTypeSlug, postId ]\n\t);\n\n\tconst mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug );\n\n\tconst imageSizes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().imageSizes,\n\t\t[]\n\t);\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => {\n\t\t\treturn media?.media_details?.sizes?.[ slug ]?.source_url;\n\t\t} )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height, aspectRatio },\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration={ true }\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: !! aspectRatio && '100%',\n\t\t\t\t\twidth: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<Overlay\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<DimensionControls\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Page\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a consious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\thref={ postPermalink }\n\t\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\t\t{ ...disabledClickProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\theight: aspectRatio ? '100%' : height,\n\t\twidth: !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholder()\n\t\t) : (\n\t\t\t<img\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tsrc={ mediaUrl }\n\t\t\t\talt={\n\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t}\n\t\t\t\tstyle={ imageStyles }\n\t\t\t/>\n\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItem onClick={ () => setFeaturedImage( 0 ) }>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ postPermalink }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\t{ ...disabledClickProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ image }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\timage\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,YAAA,GAAAJ,OAAA;AAUA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,kBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,QAAA,GAAAX,sBAAA,CAAAC,OAAA;AArCA;AACA;AACA;;AAGA;AACA;AACA;;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AC1BgC,OAAO,EAAG5B;EAAe,GAEzB,IAAAV,MAAA,CAAAC,aAAA,EAAClF,WAAA,CAAAwI,QAAQ;IAACxH,OAAO,EAAGA,CAAA,KAAMyB,gBAAgB,CAAE,CAAE;EAAG,GAC9C,IAAA2D,QAAE,EAAE,OAAQ,CACL,CACO,CACJ,CACf,EACD,IAAAnB,MAAA,CAAAC,aAAA;IAAA,GAAaV;EAAU,GAEpB,CAAC,CAAEzC,MAAM,GACV,IAAAkD,MAAA,CAAAC,aAAA;IACC6B,IAAI,EAAGzD,aAAe;IACtB0D,MAAM,EAAG1E,UAAY;IAAA,GAChBvB;EAAkB,GAErB+F,KACA,CAAC,GAEJA,KAEM,CACP,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_coreData","_data","_components","_blockEditor","_element","_i18n","_icons","_notices","_dimensionControls","_overlay","ALLOWED_MEDIA_TYPES","getMediaSourceUrlBySizeSlug","media","slug","media_details","sizes","source_url","disabledClickProps","onClick","event","preventDefault","PostFeaturedImageEdit","clientId","attributes","setAttributes","context","postId","postType","postTypeSlug","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","aspectRatio","height","width","scale","sizeSlug","rel","linkTarget","useFirstImageFromPost","storedFeaturedImage","setFeaturedImage","useEntityProp","postContent","featuredImage","useMemo","imageOpener","exec","imageId","groups","attrs","JSON","parse","id","postPermalink","useSelect","select","getMedia","getPostType","getEditedEntityRecord","coreStore","link","mediaUrl","imageSizes","blockEditorStore","getSettings","imageSizeOptions","filter","map","name","value","label","blockProps","useBlockProps","style","borderProps","useBorderProps","blockEditingMode","useBlockEditingMode","placeholder","content","_react","createElement","Placeholder","className","classnames","withIllustration","onSelectImage","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","controls","Fragment","default","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","labels","singular_name","sprintf","onChange","checked","TextControl","newRel","image","href","target","imageStyles","objectFit","MediaPlaceholder","onSelect","accept","allowedTypes","onError","mediaLibraryButton","open","Button","icon","upload","variant","showTooltip","tooltipPosition","src","alt","alt_text","BlockControls","group","MediaReplaceFlow","mediaId","mediaURL","MenuItem"],"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tMenuItem,\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n\tTextControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport Overlay from './overlay';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nfunction getMediaSourceUrlBySizeSlug( media, slug ) {\n\treturn (\n\t\tmedia?.media_details?.sizes?.[ slug ]?.source_url || media?.source_url\n\t);\n}\n\nconst disabledClickProps = {\n\tonClick: ( event ) => event.preventDefault(),\n\t'aria-disabled': true,\n};\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetMedia( featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t};\n\t\t},\n\t\t[ featuredImage, postTypeSlug, postId ]\n\t);\n\n\tconst mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug );\n\n\tconst imageSizes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().imageSizes,\n\t\t[]\n\t);\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => {\n\t\t\treturn media?.media_details?.sizes?.[ slug ]?.source_url;\n\t\t} )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height, aspectRatio },\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: !! aspectRatio && '100%',\n\t\t\t\t\twidth: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<Overlay\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<DimensionControls\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Page\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a consious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\thref={ postPermalink }\n\t\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\t\t{ ...disabledClickProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\theight: aspectRatio ? '100%' : height,\n\t\twidth: !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholder()\n\t\t) : (\n\t\t\t<img\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tsrc={ mediaUrl }\n\t\t\t\talt={\n\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t}\n\t\t\t\tstyle={ imageStyles }\n\t\t\t/>\n\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItem onClick={ () => setFeaturedImage( 0 ) }>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\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U;MAChBmE,GAAG,EACFvH,KAAK,CAACwH,QAAQ,GACX,IAAAzB,aAAO;MACP;MACA,IAAAL,QAAE,EAAE,oBAAqB,CAAC,EAC1B1F,KAAK,CAACwH,QACN,CAAC,GACD,IAAA9B,QAAE,EAAE,gBAAiB,CACxB;MACD1B,KAAK,EAAGuC;IAAa,CACrB,CACD;EACF;;EAEA;AACD;AACA;AACA;AACA;AACA;EACC,OACC,IAAAhC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAc,QAAA,QACGD,QAAQ,EACR,CAAC,CAAEpF,KAAK,IAAI,CAAEkB,uBAAuB,IACtC,IAAAqD,MAAA,CAAAC,aAAA,EAACjF,YAAA,CAAAkI,aAAa;IAACC,KAAK,EAAC;EAAO,GAC3B,IAAAnD,MAAA,CAAAC,aAAA,EAACjF,YAAA,CAAAoI,gBAAgB;IAChBC,OAAO,EAAG1F,aAAe;IACzB2F,QAAQ,EAAGzE,QAAU;IACrBwD,YAAY,EAAG9G,mBAAqB;IACpC6G,MAAM,EAAC,SAAS;IAChBD,QAAQ,EAAG7B,aAAe;IAC1BgC,OAAO,EAAG5B;EAAe,GAEzB,IAAAV,MAAA,CAAAC,aAAA,EAAClF,WAAA,CAAAwI,QAAQ;IAACxH,OAAO,EAAGA,CAAA,KAAMyB,gBAAgB,CAAE,CAAE;EAAG,GAC9C,IAAA2D,QAAE,EAAE,OAAQ,CACL,CACO,CACJ,CACf,EACD,IAAAnB,MAAA,CAAAC,aAAA;IAAA,GAAaV;EAAU,GAEpB,CAAC,CAAEzC,MAAM,GACV,IAAAkD,MAAA,CAAAC,aAAA;IACC6B,IAAI,EAAGzD,aAAe;IACtB0D,MAAM,EAAG1E,UAAY;IAAA,GAChBvB;EAAkB,GAErB+F,KACA,CAAC,GAEJA,KAEM,CACP,CAAC;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_blockEditor","_i18n","_data","_coreData","PostNavigationLinkEdit","context","postType","attributes","type","label","showTitle","textAlign","linkLabel","arrow","taxonomy","setAttributes","isNext","placeholder","__","arrowMap","none","chevron","displayArrow","ariaLabel","blockProps","useBlockProps","className","classnames","taxonomies","useSelect","select","getTaxonomies","coreStore","filteredTaxonomies","per_page","getTaxonomyOptions","selectOption","value","taxonomyOptions","filter","visibility","publicly_queryable","map","item","slug","name","_react","createElement","Fragment","InspectorControls","PanelBody","ToggleControl","__nextHasNoMarginBottom","help","checked","onChange","__experimentalToggleGroupControl","isBlock","__experimentalToggleGroupControlOption","_x","group","SelectControl","options","BlockControls","AlignmentToolbar","nextAlign","RichText","tagName","allowedFormats","newLabel","href","onClick","event","preventDefault"],"sources":["@wordpress/block-library/src/post-navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\tSelectControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tBlockControls,\n\tAlignmentToolbar,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: {\n\t\ttype,\n\t\tlabel,\n\t\tshowTitle,\n\t\ttextAlign,\n\t\tlinkLabel,\n\t\tarrow,\n\t\ttaxonomy,\n\t},\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '→' : '←',\n\t\tchevron: isNext ? '»' : '«',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\t/* translators: Label before for next and previous post. There is a space after the colon. */\n\t\tplaceholder = isNext ? __( 'Next: ' ) : __( 'Previous: ' );\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ !! showTitle }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowTitle: ! showTitle,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\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) }\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tvalue={ arrow }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { arrow: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'A decorative arrow for the next and previous link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'None',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"arrow\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Arrow',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"chevron\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Chevron',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Filter by taxonomy' ) }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttaxonomy: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tallowedFormats={ [ 'core/bold', 'core/italic' ] }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ showTitle && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-navigation-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'An example title' ) }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,YAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAmBe,SAASM,sBAAsBA,CAAE;EAC/CC,OAAO,EAAE;IAAEC;EAAS,CAAC;EACrBC,UAAU,EAAE;IACXC,IAAI;IACJC,KAAK;IACLC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,KAAK;IACLC;EACD,CAAC;EACDC;AACD,CAAC,EAAG;EACH,MAAMC,MAAM,GAAGR,IAAI,KAAK,MAAM;EAC9B,IAAIS,WAAW,GAAGD,MAAM,GAAG,IAAAE,QAAE,EAAE,MAAO,CAAC,GAAG,IAAAA,QAAE,EAAE,UAAW,CAAC;EAE1D,MAAMC,QAAQ,GAAG;IAChBC,IAAI,EAAE,EAAE;IACRP,KAAK,EAAEG,MAAM,GAAG,GAAG,GAAG,GAAG;IACzBK,OAAO,EAAEL,MAAM,GAAG,GAAG,GAAG;EACzB,CAAC;EAED,MAAMM,YAAY,GAAGH,QAAQ,CAAEN,KAAK,CAAE;EAEtC,IAAKH,SAAS,EAAG;IAChB;IACAO,WAAW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ACD,IAAAwB,MAAA,CAAAC,aAAA,EAAC/C,YAAA,CAAAkE,QAAQ;IACRC,OAAO,EAAC,GAAG;IACX,cAAa5C,SAAW;IACxBN,WAAW,EAAGA,WAAa;IAC3BoB,KAAK,EAAG5B,KAAO;IACf2D,cAAc,EAAG,CAAE,WAAW,EAAE,aAAa,CAAI;IACjDb,QAAQ,EAAKc,QAAQ,IACpBtD,aAAa,CAAE;MAAEN,KAAK,EAAE4D;IAAS,CAAE;EACnC,CACD,CAAC,EACA3D,SAAS,IACV,IAAAoC,MAAA,CAAAC,aAAA;IACCuB,IAAI,EAAC,8BAA8B;IACnCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC;EAAG,GAE7C,IAAAvD,QAAE,EAAE,kBAAmB,CACvB,CACH,EACCF,MAAM,IAAIM,YAAY,IACvB,IAAAwB,MAAA,CAAAC,aAAA;IACCrB,SAAS,EAAI,sDAAsDb,KAAO,EAAG;IAC7E,eAAc;EAAM,GAElBS,YACG,CAEH,CACJ,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_blockEditor","_i18n","_data","_coreData","PostNavigationLinkEdit","context","postType","attributes","type","label","showTitle","textAlign","linkLabel","arrow","taxonomy","setAttributes","isNext","placeholder","__","arrowMap","none","chevron","displayArrow","ariaLabel","blockProps","useBlockProps","className","classnames","taxonomies","useSelect","select","getTaxonomies","coreStore","filteredTaxonomies","per_page","getTaxonomyOptions","selectOption","value","taxonomyOptions","filter","visibility","publicly_queryable","map","item","slug","name","_react","createElement","Fragment","InspectorControls","PanelBody","ToggleControl","__nextHasNoMarginBottom","help","checked","onChange","__experimentalToggleGroupControl","isBlock","__experimentalToggleGroupControlOption","_x","group","SelectControl","options","BlockControls","AlignmentToolbar","nextAlign","RichText","tagName","allowedFormats","newLabel","href","onClick","event","preventDefault"],"sources":["@wordpress/block-library/src/post-navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\tSelectControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tBlockControls,\n\tAlignmentToolbar,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: {\n\t\ttype,\n\t\tlabel,\n\t\tshowTitle,\n\t\ttextAlign,\n\t\tlinkLabel,\n\t\tarrow,\n\t\ttaxonomy,\n\t},\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '→' : '←',\n\t\tchevron: isNext ? '»' : '«',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\t/* translators: Label before for next and previous post. There is a space after the colon. */\n\t\tplaceholder = isNext ? __( 'Next: ' ) : __( 'Previous: ' );\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ !! showTitle }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowTitle: ! showTitle,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\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) }\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tvalue={ arrow }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { arrow: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'A decorative arrow for the next and previous link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'None',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"arrow\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Arrow',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"chevron\"\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Chevron',\n\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Filter by taxonomy' ) }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttaxonomy: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tallowedFormats={ [ 'core/bold', 'core/italic' ] }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ showTitle && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-navigation-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'An example title' ) }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,YAAA,GAAAF,OA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H,EACCF,MAAM,IAAIM,YAAY,IACvB,IAAAwB,MAAA,CAAAC,aAAA;IACCrB,SAAS,EAAI,sDAAsDb,KAAO,EAAG;IAC7E;EAAW,GAETS,YACG,CAEH,CACJ,CAAC;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_components","_compose","_blockEditor","_i18n","_utils","_searchPatterns","PatternSelectionModal","clientId","attributes","setIsPatternSelectionModalOpen","searchValue","setSearchValue","useState","replaceBlock","selectBlock","useDispatch","blockEditorStore","onBlockPatternSelect","pattern","blocks","newBlocks","queryClientIds","getTransformedBlocksFromPattern","blockPreviewContext","useMemo","previewPostType","query","postType","blockNameForPatterns","useBlockNameForPatterns","blockPatterns","usePatterns","filteredBlockPatterns","searchPatterns","shownBlockPatterns","useAsyncList","_react","createElement","Modal","overlayClassName","title","__","onRequestClose","isFullScreen","className","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","BlockContextProvider","__experimentalBlockPatternsList","shownPatterns","onClickPattern"],"sources":["@wordpress/block-library/src/query/edit/pattern-selection-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Modal, SearchControl } from '@wordpress/components';\nimport { useAsyncList } from '@wordpress/compose';\nimport {\n\tBlockContextProvider,\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockNameForPatterns,\n\tgetTransformedBlocksFromPattern,\n\tusePatterns,\n} from '../utils';\nimport { searchPatterns } from '../../utils/search-patterns';\n\nexport default function PatternSelectionModal( {\n\tclientId,\n\tattributes,\n\tsetIsPatternSelectionModalOpen,\n} ) {\n\tconst [ searchValue, setSearchValue ] = useState( '' );\n\tconst { replaceBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst onBlockPatternSelect = ( pattern, blocks ) => {\n\t\tconst { newBlocks, queryClientIds } = getTransformedBlocksFromPattern(\n\t\t\tblocks,\n\t\t\tattributes\n\t\t);\n\t\treplaceBlock( clientId, newBlocks );\n\t\tif ( queryClientIds[ 0 ] ) {\n\t\t\tselectBlock( queryClientIds[ 0 ] );\n\t\t}\n\t};\n\t// When we preview Query Loop blocks we should prefer the current\n\t// block's postType, which is passed through block context.\n\tconst blockPreviewContext = useMemo(\n\t\t() => ( {\n\t\t\tpreviewPostType: attributes.query.postType,\n\t\t} ),\n\t\t[ attributes.query.postType ]\n\t);\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\tconst blockPatterns = usePatterns( clientId, blockNameForPatterns );\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\treturn searchPatterns( blockPatterns, searchValue );\n\t}, [ blockPatterns, searchValue ] );\n\tconst shownBlockPatterns = useAsyncList( filteredBlockPatterns );\n\n\treturn (\n\t\t<Modal\n\t\t\toverlayClassName=\"block-library-query-pattern__selection-modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tonRequestClose={ () => setIsPatternSelectionModalOpen( false ) }\n\t\t\tisFullScreen={ true }\n\t\t>\n\t\t\t<div className=\"block-library-query-pattern__selection-content\">\n\t\t\t\t<div className=\"block-library-query-pattern__selection-search\">\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tonChange={ setSearchValue }\n\t\t\t\t\t\tvalue={ searchValue }\n\t\t\t\t\t\tlabel={ __( 'Search for patterns' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<BlockContextProvider value={ blockPreviewContext }>\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onBlockPatternSelect }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or","_i18n","_utils","_searchPatterns","PatternSelectionModal","clientId","attributes","setIsPatternSelectionModalOpen","searchValue","setSearchValue","useState","replaceBlock","selectBlock","useDispatch","blockEditorStore","onBlockPatternSelect","pattern","blocks","newBlocks","queryClientIds","getTransformedBlocksFromPattern","blockPreviewContext","useMemo","previewPostType","query","postType","blockNameForPatterns","useBlockNameForPatterns","blockPatterns","usePatterns","filteredBlockPatterns","searchPatterns","shownBlockPatterns","useAsyncList","_react","createElement","Modal","overlayClassName","title","__","onRequestClose","isFullScreen","className","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","BlockContextProvider","__experimentalBlockPatternsList","shownPatterns","onClickPattern"],"sources":["@wordpress/block-library/src/query/edit/pattern-selection-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Modal, SearchControl } from '@wordpress/components';\nimport { useAsyncList } from '@wordpress/compose';\nimport {\n\tBlockContextProvider,\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockNameForPatterns,\n\tgetTransformedBlocksFromPattern,\n\tusePatterns,\n} from '../utils';\nimport { searchPatterns } from '../../utils/search-patterns';\n\nexport default function PatternSelectionModal( {\n\tclientId,\n\tattributes,\n\tsetIsPatternSelectionModalOpen,\n} ) {\n\tconst [ searchValue, setSearchValue ] = useState( '' );\n\tconst { replaceBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst onBlockPatternSelect = ( pattern, blocks ) => {\n\t\tconst { newBlocks, queryClientIds } = getTransformedBlocksFromPattern(\n\t\t\tblocks,\n\t\t\tattributes\n\t\t);\n\t\treplaceBlock( clientId, newBlocks );\n\t\tif ( queryClientIds[ 0 ] ) {\n\t\t\tselectBlock( queryClientIds[ 0 ] );\n\t\t}\n\t};\n\t// When we preview Query Loop blocks we should prefer the current\n\t// block's postType, which is passed through block context.\n\tconst blockPreviewContext = useMemo(\n\t\t() => ( {\n\t\t\tpreviewPostType: attributes.query.postType,\n\t\t} ),\n\t\t[ attributes.query.postType ]\n\t);\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\tconst blockPatterns = usePatterns( clientId, blockNameForPatterns );\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\treturn searchPatterns( blockPatterns, searchValue );\n\t}, [ blockPatterns, searchValue ] );\n\tconst shownBlockPatterns = useAsyncList( filteredBlockPatterns );\n\n\treturn (\n\t\t<Modal\n\t\t\toverlayClassName=\"block-library-query-pattern__selection-modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tonRequestClose={ () => setIsPatternSelectionModalOpen( false ) }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"block-library-query-pattern__selection-content\">\n\t\t\t\t<div className=\"block-library-query-pattern__selection-search\">\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tonChange={ setSearchValue }\n\t\t\t\t\t\tvalue={ searchValue }\n\t\t\t\t\t\tlabel={ __( 'Search for patterns' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<BlockContextProvider value={ blockPreviewContext }>\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onBlockPatternSelect }\n\t\t\t\t\t/>\n\t\t\t\t</BlockContextProvider>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GA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,WAAW,CAAG,CAAC;EACnC,MAAMwB,kBAAkB,GAAG,IAAAC,qBAAY,EAAEH,qBAAsB,CAAC;EAEhE,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAAsC,KAAK;IACLC,gBAAgB,EAAC,8CAA8C;IAC/DC,KAAK,EAAG,IAAAC,QAAE,EAAE,kBAAmB,CAAG;IAClCC,cAAc,EAAGA,CAAA,KAAMjC,8BAA8B,CAAE,KAAM,CAAG;IAChEkC,YAAY;EAAA,GAEZ,IAAAP,MAAA,CAAAC,aAAA;IAAKO,SAAS,EAAC;EAAgD,GAC9D,IAAAR,MAAA,CAAAC,aAAA;IAAKO,SAAS,EAAC;EAA+C,GAC7D,IAAAR,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAA6C,aAAa;IACbC,uBAAuB;IACvBC,QAAQ,EAAGpC,cAAgB;IAC3BqC,KAAK,EAAGtC,WAAa;IACrBuC,KAAK,EAAG,IAAAR,QAAE,EAAE,qBAAsB,CAAG;IACrCS,WAAW,EAAG,IAAAT,QAAE,EAAE,QAAS;EAAG,CAC9B,CACG,CAAC,EACN,IAAAL,MAAA,CAAAC,aAAA,EAACnC,YAAA,CAAAiD,oBAAoB;IAACH,KAAK,EAAGzB;EAAqB,GAClD,IAAAa,MAAA,CAAAC,aAAA,EAACnC,YAAA,CAAAkD,+BAAiB;IACjBtB,aAAa,EAAGE,qBAAuB;IACvCqB,aAAa,EAAGnB,kBAAoB;IACpCoB,cAAc,EAAGrC;EAAsB,CACvC,CACoB,CAClB,CACC,CAAC;AAEV"}
@@ -161,14 +161,16 @@ const useTaxonomies = postType => {
161
161
  const {
162
162
  getTaxonomies
163
163
  } = select(_coreData.store);
164
- const filteredTaxonomies = getTaxonomies({
164
+ return getTaxonomies({
165
165
  type: postType,
166
- per_page: -1,
167
- context: 'view'
166
+ per_page: -1
168
167
  });
169
- return filteredTaxonomies;
170
168
  }, [postType]);
171
- return taxonomies;
169
+ return (0, _element.useMemo)(() => {
170
+ return taxonomies?.filter(({
171
+ visibility
172
+ }) => !!visibility?.publicly_queryable);
173
+ }, [taxonomies]);
172
174
  };
173
175
 
174
176
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_coreData","_blockEditor","_htmlEntities","_blocks","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","exports","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","decodeEntities","usePostTypes","postTypes","useSelect","select","getPostTypes","coreStore","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","useMemo","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","useTaxonomies","postType","getTaxonomies","filteredTaxonomies","context","useIsPostTypeHierarchical","getPostType","hierarchical","useAllowedControls","attributes","blocksStore","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","clonedBlocks","block","cloneBlock","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","blockName","hasActiveVariationPatterns","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","namespace","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","startsWith","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { cloneBlock, store as blocksStore } from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) return;\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\treturn { postTypesTaxonomiesMap, postTypesSelectOptions };\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn taxonomies;\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\tconst activeVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.name,\n\t\t[ attributes ]\n\t);\n\tconst blockName = `core/query/${ activeVariationName }`;\n\tconst hasActiveVariationPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\tblockName,\n\t\t\t\trootClientId\n\t\t\t);\n\t\t\treturn activePatterns.length > 0;\n\t\t},\n\t\t[ clientId, activeVariationName, blockName ]\n\t);\n\treturn hasActiveVariationPatterns ? blockName : 'core/query';\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\tif ( ! blockName.startsWith( 'core/' ) ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA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IAAI,EAAE8D,QAAQ,CACjB,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA5D,OAAA,CAAAiF,WAAA,GAAAA,WAAA;AASO,MAAMC,oBAAoB,GAAKtB,QAAQ,IAAM;EACnD,OAAO,IAAA9C,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MAAEoE,yBAAyB;MAAEC;IAAa,CAAC,GAChDrE,MAAM,CAAEuD,kBAAiB,CAAC;IAC3B,MAAMpB,MAAM,GAAG,CAAC,CAAC;IACjBiC,yBAAyB,CAAEvB,QAAS,CAAC,CAACrD,OAAO,CAC1C8E,kBAAkB,IAAM;MACzB,MAAMnB,SAAS,GAAGkB,YAAY,CAAEC,kBAAmB,CAAC;MACpD,IAAK,CAAEnB,SAAS,CAACoB,UAAU,CAAE,OAAQ,CAAC,EAAG;QACxCpC,MAAM,CAACqC,oBAAoB,GAAG,IAAI;MACnC,CAAC,MAAM,IAAKrB,SAAS,KAAK,mBAAmB,EAAG;QAC/ChB,MAAM,CAACsC,mBAAmB,GAAG,IAAI;MAClC;IACD,CACD,CAAC;IACDtC,MAAM,CAACuC,oBAAoB,GAC1BvC,MAAM,CAACqC,oBAAoB,IAAIrC,MAAM,CAACsC,mBAAmB;IAC1D,OAAOtC,MAAM;EACd,CAAC,EACD,CAAEU,QAAQ,CACX,CAAC;AACF,CAAC;AAAC5D,OAAA,CAAAkF,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_data","require","_element","_coreData","_blockEditor","_htmlEntities","_blocks","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","exports","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","decodeEntities","usePostTypes","postTypes","useSelect","select","getPostTypes","coreStore","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","useMemo","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","useTaxonomies","postType","getTaxonomies","visibility","publicly_queryable","useIsPostTypeHierarchical","getPostType","hierarchical","useAllowedControls","attributes","blocksStore","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","clonedBlocks","block","cloneBlock","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","blockName","hasActiveVariationPatterns","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","namespace","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","startsWith","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { cloneBlock, store as blocksStore } from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) return;\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\treturn { postTypesTaxonomiesMap, postTypesSelectOptions };\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\treturn getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\tconst activeVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.name,\n\t\t[ attributes ]\n\t);\n\tconst blockName = `core/query/${ activeVariationName }`;\n\tconst hasActiveVariationPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\tblockName,\n\t\t\t\trootClientId\n\t\t\t);\n\t\t\treturn activePatterns.length > 0;\n\t\t},\n\t\t[ clientId, activeVariationName, blockName ]\n\t);\n\treturn hasActiveVariationPatterns ? blockName : 'core/query';\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\tif ( ! blockName.startsWith( 'core/' ) ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,eAAe,GAAKC,QAAQ,IAAM;EAC9C,MAAMC,OAAO,GAAGD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M,IAAM;IACb,MAAM;MAAEoE,yBAAyB;MAAEC;IAAa,CAAC,GAChDrE,MAAM,CAAEuD,kBAAiB,CAAC;IAC3B,MAAMpB,MAAM,GAAG,CAAC,CAAC;IACjBiC,yBAAyB,CAAEvB,QAAS,CAAC,CAACrD,OAAO,CAC1C8E,kBAAkB,IAAM;MACzB,MAAMnB,SAAS,GAAGkB,YAAY,CAAEC,kBAAmB,CAAC;MACpD,IAAK,CAAEnB,SAAS,CAACoB,UAAU,CAAE,OAAQ,CAAC,EAAG;QACxCpC,MAAM,CAACqC,oBAAoB,GAAG,IAAI;MACnC,CAAC,MAAM,IAAKrB,SAAS,KAAK,mBAAmB,EAAG;QAC/ChB,MAAM,CAACsC,mBAAmB,GAAG,IAAI;MAClC;IACD,CACD,CAAC;IACDtC,MAAM,CAACuC,oBAAoB,GAC1BvC,MAAM,CAACqC,oBAAoB,IAAIrC,MAAM,CAACsC,mBAAmB;IAC1D,OAAOtC,MAAM;EACd,CAAC,EACD,CAAEU,QAAQ,CACX,CAAC;AACF,CAAC;AAAC5D,OAAA,CAAAkF,oBAAA,GAAAA,oBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","arrowMap","none","arrow","chevron","QueryPaginationNextEdit","attributes","label","setAttributes","context","paginationArrow","showLabel","displayArrow","_react","createElement","href","onClick","event","preventDefault","useBlockProps","PlainText","__experimentalVersion","tagName","__","placeholder","value","onChange","newLabel","className"],"sources":["@wordpress/block-library/src/query-pagination-next/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, PlainText } from '@wordpress/block-editor';\n\nconst arrowMap = {\n\tnone: '',\n\tarrow: '→',\n\tchevron: '»',\n};\n\nexport default function QueryPaginationNextEdit( {\n\tattributes: { label },\n\tsetAttributes,\n\tcontext: { paginationArrow, showLabel },\n} ) {\n\tconst displayArrow = arrowMap[ paginationArrow ];\n\treturn (\n\t\t<a\n\t\t\thref=\"#pagination-next-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t{ ...useBlockProps() }\n\t\t>\n\t\t\t{ showLabel && (\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\taria-label={ __( 'Next page link' ) }\n\t\t\t\t\tplaceholder={ __( 'Next Page' ) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ displayArrow && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={ `wp-block-query-pagination-next-arrow is-arrow-${ paginationArrow }` }\n\t\t\t\t\taria-hidden={ true }\n\t\t\t\t>\n\t\t\t\t\t{ displayArrow }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</a>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,QAAQ,GAAG;EAChBC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,GAAG;EACVC,OAAO,EAAE;AACV,CAAC;AAEc,SAASC,uBAAuBA,CAAE;EAChDC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,aAAa;EACbC,OAAO,EAAE;IAAEC,eAAe;IAAEC;EAAU;AACvC,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGX,QAAQ,CAAES,eAAe,CAAE;EAChD,OACC,IAAAG,MAAA,CAAAC,aAAA;IACCC,IAAI,EAAC,8BAA8B;IACnCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;IAAA,GAC1C,IAAAC,0BAAa,EAAC;EAAC,GAElBR,SAAS,IACV,IAAAE,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAoB,SAAS;IACTC,qBAAqB,EAAG,CAAG;IAC3BC,OAAO,EAAC,MAAM;IACd,cAAa,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IACrCC,WAAW,EAAG,IAAAD,QAAE,EAAE,WAAY,CAAG;IACjCE,KAAK,EAAGlB,KAAO;IACfmB,QAAQ,EAAKC,QAAQ,IACpBnB,aAAa,CAAE;MAAED,KAAK,EAAEoB;IAAS,CAAE;EACnC,CACD,CACD,EACCf,YAAY,IACb,IAAAC,MAAA,CAAAC,aAAA;IACCc,SAAS,EAAI,iDAAiDlB,eAAiB,EAAG;IAClF,eAAc;EAAM,GAElBE,YACG,CAEL,CAAC;AAEN"}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","arrowMap","none","arrow","chevron","QueryPaginationNextEdit","attributes","label","setAttributes","context","paginationArrow","showLabel","displayArrow","_react","createElement","href","onClick","event","preventDefault","useBlockProps","PlainText","__experimentalVersion","tagName","__","placeholder","value","onChange","newLabel","className"],"sources":["@wordpress/block-library/src/query-pagination-next/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, PlainText } from '@wordpress/block-editor';\n\nconst arrowMap = {\n\tnone: '',\n\tarrow: '→',\n\tchevron: '»',\n};\n\nexport default function QueryPaginationNextEdit( {\n\tattributes: { label },\n\tsetAttributes,\n\tcontext: { paginationArrow, showLabel },\n} ) {\n\tconst displayArrow = arrowMap[ paginationArrow ];\n\treturn (\n\t\t<a\n\t\t\thref=\"#pagination-next-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t{ ...useBlockProps() }\n\t\t>\n\t\t\t{ showLabel && (\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\taria-label={ __( 'Next page link' ) }\n\t\t\t\t\tplaceholder={ __( 'Next Page' ) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ displayArrow && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={ `wp-block-query-pagination-next-arrow is-arrow-${ paginationArrow }` }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ displayArrow }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</a>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,QAAQ,GAAG;EAChBC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,GAAG;EACVC,OAAO,EAAE;AACV,CAAC;AAEc,SAASC,uBAAuBA,CAAE;EAChDC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,aAAa;EACbC,OAAO,EAAE;IAAEC,eAAe;IAAEC;EAAU;AACvC,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGX,QAAQ,CAAES,eAAe,CAAE;EAChD,OACC,IAAAG,MAAA,CAAAC,aAAA;IACCC,IAAI,EAAC,8BAA8B;IACnCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;IAAA,GAC1C,IAAAC,0BAAa,EAAC;EAAC,GAElBR,SAAS,IACV,IAAAE,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAoB,SAAS;IACTC,qBAAqB,EAAG,CAAG;IAC3BC,OAAO,EAAC,MAAM;IACd,cAAa,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IACrCC,WAAW,EAAG,IAAAD,QAAE,EAAE,WAAY,CAAG;IACjCE,KAAK,EAAGlB,KAAO;IACfmB,QAAQ,EAAKC,QAAQ,IACpBnB,aAAa,CAAE;MAAED,KAAK,EAAEoB;IAAS,CAAE;EACnC,CACD,CACD,EACCf,YAAY,IACb,IAAAC,MAAA,CAAAC,aAAA;IACCc,SAAS,EAAI,iDAAiDlB,eAAiB,EAAG;IAClF;EAAW,GAETE,YACG,CAEL,CAAC;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","arrowMap","none","arrow","chevron","QueryPaginationPreviousEdit","attributes","label","setAttributes","context","paginationArrow","showLabel","displayArrow","_react","createElement","href","onClick","event","preventDefault","useBlockProps","className","PlainText","__experimentalVersion","tagName","__","placeholder","value","onChange","newLabel"],"sources":["@wordpress/block-library/src/query-pagination-previous/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, PlainText } from '@wordpress/block-editor';\n\nconst arrowMap = {\n\tnone: '',\n\tarrow: '←',\n\tchevron: '«',\n};\n\nexport default function QueryPaginationPreviousEdit( {\n\tattributes: { label },\n\tsetAttributes,\n\tcontext: { paginationArrow, showLabel },\n} ) {\n\tconst displayArrow = arrowMap[ paginationArrow ];\n\treturn (\n\t\t<a\n\t\t\thref=\"#pagination-previous-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t{ ...useBlockProps() }\n\t\t>\n\t\t\t{ displayArrow && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={ `wp-block-query-pagination-previous-arrow is-arrow-${ paginationArrow }` }\n\t\t\t\t\taria-hidden={ true }\n\t\t\t\t>\n\t\t\t\t\t{ displayArrow }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ showLabel && (\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\taria-label={ __( 'Previous page link' ) }\n\t\t\t\t\tplaceholder={ __( 'Previous Page' ) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</a>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,QAAQ,GAAG;EAChBC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,GAAG;EACVC,OAAO,EAAE;AACV,CAAC;AAEc,SAASC,2BAA2BA,CAAE;EACpDC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,aAAa;EACbC,OAAO,EAAE;IAAEC,eAAe;IAAEC;EAAU;AACvC,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGX,QAAQ,CAAES,eAAe,CAAE;EAChD,OACC,IAAAG,MAAA,CAAAC,aAAA;IACCC,IAAI,EAAC,kCAAkC;IACvCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;IAAA,GAC1C,IAAAC,0BAAa,EAAC;EAAC,GAElBP,YAAY,IACb,IAAAC,MAAA,CAAAC,aAAA;IACCM,SAAS,EAAI,qDAAqDV,eAAiB,EAAG;IACtF,eAAc;EAAM,GAElBE,YACG,CACN,EACCD,SAAS,IACV,IAAAE,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAqB,SAAS;IACTC,qBAAqB,EAAG,CAAG;IAC3BC,OAAO,EAAC,MAAM;IACd,cAAa,IAAAC,QAAE,EAAE,oBAAqB,CAAG;IACzCC,WAAW,EAAG,IAAAD,QAAE,EAAE,eAAgB,CAAG;IACrCE,KAAK,EAAGnB,KAAO;IACfoB,QAAQ,EAAKC,QAAQ,IACpBpB,aAAa,CAAE;MAAED,KAAK,EAAEqB;IAAS,CAAE;EACnC,CACD,CAEA,CAAC;AAEN"}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","arrowMap","none","arrow","chevron","QueryPaginationPreviousEdit","attributes","label","setAttributes","context","paginationArrow","showLabel","displayArrow","_react","createElement","href","onClick","event","preventDefault","useBlockProps","className","PlainText","__experimentalVersion","tagName","__","placeholder","value","onChange","newLabel"],"sources":["@wordpress/block-library/src/query-pagination-previous/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, PlainText } from '@wordpress/block-editor';\n\nconst arrowMap = {\n\tnone: '',\n\tarrow: '←',\n\tchevron: '«',\n};\n\nexport default function QueryPaginationPreviousEdit( {\n\tattributes: { label },\n\tsetAttributes,\n\tcontext: { paginationArrow, showLabel },\n} ) {\n\tconst displayArrow = arrowMap[ paginationArrow ];\n\treturn (\n\t\t<a\n\t\t\thref=\"#pagination-previous-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t{ ...useBlockProps() }\n\t\t>\n\t\t\t{ displayArrow && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={ `wp-block-query-pagination-previous-arrow is-arrow-${ paginationArrow }` }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ displayArrow }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ showLabel && (\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\taria-label={ __( 'Previous page link' ) }\n\t\t\t\t\tplaceholder={ __( 'Previous Page' ) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</a>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,QAAQ,GAAG;EAChBC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,GAAG;EACVC,OAAO,EAAE;AACV,CAAC;AAEc,SAASC,2BAA2BA,CAAE;EACpDC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,aAAa;EACbC,OAAO,EAAE;IAAEC,eAAe;IAAEC;EAAU;AACvC,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGX,QAAQ,CAAES,eAAe,CAAE;EAChD,OACC,IAAAG,MAAA,CAAAC,aAAA;IACCC,IAAI,EAAC,kCAAkC;IACvCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;IAAA,GAC1C,IAAAC,0BAAa,EAAC;EAAC,GAElBP,YAAY,IACb,IAAAC,MAAA,CAAAC,aAAA;IACCM,SAAS,EAAI,qDAAqDV,eAAiB,EAAG;IACtF;EAAW,GAETE,YACG,CACN,EACCD,SAAS,IACV,IAAAE,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAqB,SAAS;IACTC,qBAAqB,EAAG,CAAG;IAC3BC,OAAO,EAAC,MAAM;IACd,cAAa,IAAAC,QAAE,EAAE,oBAAqB,CAAG;IACzCC,WAAW,EAAG,IAAAD,QAAE,EAAE,eAAgB,CAAG;IACrCE,KAAK,EAAGnB,KAAO;IACfoB,QAAQ,EAAKC,QAAQ,IACpBpB,aAAa,CAAE;MAAED,KAAK,EAAEqB;IAAS,CAAE;EACnC,CACD,CAEA,CAAC;AAEN"}