@wordpress/edit-site 6.11.0 → 6.12.1-next.082ed6819.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 (346) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/utils.js +1 -2
  3. package/build/components/add-new-template/utils.js.map +1 -1
  4. package/build/components/app/index.js +0 -5
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/use-editor-iframe-props.js +6 -8
  7. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  8. package/build/components/block-editor/use-site-editor-settings.js +4 -12
  9. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  10. package/build/components/editor/index.js +23 -27
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/editor/use-editor-title.js +37 -12
  13. package/build/components/editor/use-editor-title.js.map +1 -1
  14. package/build/components/editor/use-resolve-edited-entity.js +133 -0
  15. package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
  16. package/build/components/editor-canvas-container/index.js +1 -1
  17. package/build/components/editor-canvas-container/index.js.map +1 -1
  18. package/build/components/global-styles/block-preview-panel.js +8 -10
  19. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  20. package/build/components/global-styles/screen-block.js +18 -5
  21. package/build/components/global-styles/screen-block.js.map +1 -1
  22. package/build/components/global-styles/screen-revisions/revisions-buttons.js +24 -22
  23. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  24. package/build/components/global-styles/screen-style-variations.js +11 -5
  25. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  26. package/build/components/global-styles/shadows-edit-panel.js +2 -3
  27. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  28. package/build/components/global-styles/ui.js +42 -2
  29. package/build/components/global-styles/ui.js.map +1 -1
  30. package/build/components/global-styles-renderer/index.js +6 -8
  31. package/build/components/global-styles-renderer/index.js.map +1 -1
  32. package/build/components/global-styles-sidebar/index.js +17 -1
  33. package/build/components/global-styles-sidebar/index.js.map +1 -1
  34. package/build/components/layout/hooks.js +1 -10
  35. package/build/components/layout/hooks.js.map +1 -1
  36. package/build/components/layout/index.js +1 -0
  37. package/build/components/layout/index.js.map +1 -1
  38. package/build/components/page-patterns/fields.js +3 -7
  39. package/build/components/page-patterns/fields.js.map +1 -1
  40. package/build/components/page-patterns/header.js +2 -2
  41. package/build/components/page-patterns/header.js.map +1 -1
  42. package/build/components/page-patterns/use-patterns.js +4 -8
  43. package/build/components/page-patterns/use-patterns.js.map +1 -1
  44. package/build/components/page-templates/fields.js +1 -2
  45. package/build/components/page-templates/fields.js.map +1 -1
  46. package/build/components/post-edit/index.js +15 -11
  47. package/build/components/post-edit/index.js.map +1 -1
  48. package/build/components/post-list/index.js +13 -3
  49. package/build/components/post-list/index.js.map +1 -1
  50. package/build/components/posts-app/index.js +3 -4
  51. package/build/components/posts-app/index.js.map +1 -1
  52. package/build/components/posts-app-routes/home.js +48 -0
  53. package/build/components/posts-app-routes/home.js.map +1 -0
  54. package/build/components/posts-app-routes/index.js +37 -0
  55. package/build/components/posts-app-routes/index.js.map +1 -0
  56. package/build/components/posts-app-routes/posts-edit.js +44 -0
  57. package/build/components/posts-app-routes/posts-edit.js.map +1 -0
  58. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
  59. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  60. package/build/components/posts-app-routes/posts-list-view.js +48 -0
  61. package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
  62. package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
  63. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  64. package/build/components/posts-app-routes/posts-view.js +41 -0
  65. package/build/components/posts-app-routes/posts-view.js.map +1 -0
  66. package/build/components/sidebar/index.js +11 -3
  67. package/build/components/sidebar/index.js.map +1 -1
  68. package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
  69. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  70. package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
  71. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -90
  73. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-main/index.js +43 -42
  75. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  76. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  77. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
  79. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  80. package/build/components/site-editor-routes/index.js +1 -2
  81. package/build/components/site-editor-routes/index.js.map +1 -1
  82. package/build/components/site-editor-routes/styles-view.js +8 -2
  83. package/build/components/site-editor-routes/styles-view.js.map +1 -1
  84. package/build/components/site-hub/index.js +19 -6
  85. package/build/components/site-hub/index.js.map +1 -1
  86. package/build/components/style-book/constants.js +10 -3
  87. package/build/components/style-book/constants.js.map +1 -1
  88. package/build/components/style-book/examples.js +94 -2
  89. package/build/components/style-book/examples.js.map +1 -1
  90. package/build/components/style-book/index.js +70 -11
  91. package/build/components/style-book/index.js.map +1 -1
  92. package/build/components/welcome-guide/index.js +4 -2
  93. package/build/components/welcome-guide/index.js.map +1 -1
  94. package/build/components/welcome-guide/page.js +1 -9
  95. package/build/components/welcome-guide/page.js.map +1 -1
  96. package/build/components/welcome-guide/template.js +1 -12
  97. package/build/components/welcome-guide/template.js.map +1 -1
  98. package/build/hooks/commands/use-common-commands.js +15 -15
  99. package/build/hooks/commands/use-common-commands.js.map +1 -1
  100. package/build/index.js +1 -9
  101. package/build/index.js.map +1 -1
  102. package/build/posts.js +1 -0
  103. package/build/posts.js.map +1 -1
  104. package/build/store/actions.js +13 -0
  105. package/build/store/actions.js.map +1 -1
  106. package/build/store/selectors.js +21 -1
  107. package/build/store/selectors.js.map +1 -1
  108. package/build-module/components/add-new-template/utils.js +1 -2
  109. package/build-module/components/add-new-template/utils.js.map +1 -1
  110. package/build-module/components/app/index.js +0 -5
  111. package/build-module/components/app/index.js.map +1 -1
  112. package/build-module/components/block-editor/use-editor-iframe-props.js +6 -8
  113. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  114. package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
  115. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  116. package/build-module/components/editor/index.js +23 -27
  117. package/build-module/components/editor/index.js.map +1 -1
  118. package/build-module/components/editor/use-editor-title.js +37 -12
  119. package/build-module/components/editor/use-editor-title.js.map +1 -1
  120. package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
  121. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
  122. package/build-module/components/editor-canvas-container/index.js +1 -1
  123. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  124. package/build-module/components/global-styles/block-preview-panel.js +8 -10
  125. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  126. package/build-module/components/global-styles/screen-block.js +18 -5
  127. package/build-module/components/global-styles/screen-block.js.map +1 -1
  128. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -23
  129. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  130. package/build-module/components/global-styles/screen-style-variations.js +11 -5
  131. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  132. package/build-module/components/global-styles/shadows-edit-panel.js +2 -3
  133. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  134. package/build-module/components/global-styles/ui.js +42 -2
  135. package/build-module/components/global-styles/ui.js.map +1 -1
  136. package/build-module/components/global-styles-renderer/index.js +6 -8
  137. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  138. package/build-module/components/global-styles-sidebar/index.js +18 -2
  139. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  140. package/build-module/components/layout/hooks.js +1 -9
  141. package/build-module/components/layout/hooks.js.map +1 -1
  142. package/build-module/components/layout/index.js +1 -0
  143. package/build-module/components/layout/index.js.map +1 -1
  144. package/build-module/components/page-patterns/fields.js +4 -8
  145. package/build-module/components/page-patterns/fields.js.map +1 -1
  146. package/build-module/components/page-patterns/header.js +2 -2
  147. package/build-module/components/page-patterns/header.js.map +1 -1
  148. package/build-module/components/page-patterns/use-patterns.js +4 -8
  149. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  150. package/build-module/components/page-templates/fields.js +1 -2
  151. package/build-module/components/page-templates/fields.js.map +1 -1
  152. package/build-module/components/post-edit/index.js +14 -10
  153. package/build-module/components/post-edit/index.js.map +1 -1
  154. package/build-module/components/post-list/index.js +13 -3
  155. package/build-module/components/post-list/index.js.map +1 -1
  156. package/build-module/components/posts-app/index.js +3 -4
  157. package/build-module/components/posts-app/index.js.map +1 -1
  158. package/build-module/components/posts-app-routes/home.js +40 -0
  159. package/build-module/components/posts-app-routes/home.js.map +1 -0
  160. package/build-module/components/posts-app-routes/index.js +30 -0
  161. package/build-module/components/posts-app-routes/index.js.map +1 -0
  162. package/build-module/components/posts-app-routes/posts-edit.js +36 -0
  163. package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
  164. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
  165. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  166. package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
  167. package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
  168. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
  169. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  170. package/build-module/components/posts-app-routes/posts-view.js +33 -0
  171. package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
  172. package/build-module/components/sidebar/index.js +11 -3
  173. package/build-module/components/sidebar/index.js.map +1 -1
  174. package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
  175. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
  176. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
  177. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  178. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -91
  179. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  180. package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
  181. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  182. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  183. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
  185. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  186. package/build-module/components/site-editor-routes/index.js +1 -2
  187. package/build-module/components/site-editor-routes/index.js.map +1 -1
  188. package/build-module/components/site-editor-routes/styles-view.js +8 -2
  189. package/build-module/components/site-editor-routes/styles-view.js.map +1 -1
  190. package/build-module/components/site-hub/index.js +19 -6
  191. package/build-module/components/site-hub/index.js.map +1 -1
  192. package/build-module/components/style-book/constants.js +10 -3
  193. package/build-module/components/style-book/constants.js.map +1 -1
  194. package/build-module/components/style-book/examples.js +94 -2
  195. package/build-module/components/style-book/examples.js.map +1 -1
  196. package/build-module/components/style-book/index.js +71 -12
  197. package/build-module/components/style-book/index.js.map +1 -1
  198. package/build-module/components/welcome-guide/index.js +4 -2
  199. package/build-module/components/welcome-guide/index.js.map +1 -1
  200. package/build-module/components/welcome-guide/page.js +1 -9
  201. package/build-module/components/welcome-guide/page.js.map +1 -1
  202. package/build-module/components/welcome-guide/template.js +1 -11
  203. package/build-module/components/welcome-guide/template.js.map +1 -1
  204. package/build-module/hooks/commands/use-common-commands.js +15 -15
  205. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  206. package/build-module/index.js +2 -10
  207. package/build-module/index.js.map +1 -1
  208. package/build-module/posts.js +1 -0
  209. package/build-module/posts.js.map +1 -1
  210. package/build-module/store/actions.js +13 -0
  211. package/build-module/store/actions.js.map +1 -1
  212. package/build-module/store/selectors.js +21 -1
  213. package/build-module/store/selectors.js.map +1 -1
  214. package/build-style/posts-rtl.css +106 -16
  215. package/build-style/posts.css +106 -16
  216. package/build-style/style-rtl.css +176 -78
  217. package/build-style/style.css +176 -78
  218. package/package.json +39 -40
  219. package/src/components/add-new-template/utils.js +2 -2
  220. package/src/components/app/index.js +0 -5
  221. package/src/components/block-editor/use-editor-iframe-props.js +2 -3
  222. package/src/components/block-editor/use-site-editor-settings.js +7 -21
  223. package/src/components/editor/index.js +31 -30
  224. package/src/components/editor/use-editor-title.js +50 -13
  225. package/src/components/editor/use-resolve-edited-entity.js +132 -0
  226. package/src/components/editor-canvas-container/index.js +1 -1
  227. package/src/components/editor-canvas-container/style.scss +0 -1
  228. package/src/components/global-styles/block-preview-panel.js +10 -10
  229. package/src/components/global-styles/screen-block.js +26 -8
  230. package/src/components/global-styles/screen-revisions/revisions-buttons.js +28 -31
  231. package/src/components/global-styles/screen-revisions/style.scss +11 -17
  232. package/src/components/global-styles/screen-style-variations.js +14 -5
  233. package/src/components/global-styles/shadows-edit-panel.js +4 -2
  234. package/src/components/global-styles/ui.js +41 -1
  235. package/src/components/global-styles-renderer/index.js +4 -10
  236. package/src/components/global-styles-sidebar/index.js +16 -2
  237. package/src/components/layout/hooks.js +1 -7
  238. package/src/components/layout/index.js +6 -1
  239. package/src/components/page-patterns/fields.js +6 -12
  240. package/src/components/page-patterns/header.js +3 -2
  241. package/src/components/page-patterns/style.scss +0 -5
  242. package/src/components/page-patterns/use-patterns.js +9 -7
  243. package/src/components/page-templates/fields.js +2 -3
  244. package/src/components/page-templates/style.scss +1 -0
  245. package/src/components/post-edit/index.js +37 -32
  246. package/src/components/post-edit/style.scss +7 -0
  247. package/src/components/post-list/index.js +10 -5
  248. package/src/components/post-list/style.scss +29 -3
  249. package/src/components/posts-app/index.js +3 -4
  250. package/src/components/posts-app-routes/home.js +36 -0
  251. package/src/components/posts-app-routes/index.js +36 -0
  252. package/src/components/posts-app-routes/posts-edit.js +31 -0
  253. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
  254. package/src/components/posts-app-routes/posts-list-view.js +40 -0
  255. package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
  256. package/src/components/posts-app-routes/posts-view.js +35 -0
  257. package/src/components/sidebar/index.js +23 -7
  258. package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
  259. package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
  260. package/src/components/sidebar-navigation-item/style.scss +2 -2
  261. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  262. package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
  263. package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
  264. package/src/components/sidebar-navigation-screen-global-styles/index.js +19 -103
  265. package/src/components/sidebar-navigation-screen-main/index.js +46 -45
  266. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
  267. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  268. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
  269. package/src/components/site-editor-routes/README.md +2 -2
  270. package/src/components/site-editor-routes/index.js +0 -2
  271. package/src/components/site-editor-routes/styles-view.js +11 -1
  272. package/src/components/site-hub/index.js +33 -16
  273. package/src/components/site-hub/style.scss +1 -1
  274. package/src/components/site-icon/style.scss +16 -0
  275. package/src/components/style-book/constants.ts +11 -3
  276. package/src/components/style-book/examples.tsx +128 -2
  277. package/src/components/style-book/index.js +86 -8
  278. package/src/components/welcome-guide/index.js +3 -3
  279. package/src/components/welcome-guide/page.js +1 -7
  280. package/src/components/welcome-guide/template.js +1 -8
  281. package/src/hooks/commands/use-common-commands.js +253 -246
  282. package/src/index.js +2 -13
  283. package/src/posts.js +1 -0
  284. package/src/store/actions.js +15 -0
  285. package/src/store/selectors.js +24 -1
  286. package/src/style.scss +2 -5
  287. package/build/components/async/index.js +0 -51
  288. package/build/components/async/index.js.map +0 -1
  289. package/build/components/post-fields/index.js +0 -290
  290. package/build/components/post-fields/index.js.map +0 -1
  291. package/build/components/posts-app/router.js +0 -85
  292. package/build/components/posts-app/router.js.map +0 -1
  293. package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
  294. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  295. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
  296. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  297. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
  298. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  299. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
  300. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  301. package/build/components/site-editor-routes/styles-edit.js +0 -28
  302. package/build/components/site-editor-routes/styles-edit.js.map +0 -1
  303. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
  304. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  305. package/build/components/use-edited-entity-record/index.js +0 -60
  306. package/build/components/use-edited-entity-record/index.js.map +0 -1
  307. package/build/hooks/commands/use-edit-mode-commands.js +0 -179
  308. package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
  309. package/build-module/components/async/index.js +0 -44
  310. package/build-module/components/async/index.js.map +0 -1
  311. package/build-module/components/post-fields/index.js +0 -283
  312. package/build-module/components/post-fields/index.js.map +0 -1
  313. package/build-module/components/posts-app/router.js +0 -77
  314. package/build-module/components/posts-app/router.js.map +0 -1
  315. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
  316. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  317. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  318. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  319. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
  320. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  321. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  322. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  323. package/build-module/components/site-editor-routes/styles-edit.js +0 -20
  324. package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
  325. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
  326. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  327. package/build-module/components/use-edited-entity-record/index.js +0 -53
  328. package/build-module/components/use-edited-entity-record/index.js.map +0 -1
  329. package/build-module/hooks/commands/use-edit-mode-commands.js +0 -171
  330. package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
  331. package/src/components/async/index.js +0 -43
  332. package/src/components/post-fields/index.js +0 -361
  333. package/src/components/post-fields/style.scss +0 -3
  334. package/src/components/posts-app/router.js +0 -69
  335. package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
  336. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  337. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
  338. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  339. package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
  340. package/src/components/site-editor-routes/styles-edit.js +0 -17
  341. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -267
  342. package/src/components/use-edited-entity-record/index.js +0 -58
  343. package/src/hooks/commands/use-edit-mode-commands.js +0 -168
  344. package/src/store/test/actions.js +0 -83
  345. package/src/store/test/reducer.js +0 -69
  346. package/src/store/test/selectors.js +0 -41
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.12.0 (2024-11-16)
6
+
5
7
  ## 6.11.0 (2024-10-30)
