@wordpress/edit-site 5.5.0 → 5.7.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 (310) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +3 -11
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +23 -17
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +1 -1
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/app/index.js +4 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +7 -9
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +2 -4
  13. package/build/components/editor/index.js.map +1 -1
  14. package/build/components/global-styles/border-panel.js +20 -159
  15. package/build/components/global-styles/border-panel.js.map +1 -1
  16. package/build/components/global-styles/context-menu.js +4 -6
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/hooks.js +0 -72
  19. package/build/components/global-styles/hooks.js.map +1 -1
  20. package/build/components/global-styles/preview.js +3 -4
  21. package/build/components/global-styles/preview.js.map +1 -1
  22. package/build/components/global-styles/screen-block-list.js +5 -7
  23. package/build/components/global-styles/screen-block-list.js.map +1 -1
  24. package/build/components/global-styles/screen-border.js +13 -5
  25. package/build/components/global-styles/screen-border.js.map +1 -1
  26. package/build/components/global-styles/screen-colors.js +22 -211
  27. package/build/components/global-styles/screen-colors.js.map +1 -1
  28. package/build/components/global-styles/screen-root.js +2 -1
  29. package/build/components/global-styles/screen-root.js.map +1 -1
  30. package/build/components/global-styles/screen-style-variations.js +2 -1
  31. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  32. package/build/components/global-styles/screen-typography-element.js +4 -0
  33. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +5 -0
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/global-styles/ui.js +5 -35
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/global-styles-renderer/index.js +1 -2
  39. package/build/components/global-styles-renderer/index.js.map +1 -1
  40. package/build/components/layout/index.js +7 -0
  41. package/build/components/layout/index.js.map +1 -1
  42. package/build/components/list/added-by.js +128 -136
  43. package/build/components/list/added-by.js.map +1 -1
  44. package/build/components/list/index.js +2 -1
  45. package/build/components/list/index.js.map +1 -1
  46. package/build/components/list/table.js +6 -5
  47. package/build/components/list/table.js.map +1 -1
  48. package/build/components/routes/link.js +4 -1
  49. package/build/components/routes/link.js.map +1 -1
  50. package/build/components/save-button/index.js +2 -5
  51. package/build/components/save-button/index.js.map +1 -1
  52. package/build/components/save-hub/index.js +82 -0
  53. package/build/components/save-hub/index.js.map +1 -0
  54. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
  55. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  56. package/build/components/sidebar/index.js +2 -4
  57. package/build/components/sidebar/index.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen/index.js +5 -2
  59. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-main/index.js +13 -13
  61. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  63. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
  65. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  67. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  68. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  69. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  70. package/build/components/sidebar-navigation-screen-template/index.js +59 -10
  71. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  73. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  75. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  76. package/build/components/site-hub/index.js +3 -1
  77. package/build/components/site-hub/index.js.map +1 -1
  78. package/build/components/start-template-options/index.js +44 -9
  79. package/build/components/start-template-options/index.js.map +1 -1
  80. package/build/components/style-book/index.js +133 -19
  81. package/build/components/style-book/index.js.map +1 -1
  82. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  83. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  84. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  85. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  86. package/build/components/template-details/index.js +0 -3
  87. package/build/components/template-details/index.js.map +1 -1
  88. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  89. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  90. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  91. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  92. package/build/components/template-part-converter/index.js +19 -14
  93. package/build/components/template-part-converter/index.js.map +1 -1
  94. package/build/components/use-edited-entity-record/index.js +6 -6
  95. package/build/components/use-edited-entity-record/index.js.map +1 -1
  96. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  97. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  98. package/build/index.js +3 -0
  99. package/build/index.js.map +1 -1
  100. package/build/utils/history.js +8 -2
  101. package/build/utils/history.js.map +1 -1
  102. package/build-module/components/add-new-template/new-template-part.js +3 -9
  103. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  104. package/build-module/components/add-new-template/new-template.js +25 -18
  105. package/build-module/components/add-new-template/new-template.js.map +1 -1
  106. package/build-module/components/add-new-template/utils.js +1 -1
  107. package/build-module/components/add-new-template/utils.js.map +1 -1
  108. package/build-module/components/app/index.js +3 -2
  109. package/build-module/components/app/index.js.map +1 -1
  110. package/build-module/components/block-editor/editor-canvas.js +8 -10
  111. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  112. package/build-module/components/editor/index.js +2 -3
  113. package/build-module/components/editor/index.js.map +1 -1
  114. package/build-module/components/global-styles/border-panel.js +21 -157
  115. package/build-module/components/global-styles/border-panel.js.map +1 -1
  116. package/build-module/components/global-styles/context-menu.js +4 -4
  117. package/build-module/components/global-styles/context-menu.js.map +1 -1
  118. package/build-module/components/global-styles/hooks.js +0 -66
  119. package/build-module/components/global-styles/hooks.js.map +1 -1
  120. package/build-module/components/global-styles/preview.js +3 -4
  121. package/build-module/components/global-styles/preview.js.map +1 -1
  122. package/build-module/components/global-styles/screen-block-list.js +5 -5
  123. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  124. package/build-module/components/global-styles/screen-border.js +11 -2
  125. package/build-module/components/global-styles/screen-border.js.map +1 -1
  126. package/build-module/components/global-styles/screen-colors.js +23 -208
  127. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  128. package/build-module/components/global-styles/screen-root.js +2 -1
  129. package/build-module/components/global-styles/screen-root.js.map +1 -1
  130. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  131. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  132. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  133. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  134. package/build-module/components/global-styles/screen-typography.js +5 -0
  135. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  136. package/build-module/components/global-styles/ui.js +5 -30
  137. package/build-module/components/global-styles/ui.js.map +1 -1
  138. package/build-module/components/global-styles-renderer/index.js +1 -2
  139. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  140. package/build-module/components/layout/index.js +7 -0
  141. package/build-module/components/layout/index.js.map +1 -1
  142. package/build-module/components/list/added-by.js +126 -137
  143. package/build-module/components/list/added-by.js.map +1 -1
  144. package/build-module/components/list/index.js +2 -1
  145. package/build-module/components/list/index.js.map +1 -1
  146. package/build-module/components/list/table.js +6 -5
  147. package/build-module/components/list/table.js.map +1 -1
  148. package/build-module/components/routes/link.js +5 -2
  149. package/build-module/components/routes/link.js.map +1 -1
  150. package/build-module/components/save-button/index.js +2 -5
  151. package/build-module/components/save-button/index.js.map +1 -1
  152. package/build-module/components/save-hub/index.js +68 -0
  153. package/build-module/components/save-hub/index.js.map +1 -0
  154. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
  155. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  156. package/build-module/components/sidebar/index.js +2 -4
  157. package/build-module/components/sidebar/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  159. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
  161. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  163. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  164. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
  165. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  166. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  167. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  168. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  169. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  170. package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
  171. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  173. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  175. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  176. package/build-module/components/site-hub/index.js +3 -1
  177. package/build-module/components/site-hub/index.js.map +1 -1
  178. package/build-module/components/start-template-options/index.js +45 -10
  179. package/build-module/components/start-template-options/index.js.map +1 -1
  180. package/build-module/components/style-book/index.js +133 -21
  181. package/build-module/components/style-book/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  183. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/components/template-details/index.js +0 -3
  187. package/build-module/components/template-details/index.js.map +1 -1
  188. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  189. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  190. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  191. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  192. package/build-module/components/template-part-converter/index.js +20 -15
  193. package/build-module/components/template-part-converter/index.js.map +1 -1
  194. package/build-module/components/use-edited-entity-record/index.js +6 -6
  195. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  196. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  197. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  198. package/build-module/index.js +4 -1
  199. package/build-module/index.js.map +1 -1
  200. package/build-module/utils/history.js +9 -3
  201. package/build-module/utils/history.js.map +1 -1
  202. package/build-style/style-rtl.css +172 -128
  203. package/build-style/style.css +172 -128
  204. package/package.json +31 -31
  205. package/src/components/add-new-template/new-template-part.js +1 -6
  206. package/src/components/add-new-template/new-template.js +60 -38
  207. package/src/components/add-new-template/style.scss +12 -1
  208. package/src/components/add-new-template/utils.js +1 -1
  209. package/src/components/app/index.js +9 -6
  210. package/src/components/block-editor/editor-canvas.js +13 -22
  211. package/src/components/editor/index.js +61 -65
  212. package/src/components/global-styles/border-panel.js +24 -199
  213. package/src/components/global-styles/context-menu.js +4 -4
  214. package/src/components/global-styles/hooks.js +0 -101
  215. package/src/components/global-styles/preview.js +1 -1
  216. package/src/components/global-styles/screen-block-list.js +4 -4
  217. package/src/components/global-styles/screen-border.js +9 -2
  218. package/src/components/global-styles/screen-colors.js +25 -229
  219. package/src/components/global-styles/screen-root.js +1 -1
  220. package/src/components/global-styles/screen-style-variations.js +5 -1
  221. package/src/components/global-styles/screen-typography-element.js +4 -0
  222. package/src/components/global-styles/screen-typography.js +6 -0
  223. package/src/components/global-styles/stories/index.js +425 -0
  224. package/src/components/global-styles/style.scss +14 -18
  225. package/src/components/global-styles/ui.js +6 -31
  226. package/src/components/global-styles-renderer/index.js +1 -2
  227. package/src/components/layout/index.js +15 -0
  228. package/src/components/layout/style.scss +1 -3
  229. package/src/components/list/added-by.js +144 -140
  230. package/src/components/list/index.js +3 -1
  231. package/src/components/list/table.js +7 -4
  232. package/src/components/routes/link.js +9 -2
  233. package/src/components/save-button/index.js +2 -2
  234. package/src/components/save-hub/index.js +78 -0
  235. package/src/components/save-hub/style.scss +15 -0
  236. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
  237. package/src/components/sidebar/index.js +2 -3
  238. package/src/components/sidebar/style.scss +4 -3
  239. package/src/components/sidebar-button/style.scss +2 -1
  240. package/src/components/sidebar-navigation-item/style.scss +1 -23
  241. package/src/components/sidebar-navigation-screen/index.js +6 -0
  242. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  243. package/src/components/sidebar-navigation-screen-main/index.js +21 -8
  244. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  245. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
  246. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  247. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  248. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  249. package/src/components/sidebar-navigation-screen-template/index.js +82 -11
  250. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  251. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  252. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  253. package/src/components/site-hub/index.js +5 -1
  254. package/src/components/site-hub/style.scss +5 -1
  255. package/src/components/start-template-options/index.js +40 -8
  256. package/src/components/style-book/index.js +203 -54
  257. package/src/components/style-book/style.scss +2 -46
  258. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  259. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  260. package/src/components/template-details/index.js +0 -3
  261. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  262. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  263. package/src/components/template-part-converter/index.js +28 -12
  264. package/src/components/use-edited-entity-record/index.js +26 -18
  265. package/src/hooks/push-changes-to-global-styles/index.js +1 -0
  266. package/src/index.js +5 -1
  267. package/src/store/test/actions.js +0 -2
  268. package/src/style.scss +2 -1
  269. package/src/utils/history.js +13 -9
  270. package/build/components/global-styles/color-utils.js +0 -17
  271. package/build/components/global-styles/color-utils.js.map +0 -1
  272. package/build/components/global-styles/screen-background-color.js +0 -114
  273. package/build/components/global-styles/screen-background-color.js.map +0 -1
  274. package/build/components/global-styles/screen-button-color.js +0 -88
  275. package/build/components/global-styles/screen-button-color.js.map +0 -1
  276. package/build/components/global-styles/screen-heading-color.js +0 -165
  277. package/build/components/global-styles/screen-heading-color.js.map +0 -1
  278. package/build/components/global-styles/screen-link-color.js +0 -105
  279. package/build/components/global-styles/screen-link-color.js.map +0 -1
  280. package/build/components/global-styles/screen-text-color.js +0 -71
  281. package/build/components/global-styles/screen-text-color.js.map +0 -1
  282. package/build/components/navigation-inspector/index.js +0 -161
  283. package/build/components/navigation-inspector/index.js.map +0 -1
  284. package/build/components/navigation-inspector/navigation-menu.js +0 -79
  285. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  286. package/build-module/components/global-styles/color-utils.js +0 -9
  287. package/build-module/components/global-styles/color-utils.js.map +0 -1
  288. package/build-module/components/global-styles/screen-background-color.js +0 -97
  289. package/build-module/components/global-styles/screen-background-color.js.map +0 -1
  290. package/build-module/components/global-styles/screen-button-color.js +0 -73
  291. package/build-module/components/global-styles/screen-button-color.js.map +0 -1
  292. package/build-module/components/global-styles/screen-heading-color.js +0 -149
  293. package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
  294. package/build-module/components/global-styles/screen-link-color.js +0 -89
  295. package/build-module/components/global-styles/screen-link-color.js.map +0 -1
  296. package/build-module/components/global-styles/screen-text-color.js +0 -56
  297. package/build-module/components/global-styles/screen-text-color.js.map +0 -1
  298. package/build-module/components/navigation-inspector/index.js +0 -146
  299. package/build-module/components/navigation-inspector/index.js.map +0 -1
  300. package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
  301. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  302. package/src/components/global-styles/color-utils.js +0 -14
  303. package/src/components/global-styles/screen-background-color.js +0 -132
  304. package/src/components/global-styles/screen-button-color.js +0 -104
  305. package/src/components/global-styles/screen-heading-color.js +0 -206
  306. package/src/components/global-styles/screen-link-color.js +0 -124
  307. package/src/components/global-styles/screen-text-color.js +0 -62
  308. package/src/components/navigation-inspector/index.js +0 -191
  309. package/src/components/navigation-inspector/navigation-menu.js +0 -84
  310. package/src/components/navigation-inspector/style.scss +0 -46
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"names":["useSelect","useDispatch","Button","__experimentalHStack","HStack","sprintf","__","_n","store","coreStore","displayShortcut","check","editSiteStore","SaveButton","countUnsavedChanges","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","isSaveViewOpened","length","some","record","kind","name","key","setIsSaveViewOpened","disabled","label","undefined","primary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,EAAiBC,oBAAoB,IAAIC,MAAzC,QAAuD,uBAAvD;AACA,SAASC,OAAT,EAAkBC,EAAlB,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA,QAAhC;AAA0CC,IAAAA;AAA1C,MACLjB,SAAS,CAAIkB,MAAF,IAAc;AACxB,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAET,SAAF,CAHV;;AAIA,UAAMY,kBAAkB,GAAGF,mCAAmC,EAA9D;;AACA,UAAM;AAAEG,MAAAA;AAAF,QAAuBJ,MAAM,CAAEN,aAAF,CAAnC;AACA,WAAO;AACNG,MAAAA,OAAO,EAAEM,kBAAkB,CAACE,MAAnB,GAA4B,CAD/B;AAENP,MAAAA,QAAQ,EAAEK,kBAAkB,CAACG,IAAnB,CAA2BC,MAAF,IAClCL,oBAAoB,CAAEK,MAAM,CAACC,IAAT,EAAeD,MAAM,CAACE,IAAtB,EAA4BF,MAAM,CAACG,GAAnC,CADX,CAFJ;AAKNX,MAAAA,cAAc,EAAEK,gBAAgB,EAL1B;AAMNR,MAAAA,mBAAmB,EAAEO,kBAAkB,CAACE;AANlC,KAAP;AAQA,GAfQ,EAeN,EAfM,CADV;AAiBA,QAAM;AAAEM,IAAAA;AAAF,MAA0B5B,WAAW,CAAEW,aAAF,CAA3C;AAEA,QAAMkB,QAAQ,GAAG,CAAEf,OAAF,IAAaC,QAA9B;AAEA,QAAMe,KAAK,GAAGD,QAAQ,GAAGxB,EAAE,CAAE,OAAF,CAAL,GAAmBA,EAAE,CAAE,MAAF,CAA3C;AAEA,SACC,cAAC,MAAD;AAAQ,IAAA,SAAS,EAAC,oBAAlB;AAAuC,IAAA,SAAS,EAAC,OAAjD;AAAyD,IAAA,OAAO,EAAG;AAAnE,KACGS,OAAO,IACR,4BACGV,OAAO,EACR;AACAE,EAAAA,EAAE,CACD,mBADC,EAED,oBAFC,EAGDO,mBAHC,CAFM,EAORA,mBAPQ,CADV,CAFF,EAcC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,OAAO,EAAGgB,QAAQ,GAAGE,SAAH,GAAe,SAFlC;AAGC,qBAAgBF,QAHjB;AAIC,qBAAgBb,cAJjB;AAKC,IAAA,MAAM,EAAGD,QALV;AAMC,IAAA,OAAO,EACNc,QAAQ,GAAGE,SAAH,GAAe,MAAMH,mBAAmB,CAAE,IAAF,CAPlD;AASC,IAAA,KAAK,EAAGE;AACR;AACJ;AACA;AACA;AAbG;AAcC,IAAA,QAAQ,EACPD,QAAQ,GAAGE,SAAH,GAAetB,eAAe,CAACuB,OAAhB,CAAyB,GAAzB,CAfzB;AAiBC,IAAA,IAAI,EAAGH,QAAQ,GAAGnB,KAAH,GAAWqB;AAjB3B,KAmBGD,KAnBH,CAdD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { sprintf, __, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function SaveButton() {\n\tconst { countUnsavedChanges, isDirty, isSaving, isSaveViewOpen } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\treturn {\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t),\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tcountUnsavedChanges: dirtyEntityRecords.length,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\tconst label = disabled ? __( 'Saved' ) : __( 'Save' );\n\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t{ isDirty && (\n\t\t\t\t<span>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d unsaved change',\n\t\t\t\t\t\t\t'%d unsaved changes',\n\t\t\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\tvariant={ disabled ? undefined : 'primary' }\n\t\t\t\taria-disabled={ disabled }\n\t\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tonClick={\n\t\t\t\t\tdisabled ? undefined : () => setIsSaveViewOpened( true )\n\t\t\t\t}\n\t\t\t\tlabel={ label }\n\t\t\t\t/*\n\t\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t\t */\n\t\t\t\tshortcut={\n\t\t\t\t\tdisabled ? undefined : displayShortcut.primary( 's' )\n\t\t\t\t}\n\t\t\t\ticon={ disabled ? check : undefined }\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</Button>\n\t\t</HStack>\n\t);\n}\n"]}
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { __experimentalListView as ListView } from '@wordpress/block-editor';
6
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
7
7
  import { Button } from '@wordpress/components';
