@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
@@ -137,7 +137,8 @@ function ParentControl({
137
137
  onInputChange: debouncedSearch,
138
138
  suggestions: suggestions,
139
139
  onChange: onParentChange,
140
- __experimentalShowHowTo: false
140
+ __experimentalShowHowTo: false,
141
+ __nextHasNoMarginBottom: true
141
142
  });
142
143
  }
143
144
  var _default = exports.default = ParentControl;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_element","_compose","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","useEffect","currentParentsInfo","getEntitiesInfo","mapToIHasNameAndId","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","useMemo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","jsx","FormTokenField","label","__","onInputChange","__experimentalShowHowTo","_default","exports","default"],"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/>\n\t);\n}\n\nexport default ParentControl;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAAkE,IAAAO,WAAA,GAAAP,OAAA;AAblE;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMQ,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,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC5C,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAF,iBAAQ,EAAEX,WAAY,CAAC;EACnD,MAAM,CAAEc,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAJ,iBAAQ,EAAEX,WAAY,CAAC;EAC/D,MAAMgB,eAAe,GAAG,IAAAC,oBAAW,EAAEP,SAAS,EAAE,GAAI,CAAC;EACrD,MAAM;IAAEQ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,GAAGC,KAAK,CAACC,IAAI,CACrBH,QAAQ,CAACb,MAAM,CAAE,CAAEC,WAAW,EAAEE,MAAM,KAAM;MAC3C;MACA,MAAMD,EAAE,GAAGQ,YAAY,CAAEH,YAAY,CAACU,SAAS,EAAEd,MAAO,CAAC;MACzD,IAAKD,EAAE,EAAG;QACTD,WAAW,CAACiB,GAAG,CAAEhB,EAAG,CAAC;MACtB;MACA,OAAOD,WAAW;IACnB,CAAC,EAAE,IAAIkB,GAAG,CAAC,CAAE,CACd,CAAC;IACDzC,cAAc,CAAEf,WAAY,CAAC;IAC7BQ,QAAQ,CAAE;MAAEF,OAAO,EAAE6C;IAAI,CAAE,CAAC;EAC7B,CAAC;EACD,oBACC,IAAApD,WAAA,CAAA0D,GAAA,EAAChE,WAAA,CAAAiE,cAAc;IACdC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBhD,KAAK,EAAGA,KAAO;IACfiD,aAAa,EAAG7C,eAAiB;IACjCF,WAAW,EAAGA,WAAa;IAC3BN,QAAQ,EAAGyC,cAAgB;IAC3Ba,uBAAuB,EAAG;EAAO,CACjC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc5D,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_coreData","_element","_compose","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","useEffect","currentParentsInfo","getEntitiesInfo","mapToIHasNameAndId","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","useMemo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","jsx","FormTokenField","label","__","onInputChange","__experimentalShowHowTo","__nextHasNoMarginBottom","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAAkE,IAAAO,WAAA,GAAAP,OAAA;AAblE;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMQ,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,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC5C,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAG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,KAAM;IACxD,MAAMD,EAAE,GAAGC,MAAM,EAAED,EAAE,IAAIS,oBAAoB,GAAIR,MAAM,CAAE,EAAED,EAAE;IAC7D,IAAKA,EAAE,EAAG;MACT,OAAOA,EAAE;IACV;EACD,CAAC;EACD,MAAMU,cAAc,GAAKC,QAAQ,IAAM;IACtC,MAAMC,GAAG,GAAGC,KAAK,CAACC,IAAI,CACrBH,QAAQ,CAACb,MAAM,CAAE,CAAEC,WAAW,EAAEE,MAAM,KAAM;MAC3C;MACA,MAAMD,EAAE,GAAGQ,YAAY,CAAEH,YAAY,CAACU,SAAS,EAAEd,MAAO,CAAC;MACzD,IAAKD,EAAE,EAAG;QACTD,WAAW,CAACiB,GAAG,CAAEhB,EAAG,CAAC;MACtB;MACA,OAAOD,WAAW;IACnB,CAAC,EAAE,IAAIkB,GAAG,CAAC,CAAE,CACd,CAAC;IACDzC,cAAc,CAAEf,WAAY,CAAC;IAC7BQ,QAAQ,CAAE;MAAEF,OAAO,EAAE6C;IAAI,CAAE,CAAC;EAC7B,CAAC;EACD,oBACC,IAAApD,WAAA,CAAA0D,GAAA,EAAChE,WAAA,CAAAiE,cAAc;IACdC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBhD,KAAK,EAAGA,KAAO;IACfiD,aAAa,EAAG7C,eAAiB;IACjCF,WAAW,EAAGA,WAAa;IAC3BN,QAAQ,EAAGyC,cAAgB;IAC3Ba,uBAAuB,EAAG,KAAO;IACjCC,uBAAuB;EAAA,CACvB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7D,aAAa","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _components = require("@wordpress/components");
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ const MIN_POSTS_PER_PAGE = 1;
15
+ const MAX_POSTS_PER_PAGE = 100;
16
+ const PerPageControl = ({
17
+ perPage,
18
+ offset = 0,
19
+ onChange
20
+ }) => {
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
22
+ __next40pxDefaultSize: true,
23
+ __nextHasNoMarginBottom: true,
24
+ label: (0, _i18n.__)('Posts per page'),
25
+ min: MIN_POSTS_PER_PAGE,
26
+ max: MAX_POSTS_PER_PAGE,
27
+ onChange: newPerPage => {
28
+ if (isNaN(newPerPage) || newPerPage < MIN_POSTS_PER_PAGE || newPerPage > MAX_POSTS_PER_PAGE) {
29
+ return;
30
+ }
31
+ onChange({
32
+ perPage: newPerPage,
33
+ offset
34
+ });
35
+ },
36
+ value: parseInt(perPage, 10)
37
+ });
38
+ };
39
+ var _default = exports.default = PerPageControl;
40
+ //# sourceMappingURL=per-page-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","_jsxRuntime","MIN_POSTS_PER_PAGE","MAX_POSTS_PER_PAGE","PerPageControl","perPage","offset","onChange","jsx","RangeControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","__","min","max","newPerPage","isNaN","value","parseInt","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAqC,IAAAE,WAAA,GAAAF,OAAA;AAJrC;AACA;AACA;;AAIA,MAAMG,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,oBACC,IAAAN,WAAA,CAAAO,GAAA,EAACV,WAAA,CAAAW,YAAY;IACZC,qBAAqB;IACrBC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IAChCC,GAAG,EAAGZ,kBAAoB;IAC1Ba,GAAG,EAAGZ,kBAAoB;IAC1BI,QAAQ,EAAKS,UAAU,IAAM;MAC5B,IACCC,KAAK,CAAED,UAAW,CAAC,IACnBA,UAAU,GAAGd,kBAAkB,IAC/Bc,UAAU,GAAGb,kBAAkB,EAC9B;QACD;MACD;MACAI,QAAQ,CAAE;QAAEF,OAAO,EAAEW,UAAU;QAAEV;MAAO,CAAE,CAAC;IAC5C,CAAG;IACHY,KAAK,EAAGC,QAAQ,CAAEd,OAAO,EAAE,EAAG;EAAG,CACjC,CAAC;AAEJ,CAAC;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalB,cAAc","ignoreList":[]}
@@ -27,11 +27,12 @@ function StickyControl({
27
27
  }) {
28
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
29
29
  __nextHasNoMarginBottom: true,
30
+ __next40pxDefaultSize: true,
30
31
  label: (0, _i18n.__)('Sticky posts'),
31
32
  options: stickyOptions,
32
33
  value: value,
33
34
  onChange: onChange,
34
- help: (0, _i18n.__)('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.')
35
+ help: (0, _i18n.__)('Sticky posts always appear first, regardless of their publish date.')
35
36
  });