6
8
 
7
9
  ## 6.10.0 (2024-10-16)
@@ -10,7 +10,6 @@ exports.usePostTypeArchiveMenuItems = usePostTypeArchiveMenuItems;
10
10
  exports.useTaxonomiesMenuItems = exports.usePostTypeMenuItems = void 0;
11
11
  var _data = require("@wordpress/data");
12
12
  var _coreData = require("@wordpress/core-data");
13
- var _editor = require("@wordpress/editor");
14
13
  var _htmlEntities = require("@wordpress/html-entities");
15
14
  var _element = require("@wordpress/element");
16
15
  var _i18n = require("@wordpress/i18n");
@@ -69,7 +68,7 @@ const useExistingTemplates = () => {
69
68
  };
70
69
  exports.useExistingTemplates = useExistingTemplates;
71
70
  const useDefaultTemplateTypes = () => {
72
- return (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplateTypes(), []);
71
+ return (0, _data.useSelect)(select => select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_types || [], []);
73
72
  };
74
73
  exports.useDefaultTemplateTypes = useDefaultTemplateTypes;
75
74
  const usePublicPostTypes = () => {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_editor","_htmlEntities","_element","_i18n","_icons","_constants","EMPTY_OBJECT","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","decodeEntities","exports","useExistingTemplates","useSelect","select","coreStore","getEntityRecords","TEMPLATE_POST_TYPE","per_page","useDefaultTemplateTypes","editorStore","__experimentalGetDefaultTemplateTypes","usePublicPostTypes","postTypes","getPostTypes","useMemo","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeArchiveMenuItems","publicPostTypes","postTypesWithArchives","postType","has_archive","existingTemplates","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","needsUniqueIdentifier","useCallback","some","existingTemplate","title","sprintf","__","description","icon","startsWith","slice","archive","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templateLabels","templateName","template_name","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","_x","menuItem","post","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","blockMeta","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesHasRecords","keys","id","entitiesInfo"],"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplateTypes(),\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst postTypeLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\t\taccumulator[ singularName ] =\n\t\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof postType.icon === 'string' &&\n\t\t\t\t\t\t\tpostType.icon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst templateLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst templateName = (\n\t\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t\t).toLowerCase();\n\t\t\t\taccumulator[ templateName ] =\n\t\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\treturn templateLabels[ templateName ] > 1 && templateName !== slug;\n\t\t},\n\t\t[ templateLabels ]\n\t);\n\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle =\n\t\t\t\tlabels.template_name ||\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\t\tlabels.singular_name\n\t\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Single Item: Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'post type menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the post type e.g: \"Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Single item: %1$s (%2$s)',\n\t\t\t\t\t\t\t\t'post type menu label'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof icon === 'string' &&\n\t\t\t\t\t\t\ticon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\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\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\taccumulator[ templateName ] =\n\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst templateName = (\n\t\t\tlabels.template_name || labels.singular_name\n\t\t).toLowerCase();\n\t\treturn taxonomyLabels[ templateName ] > 1 && templateName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.template_name || labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Products by Category\". 2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy template menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the taxonomy e.g: \"Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy menu label' ),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\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\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\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\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = EMPTY_OBJECT\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesHasRecords = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = !! select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} )?.length;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\ttemplatePrefixes,\n\t\t\trecordsToExcludePerEntity,\n\t\t\tentityName,\n\t\t\tadditionalQueryParameters,\n\t\t]\n\t);\n\tconst entitiesInfo = useMemo( () => {\n\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, slug ) => {\n\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t) || [];\n\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\thasEntities: entitiesHasRecords[ slug ],\n\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t};\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );\n\treturn entitiesInfo;\n};\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA,MAAMQ,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;;AAEA,MAAMC,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,IAAI,KAAM;EAClD,IAAIC,KAAK,GAAGF,MAAM;EAClBC,IAAI,CAACE,KAAK,CAAE,GAAI,CAAC,CAACC,OAAO,CAAIC,SAAS,IAAM;IAC3CH,KAAK,GAAGA,KAAK,GAAIG,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,OAAOH,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,kBAAkB,GAAGA,CAAEC,QAAQ,EAAEN,IAAI,KAAM;EACvD,OAAO,CAAEM,QAAQ,IAAI,EAAE,EAAGC,GAAG,CAAIC,MAAM,KAAQ;IAC9C,GAAGA,MAAM;IACTC,IAAI,EAAE,IAAAC,4BAAc,EAAEZ,sBAAsB,CAAEU,MAAM,EA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,IAAI;MACnC,CAAE,CAAC,EAAEqG,MAAM;MACX,OAAOtF,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EACD,CACCwB,gBAAgB,EAChBmE,yBAAyB,EACzBH,UAAU,EACVC,yBAAyB,CAE3B,CAAC;EACD,MAAMQ,YAAY,GAAG,IAAApH,gBAAO,EAAE,MAAM;IACnC,OAAOkG,MAAM,CAACgB,IAAI,CAAEvE,gBAAgB,IAAI,CAAC,CAAE,CAAC,CAACzB,MAAM,CAClD,CAAEC,WAAW,EAAEf,IAAI,KAAM;MACxB,MAAMkE,mBAAmB,GACxBwC,yBAAyB,GAAI1G,IAAI,CAAE,EAAEtB,GAAG,CACvC,CAAE;QAAEqI;MAAG,CAAC,KAAMA,EACf,CAAC,IAAI,EAAE;MACRhG,WAAW,CAAEf,IAAI,CAAE,GAAG;QACrBuD,WAAW,EAAEsD,kBAAkB,CAAE7G,IAAI,CAAE;QACvCkE;MACD,CAAC;MACD,OAAOnD,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EAAE,CAAEwB,gBAAgB,EAAEmE,yBAAyB,EAAEG,kBAAkB,CAAG,CAAC;EACxE,OAAOG,YAAY;AACpB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_htmlEntities","_element","_i18n","_icons","_constants","EMPTY_OBJECT","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","decodeEntities","exports","useExistingTemplates","useSelect","select","coreStore","getEntityRecords","TEMPLATE_POST_TYPE","per_page","useDefaultTemplateTypes","getEntityRecord","default_template_types","usePublicPostTypes","postTypes","getPostTypes","useMemo","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeArchiveMenuItems","publicPostTypes","postTypesWithArchives","postType","has_archive","existingTemplates","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","needsUniqueIdentifier","useCallback","some","existingTemplate","title","sprintf","__","description","icon","startsWith","slice","archive","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templateLabels","templateName","template_name","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","_x","menuItem","post","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","blockMeta","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesHasRecords","keys","id","entitiesInfo"],"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_types || [],\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst postTypeLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\t\taccumulator[ singularName ] =\n\t\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof postType.icon === 'string' &&\n\t\t\t\t\t\t\tpostType.icon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst templateLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst templateName = (\n\t\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t\t).toLowerCase();\n\t\t\t\taccumulator[ templateName ] =\n\t\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\treturn templateLabels[ templateName ] > 1 && templateName !== slug;\n\t\t},\n\t\t[ templateLabels ]\n\t);\n\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle =\n\t\t\t\tlabels.template_name ||\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\t\tlabels.singular_name\n\t\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Single Item: Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'post type menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the post type e.g: \"Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Single item: %1$s (%2$s)',\n\t\t\t\t\t\t\t\t'post type menu label'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof icon === 'string' &&\n\t\t\t\t\t\t\ticon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\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\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\taccumulator[ templateName ] =\n\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst templateName = (\n\t\t\tlabels.template_name || labels.singular_name\n\t\t).toLowerCase();\n\t\treturn taxonomyLabels[ templateName ] > 1 && templateName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.template_name || labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Products by Category\". 2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy template menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the taxonomy e.g: \"Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy menu label' ),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\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\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\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\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = EMPTY_OBJECT\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesHasRecords = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = !! select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} )?.length;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\ttemplatePrefixes,\n\t\t\trecordsToExcludePerEntity,\n\t\t\tentityName,\n\t\t\tadditionalQueryParameters,\n\t\t]\n\t);\n\tconst entitiesInfo = useMemo( () => {\n\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, slug ) => {\n\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t) || [];\n\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\thasEntities: entitiesHasRecords[ slug ],\n\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t};\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );\n\treturn entitiesInfo;\n};\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMO,YAAY,GAAG,CAAC,CAAC;;AAEvB;AACA;AACA;AACA;AACA;;AAEA,MAAMC,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,IAAI,KAAM;EAClD,IAAIC,KAAK,GAAGF,MAAM;EAClBC,IAAI,CAACE,KAAK,CAAE,GAAI,CAAC,CAACC,OAAO,CAAIC,SAAS,IAAM;IAC3CH,KAAK,GAAGA,KAAK,GAAIG,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,OAAOH,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,kBAAkB,GAAGA,CAAEC,QAAQ,EAAEN,IAAI,KAAM;EACvD,OAAO,CAAEM,QAAQ,IAAI,EAAE,EAAGC,GAAG,CAAIC,MAAM,KAAQ;IAC9C,GAAGA,MAAM;IACTC,IAAI,EAAE,IAAAC,4BAAc,EAAEZ,sBAAsB,CAAEU,MAAM,EAAER,IAAK,CAAE;EAC9D,CAAC,CAAG,CAAC;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJAW,OAAA,CAAAN,kBAAA,GAAAA,kBAAA;AAMO,MAAMO,oBAAoB,GAAGA,CAAA,KAAM;EACzC,OAAO,IAAAC,eAAS,EACbC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BH,UAAU,EACVC,yBAAyB,CAE3B,CAAC;EACD,MAAMQ,YAAY,GAAG,IAAApH,gBAAO,EAAE,MAAM;IACnC,OAAOkG,MAAM,CAACgB,IAAI,CAAEvE,gBAAgB,IAAI,CAAC,CAAE,CAAC,CAACzB,MAAM,CAClD,CAAEC,WAAW,EAAEf,IAAI,KAAM;MACxB,MAAMkE,mBAAmB,GACxBwC,yBAAyB,GAAI1G,IAAI,CAAE,EAAEtB,GAAG,CACvC,CAAE;QAAEqI;MAAG,CAAC,KAAMA,EACf,CAAC,IAAI,EAAE;MACRhG,WAAW,CAAEf,IAAI,CAAE,GAAG;QACrBuD,WAAW,EAAEsD,kBAAkB,CAAE7G,IAAI,CAAE;QACvCkE;MACD,CAAC;MACD,OAAOnD,WAAW;IACnB,CAAC,EACD,CAAC,CACF,CAAC;EACF,CAAC,EAAE,CAAEwB,gBAAgB,EAAEmE,yBAAyB,EAAEG,kBAAkB,CAAG,CAAC;EACxE,OAAOG,YAAY;AACpB,CAAC","ignoreList":[]}
