@wordpress/edit-site 6.13.0 → 6.13.1-next.a9f418477.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 (514) hide show
  1. package/build/components/add-new-pattern/index.js +3 -16
  2. package/build/components/add-new-pattern/index.js.map +1 -1
  3. package/build/components/add-new-post/index.js +1 -1
  4. package/build/components/add-new-post/index.js.map +1 -1
  5. package/build/components/add-new-template/index.js +1 -5
  6. package/build/components/add-new-template/index.js.map +1 -1
  7. package/build/components/app/index.js +31 -29
  8. package/build/components/app/index.js.map +1 -1
  9. package/build/components/block-editor/use-editor-iframe-props.js +8 -8
  10. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  11. package/build/components/block-editor/use-navigate-to-entity-record.js +1 -5
  12. package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  13. package/build/components/block-editor/use-site-editor-settings.js +4 -4
  14. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  15. package/build/components/dataviews-actions/index.js +1 -5
  16. package/build/components/dataviews-actions/index.js.map +1 -1
  17. package/build/components/editor/index.js +38 -22
  18. package/build/components/editor/index.js.map +1 -1
  19. package/build/components/editor/use-editor-title.js +5 -0
  20. package/build/components/editor/use-editor-title.js.map +1 -1
  21. package/build/components/editor/use-resolve-edited-entity.js +19 -4
  22. package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/context.js +0 -1
  24. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/font-collection.js +36 -26
  26. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  28. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  30. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  31. package/build/components/global-styles/preview-colors.js +2 -2
  32. package/build/components/global-styles/preview-colors.js.map +1 -1
  33. package/build/components/global-styles/preview-styles.js +2 -2
  34. package/build/components/global-styles/preview-styles.js.map +1 -1
  35. package/build/components/global-styles/preview-typography.js +2 -2
  36. package/build/components/global-styles/preview-typography.js.map +1 -1
  37. package/build/components/global-styles/{preview-iframe.js → preview-wrapper.js} +10 -29
  38. package/build/components/global-styles/preview-wrapper.js.map +1 -0
  39. package/build/components/global-styles/typography-example.js +8 -1
  40. package/build/components/global-styles/typography-example.js.map +1 -1
  41. package/build/components/global-styles-sidebar/index.js +5 -5
  42. package/build/components/global-styles-sidebar/index.js.map +1 -1
  43. package/build/components/layout/index.js +44 -19
  44. package/build/components/layout/index.js.map +1 -1
  45. package/build/components/page-patterns/delete-category-menu-item.js +1 -4
  46. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  47. package/build/components/page-patterns/fields.js +6 -57
  48. package/build/components/page-patterns/fields.js.map +1 -1
  49. package/build/components/page-patterns/index.js +31 -30
  50. package/build/components/page-patterns/index.js.map +1 -1
  51. package/build/components/page-templates/fields.js +6 -34
  52. package/build/components/page-templates/fields.js.map +1 -1
  53. package/build/components/page-templates/index.js +34 -46
  54. package/build/components/page-templates/index.js.map +1 -1
  55. package/build/components/post-edit/header.js +83 -0
  56. package/build/components/post-edit/header.js.map +1 -0
  57. package/build/components/post-edit/index.js +42 -7
  58. package/build/components/post-edit/index.js.map +1 -1
  59. package/build/components/post-list/index.js +26 -40
  60. package/build/components/post-list/index.js.map +1 -1
  61. package/build/components/posts-app/index.js +10 -16
  62. package/build/components/posts-app/index.js.map +1 -1
  63. package/build/components/posts-app-routes/index.js +3 -7
  64. package/build/components/posts-app-routes/index.js.map +1 -1
  65. package/build/components/posts-app-routes/{posts-edit.js → post-item.js} +9 -13
  66. package/build/components/posts-app-routes/post-item.js.map +1 -0
  67. package/build/components/posts-app-routes/posts.js +89 -0
  68. package/build/components/posts-app-routes/posts.js.map +1 -0
  69. package/build/components/resizable-frame/index.js +6 -5
  70. package/build/components/resizable-frame/index.js.map +1 -1
  71. package/build/components/save-panel/index.js +9 -6
  72. package/build/components/save-panel/index.js.map +1 -1
  73. package/build/components/sidebar-dataviews/add-new-view.js +7 -8
  74. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  75. package/build/components/sidebar-dataviews/dataview-item.js +5 -8
  76. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  77. package/build/components/sidebar-dataviews/default-views.js +7 -24
  78. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  79. package/build/components/sidebar-dataviews/index.js +4 -3
  80. package/build/components/sidebar-dataviews/index.js.map +1 -1
  81. package/build/components/sidebar-global-styles-wrapper/index.js +18 -18
  82. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  83. package/build/components/sidebar-navigation-item/index.js +8 -5
  84. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  85. package/build/components/sidebar-navigation-screen/index.js +2 -2
  86. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  87. package/build/components/sidebar-navigation-screen-global-styles/content.js +12 -38
  88. package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen-global-styles/index.js +8 -19
  90. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-main/index.js +6 -14
  92. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  94. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  96. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  98. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  99. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  100. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  101. package/build/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  102. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  103. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -5
  104. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  105. package/build/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  106. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  107. package/build/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  108. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  109. package/build/components/site-editor-routes/{home-view.js → home.js} +7 -8
  110. package/build/components/site-editor-routes/home.js.map +1 -0
  111. package/build/components/site-editor-routes/index.js +12 -18
  112. package/build/components/site-editor-routes/index.js.map +1 -1
  113. package/build/components/site-editor-routes/navigation-item.js +49 -0
  114. package/build/components/site-editor-routes/navigation-item.js.map +1 -0
  115. package/build/components/{posts-app-routes/home.js → site-editor-routes/navigation.js} +16 -18
  116. package/build/components/site-editor-routes/navigation.js.map +1 -0
  117. package/build/components/site-editor-routes/{pages-edit.js → page-item.js} +10 -17
  118. package/build/components/site-editor-routes/page-item.js.map +1 -0
  119. package/build/components/site-editor-routes/pages.js +87 -0
  120. package/build/components/site-editor-routes/pages.js.map +1 -0
  121. package/build/components/site-editor-routes/{home-edit.js → pattern-item.js} +11 -11
  122. package/build/components/site-editor-routes/pattern-item.js.map +1 -0
  123. package/build/components/site-editor-routes/{patterns-view.js → patterns.js} +6 -9
  124. package/build/components/site-editor-routes/patterns.js.map +1 -0
  125. package/build/components/site-editor-routes/{styles-view.js → styles.js} +28 -9
  126. package/build/components/site-editor-routes/styles.js.map +1 -0
  127. package/build/components/site-editor-routes/{templates-edit.js → template-item.js} +6 -11
  128. package/build/components/site-editor-routes/template-item.js.map +1 -0
  129. package/build/components/site-editor-routes/{patterns-edit.js → template-part-item.js} +6 -11
  130. package/build/components/site-editor-routes/template-part-item.js.map +1 -0
  131. package/build/components/site-editor-routes/{templates-list-view.js → templates.js} +20 -13
  132. package/build/components/site-editor-routes/templates.js.map +1 -0
  133. package/build/components/site-hub/index.js +3 -3
  134. package/build/components/site-hub/index.js.map +1 -1
  135. package/build/components/style-book/constants.js +8 -19
  136. package/build/components/style-book/constants.js.map +1 -1
  137. package/build/components/style-book/examples.js +42 -27
  138. package/build/components/style-book/examples.js.map +1 -1
  139. package/build/components/style-book/index.js +21 -5
  140. package/build/components/style-book/index.js.map +1 -1
  141. package/build/components/style-book/types.js.map +1 -1
  142. package/build/hooks/commands/use-common-commands.js +12 -48
  143. package/build/hooks/commands/use-common-commands.js.map +1 -1
  144. package/build/hooks/commands/use-set-command-context.js +2 -2
  145. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  146. package/build/store/private-actions.js +7 -0
  147. package/build/store/private-actions.js.map +1 -1
  148. package/build/store/reducer.js +2 -0
  149. package/build/store/reducer.js.map +1 -1
  150. package/build/utils/is-previewing-theme.js +1 -1
  151. package/build/utils/is-previewing-theme.js.map +1 -1
  152. package/build/utils/use-activate-theme.js +9 -8
  153. package/build/utils/use-activate-theme.js.map +1 -1
  154. package/build-module/components/add-new-pattern/index.js +3 -16
  155. package/build-module/components/add-new-pattern/index.js.map +1 -1
  156. package/build-module/components/add-new-post/index.js +1 -1
  157. package/build-module/components/add-new-post/index.js.map +1 -1
  158. package/build-module/components/add-new-template/index.js +1 -5
  159. package/build-module/components/add-new-template/index.js.map +1 -1
  160. package/build-module/components/app/index.js +33 -31
  161. package/build-module/components/app/index.js.map +1 -1
  162. package/build-module/components/block-editor/use-editor-iframe-props.js +8 -8
  163. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  164. package/build-module/components/block-editor/use-navigate-to-entity-record.js +1 -5
  165. package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  166. package/build-module/components/block-editor/use-site-editor-settings.js +4 -4
  167. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  168. package/build-module/components/dataviews-actions/index.js +1 -5
  169. package/build-module/components/dataviews-actions/index.js.map +1 -1
  170. package/build-module/components/editor/index.js +38 -22
  171. package/build-module/components/editor/index.js.map +1 -1
  172. package/build-module/components/editor/use-editor-title.js +5 -0
  173. package/build-module/components/editor/use-editor-title.js.map +1 -1
  174. package/build-module/components/editor/use-resolve-edited-entity.js +19 -4
  175. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
  176. package/build-module/components/global-styles/font-library-modal/context.js +0 -1
  177. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  178. package/build-module/components/global-styles/font-library-modal/font-collection.js +37 -27
  179. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  180. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  181. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  183. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  184. package/build-module/components/global-styles/preview-colors.js +2 -2
  185. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  186. package/build-module/components/global-styles/preview-styles.js +2 -2
  187. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  188. package/build-module/components/global-styles/preview-typography.js +2 -2
  189. package/build-module/components/global-styles/preview-typography.js.map +1 -1
  190. package/build-module/components/global-styles/{preview-iframe.js → preview-wrapper.js} +12 -31
  191. package/build-module/components/global-styles/preview-wrapper.js.map +1 -0
  192. package/build-module/components/global-styles/typography-example.js +8 -1
  193. package/build-module/components/global-styles/typography-example.js.map +1 -1
  194. package/build-module/components/global-styles-sidebar/index.js +5 -5
  195. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  196. package/build-module/components/layout/index.js +45 -20
  197. package/build-module/components/layout/index.js.map +1 -1
  198. package/build-module/components/page-patterns/delete-category-menu-item.js +1 -4
  199. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  200. package/build-module/components/page-patterns/fields.js +7 -58
  201. package/build-module/components/page-patterns/fields.js.map +1 -1
  202. package/build-module/components/page-patterns/index.js +29 -28
  203. package/build-module/components/page-patterns/index.js.map +1 -1
  204. package/build-module/components/page-templates/fields.js +5 -31
  205. package/build-module/components/page-templates/fields.js.map +1 -1
  206. package/build-module/components/page-templates/index.js +33 -45
  207. package/build-module/components/page-templates/index.js.map +1 -1
  208. package/build-module/components/post-edit/header.js +76 -0
  209. package/build-module/components/post-edit/header.js.map +1 -0
  210. package/build-module/components/post-edit/index.js +42 -7
  211. package/build-module/components/post-edit/index.js.map +1 -1
  212. package/build-module/components/post-list/index.js +26 -40
  213. package/build-module/components/post-list/index.js.map +1 -1
  214. package/build-module/components/posts-app/index.js +11 -17
  215. package/build-module/components/posts-app/index.js.map +1 -1
  216. package/build-module/components/posts-app-routes/index.js +3 -7
  217. package/build-module/components/posts-app-routes/index.js.map +1 -1
  218. package/build-module/components/posts-app-routes/{posts-edit.js → post-item.js} +8 -12
  219. package/build-module/components/posts-app-routes/post-item.js.map +1 -0
  220. package/build-module/components/posts-app-routes/posts.js +81 -0
  221. package/build-module/components/posts-app-routes/posts.js.map +1 -0
  222. package/build-module/components/resizable-frame/index.js +6 -5
  223. package/build-module/components/resizable-frame/index.js.map +1 -1
  224. package/build-module/components/save-panel/index.js +9 -6
  225. package/build-module/components/save-panel/index.js.map +1 -1
  226. package/build-module/components/sidebar-dataviews/add-new-view.js +7 -8
  227. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  228. package/build-module/components/sidebar-dataviews/dataview-item.js +5 -8
  229. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  230. package/build-module/components/sidebar-dataviews/default-views.js +7 -24
  231. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  232. package/build-module/components/sidebar-dataviews/index.js +4 -3
  233. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  234. package/build-module/components/sidebar-global-styles-wrapper/index.js +18 -18
  235. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-item/index.js +8 -5
  237. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen/index.js +2 -2
  239. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  240. package/build-module/components/sidebar-navigation-screen-global-styles/content.js +12 -38
  241. package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
  242. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +9 -20
  243. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -14
  245. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  247. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  248. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  249. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  250. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  251. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  253. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  255. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -5
  257. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  259. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  261. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  262. package/build-module/components/site-editor-routes/{home-edit.js → home.js} +5 -7
  263. package/build-module/components/site-editor-routes/home.js.map +1 -0
  264. package/build-module/components/site-editor-routes/index.js +12 -18
  265. package/build-module/components/site-editor-routes/index.js.map +1 -1
  266. package/build-module/components/site-editor-routes/navigation-item.js +41 -0
  267. package/build-module/components/site-editor-routes/navigation-item.js.map +1 -0
  268. package/build-module/components/site-editor-routes/navigation.js +38 -0
  269. package/build-module/components/site-editor-routes/navigation.js.map +1 -0
  270. package/build-module/components/site-editor-routes/{pages-edit.js → page-item.js} +9 -16
  271. package/build-module/components/site-editor-routes/page-item.js.map +1 -0
  272. package/build-module/components/site-editor-routes/pages.js +79 -0
  273. package/build-module/components/site-editor-routes/pages.js.map +1 -0
  274. package/build-module/components/site-editor-routes/pattern-item.js +18 -0
  275. package/build-module/components/site-editor-routes/pattern-item.js.map +1 -0
  276. package/build-module/components/site-editor-routes/{patterns-view.js → patterns.js} +5 -8
  277. package/build-module/components/site-editor-routes/patterns.js.map +1 -0
  278. package/build-module/components/site-editor-routes/styles.js +44 -0
  279. package/build-module/components/site-editor-routes/styles.js.map +1 -0
  280. package/build-module/components/site-editor-routes/{templates-edit.js → template-item.js} +5 -10
  281. package/build-module/components/site-editor-routes/template-item.js.map +1 -0
  282. package/build-module/components/site-editor-routes/template-part-item.js +18 -0
  283. package/build-module/components/site-editor-routes/template-part-item.js.map +1 -0
  284. package/build-module/components/site-editor-routes/templates.js +33 -0
  285. package/build-module/components/site-editor-routes/templates.js.map +1 -0
  286. package/build-module/components/site-hub/index.js +3 -3
  287. package/build-module/components/site-hub/index.js.map +1 -1
  288. package/build-module/components/style-book/constants.js +8 -19
  289. package/build-module/components/style-book/constants.js.map +1 -1
  290. package/build-module/components/style-book/examples.js +42 -27
  291. package/build-module/components/style-book/examples.js.map +1 -1
  292. package/build-module/components/style-book/index.js +21 -5
  293. package/build-module/components/style-book/index.js.map +1 -1
  294. package/build-module/components/style-book/types.js.map +1 -1
  295. package/build-module/hooks/commands/use-common-commands.js +12 -48
  296. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  297. package/build-module/hooks/commands/use-set-command-context.js +2 -2
  298. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  299. package/build-module/store/private-actions.js +6 -0
  300. package/build-module/store/private-actions.js.map +1 -1
  301. package/build-module/store/reducer.js +2 -0
  302. package/build-module/store/reducer.js.map +1 -1
  303. package/build-module/utils/is-previewing-theme.js +1 -1
  304. package/build-module/utils/is-previewing-theme.js.map +1 -1
  305. package/build-module/utils/use-activate-theme.js +9 -8
  306. package/build-module/utils/use-activate-theme.js.map +1 -1
  307. package/build-style/posts-rtl.css +73 -107
  308. package/build-style/posts.css +73 -107
  309. package/build-style/style-rtl.css +201 -142
  310. package/build-style/style.css +201 -142
  311. package/package.json +40 -40
  312. package/src/components/add-new-pattern/index.js +9 -17
  313. package/src/components/add-new-post/index.js +1 -1
  314. package/src/components/add-new-template/index.js +3 -5
  315. package/src/components/app/index.js +34 -35
  316. package/src/components/block-editor/use-editor-iframe-props.js +5 -4
  317. package/src/components/block-editor/use-navigate-to-entity-record.js +3 -1
  318. package/src/components/block-editor/use-site-editor-settings.js +6 -6
  319. package/src/components/dataviews-actions/index.js +1 -5
  320. package/src/components/editor/index.js +64 -29
  321. package/src/components/editor/use-editor-title.js +4 -0
  322. package/src/components/editor/use-resolve-edited-entity.js +17 -2
  323. package/src/components/global-styles/font-library-modal/font-collection.js +40 -27
  324. package/src/components/global-styles/font-library-modal/style.scss +12 -5
  325. package/src/components/global-styles/preview-colors.js +3 -3
  326. package/src/components/global-styles/preview-styles.js +3 -3
  327. package/src/components/global-styles/preview-typography.js +3 -3
  328. package/src/components/global-styles/{preview-iframe.js → preview-wrapper.js} +9 -35
  329. package/src/components/global-styles/style.scss +5 -1
  330. package/src/components/global-styles/typography-example.js +12 -1
  331. package/src/components/global-styles-sidebar/index.js +4 -4
  332. package/src/components/layout/index.js +43 -11
  333. package/src/components/page-patterns/delete-category-menu-item.js +3 -4
  334. package/src/components/page-patterns/fields.js +9 -65
  335. package/src/components/page-patterns/index.js +39 -25
  336. package/src/components/page-patterns/style.scss +0 -28
  337. package/src/components/page-templates/fields.js +3 -31
  338. package/src/components/page-templates/index.js +34 -51
  339. package/src/components/post-edit/header.js +88 -0
  340. package/src/components/post-edit/index.js +39 -7
  341. package/src/components/post-edit/style.scss +10 -0
  342. package/src/components/post-list/index.js +44 -40
  343. package/src/components/post-list/style.scss +0 -36
  344. package/src/components/posts-app/index.js +9 -18
  345. package/src/components/posts-app-routes/index.js +3 -14
  346. package/src/components/posts-app-routes/{posts-edit.js → post-item.js} +5 -9
  347. package/src/components/posts-app-routes/posts.js +66 -0
  348. package/src/components/resizable-frame/index.js +6 -7
  349. package/src/components/save-panel/index.js +11 -5
  350. package/src/components/sidebar-dataviews/add-new-view.js +9 -9
  351. package/src/components/sidebar-dataviews/dataview-item.js +5 -8
  352. package/src/components/sidebar-dataviews/default-views.js +7 -24
  353. package/src/components/sidebar-dataviews/index.js +2 -2
  354. package/src/components/sidebar-dataviews/style.scss +2 -2
  355. package/src/components/sidebar-global-styles-wrapper/index.js +24 -30
  356. package/src/components/sidebar-navigation-item/index.js +7 -5
  357. package/src/components/sidebar-navigation-item/style.scss +1 -2
  358. package/src/components/sidebar-navigation-screen/index.js +2 -2
  359. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  360. package/src/components/sidebar-navigation-screen-global-styles/content.js +7 -35
  361. package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -34
  362. package/src/components/sidebar-navigation-screen-main/index.js +6 -10
  363. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +3 -5
  364. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  365. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +6 -6
  366. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +9 -21
  367. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -20
  368. package/src/components/sidebar-navigation-screen-patterns/index.js +3 -4
  369. package/src/components/sidebar-navigation-screen-templates-browse/content.js +24 -18
  370. package/src/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  371. package/src/components/site-editor-routes/{home-view.js → home.js} +4 -5
  372. package/src/components/site-editor-routes/index.js +22 -34
  373. package/src/components/site-editor-routes/navigation-item.js +39 -0
  374. package/src/components/site-editor-routes/navigation.js +34 -0
  375. package/src/components/site-editor-routes/{pages-edit.js → page-item.js} +6 -14
  376. package/src/components/site-editor-routes/pages.js +66 -0
  377. package/src/components/site-editor-routes/pattern-item.js +15 -0
  378. package/src/components/site-editor-routes/patterns.js +15 -0
  379. package/src/components/site-editor-routes/styles.js +39 -0
  380. package/src/components/site-editor-routes/template-item.js +15 -0
  381. package/src/components/site-editor-routes/template-part-item.js +15 -0
  382. package/src/components/site-editor-routes/templates.js +26 -0
  383. package/src/components/site-hub/index.js +3 -6
  384. package/src/components/style-book/constants.ts +8 -19
  385. package/src/components/style-book/examples.tsx +47 -28
  386. package/src/components/style-book/index.js +28 -5
  387. package/src/components/style-book/types.ts +1 -1
  388. package/src/hooks/commands/use-common-commands.js +14 -72
  389. package/src/hooks/commands/use-set-command-context.js +2 -2
  390. package/src/store/private-actions.js +7 -0
  391. package/src/store/reducer.js +2 -0
  392. package/src/style.scss +1 -0
  393. package/src/utils/is-previewing-theme.js +1 -3
  394. package/src/utils/use-activate-theme.js +4 -3
  395. package/build/components/error-boundary/index.js +0 -47
  396. package/build/components/error-boundary/index.js.map +0 -1
  397. package/build/components/error-boundary/warning.js +0 -42
  398. package/build/components/error-boundary/warning.js.map +0 -1
  399. package/build/components/global-styles/preview-iframe.js.map +0 -1
  400. package/build/components/layout/router.js +0 -92
  401. package/build/components/layout/router.js.map +0 -1
  402. package/build/components/posts-app-routes/home.js.map +0 -1
  403. package/build/components/posts-app-routes/posts-edit.js.map +0 -1
  404. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +0 -63
  405. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  406. package/build/components/posts-app-routes/posts-list-view.js +0 -48
  407. package/build/components/posts-app-routes/posts-list-view.js.map +0 -1
  408. package/build/components/posts-app-routes/posts-view-quick-edit.js +0 -60
  409. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  410. package/build/components/posts-app-routes/posts-view.js +0 -41
  411. package/build/components/posts-app-routes/posts-view.js.map +0 -1
  412. package/build/components/routes/link.js +0 -69
  413. package/build/components/routes/link.js.map +0 -1
  414. package/build/components/site-editor-routes/home-edit.js.map +0 -1
  415. package/build/components/site-editor-routes/home-view.js.map +0 -1
  416. package/build/components/site-editor-routes/navigation-edit.js +0 -29
  417. package/build/components/site-editor-routes/navigation-edit.js.map +0 -1
  418. package/build/components/site-editor-routes/navigation-item-edit.js +0 -31
  419. package/build/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  420. package/build/components/site-editor-routes/navigation-item-view.js +0 -30
  421. package/build/components/site-editor-routes/navigation-item-view.js.map +0 -1
  422. package/build/components/site-editor-routes/navigation-view.js +0 -28
  423. package/build/components/site-editor-routes/navigation-view.js.map +0 -1
  424. package/build/components/site-editor-routes/pages-edit.js.map +0 -1
  425. package/build/components/site-editor-routes/pages-list-view-quick-edit.js +0 -64
  426. package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  427. package/build/components/site-editor-routes/pages-list-view.js +0 -47
  428. package/build/components/site-editor-routes/pages-list-view.js.map +0 -1
  429. package/build/components/site-editor-routes/pages-view-quick-edit.js +0 -61
  430. package/build/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  431. package/build/components/site-editor-routes/pages-view.js +0 -42
  432. package/build/components/site-editor-routes/pages-view.js.map +0 -1
  433. package/build/components/site-editor-routes/patterns-edit.js.map +0 -1
  434. package/build/components/site-editor-routes/patterns-view.js.map +0 -1
  435. package/build/components/site-editor-routes/styles-view.js.map +0 -1
  436. package/build/components/site-editor-routes/templates-edit.js.map +0 -1
  437. package/build/components/site-editor-routes/templates-list-view.js.map +0 -1
  438. package/build/components/site-editor-routes/templates-view.js +0 -29
  439. package/build/components/site-editor-routes/templates-view.js.map +0 -1
  440. package/build-module/components/error-boundary/index.js +0 -38
  441. package/build-module/components/error-boundary/index.js.map +0 -1
  442. package/build-module/components/error-boundary/warning.js +0 -35
  443. package/build-module/components/error-boundary/warning.js.map +0 -1
  444. package/build-module/components/global-styles/preview-iframe.js.map +0 -1
  445. package/build-module/components/layout/router.js +0 -84
  446. package/build-module/components/layout/router.js.map +0 -1
  447. package/build-module/components/posts-app-routes/home.js +0 -40
  448. package/build-module/components/posts-app-routes/home.js.map +0 -1
  449. package/build-module/components/posts-app-routes/posts-edit.js.map +0 -1
  450. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +0 -55
  451. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  452. package/build-module/components/posts-app-routes/posts-list-view.js +0 -40
  453. package/build-module/components/posts-app-routes/posts-list-view.js.map +0 -1
  454. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +0 -52
  455. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  456. package/build-module/components/posts-app-routes/posts-view.js +0 -33
  457. package/build-module/components/posts-app-routes/posts-view.js.map +0 -1
  458. package/build-module/components/routes/link.js +0 -61
  459. package/build-module/components/routes/link.js.map +0 -1
  460. package/build-module/components/site-editor-routes/home-edit.js.map +0 -1
  461. package/build-module/components/site-editor-routes/home-view.js +0 -17
  462. package/build-module/components/site-editor-routes/home-view.js.map +0 -1
  463. package/build-module/components/site-editor-routes/navigation-edit.js +0 -21
  464. package/build-module/components/site-editor-routes/navigation-edit.js.map +0 -1
  465. package/build-module/components/site-editor-routes/navigation-item-edit.js +0 -23
  466. package/build-module/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  467. package/build-module/components/site-editor-routes/navigation-item-view.js +0 -22
  468. package/build-module/components/site-editor-routes/navigation-item-view.js.map +0 -1
  469. package/build-module/components/site-editor-routes/navigation-view.js +0 -20
  470. package/build-module/components/site-editor-routes/navigation-view.js.map +0 -1
  471. package/build-module/components/site-editor-routes/pages-edit.js.map +0 -1
  472. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  473. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  474. package/build-module/components/site-editor-routes/pages-list-view.js +0 -39
  475. package/build-module/components/site-editor-routes/pages-list-view.js.map +0 -1
  476. package/build-module/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  477. package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  478. package/build-module/components/site-editor-routes/pages-view.js +0 -34
  479. package/build-module/components/site-editor-routes/pages-view.js.map +0 -1
  480. package/build-module/components/site-editor-routes/patterns-edit.js +0 -23
  481. package/build-module/components/site-editor-routes/patterns-edit.js.map +0 -1
  482. package/build-module/components/site-editor-routes/patterns-view.js.map +0 -1
  483. package/build-module/components/site-editor-routes/styles-view.js +0 -25
  484. package/build-module/components/site-editor-routes/styles-view.js.map +0 -1
  485. package/build-module/components/site-editor-routes/templates-edit.js.map +0 -1
  486. package/build-module/components/site-editor-routes/templates-list-view.js +0 -26
  487. package/build-module/components/site-editor-routes/templates-list-view.js.map +0 -1
  488. package/build-module/components/site-editor-routes/templates-view.js +0 -21
  489. package/build-module/components/site-editor-routes/templates-view.js.map +0 -1
  490. package/src/components/error-boundary/index.js +0 -44
  491. package/src/components/error-boundary/test/error-boundary.js +0 -40
  492. package/src/components/error-boundary/warning.js +0 -30
  493. package/src/components/layout/router.js +0 -86
  494. package/src/components/posts-app-routes/home.js +0 -36
  495. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +0 -52
  496. package/src/components/posts-app-routes/posts-list-view.js +0 -40
  497. package/src/components/posts-app-routes/posts-view-quick-edit.js +0 -49
  498. package/src/components/posts-app-routes/posts-view.js +0 -35
  499. package/src/components/routes/link.js +0 -68
  500. package/src/components/site-editor-routes/home-edit.js +0 -17
  501. package/src/components/site-editor-routes/navigation-edit.js +0 -22
  502. package/src/components/site-editor-routes/navigation-item-edit.js +0 -26
  503. package/src/components/site-editor-routes/navigation-item-view.js +0 -25
  504. package/src/components/site-editor-routes/navigation-view.js +0 -21
  505. package/src/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  506. package/src/components/site-editor-routes/pages-list-view.js +0 -44
  507. package/src/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  508. package/src/components/site-editor-routes/pages-view.js +0 -39
  509. package/src/components/site-editor-routes/patterns-edit.js +0 -24
  510. package/src/components/site-editor-routes/patterns-view.js +0 -22
  511. package/src/components/site-editor-routes/styles-view.js +0 -26
  512. package/src/components/site-editor-routes/templates-edit.js +0 -22
  513. package/src/components/site-editor-routes/templates-list-view.js +0 -28
  514. package/src/components/site-editor-routes/templates-view.js +0 -22
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_TYPES","jsx","_jsx","jsxs","_jsxs","MainSidebarNavigationContent","children","uid","params","postType","withChevron","icon","user","SidebarNavigationScreenMain","setEditorCanvasContainerView","undefined","isRoot","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nexport function MainSidebarNavigationContent() {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"navigation-navigation-item\"\n\t\t\t\tparams={ { postType: NAVIGATION_POST_TYPE } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ navigation }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\tuid=\"styles-navigation-item\"\n\t\t\t\ticon={ styles }\n\t\t\t>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"page-navigation-item\"\n\t\t\t\tparams={ { postType: 'page' } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ page }\n\t\t\t>\n\t\t\t\t{ __( 'Pages' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"template-navigation-item\"\n\t\t\t\tparams={ { postType: TEMPLATE_POST_TYPE } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ layout }\n\t\t\t>\n\t\t\t\t{ __( 'Templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"patterns-navigation-item\"\n\t\t\t\tparams={ { postType: PATTERN_TYPES.user } }\n\t\t\t\twithChevron\n\t\t\t\ticon={ symbol }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tsetEditorCanvasContainerView( undefined );\n\t}, [ setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={ <MainSidebarNavigationContent /> }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AAC3E,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,iCAAiC,QAAQ,4CAA4C;AAC9F,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SACCC,oBAAoB,EACpBC,kBAAkB,EAClBC,aAAa,QACP,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/B,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC9C,oBACCD,KAAA,CAACrB,SAAS;IAAAuB,QAAA,gBACTJ,IAAA,CAACT,qBAAqB;MACrBc,GAAG,EAAC,4BAA4B;MAChCC,MAAM,EAAG;QAAEC,QAAQ,EAAEX;MAAqB,CAAG;MAC7CY,WAAW;MACXC,IAAI,EAAGxB,UAAY;MAAAmB,QAAA,EAEjBtB,EAAE,CAAE,YAAa;IAAC,CACE,CAAC,eACxBkB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;EAAG,CAC5C,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","jsx","_jsx","jsxs","_jsxs","MainSidebarNavigationContent","children","uid","to","withChevron","icon","SidebarNavigationScreenMain","setEditorCanvasContainerView","undefined","isRoot","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport function MainSidebarNavigationContent() {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"navigation-navigation-item\"\n\t\t\t\tto=\"/navigation\"\n\t\t\t\twithChevron\n\t\t\t\ticon={ navigation }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\tto=\"/styles\"\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t\ticon={ styles }\n\t\t\t>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"page-navigation-item\"\n\t\t\t\tto=\"/page\"\n\t\t\t\twithChevron\n\t\t\t\ticon={ page }\n\t\t\t>\n\t\t\t\t{ __( 'Pages' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"template-navigation-item\"\n\t\t\t\tto=\"/template\"\n\t\t\t\twithChevron\n\t\t\t\ticon={ layout }\n\t\t\t>\n\t\t\t\t{ __( 'Templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tuid=\"patterns-navigation-item\"\n\t\t\t\tto=\"/pattern\"\n\t\t\t\twithChevron\n\t\t\t\ticon={ symbol }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tsetEditorCanvasContainerView( undefined );\n\t}, [ setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={ <MainSidebarNavigationContent /> }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AAC3E,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,iCAAiC,QAAQ,4CAA4C;AAC9F,SAASC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Ac,CAC5B,CAAC;;EAED;EACAN,SAAS,CAAE,MAAM;IAChBkB,4BAA4B,CAAEC,SAAU,CAAC;EAC1C,CAAC,EAAE,CAAED,4BAA4B,CAAG,CAAC;EAErC,oBACCV,IAAA,CAACP,uBAAuB;IACvBmB,MAAM;IACNC,KAAK,EAAG5B,EAAE,CAAE,QAAS,CAAG;IACxB6B,WAAW,EAAG7B,EAAE,CACf,kEACD,CAAG;IACH8B,OAAO,eAAGf,IAAA,CAACG,4BAA4B,IAAE;EAAG,CAC5C,CAAC;AAEJ","ignoreList":[]}
@@ -56,11 +56,7 @@ export default function ScreenNavigationMoreMenu(props) {
56
56
  children: __('Rename')
57
57
  }), /*#__PURE__*/_jsx(MenuItem, {
58
58
  onClick: () => {
59
- history.push({
60
- postId: menuId,
61
- postType: 'wp_navigation',
62
- canvas: 'edit'
63
- });
59
+ history.navigate(`/wp_navigation/${menuId}?canvas=edit`);
64
60
  },
65
61
  children: __('Edit')
66
62
  }), /*#__PURE__*/_jsx(MenuItem, {
@@ -1 +1 @@
1
- {"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","privateApis","routerPrivateApis","RenameModal","DeleteConfirmDialog","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","menuId","renameModalOpen","setRenameModalOpen","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","history","closeModals","openRenameModal","openDeleteConfirmDialog","children","className","label","icon","popoverProps","onClose","onClick","push","postId","postType","canvas","isDestructive","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst history = useHistory();\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\tpostId: menuId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_navigation',\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AACzE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,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,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","privateApis","routerPrivateApis","RenameModal","DeleteConfirmDialog","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","menuId","renameModalOpen","setRenameModalOpen","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","history","closeModals","openRenameModal","openDeleteConfirmDialog","children","className","label","icon","popoverProps","onClose","onClick","navigate","isDestructive","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst history = useHistory();\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t`/wp_navigation/${ menuId }?canvas=edit`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AACzE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE3C,MAAM;EAAEC;AAAW,CAAC,GAAGP,MAAM,CAAEH,iBAAkB,CAAC;AAElD,MAAMW,aAAa,GAAG;EACrBC,QAAQ,EAAE;AACX,CAAC;AAED,eAAe,SAASC,wBAAwBA,CAAEC,KAAK,EAAG;EACzD,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC;EAAO,CAAC,GAAGL,KAAK;EAElE,MAAM,CAAEM,eAAe,EAAEC,kBAAkB,CAAE,GAAGvB,QAAQ,CAAE,KAAM,CAAC;EACjE,MAAM,CAAEwB,uBAAuB,EA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A,CAACX,QAAQ;YACR0C,aAAa;YACbF,OAAO,EAAGA,CAAA,KAAM;cACfP,uBAAuB,CAAC,CAAC;;cAEzB;cACAM,OAAO,CAAC,CAAC;YACV,CAAG;YAAAL,QAAA,EAED/B,EAAE,CAAE,QAAS;UAAC,CACP,CAAC;QAAA,CACD;MAAC,CACR;IACL,CACY,CAAC,EACbyB,uBAAuB,iBACxBjB,IAAA,CAACH,mBAAmB;MACnB+B,OAAO,EAAGR,WAAa;MACvBY,SAAS,EAAGtB;IAAU,CACtB,CACD,EACCK,eAAe,iBAChBf,IAAA,CAACJ,WAAW;MACXgC,OAAO,EAAGR,WAAa;MACvBP,SAAS,EAAGA,SAAW;MACvBF,MAAM,EAAGA;IAAQ,CACjB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -36,9 +36,7 @@ function useDeleteNavigationMenu() {
36
36
  createSuccessNotice(__('Navigation Menu successfully deleted.'), {
37
37
  type: 'snackbar'
38
38
  });
39
- history.push({
40
- postType: 'wp_navigation'
41
- });
39
+ history.navivate('/navigation');
42
40
  } catch (error) {
43
41
  createErrorNotice(sprintf(/* translators: %s: error message describing why the navigation menu could not be deleted. */
44
42
  __(`Unable to delete Navigation Menu (%s).`), error?.message), {
@@ -122,10 +120,7 @@ function useDuplicateNavigationMenu() {
122
120
  createSuccessNotice(__('Duplicated Navigation Menu'), {
123
121
  type: 'snackbar'
124
122
  });
125
- history.push({
126
- postType,
127
- postId: savedRecord.id
128
- });
123
+ history.navigate(`/wp_navigation/${savedRecord.id}`);
129
124
  }
130
125
  } catch (error) {
131
126
  createErrorNotice(sprintf(/* translators: %s: error message describing why the navigation menu could not be deleted. */
@@ -1 +1 @@
1
- {"version":3,"names":["store","coreStore","__","_x","sprintf","useSelect","useDispatch","noticesStore","privateApis","routerPrivateApis","postType","NAVIGATION_POST_TYPE","unlock","useHistory","useDeleteNavigationMenu","deleteEntityRecord","createSuccessNotice","createErrorNotice","history","handleDelete","navigationMenu","postId","id","force","throwOnError","type","push","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction useDeleteNavigationMenu() {\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst history = useHistory();\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__( 'Navigation Menu successfully deleted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\thistory.push( { postType: 'wp_navigation' } );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation Menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t_x( '%s (Copy)', 'navigation menu' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation Menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\thistory.push( { postType, postId: savedRecord.id } );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,GAAG;AAC5B,SAASC,oBAAoB,QAAQ,uBAAuB;AAC5D,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAW,CAAC,GAAGD,MAAM,CAAEH,iBAAkB,CAAC;AAElD,SAASK,uBAAuBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAmB,CAAC,GAAGT,WAAW,CAAEL,SAAU,CAAC;EACvD,MAAM;IAAEe,mBAAmB;IAAEC;EAAkB,CAAC,GAC/CX,WAAW,CAAEC,YAAa,CAAC;EAC5B,MAAMW,OAAO,GAAGL,UAAU,CAAC,CAAC;EAE5B,MAAMM,YAAY,GAAG,MAAQC,cAAc,IAAM;IAChD,MAAMC,MAAM,GAAGD,cAAc,EAAEE,EAAE;IACjC,IAAI;MACH,MAAMP,kBAAkB,CACvB,UAAU,EACVL,QAAQ,EACRW,MAAM,EACN;QACCE,KAAK,EAAE;MACR,CAAC,EACD;QACCC,YAAY,EAAE;MACf,CACD,CAAC;MACDR,mBAAmB,CAClBd,EAAE,CAAE,uCAAwC,CAAC,EAC7C;QACCuB,IAAI,EAAE;MACP,CACD,CA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AI,CAAE;UAAEhB,QAAQ;UAAEW,MAAM,EAAE4B,WAAW,CAAC3B;QAAG,CAAE,CAAC;MACrD;IACD,CAAC,CAAC,OAAQK,KAAK,EAAG;MACjBV,iBAAiB,CAChBb,OAAO,CACN;MACAF,EAAE,CAAE,2CAA4C,CAAC,EACjDyB,KAAK,EAAEC,OACR,CAAC,EAED;QACCH,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAC;EAED,OAAOmB,eAAe;AACvB;AAEA,eAAe,SAASS,yBAAyBA,CAAA,EAAG;EACnD,OAAO;IACNlC,YAAY,EAAEL,uBAAuB,CAAC,CAAC;IACvCsB,UAAU,EAAEP,qBAAqB,CAAC,CAAC;IACnCe,eAAe,EAAEF,0BAA0B,CAAC;EAC7C,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["store","coreStore","__","_x","sprintf","useSelect","useDispatch","noticesStore","privateApis","routerPrivateApis","postType","NAVIGATION_POST_TYPE","unlock","useHistory","useDeleteNavigationMenu","deleteEntityRecord","createSuccessNotice","createErrorNotice","history","handleDelete","navigationMenu","postId","id","force","throwOnError","type","navivate","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","navigate","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction useDeleteNavigationMenu() {\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst history = useHistory();\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__( 'Navigation Menu successfully deleted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\thistory.navivate( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation Menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t_x( '%s (Copy)', 'navigation menu' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation Menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\thistory.navigate( `/wp_navigation/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation Menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,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D,MAAM;IAAEe,mBAAmB;IAAEC;EAAkB,CAAC,GAC/CX,WAAW,CAAEC,YAAa,CAAC;EAE5B,MAAMqC,eAAe,GAAG,MAAQxB,cAAc,IAAM;IACnD,MAAMyB,SAAS,GACdzB,cAAc,EAAE0B,KAAK,EAAEC,QAAQ,IAAI3B,cAAc,EAAE4B,IAAI;IAExD,IAAI;MACH,MAAMC,WAAW,GAAG,MAAMN,gBAAgB,CACzC,UAAU,EACVjC,QAAQ,EACR;QACCoC,KAAK,EAAE1C,OAAO,CACb;QACAD,EAAE,CAAE,WAAW,EAAE,iBAAkB,CAAC,EACpC0C,SACD,CAAC;QACDK,OAAO,EAAE9B,cAAc,EAAE8B,OAAO,EAAEC,GAAG;QACrCC,MAAM,EAAE;MACT,CAAC,EACD;QACC5B,YAAY,EAAE;MACf,CACD,CAAC;MAED,IAAKyB,WAAW,EAAG;QAClBjC,mBAAmB,CAAEd,EAAE,CAAE,4BAA6B,CAAC,EAAE;UACxDuB,IAAI,EAAE;QACP,CAAE,CAAC;QACHP,OAAO,CAACmC,QAAQ,CAAE,kBAAmBJ,WAAW,CAAC3B,EAAE,EAAI,CAAC;MACzD;IACD,CAAC,CAAC,OAAQK,KAAK,EAAG;MACjBV,iBAAiB,CAChBb,OAAO,CACN;MACAF,EAAE,CAAE,2CAA4C,CAAC,EACjDyB,KAAK,EAAEC,OACR,CAAC,EAED;QACCH,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAC;EAED,OAAOmB,eAAe;AACvB;AAEA,eAAe,SAASU,yBAAyBA,CAAA,EAAG;EACnD,OAAO;IACNnC,YAAY,EAAEL,uBAAuB,CAAC,CAAC;IACvCsB,UAAU,EAAEP,qBAAqB,CAAC,CAAC;IACnCe,eAAe,EAAEF,0BAA0B,CAAC;EAC7C,CAAC;AACF","ignoreList":[]}
@@ -14,7 +14,6 @@ import { navigation } from '@wordpress/icons';
14
14
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
15
15
  import SidebarNavigationItem from '../sidebar-navigation-item';
16
16
  import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
17
- import { useLink } from '../routes/link';
18
17
  import SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';
19
18
  import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';
20
19
  import { unlock } from '../../lock-unlock';
@@ -122,12 +121,8 @@ const NavMenuItem = ({
122
121
  postId,
123
122
  ...props
124
123
  }) => {
125
- const linkInfo = useLink({
126
- postId,
127
- postType: 'wp_navigation'
128
- });
129
124
  return /*#__PURE__*/_jsx(SidebarNavigationItem, {
130
- ...linkInfo,
125
+ to: `/wp_navigation/${postId}`,
131
126
  ...props
132
127
  });
133
128
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__","_x","sprintf","useEntityRecords","store","coreStore","useSelect","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SingleNavigationMenu","useNavigationMenuHandlers","unlock","NAVIGATION_POST_TYPE","jsx","_jsx","buildMenuLabel","title","id","status","SidebarNavigationScreenNavigationMenus","backPath","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","isLoading","getNavigationFallbackId","isCreatingNavigationFallback","select","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","SidebarNavigationScreenWrapper","children","className","description","navigationMenu","edits","map","index","NavMenuItem","postId","withChevron","icon","rendered","actions","content","props","linkInfo","postType"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s: the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).\n\t\t_x( '%1$s (%2$s)', 'menu label' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus( { backPath } ) {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\tNAVIGATION_POST_TYPE,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\tconst isCreatingNavigationFallback = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).isResolving( 'getNavigationFallbackId' ),\n\t\t[]\n\t);\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t// Ensure a fallback navigation is created only once\n\t\t! isCreatingNavigationFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\tbackPath={ backPath }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title?.rendered, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n\tbackPath,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation Menus.' ) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,OAAO,QACD,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,gCAAgC,QAAQ,aAAa;AAC9D,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,oBAAoB,MAAM,qEAAqE;AACtG,OAAOC,yBAAyB,MAAM,2EAA2E;AACjH,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,uBAAuB;;AAE5D;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,SAASC,cAAcA,CAAEC,KAAK,EAAEC,EAAE,EAAEC,MAAM,EAAG;EA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AK;EACLwB,WAAW;EACXpB;AACD,CAAC,EAAG;EACH,oBACCN,IAAA,CAACT,uBAAuB;IACvBW,KAAK,EAAGA,KAAK,IAAIvB,EAAE,CAAE,YAAa,CAAG;IACrCyD,OAAO,EAAGA,OAAS;IACnBV,WAAW,EAAGA,WAAW,IAAI/C,EAAE,CAAE,+BAAgC,CAAG;IACpE2B,QAAQ,EAAGA,QAAU;IACrB+B,OAAO,EAAGb;EAAU,CACpB,CAAC;AAEJ;AAEA,MAAMO,WAAW,GAAGA,CAAE;EAAEC,MAAM;EAAE,GAAGM;AAAM,CAAC,KAAM;EAC/C,MAAMC,QAAQ,GAAG7C,OAAO,CAAE;IACzBsC,MAAM;IACNQ,QAAQ,EAAE;EACX,CAAE,CAAC;EACH,oBAAOxC,IAAA,CAACR,qBAAqB;IAAA,GAAM+C,QAAQ;IAAA,GAAQD;EAAK,CAAI,CAAC;AAC9D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","_x","sprintf","useEntityRecords","store","coreStore","useSelect","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","SingleNavigationMenu","useNavigationMenuHandlers","unlock","NAVIGATION_POST_TYPE","jsx","_jsx","buildMenuLabel","title","id","status","SidebarNavigationScreenNavigationMenus","backPath","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","isLoading","getNavigationFallbackId","isCreatingNavigationFallback","select","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","SidebarNavigationScreenWrapper","children","className","description","navigationMenu","edits","map","index","NavMenuItem","postId","withChevron","icon","rendered","actions","content","props","to"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s: the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).\n\t\t_x( '%1$s (%2$s)', 'menu label' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus( { backPath } ) {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\tNAVIGATION_POST_TYPE,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\tconst isCreatingNavigationFallback = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).isResolving( 'getNavigationFallbackId' ),\n\t\t[]\n\t);\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t// Ensure a fallback navigation is created only once\n\t\t! isCreatingNavigationFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\tbackPath={ backPath }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title?.rendered, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n\tbackPath,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation Menus.' ) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\tto={ `/wp_navigation/${ postId }` }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,OAAO,QACD,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,gCAAgC,QAAQ,aAAa;AAC9D,OAAOC,oBAAoB,MAAM,qEAAqE;AACtG,OAAOC,yBAAyB,MAAM,2EAA2E;AACjH,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,uBAAuB;;AAE5D;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,SAASC,cAAcA,CAAEC,KAAK,EAAEC,EAA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RY,OAAO;EACPlC,KAAK;EACLwB,WAAW;EACXpB;AACD,CAAC,EAAG;EACH,oBACCN,IAAA,CAACR,uBAAuB;IACvBU,KAAK,EAAGA,KAAK,IAAItB,EAAE,CAAE,YAAa,CAAG;IACrCwD,OAAO,EAAGA,OAAS;IACnBV,WAAW,EAAGA,WAAW,IAAI9C,EAAE,CAAE,+BAAgC,CAAG;IACpE0B,QAAQ,EAAGA,QAAU;IACrB+B,OAAO,EAAGb;EAAU,CACpB,CAAC;AAEJ;AAEA,MAAMO,WAAW,GAAGA,CAAE;EAAEC,MAAM;EAAE,GAAGM;AAAM,CAAC,KAAM;EAC/C,oBACCtC,IAAA,CAACP,qBAAqB;IACrB8C,EAAE,EAAG,kBAAmBP,MAAM,EAAK;IAAA,GAC9BM;EAAK,CACV,CAAC;AAEJ,CAAC","ignoreList":[]}
@@ -20,10 +20,14 @@ const POPOVER_PROPS = {
20
20
  import { unlock } from '../../lock-unlock';
21
21
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
22
22
  const {
23
- useHistory
23
+ useHistory,
24
+ useLocation
24
25
  } = unlock(routerPrivateApis);
25
26
  export default function LeafMoreMenu(props) {
26
27
  const history = useHistory();
28
+ const {
29
+ path
30
+ } = useLocation();
27
31
  const {
28
32
  block
29
33
  } = props;
@@ -57,30 +61,20 @@ export default function LeafMoreMenu(props) {
57
61
  name
58
62
  } = selectedBlock;
59
63
  if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
60
- const {
61
- params
62
- } = history.getLocationWithParams();
63
- history.push({
64
- postType: attributes.type,
65
- postId: attributes.id,
66
- canvas: 'edit'
67
- }, {
68
- backPath: params
64
+ history.navigate(`/${attributes.type}/${attributes.id}?canvas=edit`, {
65
+ state: {
66
+ backPath: path
67
+ }
69
68
  });
70
69
  }
71
70
  if (name === 'core/page-list-item' && attributes.id && history) {
72
- const {
73
- params
74
- } = history.getLocationWithParams();
75
- history.push({
76
- postType: 'page',
77
- postId: attributes.id,
78
- canvas: 'edit'
79
- }, {
80
- backPath: params
71
+ history.navigate(`/page/${attributes.id}?canvas=edit`, {
72
+ state: {
73
+ backPath: path
74
+ }
81
75
  });
82
76
  }
83
- }, [history]);
77
+ }, [path, history]);
84
78
  return /*#__PURE__*/_jsx(DropdownMenu, {
85
79
  icon: moreVertical,
86
80
  label: __('Options'),
@@ -1 +1 @@
1
- {"version":3,"names":["chevronUp","chevronDown","moreVertical","DropdownMenu","MenuItem","MenuGroup","useDispatch","useSelect","useCallback","__","sprintf","BlockTitle","store","blockEditorStore","privateApis","routerPrivateApis","POPOVER_PROPS","className","placement","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","LeafMoreMenu","props","history","block","clientId","moveBlocksDown","moveBlocksUp","removeBlocks","removeLabel","maximumLength","goToLabel","rootClientId","select","getBlockRootClientId","onGoToPage","selectedBlock","attributes","name","kind","id","type","params","getLocationWithParams","push","postType","postId","canvas","backPath","icon","label","popoverProps","noIcons","children","onClose","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function LeafMoreMenu( props ) {\n\tconst history = useHistory();\n\tconst { block } = props;\n\tconst { clientId } = block;\n\tconst { moveBlocksDown, moveBlocksUp, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst removeLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst goToLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Go to %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onGoToPage = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksUp( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move up' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksDown( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move down' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t{ block.attributes?.type === 'page' &&\n\t\t\t\t\t\t\tblock.attributes?.id && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonGoToPage( block );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ goToLabel }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{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ACV,CAAG;UAAAD,QAAA,EAEDxB;QAAW,CACJ;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["chevronUp","chevronDown","moreVertical","DropdownMenu","MenuItem","MenuGroup","useDispatch","useSelect","useCallback","__","sprintf","BlockTitle","store","blockEditorStore","privateApis","routerPrivateApis","POPOVER_PROPS","className","placement","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","useLocation","LeafMoreMenu","props","history","path","block","clientId","moveBlocksDown","moveBlocksUp","removeBlocks","removeLabel","maximumLength","goToLabel","rootClientId","select","getBlockRootClientId","onGoToPage","selectedBlock","attributes","name","kind","id","type","navigate","state","backPath","icon","label","popoverProps","noIcons","children","onClose","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nexport default function LeafMoreMenu( props ) {\n\tconst history = useHistory();\n\tconst { path } = useLocation();\n\tconst { block } = props;\n\tconst { clientId } = block;\n\tconst { moveBlocksDown, moveBlocksUp, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst removeLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst goToLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Go to %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onGoToPage = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\t`/${ attributes.type }/${ attributes.id }?canvas=edit`,\n\t\t\t\t\t{\n\t\t\t\t\t\tstate: { backPath: path },\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.navigate( `/page/${ attributes.id }?canvas=edit`, {\n\t\t\t\t\tstate: { backPath: path },\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ path, history ]\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksUp( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move up' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksDown( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move down' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t{ block.attributes?.type === 'page' &&\n\t\t\t\t\t\t\tblock.attributes?.id && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonGoToPage( block );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ goToLabel }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ removeLabel }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AACvE,SAASC,YAAY,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AACzE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,EAAE,EAAEC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AAA,EAEDhD,EAAE,CAAE,SAAU;QAAC,CACR,CAAC,eACXY,IAAA,CAACjB,QAAQ;UACRiD,IAAI,EAAGpD,WAAa;UACpB0D,OAAO,EAAGA,CAAA,KAAM;YACfzB,cAAc,CAAE,CAAED,QAAQ,CAAE,EAAEO,YAAa,CAAC;YAC5CkB,OAAO,CAAC,CAAC;UACV,CAAG;UAAAD,QAAA,EAEDhD,EAAE,CAAE,WAAY;QAAC,CACV,CAAC,EACTuB,KAAK,CAACa,UAAU,EAAEI,IAAI,KAAK,MAAM,IAClCjB,KAAK,CAACa,UAAU,EAAEG,EAAE,iBACnB3B,IAAA,CAACjB,QAAQ;UACRuD,OAAO,EAAGA,CAAA,KAAM;YACfhB,UAAU,CAAEX,KAAM,CAAC;YACnB0B,OAAO,CAAC,CAAC;UACV,CAAG;UAAAD,QAAA,EAEDlB;QAAS,CACF,CACV;MAAA,CACQ,CAAC,eACZlB,IAAA,CAAChB,SAAS;QAAAoD,QAAA,eACTpC,IAAA,CAACjB,QAAQ;UACRuD,OAAO,EAAGA,CAAA,KAAM;YACfvB,YAAY,CAAE,CAAEH,QAAQ,CAAE,EAAE,KAAM,CAAC;YACnCyB,OAAO,CAAC,CAAC;UACV,CAAG;UAAAD,QAAA,EAEDpB;QAAW,CACJ;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -2,8 +2,6 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import SidebarNavigationItem from '../sidebar-navigation-item';
5
- import { useLink } from '../routes/link';
6
- import { TEMPLATE_PART_POST_TYPE, TEMPLATE_PART_ALL_AREAS_CATEGORY, PATTERN_DEFAULT_CATEGORY, PATTERN_TYPES } from '../../utils/constants';
7
5
  import { jsx as _jsx } from "react/jsx-runtime";
8
6
  export default function CategoryItem({
9
7
  count,
@@ -13,20 +11,20 @@ export default function CategoryItem({
13
11
  label,
14
12
  type
15
13
  }) {
16
- const linkInfo = useLink({
17
- categoryId: id !== TEMPLATE_PART_ALL_AREAS_CATEGORY && id !== PATTERN_DEFAULT_CATEGORY ? id : undefined,
18
- postType: type === TEMPLATE_PART_POST_TYPE ? TEMPLATE_PART_POST_TYPE : PATTERN_TYPES.user
19
- });
20
14
  if (!count) {
21
15
  return;
22
16
  }
17
+ const queryArgs = [`postType=${type}`];
18
+ if (id) {
19
+ queryArgs.push(`categoryId=${id}`);
20
+ }
23
21
  return /*#__PURE__*/_jsx(SidebarNavigationItem, {
24
- ...linkInfo,
25
22
  icon: icon,
26
23
  suffix: /*#__PURE__*/_jsx("span", {
27
24
  children: count
28
25
  }),
29
26
  "aria-current": isActive ? 'true' : undefined,
27
+ to: `/pattern?${queryArgs.join('&')}`,
30
28
  children: label
31
29
  });
32
30
  }
@@ -1 +1 @@
1
- {"version":3,"names":["SidebarNavigationItem","useLink","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_ALL_AREAS_CATEGORY","PATTERN_DEFAULT_CATEGORY","PATTERN_TYPES","jsx","_jsx","CategoryItem","count","icon","id","isActive","label","type","linkInfo","categoryId","undefined","postType","user","suffix","children"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_ALL_AREAS_CATEGORY,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink( {\n\t\tcategoryId:\n\t\t\tid !== TEMPLATE_PART_ALL_AREAS_CATEGORY &&\n\t\t\tid !== PATTERN_DEFAULT_CATEGORY\n\t\t\t\t? id\n\t\t\t\t: undefined,\n\t\tpostType:\n\t\t\ttype === TEMPLATE_PART_POST_TYPE\n\t\t\t\t? TEMPLATE_PART_POST_TYPE\n\t\t\t\t: PATTERN_TYPES.user,\n\t} );\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACCC,uBAAuB,EACvBC,gCAAgC,EAChCC,wBAAwB,EACxBC,aAAa,QACP,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,eAAe,SAASC,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,QAAQ;EACRC,KAAK;EACLC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAGd,OAAO,CAAE;IACzBe,UAAU,EACTL,EAAE,KAAKR,gCAAgC,IACvCQ,EAAE,KAAKP,wBAAwB,GAC5BO,EAAE,GACFM,SAAS;IACbC,QAAQ,EACPJ,IAAI,KAAKZ,uBAAuB,GAC7BA,uBAAuB,GACvBG,aAAa,CAACc;EACnB,CAAE,CAAC;EAEH,IAAK,CAAEV,KAAK,EAAG;IACd;EACD;EAEA,oBACCF,IAAA,CAACP,qBAAqB;IAAA,GAChBe,QAAQ;IACbL,IAAI,EAAGA,IAAM;IACbU,MAAM,eAAGb,IAAA;MAAAc,QAAA,EAAQZ;IAAK,CAAQ,CAAG;IACjC,gBAAeG,QAAQ,GAAG,MAAM,GAAGK,SAAW;IAAAI,QAAA,EAE5CR;EAAK,CACe,CAAC;AAE1B","ignoreList":[]}
1
+ {"version":3,"names":["SidebarNavigationItem","jsx","_jsx","CategoryItem","count","icon","id","isActive","label","type","queryArgs","push","suffix","children","undefined","to","join"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\tconst queryArgs = [ `postType=${ type }` ];\n\tif ( id ) {\n\t\tqueryArgs.push( `categoryId=${ id }` );\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\tto={ `/pattern?${ queryArgs.join( '&' ) }` }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/D,eAAe,SAASC,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,QAAQ;EACRC,KAAK;EACLC;AACD,CAAC,EAAG;EACH,IAAK,CAAEL,KAAK,EAAG;IACd;EACD;EACA,MAAMM,SAAS,GAAG,CAAE,YAAaD,IAAI,EAAG,CAAE;EAC1C,IAAKH,EAAE,EAAG;IACTI,SAAS,CAACC,IAAI,CAAE,cAAeL,EAAE,EAAI,CAAC;EACvC;EAEA,oBACCJ,IAAA,CAACF,qBAAqB;IACrBK,IAAI,EAAGA,IAAM;IACbO,MAAM,eAAGV,IAAA;MAAAW,QAAA,EAAQT;IAAK,CAAQ,CAAG;IACjC,gBAAeG,QAAQ,GAAG,MAAM,GAAGO,SAAW;IAC9CC,EAAE,EAAG,YAAaL,SAAS,CAACM,IAAI,CAAE,GAAI,CAAC,EAAK;IAAAH,QAAA,EAE1CL;EAAK,CACe,CAAC;AAE1B","ignoreList":[]}
@@ -73,13 +73,12 @@ export default function SidebarNavigationScreenPatterns({
73
73
  backPath
74
74
  }) {
75
75
  const {
76
- params: {
77
- postType,
76
+ query: {
77
+ postType = 'wp_block',
78
78
  categoryId
79
79
  }
80
80
  } = useLocation();
81
- const currentType = postType || PATTERN_TYPES.user;
82
- const currentCategory = categoryId || (currentType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
81
+ const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
83
82
  const {
84
83
  templatePartAreas,
85
84
  hasTemplateParts,
@@ -106,7 +105,7 @@ export default function SidebarNavigationScreenPatterns({
106
105
  templatePartAreas: templatePartAreas,
107
106
  patternCategories: patternCategories,
108
107
  currentCategory: currentCategory,
109
- currentType: currentType
108
+ currentType: postType
110
109
  })]
111
110
  })]
112
111
  })
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","getTemplatePartIcon","__","store","coreStore","useSelect","file","privateApis","routerPrivateApis","SidebarNavigationScreen","CategoryItem","PATTERN_DEFAULT_CATEGORY","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_ALL_AREAS_CATEGORY","usePatternCategories","useTemplatePartAreas","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","CategoriesGroup","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","className","children","count","Object","values","map","templateParts","length","reduce","acc","val","icon","label","id","type","isActive","entries","area","name","user","category","SidebarNavigationScreenPatterns","backPath","params","postType","categoryId","hasTemplateParts","isLoading","hasPatterns","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","isRoot","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_ALL_AREAS_CATEGORY,\n} from '../../utils/constants';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction CategoriesGroup( {\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ TEMPLATE_PART_ALL_AREAS_CATEGORY }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) }\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype={ PATTERN_TYPES.user }\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype={ PATTERN_TYPES.user }\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns( { backPath } ) {\n\tconst {\n\t\tparams: { postType, categoryId },\n\t} = useLocation();\n\tconst currentType = postType || PATTERN_TYPES.user;\n\tconst currentCategory =\n\t\tcategoryId ||\n\t\t( currentType === PATTERN_TYPES.user\n\t\t\t? PATTERN_DEFAULT_CATEGORY\n\t\t\t: TEMPLATE_PART_ALL_AREAS_CATEGORY );\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading items…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No items found' ) }</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<CategoriesGroup\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,Q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AA,CAAAE,SAAA;QAAAU,QAAA,GACG,CAAEyB,gBAAgB,IAAI,CAAEE,WAAW,iBACpCzC,IAAA,CAACrB,SAAS;UAACkC,SAAS,EAAC,qDAAqD;UAAAC,QAAA,eACzEd,IAAA,CAACnB,IAAI;YAAAiC,QAAA,EAAG/B,EAAE,CAAE,gBAAiB;UAAC,CAAQ;QAAC,CAC7B,CACX,eACDiB,IAAA,CAACM,eAAe;UACfC,iBAAiB,EAAGA,iBAAmB;UACvCC,iBAAiB,EAAGA,iBAAmB;UACvCC,eAAe,EAAGA,eAAiB;UACnCC,WAAW,EAAGA;QAAa,CAC3B,CAAC;MAAA,CACD,CACF;IAAA,CACA;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","getTemplatePartIcon","__","store","coreStore","useSelect","file","privateApis","routerPrivateApis","SidebarNavigationScreen","CategoryItem","PATTERN_DEFAULT_CATEGORY","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_ALL_AREAS_CATEGORY","usePatternCategories","useTemplatePartAreas","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","CategoriesGroup","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","className","children","count","Object","values","map","templateParts","length","reduce","acc","val","icon","label","id","type","isActive","entries","area","name","user","category","SidebarNavigationScreenPatterns","backPath","query","postType","categoryId","hasTemplateParts","isLoading","hasPatterns","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","isRoot","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_ALL_AREAS_CATEGORY,\n} from '../../utils/constants';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction CategoriesGroup( {\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ TEMPLATE_PART_ALL_AREAS_CATEGORY }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) }\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype={ PATTERN_TYPES.user }\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype={ PATTERN_TYPES.user }\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns( { backPath } ) {\n\tconst {\n\t\tquery: { postType = 'wp_block', categoryId },\n\t} = useLocation();\n\tconst currentCategory =\n\t\tcategoryId ||\n\t\t( postType === PATTERN_TYPES.user\n\t\t\t? PATTERN_DEFAULT_CATEGORY\n\t\t\t: TEMPLATE_PART_ALL_AREAS_CATEGORY );\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading items…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No items found' ) }</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<CategoriesGroup\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ postType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ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BAAiB;UAAC,CAAQ;QAAC,CAC7B,CACX,eACDiB,IAAA,CAACM,eAAe;UACfC,iBAAiB,EAAGA,iBAAmB;UACvCC,iBAAiB,EAAGA,iBAAmB;UACvCC,eAAe,EAAGA,eAAiB;UACnCC,WAAW,EAAG2B;QAAU,CACxB,CAAC;MAAA,CACD,CACF;IAAA,CACA;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
@@ -4,15 +4,22 @@
4
4
  import { useEntityRecords } from '@wordpress/core-data';
5
5
  import { useMemo } from '@wordpress/element';
6
6
  import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
9
+ import { addQueryArgs } from '@wordpress/url';
7
10
 
8
11
  /**
9
12
  * Internal dependencies
10
13
  */
11
- import DataViewItem from '../sidebar-dataviews/dataview-item';
14
+ import SidebarNavigationItem from '../sidebar-navigation-item';
12
15
  import { useAddedBy } from '../page-templates/hooks';
13
16
  import { layout } from '@wordpress/icons';
14
17
  import { TEMPLATE_POST_TYPE } from '../../utils/constants';
18
+ import { unlock } from '../../lock-unlock';
15
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ const {
21
+ useLocation
22
+ } = unlock(routerPrivateApis);
16
23
  const EMPTY_ARRAY = [];
17
24
  function TemplateDataviewItem({
18
25
  template,
@@ -22,18 +29,21 @@ function TemplateDataviewItem({
22
29
  text,
23
30
  icon
24
31
  } = useAddedBy(template.type, template.id);
25
- return /*#__PURE__*/_jsx(DataViewItem, {
26
- slug: text,
27
- title: text,
32
+ return /*#__PURE__*/_jsx(SidebarNavigationItem, {
33
+ to: addQueryArgs('/template', {
34
+ activeView: text
35
+ }),
28
36
  icon: icon,
29
- isActive: isActive,
30
- isCustom: false
31
- }, text);
37
+ "aria-current": isActive,
38
+ children: text
39
+ });
32
40
  }
33
- export default function DataviewsTemplatesSidebarContent({
34
- activeView,
35
- title
36
- }) {
41
+ export default function DataviewsTemplatesSidebarContent() {
42
+ const {
43
+ query: {
44
+ activeView = 'all'
45
+ }
46
+ } = useLocation();
37
47
  const {
38
48
  records
39
49
  } = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
@@ -51,12 +61,11 @@ export default function DataviewsTemplatesSidebarContent({
51
61
  return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : EMPTY_ARRAY;
52
62
  }, [records]);
53
63
  return /*#__PURE__*/_jsxs(ItemGroup, {
54
- children: [/*#__PURE__*/_jsx(DataViewItem, {
55
- slug: "all",
56
- title: title,
64
+ children: [/*#__PURE__*/_jsx(SidebarNavigationItem, {
65
+ to: "/template",
57
66
  icon: layout,
58
- isActive: activeView === 'all',
59
- isCustom: false
67
+ "aria-current": activeView === 'all',
68
+ children: __('All templates')
60
69
  }), firstItemPerAuthorText.map(template => {
61
70
  return /*#__PURE__*/_jsx(TemplateDataviewItem, {
62
71
  template: template,
@@ -1 +1 @@
1
- {"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","children","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug=\"all\"\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,OAA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AAEN,kBAAmB,CAAC,cAAAD,IAAA,cAAAA,IAAA,GAC3DhB,WAAW;EAEb,CAAC,EAAE,CAAEa,OAAO,CAAG,CAAC;EAEhB,oBACCd,KAAA,CAACR,SAAS;IAAAiC,QAAA,gBACT3B,IAAA,CAACL,YAAY;MACZgB,IAAI,EAAC,KAAK;MACVC,KAAK,EAAGA,KAAO;MACfJ,IAAI,EAAGX,MAAQ;MACfS,QAAQ,EAAGS,UAAU,KAAK,KAAO;MACjCF,QAAQ,EAAG;IAAO,CAClB,CAAC,EACAK,sBAAsB,CAACU,GAAG,CAAIvB,QAAQ,IAAM;MAC7C,oBACCL,IAAA,CAACI,oBAAoB;QAEpBC,QAAQ,EAAGA,QAAU;QACrBC,QAAQ,EAAGS,UAAU,KAAKV,QAAQ,CAACmB;MAAa,GAF1CnB,QAAQ,CAACmB,WAGf,CAAC;IAEJ,CAAE,CAAC;EAAA,CACO,CAAC;AAEd","ignoreList":[]}
1
+ {"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","__","privateApis","routerPrivateApis","addQueryArgs","SidebarNavigationItem","useAddedBy","layout","TEMPLATE_POST_TYPE","unlock","jsx","_jsx","jsxs","_jsxs","useLocation","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","to","activeView","children","DataviewsTemplatesSidebarContent","query","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\tto={ addQueryArgs( '/template', { activeView: text } ) }\n\t\t\ticon={ icon }\n\t\t\taria-current={ isActive }\n\t\t>\n\t\t\t{ text }\n\t\t</SidebarNavigationItem>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent() {\n\tconst {\n\t\tquery: { activeView = 'all' },\n\t} = useLocation();\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tto=\"/template\"\n\t\t\t\ticon={ layout }\n\t\t\t\taria-current={ activeView === 'all' }\n\t\t\t>\n\t\t\t\t{ __( 'All templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\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