36
37
  }
37
38
  //# sourceMappingURL=sticky-control.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_jsxRuntime","stickyOptions","label","__","value","StickyControl","onChange","jsx","SelectControl","__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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAqC,IAAAE,WAAA,GAAAF,OAAA;AAJrC;AACA;AACA;;AAIA,MAAMG,aAAa,GAAG,CACrB;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EAAEC,KAAK,EAAE;AAAG,CAAC,EACrC;EAAEF,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EAAEC,KAAK,EAAE;AAAU,CAAC,EAC5C;EAAEF,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EAAEC,KAAK,EAAE;AAAO,CAAC,CACtC;AAEc,SAASC,aAAaA,CAAE;EAAED,KAAK;EAAEE;AAAS,CAAC,EAAG;EAC5D,oBACC,IAAAN,WAAA,CAAAO,GAAA,EAACV,WAAA,CAAAW,aAAa;IACbC,uBAAuB;IACvBP,KAAK,EAAG,IAAAC,QAAE,EAAE,cAAe,CAAG;IAC9BO,OAAO,EAAGT,aAAe;IACzBG,KAAK,EAAGA,KAAO;IACfE,QAAQ,EAAGA,QAAU;IACrBK,IAAI,EAAG,IAAAR,QAAE,EACR,wJACD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_jsxRuntime","stickyOptions","label","__","value","StickyControl","onChange","jsx","SelectControl","__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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAqC,IAAAE,WAAA,GAAAF,OAAA;AAJrC;AACA;AACA;;AAIA,MAAMG,aAAa,GAAG,CACrB;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EAAEC,KAAK,EAAE;AAAG,CAAC,EACrC;EAAEF,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EAAEC,KAAK,EAAE;AAAU,CAAC,EAC5C;EAAEF,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EAAEC,KAAK,EAAE;AAAO,CAAC,CACtC;AAEc,SAASC,aAAaA,CAAE;EAAED,KAAK;EAAEE;AAAS,CAAC,EAAG;EAC5D,oBACC,IAAAN,WAAA,CAAAO,GAAA,EAACV,WAAA,CAAAW,aAAa;IACbC,uBAAuB;IACvBC,qBAAqB;IACrBR,KAAK,EAAG,IAAAC,QAAE,EAAE,cAAe,CAAG;IAC9BQ,OAAO,EAAGV,aAAe;IACzBG,KAAK,EAAGA,KAAO;IACfE,QAAQ,EAAGA,QAAU;IACrBM,IAAI,EAAG,IAAAT,QAAE,EACR,qEACD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