@@ -15,8 +15,6 @@ var _router = require("@wordpress/router");
15
15
  var _layout = _interopRequireDefault(require("../layout"));
16
16
  var _lockUnlock = require("../../lock-unlock");
17
17
  var _useCommonCommands = require("../../hooks/commands/use-common-commands");
18
- var _useEditModeCommands = require("../../hooks/commands/use-edit-mode-commands");
19
- var _useInitEditedEntityFromUrl = _interopRequireDefault(require("../sync-state-with-url/use-init-edited-entity-from-url"));
20
18
  var _router2 = _interopRequireDefault(require("../layout/router"));
21
19
  var _useSetCommandContext = _interopRequireDefault(require("../../hooks/commands/use-set-command-context"));
22
20
  var _siteEditorRoutes = require("../site-editor-routes");
@@ -36,9 +34,6 @@ const {
36
34
  GlobalStylesProvider
37
35
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
38
36
  function AppLayout() {
39
- // This ensures the edited entity id and type are initialized properly.
40
- (0, _useInitEditedEntityFromUrl.default)();
41
- (0, _useEditModeCommands.useEditModeCommands)();
42
37
  (0, _useCommonCommands.useCommonCommands)();
43
38
  (0, _useSetCommandContext.default)();
44
39
  (0, _siteEditorRoutes.useRegisterSiteEditorRoutes)();
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","_lockUnlock","_useCommonCommands","_useEditModeCommands","_useInitEditedEntityFromUrl","_router2","_useSetCommandContext","_siteEditorRoutes","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","AppLayout","useInitEditedEntityFromURL","useEditModeCommands","useCommonCommands","useSetCommandContext","useRegisterSiteEditorRoutes","route","useActiveRoute","jsx","default","App","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","SlotFillProvider","children","jsxs","UnsavedChangesWarning","PluginArea","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport useActiveRoute from '../layout/router';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\nimport { useRegisterSiteEditorRoutes } from '../site-editor-routes';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction AppLayout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\tuseRegisterSiteEditorRoutes();\n\tconst route = useActiveRoute();\n\n\treturn <Layout route={ route } />;\n}\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<AppLayout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterProvider>\n\t\t\t</GlobalStylesProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AACA,IAAAW,oBAAA,GAAAX,OAAA;AACA,IAAAY,2BAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,QAAA,GAAAL,sBAAA,CAAAR,OAAA;AACA,IAAAc,qBAAA,GAAAN,sBAAA,CAAAR,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AAAoE,IAAAgB,WAAA,GAAAhB,OAAA;AAxBpE;AACA;AACA;;AAYA;AACA;A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AAC;IAAA,CACI;EAAC,CACN,CAAC;AAErB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","_lockUnlock","_useCommonCommands","_router2","_useSetCommandContext","_siteEditorRoutes","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","AppLayout","useCommonCommands","useSetCommandContext","useRegisterSiteEditorRoutes","route","useActiveRoute","jsx","default","App","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","SlotFillProvider","children","jsxs","UnsavedChangesWarning","PluginArea","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport useActiveRoute from '../layout/router';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\nimport { useRegisterSiteEditorRoutes } from '../site-editor-routes';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction AppLayout() {\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\tuseRegisterSiteEditorRoutes();\n\tconst route = useActiveRoute();\n\n\treturn <Layout route={ route } />;\n}\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<AppLayout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterProvider>\n\t\t\t</GlobalStylesProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,qBAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,iBAAA,GAAAb,OAAA;AAAoE,IAAAc,WAAA,GAAAd,OAAA;AAtBpE;AACA;AACA;;AAYA;AACA;AACA;;AAQA,MAAM;EAAEe;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AACtD,MAAM;EAAEC;AAAqB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE5D,SAASC,SAASA,CAAA,EAAG;EACpB,IAAAC,oCAAiB,EAAC,CAAC;EACnB,IAAAC,6BAAoB,EAAC,CAAC;EACtB,IAAAC,6CAA2B,EAAC,CAAC;EAC7B,MAAMC,KAAK,GAAG,IAAAC,gBAAc,EAAC,CAAC;EAE9B,oBAAO,IAAAX,WAAA,CAAAY,GAAA,EAACnB,OAAA,CAAAoB,OAAM;IAACH,KAAK,EAAGA;EAAO,CAAE,CAAC;AAClC;AAEe,SAASI,GAAGA,CAAA,EAAG;EAC7B,MAAM;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEzD,SAASC,iBAAiBA,CAAEC,IAAI,EAAG;IAClCJ,iBAAiB,CAChB,IAAAK,aAAO,EACN;IACA,IAAAC,QAAE,EACD,kEACD,CAAC,EACDF,IACD,CACD,CAAC;EACF;EAEA,oBACC,IAAAnB,WAAA,CAAAY,GAAA,EAAC3B,WAAA,CAAAqC,gBAAgB;IAAAC,QAAA,eAChB,IAAAvB,WAAA,CAAAwB,IAAA,EAACpB,oBAAoB;MAAAmB,QAAA,gBACpB,IAAAvB,WAAA,CAAAY,GAAA,EAACzB,OAAA,CAAAsC,qBAAqB,IAAE,CAAC,eACzB,IAAAzB,WAAA,CAAAwB,IAAA,EAACvB,cAAc;QAAAsB,QAAA,gBACd,IAAAvB,WAAA,CAAAY,GAAA,EAACN,SAAS,IAAE,CAAC,eACb,IAAAN,WAAA,CAAAY,GAAA,EAACrB,QAAA,CAAAmC,UAAU;UAACC,OAAO,EAAGT;QAAmB,CAAE,CAAC;MAAA,CAC7B,CAAC;IAAA,CACI;EAAC,CACN,CAAC;AAErB","ignoreList":[]}
@@ -71,14 +71,12 @@ function useEditorIframeProps() {
71
71
  });
