@wordpress/block-library 10.5.2-next.v.202608281122.0 → 11.0.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 (588) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/build/audio/edit.cjs +5 -5
  3. package/build/audio/edit.cjs.map +2 -2
  4. package/build/audio/index.cjs +0 -37
  5. package/build/audio/index.cjs.map +3 -3
  6. package/build/button/index.cjs +0 -34
  7. package/build/button/index.cjs.map +3 -3
  8. package/build/code/index.cjs +0 -17
  9. package/build/code/index.cjs.map +3 -3
  10. package/build/comment-template/edit.cjs.map +1 -1
  11. package/build/cover/index.cjs +0 -38
  12. package/build/cover/index.cjs.map +3 -3
  13. package/build/details/index.cjs +0 -17
  14. package/build/details/index.cjs.map +3 -3
  15. package/build/file/index.cjs +0 -43
  16. package/build/file/index.cjs.map +3 -3
  17. package/build/footnotes/format.cjs +1 -1
  18. package/build/footnotes/format.cjs.map +2 -2
  19. package/build/gallery/dynamic-gallery.cjs +22 -12
  20. package/build/gallery/dynamic-gallery.cjs.map +2 -2
  21. package/build/heading/index.cjs +0 -16
  22. package/build/heading/index.cjs.map +3 -3
  23. package/build/image/image.cjs +7 -5
  24. package/build/image/image.cjs.map +2 -2
  25. package/build/image/index.cjs +0 -81
  26. package/build/image/index.cjs.map +3 -3
  27. package/build/image/use-open-image-media-editor-modal.cjs +81 -14
  28. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  29. package/build/index.cjs +0 -10
  30. package/build/index.cjs.map +2 -2
  31. package/build/latest-posts/edit.cjs.map +1 -1
  32. package/build/list-item/edit.cjs +14 -11
  33. package/build/list-item/edit.cjs.map +2 -2
  34. package/build/list-item/hooks/index.cjs +6 -9
  35. package/build/list-item/hooks/index.cjs.map +2 -2
  36. package/build/list-item/hooks/use-enter.cjs +62 -67
  37. package/build/list-item/hooks/use-enter.cjs.map +3 -3
  38. package/build/list-item/hooks/use-merge.cjs +26 -44
  39. package/build/list-item/hooks/use-merge.cjs.map +3 -3
  40. package/build/list-item/hooks/use-multi-select-tab.cjs +80 -0
  41. package/build/list-item/hooks/use-multi-select-tab.cjs.map +7 -0
  42. package/build/list-item/hooks/use-tab.cjs +65 -0
  43. package/build/list-item/hooks/use-tab.cjs.map +7 -0
  44. package/build/list-item/index.cjs +0 -17
  45. package/build/list-item/index.cjs.map +3 -3
  46. package/build/list-item/utils.cjs +169 -0
  47. package/build/list-item/utils.cjs.map +7 -0
  48. package/build/math/block.json +3 -0
  49. package/build/media-text/index.cjs +0 -50
  50. package/build/media-text/index.cjs.map +3 -3
  51. package/build/media-text/media-container.cjs +16 -11
  52. package/build/media-text/media-container.cjs.map +2 -2
  53. package/build/more/index.cjs +0 -18
  54. package/build/more/index.cjs.map +3 -3
  55. package/build/navigation/constants.cjs +1 -1
  56. package/build/navigation/constants.cjs.map +1 -1
  57. package/build/navigation-link/block.json +1 -1
  58. package/build/navigation-link/deprecated.cjs +69 -0
  59. package/build/navigation-link/deprecated.cjs.map +7 -0
  60. package/build/navigation-link/index.cjs +6 -74
  61. package/build/navigation-link/index.cjs.map +4 -4
  62. package/build/{form-submit-button/init.cjs → navigation-link/variations.cjs} +23 -8
  63. package/build/navigation-link/variations.cjs.map +7 -0
  64. package/build/navigation-submenu/index.cjs +0 -32
  65. package/build/navigation-submenu/index.cjs.map +3 -3
  66. package/build/paragraph/index.cjs +0 -17
  67. package/build/paragraph/index.cjs.map +3 -3
  68. package/build/paragraph/use-enter.cjs +8 -4
  69. package/build/paragraph/use-enter.cjs.map +2 -2
  70. package/build/post-template/edit.cjs +3 -1
  71. package/build/post-template/edit.cjs.map +2 -2
  72. package/build/preformatted/index.cjs +0 -17
  73. package/build/preformatted/index.cjs.map +3 -3
  74. package/build/pullquote/index.cjs +0 -24
  75. package/build/pullquote/index.cjs.map +3 -3
  76. package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +13 -5
  77. package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +2 -2
  78. package/build/query/edit/inspector-controls/index.cjs +9 -4
  79. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  80. package/build/query/edit/query-content.cjs +30 -9
  81. package/build/query/edit/query-content.cjs.map +3 -3
  82. package/build/query/utils.cjs +11 -4
  83. package/build/query/utils.cjs.map +2 -2
  84. package/build/search/edit.cjs +3 -1
  85. package/build/search/edit.cjs.map +2 -2
  86. package/build/search/index.cjs +0 -31
  87. package/build/search/index.cjs.map +3 -3
  88. package/build/site-tagline/edit.cjs +11 -17
  89. package/build/site-tagline/edit.cjs.map +2 -2
  90. package/build/site-title/edit.cjs +12 -18
  91. package/build/site-title/edit.cjs.map +2 -2
  92. package/build/social-link/index.cjs +0 -31
  93. package/build/social-link/index.cjs.map +3 -3
  94. package/build/verse/index.cjs +0 -17
  95. package/build/verse/index.cjs.map +3 -3
  96. package/build/video/index.cjs +0 -40
  97. package/build/video/index.cjs.map +3 -3
  98. package/build/video/tracks-editor.cjs +2 -3
  99. package/build/video/tracks-editor.cjs.map +3 -3
  100. package/build-module/audio/edit.mjs +5 -5
  101. package/build-module/audio/edit.mjs.map +2 -2
  102. package/build-module/audio/index.mjs +0 -37
  103. package/build-module/audio/index.mjs.map +2 -2
  104. package/build-module/button/index.mjs +0 -34
  105. package/build-module/button/index.mjs.map +2 -2
  106. package/build-module/code/index.mjs +0 -17
  107. package/build-module/code/index.mjs.map +2 -2
  108. package/build-module/comment-template/edit.mjs.map +1 -1
  109. package/build-module/cover/index.mjs +0 -38
  110. package/build-module/cover/index.mjs.map +2 -2
  111. package/build-module/details/index.mjs +0 -17
  112. package/build-module/details/index.mjs.map +2 -2
  113. package/build-module/file/index.mjs +1 -44
  114. package/build-module/file/index.mjs.map +2 -2
  115. package/build-module/footnotes/format.mjs +1 -1
  116. package/build-module/footnotes/format.mjs.map +2 -2
  117. package/build-module/gallery/dynamic-gallery.mjs +23 -13
  118. package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
  119. package/build-module/heading/index.mjs +1 -21
  120. package/build-module/heading/index.mjs.map +2 -2
  121. package/build-module/image/image.mjs +7 -5
  122. package/build-module/image/image.mjs.map +2 -2
  123. package/build-module/image/index.mjs +0 -81
  124. package/build-module/image/index.mjs.map +2 -2
  125. package/build-module/image/use-open-image-media-editor-modal.mjs +84 -14
  126. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  127. package/build-module/index.mjs +0 -10
  128. package/build-module/index.mjs.map +2 -2
  129. package/build-module/latest-posts/edit.mjs.map +1 -1
  130. package/build-module/list-item/edit.mjs +20 -18
  131. package/build-module/list-item/edit.mjs.map +2 -2
  132. package/build-module/list-item/hooks/index.mjs +8 -10
  133. package/build-module/list-item/hooks/index.mjs.map +2 -2
  134. package/build-module/list-item/hooks/use-enter.mjs +63 -58
  135. package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
  136. package/build-module/list-item/hooks/use-merge.mjs +27 -35
  137. package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
  138. package/build-module/list-item/hooks/use-multi-select-tab.mjs +59 -0
  139. package/build-module/list-item/hooks/use-multi-select-tab.mjs.map +7 -0
  140. package/build-module/list-item/hooks/use-tab.mjs +44 -0
  141. package/build-module/list-item/hooks/use-tab.mjs.map +7 -0
  142. package/build-module/list-item/index.mjs +0 -17
  143. package/build-module/list-item/index.mjs.map +2 -2
  144. package/build-module/list-item/utils.mjs +140 -0
  145. package/build-module/list-item/utils.mjs.map +7 -0
  146. package/build-module/math/block.json +3 -0
  147. package/build-module/media-text/index.mjs +0 -50
  148. package/build-module/media-text/index.mjs.map +2 -2
  149. package/build-module/media-text/media-container.mjs +17 -12
  150. package/build-module/media-text/media-container.mjs.map +2 -2
  151. package/build-module/more/index.mjs +0 -18
  152. package/build-module/more/index.mjs.map +2 -2
  153. package/build-module/navigation/constants.mjs +1 -1
  154. package/build-module/navigation/constants.mjs.map +1 -1
  155. package/build-module/navigation-link/block.json +1 -1
  156. package/build-module/navigation-link/deprecated.mjs +48 -0
  157. package/build-module/navigation-link/deprecated.mjs.map +7 -0
  158. package/build-module/navigation-link/index.mjs +7 -75
  159. package/build-module/navigation-link/index.mjs.map +3 -3
  160. package/build-module/navigation-link/variations.mjs +22 -0
  161. package/build-module/navigation-link/variations.mjs.map +7 -0
  162. package/build-module/navigation-submenu/index.mjs +1 -33
  163. package/build-module/navigation-submenu/index.mjs.map +2 -2
  164. package/build-module/paragraph/index.mjs +0 -17
  165. package/build-module/paragraph/index.mjs.map +2 -2
  166. package/build-module/paragraph/use-enter.mjs +8 -4
  167. package/build-module/paragraph/use-enter.mjs.map +2 -2
  168. package/build-module/post-template/edit.mjs +3 -1
  169. package/build-module/post-template/edit.mjs.map +2 -2
  170. package/build-module/preformatted/index.mjs +0 -17
  171. package/build-module/preformatted/index.mjs.map +2 -2
  172. package/build-module/pullquote/index.mjs +0 -24
  173. package/build-module/pullquote/index.mjs.map +2 -2
  174. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +14 -6
  175. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +2 -2
  176. package/build-module/query/edit/inspector-controls/index.mjs +9 -4
  177. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  178. package/build-module/query/edit/query-content.mjs +32 -11
  179. package/build-module/query/edit/query-content.mjs.map +2 -2
  180. package/build-module/query/utils.mjs +10 -7
  181. package/build-module/query/utils.mjs.map +2 -2
  182. package/build-module/search/edit.mjs +4 -2
  183. package/build-module/search/edit.mjs.map +2 -2
  184. package/build-module/search/index.mjs +0 -31
  185. package/build-module/search/index.mjs.map +2 -2
  186. package/build-module/site-tagline/edit.mjs +13 -19
  187. package/build-module/site-tagline/edit.mjs.map +2 -2
  188. package/build-module/site-title/edit.mjs +14 -20
  189. package/build-module/site-title/edit.mjs.map +2 -2
  190. package/build-module/social-link/index.mjs +0 -31
  191. package/build-module/social-link/index.mjs.map +2 -2
  192. package/build-module/verse/index.mjs +0 -17
  193. package/build-module/verse/index.mjs.map +2 -2
  194. package/build-module/video/index.mjs +0 -40
  195. package/build-module/video/index.mjs.map +2 -2
  196. package/build-module/video/tracks-editor.mjs +3 -5
  197. package/build-module/video/tracks-editor.mjs.map +2 -2
  198. package/build-style/columns/style-rtl.css +1 -1
  199. package/build-style/columns/style.css +1 -1
  200. package/build-style/comment-template/style-rtl.css +0 -1
  201. package/build-style/comment-template/style.css +0 -1
  202. package/build-style/cover/style-rtl.css +1 -2
  203. package/build-style/cover/style.css +1 -2
  204. package/build-style/editor-rtl.css +20 -81
  205. package/build-style/editor.css +20 -81
  206. package/build-style/gallery/style-rtl.css +2 -4
  207. package/build-style/gallery/style.css +2 -4
  208. package/build-style/group/theme-rtl.css +1 -1
  209. package/build-style/group/theme.css +1 -1
  210. package/build-style/heading/style-rtl.css +1 -1
  211. package/build-style/heading/style.css +1 -1
  212. package/build-style/icon/style-rtl.css +3 -0
  213. package/build-style/icon/style.css +3 -0
  214. package/build-style/image/editor-rtl.css +0 -1
  215. package/build-style/image/editor.css +0 -1
  216. package/build-style/list/style-rtl.css +1 -1
  217. package/build-style/list/style.css +1 -1
  218. package/build-style/media-text/style-rtl.css +2 -3
  219. package/build-style/media-text/style.css +2 -3
  220. package/build-style/navigation/editor-rtl.css +8 -0
  221. package/build-style/navigation/editor.css +8 -0
  222. package/build-style/paragraph/style-rtl.css +1 -1
  223. package/build-style/paragraph/style.css +1 -1
  224. package/build-style/playlist/style-rtl.css +1 -2
  225. package/build-style/playlist/style.css +1 -2
  226. package/build-style/playlist-track/style-rtl.css +1 -2
  227. package/build-style/playlist-track/style.css +1 -2
  228. package/build-style/preformatted/style-rtl.css +1 -1
  229. package/build-style/preformatted/style.css +1 -1
  230. package/build-style/query/editor-rtl.css +5 -15
  231. package/build-style/query/editor.css +5 -15
  232. package/build-style/read-more/style-rtl.css +0 -1
  233. package/build-style/read-more/style.css +0 -1
  234. package/build-style/reset-rtl.css +1 -3
  235. package/build-style/reset.css +1 -3
  236. package/build-style/search/style-rtl.css +1 -3
  237. package/build-style/search/style.css +1 -3
  238. package/build-style/site-logo/editor-rtl.css +1 -2
  239. package/build-style/site-logo/editor.css +1 -2
  240. package/build-style/style-rtl.css +18 -77
  241. package/build-style/style.css +18 -77
  242. package/build-style/tab-list/style-rtl.css +1 -3
  243. package/build-style/tab-list/style.css +1 -3
  244. package/build-style/template-part/editor-rtl.css +4 -8
  245. package/build-style/template-part/editor.css +4 -8
  246. package/build-style/template-part/theme-rtl.css +1 -1
  247. package/build-style/template-part/theme.css +1 -1
  248. package/build-style/theme-rtl.css +2 -2
  249. package/build-style/theme.css +2 -2
  250. package/build-style/video/style-rtl.css +1 -2
  251. package/build-style/video/style.css +1 -2
  252. package/build-types/navigation-link/deprecated.d.ts +48 -0
  253. package/build-types/navigation-link/deprecated.d.ts.map +1 -0
  254. package/package.json +43 -43
  255. package/src/accordion/index.php +2 -2
  256. package/src/accordion-item/index.php +1 -1
  257. package/src/audio/edit.jsx +6 -7
  258. package/src/audio/index.js +0 -37
  259. package/src/breadcrumbs/index.php +4 -4
  260. package/src/button/index.js +0 -34
  261. package/src/button/style.scss +16 -15
  262. package/src/button/test/{get-experimental-label.js → get-experimental-label.jsdom.test.js} +1 -0
  263. package/src/button/test/get-updated-link-attributes.js +1 -0
  264. package/src/button/test/utils.js +1 -0
  265. package/src/categories/index.php +4 -0
  266. package/src/code/index.js +0 -18
  267. package/src/code/test/utils.js +1 -0
  268. package/src/columns/style.scss +2 -1
  269. package/src/columns/test/{transforms.js → transforms.jsdom.test.js} +1 -0
  270. package/src/columns/test/utils.js +1 -0
  271. package/src/comment-template/edit.jsx +1 -1
  272. package/src/comment-template/index.php +2 -2
  273. package/src/comment-template/test/index.js +1 -0
  274. package/src/common.scss +51 -50
  275. package/src/cover/README.md +37 -0
  276. package/src/cover/index.js +0 -39
  277. package/src/cover/style.scss +3 -3
  278. package/src/cover/test/{edit.js → edit.jsdom.test.js} +18 -17
  279. package/src/cover/test/{transforms.js → transforms.jsdom.test.js} +1 -0
  280. package/src/details/index.js +0 -18
  281. package/src/editor.scss +0 -2
  282. package/src/embed/editor.scss +1 -0
  283. package/src/embed/test/{index.js → index.jsdom.test.js} +5 -1
  284. package/src/file/index.js +1 -43
  285. package/src/footnotes/format.jsx +5 -1
  286. package/src/gallery/dynamic-gallery.jsx +31 -4
  287. package/src/gallery/test/dynamic-source.js +1 -0
  288. package/src/gallery/test/{edit.js → edit.jsdom.test.js} +4 -0
  289. package/src/gallery/test/responsive-styles.js +1 -0
  290. package/src/gallery/test/shared.js +1 -0
  291. package/src/gallery/test/{transforms.js → transforms.jsdom.test.js} +1 -0
  292. package/src/gallery/test/{use-get-new-images.jsx → use-get-new-images.jsdom.test.jsx} +1 -0
  293. package/src/gallery/test/variations.js +1 -0
  294. package/src/group/test/{placeholder.jsx → placeholder.jsdom.test.jsx} +1 -0
  295. package/src/group/theme.scss +1 -1
  296. package/src/heading/index.js +1 -22
  297. package/src/heading/index.php +1 -1
  298. package/src/heading/style.scss +1 -1
  299. package/src/heading/test/shared.js +1 -0
  300. package/src/home-link/index.php +2 -2
  301. package/src/html/test/{index.js → index.jsdom.test.js} +9 -0
  302. package/src/html/test/{utils.js → utils.jsdom.test.js} +1 -0
  303. package/src/icon/index.php +18 -6
  304. package/src/icon/style.scss +7 -0
  305. package/src/image/image.jsx +18 -11
  306. package/src/image/index.js +0 -80
  307. package/src/image/test/{transforms.js → transforms.jsdom.test.js} +1 -0
  308. package/src/image/test/{use-open-image-media-editor-modal.js → use-open-image-media-editor-modal.jsdom.test.js} +343 -28
  309. package/src/image/use-open-image-media-editor-modal.js +184 -21
  310. package/src/index.jsx +0 -11
  311. package/src/latest-posts/edit.jsx +1 -1
  312. package/src/latest-posts/test/{deprecated.js → deprecated.jsdom.test.js} +1 -0
  313. package/src/list/index.php +1 -1
  314. package/src/list/style.scss +1 -1
  315. package/src/list-item/edit.jsx +20 -20
  316. package/src/list-item/hooks/index.js +2 -3
  317. package/src/list-item/hooks/use-enter.js +82 -70
  318. package/src/list-item/hooks/use-merge.js +28 -36
  319. package/src/list-item/hooks/use-multi-select-tab.js +83 -0
  320. package/src/list-item/hooks/use-tab.js +62 -0
  321. package/src/list-item/index.js +0 -18
  322. package/src/list-item/utils.js +236 -0
  323. package/src/math/README.md +2 -0
  324. package/src/math/block.json +3 -0
  325. package/src/media-text/index.js +0 -50
  326. package/src/media-text/media-container.jsx +22 -12
  327. package/src/media-text/style.scss +2 -1
  328. package/src/media-text/test/image-fill.js +1 -0
  329. package/src/more/index.js +0 -19
  330. package/src/navigation/constants.js +1 -1
  331. package/src/navigation/edit/test/are-blocks-dirty.js +1 -0
  332. package/src/navigation/edit/test/{layout-custom-properties.js → layout-custom-properties.jsdom.test.js} +8 -7
  333. package/src/navigation/edit/test/{navigation-menu-selector.jsx → navigation-menu-selector.jsdom.test.jsx} +23 -14
  334. package/src/navigation/edit/test/{overlay-template-part-selector.jsx → overlay-template-part-selector.jsdom.test.jsx} +22 -20
  335. package/src/navigation/edit/test/{responsive-wrapper.jsx → responsive-wrapper.jsdom.test.jsx} +14 -13
  336. package/src/navigation/edit/test/{use-create-overlay.js → use-create-overlay.jsdom.test.js} +19 -24
  337. package/src/navigation/edit/test/utils.js +1 -0
  338. package/src/navigation/editor.scss +13 -0
  339. package/src/navigation/index.php +14 -14
  340. package/src/navigation/test/{menu-items-to-blocks.js → menu-items-to-blocks.jsdom.test.js} +3 -2
  341. package/src/navigation/test/{use-navigation-menu.js → use-navigation-menu.jsdom.test.js} +7 -4
  342. package/src/navigation/test/{view.js → view.jsdom.test.js} +4 -2
  343. package/src/navigation-link/block.json +1 -1
  344. package/src/navigation-link/deprecated.tsx +58 -0
  345. package/src/navigation-link/{index.jsx → index.js} +5 -77
  346. package/src/navigation-link/index.php +5 -5
  347. package/src/navigation-link/shared/test/{controls.jsx → controls.jsdom.test.jsx} +18 -18
  348. package/src/navigation-link/shared/test/update-attributes.test.js +52 -51
  349. package/src/navigation-link/shared/test/{use-enable-link-status-validation.test.js → use-enable-link-status-validation.jsdom.test.js} +8 -6
  350. package/src/navigation-link/shared/test/{use-entity-binding.js → use-entity-binding.jsdom.test.js} +12 -11
  351. package/src/navigation-link/shared/test/{use-handle-link-change.test.js → use-handle-link-change.jsdom.test.js} +23 -20
  352. package/src/navigation-link/shared/test/{use-link-preview.test.js → use-link-preview.jsdom.test.js} +17 -14
  353. package/src/navigation-link/test/__snapshots__/{hooks.js.snap → hooks.jsdom.test.js.snap} +23 -6
  354. package/src/navigation-link/test/block-labelling.js +1 -0
  355. package/src/navigation-link/test/{hooks.js → hooks.jsdom.test.js} +1 -0
  356. package/src/navigation-link/variations.js +19 -0
  357. package/src/navigation-submenu/index.js +1 -33
  358. package/src/page-list/index.php +10 -10
  359. package/src/page-list/test/{convert-to-navigation-links.js → convert-to-navigation-links.jsdom.test.js} +3 -2
  360. package/src/paragraph/index.js +0 -18
  361. package/src/paragraph/style.scss +1 -1
  362. package/src/paragraph/use-enter.js +13 -6
  363. package/src/pattern/test/index.js +1 -0
  364. package/src/playlist/test/{edit-component.jsx → edit-component.jsdom.test.jsx} +31 -30
  365. package/src/playlist/test/{edit.js → edit.jsdom.test.js} +1 -0
  366. package/src/playlist/test/{transforms.js → transforms.jsdom.test.js} +1 -0
  367. package/src/playlist-track/test/{edit.jsx → edit.jsdom.test.jsx} +20 -19
  368. package/src/post-author/index.php +3 -3
  369. package/src/post-author-biography/index.php +3 -3
  370. package/src/post-author-name/index.php +3 -3
  371. package/src/post-comments-link/index.php +4 -4
  372. package/src/post-date/test/{edit.js → edit.jsdom.test.js} +1 -0
  373. package/src/post-template/edit.jsx +3 -1
  374. package/src/post-time-to-read/index.php +3 -3
  375. package/src/post-title/style.scss +1 -0
  376. package/src/preformatted/index.js +0 -18
  377. package/src/preformatted/style.scss +1 -1
  378. package/src/pullquote/index.js +0 -24
  379. package/src/query/edit/inspector-controls/enhanced-pagination-control.jsx +13 -6
  380. package/src/query/edit/inspector-controls/index.jsx +9 -4
  381. package/src/query/edit/query-content.jsx +31 -8
  382. package/src/query/editor.scss +1 -7
  383. package/src/query/index.php +2 -2
  384. package/src/query/test/{utils.js → utils.jsdom.test.js} +1 -0
  385. package/src/query/utils.js +15 -11
  386. package/src/quote/test/{migrate.js → migrate.jsdom.test.js} +1 -0
  387. package/src/read-more/index.php +1 -1
  388. package/src/search/edit.jsx +12 -2
  389. package/src/search/index.js +0 -30
  390. package/src/search/index.php +1 -1
  391. package/src/separator/test/{edit.jsx → edit.jsdom.test.jsx} +5 -4
  392. package/src/site-logo/index.php +1 -1
  393. package/src/site-tagline/edit.jsx +18 -27
  394. package/src/site-title/edit.jsx +20 -27
  395. package/src/social-link/index.js +0 -32
  396. package/src/social-link/index.php +0 -1
  397. package/src/style.scss +0 -1
  398. package/src/table/editor.scss +1 -0
  399. package/src/table/style.scss +2 -0
  400. package/src/table/test/state.js +1 -0
  401. package/src/table/test/utils.js +1 -0
  402. package/src/table-of-contents/index.php +3 -3
  403. package/src/template-part/theme.scss +1 -1
  404. package/src/utils/test/search-patterns.js +1 -0
  405. package/src/utils/test/{style-state.js → style-state.jsdom.test.js} +1 -0
  406. package/src/utils/test/{waveform-player-dependency.js → waveform-player-dependency.jsdom.test.js} +15 -21
  407. package/src/verse/index.js +0 -18
  408. package/src/verse/style.scss +1 -0
  409. package/src/video/index.js +0 -40
  410. package/src/video/test/variations.js +1 -0
  411. package/src/video/tracks-editor.jsx +4 -5
  412. package/build/form/block.json +0 -65
  413. package/build/form/deprecated.cjs +0 -111
  414. package/build/form/deprecated.cjs.map +0 -7
  415. package/build/form/edit.cjs +0 -180
  416. package/build/form/edit.cjs.map +0 -7
  417. package/build/form/icons.cjs +0 -33
  418. package/build/form/icons.cjs.map +0 -7
  419. package/build/form/index.cjs +0 -118
  420. package/build/form/index.cjs.map +0 -7
  421. package/build/form/init.cjs +0 -28
  422. package/build/form/init.cjs.map +0 -7
  423. package/build/form/save.cjs +0 -40
  424. package/build/form/save.cjs.map +0 -7
  425. package/build/form/utils.cjs +0 -61
  426. package/build/form/utils.cjs.map +0 -7
  427. package/build/form/variations.cjs +0 -152
  428. package/build/form/variations.cjs.map +0 -7
  429. package/build/form/view.cjs +0 -48
  430. package/build/form/view.cjs.map +0 -7
  431. package/build/form-input/block.json +0 -72
  432. package/build/form-input/deprecated.cjs +0 -252
  433. package/build/form-input/deprecated.cjs.map +0 -7
  434. package/build/form-input/edit.cjs +0 -206
  435. package/build/form-input/edit.cjs.map +0 -7
  436. package/build/form-input/icons.cjs +0 -33
  437. package/build/form-input/icons.cjs.map +0 -7
  438. package/build/form-input/index.cjs +0 -63
  439. package/build/form-input/index.cjs.map +0 -7
  440. package/build/form-input/init.cjs +0 -28
  441. package/build/form-input/init.cjs.map +0 -7
  442. package/build/form-input/save.cjs +0 -88
  443. package/build/form-input/save.cjs.map +0 -7
  444. package/build/form-input/variations.cjs +0 -105
  445. package/build/form-input/variations.cjs.map +0 -7
  446. package/build/form-submission-notification/block.json +0 -19
  447. package/build/form-submission-notification/edit.cjs +0 -71
  448. package/build/form-submission-notification/edit.cjs.map +0 -7
  449. package/build/form-submission-notification/index.cjs +0 -73
  450. package/build/form-submission-notification/index.cjs.map +0 -7
  451. package/build/form-submission-notification/init.cjs +0 -28
  452. package/build/form-submission-notification/init.cjs.map +0 -7
  453. package/build/form-submission-notification/save.cjs +0 -54
  454. package/build/form-submission-notification/save.cjs.map +0 -7
  455. package/build/form-submission-notification/variations.cjs +0 -78
  456. package/build/form-submission-notification/variations.cjs.map +0 -7
  457. package/build/form-submit-button/block.json +0 -15
  458. package/build/form-submit-button/edit.cjs +0 -36
  459. package/build/form-submit-button/edit.cjs.map +0 -7
  460. package/build/form-submit-button/index.cjs +0 -75
  461. package/build/form-submit-button/index.cjs.map +0 -7
  462. package/build/form-submit-button/init.cjs.map +0 -7
  463. package/build/form-submit-button/save.cjs +0 -32
  464. package/build/form-submit-button/save.cjs.map +0 -7
  465. package/build/list-item/hooks/use-indent-list-item.cjs +0 -79
  466. package/build/list-item/hooks/use-indent-list-item.cjs.map +0 -7
  467. package/build/list-item/hooks/use-outdent-list-item.cjs +0 -106
  468. package/build/list-item/hooks/use-outdent-list-item.cjs.map +0 -7
  469. package/build/list-item/hooks/use-space.cjs +0 -83
  470. package/build/list-item/hooks/use-space.cjs.map +0 -7
  471. package/build/query/edit/enhanced-pagination-modal.cjs +0 -89
  472. package/build/query/edit/enhanced-pagination-modal.cjs.map +0 -7
  473. package/build-module/form/block.json +0 -65
  474. package/build-module/form/deprecated.mjs +0 -96
  475. package/build-module/form/deprecated.mjs.map +0 -7
  476. package/build-module/form/edit.mjs +0 -170
  477. package/build-module/form/edit.mjs.map +0 -7
  478. package/build-module/form/icons.mjs +0 -8
  479. package/build-module/form/icons.mjs.map +0 -7
  480. package/build-module/form/index.mjs +0 -83
  481. package/build-module/form/index.mjs.map +0 -7
  482. package/build-module/form/init.mjs +0 -7
  483. package/build-module/form/init.mjs.map +0 -7
  484. package/build-module/form/save.mjs +0 -19
  485. package/build-module/form/save.mjs.map +0 -7
  486. package/build-module/form/utils.mjs +0 -35
  487. package/build-module/form/utils.mjs.map +0 -7
  488. package/build-module/form/variations.mjs +0 -134
  489. package/build-module/form/variations.mjs.map +0 -7
  490. package/build-module/form/view.mjs +0 -46
  491. package/build-module/form/view.mjs.map +0 -7
  492. package/build-module/form-input/block.json +0 -72
  493. package/build-module/form-input/deprecated.mjs +0 -226
  494. package/build-module/form-input/deprecated.mjs.map +0 -7
  495. package/build-module/form-input/edit.mjs +0 -186
  496. package/build-module/form-input/edit.mjs.map +0 -7
  497. package/build-module/form-input/icons.mjs +0 -8
  498. package/build-module/form-input/icons.mjs.map +0 -7
  499. package/build-module/form-input/index.mjs +0 -25
  500. package/build-module/form-input/index.mjs.map +0 -7
  501. package/build-module/form-input/init.mjs +0 -7
  502. package/build-module/form-input/init.mjs.map +0 -7
  503. package/build-module/form-input/save.mjs +0 -62
  504. package/build-module/form-input/save.mjs.map +0 -7
  505. package/build-module/form-input/variations.mjs +0 -84
  506. package/build-module/form-input/variations.mjs.map +0 -7
  507. package/build-module/form-submission-notification/block.json +0 -19
  508. package/build-module/form-submission-notification/edit.mjs +0 -45
  509. package/build-module/form-submission-notification/edit.mjs.map +0 -7
  510. package/build-module/form-submission-notification/index.mjs +0 -35
  511. package/build-module/form-submission-notification/index.mjs.map +0 -7
  512. package/build-module/form-submission-notification/init.mjs +0 -7
  513. package/build-module/form-submission-notification/init.mjs.map +0 -7
  514. package/build-module/form-submission-notification/save.mjs +0 -23
  515. package/build-module/form-submission-notification/save.mjs.map +0 -7
  516. package/build-module/form-submission-notification/variations.mjs +0 -57
  517. package/build-module/form-submission-notification/variations.mjs.map +0 -7
  518. package/build-module/form-submit-button/block.json +0 -15
  519. package/build-module/form-submit-button/edit.mjs +0 -15
  520. package/build-module/form-submit-button/edit.mjs.map +0 -7
  521. package/build-module/form-submit-button/index.mjs +0 -37
  522. package/build-module/form-submit-button/index.mjs.map +0 -7
  523. package/build-module/form-submit-button/init.mjs +0 -7
  524. package/build-module/form-submit-button/init.mjs.map +0 -7
  525. package/build-module/form-submit-button/save.mjs +0 -11
  526. package/build-module/form-submit-button/save.mjs.map +0 -7
  527. package/build-module/list-item/hooks/use-indent-list-item.mjs +0 -58
  528. package/build-module/list-item/hooks/use-indent-list-item.mjs.map +0 -7
  529. package/build-module/list-item/hooks/use-outdent-list-item.mjs +0 -85
  530. package/build-module/list-item/hooks/use-outdent-list-item.mjs.map +0 -7
  531. package/build-module/list-item/hooks/use-space.mjs +0 -52
  532. package/build-module/list-item/hooks/use-space.mjs.map +0 -7
  533. package/build-module/query/edit/enhanced-pagination-modal.mjs +0 -72
  534. package/build-module/query/edit/enhanced-pagination-modal.mjs.map +0 -7
  535. package/build-style/form-input/editor-rtl.css +0 -19
  536. package/build-style/form-input/editor.css +0 -19
  537. package/build-style/form-input/style-rtl.css +0 -48
  538. package/build-style/form-input/style.css +0 -48
  539. package/build-style/form-submission-notification/editor-rtl.css +0 -30
  540. package/build-style/form-submission-notification/editor.css +0 -30
  541. package/build-style/form-submit-button/style-rtl.css +0 -3
  542. package/build-style/form-submit-button/style.css +0 -3
  543. package/src/form/README.md +0 -90
  544. package/src/form/block.json +0 -65
  545. package/src/form/deprecated.jsx +0 -93
  546. package/src/form/edit.jsx +0 -169
  547. package/src/form/icons.jsx +0 -7
  548. package/src/form/index.js +0 -91
  549. package/src/form/index.php +0 -197
  550. package/src/form/init.js +0 -3
  551. package/src/form/save.jsx +0 -15
  552. package/src/form/utils.js +0 -36
  553. package/src/form/variations.js +0 -133
  554. package/src/form/view.js +0 -54
  555. package/src/form-input/README.md +0 -74
  556. package/src/form-input/block.json +0 -72
  557. package/src/form-input/deprecated.jsx +0 -248
  558. package/src/form-input/edit.jsx +0 -187
  559. package/src/form-input/editor.scss +0 -24
  560. package/src/form-input/icons.jsx +0 -7
  561. package/src/form-input/index.js +0 -22
  562. package/src/form-input/index.php +0 -47
  563. package/src/form-input/init.js +0 -3
  564. package/src/form-input/save.jsx +0 -89
  565. package/src/form-input/style.scss +0 -64
  566. package/src/form-input/variations.js +0 -82
  567. package/src/form-submission-notification/README.md +0 -50
  568. package/src/form-submission-notification/block.json +0 -19
  569. package/src/form-submission-notification/edit.jsx +0 -44
  570. package/src/form-submission-notification/editor.scss +0 -45
  571. package/src/form-submission-notification/index.js +0 -33
  572. package/src/form-submission-notification/index.php +0 -48
  573. package/src/form-submission-notification/init.js +0 -3
  574. package/src/form-submission-notification/save.jsx +0 -18
  575. package/src/form-submission-notification/variations.js +0 -56
  576. package/src/form-submit-button/README.md +0 -54
  577. package/src/form-submit-button/block.json +0 -15
  578. package/src/form-submit-button/edit.jsx +0 -12
  579. package/src/form-submit-button/index.js +0 -35
  580. package/src/form-submit-button/init.js +0 -3
  581. package/src/form-submit-button/save.jsx +0 -10
  582. package/src/form-submit-button/style.scss +0 -3
  583. package/src/list-item/hooks/use-indent-list-item.js +0 -73
  584. package/src/list-item/hooks/use-outdent-list-item.js +0 -100
  585. package/src/list-item/hooks/use-space.js +0 -66
  586. package/src/query/edit/enhanced-pagination-modal.jsx +0 -77
  587. /package/src/utils/test/{waveform-player.jsx → waveform-player.jsdom.test.jsx} +0 -0
  588. /package/src/utils/test/{waveform-utils.js → waveform-utils.jsdom.test.js} +0 -0