@@ -59,7 +59,8 @@ function TaxonomyControls({
59
59
  if (!taxonomies || taxonomies.length === 0) {
60
60
  return null;
61
61
  }
62
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
63
+ spacing: 4,
63
64
  children: taxonomies.map(taxonomy => {
64
65
  const termIds = taxQuery?.[taxonomy.slug] || [];
65
66
  const handleChange = newTermIds => onChange({
@@ -187,7 +188,9 @@ function TaxonomyItem({
187
188
  suggestions: suggestions,
188
189
  displayTransform: _htmlEntities.decodeEntities,
189
190
  onChange: onTermsChange,
190
- __experimentalShowHowTo: false
191
+ __experimentalShowHowTo: false,
192
+ __nextHasNoMarginBottom: true,
193
+ __next40pxDefaultSize: true
191
194
  })
192
195
  });
193
196
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","Fragment","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAb5C;AACA;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aAAa,CAAG,CAAC;EAC/B;EACA,IAAAE,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEZ,iBAAiB,EAAG;MAC1B;IACD;IACAJ,cAAc,CAAEG,aAAa,CAAChB,GAAG,CAAImC,MAAM,IAAMA,MAAM,CAACjD,IAAK,CAAE,CAAC;EACjE,CAAC,EAAE,CAAE8B,aAAa,EAAEC,iBAAiB,CAAG,CAAC;EACzC,MAAMmB,aAAa,GAAKC,aAAa,IAAM;IAC1C,MAAMhC,UAAU,GAAG,IAAIiC,GAAG,CAAC,CAAC;IAC5B,KAAM,MAAMzD,SAAS,IAAIwD,aAAa,EAAG;MACxC,MAAMvD,MAAM,GAAGH,oBAAoB,CAAEqC,aAAa,EAAEnC,SAAU,CAAC;MAC/D,IAAKC,MAAM,EAAG;QACbuB,UAAU,CAACkC,GAAG,CAAEzD,MAAO,CAAC;MACzB;IACD;IACA+B,cAAc,CAAEvC,WAAY,CAAC;IAC7BgB,QAAQ,CAAEkD,KAAK,CAACC,IAAI,CAAEpC,UAAW,CAAE,CAAC;EACrC,CAAC;EACD,oBACC,IAAAhC,WAAA,CAAAwB,GAAA;IAAK6C,SAAS,EAAC,iDAAiD;IAAA3C,QAAA,eAC/D,IAAA1B,WAAA,CAAAwB,GAAA,EAAChC,WAAA,CAAA8E,cAAc;MACdC,KAAK,EAAG3C,QAAQ,CAACf,IAAM;MACvBwB,KAAK,EAAGA,KAAO;MACfmC,aAAa,EAAG/B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3BkC,gBAAgB,EAAGC,4BAAgB;MACnCzD,QAAQ,EAAG8C,aAAe;MAC1BY,uBAAuB,EAAG;IAAO,CACjC;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","__experimentalVStack","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAhB5C;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAMQ,WAAW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B;EACA,IAAAE,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEZ,iBAAiB,EAAG;MAC1B;IACD;IACAJ,cAAc,CAAEG,aAAa,CAAChB,GAAG,CAAImC,MAAM,IAAMA,MAAM,CAAClD,IAAK,CAAE,CAAC;EACjE,CAAC,EAAE,CAAE+B,aAAa,EAAEC,iBAAiB,CAAG,CAAC;EACzC,MAAMmB,aAAa,GAAKC,aAAa,IAAM;IAC1C,MAAMhC,UAAU,GAAG,IAAIiC,GAAG,CAAC,CAAC;IAC5B,KAAM,MAAM1D,SAAS,IAAIyD,aAAa,EAAG;MACxC,MAAMxD,MAAM,GAAGH,oBAAoB,CAAEsC,aAAa,EAAEpC,SAAU,CAAC;MAC/D,IAAKC,MAAM,EAAG;QACbwB,UAAU,CAACkC,GAAG,CAAE1D,MAAO,CAAC;MACzB;IACD;IACAgC,cAAc,CAAExC,WAAY,CAAC;IAC7BgB,QAAQ,CAAEmD,KAAK,CAACC,IAAI,CAAEpC,UAAW,CAAE,CAAC;EACrC,CAAC;EACD,oBACC,IAAAjC,WAAA,CAAAwB,GAAA;IAAK8C,SAAS,EAAC,iDAAiD;IAAA3C,QAAA,eAC/D,IAAA3B,WAAA,CAAAwB,GAAA,EAAChC,WAAA,CAAA+E,cAAc;MACdC,KAAK,EAAG3C,QAAQ,CAAChB,IAAM;MACvByB,KAAK,EAAGA,KAAO;MACfmC,aAAa,EAAG/B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3BkC,gBAAgB,EAAGC,4BAAgB;MACnC1D,QAAQ,EAAG+C,aAAe;MAC1BY,uBAAuB,EAAG,KAAO;MACjCC,uBAAuB;MACvBC,qBAAqB;IAAA,CACrB;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -58,11 +58,20 @@ function QueryContent({
58
58
  } = select(_blockEditor.store);
59
59
  const {
60
60
  getEntityRecord,
61
+ getEntityRecordEdits,
61
62
  canUser
62
63
  } = select(_coreData.store);
63
- const settingPerPage = canUser('read', 'settings') ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
64
+ const settingPerPage = canUser('read', {
65
+ kind: 'root',
66
+ name: 'site'
67
+ }) ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
68
+
69
+ // Gets changes made via the template area posts per page setting. These won't be saved
70
+ // until the page is saved, but we should reflect this setting within the query loops
71
+ // that inherit it.
72
+ const editedSettingPerPage = +getEntityRecordEdits('root', 'site')?.posts_per_page;
64
73
  return {
65
- postsPerPage: settingPerPage || DEFAULTS_POSTS_PER_PAGE
74
+ postsPerPage: editedSettingPerPage || settingPerPage || DEFAULTS_POSTS_PER_PAGE
66
75
  };
67
76
  }, []);
68
77
  // There are some effects running where some initialization logic is
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_queryToolbar","_interopRequireDefault","_inspectorControls","_enhancedPaginationModal","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","queryId","query","displayLayout","tagName","TagName","inherit","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","canUser","coreStore","settingPerPage","posts_per_page","useEffect","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","__","section","aside","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","setDisplayLayout","BlockControls","group","SelectControl","__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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,wBAAA,GAAAF,sBAAA,CAAAR,OAAA;AAAkE,IAAAW,WAAA,GAAAX,OAAA;AAtBlE;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,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGpD,OAAS;QACjBqD,QAAQ,EAAKD,KAAK,IACjB5D,aAAa,CAAE;UAAEO,OAAO,EAAEqD;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGtB,mBAAmB,CAAEhC,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpB,IAAAb,WAAA,CAAAqD,GAAA,EAACxC,OAAO;MAAA,GAAMS;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_queryToolbar","_interopRequireDefault","_inspectorControls","_enhancedPaginationModal","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","queryId","query","displayLayout","tagName","TagName","inherit","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","useEffect","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","__","section","aside","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","setDisplayLayout","BlockControls","group","SelectControl","__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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,I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B,EAAGA;MAA2B,CACvD;IAAC,CACY,CAAC,eAChB,IAAAN,WAAA,CAAAwD,GAAA,EAAChE,YAAA,CAAAkE,iBAAiB;MAACI,KAAK,EAAC,UAAU;MAAAP,QAAA,eAClC,IAAAvD,WAAA,CAAAwD,GAAA,EAAC/D,WAAA,CAAAsE,aAAa;QACbC,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAG,IAAAhB,QAAE,EAAE,cAAe,CAAG;QAC9BiB,OAAO,EAAG,CACT;UAAED,KAAK,EAAE,IAAAhB,QAAE,EAAE,iBAAkB,CAAC;UAAEkB,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,EAAGvD,OAAS;QACjBwD,QAAQ,EAAKD,KAAK,IACjB/D,aAAa,CAAE;UAAEO,OAAO,EAAEwD;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGtB,mBAAmB,CAAEnC,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpB,IAAAb,WAAA,CAAAwD,GAAA,EAAC3C,OAAO;MAAA,GAAMS;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
@@ -24,8 +24,7 @@ function QueryPlaceholder({
24
24
  attributes,
25
25
  clientId,
26
26
  name,
27
- openPatternSelectionModal,
28
- setAttributes
27
+ openPatternSelectionModal
29
28
  }) {
30
29
  const [isStartingBlank, setIsStartingBlank] = (0, _element.useState)(false);
31
30
  const blockProps = (0, _blockEditor.useBlockProps)();
@@ -56,7 +55,6 @@ function QueryPlaceholder({
56
55
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(QueryVariationPicker, {
57
56
  clientId: clientId,
58
57
  attributes: attributes,
59
- setAttributes: setAttributes,
60
58
  icon: icon,
61
59
  label: label
62
60
  });
@@ -84,7 +82,6 @@ function QueryPlaceholder({
84
82
  function QueryVariationPicker({
85
83
  clientId,
86
84
  attributes,
87
- setAttributes,
88
85
  icon,
89
86
  label
90
87
  }) {
@@ -100,16 +97,6 @@ function QueryVariationPicker({
100
97
  label: label,
101
98
  variations: scopeVariations,
102
99
  onSelect: variation => {
103
- if (variation.attributes) {
104
- setAttributes({
105
- ...variation.attributes,
106
- query: {
107
- ...variation.attributes.query,
108
- postType: attributes.query.postType || variation.attributes.query.postType
109
- },
110
- namespace: attributes.namespace
111
- });
112
- }
113
100
  if (variation.innerBlocks) {
114
101
  replaceInnerBlocks(clientId, (0, _blocks.createBlocksFromInnerBlocksTemplate)(variation.innerBlocks), false);
115
102
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_utils","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","setAttributes","isStartingBlank","setIsStartingBlank","useState","blockProps","useBlockProps","blockNameForPatterns","useBlockNameForPatterns","blockType","activeBlockVariation","hasPatterns","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","length","icon","src","label","title","jsx","QueryVariationPicker","children","jsxs","Placeholder","instructions","__","Button","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","__experimentalBlockVariationPicker","variations","onSelect","variation","query","postType","namespace","innerBlocks","createBlocksFromInnerBlocksTemplate"],"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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oreList":[]}
1
+ {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_utils","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","useState","blockProps","useBlockProps","blockNameForPatterns","useBlockNameForPatterns","blockType","activeBlockVariation","hasPatterns","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","length","icon","src","label","title","jsx","QueryVariationPicker","children","jsxs","Placeholder","instructions","__","Button","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","__experimentalBlockVariationPicker","variations","onSelect","variation","innerBlocks","createBlocksFromInnerBlocksTemplate"],"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\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\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA6E,IAAAO,WAAA,GAAAP,OAAA;AApB7E;AACA;AACA;;AAeA;AACA;AACA;;AAGe,SAASQ,gBAAgBA,CAAE;EACzCC,UAAU;EACVC,QAAQ;EACRC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjE,MAAMC,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,oBAAoB,GAAG,IAAAC,8BAAuB,EACnDT,QAAQ,EACRD,UACD,CAAC;EACD,MAAM;IAAEW,SAAS;IAAEC,oBAAoB;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAC/DC,MAAM,IAAM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A8B,GAAA,EAACjC,WAAA,CAAAwC,MAAM;QACNC,OAAO,EAAC,SAAS;QACjBC,OAAO,EAAGlC,yBAA2B;QAAA2B,QAAA,EAEnC,IAAAI,QAAE,EAAE,QAAS;MAAC,CACT,CACR,eAED,IAAApC,WAAA,CAAA8B,GAAA,EAACjC,WAAA,CAAAwC,MAAM;QACNC,OAAO,EAAC,WAAW;QACnBC,OAAO,EAAGA,CAAA,KAAM;UACfhC,kBAAkB,CAAE,IAAK,CAAC;QAC3B,CAAG;QAAAyB,QAAA,EAED,IAAAI,QAAE,EAAE,aAAc;MAAC,CACd,CAAC;IAAA,CACG;EAAC,CACV,CAAC;AAER;AAEA,SAASL,oBAAoBA,CAAE;EAAE5B,QAAQ;EAAED,UAAU;EAAEwB,IAAI;EAAEE;AAAM,CAAC,EAAG;EACtE,MAAMY,eAAe,GAAG,IAAAC,+BAAwB,EAAEvC,UAAW,CAAC;EAC9D,MAAM;IAAEwC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEpB,kBAAiB,CAAC;EAC9D,MAAMd,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,oBACC,IAAAV,WAAA,CAAA8B,GAAA;IAAA,GAAUrB,UAAU;IAAAuB,QAAA,eACnB,IAAAhC,WAAA,CAAA8B,GAAA,EAAClC,YAAA,CAAAgD,kCAAkC;MAClClB,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfiB,UAAU,EAAGL,eAAiB;MAC9BM,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BN,kBAAkB,CACjBvC,QAAQ,EACR,IAAA8C,2CAAmC,EAClCF,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = QueryToolbar;
7
7
  var _components = require("@wordpress/components");
8
8
  var _i18n = require("@wordpress/i18n");
9
- var _icons = require("@wordpress/icons");
10
9
  var _utils = require("../utils");
11
10
  var _jsxRuntime = require("react/jsx-runtime");
12
11
  /**
@@ -18,91 +17,19 @@ var _jsxRuntime = require("react/jsx-runtime");
18
17
  */
19
18
 
20
19
  function QueryToolbar({
21
- attributes: {
22
- query
23
- },
24
- setQuery,
25
20
  openPatternSelectionModal,
26
21
  name,
27
22
  clientId
28
23
  }) {
29
24
  const hasPatterns = !!(0, _utils.usePatterns)(clientId, name).length;
30
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
31
- children: [!query.inherit && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
32
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
33
- contentClassName: "block-library-query-toolbar__popover",
34
- renderToggle: ({
35
- onToggle
36
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
37
- icon: _icons.settings,
38
- label: (0, _i18n.__)('Display settings'),
39
- onClick: onToggle
40
- }),
41
- renderContent: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
42
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalNumberControl, {
43
- __unstableInputWidth: "60px",
44
- className: "block-library-query-toolbar__popover-number-control",
45
- label: (0, _i18n.__)('Items per Page'),
46
- labelPosition: "edge",
47
- min: 1,
48
- max: 100,
49
- onChange: value => {
50
- if (isNaN(value) || value < 1 || value > 100) {
51
- return;
52
- }
53
- setQuery({
54
- perPage: value
55
- });
56
- },
57
- step: "1",
58
- value: query.perPage,
59
- isDragEnabled: false
60
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalNumberControl, {
61
- __unstableInputWidth: "60px",
62
- className: "block-library-query-toolbar__popover-number-control",
63
- label: (0, _i18n.__)('Offset'),
64
- labelPosition: "edge",
65
- min: 0,
66
- max: 100,
67
- onChange: value => {
68
- if (isNaN(value) || value < 0 || value > 100) {
69
- return;
70
- }
71
- setQuery({
72
- offset: value
73
- });
74
- },
75
- step: "1",
76
- value: query.offset,
77
- isDragEnabled: false
78
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalNumberControl, {
79
- __unstableInputWidth: "60px",
80
- className: "block-library-query-toolbar__popover-number-control",
81
- label: (0, _i18n.__)('Max pages to show'),
82
- labelPosition: "edge",
83
- min: 0,
84
- onChange: value => {
85
- if (isNaN(value) || value < 0) {
86
- return;
87
- }
88
- setQuery({
89
- pages: value
90
- });
91
- },
92
- step: "1",
93
- value: query.pages,
94
- isDragEnabled: false,
95
- help: (0, _i18n.__)('Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).')
96
- })]
97
- })
98
- })
99
- }), hasPatterns && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
26
+ children: hasPatterns && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
100
27
  className: "wp-block-template-part__block-control-group",
101
28
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
102
29
  onClick: openPatternSelectionModal,
103
30
  children: (0, _i18n.__)('Replace')
104
31
  })
105
- })]
32
+ })
106
33
  });
107
34
  }