72
72
  }
73
73
  },
74
- onClick: () => {
75
- history.push({
76
- ...params,
77
- canvas: 'edit'
78
- }, undefined, {
79
- transition: 'canvas-mode-edit-transition'
80
- });
81
- },
74
+ onClick: () => history.push({
75
+ ...params,
76
+ canvas: 'edit'
77
+ }, undefined, {
78
+ transition: 'canvas-mode-edit-transition'
79
+ }),
82
80
  onClickCapture: event => {
83
81
  if (currentPostIsTrashed) {
84
82
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_keycodes","_element","_i18n","_editor","_router","_lockUnlock","useLocation","useHistory","unlock","routerPrivateApis","useEditorIframeProps","params","history","canvas","currentPostIsTrashed","useSelect","select","editorStore","getCurrentPostAttribute","isFocused","setIsFocused","useState","useEffect","viewModeIframeProps","__","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","push","undefined","transition","onClick","onClickCapture","stopPropagation","readonly","className","clsx"],"sources":["@wordpress/edit-site/src/components/block-editor/use-editor-iframe-props.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useEditorIframeProps() {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = params;\n\tconst currentPostIsTrashed = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t'trash'\n\t\t);\n\t}, [] );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvas === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvas ] );\n\n\t// In view mode, make the canvas iframe be perceived and behave as a button\n\t// to switch to edit mode, with a meaningful label and no title attribute.\n\tconst viewModeIframeProps = {\n\t\t'aria-label': __( 'Edit' ),\n\t\t'aria-disabled': currentPostIsTrashed,\n\t\ttitle: null,\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif (\n\t\t\t\t( keyCode === ENTER || keyCode === SPACE ) &&\n\t\t\t\t! currentPostIsTrashed\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\thistory.push( { ...params, canvas: 'edit' }, undefined, {\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\tonClick: () => {\n\t\t\thistory.push( { ...params, canvas: 'edit' }, undefined, {\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t} );\n\t\t},\n\t\tonClickCapture: ( event ) => {\n\t\t\tif ( currentPostIsTrashed ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\treturn {\n\t\tclassName: clsx( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t'is-focused': isFocused && canvas === 'view',\n\t\t} ),\n\t\t...( canvas === 'view' ? viewModeIframeProps : {} ),\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAM;EAAEQ,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEhD,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAO,CAAC,GAAGL,WAAW,CAAC,CAAC;EAChC,MAAMM,OAAO,GAAGL,UAAU,CAAC,CAAC;EAC5B,MAAM;IAAE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EAAEwB,SAAS,EAAE;QACvDC,UAAU,EAAE;MACb,CAAE,CAAC;IACJ,CAAC;IACDE,cAAc,EAAIT,KAAK,IAAM;MAC5B,IAAKjB,oBAAoB,EAAG;QAC3BiB,KAAK,CAACI,cAAc,CAAC,CAAC;QACtBJ,KAAK,CAACU,eAAe,CAAC,CAAC;MACxB;IACD,CAAC;IACDC,QAAQ,EAAE;EACX,CAAC;EAED,OAAO;IACNC,SAAS,EAAE,IAAAC,aAAI,EAAE,wCAAwC,EAAE;MAC1D,YAAY,EAAEzB,SAAS,IAAIN,MAAM,KAAK;IACvC,CAAE,CAAC;IACH,IAAKA,MAAM,KAAK,MAAM,GAAGU,mBAAmB,GAAG,CAAC,CAAC;EAClD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_keycodes","_element","_i18n","_editor","_router","_lockUnlock","useLocation","useHistory","unlock","routerPrivateApis","useEditorIframeProps","params","history","canvas","currentPostIsTrashed","useSelect","select","editorStore","getCurrentPostAttribute","isFocused","setIsFocused","useState","useEffect","viewModeIframeProps","__","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","push","undefined","transition","onClick","onClickCapture","stopPropagation","readonly","className","clsx"],"sources":["@wordpress/edit-site/src/components/block-editor/use-editor-iframe-props.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useEditorIframeProps() {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = params;\n\tconst currentPostIsTrashed = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t'trash'\n\t\t);\n\t}, [] );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvas === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvas ] );\n\n\t// In view mode, make the canvas iframe be perceived and behave as a button\n\t// to switch to edit mode, with a meaningful label and no title attribute.\n\tconst viewModeIframeProps = {\n\t\t'aria-label': __( 'Edit' ),\n\t\t'aria-disabled': currentPostIsTrashed,\n\t\ttitle: null,\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif (\n\t\t\t\t( keyCode === ENTER || keyCode === SPACE ) &&\n\t\t\t\t! currentPostIsTrashed\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\thistory.push( { ...params, canvas: 'edit' }, undefined, {\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\tonClick: () =>\n\t\t\thistory.push( { ...params, canvas: 'edit' }, undefined, {\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t} ),\n\t\tonClickCapture: ( event ) => {\n\t\t\tif ( currentPostIsTrashed ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\treturn {\n\t\tclassName: clsx( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t'is-focused': isFocused && canvas === 'view',\n\t\t} ),\n\t\t...( canvas === 'view' ? viewModeIframeProps : {} ),\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AA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A,KAAMT,YAAY,CAAE,KAAM,CAAC;IACnCU,SAAS,EAAIC,KAAK,IAAM;MACvB,MAAM;QAAEC;MAAQ,CAAC,GAAGD,KAAK;MACzB,IACC,CAAEC,OAAO,KAAKC,eAAK,IAAID,OAAO,KAAKE,eAAK,KACxC,CAAEpB,oBAAoB,EACrB;QACDiB,KAAK,CAACI,cAAc,CAAC,CAAC;QACtBvB,OAAO,CAACwB,IAAI,CAAE;UAAE,GAAGzB,MAAM;UAAEE,MAAM,EAAE;QAAO,CAAC,EAAEwB,SAAS,EAAE;UACvDC,UAAU,EAAE;QACb,CAAE,CAAC;MACJ;IACD,CAAC;IACDC,OAAO,EAAEA,CAAA,KACR3B,OAAO,CAACwB,IAAI,CAAE;MAAE,GAAGzB,MAAM;MAAEE,MAAM,EAAE;IAAO,CAAC,EAAEwB,SAAS,EAAE;MACvDC,UAAU,EAAE;IACb,CAAE,CAAC;IACJE,cAAc,EAAIT,KAAK,IAAM;MAC5B,IAAKjB,oBAAoB,EAAG;QAC3BiB,KAAK,CAACI,cAAc,CAAC,CAAC;QACtBJ,KAAK,CAACU,eAAe,CAAC,CAAC;MACxB;IACD,CAAC;IACDC,QAAQ,EAAE;EACX,CAAC;EAED,OAAO;IACNC,SAAS,EAAE,IAAAC,aAAI,EAAE,wCAAwC,EAAE;MAC1D,YAAY,EAAEzB,SAAS,IAAIN,MAAM,KAAK;IACvC,CAAE,CAAC;IACH,IAAKA,MAAM,KAAK,MAAM,GAAGU,mBAAmB,GAAG,CAAC,CAAC;EAClD,CAAC;AACF","ignoreList":[]}
@@ -49,22 +49,15 @@ function useSpecificEditorSettings() {
49
49
  } = params;
