@wordpress/block-library 9.3.0 → 9.5.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 (853) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/avatar/edit.js +1 -0
  3. package/build/avatar/edit.js.map +1 -1
  4. package/build/block/edit.js +38 -23
  5. package/build/block/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/index.js +26 -0
  9. package/build/buttons/index.js.map +1 -1
  10. package/build/categories/edit.js +20 -3
  11. package/build/categories/edit.js.map +1 -1
  12. package/build/categories/index.js +20 -0
  13. package/build/categories/index.js.map +1 -1
  14. package/build/column/edit.js +2 -2
  15. package/build/column/edit.js.map +1 -1
  16. package/build/column/index.js +2 -0
  17. package/build/column/index.js.map +1 -1
  18. package/build/columns/index.js +2 -2
  19. package/build/columns/index.js.map +1 -1
  20. package/build/comment-template/index.js +12 -0
  21. package/build/comment-template/index.js.map +1 -1
  22. package/build/comments-title/deprecated.js +3 -0
  23. package/build/comments-title/deprecated.js.map +1 -1
  24. package/build/comments-title/edit.js +3 -1
  25. package/build/comments-title/edit.js.map +1 -1
  26. package/build/comments-title/index.js +3 -0
  27. package/build/comments-title/index.js.map +1 -1
  28. package/build/cover/edit/inspector-controls.js +2 -1
  29. package/build/cover/edit/inspector-controls.js.map +1 -1
  30. package/build/details/edit.js +1 -0
  31. package/build/details/edit.js.map +1 -1
  32. package/build/embed/variations.js +39 -34
  33. package/build/embed/variations.js.map +1 -1
  34. package/build/footnotes/index.js +1 -1
  35. package/build/footnotes/index.js.map +1 -1
  36. package/build/form/edit.js +4 -4
  37. package/build/form/edit.js.map +1 -1
  38. package/build/form-input/edit.js +3 -0
  39. package/build/form-input/edit.js.map +1 -1
  40. package/build/gallery/edit.js +42 -8
  41. package/build/gallery/edit.js.map +1 -1
  42. package/build/gallery/gap-styles.js +1 -9
  43. package/build/gallery/gap-styles.js.map +1 -1
  44. package/build/gallery/index.js +10 -0
  45. package/build/gallery/index.js.map +1 -1
  46. package/build/gallery/use-image-sizes.js +2 -2
  47. package/build/gallery/use-image-sizes.js.map +1 -1
  48. package/build/group/deprecated.js +2 -5
  49. package/build/group/deprecated.js.map +1 -1
  50. package/build/group/index.js +27 -30
  51. package/build/group/index.js.map +1 -1
  52. package/build/group/variations.js +51 -3
  53. package/build/group/variations.js.map +1 -1
  54. package/build/heading/edit.js +2 -0
  55. package/build/heading/edit.js.map +1 -1
  56. package/build/heading/index.js +17 -1
  57. package/build/heading/index.js.map +1 -1
  58. package/build/image/edit.js +1 -1
  59. package/build/image/edit.js.map +1 -1
  60. package/build/image/image.js +24 -11
  61. package/build/image/image.js.map +1 -1
  62. package/build/image/index.js +3 -0
  63. package/build/image/index.js.map +1 -1
  64. package/build/image/view.js +65 -49
  65. package/build/image/view.js.map +1 -1
  66. package/build/latest-comments/index.js +9 -0
  67. package/build/latest-comments/index.js.map +1 -1
  68. package/build/latest-posts/edit.js +1 -0
  69. package/build/latest-posts/edit.js.map +1 -1
  70. package/build/list/edit.js +3 -3
  71. package/build/list/edit.js.map +1 -1
  72. package/build/list/index.js +1 -1
  73. package/build/list/ordered-list-settings.js +19 -17
  74. package/build/list/ordered-list-settings.js.map +1 -1
  75. package/build/list-item/edit.js +2 -2
  76. package/build/list-item/edit.js.map +1 -1
  77. package/build/list-item/hooks/index.js +0 -7
  78. package/build/list-item/hooks/index.js.map +1 -1
  79. package/build/list-item/index.js +3 -2
  80. package/build/list-item/index.js.map +1 -1
  81. package/build/loginout/index.js +14 -1
  82. package/build/loginout/index.js.map +1 -1
  83. package/build/media-text/index.js +12 -0
  84. package/build/media-text/index.js.map +1 -1
  85. package/build/navigation/edit/index.js +5 -4
  86. package/build/navigation/edit/index.js.map +1 -1
  87. package/build/navigation/edit/navigation-menu-delete-control.js +1 -0
  88. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  89. package/build/navigation/use-navigation-menu.js +5 -1
  90. package/build/navigation/use-navigation-menu.js.map +1 -1
  91. package/build/navigation-link/link-ui.js +13 -17
  92. package/build/navigation-link/link-ui.js.map +1 -1
  93. package/build/navigation-submenu/edit.js +0 -11
  94. package/build/navigation-submenu/edit.js.map +1 -1
  95. package/build/page-list/edit.js +1 -0
  96. package/build/page-list/edit.js.map +1 -1
  97. package/build/page-list-item/edit.js +4 -1
  98. package/build/page-list-item/edit.js.map +1 -1
  99. package/build/paragraph/index.js +6 -0
  100. package/build/paragraph/index.js.map +1 -1
  101. package/build/paragraph/transforms.js +6 -0
  102. package/build/paragraph/transforms.js.map +1 -1
  103. package/build/post-author/index.js +8 -0
  104. package/build/post-author/index.js.map +1 -1
  105. package/build/post-author-biography/index.js +3 -0
  106. package/build/post-author-biography/index.js.map +1 -1
  107. package/build/post-author-name/index.js +3 -0
  108. package/build/post-author-name/index.js.map +1 -1
  109. package/build/post-comments-form/index.js +12 -0
  110. package/build/post-comments-form/index.js.map +1 -1
  111. package/build/post-content/index.js +1 -0
  112. package/build/post-content/index.js.map +1 -1
  113. package/build/post-date/index.js +15 -0
  114. package/build/post-date/index.js.map +1 -1
  115. package/build/post-excerpt/edit.js +1 -0
  116. package/build/post-excerpt/edit.js.map +1 -1
  117. package/build/post-excerpt/index.js +12 -0
  118. package/build/post-excerpt/index.js.map +1 -1
  119. package/build/post-featured-image/index.js +3 -0
  120. package/build/post-featured-image/index.js.map +1 -1
  121. package/build/post-navigation-link/edit.js +2 -0
  122. package/build/post-navigation-link/edit.js.map +1 -1
  123. package/build/post-terms/index.js +15 -0
  124. package/build/post-terms/index.js.map +1 -1
  125. package/build/post-time-to-read/index.js +6 -0
  126. package/build/post-time-to-read/index.js.map +1 -1
  127. package/build/post-title/edit.js +9 -3
  128. package/build/post-title/edit.js.map +1 -1
  129. package/build/post-title/index.js +15 -0
  130. package/build/post-title/index.js.map +1 -1
  131. package/build/query/edit/inspector-controls/author-control.js +3 -1
  132. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  133. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +1 -0
  134. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  135. package/build/query/edit/inspector-controls/index.js +90 -12
  136. package/build/query/edit/inspector-controls/index.js.map +1 -1
  137. package/build/query/edit/inspector-controls/offset-controls.js +37 -0
  138. package/build/query/edit/inspector-controls/offset-controls.js.map +1 -0
  139. package/build/query/edit/inspector-controls/order-control.js +1 -0
  140. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  141. package/build/query/edit/inspector-controls/pages-control.js +36 -0
  142. package/build/query/edit/inspector-controls/pages-control.js.map +1 -0
  143. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  144. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  145. package/build/query/edit/inspector-controls/per-page-control.js +40 -0
  146. package/build/query/edit/inspector-controls/per-page-control.js.map +1 -0
  147. package/build/query/edit/inspector-controls/sticky-control.js +2 -1
  148. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
  149. package/build/query/edit/inspector-controls/taxonomy-controls.js +5 -2
  150. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  151. package/build/query/edit/query-content.js +11 -2
  152. package/build/query/edit/query-content.js.map +1 -1
  153. package/build/query/edit/query-placeholder.js +1 -14
  154. package/build/query/edit/query-placeholder.js.map +1 -1
  155. package/build/query/edit/query-toolbar.js +3 -76
  156. package/build/query/edit/query-toolbar.js.map +1 -1
  157. package/build/query/utils.js +15 -6
  158. package/build/query/utils.js.map +1 -1
  159. package/build/query/variations.js +9 -55
  160. package/build/query/variations.js.map +1 -1
  161. package/build/query-pagination-numbers/edit.js +1 -0
  162. package/build/query-pagination-numbers/edit.js.map +1 -1
  163. package/build/query-title/edit.js +13 -19
  164. package/build/query-title/edit.js.map +1 -1
  165. package/build/query-title/index.js +3 -0
  166. package/build/query-title/index.js.map +1 -1
  167. package/build/query-title/use-archive-label.js +95 -0
  168. package/build/query-title/use-archive-label.js.map +1 -0
  169. package/build/quote/index.js +15 -1
  170. package/build/quote/index.js.map +1 -1
  171. package/build/search/index.js +3 -0
  172. package/build/search/index.js.map +1 -1
  173. package/build/site-logo/edit.js +19 -9
  174. package/build/site-logo/edit.js.map +1 -1
  175. package/build/site-tagline/edit.js +8 -5
  176. package/build/site-tagline/edit.js.map +1 -1
  177. package/build/site-tagline/index.js +18 -2
  178. package/build/site-tagline/index.js.map +1 -1
  179. package/build/site-title/edit.js +6 -3
  180. package/build/site-title/edit.js.map +1 -1
  181. package/build/site-title/index.js +16 -1
  182. package/build/site-title/index.js.map +1 -1
  183. package/build/social-link/edit.js +0 -1
  184. package/build/social-link/edit.js.map +1 -1
  185. package/build/social-link/icons/soundcloud.js +1 -1
  186. package/build/social-link/icons/soundcloud.js.map +1 -1
  187. package/build/social-links/index.js +12 -0
  188. package/build/social-links/index.js.map +1 -1
  189. package/build/spacer/controls.js +8 -13
  190. package/build/spacer/controls.js.map +1 -1
  191. package/build/table-of-contents/index.js +14 -1
  192. package/build/table-of-contents/index.js.map +1 -1
  193. package/build/tag-cloud/edit.js +42 -33
  194. package/build/tag-cloud/edit.js.map +1 -1
  195. package/build/tag-cloud/index.js +1 -1
  196. package/build/template-part/edit/index.js +8 -5
  197. package/build/template-part/edit/index.js.map +1 -1
  198. package/build/template-part/edit/inner-blocks.js +11 -4
  199. package/build/template-part/edit/inner-blocks.js.map +1 -1
  200. package/build/template-part/edit/placeholder.js +23 -3
  201. package/build/template-part/edit/placeholder.js.map +1 -1
  202. package/build/template-part/edit/title-modal.js +20 -8
  203. package/build/template-part/edit/title-modal.js.map +1 -1
  204. package/build/term-description/index.js +12 -0
  205. package/build/term-description/index.js.map +1 -1
  206. package/build/utils/hooks.js +5 -1
  207. package/build/utils/hooks.js.map +1 -1
  208. package/build-module/avatar/edit.js +1 -0
  209. package/build-module/avatar/edit.js.map +1 -1
  210. package/build-module/block/edit.js +38 -23
  211. package/build-module/block/edit.js.map +1 -1
  212. package/build-module/button/edit.js +1 -1
  213. package/build-module/button/edit.js.map +1 -1
  214. package/build-module/buttons/index.js +26 -0
  215. package/build-module/buttons/index.js.map +1 -1
  216. package/build-module/categories/edit.js +21 -4
  217. package/build-module/categories/edit.js.map +1 -1
  218. package/build-module/categories/index.js +20 -0
  219. package/build-module/categories/index.js.map +1 -1
  220. package/build-module/column/edit.js +2 -2
  221. package/build-module/column/edit.js.map +1 -1
  222. package/build-module/column/index.js +2 -0
  223. package/build-module/column/index.js.map +1 -1
  224. package/build-module/columns/index.js +2 -2
  225. package/build-module/columns/index.js.map +1 -1
  226. package/build-module/comment-template/index.js +12 -0
  227. package/build-module/comment-template/index.js.map +1 -1
  228. package/build-module/comments-title/deprecated.js +3 -0
  229. package/build-module/comments-title/deprecated.js.map +1 -1
  230. package/build-module/comments-title/edit.js +3 -1
  231. package/build-module/comments-title/edit.js.map +1 -1
  232. package/build-module/comments-title/index.js +3 -0
  233. package/build-module/comments-title/index.js.map +1 -1
  234. package/build-module/cover/edit/inspector-controls.js +2 -1
  235. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  236. package/build-module/details/edit.js +1 -0
  237. package/build-module/details/edit.js.map +1 -1
  238. package/build-module/embed/variations.js +40 -35
  239. package/build-module/embed/variations.js.map +1 -1
  240. package/build-module/footnotes/index.js +1 -1
  241. package/build-module/footnotes/index.js.map +1 -1
  242. package/build-module/form/edit.js +4 -4
  243. package/build-module/form/edit.js.map +1 -1
  244. package/build-module/form-input/edit.js +3 -0
  245. package/build-module/form-input/edit.js.map +1 -1
  246. package/build-module/gallery/edit.js +43 -9
  247. package/build-module/gallery/edit.js.map +1 -1
  248. package/build-module/gallery/gap-styles.js +1 -9
  249. package/build-module/gallery/gap-styles.js.map +1 -1
  250. package/build-module/gallery/index.js +10 -0
  251. package/build-module/gallery/index.js.map +1 -1
  252. package/build-module/gallery/use-image-sizes.js +2 -2
  253. package/build-module/gallery/use-image-sizes.js.map +1 -1
  254. package/build-module/group/deprecated.js +2 -5
  255. package/build-module/group/deprecated.js.map +1 -1
  256. package/build-module/group/index.js +27 -30
  257. package/build-module/group/index.js.map +1 -1
  258. package/build-module/group/variations.js +51 -3
  259. package/build-module/group/variations.js.map +1 -1
  260. package/build-module/heading/edit.js +2 -0
  261. package/build-module/heading/edit.js.map +1 -1
  262. package/build-module/heading/index.js +17 -1
  263. package/build-module/heading/index.js.map +1 -1
  264. package/build-module/image/edit.js +1 -1
  265. package/build-module/image/edit.js.map +1 -1
  266. package/build-module/image/image.js +25 -12
  267. package/build-module/image/image.js.map +1 -1
  268. package/build-module/image/index.js +3 -0
  269. package/build-module/image/index.js.map +1 -1
  270. package/build-module/image/view.js +65 -49
  271. package/build-module/image/view.js.map +1 -1
  272. package/build-module/latest-comments/index.js +9 -0
  273. package/build-module/latest-comments/index.js.map +1 -1
  274. package/build-module/latest-posts/edit.js +1 -0
  275. package/build-module/latest-posts/edit.js.map +1 -1
  276. package/build-module/list/edit.js +3 -3
  277. package/build-module/list/edit.js.map +1 -1
  278. package/build-module/list/index.js +1 -1
  279. package/build-module/list/ordered-list-settings.js +19 -17
  280. package/build-module/list/ordered-list-settings.js.map +1 -1
  281. package/build-module/list-item/edit.js +2 -2
  282. package/build-module/list-item/edit.js.map +1 -1
  283. package/build-module/list-item/hooks/index.js +0 -1
  284. package/build-module/list-item/hooks/index.js.map +1 -1
  285. package/build-module/list-item/index.js +3 -2
  286. package/build-module/list-item/index.js.map +1 -1
  287. package/build-module/loginout/index.js +14 -1
  288. package/build-module/loginout/index.js.map +1 -1
  289. package/build-module/media-text/index.js +12 -0
  290. package/build-module/media-text/index.js.map +1 -1
  291. package/build-module/navigation/edit/index.js +5 -4
  292. package/build-module/navigation/edit/index.js.map +1 -1
  293. package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -0
  294. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  295. package/build-module/navigation/use-navigation-menu.js +5 -1
  296. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  297. package/build-module/navigation-link/link-ui.js +13 -17
  298. package/build-module/navigation-link/link-ui.js.map +1 -1
  299. package/build-module/navigation-submenu/edit.js +0 -11
  300. package/build-module/navigation-submenu/edit.js.map +1 -1
  301. package/build-module/page-list/edit.js +1 -0
  302. package/build-module/page-list/edit.js.map +1 -1
  303. package/build-module/page-list-item/edit.js +4 -1
  304. package/build-module/page-list-item/edit.js.map +1 -1
  305. package/build-module/paragraph/index.js +6 -0
  306. package/build-module/paragraph/index.js.map +1 -1
  307. package/build-module/paragraph/transforms.js +6 -0
  308. package/build-module/paragraph/transforms.js.map +1 -1
  309. package/build-module/post-author/index.js +8 -0
  310. package/build-module/post-author/index.js.map +1 -1
  311. package/build-module/post-author-biography/index.js +3 -0
  312. package/build-module/post-author-biography/index.js.map +1 -1
  313. package/build-module/post-author-name/index.js +3 -0
  314. package/build-module/post-author-name/index.js.map +1 -1
  315. package/build-module/post-comments-form/index.js +12 -0
  316. package/build-module/post-comments-form/index.js.map +1 -1
  317. package/build-module/post-content/index.js +1 -0
  318. package/build-module/post-content/index.js.map +1 -1
  319. package/build-module/post-date/index.js +15 -0
  320. package/build-module/post-date/index.js.map +1 -1
  321. package/build-module/post-excerpt/edit.js +1 -0
  322. package/build-module/post-excerpt/edit.js.map +1 -1
  323. package/build-module/post-excerpt/index.js +12 -0
  324. package/build-module/post-excerpt/index.js.map +1 -1
  325. package/build-module/post-featured-image/index.js +3 -0
  326. package/build-module/post-featured-image/index.js.map +1 -1
  327. package/build-module/post-navigation-link/edit.js +2 -0
  328. package/build-module/post-navigation-link/edit.js.map +1 -1
  329. package/build-module/post-terms/index.js +15 -0
  330. package/build-module/post-terms/index.js.map +1 -1
  331. package/build-module/post-time-to-read/index.js +6 -0
  332. package/build-module/post-time-to-read/index.js.map +1 -1
  333. package/build-module/post-title/edit.js +9 -3
  334. package/build-module/post-title/edit.js.map +1 -1
  335. package/build-module/post-title/index.js +15 -0
  336. package/build-module/post-title/index.js.map +1 -1
  337. package/build-module/query/edit/inspector-controls/author-control.js +3 -1
  338. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  339. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +1 -0
  340. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  341. package/build-module/query/edit/inspector-controls/index.js +92 -14
  342. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  343. package/build-module/query/edit/inspector-controls/offset-controls.js +29 -0
  344. package/build-module/query/edit/inspector-controls/offset-controls.js.map +1 -0
  345. package/build-module/query/edit/inspector-controls/order-control.js +1 -0
  346. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  347. package/build-module/query/edit/inspector-controls/pages-control.js +28 -0
  348. package/build-module/query/edit/inspector-controls/pages-control.js.map +1 -0
  349. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  350. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  351. package/build-module/query/edit/inspector-controls/per-page-control.js +33 -0
  352. package/build-module/query/edit/inspector-controls/per-page-control.js.map +1 -0
  353. package/build-module/query/edit/inspector-controls/sticky-control.js +2 -1
  354. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
  355. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +6 -4
  356. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  357. package/build-module/query/edit/query-content.js +11 -2
  358. package/build-module/query/edit/query-content.js.map +1 -1
  359. package/build-module/query/edit/query-placeholder.js +1 -14
  360. package/build-module/query/edit/query-placeholder.js.map +1 -1
  361. package/build-module/query/edit/query-toolbar.js +4 -78
  362. package/build-module/query/edit/query-toolbar.js.map +1 -1
  363. package/build-module/query/utils.js +15 -6
  364. package/build-module/query/utils.js.map +1 -1
  365. package/build-module/query/variations.js +4 -50
  366. package/build-module/query/variations.js.map +1 -1
  367. package/build-module/query-pagination-numbers/edit.js +1 -0
  368. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  369. package/build-module/query-title/edit.js +14 -20
  370. package/build-module/query-title/edit.js.map +1 -1
  371. package/build-module/query-title/index.js +3 -0
  372. package/build-module/query-title/index.js.map +1 -1
  373. package/build-module/query-title/use-archive-label.js +88 -0
  374. package/build-module/query-title/use-archive-label.js.map +1 -0
  375. package/build-module/quote/index.js +15 -1
  376. package/build-module/quote/index.js.map +1 -1
  377. package/build-module/search/index.js +3 -0
  378. package/build-module/search/index.js.map +1 -1
  379. package/build-module/site-logo/edit.js +19 -9
  380. package/build-module/site-logo/edit.js.map +1 -1
  381. package/build-module/site-tagline/edit.js +8 -5
  382. package/build-module/site-tagline/edit.js.map +1 -1
  383. package/build-module/site-tagline/index.js +18 -2
  384. package/build-module/site-tagline/index.js.map +1 -1
  385. package/build-module/site-title/edit.js +6 -3
  386. package/build-module/site-title/edit.js.map +1 -1
  387. package/build-module/site-title/index.js +16 -1
  388. package/build-module/site-title/index.js.map +1 -1
  389. package/build-module/social-link/edit.js +0 -1
  390. package/build-module/social-link/edit.js.map +1 -1
  391. package/build-module/social-link/icons/soundcloud.js +1 -1
  392. package/build-module/social-link/icons/soundcloud.js.map +1 -1
  393. package/build-module/social-links/index.js +12 -0
  394. package/build-module/social-links/index.js.map +1 -1
  395. package/build-module/spacer/controls.js +9 -14
  396. package/build-module/spacer/controls.js.map +1 -1
  397. package/build-module/table-of-contents/index.js +14 -1
  398. package/build-module/table-of-contents/index.js.map +1 -1
  399. package/build-module/tag-cloud/edit.js +43 -34
  400. package/build-module/tag-cloud/edit.js.map +1 -1
  401. package/build-module/tag-cloud/index.js +1 -1
  402. package/build-module/template-part/edit/index.js +8 -5
  403. package/build-module/template-part/edit/index.js.map +1 -1
  404. package/build-module/template-part/edit/inner-blocks.js +11 -4
  405. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  406. package/build-module/template-part/edit/placeholder.js +23 -3
  407. package/build-module/template-part/edit/placeholder.js.map +1 -1
  408. package/build-module/template-part/edit/title-modal.js +20 -8
  409. package/build-module/template-part/edit/title-modal.js.map +1 -1
  410. package/build-module/term-description/index.js +12 -0
  411. package/build-module/term-description/index.js.map +1 -1
  412. package/build-module/utils/hooks.js +5 -1
  413. package/build-module/utils/hooks.js.map +1 -1
  414. package/build-style/archives/editor-rtl.css +3 -0
  415. package/build-style/archives/editor.css +3 -0
  416. package/build-style/archives/style-rtl.css +3 -0
  417. package/build-style/archives/style.css +3 -0
  418. package/build-style/audio/editor-rtl.css +3 -0
  419. package/build-style/audio/editor.css +3 -0
  420. package/build-style/audio/style-rtl.css +3 -0
  421. package/build-style/audio/style.css +3 -0
  422. package/build-style/audio/theme-rtl.css +3 -0
  423. package/build-style/audio/theme.css +3 -0
  424. package/build-style/avatar/editor-rtl.css +3 -0
  425. package/build-style/avatar/editor.css +3 -0
  426. package/build-style/avatar/style-rtl.css +3 -0
  427. package/build-style/avatar/style.css +3 -0
  428. package/build-style/button/editor-rtl.css +3 -0
  429. package/build-style/button/editor.css +3 -0
  430. package/build-style/button/style-rtl.css +3 -0
  431. package/build-style/button/style.css +3 -0
  432. package/build-style/buttons/editor-rtl.css +3 -0
  433. package/build-style/buttons/editor.css +3 -0
  434. package/build-style/buttons/style-rtl.css +3 -0
  435. package/build-style/buttons/style.css +3 -0
  436. package/build-style/calendar/style-rtl.css +3 -0
  437. package/build-style/calendar/style.css +3 -0
  438. package/build-style/categories/editor-rtl.css +7 -0
  439. package/build-style/categories/editor.css +7 -0
  440. package/build-style/categories/style-rtl.css +7 -0
  441. package/build-style/categories/style.css +7 -0
  442. package/build-style/classic-rtl.css +3 -0
  443. package/build-style/classic.css +3 -0
  444. package/build-style/code/editor-rtl.css +3 -0
  445. package/build-style/code/editor.css +3 -0
  446. package/build-style/code/style-rtl.css +3 -0
  447. package/build-style/code/style.css +3 -0
  448. package/build-style/code/theme-rtl.css +3 -0
  449. package/build-style/code/theme.css +3 -0
  450. package/build-style/columns/editor-rtl.css +3 -0
  451. package/build-style/columns/editor.css +3 -0
  452. package/build-style/columns/style-rtl.css +3 -0
  453. package/build-style/columns/style.css +3 -0
  454. package/build-style/comment-author-avatar/editor-rtl.css +3 -0
  455. package/build-style/comment-author-avatar/editor.css +3 -0
  456. package/build-style/comment-content/style-rtl.css +3 -0
  457. package/build-style/comment-content/style.css +3 -0
  458. package/build-style/comment-template/style-rtl.css +3 -0
  459. package/build-style/comment-template/style.css +3 -0
  460. package/build-style/comments/editor-rtl.css +3 -0
  461. package/build-style/comments/editor.css +3 -0
  462. package/build-style/comments/style-rtl.css +3 -0
  463. package/build-style/comments/style.css +3 -0
  464. package/build-style/comments-pagination/editor-rtl.css +3 -0
  465. package/build-style/comments-pagination/editor.css +3 -0
  466. package/build-style/comments-pagination/style-rtl.css +3 -0
  467. package/build-style/comments-pagination/style.css +3 -0
  468. package/build-style/comments-pagination-numbers/editor-rtl.css +3 -0
  469. package/build-style/comments-pagination-numbers/editor.css +3 -0
  470. package/build-style/comments-title/editor-rtl.css +3 -0
  471. package/build-style/comments-title/editor.css +3 -0
  472. package/build-style/common-rtl.css +3 -0
  473. package/build-style/common.css +3 -0
  474. package/build-style/cover/editor-rtl.css +3 -0
  475. package/build-style/cover/editor.css +3 -0
  476. package/build-style/cover/style-rtl.css +3 -0
  477. package/build-style/cover/style.css +3 -0
  478. package/build-style/details/editor-rtl.css +3 -0
  479. package/build-style/details/editor.css +3 -0
  480. package/build-style/details/style-rtl.css +3 -0
  481. package/build-style/details/style.css +3 -0
  482. package/build-style/editor-elements-rtl.css +3 -0
  483. package/build-style/editor-elements.css +3 -0
  484. package/build-style/editor-rtl.css +29 -42
  485. package/build-style/editor.css +29 -42
  486. package/build-style/elements-rtl.css +3 -0
  487. package/build-style/elements.css +3 -0
  488. package/build-style/embed/editor-rtl.css +3 -0
  489. package/build-style/embed/editor.css +3 -0
  490. package/build-style/embed/style-rtl.css +3 -0
  491. package/build-style/embed/style.css +3 -0
  492. package/build-style/embed/theme-rtl.css +3 -0
  493. package/build-style/embed/theme.css +3 -0
  494. package/build-style/file/editor-rtl.css +3 -0
  495. package/build-style/file/editor.css +3 -0
  496. package/build-style/file/style-rtl.css +3 -0
  497. package/build-style/file/style.css +3 -0
  498. package/build-style/footnotes/style-rtl.css +3 -0
  499. package/build-style/footnotes/style.css +3 -0
  500. package/build-style/form-input/editor-rtl.css +3 -0
  501. package/build-style/form-input/editor.css +3 -0
  502. package/build-style/form-input/style-rtl.css +4 -0
  503. package/build-style/form-input/style.css +4 -0
  504. package/build-style/form-submission-notification/editor-rtl.css +3 -0
  505. package/build-style/form-submission-notification/editor.css +3 -0
  506. package/build-style/form-submit-button/style-rtl.css +3 -0
  507. package/build-style/form-submit-button/style.css +3 -0
  508. package/build-style/freeform/editor-rtl.css +3 -0
  509. package/build-style/freeform/editor.css +3 -0
  510. package/build-style/gallery/editor-rtl.css +3 -1
  511. package/build-style/gallery/editor.css +3 -1
  512. package/build-style/gallery/style-rtl.css +3 -0
  513. package/build-style/gallery/style.css +3 -0
  514. package/build-style/gallery/theme-rtl.css +3 -0
  515. package/build-style/gallery/theme.css +3 -0
  516. package/build-style/group/editor-rtl.css +3 -11
  517. package/build-style/group/editor.css +3 -11
  518. package/build-style/group/style-rtl.css +3 -0
  519. package/build-style/group/style.css +3 -0
  520. package/build-style/group/theme-rtl.css +3 -0
  521. package/build-style/group/theme.css +3 -0
  522. package/build-style/heading/style-rtl.css +3 -0
  523. package/build-style/heading/style.css +3 -0
  524. package/build-style/html/editor-rtl.css +3 -0
  525. package/build-style/html/editor.css +3 -0
  526. package/build-style/image/editor-rtl.css +19 -4
  527. package/build-style/image/editor.css +19 -4
  528. package/build-style/image/style-rtl.css +22 -0
  529. package/build-style/image/style.css +22 -0
  530. package/build-style/image/theme-rtl.css +3 -0
  531. package/build-style/image/theme.css +3 -0
  532. package/build-style/latest-comments/style-rtl.css +3 -0
  533. package/build-style/latest-comments/style.css +3 -0
  534. package/build-style/latest-posts/editor-rtl.css +3 -3
  535. package/build-style/latest-posts/editor.css +3 -3
  536. package/build-style/latest-posts/style-rtl.css +3 -0
  537. package/build-style/latest-posts/style.css +3 -0
  538. package/build-style/list/style-rtl.css +4 -1
  539. package/build-style/list/style.css +4 -1
  540. package/build-style/loginout/style-rtl.css +94 -0
  541. package/build-style/loginout/style.css +94 -0
  542. package/build-style/media-text/editor-rtl.css +3 -0
  543. package/build-style/media-text/editor.css +3 -0
  544. package/build-style/media-text/style-rtl.css +3 -0
  545. package/build-style/media-text/style.css +3 -0
  546. package/build-style/more/editor-rtl.css +3 -0
  547. package/build-style/more/editor.css +3 -0
  548. package/build-style/navigation/editor-rtl.css +3 -12
  549. package/build-style/navigation/editor.css +3 -12
  550. package/build-style/navigation/style-rtl.css +4 -4
  551. package/build-style/navigation/style.css +4 -4
  552. package/build-style/navigation-link/editor-rtl.css +3 -0
  553. package/build-style/navigation-link/editor.css +3 -0
  554. package/build-style/navigation-link/style-rtl.css +3 -0
  555. package/build-style/navigation-link/style.css +3 -0
  556. package/build-style/navigation-submenu/editor-rtl.css +3 -0
  557. package/build-style/navigation-submenu/editor.css +3 -0
  558. package/build-style/nextpage/editor-rtl.css +3 -0
  559. package/build-style/nextpage/editor.css +3 -0
  560. package/build-style/page-list/editor-rtl.css +3 -0
  561. package/build-style/page-list/editor.css +3 -0
  562. package/build-style/page-list/style-rtl.css +3 -0
  563. package/build-style/page-list/style.css +3 -0
  564. package/build-style/paragraph/editor-rtl.css +3 -0
  565. package/build-style/paragraph/editor.css +3 -0
  566. package/build-style/paragraph/style-rtl.css +3 -0
  567. package/build-style/paragraph/style.css +3 -0
  568. package/build-style/post-author/style-rtl.css +3 -0
  569. package/build-style/post-author/style.css +3 -0
  570. package/build-style/post-comments-form/editor-rtl.css +3 -0
  571. package/build-style/post-comments-form/editor.css +3 -0
  572. package/build-style/post-comments-form/style-rtl.css +4 -1
  573. package/build-style/post-comments-form/style.css +4 -1
  574. package/build-style/post-content/editor-rtl.css +3 -0
  575. package/build-style/post-content/editor.css +3 -0
  576. package/build-style/post-content/style-rtl.css +96 -0
  577. package/build-style/post-content/style.css +96 -0
  578. package/build-style/post-date/style-rtl.css +3 -0
  579. package/build-style/post-date/style.css +3 -0
  580. package/build-style/post-excerpt/editor-rtl.css +3 -0
  581. package/build-style/post-excerpt/editor.css +3 -0
  582. package/build-style/post-excerpt/style-rtl.css +4 -0
  583. package/build-style/post-excerpt/style.css +4 -0
  584. package/build-style/post-featured-image/editor-rtl.css +3 -0
  585. package/build-style/post-featured-image/editor.css +3 -0
  586. package/build-style/post-featured-image/style-rtl.css +3 -0
  587. package/build-style/post-featured-image/style.css +3 -0
  588. package/build-style/post-navigation-link/style-rtl.css +3 -0
  589. package/build-style/post-navigation-link/style.css +3 -0
  590. package/build-style/post-template/editor-rtl.css +3 -0
  591. package/build-style/post-template/editor.css +3 -0
  592. package/build-style/post-template/style-rtl.css +3 -0
  593. package/build-style/post-template/style.css +3 -0
  594. package/build-style/post-terms/style-rtl.css +3 -0
  595. package/build-style/post-terms/style.css +3 -0
  596. package/build-style/post-time-to-read/style-rtl.css +3 -0
  597. package/build-style/post-time-to-read/style.css +3 -0
  598. package/build-style/post-title/style-rtl.css +3 -0
  599. package/build-style/post-title/style.css +3 -0
  600. package/build-style/preformatted/style-rtl.css +3 -0
  601. package/build-style/preformatted/style.css +3 -0
  602. package/build-style/pullquote/editor-rtl.css +3 -0
  603. package/build-style/pullquote/editor.css +3 -0
  604. package/build-style/pullquote/style-rtl.css +3 -0
  605. package/build-style/pullquote/style.css +3 -0
  606. package/build-style/pullquote/theme-rtl.css +3 -0
  607. package/build-style/pullquote/theme.css +3 -0
  608. package/build-style/query/editor-rtl.css +3 -7
  609. package/build-style/query/editor.css +3 -7
  610. package/build-style/query-pagination/editor-rtl.css +3 -0
  611. package/build-style/query-pagination/editor.css +3 -0
  612. package/build-style/query-pagination/style-rtl.css +3 -0
  613. package/build-style/query-pagination/style.css +3 -0
  614. package/build-style/query-pagination-numbers/editor-rtl.css +3 -0
  615. package/build-style/query-pagination-numbers/editor.css +3 -0
  616. package/build-style/query-title/style-rtl.css +3 -0
  617. package/build-style/query-title/style.css +3 -0
  618. package/build-style/quote/style-rtl.css +3 -0
  619. package/build-style/quote/style.css +3 -0
  620. package/build-style/quote/theme-rtl.css +6 -3
  621. package/build-style/quote/theme.css +6 -3
  622. package/build-style/read-more/style-rtl.css +3 -0
  623. package/build-style/read-more/style.css +3 -0
  624. package/build-style/reset-rtl.css +3 -0
  625. package/build-style/reset.css +3 -0
  626. package/build-style/rss/editor-rtl.css +3 -0
  627. package/build-style/rss/editor.css +3 -0
  628. package/build-style/rss/style-rtl.css +3 -0
  629. package/build-style/rss/style.css +3 -0
  630. package/build-style/search/editor-rtl.css +4 -1
  631. package/build-style/search/editor.css +4 -1
  632. package/build-style/search/style-rtl.css +3 -0
  633. package/build-style/search/style.css +3 -0
  634. package/build-style/search/theme-rtl.css +3 -0
  635. package/build-style/search/theme.css +3 -0
  636. package/build-style/separator/editor-rtl.css +3 -0
  637. package/build-style/separator/editor.css +3 -0
  638. package/build-style/separator/style-rtl.css +3 -0
  639. package/build-style/separator/style.css +3 -0
  640. package/build-style/separator/theme-rtl.css +3 -0
  641. package/build-style/separator/theme.css +3 -0
  642. package/build-style/shortcode/editor-rtl.css +3 -0
  643. package/build-style/shortcode/editor.css +3 -0
  644. package/build-style/site-logo/editor-rtl.css +3 -0
  645. package/build-style/site-logo/editor.css +3 -0
  646. package/build-style/site-logo/style-rtl.css +3 -0
  647. package/build-style/site-logo/style.css +3 -0
  648. package/build-style/site-tagline/editor-rtl.css +3 -0
  649. package/build-style/site-tagline/editor.css +3 -0
  650. package/build-style/site-tagline/style-rtl.css +94 -0
  651. package/build-style/site-tagline/style.css +94 -0
  652. package/build-style/site-title/editor-rtl.css +3 -0
  653. package/build-style/site-title/editor.css +3 -0
  654. package/build-style/site-title/style-rtl.css +7 -1
  655. package/build-style/site-title/style.css +7 -1
  656. package/build-style/social-link/editor-rtl.css +3 -0
  657. package/build-style/social-link/editor.css +3 -0
  658. package/build-style/social-links/editor-rtl.css +3 -0
  659. package/build-style/social-links/editor.css +3 -0
  660. package/build-style/social-links/style-rtl.css +5 -2
  661. package/build-style/social-links/style.css +5 -2
  662. package/build-style/spacer/editor-rtl.css +3 -0
  663. package/build-style/spacer/editor.css +3 -0
  664. package/build-style/spacer/style-rtl.css +3 -0
  665. package/build-style/spacer/style.css +3 -0
  666. package/build-style/style-rtl.css +56 -9
  667. package/build-style/style.css +56 -9
  668. package/build-style/table/editor-rtl.css +3 -0
  669. package/build-style/table/editor.css +3 -0
  670. package/build-style/table/style-rtl.css +3 -0
  671. package/build-style/table/style.css +3 -0
  672. package/build-style/table/theme-rtl.css +3 -0
  673. package/build-style/table/theme.css +3 -0
  674. package/build-style/table-of-contents/style-rtl.css +94 -0
  675. package/build-style/table-of-contents/style.css +94 -0
  676. package/build-style/tag-cloud/editor-rtl.css +95 -0
  677. package/build-style/tag-cloud/editor.css +95 -0
  678. package/build-style/tag-cloud/style-rtl.css +3 -0
  679. package/build-style/tag-cloud/style.css +3 -0
  680. package/build-style/template-part/editor-rtl.css +3 -0
  681. package/build-style/template-part/editor.css +3 -0
  682. package/build-style/template-part/theme-rtl.css +3 -0
  683. package/build-style/template-part/theme.css +3 -0
  684. package/build-style/term-description/style-rtl.css +4 -0
  685. package/build-style/term-description/style.css +4 -0
  686. package/build-style/text-columns/editor-rtl.css +3 -0
  687. package/build-style/text-columns/editor.css +3 -0
  688. package/build-style/text-columns/style-rtl.css +3 -0
  689. package/build-style/text-columns/style.css +3 -0
  690. package/build-style/theme-rtl.css +6 -3
  691. package/build-style/theme.css +6 -3
  692. package/build-style/verse/style-rtl.css +3 -0
  693. package/build-style/verse/style.css +3 -0
  694. package/build-style/video/editor-rtl.css +3 -3
  695. package/build-style/video/editor.css +3 -3
  696. package/build-style/video/style-rtl.css +3 -0
  697. package/build-style/video/style.css +3 -0
  698. package/build-style/video/theme-rtl.css +3 -0
  699. package/build-style/video/theme.css +3 -0
  700. package/package.json +35 -35
  701. package/src/avatar/edit.js +1 -0
  702. package/src/block/edit.js +58 -27
  703. package/src/block/test/edit.native.js +6 -2
  704. package/src/button/edit.js +1 -1
  705. package/src/button/index.php +1 -14
  706. package/src/buttons/block.json +20 -0
  707. package/src/buttons/index.js +6 -0
  708. package/src/categories/block.json +20 -0
  709. package/src/categories/edit.js +32 -4
  710. package/src/categories/editor.scss +4 -0
  711. package/src/categories/index.php +4 -1
  712. package/src/categories/style.scss +4 -0
  713. package/src/column/block.json +2 -0
  714. package/src/column/edit.js +2 -2
  715. package/src/columns/index.js +1 -1
  716. package/src/comment-template/block.json +12 -0
  717. package/src/comments-title/block.json +3 -0
  718. package/src/comments-title/edit.js +8 -1
  719. package/src/cover/edit/inspector-controls.js +1 -0
  720. package/src/details/edit.js +1 -0
  721. package/src/editor.scss +1 -0
  722. package/src/embed/test/__snapshots__/index.native.js.snap +8 -8
  723. package/src/embed/test/index.js +1 -1
  724. package/src/embed/test/index.native.js +24 -23
  725. package/src/embed/variations.js +43 -35
  726. package/src/footnotes/index.js +1 -2
  727. package/src/form/edit.js +3 -2
  728. package/src/form-input/edit.js +3 -0
  729. package/src/form-input/style.scss +1 -0
  730. package/src/gallery/block.json +10 -0
  731. package/src/gallery/edit.js +75 -13
  732. package/src/gallery/editor.scss +0 -1
  733. package/src/gallery/gap-styles.js +1 -8
  734. package/src/gallery/test/__snapshots__/index.native.js.snap +1 -1
  735. package/src/gallery/test/index.native.js +5 -5
  736. package/src/gallery/use-image-sizes.js +2 -2
  737. package/src/group/deprecated.js +3 -7
  738. package/src/group/editor.scss +1 -1
  739. package/src/group/index.js +26 -29
  740. package/src/group/variations.js +56 -0
  741. package/src/heading/block.json +15 -0
  742. package/src/heading/edit.js +3 -1
  743. package/src/heading/index.js +1 -0
  744. package/src/image/block.json +3 -0
  745. package/src/image/edit.js +1 -1
  746. package/src/image/editor.scss +18 -1
  747. package/src/image/image.js +55 -35
  748. package/src/image/index.php +32 -15
  749. package/src/image/style.scss +22 -0
  750. package/src/image/test/edit.native.js +1 -0
  751. package/src/image/view.js +69 -49
  752. package/src/latest-comments/block.json +9 -0
  753. package/src/latest-posts/edit.js +1 -0
  754. package/src/latest-posts/editor.scss +0 -4
  755. package/src/list/block.json +1 -1
  756. package/src/list/edit.js +3 -3
  757. package/src/list/ordered-list-settings.js +20 -18
  758. package/src/list/style.scss +1 -1
  759. package/src/list/test/edit.native.js +1 -3
  760. package/src/list-item/block.json +3 -2
  761. package/src/list-item/edit.js +2 -2
  762. package/src/list-item/hooks/index.js +0 -1
  763. package/src/loginout/block.json +14 -1
  764. package/src/loginout/style.scss +4 -0
  765. package/src/media-text/block.json +12 -0
  766. package/src/media-text/style.native.scss +2 -0
  767. package/src/navigation/edit/index.js +5 -5
  768. package/src/navigation/edit/navigation-menu-delete-control.js +1 -0
  769. package/src/navigation/editor.scss +0 -1
  770. package/src/navigation/index.php +1 -1
  771. package/src/navigation/style.scss +4 -9
  772. package/src/navigation/test/use-navigation-menu.js +54 -15
  773. package/src/navigation/use-navigation-menu.js +5 -1
  774. package/src/navigation-link/link-ui.js +8 -14
  775. package/src/navigation-submenu/edit.js +1 -13
  776. package/src/page-list/edit.js +1 -0
  777. package/src/page-list-item/edit.js +4 -4
  778. package/src/paragraph/block.json +6 -0
  779. package/src/post-author/index.js +8 -0
  780. package/src/post-author-biography/block.json +3 -0
  781. package/src/post-author-name/block.json +3 -0
  782. package/src/post-comments-form/block.json +12 -0
  783. package/src/post-comments-form/style.scss +1 -1
  784. package/src/post-content/block.json +1 -0
  785. package/src/post-content/style.scss +5 -0
  786. package/src/post-date/block.json +15 -0
  787. package/src/post-excerpt/block.json +12 -0
  788. package/src/post-excerpt/edit.js +1 -0
  789. package/src/post-excerpt/style.scss +3 -0
  790. package/src/post-featured-image/block.json +3 -0
  791. package/src/post-navigation-link/edit.js +2 -0
  792. package/src/post-terms/block.json +15 -0
  793. package/src/post-time-to-read/block.json +6 -0
  794. package/src/post-title/block.json +15 -0
  795. package/src/post-title/edit.js +9 -8
  796. package/src/query/edit/inspector-controls/author-control.js +2 -0
  797. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +1 -0
  798. package/src/query/edit/inspector-controls/index.js +123 -23
  799. package/src/query/edit/inspector-controls/offset-controls.js +31 -0
  800. package/src/query/edit/inspector-controls/order-control.js +1 -0
  801. package/src/query/edit/inspector-controls/pages-control.js +27 -0
  802. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  803. package/src/query/edit/inspector-controls/per-page-control.js +33 -0
  804. package/src/query/edit/inspector-controls/sticky-control.js +2 -1
  805. package/src/query/edit/inspector-controls/taxonomy-controls.js +8 -3
  806. package/src/query/edit/query-content.js +17 -3
  807. package/src/query/edit/query-placeholder.js +1 -21
  808. package/src/query/edit/query-toolbar.js +1 -90
  809. package/src/query/editor.scss +0 -9
  810. package/src/query/utils.js +13 -5
  811. package/src/query/variations.js +4 -46
  812. package/src/query-pagination-numbers/edit.js +1 -0
  813. package/src/query-title/block.json +3 -0
  814. package/src/query-title/edit.js +19 -18
  815. package/src/query-title/use-archive-label.js +99 -0
  816. package/src/quote/block.json +15 -1
  817. package/src/quote/theme.scss +5 -3
  818. package/src/search/block.json +3 -0
  819. package/src/search/editor.scss +1 -1
  820. package/src/site-logo/edit.js +27 -10
  821. package/src/site-tagline/block.json +18 -2
  822. package/src/site-tagline/edit.js +7 -6
  823. package/src/site-tagline/style.scss +4 -0
  824. package/src/site-title/block.json +10 -0
  825. package/src/site-title/edit.js +6 -5
  826. package/src/site-title/index.js +6 -1
  827. package/src/site-title/style.scss +7 -2
  828. package/src/social-link/edit.js +0 -1
  829. package/src/social-link/icons/soundcloud.js +1 -1
  830. package/src/social-link/socials-with-bg.scss +1 -1
  831. package/src/social-link/socials-without-bg.scss +1 -1
  832. package/src/social-links/block.json +12 -0
  833. package/src/spacer/controls.js +10 -13
  834. package/src/style.scss +4 -0
  835. package/src/table-of-contents/block.json +14 -1
  836. package/src/table-of-contents/style.scss +4 -0
  837. package/src/tag-cloud/block.json +1 -1
  838. package/src/tag-cloud/edit.js +53 -35
  839. package/src/tag-cloud/editor.scss +9 -0
  840. package/src/template-part/edit/index.js +10 -5
  841. package/src/template-part/edit/inner-blocks.js +11 -6
  842. package/src/template-part/edit/placeholder.js +31 -6
  843. package/src/template-part/edit/title-modal.js +18 -4
  844. package/src/term-description/block.json +12 -0
  845. package/src/term-description/style.scss +2 -0
  846. package/src/utils/hooks.js +5 -1
  847. package/src/video/editor.scss +0 -4
  848. package/tsconfig.tsbuildinfo +1 -1
  849. package/build/list-item/hooks/use-split.js +0 -39
  850. package/build/list-item/hooks/use-split.js.map +0 -1
  851. package/build-module/list-item/hooks/use-split.js +0 -32
  852. package/build-module/list-item/hooks/use-split.js.map +0 -1
  853. package/src/list-item/hooks/use-split.js +0 -33