108
35
  //# sourceMappingURL=query-toolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_icons","_utils","_jsxRuntime","QueryToolbar","attributes","query","setQuery","openPatternSelectionModal","name","clientId","hasPatterns","usePatterns","length","jsxs","Fragment","children","inherit","jsx","ToolbarGroup","Dropdown","contentClassName","renderToggle","onToggle","ToolbarButton","icon","settings","label","__","onClick","renderContent","__experimentalNumberControl","__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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAuC,IAAAI,WAAA,GAAAJ,OAAA;AAfvC;AACA;AACA;;AAUA;AACA;AACA;;AAGe,SAASK,YAAYA,CAAE;EACrCC,UAAU,EAAE;IAAEC;EAAM,CAAC;EACrBC,QAAQ;EACRC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAA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C,6CAA6C;MAAAjB,QAAA,eACpE,IAAAb,WAAA,CAAAe,GAAA,EAACpB,WAAA,CAAA0B,aAAa;QAACK,OAAO,EAAGrB,yBAA2B;QAAAQ,QAAA,EACjD,IAAAY,QAAE,EAAE,SAAU;MAAC,CACH;IAAC,CACH,CACd;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_utils","_jsxRuntime","QueryToolbar","openPatternSelectionModal","name","clientId","hasPatterns","usePatterns","length","jsx","Fragment","children","ToolbarGroup","className","ToolbarButton","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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAAuC,IAAAG,WAAA,GAAAH,OAAA;AATvC;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,YAAYA,CAAE;EACrCC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CAAC,CAAE,IAAAC,kBAAW,EAAEF,QAAQ,EAAED,IAAK,CAAC,CAACI,MAAM;EAE3D,oBACC,IAAAP,WAAA,CAAAQ,GAAA,EAAAR,WAAA,CAAAS,QAAA;IAAAC,QAAA,EACGL,WAAW,iBACZ,IAAAL,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAe,YAAY;MAACC,SAAS,EAAC,6CAA6C;MAAAF,QAAA,eACpE,IAAAV,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAiB,aAAa;QAACC,OAAO,EAAGZ,yBAA2B;QAAAQ,QAAA,EACjD,IAAAK,QAAE,EAAE,SAAU;MAAC,CACH;IAAC,CACH;EACd,CACA,CAAC;AAEL","ignoreList":[]}