50
50
  const onNavigateToEntityRecord = (0, _useNavigateToEntityRecord.default)();
51
51
  const {
52
- settings,
53
- shouldUseTemplateAsDefaultRenderingMode
52
+ settings
54
53
  } = (0, _data.useSelect)(select => {
55
54
  const {
56
- getEditedPostContext,
57
55
  getSettings
58
- } = (0, _lockUnlock.unlock)(select(_store.store));
59
- const _context = getEditedPostContext();
56
+ } = select(_store.store);
60
57
  return {
61
- settings: getSettings(),
62
- // TODO: The `postType` check should be removed when the default rendering mode per post type is merged.
63
- // @see https://github.com/WordPress/gutenberg/pull/62304/
64
- shouldUseTemplateAsDefaultRenderingMode: _context?.postId && _context?.postType !== 'post'
58
+ settings: getSettings()
65
59
  };
66
60
  }, []);
67
- const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode ? 'template-locked' : 'post-only';
68
61
  const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
69
62
  const defaultEditorSettings = (0, _element.useMemo)(() => {
70
63
  return {
@@ -72,12 +65,11 @@ function useSpecificEditorSettings() {
72
65
  richEditingEnabled: true,
73
66
  supportsTemplateMode: true,
74
67
  focusMode: canvas !== 'view',
75
- defaultRenderingMode,
76
68
  onNavigateToEntityRecord,
77
69
  onNavigateToPreviousEntityRecord,
78
70
  isPreviewMode: canvas === 'view'
79
71
  };
80
- }, [settings, canvas, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
72
+ }, [settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
81
73
  return defaultEditorSettings;
82
74
  }
83
75
  //# sourceMappingURL=use-site-editor-settings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_router","_compose","_store","_lockUnlock","_useNavigateToEntityRecord","_interopRequireDefault","_constants","useLocation","useHistory","unlock","routerPrivateApis","useNavigateToPreviousEntityRecord","location","previousLocation","usePrevious","history","goBack","useMemo","isFocusMode","params","focusMode","postId","FOCUSABLE_ENTITIES","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","useNavigateToEntityRecord","settings","shouldUseTemplateAsDefaultRenderingMode","useSelect","select","getEditedPostContext","getSettings","editSiteStore","_context","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","isPreviewMode"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// `previousLocation` changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { settings, shouldUseTemplateAsDefaultRenderingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext, getSettings } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\tsettings: getSettings(),\n\t\t\t\t// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/pull/62304/\n\t\t\t\tshouldUseTemplateAsDefaultRenderingMode:\n\t\t\t\t\t_context?.postId && _context?.postType !== 'post',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvas !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tisPreviewMode: canvas === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvas,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,0BAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAMA;AACA;AACA;;AAMA,MAAM;EAAES,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/D,SAASC,iCAAiCA,CAAA,EAAG;EAC5C,MAAMC,QAAQ,GAAGL,WAAW,CAAC,CAAC;EAC9B,MAAMM,gBAAgB,GAAG,IAAAC,oBAAW,EAAEF,QAAS,CAAC;EAChD,MAAMG,OAAO,GAAGP,UAAU,CAAC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d,MAAMQ,gCAAgC,GACrC/B,iCAAiC,CAAC,CAAC;EACpC,MAAMgC,qBAAqB,GAAG,IAAA1B,gBAAO,EAAE,MAAM;IAC5C,OAAO;MACN,GAAGgB,QAAQ;MAEXW,kBAAkB,EAAE,IAAI;MACxBC,oBAAoB,EAAE,IAAI;MAC1BzB,SAAS,EAAEM,MAAM,KAAK,MAAM;MAC5Be,oBAAoB;MACpBV,wBAAwB;MACxBW,gCAAgC;MAChCI,aAAa,EAAEpB,MAAM,KAAK;IAC3B,CAAC;EACF,CAAC,EAAE,CACFO,QAAQ,EACRP,MAAM,EACNe,oBAAoB,EACpBV,wBAAwB,EACxBW,gCAAgC,CAC/B,CAAC;EAEH,OAAOC,qBAAqB;AAC7B","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_router","_compose","_store","_lockUnlock","_useNavigateToEntityRecord","_interopRequireDefault","_constants","useLocation","useHistory","unlock","routerPrivateApis","useNavigateToPreviousEntityRecord","location","previousLocation","usePrevious","history","goBack","useMemo","isFocusMode","params","focusMode","postId","FOCUSABLE_ENTITIES","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","useNavigateToEntityRecord","settings","useSelect","select","getSettings","editSiteStore","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","isPreviewMode"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// `previousLocation` changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { settings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( editSiteStore );\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvas !== 'view',\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tisPreviewMode: canvas === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvas,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAA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AG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7C,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,YAAc,CAAC;IAC/C,OAAO;MACNJ,QAAQ,EAAEG,WAAW,CAAC;IACvB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,gCAAgC,GACrC3B,iCAAiC,CAAC,CAAC;EACpC,MAAM4B,qBAAqB,GAAG,IAAAtB,gBAAO,EAAE,MAAM;IAC5C,OAAO;MACN,GAAGgB,QAAQ;MAEXO,kBAAkB,EAAE,IAAI;MACxBC,oBAAoB,EAAE,IAAI;MAC1BrB,SAAS,EAAEM,MAAM,KAAK,MAAM;MAC5BK,wBAAwB;MACxBO,gCAAgC;MAChCI,aAAa,EAAEhB,MAAM,KAAK;IAC3B,CAAC;EACF,CAAC,EAAE,CACFO,QAAQ,EACRP,MAAM,EACNK,wBAAwB,EACxBO,gCAAgC,CAC/B,CAAC;EAEH,OAAOC,qBAAqB;AAC7B","ignoreList":[]}
@@ -38,6 +38,8 @@ var _useEditorIframeProps = _interopRequireDefault(require("../block-editor/use-
38
38
  var _useEditorTitle = _interopRequireDefault(require("./use-editor-title"));
39
39
  var _hooks = require("../layout/hooks");
40
40
  var _useAdaptEditorToCanvas = require("./use-adapt-editor-to-canvas");
41
+ var _constants = require("../../utils/constants");
42
+ var _useResolveEditedEntity = require("./use-resolve-edited-entity");
41
43
  var _jsxRuntime = require("react/jsx-runtime");
42
44
  /**
43
45
  * External dependencies
@@ -96,12 +98,15 @@ function EditSiteEditor({
96
98
  } = params;
97
99
  const isLoading = (0, _hooks.useIsSiteEditorLoading)();
98
100
  (0, _useAdaptEditorToCanvas.useAdaptEditorToCanvas)(canvas);
101
+ const entity = (0, _useResolveEditedEntity.useResolveEditedEntity)();
102
+ // deprecated sync state with url
103
+ (0, _useResolveEditedEntity.useSyncDeprecatedEntityIntoState)(entity);
104
+ const {
105
+ postType,
106
+ postId,
107
+ context
108
+ } = entity;
99
109
  const {
100
- editedPostType,
101
- editedPostId,
102
- contextPostType,
103
- contextPostId,
104
- isEditingPage,
105
110
  supportsGlobalStyles,
106
111
  showIconLabels,
107
112
  editorCanvasView,
@@ -109,11 +114,7 @@ function EditSiteEditor({
109
114
  hasSiteIcon
110
115
  } = (0, _data.useSelect)(select => {
111
116
  const {
112
- getEditorCanvasContainerView,
113
- getEditedPostContext,
114
- isPage,
115
- getEditedPostType,
116
- getEditedPostId
117
+ getEditorCanvasContainerView
117
118
  } = (0, _lockUnlock.unlock)(select(_store.store));
118
119
  const {
119
120
  get
@@ -122,17 +123,8 @@ function EditSiteEditor({
122
123
  getCurrentTheme,
123
124
  getEntityRecord
124
125
  } = select(_coreData.store);
125
- const _context = getEditedPostContext();
126
126
  const siteData = getEntityRecord('root', '__unstableBase', undefined);
127
-
128
- // The currently selected entity to display.
129
- // Typically template or template part in the site editor.
130
127
  return {
131
- editedPostType: getEditedPostType(),
132
- editedPostId: getEditedPostId(),
133
- contextPostType: _context?.postId ? _context.postType : undefined,
134
- contextPostId: _context?.postId ? _context.postId : undefined,
135
- isEditingPage: isPage(),
136
128
  supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
137
129
  showIconLabels: get('core', 'showIconLabels'),
138
130
  editorCanvasView: getEditorCanvasContainerView(),
@@ -140,12 +132,12 @@ function EditSiteEditor({
140
132
  hasSiteIcon: !!siteData?.site_icon_url
141
133
  };
142
134
  }, []);
143
- (0, _useEditorTitle.default)();
135
+ const postWithTemplate = !!context?.postId;
136
+ (0, _useEditorTitle.default)(postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId);
144
137
  const _isPreviewingTheme = (0, _isPreviewingTheme2.isPreviewingTheme)();
145
138
  const hasDefaultEditorCanvasView = !(0, _editorCanvasContainer.useHasEditorCanvasContainer)();
146
139
  const iframeProps = (0, _useEditorIframeProps.default)();
147
140
  const isEditMode = canvas === 'edit';
148
- const postWithTemplate = !!contextPostId;
149
141
  const loadingProgressId = (0, _compose.useInstanceId)(_canvasLoader.default, 'edit-site-editor__loading-progress');
150
142
  const settings = (0, _useSiteEditorSettings.useSpecificEditorSettings)();
151
143
  const styles = (0, _element.useMemo)(() => [...settings.styles, {
@@ -202,12 +194,16 @@ function EditSiteEditor({
202
194
  duration: disableMotion ? 0 : 0.2
203
195
  };
204
196
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
205
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesRenderer.GlobalStylesRenderer, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_canvasLoader.default, {
197
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesRenderer.GlobalStylesRenderer, {
198
+ disableRootPadding: postType !== _constants.TEMPLATE_POST_TYPE
199
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_canvasLoader.default, {
206
200
  id: loadingProgressId
207
- }) : null, isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {}), isReady && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Editor, {
208
- postType: postWithTemplate ? contextPostType : editedPostType,
209
- postId: postWithTemplate ? contextPostId : editedPostId,
210
- templateId: postWithTemplate ? editedPostId : undefined,
201
+ }) : null, isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {
202
+ postType: postWithTemplate ? context.postType : postType
203
+ }), isReady && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Editor, {
204
+ postType: postWithTemplate ? context.postType : postType,
205
+ postId: postWithTemplate ? context.postId : postId,
206
+ templateId: postWithTemplate ? postId : undefined,
211
207
  settings: settings,
212
208
  className: (0, _clsx.default)('edit-site-editor__editor-interface', {
213
209
  'show-icon-labels': showIconLabels
@@ -221,7 +217,7 @@ function EditSiteEditor({
221
217
  title: title,
222
218
  iframeProps: iframeProps,
223
219
  onActionPerformed: onActionPerformed,
224
- extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginTemplateSettingPanel.default.Slot, {}),
220
+ extraSidebarPanels: !postWithTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginTemplateSettingPanel.default.Slot, {}),
225
221
  children: [isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BackButton, {
226
222
  children: ({
227
223
  length