@@ -1 +1 @@
1
- {"version":3,"names":["__","FormTokenField","useSelect","store","coreStore","useState","useEffect","useMemo","useDebounce","getEntitiesInfo","mapToIHasNameAndId","jsx","_jsx","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","selectorArgs","orderby","exclude","per_page","currentParents","length","include","currentParentsInfo","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","label","onInputChange","__experimentalShowHowTo"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch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AAW;IACnB,CAAC,EAAE,IAAIiB,GAAG,CAAC,CAAE,CACd,CAAC;IACDlC,cAAc,CAAEd,WAAY,CAAC;IAC7BQ,QAAQ,CAAE;MAAEF,OAAO,EAAEqC;IAAI,CAAE,CAAC;EAC7B,CAAC;EACD,oBACC5C,IAAA,CAACX,cAAc;IACd6D,KAAK,EAAG9D,EAAE,CAAE,SAAU,CAAG;IACzBwB,KAAK,EAAGA,KAAO;IACfuC,aAAa,EAAGnC,eAAiB;IACjCF,WAAW,EAAGA,WAAa;IAC3BL,QAAQ,EAAGiC,cAAgB;IAC3BU,uBAAuB,EAAG;EAAO,CACjC,CAAC;AAEJ;AAEA,eAAe9C,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["__","FormTokenField","useSelect","store","coreStore","useState","useEffect","useMemo","useDebounce","getEntitiesInfo","mapToIHasNameAndId","jsx","_jsx","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","selectorArgs","orderby","exclude","per_page","currentParents","length","include","currentParentsInfo","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","label","onInputChange","__experimentalShowHowTo","__nextHasNoMarginBottom"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ onParentChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\nexport default ParentControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACjE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElE,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG;EAClBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,UAAU;EACnBC,OAAO,EAAE;AACV,CAAC;AAED,SAASC,aAAaA,CAAE;EAAEC,OAAO;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAGlB,QAAQ,CAAE,EAAG,CAAC;EAC5C,MAAM,CAAEmB,KAAK,EAAEC,QAAQ,CAAE,GAAGpB,QAAQ,CAAEQ,WAAY,CAAC;EACnD,MAAM,CAAEa,WAAW,EAAEC,cAAc,CAAE,GAAGtB,QAAQ,CAAEQ,WAAY,CAAC;EAC/D,MAAMe,eAAe,GAAGpB,WAAW,CAAEe,SAAS,EAAE,GAAI,CAAC;EACrD,MAAM;IAAEM,aAAa;IAAEC;EAAkB,CAAC,GAAG5B,SAAS,CACnD6B,MAAM,IAAM;IACb,IAAK,CAAET,MAAM,EAAG;MACf,OAAO;QAAEO,aAAa,EAAEhB,WAAW;QAAEiB,iBAA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,EAAG;QACTD,WAAW,CAACgB,GAAG,CAAEf,EAAG,CAAC;MACtB;MACA,OAAOD,WAAW;IACnB,CAAC,EAAE,IAAIiB,GAAG,CAAC,CAAE,CACd,CAAC;IACDlC,cAAc,CAAEd,WAAY,CAAC;IAC7BQ,QAAQ,CAAE;MAAEF,OAAO,EAAEqC;IAAI,CAAE,CAAC;EAC7B,CAAC;EACD,oBACC5C,IAAA,CAACX,cAAc;IACd6D,KAAK,EAAG9D,EAAE,CAAE,SAAU,CAAG;IACzBwB,KAAK,EAAGA,KAAO;IACfuC,aAAa,EAAGnC,eAAiB;IACjCF,WAAW,EAAGA,WAAa;IAC3BL,QAAQ,EAAGiC,cAAgB;IAC3BU,uBAAuB,EAAG,KAAO;IACjCC,uBAAuB;EAAA,CACvB,CAAC;AAEJ;AAEA,eAAe/C,aAAa","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { RangeControl } from '@wordpress/components';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const MIN_POSTS_PER_PAGE = 1;
8
+ const MAX_POSTS_PER_PAGE = 100;
9
+ const PerPageControl = ({
10
+ perPage,
11
+ offset = 0,
12
+ onChange
13
+ }) => {
14
+ return /*#__PURE__*/_jsx(RangeControl, {
15
+ __next40pxDefaultSize: true,
16
+ __nextHasNoMarginBottom: true,
17
+ label: __('Posts per page'),
18
+ min: MIN_POSTS_PER_PAGE,
19
+ max: MAX_POSTS_PER_PAGE,
20
+ onChange: newPerPage => {
21
+ if (isNaN(newPerPage) || newPerPage < MIN_POSTS_PER_PAGE || newPerPage > MAX_POSTS_PER_PAGE) {
22
+ return;
23
+ }
24
+ onChange({
25
+ perPage: newPerPage,
26
+ offset
27
+ });
28
+ },
29
+ value: parseInt(perPage, 10)
30
+ });
31
+ };
32
+ export default PerPageControl;
33
+ //# sourceMappingURL=per-page-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RangeControl","__","jsx","_jsx","MIN_POSTS_PER_PAGE","MAX_POSTS_PER_PAGE","PerPageControl","perPage","offset","onChange","__next40pxDefaultSize","__nextHasNoMarginBottom","label","min","max","newPerPage","isNaN","value","parseInt"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/per-page-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RangeControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst MIN_POSTS_PER_PAGE = 1;\nconst MAX_POSTS_PER_PAGE = 100;\n\nconst PerPageControl = ( { perPage, offset = 0, onChange } ) => {\n\treturn (\n\t\t<RangeControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\tmin={ MIN_POSTS_PER_PAGE }\n\t\t\tmax={ MAX_POSTS_PER_PAGE }\n\t\t\tonChange={ ( newPerPage ) => {\n\t\t\t\tif (\n\t\t\t\t\tisNaN( newPerPage ) ||\n\t\t\t\t\tnewPerPage < MIN_POSTS_PER_PAGE ||\n\t\t\t\t\tnewPerPage > MAX_POSTS_PER_PAGE\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonChange( { perPage: newPerPage, offset } );\n\t\t\t} }\n\t\t\tvalue={ parseInt( perPage, 10 ) }\n\t\t/>\n\t);\n};\n\nexport default PerPageControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,EAAE,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErC,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,kBAAkB,GAAG,GAAG;AAE9B,MAAMC,cAAc,GAAGA,CAAE;EAAEC,OAAO;EAAEC,MAAM,GAAG,CAAC;EAAEC;AAAS,CAAC,KAAM;EAC/D,oBACCN,IAAA,CAACH,YAAY;IACZU,qBAAqB;IACrBC,uBAAuB;IACvBC,KAAK,EAAGX,EAAE,CAAE,gBAAiB,CAAG;IAChCY,GAAG,EAAGT,kBAAoB;IAC1BU,GAAG,EAAGT,kBAAoB;IAC1BI,QAAQ,EAAKM,UAAU,IAAM;MAC5B,IACCC,KAAK,CAAED,UAAW,CAAC,IACnBA,UAAU,GAAGX,kBAAkB,IAC/BW,UAAU,GAAGV,kBAAkB,EAC9B;QACD;MACD;MACAI,QAAQ,CAAE;QAAEF,OAAO,EAAEQ,UAAU;QAAEP;MAAO,CAAE,CAAC;IAC5C,CAAG;IACHS,KAAK,EAAGC,QAAQ,CAAEX,OAAO,EAAE,EAAG;EAAG,CACjC,CAAC;AAEJ,CAAC;AAED,eAAeD,cAAc","ignoreList":[]}
@@ -20,11 +20,12 @@ export default function StickyControl({
20
20
  }) {
21
21
  return /*#__PURE__*/_jsx(SelectControl, {
22
22
  __nextHasNoMarginBottom: true,
23
+ __next40pxDefaultSize: true,
23
24
  label: __('Sticky posts'),
24
25
  options: stickyOptions,
25
26
  value: value,
26
27
  onChange: onChange,
27
- help: __('Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.')
28
+ help: __('Sticky posts always appear first, regardless of their publish date.')
28
29
  });
29
30
  }
30
31
  //# sourceMappingURL=sticky-control.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SelectControl","__","jsx","_jsx","stickyOptions","label","value","StickyControl","onChange","__nextHasNoMarginBottom","options","help"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/sticky-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst stickyOptions = [\n\t{ label: __( 'Include' ), value: '' },\n\t{ label: __( 'Exclude' ), value: 'exclude' },\n\t{ label: __( 'Only' ), value: 'only' },\n];\n\nexport default function StickyControl( { value, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\toptions={ stickyOptions }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\thelp={ __(\n\t\t\t\t'Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.'\n\t\t\t) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErC,MAAMC,aAAa,GAAG,CACrB;EAAEC,KAAK,EAAEJ,EAAE,CAAE,SAAU,CAAC;EAAEK,KAAK,EAAE;AAAG,CAAC,EACrC;EAAED,KAAK,EAAEJ,EAAE,CAAE,SAAU,CAAC;EAAEK,KAAK,EAAE;AAAU,CAAC,EAC5C;EAAED,KAAK,EAAEJ,EAAE,CAAE,MAAO,CAAC;EAAEK,KAAK,EAAE;AAAO,CAAC,CACtC;AAED,eAAe,SAASC,aAAaA,CAAE;EAAED,KAAK;EAAEE;AAAS,CAAC,EAAG;EAC5D,oBACCL,IAAA,CAACH,aAAa;IACbS,uBAAuB;IACvBJ,KAAK,EAAGJ,EAAE,CAAE,cAAe,CAAG;IAC9BS,OAAO,EAAGN,aAAe;IACzBE,KAAK,EAAGA,KAAO;IACfE,QAAQ,EAAGA,QAAU;IACrBG,IAAI,EAAGV,EAAE,CACR,wJACD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["SelectControl","__","jsx","_jsx","stickyOptions","label","value","StickyControl","onChange","__nextHasNoMarginBottom","__next40pxDefaultSize","options","help"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/sticky-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst stickyOptions = [\n\t{ label: __( 'Include' ), value: '' },\n\t{ label: __( 'Exclude' ), value: 'exclude' },\n\t{ label: __( 'Only' ), value: 'only' },\n];\n\nexport default function StickyControl( { value, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\toptions={ stickyOptions }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\thelp={ __(\n\t\t\t\t'Sticky posts always appear first, regardless of their publish date.'\n\t\t\t) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErC,MAAMC,aAAa,GAAG,CACrB;EAAEC,KAAK,EAAEJ,EAAE,CAAE,SAAU,CAAC;EAAEK,KAAK,EAAE;AAAG,CAAC,EACrC;EAAED,KAAK,EAAEJ,EAAE,CAAE,SAAU,CAAC;EAAEK,KAAK,EAAE;AAAU,CAAC,EAC5C;EAAED,KAAK,EAAEJ,EAAE,CAAE,MAAO,CAAC;EAAEK,KAAK,EAAE;AAAO,CAAC,CACtC;AAED,eAAe,SAASC,aAAaA,CAAE;EAAED,KAAK;EAAEE;AAAS,CAAC,EAAG;EAC5D,oBACCL,IAAA,CAACH,aAAa;IACbS,uBAAuB;IACvBC,qBAAqB;IACrBL,KAAK,EAAGJ,EAAE,CAAE,cAAe,CAAG;IAC9BU,OAAO,EAAGP,aAAe;IACzBE,KAAK,EAAGA,KAAO;IACfE,QAAQ,EAAGA,QAAU;IACrBI,IAAI,EAAGX,EAAE,CACR,qEACD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { FormTokenField } from '@wordpress/components';
4
+ import { FormTokenField, __experimentalVStack as VStack } from '@wordpress/components';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
7
  import { useState, useEffect } from '@wordpress/element';
@@ -13,7 +13,6 @@ import { decodeEntities } from '@wordpress/html-entities';
13
13
  */
14
14
  import { useTaxonomies } from '../../utils';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
- import { Fragment as _Fragment } from "react/jsx-runtime";
17
16
  const EMPTY_ARRAY = [];
18
17
  const BASE_QUERY = {
19
18
  order: 'asc',
@@ -53,7 +52,8 @@ export function TaxonomyControls({
53
52
  if (!taxonomies || taxonomies.length === 0) {
54
53
  return null;
55
54
  }
56
- return /*#__PURE__*/_jsx(_Fragment, {
55
+ return /*#__PURE__*/_jsx(VStack, {
56
+ spacing: 4,
57
57
  children: taxonomies.map(taxonomy => {
58
58
  const termIds = taxQuery?.[taxonomy.slug] || [];
59
59
  const handleChange = newTermIds => onChange({
@@ -181,7 +181,9 @@ function TaxonomyItem({
181
181
  suggestions: suggestions,
182
182
  displayTransform: decodeEntities,
183
183
  onChange: onTermsChange,
184
- __experimentalShowHowTo: false
184
+ __experimentalShowHowTo: false,
185
+ __nextHasNoMarginBottom: true,
186
+ __next40pxDefaultSize: true
185
187
  })
186
188
  });
187
189
  }
@@ -1 +1 @@
1
- {"version":3,"names":["FormTokenField","useSelect","store","coreStore","useState","useEffect","useDebounce","decodeEntities","useTaxonomies","jsx","_jsx","Fragment","_Fragment","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","length","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","selectorArgs","orderby","exclude","per_page","existingTerms","include","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","label","onInputChange","displayTransform","__experimentalShowHowTo"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,aAAa,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAE5C,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG;EAClBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;;AAED;AACA,MAAMC,oBAAoB,GAAGA,CAAEC,KAAK,EAAEC,SAAS,KAAM;EACpD;EACA,MAAMC,MAAM,GACXD,SAAS,EAAEE,EAAE,IAAIH,KAAK,EAAEI,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKL,SAAU,CAAC,EAAEE,EAAE;EACxE,IAAKD,MAAM,EAAG;IACb,OAAOA,MAAM;EACd;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMK,cAAc,GAAGN,SAAS,CAACO,iBAAiB,CAAC,CAAC;E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/B,UAAW,CAAE,CAAC;EACrC,CAAC;EACD,oBACC/B,IAAA;IAAK+D,SAAS,EAAC,iDAAiD;IAAAtC,QAAA,eAC/DzB,IAAA,CAACV,cAAc;MACd0E,KAAK,EAAGrC,QAAQ,CAACZ,IAAM;MACvBoB,KAAK,EAAGA,KAAO;MACf8B,aAAa,EAAG1B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3B6B,gBAAgB,EAAGrE,cAAgB;MACnCsB,QAAQ,EAAGsC,aAAe;MAC1BU,uBAAuB,EAAG;IAAO,CACjC;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["FormTokenField","__experimentalVStack","VStack","useSelect","store","coreStore","useState","useEffect","useDebounce","decodeEntities","useTaxonomies","jsx","_jsx","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","length","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","selectorArgs","orderby","exclude","per_page","existingTerms","include","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","label","onInputChange","displayTransform","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,aAAa,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG;EAClBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;;AAED;AACA,MAAMC,oBAAoB,GAAGA,CAAEC,KAAK,EAAEC,SAAS,KAAM;EACpD;EACA,MAAMC,MAAM,GACXD,SAAS,EAAEE,EAAE,IAAIH,KAAK,EAAEI,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKL,SAAU,CAAC,EAAEE,EAAE;EACxE,IAAKD,MAAM,EAAG;IACb,OAAOA,MAAM;EACd;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMK,cAAc,GAAGN,SAAS,CAACO,iBAAiB,CAAC,CAAC;EACpD,OAAOR,KAAK,EAAEI,IAAI,CACfC,IAAI,IAAMA,IAAI,CAACC,IAAI,CAACE,iBAAiB,CAAC,CAAC,KAAKD,cAC/C,CAAC,EAAEJ,EAAE;AACN,CAAC;AAED,OAAO,SAASM,gBAAgBA,CAAE;EAAEC,QAAQ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AM;MACvBqB,KAAK,EAAGA,KAAO;MACf8B,aAAa,EAAG1B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3B6B,gBAAgB,EAAGpE,cAAgB;MACnCoB,QAAQ,EAAGuC,aAAe;MAC1BU,uBAAuB,EAAG,KAAO;MACjCC,uBAAuB;MACvBC,qBAAqB;IAAA,CACrB;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -52,11 +52,20 @@ export default function QueryContent({
52
52
  } = select(blockEditorStore);
53
53
  const {
54
54
  getEntityRecord,
55
+ getEntityRecordEdits,
55
56
  canUser
56
57
  } = select(coreStore);
57
- const settingPerPage = canUser('read', 'settings') ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
58
+ const settingPerPage = canUser('read', {
59
+ kind: 'root',
60
+ name: 'site'
61
+ }) ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
62
+
63
+ // Gets changes made via the template area posts per page setting. These won't be saved
64
+ // until the page is saved, but we should reflect this setting within the query loops
65
+ // that inherit it.
66
+ const editedSettingPerPage = +getEntityRecordEdits('root', 'site')?.posts_per_page;
58
67
  return {
59
- postsPerPage: settingPerPage || DEFAULTS_POSTS_PER_PAGE
68
+ postsPerPage: editedSettingPerPage || settingPerPage || DEFAULTS_POSTS_PER_PAGE
60
69
  };
61
70
  }, []);
62
71
  // There are some effects running where some initialization logic is
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","QueryToolbar","QueryInspectorControls","EnhancedPaginationModal","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","queryId","query","displayLayout","tagName","TagName","inherit","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","postsPerPage","select","getSettings","getEntityRecord","canUser","settingPerPage","posts_per_page","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","section","aside","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, canUser } = select( coreStore );\n\t\tconst settingPerPage = canUser( 'read', 'settings' )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\t\treturn {\n\t\t\tpostsPerPage: settingPerPage || DEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\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\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\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [ query.perPage, postsPerPage, inherit ] );\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}, [ queryId, instanceId ] );\n\tconst updateQuery = ( newQuery ) =>\n\t\tsetAttributes( { query: { ...query, ...newQuery } } );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\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\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\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<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tname={ name }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<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\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,Q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,OAAO,EAAG,CACT;UAAED,KAAK,EAAEzD,EAAE,CAAE,iBAAkB,CAAC;UAAE2D,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,QAAQ;UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGpC,OAAS;QACjBqC,QAAQ,EAAKD,KAAK,IACjB5C,aAAa,CAAE;UAAEO,OAAO,EAAEqC;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGd,mBAAmB,CAAExB,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpBjB,IAAA,CAACiB,OAAO;MAAA,GAAMK;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","QueryToolbar","QueryInspectorControls","EnhancedPaginationModal","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","queryId","query","displayLayout","tagName","TagName","inherit","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","postsPerPage","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","settingPerPage","kind","posts_per_page","editedSettingPerPage","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","section","aside","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\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\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\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\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [ query.perPage, postsPerPage, inherit ] );\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}, [ queryId, instanceId ] );\n\tconst updateQuery = ( newQuery ) =>\n\t\tsetAttributes( { query: { ...query, ...newQuery } } );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\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\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\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<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tname={ name }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<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\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,Q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eAChBV,IAAA,CAACZ,iBAAiB;MAAC+D,KAAK,EAAC,UAAU;MAAAH,QAAA,eAClChD,IAAA,CAACP,aAAa;QACb2D,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAG5D,EAAE,CAAE,cAAe,CAAG;QAC9B6D,OAAO,EAAG,CACT;UAAED,KAAK,EAAE5D,EAAE,CAAE,iBAAkB,CAAC;UAAE8D,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,QAAQ;UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGvC,OAAS;QACjBwC,QAAQ,EAAKD,KAAK,IACjB/C,aAAa,CAAE;UAAEO,OAAO,EAAEwC;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGd,mBAAmB,CAAE3B,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpBjB,IAAA,CAACiB,OAAO;MAAA,GAAMK;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
@@ -18,8 +18,7 @@ export default function QueryPlaceholder({
18
18
  attributes,
19
19
  clientId,
20
20
  name,
21
- openPatternSelectionModal,
22
- setAttributes
21
+ openPatternSelectionModal
23
22
  }) {
24
23
  const [isStartingBlank, setIsStartingBlank] = useState(false);
25
24
  const blockProps = useBlockProps();
@@ -50,7 +49,6 @@ export default function QueryPlaceholder({
50
49
  return /*#__PURE__*/_jsx(QueryVariationPicker, {
51
50
  clientId: clientId,
52
51
  attributes: attributes,
53
- setAttributes: setAttributes,
54
52
  icon: icon,
55
53
  label: label
56
54
  });
@@ -78,7 +76,6 @@ export default function QueryPlaceholder({
78
76
  function QueryVariationPicker({
79
77
  clientId,
80
78
  attributes,
81
- setAttributes,
82
79
  icon,
83
80
  label
84
81
  }) {
@@ -94,16 +91,6 @@ function QueryVariationPicker({
94
91
  label: label,
95
92
  variations: scopeVariations,
96
93
  onSelect: variation => {
97
- if (variation.attributes) {
98
- setAttributes({
99
- ...variation.attributes,
100
- query: {
101
- ...variation.attributes.query,
102
- postType: attributes.query.postType || variation.attributes.query.postType
103
- },
104
- namespace: attributes.namespace
105
- });
106
- }
107
94
  if (variation.innerBlocks) {
108
95
  replaceInnerBlocks(clientId, createBlocksFromInnerBlocksTemplate(variation.innerBlocks), false);
109
96
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","createBlocksFromInnerBlocksTemplate","store","blocksStore","useState","useBlockProps","blockEditorStore","__experimentalBlockVariationPicker","Button","Placeholder","__","useScopedBlockVariations","useBlockNameForPatterns","jsx","_jsx","jsxs","_jsxs","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","setAttributes","isStartingBlank","setIsStartingBlank","blockProps","blockNameForPatterns","blockType","activeBlockVariation","hasPatterns","select","getActiveBlockVariation","getBlockType","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","length","icon","src","label","title","QueryVariationPicker","children","instructions","variant","onClick","scopeVariations","replaceInnerBlocks","variations","onSelect","variation","query","postType","namespace","innerBlocks"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations, useBlockNameForPatterns } from '../utils';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n\tsetAttributes,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\tconst { blockType, activeBlockVariation, hasPatterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t\thasPatterns: !! getPatternsByBlockTypes(\n\t\t\t\t\tblockNameForPatterns,\n\t\t\t\t\trootClientId\n\t\t\t\t).length,\n\t\t\t};\n\t\t},\n\t\t[ name, blockNameForPatterns, clientId, attributes ]\n\t);\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\ticon,\n\tlabel,\n} ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.attributes ) {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t...variation.attributes,\n\t\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\t\t...variation.attributes.query,\n\t\t\t\t\t\t\t\tpostType:\n\t\t\t\t\t\t\t\t\tattributes.query.postType ||\n\t\t\t\t\t\t\t\t\tvariation.attributes.query.postType,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnamespace: attributes.namespace,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tvariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\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</div>\n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ACJE;AACD,CAAC,EAAG;EACH,MAAMO,eAAe,GAAGnC,wBAAwB,CAAEO,UAAW,CAAC;EAC9D,MAAM;IAAE6B;EAAmB,CAAC,GAAG/C,WAAW,CAAEM,gBAAiB,CAAC;EAC9D,MAAMmB,UAAU,GAAGpB,aAAa,CAAC,CAAC;EAClC,oBACCS,IAAA;IAAA,GAAUW,UAAU;IAAAiB,QAAA,eACnB5B,IAAA,CAACP,kCAAkC;MAClC8B,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfS,UAAU,EAAGF,eAAiB;MAC9BG,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAAChC,UAAU,EAAG;UAC3BI,aAAa,CAAE;YACd,GAAG4B,SAAS,CAAChC,UAAU;YACvBiC,KAAK,EAAE;cACN,GAAGD,SAAS,CAAChC,UAAU,CAACiC,KAAK;cAC7BC,QAAQ,EACPlC,UAAU,CAACiC,KAAK,CAACC,QAAQ,IACzBF,SAAS,CAAChC,UAAU,CAACiC,KAAK,CAACC;YAC7B,CAAC;YACDC,SAAS,EAAEnC,UAAU,CAACmC;UACvB,CAAE,CAAC;QACJ;QACA,IAAKH,SAAS,CAACI,WAAW,EAAG;UAC5BP,kBAAkB,CACjB5B,QAAQ,EACRlB,mCAAmC,CAClCiD,SAAS,CAACI,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","createBlocksFromInnerBlocksTemplate","store","blocksStore","useState","useBlockProps","blockEditorStore","__experimentalBlockVariationPicker","Button","Placeholder","__","useScopedBlockVariations","useBlockNameForPatterns","jsx","_jsx","jsxs","_jsxs","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","blockProps","blockNameForPatterns","blockType","activeBlockVariation","hasPatterns","select","getActiveBlockVariation","getBlockType","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","length","icon","src","label","title","QueryVariationPicker","children","instructions","variant","onClick","scopeVariations","replaceInnerBlocks","variations","onSelect","variation","innerBlocks"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations, useBlockNameForPatterns } from '../utils';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\tconst { blockType, activeBlockVariation, hasPatterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t\thasPatterns: !! getPatternsByBlockTypes(\n\t\t\t\t\tblockNameForPatterns,\n\t\t\t\t\trootClientId\n\t\t\t\t).length,\n\t\t\t};\n\t\t},\n\t\t[ name, blockNameForPatterns, clientId, attributes ]\n\t);\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( { clientId, attributes, icon, label } ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\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C,CACV,CAAC;AAER;AAEA,SAAS8B,oBAAoBA,CAAE;EAAErB,QAAQ;EAAED,UAAU;EAAEkB,IAAI;EAAEE;AAAM,CAAC,EAAG;EACtE,MAAMO,eAAe,GAAGlC,wBAAwB,CAAEO,UAAW,CAAC;EAC9D,MAAM;IAAE4B;EAAmB,CAAC,GAAG9C,WAAW,CAAEM,gBAAiB,CAAC;EAC9D,MAAMkB,UAAU,GAAGnB,aAAa,CAAC,CAAC;EAClC,oBACCS,IAAA;IAAA,GAAUU,UAAU;IAAAiB,QAAA,eACnB3B,IAAA,CAACP,kCAAkC;MAClC6B,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfS,UAAU,EAAGF,eAAiB;MAC9BG,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BJ,kBAAkB,CACjB3B,QAAQ,EACRlB,mCAAmC,CAClCgD,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { ToolbarGroup, Dropdown, ToolbarButton, __experimentalNumberControl as NumberControl } from '@wordpress/components';
4
+ import { ToolbarGroup, ToolbarButton } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { settings } from '@wordpress/icons';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
@@ -11,93 +10,20 @@ import { settings } from '@wordpress/icons';
11
10
  import { usePatterns } from '../utils';
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
13
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
13
  export default function QueryToolbar({
16
- attributes: {
17
- query
18
- },
19
- setQuery,
20
14
  openPatternSelectionModal,
21
15
  name,
22
16
  clientId
23
17
  }) {
24
18
  const hasPatterns = !!usePatterns(clientId, name).length;
25
- return /*#__PURE__*/_jsxs(_Fragment, {
26
- children: [!query.inherit && /*#__PURE__*/_jsx(ToolbarGroup, {
27
- children: /*#__PURE__*/_jsx(Dropdown, {
28
- contentClassName: "block-library-query-toolbar__popover",
29
- renderToggle: ({
30
- onToggle
31
- }) => /*#__PURE__*/_jsx(ToolbarButton, {
32
- icon: settings,
33
- label: __('Display settings'),
34
- onClick: onToggle
35
- }),
36
- renderContent: () => /*#__PURE__*/_jsxs(_Fragment, {
37
- children: [/*#__PURE__*/_jsx(NumberControl, {
38
- __unstableInputWidth: "60px",
39
- className: "block-library-query-toolbar__popover-number-control",
40
- label: __('Items per Page'),
41
- labelPosition: "edge",
42
- min: 1,
43
- max: 100,
44
- onChange: value => {
45
- if (isNaN(value) || value < 1 || value > 100) {
46
- return;
47
- }
48
- setQuery({
49
- perPage: value
50
- });
51
- },
52
- step: "1",
53
- value: query.perPage,
54
- isDragEnabled: false
55
- }), /*#__PURE__*/_jsx(NumberControl, {
56
- __unstableInputWidth: "60px",
57
- className: "block-library-query-toolbar__popover-number-control",
58
- label: __('Offset'),
59
- labelPosition: "edge",
60
- min: 0,
61
- max: 100,
62
- onChange: value => {
63
- if (isNaN(value) || value < 0 || value > 100) {
64
- return;
65
- }
66
- setQuery({
67
- offset: value
68
- });
69
- },
70
- step: "1",
71
- value: query.offset,
72
- isDragEnabled: false
73
- }), /*#__PURE__*/_jsx(NumberControl, {
74
- __unstableInputWidth: "60px",
75
- className: "block-library-query-toolbar__popover-number-control",
76
- label: __('Max pages to show'),
77
- labelPosition: "edge",
78
- min: 0,
79
- onChange: value => {
80
- if (isNaN(value) || value < 0) {
81
- return;
82
- }
83
- setQuery({
84
- pages: value
85
- });
86
- },
87
- step: "1",
88
- value: query.pages,
89
- isDragEnabled: false,
90
- help: __('Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).')
91
- })]
92
- })
93
- })
94
- }), hasPatterns && /*#__PURE__*/_jsx(ToolbarGroup, {
19
+ return /*#__PURE__*/_jsx(_Fragment, {
20
+ children: hasPatterns && /*#__PURE__*/_jsx(ToolbarGroup, {
95
21
  className: "wp-block-template-part__block-control-group",
96
22
  children: /*#__PURE__*/_jsx(ToolbarButton, {
97
23
  onClick: openPatternSelectionModal,
98
24
  children: __('Replace')
99
25
  })
100
- })]
26
+ })
101
27
  });
102
28
  }
103
29
  //# sourceMappingURL=query-toolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ToolbarGroup","Dropdown","ToolbarButton","__experimentalNumberControl","NumberControl","__","settings","usePatterns","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","QueryToolbar","attributes","query","setQuery","openPatternSelectionModal","name","clientId","hasPatterns","length","children","inherit","contentClassName","renderToggle","onToggle","icon","label","onClick","renderContent","__unstableInputWidth","className","labelPosition","min","max","onChange","value","isNaN","perPage","step","isDragEnabled","offset","pages","help"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tDropdown,\n\tToolbarButton,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { usePatterns } from '../utils';\n\nexport default function QueryToolbar( {\n\tattributes: { query },\n\tsetQuery,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst hasPatterns = !! usePatterns( clientId, name ).length;\n\n\treturn (\n\t\t<>\n\t\t\t{ ! query.inherit && (\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tcontentClassName=\"block-library-query-toolbar__popover\"\n\t\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\t\t\tlabel={ __( 'Display settings' ) }\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-query-toolbar__popover-number-control\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Items per Page' ) }\n\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tisNaN( value ) ||\n\t\t\t\t\t\t\t\t\t\t\tvalue < 1 ||\n\t\t\t\t\t\t\t\t\t\t\tvalue > 100\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\tperPage: value,\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\tstep=\"1\"\n\t\t\t\t\t\t\t\t\tvalue={ query.perPage }\n\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-query-toolbar__popover-number-control\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tisNaN( value ) ||\n\t\t\t\t\t\t\t\t\t\t\tvalue < 0 ||\n\t\t\t\t\t\t\t\t\t\t\tvalue > 100\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetQuery( { offset: value } );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\t\t\tvalue={ query.offset }\n\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-query-toolbar__popover-number-control\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Max pages to show' ) }\n\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tif ( isNaN( value ) || value < 0 ) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetQuery( { pages: value } );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\t\t\tvalue={ query.pages }\n\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t\t{ hasPatterns && (\n\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t<ToolbarButton onClick={ openPatternSelectionModal }>\n\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,QAAQ,EACRC,aAAa,EACbC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,kBAAkB;;AAE3C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEvC,eAAe,SAASC,YAAYA,CAAE;EACrCC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,QAAQ;EACRC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CAAC,CAAEd,WAAW,CAAEa,QAAQ,EAAED,IAAK,CAAC,CAACG,MAAM;EAE3D,oBACCT,KAAA,CAAAF,SAAA;IAAAY,QAAA,GACG,CAAEP,KAAK,CAACQ,OAAO,iBAChBf,IAAA,CAACT,YAAY;MAAAuB,QAAA,eACZd,IAAA,CAACR,QAAQ;QACRwB,gBAAgB,EAAC,sCAAsC;QACvDC,YAAY,EAAGA,CAAE;UAAEC;QAAS,CAAC,kBAC5BlB,IAAA,CAACP,aAAa;UACb0B,IAAI,EAAGtB,QAAU;UACjBuB,KAAK,EAAGxB,EAAE,CAAE,kBAAmB,CAAG;UAClCyB,OAAO,EAAGH;QAAU,CACpB,CACC;QACHI,aAAa,EAAGA,CAAA,kBACflB,KAAA,CAAAF,SAAA;UAAAY,QAAA,gBACCd,IAAA,CAACL,aAAa;YACb4B,oBAA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AAM,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAG;gBAClC;cACD;cACArB,QAAQ,CAAE;gBAAE2B,KAAK,EAAEN;cAAM,CAAE,CAAC;YAC7B,CAAG;YACHG,IAAI,EAAC,GAAG;YACRH,KAAK,EAAGtB,KAAK,CAAC4B,KAAO;YACrBF,aAAa,EAAG,KAAO;YACvBG,IAAI,EAAGxC,EAAE,CACR,uGACD;UAAG,CACH,CAAC;QAAA,CACD;MACA,CACH;IAAC,CACW,CACd,EACCgB,WAAW,iBACZZ,IAAA,CAACT,YAAY;MAACiC,SAAS,EAAC,6CAA6C;MAAAV,QAAA,eACpEd,IAAA,CAACP,aAAa;QAAC4B,OAAO,EAAGZ,yBAA2B;QAAAK,QAAA,EACjDlB,EAAE,CAAE,SAAU;MAAC,CACH;IAAC,CACH,CACd;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["ToolbarGroup","ToolbarButton","__","usePatterns","jsx","_jsx","Fragment","_Fragment","QueryToolbar","openPatternSelectionModal","name","clientId","hasPatterns","length","children","className","onClick"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { usePatterns } from '../utils';\n\nexport default function QueryToolbar( {\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst hasPatterns = !! usePatterns( clientId, name ).length;\n\n\treturn (\n\t\t<>\n\t\t\t{ hasPatterns && (\n\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t<ToolbarButton onClick={ openPatternSelectionModal }>\n\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,aAAa,QAAQ,uBAAuB;AACnE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEvC,eAAe,SAASC,YAAYA,CAAE;EACrCC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CAAC,CAAET,WAAW,CAAEQ,QAAQ,EAAED,IAAK,CAAC,CAACG,MAAM;EAE3D,oBACCR,IAAA,CAAAE,SAAA;IAAAO,QAAA,EACGF,WAAW,iBACZP,IAAA,CAACL,YAAY;MAACe,SAAS,EAAC,6CAA6C;MAAAD,QAAA,eACpET,IAAA,CAACJ,aAAa;QAACe,OAAO,EAAGP,yBAA2B;QAAAK,QAAA,EACjDZ,EAAE,CAAE,SAAU;MAAC,CACH;IAAC,CACH;EACd,CACA,CAAC;AAEL","ignoreList":[]}
@@ -143,12 +143,17 @@ export const usePostTypes = () => {
143
143
  export const useTaxonomies = postType => {
144
144
  const taxonomies = useSelect(select => {
145
145
  const {
146
- getTaxonomies
146
+ getTaxonomies,
147
+ getPostType
147
148
  } = select(coreStore);
148
- return getTaxonomies({
149
- type: postType,
150
- per_page: -1
151
- });
149
+ // Does the post type have taxonomies?
150
+ if (getPostType(postType)?.taxonomies?.length > 0) {
151
+ return getTaxonomies({
152
+ type: postType,
153
+ per_page: -1
154
+ });
155
+ }
156
+ return [];
152
157
  }, [postType]);
153
158
  return useMemo(() => {
154
159
  return taxonomies?.filter(({
@@ -207,7 +212,8 @@ export const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) =>
207
212
  query: {
208
213
  postType,
209
214
  inherit
210
- }
215
+ },
216
+ namespace
211
217
  } = queryBlockAttributes;
212
218
  const clonedBlocks = blocks.map(block => cloneBlock(block));
213
219
  const queryClientIds = [];
@@ -220,6 +226,9 @@ export const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) =>
220
226
  postType,
221
227
  inherit
222
228
  };
229
+ if (namespace) {
230
+ block.attributes.namespace = namespace;
231
+ }
223
232
  queryClientIds.push(block.clientId);
224
233
  }
225
234
  block.innerBlocks?.forEach(innerBlock => {