@wordpress/block-library 9.3.0 → 9.4.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 (392) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +38 -23
  3. package/build/block/edit.js.map +1 -1
  4. package/build/button/edit.js +1 -1
  5. package/build/button/edit.js.map +1 -1
  6. package/build/buttons/index.js +26 -0
  7. package/build/buttons/index.js.map +1 -1
  8. package/build/categories/edit.js +20 -3
  9. package/build/categories/edit.js.map +1 -1
  10. package/build/categories/index.js +8 -0
  11. package/build/categories/index.js.map +1 -1
  12. package/build/columns/index.js +2 -2
  13. package/build/columns/index.js.map +1 -1
  14. package/build/cover/edit/inspector-controls.js +2 -1
  15. package/build/cover/edit/inspector-controls.js.map +1 -1
  16. package/build/embed/variations.js +39 -34
  17. package/build/embed/variations.js.map +1 -1
  18. package/build/footnotes/index.js +1 -1
  19. package/build/footnotes/index.js.map +1 -1
  20. package/build/form-input/edit.js +2 -0
  21. package/build/form-input/edit.js.map +1 -1
  22. package/build/gallery/index.js +10 -0
  23. package/build/gallery/index.js.map +1 -1
  24. package/build/group/deprecated.js +2 -5
  25. package/build/group/deprecated.js.map +1 -1
  26. package/build/heading/index.js +14 -1
  27. package/build/heading/index.js.map +1 -1
  28. package/build/image/edit.js +1 -1
  29. package/build/image/edit.js.map +1 -1
  30. package/build/image/image.js +24 -11
  31. package/build/image/image.js.map +1 -1
  32. package/build/image/index.js +3 -0
  33. package/build/image/index.js.map +1 -1
  34. package/build/image/view.js +65 -49
  35. package/build/image/view.js.map +1 -1
  36. package/build/latest-comments/index.js +9 -0
  37. package/build/latest-comments/index.js.map +1 -1
  38. package/build/list/edit.js +3 -3
  39. package/build/list/edit.js.map +1 -1
  40. package/build/list-item/edit.js +2 -2
  41. package/build/list-item/edit.js.map +1 -1
  42. package/build/list-item/hooks/index.js +0 -7
  43. package/build/list-item/hooks/index.js.map +1 -1
  44. package/build/media-text/index.js +12 -0
  45. package/build/media-text/index.js.map +1 -1
  46. package/build/navigation/edit/navigation-menu-delete-control.js +1 -0
  47. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  48. package/build/navigation/use-navigation-menu.js +5 -1
  49. package/build/navigation/use-navigation-menu.js.map +1 -1
  50. package/build/navigation-link/link-ui.js +13 -17
  51. package/build/navigation-link/link-ui.js.map +1 -1
  52. package/build/navigation-submenu/edit.js +0 -11
  53. package/build/navigation-submenu/edit.js.map +1 -1
  54. package/build/page-list/edit.js +1 -0
  55. package/build/page-list/edit.js.map +1 -1
  56. package/build/page-list-item/edit.js +4 -1
  57. package/build/page-list-item/edit.js.map +1 -1
  58. package/build/paragraph/index.js +6 -0
  59. package/build/paragraph/index.js.map +1 -1
  60. package/build/paragraph/transforms.js +6 -0
  61. package/build/paragraph/transforms.js.map +1 -1
  62. package/build/post-author/index.js +8 -0
  63. package/build/post-author/index.js.map +1 -1
  64. package/build/post-author-biography/index.js +3 -0
  65. package/build/post-author-biography/index.js.map +1 -1
  66. package/build/post-author-name/index.js +3 -0
  67. package/build/post-author-name/index.js.map +1 -1
  68. package/build/post-date/index.js +3 -0
  69. package/build/post-date/index.js.map +1 -1
  70. package/build/post-excerpt/edit.js +1 -0
  71. package/build/post-excerpt/edit.js.map +1 -1
  72. package/build/post-featured-image/index.js +3 -0
  73. package/build/post-featured-image/index.js.map +1 -1
  74. package/build/post-terms/index.js +3 -0
  75. package/build/post-terms/index.js.map +1 -1
  76. package/build/post-title/edit.js +5 -1
  77. package/build/post-title/edit.js.map +1 -1
  78. package/build/query/edit/inspector-controls/author-control.js +3 -1
  79. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  80. package/build/query/edit/inspector-controls/index.js +24 -6
  81. package/build/query/edit/inspector-controls/index.js.map +1 -1
  82. package/build/query/edit/inspector-controls/order-control.js +1 -0
  83. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  84. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  85. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  86. package/build/query/edit/inspector-controls/sticky-control.js +1 -0
  87. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
  88. package/build/query/edit/inspector-controls/taxonomy-controls.js +5 -2
  89. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  90. package/build/query/edit/query-content.js +11 -2
  91. package/build/query/edit/query-content.js.map +1 -1
  92. package/build/query/edit/query-placeholder.js +1 -14
  93. package/build/query/edit/query-placeholder.js.map +1 -1
  94. package/build/query/utils.js +5 -1
  95. package/build/query/utils.js.map +1 -1
  96. package/build/query/variations.js +9 -55
  97. package/build/query/variations.js.map +1 -1
  98. package/build/query-pagination-numbers/edit.js +1 -0
  99. package/build/query-pagination-numbers/edit.js.map +1 -1
  100. package/build/query-title/edit.js +11 -19
  101. package/build/query-title/edit.js.map +1 -1
  102. package/build/query-title/use-archive-label.js +95 -0
  103. package/build/query-title/use-archive-label.js.map +1 -0
  104. package/build/quote/index.js +15 -1
  105. package/build/quote/index.js.map +1 -1
  106. package/build/search/index.js +3 -0
  107. package/build/search/index.js.map +1 -1
  108. package/build/site-logo/edit.js +4 -1
  109. package/build/site-logo/edit.js.map +1 -1
  110. package/build/site-tagline/edit.js +5 -2
  111. package/build/site-tagline/edit.js.map +1 -1
  112. package/build/site-tagline/index.js +6 -1
  113. package/build/site-tagline/index.js.map +1 -1
  114. package/build/site-title/edit.js +4 -1
  115. package/build/site-title/edit.js.map +1 -1
  116. package/build/site-title/index.js +6 -1
  117. package/build/site-title/index.js.map +1 -1
  118. package/build/social-link/icons/soundcloud.js +1 -1
  119. package/build/social-link/icons/soundcloud.js.map +1 -1
  120. package/build/social-links/index.js +12 -0
  121. package/build/social-links/index.js.map +1 -1
  122. package/build/tag-cloud/edit.js +4 -1
  123. package/build/tag-cloud/edit.js.map +1 -1
  124. package/build/template-part/edit/index.js +5 -3
  125. package/build/template-part/edit/index.js.map +1 -1
  126. package/build/template-part/edit/inner-blocks.js +8 -3
  127. package/build/template-part/edit/inner-blocks.js.map +1 -1
  128. package/build/template-part/edit/placeholder.js +23 -3
  129. package/build/template-part/edit/placeholder.js.map +1 -1
  130. package/build/template-part/edit/title-modal.js +20 -8
  131. package/build/template-part/edit/title-modal.js.map +1 -1
  132. package/build/term-description/index.js +12 -0
  133. package/build/term-description/index.js.map +1 -1
  134. package/build/utils/hooks.js +5 -1
  135. package/build/utils/hooks.js.map +1 -1
  136. package/build-module/block/edit.js +38 -23
  137. package/build-module/block/edit.js.map +1 -1
  138. package/build-module/button/edit.js +1 -1
  139. package/build-module/button/edit.js.map +1 -1
  140. package/build-module/buttons/index.js +26 -0
  141. package/build-module/buttons/index.js.map +1 -1
  142. package/build-module/categories/edit.js +21 -4
  143. package/build-module/categories/edit.js.map +1 -1
  144. package/build-module/categories/index.js +8 -0
  145. package/build-module/categories/index.js.map +1 -1
  146. package/build-module/columns/index.js +2 -2
  147. package/build-module/columns/index.js.map +1 -1
  148. package/build-module/cover/edit/inspector-controls.js +2 -1
  149. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  150. package/build-module/embed/variations.js +40 -35
  151. package/build-module/embed/variations.js.map +1 -1
  152. package/build-module/footnotes/index.js +1 -1
  153. package/build-module/footnotes/index.js.map +1 -1
  154. package/build-module/form-input/edit.js +2 -0
  155. package/build-module/form-input/edit.js.map +1 -1
  156. package/build-module/gallery/index.js +10 -0
  157. package/build-module/gallery/index.js.map +1 -1
  158. package/build-module/group/deprecated.js +2 -5
  159. package/build-module/group/deprecated.js.map +1 -1
  160. package/build-module/heading/index.js +14 -1
  161. package/build-module/heading/index.js.map +1 -1
  162. package/build-module/image/edit.js +1 -1
  163. package/build-module/image/edit.js.map +1 -1
  164. package/build-module/image/image.js +25 -12
  165. package/build-module/image/image.js.map +1 -1
  166. package/build-module/image/index.js +3 -0
  167. package/build-module/image/index.js.map +1 -1
  168. package/build-module/image/view.js +65 -49
  169. package/build-module/image/view.js.map +1 -1
  170. package/build-module/latest-comments/index.js +9 -0
  171. package/build-module/latest-comments/index.js.map +1 -1
  172. package/build-module/list/edit.js +3 -3
  173. package/build-module/list/edit.js.map +1 -1
  174. package/build-module/list-item/edit.js +2 -2
  175. package/build-module/list-item/edit.js.map +1 -1
  176. package/build-module/list-item/hooks/index.js +0 -1
  177. package/build-module/list-item/hooks/index.js.map +1 -1
  178. package/build-module/media-text/index.js +12 -0
  179. package/build-module/media-text/index.js.map +1 -1
  180. package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -0
  181. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  182. package/build-module/navigation/use-navigation-menu.js +5 -1
  183. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  184. package/build-module/navigation-link/link-ui.js +13 -17
  185. package/build-module/navigation-link/link-ui.js.map +1 -1
  186. package/build-module/navigation-submenu/edit.js +0 -11
  187. package/build-module/navigation-submenu/edit.js.map +1 -1
  188. package/build-module/page-list/edit.js +1 -0
  189. package/build-module/page-list/edit.js.map +1 -1
  190. package/build-module/page-list-item/edit.js +4 -1
  191. package/build-module/page-list-item/edit.js.map +1 -1
  192. package/build-module/paragraph/index.js +6 -0
  193. package/build-module/paragraph/index.js.map +1 -1
  194. package/build-module/paragraph/transforms.js +6 -0
  195. package/build-module/paragraph/transforms.js.map +1 -1
  196. package/build-module/post-author/index.js +8 -0
  197. package/build-module/post-author/index.js.map +1 -1
  198. package/build-module/post-author-biography/index.js +3 -0
  199. package/build-module/post-author-biography/index.js.map +1 -1
  200. package/build-module/post-author-name/index.js +3 -0
  201. package/build-module/post-author-name/index.js.map +1 -1
  202. package/build-module/post-date/index.js +3 -0
  203. package/build-module/post-date/index.js.map +1 -1
  204. package/build-module/post-excerpt/edit.js +1 -0
  205. package/build-module/post-excerpt/edit.js.map +1 -1
  206. package/build-module/post-featured-image/index.js +3 -0
  207. package/build-module/post-featured-image/index.js.map +1 -1
  208. package/build-module/post-terms/index.js +3 -0
  209. package/build-module/post-terms/index.js.map +1 -1
  210. package/build-module/post-title/edit.js +5 -1
  211. package/build-module/post-title/edit.js.map +1 -1
  212. package/build-module/query/edit/inspector-controls/author-control.js +3 -1
  213. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  214. package/build-module/query/edit/inspector-controls/index.js +25 -7
  215. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  216. package/build-module/query/edit/inspector-controls/order-control.js +1 -0
  217. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  218. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  219. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  220. package/build-module/query/edit/inspector-controls/sticky-control.js +1 -0
  221. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
  222. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +6 -4
  223. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  224. package/build-module/query/edit/query-content.js +11 -2
  225. package/build-module/query/edit/query-content.js.map +1 -1
  226. package/build-module/query/edit/query-placeholder.js +1 -14
  227. package/build-module/query/edit/query-placeholder.js.map +1 -1
  228. package/build-module/query/utils.js +5 -1
  229. package/build-module/query/utils.js.map +1 -1
  230. package/build-module/query/variations.js +4 -50
  231. package/build-module/query/variations.js.map +1 -1
  232. package/build-module/query-pagination-numbers/edit.js +1 -0
  233. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  234. package/build-module/query-title/edit.js +12 -20
  235. package/build-module/query-title/edit.js.map +1 -1
  236. package/build-module/query-title/use-archive-label.js +88 -0
  237. package/build-module/query-title/use-archive-label.js.map +1 -0
  238. package/build-module/quote/index.js +15 -1
  239. package/build-module/quote/index.js.map +1 -1
  240. package/build-module/search/index.js +3 -0
  241. package/build-module/search/index.js.map +1 -1
  242. package/build-module/site-logo/edit.js +4 -1
  243. package/build-module/site-logo/edit.js.map +1 -1
  244. package/build-module/site-tagline/edit.js +5 -2
  245. package/build-module/site-tagline/edit.js.map +1 -1
  246. package/build-module/site-tagline/index.js +6 -1
  247. package/build-module/site-tagline/index.js.map +1 -1
  248. package/build-module/site-title/edit.js +4 -1
  249. package/build-module/site-title/edit.js.map +1 -1
  250. package/build-module/site-title/index.js +6 -1
  251. package/build-module/site-title/index.js.map +1 -1
  252. package/build-module/social-link/icons/soundcloud.js +1 -1
  253. package/build-module/social-link/icons/soundcloud.js.map +1 -1
  254. package/build-module/social-links/index.js +12 -0
  255. package/build-module/social-links/index.js.map +1 -1
  256. package/build-module/tag-cloud/edit.js +4 -1
  257. package/build-module/tag-cloud/edit.js.map +1 -1
  258. package/build-module/template-part/edit/index.js +5 -3
  259. package/build-module/template-part/edit/index.js.map +1 -1
  260. package/build-module/template-part/edit/inner-blocks.js +8 -3
  261. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  262. package/build-module/template-part/edit/placeholder.js +23 -3
  263. package/build-module/template-part/edit/placeholder.js.map +1 -1
  264. package/build-module/template-part/edit/title-modal.js +20 -8
  265. package/build-module/template-part/edit/title-modal.js.map +1 -1
  266. package/build-module/term-description/index.js +12 -0
  267. package/build-module/term-description/index.js.map +1 -1
  268. package/build-module/utils/hooks.js +5 -1
  269. package/build-module/utils/hooks.js.map +1 -1
  270. package/build-style/categories/editor-rtl.css +4 -0
  271. package/build-style/categories/editor.css +4 -0
  272. package/build-style/categories/style-rtl.css +4 -0
  273. package/build-style/categories/style.css +4 -0
  274. package/build-style/editor-rtl.css +13 -12
  275. package/build-style/editor.css +13 -12
  276. package/build-style/image/editor-rtl.css +8 -4
  277. package/build-style/image/editor.css +8 -4
  278. package/build-style/image/style-rtl.css +19 -0
  279. package/build-style/image/style.css +19 -0
  280. package/build-style/list/style-rtl.css +1 -1
  281. package/build-style/list/style.css +1 -1
  282. package/build-style/navigation/style-rtl.css +1 -4
  283. package/build-style/navigation/style.css +1 -4
  284. package/build-style/post-comments-form/style-rtl.css +1 -1
  285. package/build-style/post-comments-form/style.css +1 -1
  286. package/build-style/query/editor-rtl.css +0 -7
  287. package/build-style/query/editor.css +0 -7
  288. package/build-style/search/editor-rtl.css +1 -1
  289. package/build-style/search/editor.css +1 -1
  290. package/build-style/social-links/style-rtl.css +2 -2
  291. package/build-style/social-links/style.css +2 -2
  292. package/build-style/style-rtl.css +29 -8
  293. package/build-style/style.css +29 -8
  294. package/build-style/term-description/style-rtl.css +1 -0
  295. package/build-style/term-description/style.css +1 -0
  296. package/package.json +35 -35
  297. package/src/block/edit.js +58 -27
  298. package/src/block/test/edit.native.js +6 -2
  299. package/src/button/edit.js +1 -1
  300. package/src/button/index.php +2 -2
  301. package/src/buttons/block.json +20 -0
  302. package/src/buttons/index.js +6 -0
  303. package/src/categories/block.json +8 -0
  304. package/src/categories/edit.js +32 -4
  305. package/src/categories/editor.scss +4 -0
  306. package/src/categories/index.php +4 -1
  307. package/src/categories/style.scss +4 -0
  308. package/src/columns/index.js +1 -1
  309. package/src/cover/edit/inspector-controls.js +1 -0
  310. package/src/embed/test/__snapshots__/index.native.js.snap +8 -8
  311. package/src/embed/test/index.js +1 -1
  312. package/src/embed/test/index.native.js +24 -23
  313. package/src/embed/variations.js +43 -35
  314. package/src/footnotes/index.js +1 -2
  315. package/src/form-input/edit.js +2 -0
  316. package/src/gallery/block.json +10 -0
  317. package/src/group/deprecated.js +3 -7
  318. package/src/heading/block.json +12 -0
  319. package/src/heading/index.js +1 -0
  320. package/src/image/block.json +3 -0
  321. package/src/image/edit.js +1 -1
  322. package/src/image/editor.scss +6 -1
  323. package/src/image/image.js +55 -35
  324. package/src/image/index.php +32 -15
  325. package/src/image/style.scss +22 -0
  326. package/src/image/test/edit.native.js +1 -0
  327. package/src/image/view.js +69 -49
  328. package/src/latest-comments/block.json +9 -0
  329. package/src/list/edit.js +3 -3
  330. package/src/list/style.scss +1 -1
  331. package/src/list-item/edit.js +2 -2
  332. package/src/list-item/hooks/index.js +0 -1
  333. package/src/media-text/block.json +12 -0
  334. package/src/navigation/edit/navigation-menu-delete-control.js +1 -0
  335. package/src/navigation/index.php +1 -1
  336. package/src/navigation/style.scss +4 -9
  337. package/src/navigation/test/use-navigation-menu.js +54 -15
  338. package/src/navigation/use-navigation-menu.js +5 -1
  339. package/src/navigation-link/link-ui.js +8 -14
  340. package/src/navigation-submenu/edit.js +1 -13
  341. package/src/page-list/edit.js +1 -0
  342. package/src/page-list-item/edit.js +4 -4
  343. package/src/paragraph/block.json +6 -0
  344. package/src/post-author/index.js +8 -0
  345. package/src/post-author-biography/block.json +3 -0
  346. package/src/post-author-name/block.json +3 -0
  347. package/src/post-comments-form/style.scss +1 -1
  348. package/src/post-date/block.json +3 -0
  349. package/src/post-excerpt/edit.js +1 -0
  350. package/src/post-featured-image/block.json +3 -0
  351. package/src/post-terms/block.json +3 -0
  352. package/src/post-title/edit.js +5 -5
  353. package/src/query/edit/inspector-controls/author-control.js +2 -0
  354. package/src/query/edit/inspector-controls/index.js +41 -14
  355. package/src/query/edit/inspector-controls/order-control.js +1 -0
  356. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  357. package/src/query/edit/inspector-controls/sticky-control.js +1 -0
  358. package/src/query/edit/inspector-controls/taxonomy-controls.js +8 -3
  359. package/src/query/edit/query-content.js +17 -3
  360. package/src/query/edit/query-placeholder.js +1 -21
  361. package/src/query/editor.scss +0 -9
  362. package/src/query/utils.js +4 -0
  363. package/src/query/variations.js +4 -46
  364. package/src/query-pagination-numbers/edit.js +1 -0
  365. package/src/query-title/edit.js +10 -17
  366. package/src/query-title/use-archive-label.js +99 -0
  367. package/src/quote/block.json +15 -1
  368. package/src/search/block.json +3 -0
  369. package/src/search/editor.scss +1 -1
  370. package/src/site-logo/edit.js +4 -1
  371. package/src/site-tagline/block.json +6 -1
  372. package/src/site-tagline/edit.js +5 -2
  373. package/src/site-title/edit.js +4 -1
  374. package/src/site-title/index.js +6 -1
  375. package/src/social-link/icons/soundcloud.js +1 -1
  376. package/src/social-link/socials-with-bg.scss +1 -1
  377. package/src/social-link/socials-without-bg.scss +1 -1
  378. package/src/social-links/block.json +12 -0
  379. package/src/tag-cloud/edit.js +7 -1
  380. package/src/template-part/edit/index.js +5 -3
  381. package/src/template-part/edit/inner-blocks.js +8 -5
  382. package/src/template-part/edit/placeholder.js +31 -6
  383. package/src/template-part/edit/title-modal.js +18 -4
  384. package/src/term-description/block.json +12 -0
  385. package/src/term-description/style.scss +2 -0
  386. package/src/utils/hooks.js +5 -1
  387. package/tsconfig.tsbuildinfo +1 -1
  388. package/build/list-item/hooks/use-split.js +0 -39
  389. package/build/list-item/hooks/use-split.js.map +0 -1
  390. package/build-module/list-item/hooks/use-split.js +0 -32
  391. package/build-module/list-item/hooks/use-split.js.map +0 -1
  392. package/src/list-item/hooks/use-split.js +0 -33