@@ -161,12 +161,17 @@ exports.usePostTypes = usePostTypes;
161
161
  const useTaxonomies = postType => {
162
162
  const taxonomies = (0, _data.useSelect)(select => {
163
163
  const {
164
- getTaxonomies
164
+ getTaxonomies,
165
+ getPostType
165
166
  } = select(_coreData.store);
166
- return getTaxonomies({
167
- type: postType,
168
- per_page: -1
169
- });
167
+ // Does the post type have taxonomies?
168
+ if (getPostType(postType)?.taxonomies?.length > 0) {
169
+ return getTaxonomies({
170
+ type: postType,
171
+ per_page: -1
172
+ });
173
+ }
174
+ return [];
170
175
  }, [postType]);
171
176
  return (0, _element.useMemo)(() => {
172
177
  return taxonomies?.filter(({
@@ -226,7 +231,8 @@ const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) => {
226
231
  query: {
227
232
  postType,
228
233
  inherit
229
- }
234
+ },
235
+ namespace
230
236
  } = queryBlockAttributes;
231
237
  const clonedBlocks = blocks.map(block => (0, _blocks.cloneBlock)(block));
232
238
  const queryClientIds = [];
@@ -239,6 +245,9 @@ const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) => {
239
245
  postType,
240
246
  inherit
241
247
  };
248
+ if (namespace) {
249
+ block.attributes.namespace = namespace;
250
+ }
242
251
  queryClientIds.push(block.clientId);
243
252
  }
244
253
  block.innerBlocks?.forEach(innerBlock => {