@@ -9,13 +9,13 @@ import {
9
9
  useInnerBlocksProps,
10
10
  privateApis as blockEditorPrivateApis
11
11
  } from "@wordpress/block-editor";
12
- import { __ } from "@wordpress/i18n";
12
+ import { __, sprintf } from "@wordpress/i18n";
13
13
  import { store as coreStore } from "@wordpress/core-data";
14
+ import { store as noticesStore } from "@wordpress/notices";
14
15
  import EnhancedPaginationControl from "./inspector-controls/enhanced-pagination-control.mjs";
15
16
  import { unlock } from "../../lock-unlock.mjs";
16
17
  import QueryInspectorControls from "./inspector-controls/index.mjs";
17
- import EnhancedPaginationModal from "./enhanced-pagination-modal.mjs";
18
- import { getQueryContextFromTemplate } from "../utils.mjs";
18
+ import { getQueryContextFromTemplate, useUnsupportedBlocks } from "../utils.mjs";
19
19
  import QueryToolbar from "./query-toolbar.mjs";
20
20
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
21
  var { HTMLElementControl } = unlock(blockEditorPrivateApis);
@@ -38,6 +38,8 @@ function QueryContent({
38
38
  const { templateSlug, postType } = context;
39
39
  const { isSingular, templateType } = getQueryContextFromTemplate(templateSlug);
40
40
  const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(blockEditorStore);
41
+ const { createNotice } = useDispatch(noticesStore);
42
+ const unsupportedBlocks = useUnsupportedBlocks(clientId);
41
43
  const instanceId = useInstanceId(QueryContent);
42
44
  const blockProps = useBlockProps();
43
45
  const innerBlocksProps = useInnerBlocksProps(blockProps);
@@ -94,6 +96,33 @@ function QueryContent({
94
96
  __unstableMarkNextChangeAsNotPersistent,
95
97
  setAttributes
96
98
  ]);
99
+ useEffect(() => {
100
+ if (enhancedPagination && unsupportedBlocks.length) {
101
+ __unstableMarkNextChangeAsNotPersistent();
102
+ setAttributes({ enhancedPagination: false });
103
+ const message = sprintf(
104
+ /* translators: %s: A list of block titles. */
105
+ __(
106
+ `"Reload full page" was enabled because some blocks inside the Query block aren't supported: %s.`
107
+ ),
108
+ unsupportedBlocks.join(
109
+ /* translators: Used between list items, there is a space after the comma. */
110
+ __(", ")
111
+ // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
112
+ )
113
+ );
114
+ createNotice("info", message, {
115
+ type: "snackbar",
116
+ id: "query-enhanced-pagination-disabled"
117
+ });
118
+ }
119
+ }, [
120
+ enhancedPagination,
121
+ unsupportedBlocks,
122
+ __unstableMarkNextChangeAsNotPersistent,
123
+ setAttributes,
124
+ createNotice
125
+ ]);
97
126
  return /* @__PURE__ */ jsxs(Fragment, { children: [
98
127
  isSelected && /* @__PURE__ */ jsx(
99
128
  QueryToolbar,
@@ -103,14 +132,6 @@ function QueryContent({
103
132
  hasInnerBlocks: true
104
133
  }
105
134
  ),
106
- /* @__PURE__ */ jsx(
107
- EnhancedPaginationModal,
108
- {
109
- attributes,
110
- setAttributes,
111
- clientId
112
- }
113
- ),
114
135
  /* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsx(
115
136
  QueryInspectorControls,
116
137
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/query/edit/query-content.jsx"],
4
- "sourcesContent": ["import { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n\tisSelected,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug, postType } = context;\n\tconst { isSingular, templateType } =\n\t\tgetQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\n\t// Whether the \"exclude current\" filter applies: we're in a singular template\n\t// and the post type matches the query.\n\tconst shouldExcludeCurrentPost =\n\t\tisSingular &&\n\t\t! inherit &&\n\t\t( query.postType === postType || query.postType === templateType );\n\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// Remove the exclusion when it no longer applies, so the filters stay\n\t\t// clean. We never force it on: enabling the exclusion is left to the\n\t\t// user. An absent key is already clean — writing `null` into it would\n\t\t// change the serialized markup of every pre-existing Query block just\n\t\t// by opening the editor.\n\t\tif (\n\t\t\t! shouldExcludeCurrentPost &&\n\t\t\tquery.excludeCurrent !== undefined &&\n\t\t\tquery.excludeCurrent !== null\n\t\t) {\n\t\t\tnewQuery.excludeCurrent = null;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.excludeCurrent,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\tshouldExcludeCurrentPost,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\thasInnerBlocks\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<EnhancedPaginationModal\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<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t\tshouldExcludeCurrentPost={ shouldExcludeCurrentPost }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<Tag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AAA,IACD;AAAA,IACA,oBAAC,qBACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IACA,qBAAC,qBAAkB,OAAM,YACxB;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,SAAU;AAAA,UACV,UAAW,CAAE,UACZ,cAAe,EAAE,SAAS,MAAM,CAAE;AAAA,UAEnC;AAAA,UACA,SAAU;AAAA,YACT,EAAE,OAAO,GAAI,iBAAkB,GAAG,OAAO,MAAM;AAAA,YAC/C,EAAE,OAAO,UAAU,OAAO,OAAO;AAAA,YACjC,EAAE,OAAO,aAAa,OAAO,UAAU;AAAA,YACvC,EAAE,OAAO,WAAW,OAAO,QAAQ;AAAA,UACpC;AAAA;AAAA,MACD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,IACA,oBAAC,WAAU,GAAG,kBAAmB;AAAA,KAClC;AAEF;",
4
+ "sourcesContent": ["import { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport { getQueryContextFromTemplate, useUnsupportedBlocks } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n\tisSelected,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug, postType } = context;\n\tconst { isSingular, templateType } =\n\t\tgetQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst unsupportedBlocks = useUnsupportedBlocks( clientId );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\n\t// Whether the \"exclude current\" filter applies: we're in a singular template\n\t// and the post type matches the query.\n\tconst shouldExcludeCurrentPost =\n\t\tisSingular &&\n\t\t! inherit &&\n\t\t( query.postType === postType || query.postType === templateType );\n\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// Remove the exclusion when it no longer applies, so the filters stay\n\t\t// clean. We never force it on: enabling the exclusion is left to the\n\t\t// user. An absent key is already clean — writing `null` into it would\n\t\t// change the serialized markup of every pre-existing Query block just\n\t\t// by opening the editor.\n\t\tif (\n\t\t\t! shouldExcludeCurrentPost &&\n\t\t\tquery.excludeCurrent !== undefined &&\n\t\t\tquery.excludeCurrent !== null\n\t\t) {\n\t\t\tnewQuery.excludeCurrent = null;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.excludeCurrent,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\tshouldExcludeCurrentPost,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tuseEffect( () => {\n\t\tif ( enhancedPagination && unsupportedBlocks.length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { enhancedPagination: false } );\n\t\t\tconst message = sprintf(\n\t\t\t\t/* translators: %s: A list of block titles. */\n\t\t\t\t__(\n\t\t\t\t\t`\"Reload full page\" was enabled because some blocks inside the Query block aren't supported: %s.`\n\t\t\t\t),\n\t\t\t\tunsupportedBlocks.join(\n\t\t\t\t\t/* translators: Used between list items, there is a space after the comma. */\n\t\t\t\t\t__( ', ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t\t)\n\t\t\t);\n\t\t\tcreateNotice( 'info', message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'query-enhanced-pagination-disabled',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tenhancedPagination,\n\t\tunsupportedBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t\tcreateNotice,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\thasInnerBlocks\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t\tshouldExcludeCurrentPost={ shouldExcludeCurrentPost }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,qBAAqB;AAC9B,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,oBAAoB;AACtC,OAAO,+BAA+B;AACtC,SAAS,cAAc;AACvB,OAAO,4BAA4B;AACnC,SAAS,6BAA6B,4BAA4B;AAClE,OAAO,kBAAkB;AA0JvB,mBAEE,KAiBD,YAnBD;AAxJF,IAAM,EAAE,mBAAmB,IAAI,OAAQ,sBAAuB;AAE9D,IAAM,0BAA0B;AAEjB,SAAR,aAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,UAAU;AAAA,IACnB,OAAO,EAAE,QAAQ,IAAI,CAAC;AAAA,EACvB,IAAI;AAC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,CAAE;AAAA,UAEnC;AAAA,UACA,SAAU;AAAA,YACT,EAAE,OAAO,GAAI,iBAAkB,GAAG,OAAO,MAAM;AAAA,YAC/C,EAAE,OAAO,UAAU,OAAO,OAAO;AAAA,YACjC,EAAE,OAAO,aAAa,OAAO,UAAU;AAAA,YACvC,EAAE,OAAO,WAAW,OAAO,QAAQ;AAAA,UACpC;AAAA;AAAA,MACD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,IACA,oBAAC,WAAU,GAAG,kBAAmB;AAAA,KAClC;AAEF;",
6
6
  "names": []
7
7
  }
@@ -5,11 +5,7 @@ import { store as coreStore } from "@wordpress/core-data";
5
5
  import { store as blockEditorStore } from "@wordpress/block-editor";
6
6
  import { decodeEntities } from "@wordpress/html-entities";
7
7
  import { __ } from "@wordpress/i18n";
8
- import {
9
- cloneBlock,
10
- getBlockSupport,
11
- store as blocksStore
12
- } from "@wordpress/blocks";
8
+ import { cloneBlock, store as blocksStore } from "@wordpress/blocks";
13
9
  var getEntitiesInfo = (entities) => {
14
10
  const mapping = entities?.reduce(
15
11
  (accumulator, entity) => {
@@ -260,7 +256,9 @@ var useUnsupportedBlocks = (clientId) => {
260
256
  return useSelect(
261
257
  (select) => {
262
258
  const { getClientIdsOfDescendants, getBlockName } = select(blockEditorStore);
263
- return getClientIdsOfDescendants(clientId).some(
259
+ const { getBlockSupport, getBlockType } = select(blocksStore);
260
+ const blockTitles = /* @__PURE__ */ new Set();
261
+ getClientIdsOfDescendants(clientId).forEach(
264
262
  (descendantClientId) => {
265
263
  const blockName = getBlockName(descendantClientId);
266
264
  const blockSupportsInteractivity = Object.is(
@@ -271,9 +269,14 @@ var useUnsupportedBlocks = (clientId) => {
271
269
  blockName,
272
270
  "interactivity.clientNavigation"
273
271
  );
274
- return !blockSupportsInteractivity && !blockSupportsInteractivityClientNavigation;
272
+ if (!blockSupportsInteractivity && !blockSupportsInteractivityClientNavigation) {
273
+ blockTitles.add(
274
+ getBlockType(blockName)?.title || blockName
275
+ );
276
+ }
275
277
  }
276
278
  );
279
+ return [...blockTitles];
277
280
  },
278
281
  [clientId]
279
282
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/query/utils.js"],
4
- "sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcloneBlock,\n\tgetBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n/** @typedef {import('@wordpress/components/build-types/query-controls/types').OrderByOption} OrderByOption */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n * 3. A helper map with post format support per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\tconst postTypeFormatSupportMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] =\n\t\t\t\ttype.supports?.[ 'post-formats' ] || false;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\treturn {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t};\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * List of avaiable options to order by.\n *\n * @param {string} postType The post type to check.\n * @return {OrderByOption[]} List of order options.\n */\nexport function useOrderByOptions( postType ) {\n\tconst supportsCustomOrder = useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn !! type?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst orderByOptions = [\n\t\t\t{\n\t\t\t\tlabel: __( 'Newest to oldest' ),\n\t\t\t\tvalue: 'date/desc',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Oldest to newest' ),\n\t\t\t\tvalue: 'date/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\t\t\tlabel: __( 'A → Z' ),\n\t\t\t\tvalue: 'title/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\t\t\tlabel: __( 'Z → A' ),\n\t\t\t\tvalue: 'title/desc',\n\t\t\t},\n\t\t];\n\n\t\tif ( supportsCustomOrder ) {\n\t\t\torderByOptions.push(\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by ascending menu order. */\n\t\t\t\t\tlabel: __( 'Ascending by order' ),\n\t\t\t\t\tvalue: 'menu_order/asc',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by descending menu order. */\n\t\t\t\t\tlabel: __( 'Descending by order' ),\n\t\t\t\t\tvalue: 'menu_order/desc',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn orderByOptions;\n\t}, [ supportsCustomOrder ] );\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst activeVariationName = select(\n\t\t\t\tblocksStore\n\t\t\t).getActiveBlockVariation( 'core/query', attributes )?.name;\n\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn 'core/query';\n\t\t\t}\n\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\t`core/query/${ activeVariationName }`,\n\t\t\t\trootClientId\n\t\t\t);\n\n\t\t\treturn activePatterns.length > 0\n\t\t\t\t? `core/query/${ activeVariationName }`\n\t\t\t\t: 'core/query';\n\t\t},\n\t\t[ clientId, attributes ]\n\t);\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * Hook that, given a block clientId, determines if it has unsupported blocks or not.\n *\n * @param {string} clientId The block's client ID.\n * @return {boolean} True if there are any unsupported blocks.\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\treturn getClientIdsOfDescendants( clientId ).some(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! blockSupportsInteractivity &&\n\t\t\t\t\t\t! blockSupportsInteractivityClientNavigation\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n\n/**\n * Helper function that returns the query context from the editor based on the\n * available template slug.\n *\n * @param {string} templateSlug Current template slug based on context.\n * @return {Object} An object with isSingular and templateType properties.\n */\nexport function getQueryContextFromTemplate( templateSlug ) {\n\t// In the Post Editor, the template slug is not available.\n\tif ( ! templateSlug ) {\n\t\treturn { isSingular: true };\n\t}\n\tlet isSingular = false;\n\tlet templateType = templateSlug === 'wp' ? 'custom' : templateSlug;\n\tconst singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];\n\tconst templateTypeFromSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-', 1 )[ 0 ]\n\t\t: templateSlug;\n\tconst queryFromTemplateSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-' ).slice( 1 ).join( '-' )\n\t\t: '';\n\tif ( queryFromTemplateSlug ) {\n\t\ttemplateType = templateTypeFromSlug;\n\t}\n\tisSingular = singularTemplates.includes( templateType );\n\n\treturn { isSingular, templateType };\n}\n"],
5
- "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AA8BA,IAAM,kBAAkB,CAAE,aAAc;AAC9C,QAAM,UAAU,UAAU;AAAA,IACzB,CAAE,aAAa,WAAY;AAC1B,YAAM,EAAE,SAAS,WAAW,MAAM,IAAI;AACtC,cAAS,OAAO,EAAG,IAAI;AACvB,gBAAW,OAAO,IAAK,IAAI;AAC3B,YAAM,KAAM,OAAO,IAAK;AACxB,aAAO;AAAA,IACR;AAAA,IACA,EAAE,SAAS,CAAC,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,EACzC;AACA,SAAO;AAAA,IACN;AAAA,IACA,GAAG;AAAA,EACJ;AACD;AAWO,IAAM,yBAAyB,CAAE,QAAQ,SAAU;AACzD,QAAM,iBAAiB,KAAK,MAAO,GAAI;AACvC,MAAI,QAAQ;AACZ,iBAAe,QAAS,CAAE,cAAe;AACxC,YAAQ,QAAS,SAAU;AAAA,EAC5B,CAAE;AACF,SAAO;AACR;AAWO,IAAM,qBAAqB,CAAE,UAAU,SAAU;AACvD,UAAS,YAAY,CAAC,GAAI,IAAK,CAAE,YAAc;AAAA,IAC9C,GAAG;AAAA,IACH,MAAM,eAAgB,uBAAwB,QAAQ,IAAK,CAAE;AAAA,EAC9D,EAAI;AACL;AAUO,IAAM,eAAe,MAAM;AACjC,QAAM,YAAY,UAAW,CAAE,WAAY;AAC1C,UAAM,EAAE,aAAa,IAAI,OAAQ,SAAU;AAC3C,UAAM,oBAAoB,CAAE,YAAa;AACzC,UAAM,oBAAoB,aAAc,EAAE,UAAU,GAA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E,uBAAwB;AACzB,gBAAM,YAAY,aAAc,kBAAmB;AAMnD,gBAAM,6BAA6B,OAAO;AAAA,YACzC,gBAAiB,WAAW,eAAgB;AAAA,YAC5C;AAAA,UACD;AACA,gBAAM,6CACL;AAAA,YACC;AAAA,YACA;AAAA,UACD;AAED,iBACC,CAAE,8BACF,CAAE;AAAA,QAEJ;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD;AASO,SAAS,4BAA6B,cAAe;AAE3D,MAAK,CAAE,cAAe;AACrB,WAAO,EAAE,YAAY,KAAK;AAAA,EAC3B;AACA,MAAI,aAAa;AACjB,MAAI,eAAe,iBAAiB,OAAO,WAAW;AACtD,QAAM,oBAAoB,CAAE,OAAO,SAAS,UAAU,QAAQ,QAAS;AACvE,QAAM,uBAAuB,aAAa,SAAU,GAAI,IACrD,aAAa,MAAO,KAAK,CAAE,EAAG,CAAE,IAChC;AACH,QAAM,wBAAwB,aAAa,SAAU,GAAI,IACtD,aAAa,MAAO,GAAI,EAAE,MAAO,CAAE,EAAE,KAAM,GAAI,IAC/C;AACH,MAAK,uBAAwB;AAC5B,mBAAe;AAAA,EAChB;AACA,eAAa,kBAAkB,SAAU,YAAa;AAEtD,SAAO,EAAE,YAAY,aAAa;AACnC;",
4
+ "sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { cloneBlock, store as blocksStore } from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n/** @typedef {import('@wordpress/components/build-types/query-controls/types').OrderByOption} OrderByOption */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n * 3. A helper map with post format support per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\tconst postTypeFormatSupportMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] =\n\t\t\t\ttype.supports?.[ 'post-formats' ] || false;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\treturn {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t};\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * List of available options to order by.\n *\n * @param {string} postType The post type to check.\n * @return {OrderByOption[]} List of order options.\n */\nexport function useOrderByOptions( postType ) {\n\tconst supportsCustomOrder = useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn !! type?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst orderByOptions = [\n\t\t\t{\n\t\t\t\tlabel: __( 'Newest to oldest' ),\n\t\t\t\tvalue: 'date/desc',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Oldest to newest' ),\n\t\t\t\tvalue: 'date/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\t\t\tlabel: __( 'A → Z' ),\n\t\t\t\tvalue: 'title/asc',\n\t\t\t},\n\t\t\t{\n\t\t\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\t\t\tlabel: __( 'Z → A' ),\n\t\t\t\tvalue: 'title/desc',\n\t\t\t},\n\t\t];\n\n\t\tif ( supportsCustomOrder ) {\n\t\t\torderByOptions.push(\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by ascending menu order. */\n\t\t\t\t\tlabel: __( 'Ascending by order' ),\n\t\t\t\t\tvalue: 'menu_order/asc',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t/* translators: Label for ordering posts by descending menu order. */\n\t\t\t\t\tlabel: __( 'Descending by order' ),\n\t\t\t\t\tvalue: 'menu_order/desc',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn orderByOptions;\n\t}, [ supportsCustomOrder ] );\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst activeVariationName = select(\n\t\t\t\tblocksStore\n\t\t\t).getActiveBlockVariation( 'core/query', attributes )?.name;\n\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn 'core/query';\n\t\t\t}\n\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\t`core/query/${ activeVariationName }`,\n\t\t\t\trootClientId\n\t\t\t);\n\n\t\t\treturn activePatterns.length > 0\n\t\t\t\t? `core/query/${ activeVariationName }`\n\t\t\t\t: 'core/query';\n\t\t},\n\t\t[ clientId, attributes ]\n\t);\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * Hook that, given a block clientId, returns the titles of the unsupported\n * blocks it contains, without duplicates.\n *\n * @param {string} clientId The block's client ID.\n * @return {string[]} The titles of the unsupported blocks.\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 { getBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockTitles = new Set();\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! blockSupportsInteractivity &&\n\t\t\t\t\t\t! blockSupportsInteractivityClientNavigation\n\t\t\t\t\t) {\n\t\t\t\t\t\tblockTitles.add(\n\t\t\t\t\t\t\tgetBlockType( blockName )?.title || blockName\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\treturn [ ...blockTitles ];\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n\n/**\n * Helper function that returns the query context from the editor based on the\n * available template slug.\n *\n * @param {string} templateSlug Current template slug based on context.\n * @return {Object} An object with isSingular and templateType properties.\n */\nexport function getQueryContextFromTemplate( templateSlug ) {\n\t// In the Post Editor, the template slug is not available.\n\tif ( ! templateSlug ) {\n\t\treturn { isSingular: true };\n\t}\n\tlet isSingular = false;\n\tlet templateType = templateSlug === 'wp' ? 'custom' : templateSlug;\n\tconst singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];\n\tconst templateTypeFromSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-', 1 )[ 0 ]\n\t\t: templateSlug;\n\tconst queryFromTemplateSlug = templateSlug.includes( '-' )\n\t\t? templateSlug.split( '-' ).slice( 1 ).join( '-' )\n\t\t: '';\n\tif ( queryFromTemplateSlug ) {\n\t\ttemplateType = templateTypeFromSlug;\n\t}\n\tisSingular = singularTemplates.includes( templateType );\n\n\treturn { isSingular, templateType };\n}\n"],
5
+ "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AACnB,SAAS,YAAY,SAAS,mBAAmB;AA8B1C,IAAM,kBAAkB,CAAE,aAAc;AAC9C,QAAM,UAAU,UAAU;AAAA,IACzB,CAAE,aAAa,WAAY;AAC1B,YAAM,EAAE,SAAS,WAAW,MAAM,IAAI;AACtC,cAAS,OAAO,EAAG,IAAI;AACvB,gBAAW,OAAO,IAAK,IA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AAe;AAE3D,MAAK,CAAE,cAAe;AACrB,WAAO,EAAE,YAAY,KAAK;AAAA,EAC3B;AACA,MAAI,aAAa;AACjB,MAAI,eAAe,iBAAiB,OAAO,WAAW;AACtD,QAAM,oBAAoB,CAAE,OAAO,SAAS,UAAU,QAAQ,QAAS;AACvE,QAAM,uBAAuB,aAAa,SAAU,GAAI,IACrD,aAAa,MAAO,KAAK,CAAE,EAAG,CAAE,IAChC;AACH,QAAM,wBAAwB,aAAa,SAAU,GAAI,IACtD,aAAa,MAAO,GAAI,EAAE,MAAO,CAAE,EAAE,KAAM,GAAI,IAC/C;AACH,MAAK,uBAAwB;AAC5B,mBAAe;AAAA,EAChB;AACA,eAAa,kBAAkB,SAAU,YAAa;AAEtD,SAAO,EAAE,YAAY,aAAa;AACnC;",
6
6
  "names": []
7
7
  }
@@ -26,10 +26,11 @@ import {
26
26
  __experimentalVStack as VStack
27
27
  } from "@wordpress/components";
28
28
  import { useInstanceId } from "@wordpress/compose";
29
- import { Icon, search } from "@wordpress/icons";
29
+ import { Icon } from "@wordpress/icons";
30
30
  import { __, sprintf } from "@wordpress/i18n";
31
31
  import { __unstableStripHTML as stripHTML } from "@wordpress/dom";
32
32
  import { speak } from "@wordpress/a11y";
33
+ import { Path, SVG } from "@wordpress/primitives";
33
34
  import {
34
35
  PC_WIDTH_DEFAULT,
35
36
  PX_WIDTH_DEFAULT,
@@ -51,6 +52,7 @@ var TAG_NAME_MESSAGES = {
51
52
  };
52
53
  var DEFAULT_INNER_PADDING = "4px";
53
54
  var PERCENTAGE_WIDTHS = [25, 50, 75, 100];
55
+ var searchBlockIcon = /* @__PURE__ */ jsx(SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });
54
56
  function SearchEdit({
55
57
  className,
56
58
  attributes,
@@ -232,7 +234,7 @@ function SearchEdit({
232
234
  style: buttonStyles,
233
235
  "aria-label": buttonText ? stripHTML(buttonText) : __("Search"),
234
236
  ref: buttonRef,
235
- children: /* @__PURE__ */ jsx(Icon, { icon: search })
237
+ children: /* @__PURE__ */ jsx(Icon, { icon: searchBlockIcon })
236
238
  }
237
239
  ),
238
240
  !buttonUseIcon && /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/search/edit.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { speak } from '@wordpress/a11y';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Help text describing each wrapper element option. Kept local to the block\n// because the choices and their guidance are specific to the Search block.\nconst TAG_NAME_MESSAGES = {\n\t'': __(\n\t\t'Lets the theme decide. Uses the <search> landmark element if the theme opts in, otherwise a <form>.'\n\t),\n\tsearch: __(\n\t\t'Wraps the block in a <search> landmark, announced as a search region by assistive technologies.'\n\t),\n\tform: __(\n\t\t'Uses a <form role=\"search\"> wrapper for backward compatibility with existing theme styles.'\n\t),\n};\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\ttagName,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst isSearchFieldHidden = hasOnlyButton && ! isSelected;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\tisSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\thasNoButton ? colorProps.className : undefined,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( hasNoButton ? colorProps.style : {} ),\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\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};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\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\tbuttonUseIcon: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\tvalue={ tagName ?? '' }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default' ), value: '' },\n\t\t\t\t\t\t{ label: '<search>', value: 'search' },\n\t\t\t\t\t\t{ label: '<form>', value: 'form' },\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tsetAttributes( { tagName: value } );\n\t\t\t\t\t\t// The help text is updated via aria-describedby, which\n\t\t\t\t\t\t// is not re-announced while focus remains on the select.\n\t\t\t\t\t\t// Announce the new description so it is not missed.\n\t\t\t\t\t\t// speak() strips HTML-like tags, which would drop the\n\t\t\t\t\t\t// element names (e.g. <search>) entirely. Remove only the\n\t\t\t\t\t\t// angle brackets so the words are retained when spoken.\n\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\tTAG_NAME_MESSAGES[ value ].replace( /[<>]/g, '' )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ TAG_NAME_MESSAGES[ tagName ?? '' ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst isNonZeroBorderRadius = ( radius ) =>\n\t\tradius !== undefined && parseInt( radius, 10 ) !== 0;\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tisNonZeroBorderRadius( radius )\n\t\t\t? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`\n\t\t\t: undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tif ( isButtonPositionInside ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\tborderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius,\n\t\t\t\t} = borderProps.style;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tpadBorderRadius( borderTopRightRadius ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomLeftRadius\n\t\t\t\t\t),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomRightRadius\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\t// Reflect an explicit <search> choice in the editor markup so wrapper\n\t// styles match the front end. The <form> and theme-deferred default keep\n\t// the historical <div> to avoid nesting a live <form> in the editor.\n\tconst Wrapper = 'search' === tagName ? 'search' : 'div';\n\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t<Wrapper { ...blockProps }>\n\t\t\t\t{ showLabel && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t<ResizableBox\n\t\t\t\t\tsize={ {\n\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\t\tisButtonPositionInside\n\t\t\t\t\t\t\t? borderProps.className\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\t\tenable={ getResizableSides() }\n\t\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t>\n\t\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t\t</ResizableBox>\n\t\t\t</Wrapper>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,WAAW,cAAc;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,wBAAwB;AAAA,OAClB;AACP,SAAS,qBAAqB;AAC9B,SAAS,MAAM,cAAc;AAC7B,SAAS,IAAI,eAAe;AAC5B,SAAS,uBAAuB,iBAAiB;AACjD,SAAS,aAAa;AACtB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,sCAAsC;AAsM5C,SAgDA,UAhDA,KAgDA,YAhDA;AAlMH,IAAM,oBAAoB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AAA,cAChB,aAAa;AAAA,eAChB;AAAA,YAGC,eAAe,gBAAgB;AAAA;AAAA;AAAA,MAClC;AAAA,OACD;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { speak } from '@wordpress/a11y';\nimport { Path, SVG } from '@wordpress/primitives';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Help text describing each wrapper element option. Kept local to the block\n// because the choices and their guidance are specific to the Search block.\nconst TAG_NAME_MESSAGES = {\n\t'': __(\n\t\t'Lets the theme decide. Uses the <search> landmark element if the theme opts in, otherwise a <form>.'\n\t),\n\tsearch: __(\n\t\t'Wraps the block in a <search> landmark, announced as a search region by assistive technologies.'\n\t),\n\tform: __(\n\t\t'Uses a <form role=\"search\"> wrapper for backward compatibility with existing theme styles.'\n\t),\n};\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\n// Keep this block-specific icon aligned with the PHP renderer. Unlike the\n// Search icon from @wordpress/icons, it remains fill-based so existing theme\n// styles continue to work in both the editor and the front end.\nconst searchBlockIcon = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z\" />\n\t</SVG>\n);\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\ttagName,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst isSearchFieldHidden = hasOnlyButton && ! isSelected;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\tisSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\thasNoButton ? colorProps.className : undefined,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( hasNoButton ? colorProps.style : {} ),\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ searchBlockIcon } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\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};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\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\tbuttonUseIcon: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\tvalue={ tagName ?? '' }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default' ), value: '' },\n\t\t\t\t\t\t{ label: '<search>', value: 'search' },\n\t\t\t\t\t\t{ label: '<form>', value: 'form' },\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tsetAttributes( { tagName: value } );\n\t\t\t\t\t\t// The help text is updated via aria-describedby, which\n\t\t\t\t\t\t// is not re-announced while focus remains on the select.\n\t\t\t\t\t\t// Announce the new description so it is not missed.\n\t\t\t\t\t\t// speak() strips HTML-like tags, which would drop the\n\t\t\t\t\t\t// element names (e.g. <search>) entirely. Remove only the\n\t\t\t\t\t\t// angle brackets so the words are retained when spoken.\n\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\tTAG_NAME_MESSAGES[ value ].replace( /[<>]/g, '' )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ TAG_NAME_MESSAGES[ tagName ?? '' ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst isNonZeroBorderRadius = ( radius ) =>\n\t\tradius !== undefined && parseInt( radius, 10 ) !== 0;\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tisNonZeroBorderRadius( radius )\n\t\t\t? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`\n\t\t\t: undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tif ( isButtonPositionInside ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\tborderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius,\n\t\t\t\t} = borderProps.style;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tpadBorderRadius( borderTopRightRadius ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomLeftRadius\n\t\t\t\t\t),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomRightRadius\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\t// Reflect an explicit <search> choice in the editor markup so wrapper\n\t// styles match the front end. The <form> and theme-deferred default keep\n\t// the historical <div> to avoid nesting a live <form> in the editor.\n\tconst Wrapper = 'search' === tagName ? 'search' : 'div';\n\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t<Wrapper { ...blockProps }>\n\t\t\t\t{ showLabel && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t<ResizableBox\n\t\t\t\t\tsize={ {\n\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\t\tisButtonPositionInside\n\t\t\t\t\t\t\t? borderProps.className\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\t\tenable={ getResizableSides() }\n\t\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t>\n\t\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t\t</ResizableBox>\n\t\t\t</Wrapper>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,WAAW,cAAc;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,wBAAwB;AAAA,OAClB;AACP,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,IAAI,eAAe;AAC5B,SAAS,uBAAuB,iBAAiB;AACjD,SAAS,aAAa;AACtB,SAAS,MAAM,WAAW;AA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AA,UACA,cAAe,CAAE,OAAO,WAAW,KAAK,UAAW;AAClD,0BAAe;AAAA,cACd,OAAO,SAAU,QAAQ,MAAM,OAAO,EAAG;AAAA,YAC1C,CAAE;AACF,4BAAiB,IAAK;AAAA,UACvB;AAAA,UACA,YAAa;AAAA,UAET;AAAA,uCACH,2BACA,kBACA,iCACG;AAAA,8BAAgB;AAAA,cAChB,aAAa;AAAA,eAChB;AAAA,YAGC,eAAe,gBAAgB;AAAA;AAAA;AAAA,MAClC;AAAA,OACD;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,10 @@
1
1
  // packages/block-library/src/search/index.js
2
2
  import { __ } from "@wordpress/i18n";
3
3
  import { search as icon } from "@wordpress/icons";
4
- import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
5
4
  import initBlock from "../utils/init-block.mjs";
6
5
  import metadata from "./block.json";
7
6
  import edit from "./edit.mjs";
8
7
  import variations from "./variations.mjs";
9
- import { unlock } from "../lock-unlock.mjs";
10
- var { fieldsKey, formKey } = unlock(blocksPrivateApis);
11
8
  var { name } = metadata;
12
9
  var settings = {
13
10
  icon,
@@ -18,34 +15,6 @@ var settings = {
18
15
  variations,
19
16
  edit
20
17
  };
21
- if (window.__experimentalContentOnlyInspectorFields) {
22
- settings[fieldsKey] = [
23
- {
24
- id: "label",
25
- label: __("Label"),
26
- type: "text",
27
- Edit: "rich-text"
28
- // TODO: replace with custom component
29
- },
30
- {
31
- id: "buttonText",
32
- label: __("Button text"),
33
- type: "text",
34
- Edit: "rich-text"
35
- // TODO: replace with custom component
36
- },
37
- {
38
- id: "placeholder",
39
- label: __("Placeholder"),
40
- type: "text",
41
- Edit: "rich-text"
42
- // TODO: replace with custom component
43
- }
44
- ];
45
- settings[formKey] = {
46
- fields: ["label", "buttonText", "placeholder"]
47
- };
48
- }
49
18
  var init = () => initBlock({ name, metadata, settings });
50
19
  export {
51
20
  init,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/search/index.js"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t\t{\n\t\t\tid: 'buttonText',\n\t\t\tlabel: __( 'Button text' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t\t{\n\t\t\tid: 'placeholder',\n\t\t\tlabel: __( 'Placeholder' ),\n\t\t\ttype: 'text',\n\t\t\tEdit: 'rich-text', // TODO: replace with custom component\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'label', 'buttonText', 'placeholder' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
- "mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe,yBAAyB;AACjD,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY,EAAE,YAAY,GAAI,QAAS,GAAG,OAAO,GAAI,QAAS,EAAE;AAAA,IAChE,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,aAAc;AAAA,MACzB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,aAAc;AAAA,MACzB,MAAM;AAAA,MACN,MAAM;AAAA;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAS,cAAc,aAAc;AAAA,EAChD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
4
+ "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
5
+ "mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAC/B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY,EAAE,YAAY,GAAI,QAAS,GAAG,OAAO,GAAI,QAAS,EAAE;AAAA,IAChE,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  // packages/block-library/src/site-tagline/edit.jsx
2
- import { useDispatch, useSelect } from "@wordpress/data";
3
- import { store as coreStore } from "@wordpress/core-data";
2
+ import { useSelect } from "@wordpress/data";
3
+ import { store as coreStore, useEntityProp } from "@wordpress/core-data";
4
4
  import {
5
5
  useBlockProps,
6
6
  BlockControls,
@@ -15,26 +15,20 @@ function SiteTaglineEdit(props) {
15
15
  useDeprecatedTextAlign(props);
16
16
  const { attributes, setAttributes, insertBlocksAfter } = props;
17
17
  const { level, levelOptions } = attributes;
18
- const { canUserEdit, tagline } = useSelect((select) => {
19
- const { canUser, getEntityRecord, getEditedEntityRecord } = select(coreStore);
20
- const canEdit = canUser("update", {
18
+ const canUserEdit = useSelect(
19
+ (select) => select(coreStore).canUser("update", {
21
20
  kind: "root",
22
21
  name: "site"
23
- });
24
- const settings = canEdit ? getEditedEntityRecord("root", "site") : {};
25
- const readOnlySettings = getEntityRecord("root", "__unstableBase");
26
- return {
27
- canUserEdit: canEdit,
28
- tagline: canEdit ? settings?.description : readOnlySettings?.description
29
- };
30
- }, []);
22
+ }),
23
+ []
24
+ );
25
+ const [tagline, setTagline] = useEntityProp(
26
+ "root",
27
+ canUserEdit ? "site" : "__unstableBase",
28
+ "description",
29
+ void 0
30
+ );
31
31
  const TagName = level === 0 ? "p" : `h${level}`;
32
- const { editEntityRecord } = useDispatch(coreStore);
33
- function setTagline(newTagline) {
34
- editEntityRecord("root", "site", void 0, {
35
- description: newTagline
36
- });
37
- }
38
32
  const blockProps = useBlockProps({
39
33
  className: !canUserEdit && !tagline && "wp-block-site-tagline__placeholder"
40
34
  });