8
8
  import { useFocusOnMount, useFocusReturn, useInstanceId, useMergeRefs } from '@wordpress/compose';
9
9
  import { useDispatch } from '@wordpress/data';
@@ -15,6 +15,7 @@ import { ESCAPE } from '@wordpress/keycodes';
15
15
  */
16
16
 
17
17
  import { store as editSiteStore } from '../../store';
18
+ import { unlock } from '../../private-apis';
18
19
  export default function ListViewSidebar() {
19
20
  const {
20
21
  setIsListViewOpened
@@ -31,6 +32,9 @@ export default function ListViewSidebar() {
31
32
 
32
33
  const instanceId = useInstanceId(ListViewSidebar);
33
34
  const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`;
35
+ const {
36
+ PrivateListView
37
+ } = unlock(blockEditorPrivateApis);
34
38
  return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
35
39
  createElement("div", {
36
40
  "aria-labelledby": labelId,
@@ -48,7 +52,7 @@ export default function ListViewSidebar() {
48
52
  })), createElement("div", {
49
53
  className: "edit-site-editor__list-view-panel-content",
50
54
  ref: useMergeRefs([contentFocusReturnRef, focusOnMountRef])
51
- }, createElement(ListView, null)))
55
+ }, createElement(PrivateListView, null)))
52
56
  );
53
57
  }
54
58
  //# sourceMappingURL=list-view-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editSiteStore","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","instanceId","labelId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,aAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BP,WAAW,CAAEK,aAAF,CAA3C;AAEA,QAAMG,eAAe,GAAGZ,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMa,oBAAoB,GAAGZ,cAAc,EAA3C;AACA,QAAMa,qBAAqB,GAAGb,cAAc,EAA5C;;AACA,WAASc,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBV,MAAlB,IAA4B,CAAES,KAAK,CAACE,gBAAzC,EAA4D;AAC3DP,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMQ,UAAU,GAAGjB,aAAa,CAAEQ,eAAF,CAAhC;AACA,QAAMU,OAAO,GAAI,2CAA2CD,UAAY,EAAxE;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,mCAFX;AAGC,MAAA,SAAS,EAAGL;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,0CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGO;AAAb,OAAyBf,EAAE,CAAE,WAAF,CAA3B,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,yBAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMM,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAGR,YAAY,CAAE,CACnBW,qBADmB,EAEnBF,eAFmB,CAAF;AAFnB,OAOC,cAAC,QAAD,OAPD,CAhBD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["privateApis","blockEditorPrivateApis","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editSiteStore","unlock","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","instanceId","labelId","PrivateListView"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,aAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BR,WAAW,CAAEK,aAAF,CAA3C;AAEA,QAAMI,eAAe,GAAGb,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMc,oBAAoB,GAAGb,cAAc,EAA3C;AACA,QAAMc,qBAAqB,GAAGd,cAAc,EAA5C;;AACA,WAASe,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBX,MAAlB,IAA4B,CAAEU,KAAK,CAACE,gBAAzC,EAA4D;AAC3DP,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMQ,UAAU,GAAGlB,aAAa,CAAES,eAAF,CAAhC;AACA,QAAMU,OAAO,GAAI,2CAA2CD,UAAY,EAAxE;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAsBZ,MAAM,CAAEZ,sBAAF,CAAlC;AACA,SACC;AACA;AACC,yBAAkBuB,OADnB;AAEC,MAAA,SAAS,EAAC,mCAFX;AAGC,MAAA,SAAS,EAAGL;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,0CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGO;AAAb,OAAyBhB,EAAE,CAAE,WAAF,CAA3B,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,yBAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMO,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAGT,YAAY,CAAE,CACnBY,qBADmB,EAEnBF,eAFmB,CAAF;AAFnB,OAOC,cAAC,eAAD,OAPD,CAhBD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\tconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<PrivateListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -15,7 +15,7 @@ import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-templa
15
15
  import useSyncPathWithURL, { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
16
16
  import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
17
17
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
18
- import SaveButton from '../save-button';
18
+ import SaveHub from '../save-hub';
19
19
  import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
20
20
  import { useLocation } from '../routes';
21
21
 
@@ -46,9 +46,7 @@ function Sidebar() {
46
46
  initialPath: initialPath.current
47
47
  }, createElement(SidebarScreens, null)), createElement("div", {
48
48
  className: "edit-site-sidebar__footer"
49
- }, createElement(SaveButton, {
50
- showTooltip: false
51
- })));
49
+ }, createElement(SaveHub, null)));
52
50
  }
53
51
 
54
52
  export default memo(Sidebar);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveButton","SidebarNavigationScreenNavigationItem","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;A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\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveButton from '../save-button';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\nimport { useLocation } from '../routes';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveButton showTooltip={ false } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveHub","SidebarNavigationScreenNavigationItem","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,SAASC,WAAT,QAA4B,WAA5B;;AAEA,SAASC,cAAT,GAA0B;AACzBP,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CADD,EAIC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAJD,EAOC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,qCAAD,OADD,CAPD,EAUC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,gCAAD,OADD,CAVD,EAaC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAbD,EAgBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,+BAAD,OADD,CAhBD,CADD;AAsBA;;AAED,SAASQ,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBJ,WAAW,EAAzC;AACA,QAAMK,WAAW,GAAGnB,MAAM,CAAES,cAAc,CAAES,SAAF,CAAhB,CAA1B;AAEA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,cAAC,cAAD,OAJD,CADD,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD,OADD,CAPD,CADD;AAaA;;AAED,eAAerB,IAAI,CAAEiB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\nimport { useLocation } from '../routes';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveHub />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
@@ -19,7 +19,8 @@ export default function SidebarNavigationScreen(_ref) {
19
19
  isRoot,
20
20
  title,
21
21
  actions,
22
- content
22
+ content,
23
+ description
23
24
  } = _ref;
24
25
  const {
25
26
  dashboardLink
@@ -50,6 +51,8 @@ export default function SidebarNavigationScreen(_ref) {
50
51
  className: "edit-site-sidebar-navigation-screen__title"
51
52
  }, title), actions), createElement("nav", {
52
53
  className: "edit-site-sidebar-navigation-screen__content"
53
- }, content));
54
+ }, description && createElement("p", {
55
+ className: "edit-site-sidebar-navigation-screen__description"
56
+ }, description), content));
54
57
  }
55
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,QAIO,uBAJP;AAKA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBV,SAAS,CAAIW,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBT,MAAM,CAAEQ,MAAM,CAAET,aAAF,CAAR,CAA9B;AACA,WAAO;AACNQ,MAAAA,aAAa,EAAEE,WAAW,GAAGC;AADvB,KAAP;AAGA,GALkC,EAKhC,EALgC,CAAnC;AAOA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAEP,MAAF,GACD,cAAC,uBAAD;AACC,IAAA,EAAE,EAAGF,aADN;AAEC,IAAA,IAAI,EAAGR,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,MAAF;AAHhB,IADC,GAOD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGD,KAAK,KAAKE,YAAL,GAAoBC,WADjC;AAEC,kBAAaF,EAAE,CAAE,2BAAF,CAFhB;AAGC,IAAA,IAAI,EAAGa,aAAa,IAAI,WAHzB;AAIC,IAAA,KAAK,EAAGb,EAAE,CAAE,WAAF;AAJX,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGU,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA1BD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","description","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB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AK,EAAGd,EAAE,CAAE,WAAF;AAJX,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGU,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGE,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAFF,EAMGD,OANH,CA1BD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n\tdescription,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ description && (\n\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -15,23 +15,23 @@ import { store as coreStore } from '@wordpress/core-data';
15
15
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
16
  import SidebarNavigationItem from '../sidebar-navigation-item';
17
17
  export default function SidebarNavigationScreenMain() {
18
- const {
19
- navigationMenus
20
- } = useSelect(select => {
21
- const {
22
- getEntityRecords
23
- } = select(coreStore);
24
- return {
25
- navigationMenus: getEntityRecords('postType', 'wp_navigation', {
26
- per_page: -1,
27
- status: 'publish'
28
- })
29
- };
18
+ const hasNavigationMenus = useSelect(select => {
19
+ // The query needs to be the same as in the "SidebarNavigationScreenNavigationMenus" component,
20
+ // to avoid double network calls.
21
+ const navigationMenus = select(coreStore).getEntityRecords('postType', 'wp_navigation', {
22
+ per_page: 1,
23
+ status: 'publish',
24
+ order: 'desc',
25
+ orderby: 'date'
26
+ });
27
+ return (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 0;
30
28
  });
29
+ const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN ? hasNavigationMenus : false;
31
30
  return createElement(SidebarNavigationScreen, {
32
31
  isRoot: true,
33
32
  title: __('Design'),
34
- content: createElement(ItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && createElement(NavigatorButton, {
33
+ description: __('Customize the appearance of your website using the block editor.'),
34
+ content: createElement(ItemGroup, null, showNavigationScreen && createElement(NavigatorButton, {
35
35
  as: SidebarNavigationItem,
36
36
  path: "/navigation",
37
37
  withChevron: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","per_page","status","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA/B,QAAiD,kBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsBN,SAAS,CAAIO,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEL,SAAF,CAAnC;AACA,WAAO;AACNI,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DC,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GARoC,CAArC;AAUA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,OAAO,EACN,cAAC,SAAD,QACG,CAAC,CAAEU,eAAH,IAAsBA,eAAe,CAACK,MAAhB,GAAyB,CAA/C,IACD,cAAC,eAAD;AACC,MAAA,EAAE,EAAGP,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;AAJF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","hasNavigationMenus","select","navigationMenus","getEntityRecords","per_page","status","order","orderby","length","showNavigationScreen","process","env","IS_GUTENBERG_PLUGIN"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA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MGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;AAPF,IADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst hasNavigationMenus = useSelect( ( select ) => {\n\t\t// The query needs to be the same as in the \"SidebarNavigationScreenNavigationMenus\" component,\n\t\t// to avoid double network calls.\n\t\tconst navigationMenus = select( coreStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\t{\n\t\t\t\tper_page: 1,\n\t\t\t\tstatus: 'publish',\n\t\t\t\torder: 'desc',\n\t\t\t\torderby: 'date',\n\t\t\t}\n\t\t);\n\n\t\treturn navigationMenus?.length > 0;\n\t} );\n\n\tconst showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN\n\t\t? hasNavigationMenus\n\t\t: false;\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={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ showNavigationScreen && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -1,12 +1,12 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { useDispatch, useSelect } from '@wordpress/data';
8
- import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
9
- import { store as coreStore } from '@wordpress/core-data';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { __experimentalUseNavigator as useNavigator, ExternalLink } from '@wordpress/components';
9
+ import { useEntityRecord } from '@wordpress/core-data';
10
10
  import { decodeEntities } from '@wordpress/html-entities';
11
11
  import { pencil } from '@wordpress/icons';
12
12
  /**
@@ -18,7 +18,7 @@ import { unlock } from '../../private-apis';
18
18
  import { store as editSiteStore } from '../../store';
19
19
  import SidebarButton from '../sidebar-button';
20
20
  export default function SidebarNavigationScreenNavigationItem() {
21
- var _post$title, _post$description;
21
+ var _record$title, _record$description;
22
22
 
23
23
  const {
24
24
  setCanvasMode
@@ -30,25 +30,20 @@ export default function SidebarNavigationScreenNavigationItem() {
30
30
  }
31
31
  } = useNavigator();
32
32
  const {
33
- post
34
- } = useSelect(select => {
35
- const {
36
- getEntityRecord
37
- } = select(coreStore); // The currently selected entity to display.
38
- // Typically template or template part in the site editor.
39
-
40
- return {
41
- post: postId && postType ? getEntityRecord('postType', postType, postId) : null
42
- };
43
- }, [postType, postId]);
33
+ record
34
+ } = useEntityRecord('postType', postType, postId);
44
35
  return createElement(SidebarNavigationScreen, {
45
- title: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
36
+ title: record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) : null,
46
37
  actions: createElement(SidebarButton, {
47
38
  onClick: () => setCanvasMode('edit'),
48
39
  label: __('Edit'),
49
40
  icon: pencil
50
41
  }),
51
- content: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
42
+ description: postType === 'page' ? __('Pages are static and are not listed by date. Pages do not use tags or categories.') : __('Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'),
43
+ content: createElement(Fragment, null, record !== null && record !== void 0 && record.link ? createElement(ExternalLink, {
44
+ className: "edit-site-sidebar-navigation-screen__page-link",
45
+ href: record.link
46
+ }, record.link) : null, record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$description = record.description) === null || _record$description === void 0 ? void 0 : _record$description.rendered) : null)
52
47
  });
53
48
  }
54
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","store","coreStore","decodeEntities","pencil","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","post","select","getEntityRecord","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBJ,MAAM,CAAET,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFb,YAAY,EAFhB;AAIA,QAAM;AAAEc,IAAAA;AAAF,MAAWhB,SAAS,CACvBiB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEb,SAAF,CAAlC,CADa,CAGb;AACA;;AACA,WAAO;AACNY,MAAAA,IAAI,EACHD,MAAM,IAAID,QAAV,GACGI,eAAe,CAAE,UAAF,EAAcJ,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAZwB,EAazB,CAAED,QAAF,EAAYC,MAAZ,CAbyB,CAA1B;AAgBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,IAAI,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,sCAAEA,IAAI,CAAEG,KAAR,gDAAE,YAAaC,QAAf,CAAjB,GAA6C,IAD1D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGQ;AAHR,MAHF;AASC,IAAA,OAAO,EACNU,IAAI,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,4CAAEA,IAAI,CAAEK,WAAR,sDAAE,kBAAmBD,QAArB,CAAjB,GAAmD;AAVzD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\n\tconst { post } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tpost:\n\t\t\t\t\tpostId && postType\n\t\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","__experimentalUseNavigator","useNavigator","ExternalLink","useEntityRecord","decodeEntities","pencil","SidebarNavigationScreen","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","record","title","rendered","link","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,YAFD,QAGO,uBAHP;AAIA,SAASC,eAAT,QAAgC,sBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,MAAM,CAAER,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFd,YAAY,EAFhB;AAGA,QAAM;AAAEe,IAAAA;AAAF,MAAab,eAAe,CAAE,UAAF,EAAcW,QAAd,EAAwBC,MAAxB,CAAlC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,MAAM,GAAGZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,wCAAEA,MAAM,CAAEC,KAAV,kDAAE,cAAeC,QAAjB,CAAjB,GAA+C,IAD9D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMN,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,WAAW,EACVS,QAAQ,KAAK,MAAb,GACGhB,EAAE,CACF,mFADE,CADL,GAIGA,EAAE,CACF,oGADE,CAdP;AAkBC,IAAA,OAAO,EACN,8BACGkB,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEG,IAAR,GACD,cAAC,YAAD;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,IAAI,EAAGH,MAAM,CAACG;AAFf,OAIGH,MAAM,CAACG,IAJV,CADC,GAOE,IARL,EASGH,MAAM,GACLZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,8CAAEA,MAAM,CAAEI,WAAV,wDAAE,oBAAqBF,QAAvB,CADT,GAEL,IAXJ;AAnBF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', postType, postId );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ record ? decodeEntities( record?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Pages are static and are not listed by date. Pages do not use tags or categories.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'\n\t\t\t\t\t )\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ record?.link ? (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\t\t\thref={ record.link }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ record.link }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ record\n\t\t\t\t\t\t? decodeEntities( record?.description?.rendered )\n\t\t\t\t\t\t: null }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -4,16 +4,75 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { useCallback } from '@wordpress/element';
7
+ import { useCallback, useMemo } from '@wordpress/element';
8
+ import { useSelect } from '@wordpress/data';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+ import { BlockEditorProvider } from '@wordpress/block-editor';
11
+ import { createBlock } from '@wordpress/blocks';
8
12
  /**
9
13
  * Internal dependencies
10
14
  */
11
15
 
12
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
13
- import NavigationInspector from '../navigation-inspector';
14
17
  import { useHistory } from '../routes';
18
+ import NavigationMenuContent from './navigation-menu-content';
19
+ import { NavigationMenuLoader } from './loader';
20
+ import { unlock } from '../../private-apis';
21
+ import { store as editSiteStore } from '../../store';
22
+
23
+ const noop = () => {};
24
+
25
+ const NAVIGATION_MENUS_QUERY = {
26
+ per_page: 1,
27
+ status: 'publish',
28
+ order: 'desc',
29
+ orderby: 'date'
30
+ };
31
+
32
+ function SidebarNavigationScreenWrapper(_ref) {
33
+ let {
34
+ children,
35
+ actions
36
+ } = _ref;
37
+ return createElement(SidebarNavigationScreen, {
38
+ title: __('Navigation'),
39
+ actions: actions,
40
+ description: __('Browse your site, edit pages, and manage your primary navigation menu.'),
41
+ content: children
42
+ });
43
+ }
44
+
15
45
  export default function SidebarNavigationScreenNavigationMenus() {
46
+ var _navigationMenus$;
47
+
16
48
  const history = useHistory();
49
+ const {
50
+ navigationMenus,
51
+ hasResolvedNavigationMenus,
52
+ storedSettings
53
+ } = useSelect(select => {
54
+ const {
55
+ getSettings
56
+ } = unlock(select(editSiteStore));
57
+ const {
58
+ getEntityRecords,
59
+ hasFinishedResolution
60
+ } = select(coreStore);
61
+ const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY];
62
+ return {
63
+ storedSettings: getSettings(false),
64
+ navigationMenus: getEntityRecords(...navigationMenusQuery),
65
+ hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
66
+ };
67
+ }, []);
68
+ const firstNavigationMenu = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id;
69
+ const blocks = useMemo(() => {
70
+ return [createBlock('core/navigation', {
71
+ ref: firstNavigationMenu
72
+ })];
73
+ }, [firstNavigationMenu]);
74
+ const isLoading = !hasResolvedNavigationMenus;
75
+ const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
17
76
  const onSelect = useCallback(selectedBlock => {
18
77
  const {
19
78
  attributes,
@@ -34,13 +93,25 @@ export default function SidebarNavigationScreenNavigationMenus() {
34
93
  });
35
94
  }
36
95
  }, [history]);
37
- return createElement(SidebarNavigationScreen, {
38
- title: __('Navigation'),
39
- content: createElement("div", {
40
- className: "edit-site-sidebar-navigation-screen-navigation-menus"
41
- }, createElement(NavigationInspector, {
42
- onSelect: onSelect
43
- }))
44
- });
96
+
97
+ if (hasResolvedNavigationMenus && !hasNavigationMenus) {
98
+ return createElement(SidebarNavigationScreenWrapper, null, __('There are no Navigation Menus.'));
99
+ }
100
+
101
+ if (!hasResolvedNavigationMenus || isLoading) {
102
+ return createElement(SidebarNavigationScreenWrapper, null, createElement(NavigationMenuLoader, null));
103
+ }
104
+
105
+ return createElement(BlockEditorProvider, {
106
+ settings: storedSettings,
107
+ value: blocks,
108
+ onChange: noop,
109
+ onInput: noop
110
+ }, createElement(SidebarNavigationScreenWrapper, null, createElement("div", {
111
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
112
+ }, createElement(NavigationMenuContent, {
113
+ rootClientId: blocks[0].clientId,
114
+ onSelect: onSelect
115
+ }))));
45
116
  }
46
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","name","kind","id","type","push","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA,UAAF;AAAcC,MAAAA;AAAd,QAAuBF,aAA7B;;AACA,QACCC,UAAU,CAACE,IAAX,KAAoB,WAApB,IACAF,UAAU,CAACG,EADX,IAEAH,UAAU,CAACI,IAFX,IAGAP,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACQ,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEN,UAAU,CAACI,IADR;AAEbG,QAAAA,MAAM,EAAEP,UAAU,CAACG;AAFN,OAAd;AAIA;;AACD,QAAKF,IAAI,KAAK,qBAAT,IAAkCD,UAAU,CAACG,EAA7C,IAAmDN,OAAxD,EAAkE;AACjEA,MAAAA,OAAO,CAACQ,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAE,MADG;AAEbC,QAAAA,MAAM,EAAEP,UAAU,CAACG;AAFN,OAAd;AAIA;AACD,GApB0B,EAqB3B,CAAEN,OAAF,CArB2B,CAA5B;AAuBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGN,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AAHF,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = 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.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\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.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","useMemo","useSelect","store","coreStore","BlockEditorProvider","createBlock","SidebarNavigationScreen","useHistory","NavigationMenuContent","NavigationMenuLoader","unlock","editSiteStore","noop","NAVIGATION_MENUS_QUERY","per_page","status","order","orderby","SidebarNavigationScreenWrapper","children","actions","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","getEntityRecords","hasFinishedResolution","navigationMenusQuery","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,mBAAT,QAAoC,yBAApC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,qBAAP,MAAkC,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GtC,EAAE,CAAE,gCAAF,CADL,CADD;AAKA;;AAED,MAAK,CAAE0B,0BAAF,IAAgCW,SAArC,EAAiD;AAChD,WACC,cAAC,8BAAD,QACC,cAAC,oBAAD,OADD,CADD;AAKA;;AAED,SACC,cAAC,mBAAD;AACC,IAAA,QAAQ,EAAGV,cADZ;AAEC,IAAA,KAAK,EAAGQ,MAFT;AAGC,IAAA,QAAQ,EAAGrB,IAHZ;AAIC,IAAA,OAAO,EAAGA;AAJX,KAMC,cAAC,8BAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,qBAAD;AACC,IAAA,YAAY,EAAGqB,MAAM,CAAE,CAAF,CAAN,CAAYc,QAD5B;AAEC,IAAA,QAAQ,EAAGT;AAFZ,IADD,CADD,CAND,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useHistory } from '../routes';\nimport NavigationMenuContent from './navigation-menu-content';\nimport { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = {\n\tper_page: 1,\n\tstatus: 'publish',\n\torder: 'desc',\n\torderby: 'date',\n};\n\nfunction SidebarNavigationScreenWrapper( { children, actions } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ __(\n\t\t\t\t'Browse your site, edit pages, and manage your primary navigation menu.'\n\t\t\t) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst { navigationMenus, hasResolvedNavigationMenus, storedSettings } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst navigationMenusQuery = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tNAVIGATION_MENUS_QUERY,\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( false ),\n\t\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tnavigationMenusQuery\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ]?.id;\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: firstNavigationMenu } ),\n\t\t];\n\t}, [ firstNavigationMenu ] );\n\n\tconst isLoading = ! hasResolvedNavigationMenus;\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tconst onSelect = 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.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\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.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tif ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedNavigationMenus || isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<NavigationMenuLoader />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t\t<NavigationMenuContent\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+ export function NavigationMenuLoader() {
3
+ return createElement(Fragment, null, createElement("div", {
4
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
5
+ }), createElement("div", {
6
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
7
+ }), createElement("div", {
8
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
9
+ }));
10
+ }
11
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/loader.js"],"names":["NavigationMenuLoader"],"mappings":";AAAA,OAAO,SAASA,oBAAT,GAAgC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,CADD;AAOA","sourcesContent":["export function NavigationMenuLoader() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,66 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools } from '@wordpress/block-editor';
7
+ import { useDispatch, useSelect } from '@wordpress/data';
8
+ import { createBlock } from '@wordpress/blocks';
9
+ import { useCallback } from '@wordpress/element';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { unlock } from '../../private-apis';
15
+ import { NavigationMenuLoader } from './loader';
16
+ export default function NavigationMenuContent(_ref) {
17
+ let {
18
+ rootClientId,
19
+ onSelect
20
+ } = _ref;
21
+ const {
22
+ clientIdsTree,
23
+ isLoading
24
+ } = useSelect(select => {
25
+ const {
26
+ __unstableGetClientIdsTree,
27
+ areInnerBlocksControlled
28
+ } = select(blockEditorStore);
29
+ return {
30
+ clientIdsTree: __unstableGetClientIdsTree(rootClientId),
31
+ // This is a small hack to wait for the navigation block
32
+ // to actually load its inner blocks.
33
+ isLoading: !areInnerBlocksControlled(rootClientId)
34
+ };
35
+ }, [rootClientId]);
36
+ const {
37
+ replaceBlock,
38
+ __unstableMarkNextChangeAsNotPersistent
39
+ } = useDispatch(blockEditorStore);
40
+ const {
41
+ OffCanvasEditor,
42
+ LeafMoreMenu
43
+ } = unlock(blockEditorPrivateApis);
44
+ const offCanvasOnselect = useCallback(block => {
45
+ if (block.name === 'core/navigation-link' && !block.attributes.url) {
46
+ __unstableMarkNextChangeAsNotPersistent();
47
+
48
+ replaceBlock(block.clientId, createBlock('core/navigation-link', block.attributes));
49
+ } else {
50
+ onSelect(block);
51
+ }
52
+ }, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger.
53
+ // For example a navigation page list load its items has an effect on edit to load its items.
54
+
55
+ return createElement(Fragment, null, isLoading && createElement(NavigationMenuLoader, null), !isLoading && createElement(OffCanvasEditor, {
56
+ blocks: clientIdsTree,
57
+ onSelect: offCanvasOnselect,
58
+ LeafMoreMenu: LeafMoreMenu,
59
+ showAppender: false
60
+ }), createElement("div", {
61
+ style: {
62
+ visibility: 'hidden'
63
+ }
64
+ }, createElement(BlockTools, null, createElement(BlockList, null))));
65
+ }
66
+ //# sourceMappingURL=navigation-menu-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","useDispatch","useSelect","createBlock","useCallback","unlock","NavigationMenuLoader","NavigationMenuContent","rootClientId","onSelect","clientIdsTree","isLoading","select","__unstableGetClientIdsTree","areInnerBlocksControlled","replaceBlock","__unstableMarkNextChangeAsNotPersistent","OffCanvasEditor","LeafMoreMenu","offCanvasOnselect","block","name","attributes","url","clientId","visibility"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,EAGCC,SAHD,EAICC,UAJD,QAKO,yBALP;AAMA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,oBAAT,QAAqC,UAArC;AAEA,eAAe,SAASC,qBAAT,OAA6D;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AAC3E,QAAM;AAAE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MAAAA,UAAU,EAAE;AAAd;AAAb,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAVD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { NavigationMenuLoader } from './loader';\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst { clientIdsTree, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableGetClientIdsTree, areInnerBlocksControlled } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tclientIdsTree: __unstableGetClientIdsTree( rootClientId ),\n\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tisLoading: ! areInnerBlocksControlled( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ isLoading && <NavigationMenuLoader /> }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<OffCanvasEditor\n\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div style={ { visibility: 'hidden' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}