@@ -9,6 +9,12 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
  */
10
10
  import useNavigationMenu from '../use-navigation-menu';
11
11
 
12
+ const BASE_ENTITY = {
13
+ kind: 'postType',
14
+ name: 'wp_navigation',
15
+ id: undefined,
16
+ };
17
+
12
18
  function createRegistryWithStores() {
13
19
  // Create a registry and register used stores.
14
20
  const registry = createRegistry();
@@ -63,37 +69,70 @@ function resolveRecords( registry, menus ) {
63
69
 
64
70
  function resolveReadPermission( registry, allowed ) {
65
71
  const dispatch = registry.dispatch( coreStore );
66
- dispatch.receiveUserPermission( 'create/navigation', allowed );
67
- dispatch.startResolution( 'canUser', [ 'read', 'navigation' ] );
68
- dispatch.finishResolution( 'canUser', [ 'read', 'navigation' ] );
72
+ dispatch.receiveUserPermission( 'read/postType/wp_navigation', allowed );
73
+ dispatch.startResolution( 'canUser', [ 'read', BASE_ENTITY ] );
74
+ dispatch.finishResolution( 'canUser', [ 'read', BASE_ENTITY ] );
69
75
  }
70
76
 
71
77
  function resolveReadRecordPermission( registry, ref, allowed ) {
72
78
  const dispatch = registry.dispatch( coreStore );
73
- dispatch.receiveUserPermission( 'create/navigation', allowed );
74
- dispatch.startResolution( 'canUser', [ 'read', 'navigation', ref ] );
75
- dispatch.finishResolution( 'canUser', [ 'read', 'navigation', ref ] );
79
+ dispatch.receiveUserPermission(
80
+ `read/postType/wp_navigation/${ ref }`,
81
+ allowed
82
+ );
83
+ dispatch.startResolution( 'canUser', [
84
+ 'read',
85
+ { ...BASE_ENTITY, id: ref },
86
+ ] );
87
+ dispatch.finishResolution( 'canUser', [
88
+ 'read',
89
+ { ...BASE_ENTITY, id: ref },
90
+ ] );
76
91
  }
77
92
 
78
93
  function resolveCreatePermission( registry, allowed ) {
79
94
  const dispatch = registry.dispatch( coreStore );
80
- dispatch.receiveUserPermission( 'create/navigation', allowed );
81
- dispatch.startResolution( 'canUser', [ 'create', 'navigation' ] );
82
- dispatch.finishResolution( 'canUser', [ 'create', 'navigation' ] );
95
+ dispatch.receiveUserPermission( 'create/postType/wp_navigation', allowed );
96
+ dispatch.startResolution( 'canUser', [
97
+ 'create',
98
+ { kind: 'postType', name: 'wp_navigation' },
99
+ ] );
100
+ dispatch.finishResolution( 'canUser', [
101
+ 'create',
102
+ { kind: 'postType', name: 'wp_navigation' },
103
+ ] );
83
104
  }
84
105
 
85
106
  function resolveUpdatePermission( registry, ref, allowed ) {
86
107
  const dispatch = registry.dispatch( coreStore );
87
- dispatch.receiveUserPermission( `update/navigation/${ ref }`, allowed );
88
- dispatch.startResolution( 'canUser', [ 'update', 'navigation', ref ] );
89
- dispatch.finishResolution( 'canUser', [ 'update', 'navigation', ref ] );
108
+ dispatch.receiveUserPermission(
109
+ `update/postType/wp_navigation/${ ref }`,
110
+ allowed
111
+ );
112
+ dispatch.startResolution( 'canUser', [
113
+ 'update',
114
+ { ...BASE_ENTITY, id: ref },
115
+ ] );
116
+ dispatch.finishResolution( 'canUser', [
117
+ 'update',
118
+ { ...BASE_ENTITY, id: ref },
119
+ ] );
90
120
  }
91
121
 
92
122
  function resolveDeletePermission( registry, ref, allowed ) {
93
123
  const dispatch = registry.dispatch( coreStore );
94
- dispatch.receiveUserPermission( `delete/navigation/${ ref }`, allowed );
95
- dispatch.startResolution( 'canUser', [ 'delete', 'navigation', ref ] );
96
- dispatch.finishResolution( 'canUser', [ 'delete', 'navigation', ref ] );
124
+ dispatch.receiveUserPermission(
125
+ `delete/postType/wp_navigation/${ ref }`,
126
+ allowed
127
+ );
128
+ dispatch.startResolution( 'canUser', [
129
+ 'delete',
130
+ { ...BASE_ENTITY, id: ref },
131
+ ] );
132
+ dispatch.finishResolution( 'canUser', [
133
+ 'delete',
134
+ { ...BASE_ENTITY, id: ref },
135
+ ] );
97
136
  }
98
137
 
99
138
  describe( 'useNavigationMenus', () => {
@@ -14,7 +14,11 @@ import { useSelect } from '@wordpress/data';
14
14
  import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
15
15
 
16
16
  export default function useNavigationMenu( ref ) {
17
- const permissions = useResourcePermissions( 'navigation', ref );
17
+ const permissions = useResourcePermissions( {
18
+ kind: 'postType',
19
+ name: 'wp_navigation',
20
+ id: ref,
21
+ } );
18
22
 
19
23
  const {
20
24
  navigationMenu,
@@ -147,15 +147,18 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
147
147
  }
148
148
 
149
149
  function UnforwardedLinkUI( props, ref ) {
150
+ const { label, url, opensInNewTab, type, kind } = props.link;
151
+ const postType = type || 'page';
152
+
150
153
  const [ addingBlock, setAddingBlock ] = useState( false );
151
154
  const [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );
152
155
  const { saveEntityRecord } = useDispatch( coreStore );
153
- const pagesPermissions = useResourcePermissions( 'pages' );
154
- const postsPermissions = useResourcePermissions( 'posts' );
156
+ const permissions = useResourcePermissions( {
157
+ kind: 'postType',
158
+ name: postType,
159
+ } );
155
160
 
156
161
  async function handleCreate( pageTitle ) {
157
- const postType = props.link.type || 'page';
158
-
159
162
  const page = await saveEntityRecord( 'postType', postType, {
160
163
  title: pageTitle,
161
164
  status: 'draft',
@@ -180,15 +183,6 @@ function UnforwardedLinkUI( props, ref ) {
180
183
  };
181
184
  }
182
185
 
183
- const { label, url, opensInNewTab, type, kind } = props.link;
184
-
185
- let userCanCreate = false;
186
- if ( ! type || type === 'page' ) {
187
- userCanCreate = pagesPermissions.canCreate;
188
- } else if ( type === 'post' ) {
189
- userCanCreate = postsPermissions.canCreate;
190
- }
191
-
192
186
  // Memoize link value to avoid overriding the LinkControl's internal state.
193
187
  // This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.
194
188
  const link = useMemo(
@@ -241,7 +235,7 @@ function UnforwardedLinkUI( props, ref ) {
241
235
  hasRichPreviews
242
236
  value={ link }
243
237
  showInitialSuggestions
244
- withCreateSuggestion={ userCanCreate }
238
+ withCreateSuggestion={ permissions.canCreate }
245
239
  createSuggestion={ handleCreate }
246
240
  createSuggestionButtonText={ ( searchTerm ) => {
247
241
  let format;
@@ -29,7 +29,6 @@ import {
29
29
  import { isURL, prependHTTP } from '@wordpress/url';
30
30
  import { useState, useEffect, useRef } from '@wordpress/element';
31
31
  import { link as linkIcon, removeSubmenu } from '@wordpress/icons';
32
- import { useResourcePermissions } from '@wordpress/core-data';
33
32
  import { speak } from '@wordpress/a11y';
34
33
  import { createBlock } from '@wordpress/blocks';
35
34
  import { useMergeRefs, usePrevious } from '@wordpress/compose';
@@ -134,7 +133,7 @@ export default function NavigationSubmenuEdit( {
134
133
  context,
135
134
  clientId,
136
135
  } ) {
137
- const { label, type, url, description, rel, title } = attributes;
136
+ const { label, url, description, rel, title } = attributes;
138
137
 
139
138
  const { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;
140
139
 
@@ -154,9 +153,6 @@ export default function NavigationSubmenuEdit( {
154
153
  const itemLabelPlaceholder = __( 'Add text…' );
155
154
  const ref = useRef();
156
155
 
157
- const pagesPermissions = useResourcePermissions( 'pages' );
158
- const postsPermissions = useResourcePermissions( 'posts' );
159
-
160
156
  const {
161
157
  parentCount,
162
158
  isParentOfSelectedBlock,
@@ -264,13 +260,6 @@ export default function NavigationSubmenuEdit( {
264
260
  selection.addRange( range );
265
261
  }
266
262
 
267
- let userCanCreate = false;
268
- if ( ! type || type === 'page' ) {
269
- userCanCreate = pagesPermissions.canCreate;
270
- } else if ( type === 'post' ) {
271
- userCanCreate = postsPermissions.canCreate;
272
- }
273
-
274
263
  const {
275
264
  textColor,
276
265
  customTextColor,
@@ -499,7 +488,6 @@ export default function NavigationSubmenuEdit( {
499
488
  }
500
489
  } }
501
490
  anchor={ popoverAnchor }
502
- hasCreateSuggestion={ userCanCreate }
503
491
  onRemove={ () => {
504
492
  setAttributes( { url: '' } );
505
493
  speak( __( 'Link removed.' ), 'assertive' );
@@ -319,6 +319,7 @@ export default function PageListEdit( {
319
319
  { pagesTree.length > 0 && (
320
320
  <PanelBody>
321
321
  <ComboboxControl
322
+ __nextHasNoMarginBottom
322
323
  __next40pxDefaultSize
323
324
  className="editor-page-attributes__parent"
324
325
  label={ __( 'Parent' ) }
@@ -21,10 +21,10 @@ import {
21
21
 
22
22
  function useFrontPageId() {
23
23
  return useSelect( ( select ) => {
24
- const canReadSettings = select( coreStore ).canUser(
25
- 'read',
26
- 'settings'
27
- );
24
+ const canReadSettings = select( coreStore ).canUser( 'read', {
25
+ kind: 'root',
26
+ name: 'site',
27
+ } );
28
28
  if ( ! canReadSettings ) {
29
29
  return undefined;
30
30
  }
@@ -33,6 +33,12 @@
33
33
  "splitting": true,
34
34
  "anchor": true,
35
35
  "className": false,
36
+ "__experimentalBorder": {
37
+ "color": true,
38
+ "radius": true,
39
+ "style": true,
40
+ "width": true
41
+ },
36
42
  "color": {
37
43
  "gradients": true,
38
44
  "link": true,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { __ } from '@wordpress/i18n';
4
5
  import { postAuthor as icon } from '@wordpress/icons';
5
6
 
6
7
  /**
@@ -15,6 +16,13 @@ export { metadata, name };
15
16
 
16
17
  export const settings = {
17
18
  icon,
19
+ example: {
20
+ viewportWidth: 350,
21
+ attributes: {
22
+ showBio: true,
23
+ byline: __( 'Posted by' ),
24
+ },
25
+ },
18
26
  edit,
19
27
  };
20
28
 
@@ -12,6 +12,9 @@
12
12
  }
13
13
  },
14
14
  "usesContext": [ "postType", "postId" ],
15
+ "example": {
16
+ "viewportWidth": 350
17
+ },
15
18
  "supports": {
16
19
  "spacing": {
17
20
  "margin": true,
@@ -20,6 +20,9 @@
20
20
  }
21
21
  },
22
22
  "usesContext": [ "postType", "postId" ],
23
+ "example": {
24
+ "viewportWidth": 350
25
+ },
23
26
  "supports": {
24
27
  "html": false,
25
28
  "spacing": {
@@ -38,7 +38,7 @@
38
38
  }
39
39
 
40
40
  // Styles copied from button block styles.
41
- input[type="submit"] {
41
+ :where(input[type="submit"]) {
42
42
  box-shadow: none;
43
43
  cursor: pointer;
44
44
  display: inline-block;
@@ -23,6 +23,9 @@
23
23
  }
24
24
  },
25
25
  "usesContext": [ "postId", "postType", "queryId" ],
26
+ "example": {
27
+ "viewportWidth": 350
28
+ },
26
29
  "supports": {
27
30
  "html": false,
28
31
  "color": {
@@ -231,6 +231,7 @@ export default function PostExcerptEditor( {
231
231
  }
232
232
  />
233
233
  <RangeControl
234
+ __nextHasNoMarginBottom
234
235
  label={ __( 'Max number of words' ) }
235
236
  value={ excerptLength }
236
237
  onChange={ ( value ) => {
@@ -58,6 +58,9 @@
58
58
  }
59
59
  },
60
60
  "usesContext": [ "postId", "postType", "queryId" ],
61
+ "example": {
62
+ "viewportWidth": 350
63
+ },
61
64
  "supports": {
62
65
  "align": [ "left", "right", "center", "wide", "full" ],
63
66
  "color": {
@@ -27,6 +27,9 @@
27
27
  }
28
28
  },
29
29
  "usesContext": [ "postId", "postType" ],
30
+ "example": {
31
+ "viewportWidth": 350
32
+ },
30
33
  "supports": {
31
34
  "html": false,
32
35
  "color": {
@@ -42,11 +42,11 @@ export default function PostTitleEdit( {
42
42
  if ( isDescendentOfQueryLoop ) {
43
43
  return false;
44
44
  }
45
- return select( coreStore ).canUserEditEntityRecord(
46
- 'postType',
47
- postType,
48
- postId
49
- );
45
+ return select( coreStore ).canUser( 'update', {
46
+ kind: 'postType',
47
+ name: postType,
48
+ id: postId,
49
+ } );
50
50
  },
51
51
  [ isDescendentOfQueryLoop, postType, postId ]
52
52
  );
@@ -76,6 +76,8 @@ function AuthorControl( { value, onChange } ) {
76
76
  suggestions={ authorsInfo.names }
77
77
  onChange={ onAuthorChange }
78
78
  __experimentalShowHowTo={ false }
79
+ __nextHasNoMarginBottom
80
+ __next40pxDefaultSize
79
81
  />
80
82
  );
81
83
  }
@@ -7,6 +7,8 @@ import {
7
7
  SelectControl,
8
8
  RangeControl,
9
9
  ToggleControl,
10
+ __experimentalToggleGroupControl as ToggleGroupControl,
11
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
10
12
  Notice,
11
13
  __experimentalToolsPanel as ToolsPanel,
12
14
  __experimentalToolsPanelItem as ToolsPanelItem,
@@ -101,6 +103,10 @@ export default function QueryInspectorControls( props ) {
101
103
  const showInheritControl = isControlAllowed( allowedControls, 'inherit' );
102
104
  const showPostTypeControl =
103
105
  ! inherit && isControlAllowed( allowedControls, 'postType' );
106
+ const postTypeControlLabel = __( 'Content type' );
107
+ const postTypeControlHelp = __(
108
+ 'WordPress contains different types of content you can filter by. Posts and pages are the default types, but plugins could add more.'
109
+ );
104
110
  const showColumnsControl = false;
105
111
  const showOrderControl =
106
112
  ! inherit && isControlAllowed( allowedControls, 'order' );
@@ -144,7 +150,7 @@ export default function QueryInspectorControls( props ) {
144
150
  __nextHasNoMarginBottom
145
151
  label={ __( 'Inherit query from template' ) }
146
152
  help={ __(
147
- 'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'
153
+ 'Enable to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'
148
154
  ) }
149
155
  checked={ !! inherit }
150
156
  onChange={ ( value ) =>
@@ -152,22 +158,42 @@ export default function QueryInspectorControls( props ) {
152
158
  }
153
159
  />
154
160
  ) }
155
- { showPostTypeControl && (
156
- <SelectControl
157
- __nextHasNoMarginBottom
158
- options={ postTypesSelectOptions }
159
- value={ postType }
160
- label={ __( 'Post type' ) }
161
- onChange={ onPostTypeChange }
162
- help={ __(
163
- 'WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.'
164
- ) }
165
- />
166
- ) }
161
+ { showPostTypeControl &&
162
+ ( postTypesSelectOptions.length > 2 ? (
163
+ <SelectControl
164
+ __nextHasNoMarginBottom
165
+ __next40pxDefaultSize
166
+ options={ postTypesSelectOptions }
167
+ value={ postType }
168
+ label={ postTypeControlLabel }
169
+ onChange={ onPostTypeChange }
170
+ help={ postTypeControlHelp }
171
+ />
172
+ ) : (
173
+ <ToggleGroupControl
174
+ __nextHasNoMarginBottom
175
+ __next40pxDefaultSize
176
+ isBlock
177
+ value={ postType }
178
+ label={ postTypeControlLabel }
179
+ onChange={ onPostTypeChange }
180
+ help={ postTypeControlHelp }
181
+ >
182
+ { postTypesSelectOptions.map( ( option ) => (
183
+ <ToggleGroupControlOption
184
+ key={ option.value }
185
+ value={ option.value }
186
+ label={ option.label }
187
+ />
188
+ ) ) }
189
+ </ToggleGroupControl>
190
+ ) ) }
191
+
167
192
  { showColumnsControl && (
168
193
  <>
169
194
  <RangeControl
170
195
  __nextHasNoMarginBottom
196
+ __next40pxDefaultSize
171
197
  label={ __( 'Columns' ) }
172
198
  value={ displayLayout.columns }
173
199
  onChange={ ( value ) =>
@@ -213,7 +239,7 @@ export default function QueryInspectorControls( props ) {
213
239
  ) }
214
240
  { ! inherit && showFiltersPanel && (
215
241
  <ToolsPanel
216
- className="block-library-query-toolspanel__filters"
242
+ className="block-library-query-toolspanel__filters" // unused but kept for backward compatibility
217
243
  label={ __( 'Filters' ) }
218
244
  resetAll={ () => {
219
245
  setQuery( {
@@ -262,6 +288,7 @@ export default function QueryInspectorControls( props ) {
262
288
  >
263
289
  <TextControl
264
290
  __nextHasNoMarginBottom
291
+ __next40pxDefaultSize
265
292
  label={ __( 'Keyword' ) }
266
293
  value={ querySearch }
267
294
  onChange={ setQuerySearch }
@@ -28,6 +28,7 @@ function OrderControl( { order, orderBy, onChange } ) {
28
28
  return (
29
29
  <SelectControl
30
30
  __nextHasNoMarginBottom
31
+ __next40pxDefaultSize
31
32
  label={ __( 'Order by' ) }
32
33
  value={ `${ orderBy }/${ order }` }
33
34
  options={ orderOptions }
@@ -138,6 +138,7 @@ function ParentControl( { parents, postType, onChange } ) {
138
138
  suggestions={ suggestions }
139
139
  onChange={ onParentChange }
140
140
  __experimentalShowHowTo={ false }
141
+ __nextHasNoMarginBottom
141
142
  />
142
143
  );
143
144
  }
@@ -14,6 +14,7 @@ export default function StickyControl( { value, onChange } ) {
14
14
  return (
15
15
  <SelectControl
16
16
  __nextHasNoMarginBottom
17
+ __next40pxDefaultSize
17
18
  label={ __( 'Sticky posts' ) }
18
19
  options={ stickyOptions }
19
20
  value={ value }
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { FormTokenField } from '@wordpress/components';
4
+ import {
5
+ FormTokenField,
6
+ __experimentalVStack as VStack,
7
+ } from '@wordpress/components';
5
8
  import { useSelect } from '@wordpress/data';
6
9
  import { store as coreStore } from '@wordpress/core-data';
7
10
  import { useState, useEffect } from '@wordpress/element';
@@ -53,7 +56,7 @@ export function TaxonomyControls( { onChange, query } ) {
53
56
  }
54
57
 
55
58
  return (
56
- <>
59
+ <VStack spacing={ 4 }>
57
60
  { taxonomies.map( ( taxonomy ) => {
58
61
  const termIds = taxQuery?.[ taxonomy.slug ] || [];
59
62
  const handleChange = ( newTermIds ) =>
@@ -73,7 +76,7 @@ export function TaxonomyControls( { onChange, query } ) {
73
76
  />
74
77
  );
75
78
  } ) }
76
- </>
79
+ </VStack>
77
80
  );
78
81
  }
79
82
 
@@ -187,6 +190,8 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
187
190
  displayTransform={ decodeEntities }
188
191
  onChange={ onTermsChange }
189
192
  __experimentalShowHowTo={ false }
193
+ __nextHasNoMarginBottom
194
+ __next40pxDefaultSize
190
195
  />
191
196
  </div>
192
197
  );
@@ -48,12 +48,26 @@ export default function QueryContent( {
48
48
  } );
49
49
  const { postsPerPage } = useSelect( ( select ) => {
50
50
  const { getSettings } = select( blockEditorStore );
51
- const { getEntityRecord, canUser } = select( coreStore );
52
- const settingPerPage = canUser( 'read', 'settings' )
51
+ const { getEntityRecord, getEntityRecordEdits, canUser } =
52
+ select( coreStore );
53
+ const settingPerPage = canUser( 'read', {
54
+ kind: 'root',
55
+ name: 'site',
56
+ } )
53
57
  ? +getEntityRecord( 'root', 'site' )?.posts_per_page
54
58
  : +getSettings().postsPerPage;
59
+
60
+ // Gets changes made via the template area posts per page setting. These won't be saved
61
+ // until the page is saved, but we should reflect this setting within the query loops
62
+ // that inherit it.
63
+ const editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )
64
+ ?.posts_per_page;
65
+
55
66
  return {
56
- postsPerPage: settingPerPage || DEFAULTS_POSTS_PER_PAGE,
67
+ postsPerPage:
68
+ editedSettingPerPage ||
69
+ settingPerPage ||
70
+ DEFAULTS_POSTS_PER_PAGE,
57
71
  };
58
72
  }, [] );
59
73
  // There are some effects running where some initialization logic is
@@ -25,7 +25,6 @@ export default function QueryPlaceholder( {
25
25
  clientId,
26
26
  name,
27
27
  openPatternSelectionModal,
28
- setAttributes,
29
28
  } ) {
30
29
  const [ isStartingBlank, setIsStartingBlank ] = useState( false );
31
30
  const blockProps = useBlockProps();
@@ -64,7 +63,6 @@ export default function QueryPlaceholder( {
64
63
  <QueryVariationPicker
65
64
  clientId={ clientId }
66
65
  attributes={ attributes }
67
- setAttributes={ setAttributes }
68
66
  icon={ icon }
69
67
  label={ label }
70
68
  />
@@ -101,13 +99,7 @@ export default function QueryPlaceholder( {
101
99
  );
102
100
  }
103
101
 
104
- function QueryVariationPicker( {
105
- clientId,
106
- attributes,
107
- setAttributes,
108
- icon,
109
- label,
110
- } ) {
102
+ function QueryVariationPicker( { clientId, attributes, icon, label } ) {
111
103
  const scopeVariations = useScopedBlockVariations( attributes );
112
104
  const { replaceInnerBlocks } = useDispatch( blockEditorStore );
113
105
  const blockProps = useBlockProps();
@@ -118,18 +110,6 @@ function QueryVariationPicker( {
118
110
  label={ label }
119
111
  variations={ scopeVariations }
120
112
  onSelect={ ( variation ) => {
121
- if ( variation.attributes ) {
122
- setAttributes( {
123
- ...variation.attributes,
124
- query: {
125
- ...variation.attributes.query,
126
- postType:
127
- attributes.query.postType ||
128
- variation.attributes.query.postType,
129
- },
130
- namespace: attributes.namespace,
131
- } );
132
- }
133
113
  if ( variation.innerBlocks ) {
134
114
  replaceInnerBlocks(
135
115
  clientId,
@@ -49,15 +49,6 @@
49
49
  }
50
50
  }
51
51
 
52
- .block-library-query-toolspanel__filters {
53
- .components-form-token-field__help {
54
- margin-bottom: 0;
55
- }
56
- .block-library-query-inspector__taxonomy-control:not(:last-child) {
57
- margin-bottom: $grid-unit-30;
58
- }
59
- }
60
-
61
52
  .wp-block-query__enhanced-pagination-modal {
62
53
  @include break-small() {
63
54
  max-width: $break-mobile;
@@ -213,6 +213,7 @@ export const getTransformedBlocksFromPattern = (
213
213
  ) => {
214
214
  const {
215
215
  query: { postType, inherit },
216
+ namespace,
216
217
  } = queryBlockAttributes;
217
218
  const clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );
218
219
  const queryClientIds = [];
@@ -225,6 +226,9 @@ export const getTransformedBlocksFromPattern = (
225
226
  postType,
226
227
  inherit,
227
228
  };
229
+ if ( namespace ) {
230
+ block.attributes.namespace = namespace;
231
+ }
228
232
  queryClientIds.push( block.clientId );
229
233
  }
230
234
  block.innerBlocks?.forEach( ( innerBlock ) => {