@wordpress/edit-site 5.4.0 → 5.6.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 (339) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +12 -3
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -7
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +19 -16
  7. package/build/components/add-new-template/new-template.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 +2 -1
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +5 -7
  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 +13 -11
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/dimensions-panel.js +41 -487
  19. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  20. package/build/components/global-styles/duotone-panel.js +78 -0
  21. package/build/components/global-styles/duotone-panel.js.map +1 -0
  22. package/build/components/global-styles/filter-utils.js +17 -0
  23. package/build/components/global-styles/filter-utils.js.map +1 -0
  24. package/build/components/global-styles/hooks.js +11 -26
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/preview.js +9 -5
  27. package/build/components/global-styles/preview.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +6 -11
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-border.js +14 -6
  31. package/build/components/global-styles/screen-border.js.map +1 -1
  32. package/build/components/global-styles/screen-filters.js +46 -0
  33. package/build/components/global-styles/screen-filters.js.map +1 -0
  34. package/build/components/global-styles/screen-layout.js +13 -5
  35. package/build/components/global-styles/screen-layout.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +2 -1
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +2 -1
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/screen-variations.js +1 -1
  41. package/build/components/global-styles/screen-variations.js.map +1 -1
  42. package/build/components/global-styles/shadow-panel.js +6 -4
  43. package/build/components/global-styles/shadow-panel.js.map +1 -1
  44. package/build/components/global-styles/typography-panel.js +2 -5
  45. package/build/components/global-styles/typography-panel.js.map +1 -1
  46. package/build/components/global-styles/ui.js +7 -1
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  49. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  50. package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
  51. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  52. package/build/components/keyboard-shortcuts/global.js +48 -0
  53. package/build/components/keyboard-shortcuts/global.js.map +1 -0
  54. package/build/components/keyboard-shortcuts/index.js +67 -0
  55. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  56. package/build/components/keyboard-shortcuts/register.js +153 -0
  57. package/build/components/keyboard-shortcuts/register.js.map +1 -0
  58. package/build/components/layout/index.js +12 -1
  59. package/build/components/layout/index.js.map +1 -1
  60. package/build/components/list/added-by.js +127 -136
  61. package/build/components/list/added-by.js.map +1 -1
  62. package/build/components/list/index.js +2 -1
  63. package/build/components/list/index.js.map +1 -1
  64. package/build/components/list/table.js +9 -7
  65. package/build/components/list/table.js.map +1 -1
  66. package/build/components/routes/link.js +4 -1
  67. package/build/components/routes/link.js.map +1 -1
  68. package/build/components/save-hub/index.js +82 -0
  69. package/build/components/save-hub/index.js.map +1 -0
  70. package/build/components/save-panel/index.js +11 -1
  71. package/build/components/save-panel/index.js.map +1 -1
  72. package/build/components/sidebar/index.js +27 -17
  73. package/build/components/sidebar/index.js.map +1 -1
  74. package/build/components/sidebar-button/index.js +30 -0
  75. package/build/components/sidebar-button/index.js.map +1 -0
  76. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  77. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen/index.js +14 -11
  79. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-main/index.js +16 -16
  81. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
  83. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
  85. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  87. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  88. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  89. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  90. package/build/components/sidebar-navigation-screen-template/index.js +66 -27
  91. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  92. package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
  93. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  94. package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
  95. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  96. package/build/components/site-hub/index.js +3 -1
  97. package/build/components/site-hub/index.js.map +1 -1
  98. package/build/components/style-book/index.js +151 -21
  99. package/build/components/style-book/index.js.map +1 -1
  100. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  101. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  102. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  103. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  104. package/build/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
  105. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  106. package/build/components/template-details/index.js +5 -10
  107. package/build/components/template-details/index.js.map +1 -1
  108. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  109. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  110. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  111. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  112. package/build/components/template-part-converter/index.js +19 -14
  113. package/build/components/template-part-converter/index.js.map +1 -1
  114. package/build/components/use-edited-entity-record/index.js +6 -6
  115. package/build/components/use-edited-entity-record/index.js.map +1 -1
  116. package/build/index.js +13 -22
  117. package/build/index.js.map +1 -1
  118. package/build/store/actions.js +2 -2
  119. package/build/store/actions.js.map +1 -1
  120. package/build/utils/get-is-list-page.js +1 -1
  121. package/build/utils/get-is-list-page.js.map +1 -1
  122. package/build/utils/history.js +8 -2
  123. package/build/utils/history.js.map +1 -1
  124. package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
  125. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  126. package/build-module/components/add-new-template/new-template-part.js +8 -7
  127. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  128. package/build-module/components/add-new-template/new-template.js +21 -17
  129. package/build-module/components/add-new-template/new-template.js.map +1 -1
  130. package/build-module/components/app/index.js +3 -2
  131. package/build-module/components/app/index.js.map +1 -1
  132. package/build-module/components/block-editor/editor-canvas.js +2 -1
  133. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  134. package/build-module/components/editor/index.js +5 -6
  135. package/build-module/components/editor/index.js.map +1 -1
  136. package/build-module/components/global-styles/border-panel.js +21 -157
  137. package/build-module/components/global-styles/border-panel.js.map +1 -1
  138. package/build-module/components/global-styles/context-menu.js +14 -11
  139. package/build-module/components/global-styles/context-menu.js.map +1 -1
  140. package/build-module/components/global-styles/dimensions-panel.js +43 -480
  141. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  142. package/build-module/components/global-styles/duotone-panel.js +67 -0
  143. package/build-module/components/global-styles/duotone-panel.js.map +1 -0
  144. package/build-module/components/global-styles/filter-utils.js +9 -0
  145. package/build-module/components/global-styles/filter-utils.js.map +1 -0
  146. package/build-module/components/global-styles/hooks.js +11 -26
  147. package/build-module/components/global-styles/hooks.js.map +1 -1
  148. package/build-module/components/global-styles/preview.js +10 -6
  149. package/build-module/components/global-styles/preview.js.map +1 -1
  150. package/build-module/components/global-styles/screen-block-list.js +6 -8
  151. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  152. package/build-module/components/global-styles/screen-border.js +12 -3
  153. package/build-module/components/global-styles/screen-border.js.map +1 -1
  154. package/build-module/components/global-styles/screen-filters.js +33 -0
  155. package/build-module/components/global-styles/screen-filters.js.map +1 -0
  156. package/build-module/components/global-styles/screen-layout.js +11 -2
  157. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  158. package/build-module/components/global-styles/screen-root.js +2 -1
  159. package/build-module/components/global-styles/screen-root.js.map +1 -1
  160. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  161. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  162. package/build-module/components/global-styles/screen-variations.js +1 -1
  163. package/build-module/components/global-styles/screen-variations.js.map +1 -1
  164. package/build-module/components/global-styles/shadow-panel.js +6 -4
  165. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  166. package/build-module/components/global-styles/typography-panel.js +2 -5
  167. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  168. package/build-module/components/global-styles/ui.js +6 -1
  169. package/build-module/components/global-styles/ui.js.map +1 -1
  170. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  172. package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
  173. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  174. package/build-module/components/keyboard-shortcuts/global.js +37 -0
  175. package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
  176. package/build-module/components/keyboard-shortcuts/index.js +65 -0
  177. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  178. package/build-module/components/keyboard-shortcuts/register.js +141 -0
  179. package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
  180. package/build-module/components/layout/index.js +10 -1
  181. package/build-module/components/layout/index.js.map +1 -1
  182. package/build-module/components/list/added-by.js +126 -138
  183. package/build-module/components/list/added-by.js.map +1 -1
  184. package/build-module/components/list/index.js +2 -1
  185. package/build-module/components/list/index.js.map +1 -1
  186. package/build-module/components/list/table.js +9 -7
  187. package/build-module/components/list/table.js.map +1 -1
  188. package/build-module/components/routes/link.js +5 -2
  189. package/build-module/components/routes/link.js.map +1 -1
  190. package/build-module/components/save-hub/index.js +68 -0
  191. package/build-module/components/save-hub/index.js.map +1 -0
  192. package/build-module/components/save-panel/index.js +8 -1
  193. package/build-module/components/save-panel/index.js.map +1 -1
  194. package/build-module/components/sidebar/index.js +24 -19
  195. package/build-module/components/sidebar/index.js.map +1 -1
  196. package/build-module/components/sidebar-button/index.js +18 -0
  197. package/build-module/components/sidebar-button/index.js.map +1 -0
  198. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  199. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen/index.js +12 -12
  201. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  202. package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
  203. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
  205. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +91 -14
  207. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  209. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  210. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  211. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  212. package/build-module/components/sidebar-navigation-screen-template/index.js +67 -30
  213. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
  215. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  216. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
  217. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  218. package/build-module/components/site-hub/index.js +3 -1
  219. package/build-module/components/site-hub/index.js.map +1 -1
  220. package/build-module/components/style-book/index.js +152 -25
  221. package/build-module/components/style-book/index.js.map +1 -1
  222. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  223. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  224. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  225. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  226. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
  227. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  228. package/build-module/components/template-details/index.js +5 -9
  229. package/build-module/components/template-details/index.js.map +1 -1
  230. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  231. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  232. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  233. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  234. package/build-module/components/template-part-converter/index.js +20 -15
  235. package/build-module/components/template-part-converter/index.js.map +1 -1
  236. package/build-module/components/use-edited-entity-record/index.js +6 -6
  237. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  238. package/build-module/index.js +16 -23
  239. package/build-module/index.js.map +1 -1
  240. package/build-module/store/actions.js +2 -2
  241. package/build-module/store/actions.js.map +1 -1
  242. package/build-module/utils/get-is-list-page.js +1 -1
  243. package/build-module/utils/get-is-list-page.js.map +1 -1
  244. package/build-module/utils/history.js +9 -3
  245. package/build-module/utils/history.js.map +1 -1
  246. package/build-style/style-rtl.css +203 -143
  247. package/build-style/style.css +203 -143
  248. package/package.json +31 -31
  249. package/src/components/add-new-template/add-custom-template-modal.js +14 -10
  250. package/src/components/add-new-template/new-template-part.js +7 -9
  251. package/src/components/add-new-template/new-template.js +60 -38
  252. package/src/components/add-new-template/style.scss +12 -6
  253. package/src/components/app/index.js +9 -6
  254. package/src/components/block-editor/editor-canvas.js +2 -1
  255. package/src/components/block-editor/style.scss +1 -1
  256. package/src/components/editor/index.js +62 -65
  257. package/src/components/editor/style.scss +0 -6
  258. package/src/components/global-styles/border-panel.js +24 -199
  259. package/src/components/global-styles/context-menu.js +18 -12
  260. package/src/components/global-styles/dimensions-panel.js +43 -577
  261. package/src/components/global-styles/duotone-panel.js +82 -0
  262. package/src/components/global-styles/filter-utils.js +9 -0
  263. package/src/components/global-styles/hooks.js +12 -36
  264. package/src/components/global-styles/preview.js +155 -140
  265. package/src/components/global-styles/screen-block-list.js +6 -11
  266. package/src/components/global-styles/screen-border.js +10 -3
  267. package/src/components/global-styles/screen-filters.js +27 -0
  268. package/src/components/global-styles/screen-layout.js +9 -2
  269. package/src/components/global-styles/screen-root.js +1 -1
  270. package/src/components/global-styles/screen-style-variations.js +5 -1
  271. package/src/components/global-styles/screen-variations.js +0 -1
  272. package/src/components/global-styles/shadow-panel.js +4 -3
  273. package/src/components/global-styles/style.scss +10 -0
  274. package/src/components/global-styles/typography-panel.js +5 -7
  275. package/src/components/global-styles/ui.js +6 -1
  276. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  277. package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
  278. package/src/components/keyboard-shortcuts/global.js +35 -0
  279. package/src/components/keyboard-shortcuts/index.js +70 -0
  280. package/src/components/keyboard-shortcuts/register.js +157 -0
  281. package/src/components/layout/index.js +19 -0
  282. package/src/components/layout/style.scss +9 -4
  283. package/src/components/list/added-by.js +152 -155
  284. package/src/components/list/index.js +3 -1
  285. package/src/components/list/style.scss +5 -13
  286. package/src/components/list/table.js +11 -9
  287. package/src/components/routes/link.js +9 -2
  288. package/src/components/save-hub/index.js +78 -0
  289. package/src/components/save-hub/style.scss +15 -0
  290. package/src/components/save-panel/index.js +8 -1
  291. package/src/components/sidebar/index.js +33 -16
  292. package/src/components/sidebar/style.scss +4 -3
  293. package/src/components/sidebar-button/index.js +21 -0
  294. package/src/components/sidebar-button/style.scss +24 -0
  295. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
  296. package/src/components/sidebar-edit-mode/style.scss +16 -0
  297. package/src/components/sidebar-navigation-item/style.scss +1 -23
  298. package/src/components/sidebar-navigation-screen/index.js +37 -38
  299. package/src/components/sidebar-navigation-screen/style.scss +16 -9
  300. package/src/components/sidebar-navigation-screen-main/index.js +24 -11
  301. package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
  302. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
  303. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  304. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  305. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  306. package/src/components/sidebar-navigation-screen-template/index.js +89 -30
  307. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  308. package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
  309. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
  310. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
  311. package/src/components/site-hub/index.js +5 -1
  312. package/src/components/site-hub/style.scss +5 -1
  313. package/src/components/style-book/index.js +234 -55
  314. package/src/components/style-book/style.scss +1 -45
  315. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
  316. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  317. package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
  318. package/src/components/template-details/index.js +4 -8
  319. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  320. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  321. package/src/components/template-part-converter/index.js +28 -12
  322. package/src/components/use-edited-entity-record/index.js +26 -18
  323. package/src/index.js +11 -22
  324. package/src/store/actions.js +2 -2
  325. package/src/store/test/actions.js +0 -2
  326. package/src/style.scss +3 -1
  327. package/src/utils/get-is-list-page.js +1 -1
  328. package/src/utils/history.js +13 -9
  329. package/build/components/navigation-inspector/index.js +0 -161
  330. package/build/components/navigation-inspector/index.js.map +0 -1
  331. package/build/components/navigation-inspector/navigation-menu.js +0 -62
  332. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  333. package/build-module/components/navigation-inspector/index.js +0 -146
  334. package/build-module/components/navigation-inspector/index.js.map +0 -1
  335. package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
  336. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  337. package/src/components/navigation-inspector/index.js +0 -191
  338. package/src/components/navigation-inspector/navigation-menu.js +0 -66
  339. package/src/components/navigation-inspector/style.scss +0 -46
@@ -0,0 +1,21 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { Button } from '@wordpress/components';
10
+
11
+ export default function SidebarButton( props ) {
12
+ return (
13
+ <Button
14
+ { ...props }
15
+ className={ classnames(
16
+ 'edit-site-sidebar-button',
17
+ props.className
18
+ ) }
19
+ />
20
+ );
21
+ }
@@ -0,0 +1,24 @@
1
+ .edit-site-sidebar-button {
2
+ color: $gray-200;
3
+ flex-shrink: 0;
4
+
5
+ // Focus (resets default button focus and use focus-visible).
6
+ &:focus:not(:disabled) {
7
+ box-shadow: none;
8
+ outline: none;
9
+ }
10
+ &:focus-visible:not(:disabled) {
11
+ box-shadow:
12
+ 0 0 0 var(--wp-admin-border-width-focus)
13
+ var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
14
+ outline: 3px solid transparent;
15
+ }
16
+
17
+ &:hover,
18
+ &:focus-visible,
19
+ &:focus,
20
+ &:not([aria-disabled="true"]):active,
21
+ &[aria-expanded="true"] {
22
+ color: $white;
23
+ }
24
+ }
@@ -37,18 +37,14 @@ export default function GlobalStylesSidebar() {
37
37
  closeLabel={ __( 'Close Styles sidebar' ) }
38
38
  panelClassName="edit-site-global-styles-sidebar__panel"
39
39
  header={
40
- <Flex>
41
- <FlexBlock>
40
+ <Flex className="edit-site-global-styles-sidebar__header">
41
+ <FlexBlock style={ { minWidth: 'min-content' } }>
42
42
  <strong>{ __( 'Styles' ) }</strong>
43
43
  </FlexBlock>
44
44
  <FlexItem>
45
45
  <Button
46
46
  icon={ seen }
47
- label={
48
- isStyleBookOpened
49
- ? __( 'Close Style Book' )
50
- : __( 'Open Style Book' )
51
- }
47
+ label={ __( 'Style Book' ) }
52
48
  isPressed={ isStyleBookOpened }
53
49
  disabled={ editorMode !== 'visual' }
54
50
  onClick={ () => {
@@ -83,3 +83,19 @@
83
83
  .edit-site-global-styles-sidebar hr {
84
84
  margin: 0;
85
85
  }
86
+
87
+ .show-icon-labels {
88
+ .edit-site-global-styles-sidebar__header {
89
+ .components-button.has-icon {
90
+ // Hide the button icons when labels are set to display...
91
+ svg {
92
+ display: none;
93
+ }
94
+ // ... and display labels.
95
+ &::after {
96
+ content: attr(aria-label);
97
+ font-size: $helptext-font-size;
98
+ }
99
+ }
100
+ }
101
+ }
@@ -1,13 +1,12 @@
1
1
  .edit-site-sidebar-navigation-item.components-item {
2
2
  color: $gray-600;
3
- border-width: $border-width-tab;
3
+ margin: 0 $grid-unit-05;
4
4
 
5
5
  &:hover,
6
6
  &:focus,
7
7
  &[aria-current] {
8
8
  color: $white;
9
9
  background: $gray-800;
10
- border-width: $border-width-tab;
11
10
  }
12
11
 
13
12
  &[aria-current] {
@@ -15,28 +14,7 @@
15
14
  }
16
15
  }
17
16
 
18
- .edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .components-button {
19
- color: $gray-600;
20
- &:hover,
21
- &:focus,
22
- &[aria-current] {
23
- color: $white;
24
- }
25
- }
26
-
27
- .edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .offcanvas-editor-list-view-leaf {
28
- &:hover,
29
- &:focus,
30
- &[aria-current] {
31
- background: $gray-800;
32
- }
33
- .block-editor-list-view-block__menu {
34
- margin-left: -$grid-unit-10;
35
- }
36
- }
37
-
38
17
  .edit-site-sidebar-navigation-screen__content .block-editor-list-view-block-select-button {
39
18
  cursor: grab;
40
- width: calc(100% - #{ $border-width-focus });
41
19
  padding: $grid-unit-10;
42
20
  }
@@ -5,8 +5,6 @@ import {
5
5
  __experimentalHStack as HStack,
6
6
  __experimentalVStack as VStack,
7
7
  __experimentalNavigatorToParentButton as NavigatorToParentButton,
8
- Button,
9
- __experimentalNavigatorScreen as NavigatorScreen,
10
8
  } from '@wordpress/components';
11
9
  import { isRTL, __ } from '@wordpress/i18n';
12
10
  import { chevronRight, chevronLeft } from '@wordpress/icons';
@@ -17,12 +15,14 @@ import { useSelect } from '@wordpress/data';
17
15
  */
18
16
  import { store as editSiteStore } from '../../store';
19
17
  import { unlock } from '../../private-apis';
18
+ import SidebarButton from '../sidebar-button';
20
19
 
21
20
  export default function SidebarNavigationScreen( {
22
- path,
21
+ isRoot,
23
22
  title,
24
23
  actions,
25
24
  content,
25
+ description,
26
26
  } ) {
27
27
  const { dashboardLink } = useSelect( ( select ) => {
28
28
  const { getSettings } = unlock( select( editSiteStore ) );
@@ -32,41 +32,40 @@ export default function SidebarNavigationScreen( {
32
32
  }, [] );
33
33
 
34
34
  return (
35
- <NavigatorScreen
36
- className="edit-site-sidebar-navigation-screen"
37
- path={ path }
38
- >
39
- <VStack spacing={ 2 }>
40
- <HStack
41
- spacing={ 4 }
42
- justify="flex-start"
43
- className="edit-site-sidebar-navigation-screen__title-icon"
44
- >
45
- { path !== '/' ? (
46
- <NavigatorToParentButton
47
- className="edit-site-sidebar-navigation-screen__back"
48
- icon={ isRTL() ? chevronRight : chevronLeft }
49
- aria-label={ __( 'Back' ) }
50
- />
51
- ) : (
52
- <Button
53
- className="edit-site-sidebar-navigation-screen__back"
54
- icon={ isRTL() ? chevronRight : chevronLeft }
55
- aria-label={ __( 'Navigate to the Dashboard' ) }
56
- href={ dashboardLink || 'index.php' }
57
- label={ __( 'Dashboard' ) }
58
- />
59
- ) }
60
- <h2 className="edit-site-sidebar-navigation-screen__title">
61
- { title }
62
- </h2>
63
- { actions }
64
- </HStack>
35
+ <VStack spacing={ 2 }>
36
+ <HStack
37
+ spacing={ 4 }
38
+ justify="flex-start"
39
+ className="edit-site-sidebar-navigation-screen__title-icon"
40
+ >
41
+ { ! isRoot ? (
42
+ <NavigatorToParentButton
43
+ as={ SidebarButton }
44
+ icon={ isRTL() ? chevronRight : chevronLeft }
45
+ aria-label={ __( 'Back' ) }
46
+ />
47
+ ) : (
48
+ <SidebarButton
49
+ icon={ isRTL() ? chevronRight : chevronLeft }
50
+ aria-label={ __( 'Navigate to the Dashboard' ) }
51
+ href={ dashboardLink || 'index.php' }
52
+ label={ __( 'Dashboard' ) }
53
+ />
54
+ ) }
55
+ <h2 className="edit-site-sidebar-navigation-screen__title">
56
+ { title }
57
+ </h2>
58
+ { actions }
59
+ </HStack>
65
60
 
66
- <nav className="edit-site-sidebar-navigation-screen__content">
67
- { content }
68
- </nav>
69
- </VStack>
70
- </NavigatorScreen>
61
+ <nav className="edit-site-sidebar-navigation-screen__content">
62
+ { description && (
63
+ <p className="edit-site-sidebar-navigation-screen__description">
64
+ { description }
65
+ </p>
66
+ ) }
67
+ { content }
68
+ </nav>
69
+ </VStack>
71
70
  );
72
71
  }
@@ -10,6 +10,21 @@
10
10
  color: $gray-600;
11
11
  }
12
12
 
13
+ .edit-site-sidebar-navigation-screen__page-link {
14
+ color: $gray-600;
15
+
16
+ &:hover,
17
+ &:focus {
18
+ color: $white;
19
+ }
20
+
21
+ .components-external-link__icon {
22
+ margin-left: $grid-unit-05;
23
+ }
24
+ margin-left: $grid-unit-20;
25
+ display: inline-block;
26
+ }
27
+
13
28
  .edit-site-sidebar-navigation-screen__title-icon {
14
29
  position: sticky;
15
30
  top: 0;
@@ -23,17 +38,9 @@
23
38
 
24
39
  .edit-site-sidebar-navigation-screen__title {
25
40
  font-size: calc(1.56 * 13px);
41
+ line-height: normal;
26
42
  font-weight: 500;
27
43
  flex-grow: 1;
28
44
  color: $white;
29
45
  margin: 0;
30
46
  }
31
-
32
- .edit-site-sidebar-navigation-screen__back {
33
- color: $gray-200;
34
-
35
- &:hover,
36
- &:not([aria-disabled="true"]):active {
37
- color: $white;
38
- }
39
- }
@@ -17,23 +17,36 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
17
17
  import SidebarNavigationItem from '../sidebar-navigation-item';
18
18
 
19
19
  export default function SidebarNavigationScreenMain() {
20
- const { navigationMenus } = useSelect( ( select ) => {
21
- const { getEntityRecords } = select( coreStore );
22
- return {
23
- navigationMenus: getEntityRecords( 'postType', 'wp_navigation', {
24
- per_page: -1,
20
+ const hasNavigationMenus = useSelect( ( select ) => {
21
+ // The query needs to be the same as in the "SidebarNavigationScreenNavigationMenus" component,
22
+ // to avoid double network calls.
23
+ const navigationMenus = select( coreStore ).getEntityRecords(
24
+ 'postType',
25
+ 'wp_navigation',
26
+ {
27
+ per_page: 1,
25
28
  status: 'publish',
26
- } ),
27
- };
29
+ order: 'desc',
30
+ orderby: 'date',
31
+ }
32
+ );
33
+
34
+ return navigationMenus?.length > 0;
28
35
  } );
29
36
 
37
+ const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN
38
+ ? hasNavigationMenus
39
+ : false;
30
40
  return (
31
41
  <SidebarNavigationScreen
32
- path="/"
42
+ isRoot
33
43
  title={ __( 'Design' ) }
44
+ description={ __(
45
+ 'Customize the appearance of your website using the block editor.'
46
+ ) }
34
47
  content={
35
48
  <ItemGroup>
36
- { !! navigationMenus && navigationMenus.length > 0 && (
49
+ { showNavigationScreen && (
37
50
  <NavigatorButton
38
51
  as={ SidebarNavigationItem }
39
52
  path="/navigation"
@@ -45,7 +58,7 @@ export default function SidebarNavigationScreenMain() {
45
58
  ) }
46
59
  <NavigatorButton
47
60
  as={ SidebarNavigationItem }
48
- path="/templates"
61
+ path="/wp_template"
49
62
  withChevron
50
63
  icon={ layout }
51
64
  >
@@ -53,7 +66,7 @@ export default function SidebarNavigationScreenMain() {
53
66
  </NavigatorButton>
54
67
  <NavigatorButton
55
68
  as={ SidebarNavigationItem }
56
- path="/template-parts"
69
+ path="/wp_template_part"
57
70
  withChevron
58
71
  icon={ symbolFilled }
59
72
  >
@@ -2,10 +2,14 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { useDispatch, useSelect } from '@wordpress/data';
6
- import { Button } from '@wordpress/components';
7
- import { store as coreStore } from '@wordpress/core-data';
5
+ import { useDispatch } from '@wordpress/data';
6
+ import {
7
+ __experimentalUseNavigator as useNavigator,
8
+ ExternalLink,
9
+ } from '@wordpress/components';
10
+ import { useEntityRecord } from '@wordpress/core-data';
8
11
  import { decodeEntities } from '@wordpress/html-entities';
12
+ import { pencil } from '@wordpress/icons';
9
13
 
10
14
  /**
11
15
  * Internal dependencies
@@ -13,39 +17,48 @@ import { decodeEntities } from '@wordpress/html-entities';
13
17
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
14
18
  import { unlock } from '../../private-apis';
15
19
  import { store as editSiteStore } from '../../store';
20
+ import SidebarButton from '../sidebar-button';
16
21
 
17
22
  export default function SidebarNavigationScreenNavigationItem() {
18
23
  const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
19
-
20
- const { post } = useSelect( ( select ) => {
21
- const { getEditedPostContext } = select( editSiteStore );
22
- const { getEntityRecord } = select( coreStore );
23
- const { postType, postId } = getEditedPostContext() ?? {};
24
-
25
- // The currently selected entity to display.
26
- // Typically template or template part in the site editor.
27
- return {
28
- post:
29
- postId && postType
30
- ? getEntityRecord( 'postType', postType, postId )
31
- : null,
32
- };
33
- }, [] );
24
+ const {
25
+ params: { postType, postId },
26
+ } = useNavigator();
27
+ const { record } = useEntityRecord( 'postType', postType, postId );
34
28
 
35
29
  return (
36
30
  <SidebarNavigationScreen
37
- path="/navigation/single"
38
- title={ post ? decodeEntities( post?.title?.rendered ) : null }
31
+ title={ record ? decodeEntities( record?.title?.rendered ) : null }
39
32
  actions={
40
- <Button
41
- variant="primary"
33
+ <SidebarButton
42
34
  onClick={ () => setCanvasMode( 'edit' ) }
43
- >
44
- { __( 'Edit' ) }
45
- </Button>
35
+ label={ __( 'Edit' ) }
36
+ icon={ pencil }
37
+ />
38
+ }
39
+ description={
40
+ postType === 'page'
41
+ ? __(
42
+ 'Pages are static and are not listed by date. Pages do not use tags or categories.'
43
+ )
44
+ : __(
45
+ 'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'
46
+ )
46
47
  }
47
48
  content={
48
- post ? decodeEntities( post?.description?.rendered ) : null
49
+ <>
50
+ { record?.link ? (
51
+ <ExternalLink
52
+ className="edit-site-sidebar-navigation-screen__page-link"
53
+ href={ record.link }
54
+ >
55
+ { record.link }
56
+ </ExternalLink>
57
+ ) : null }
58
+ { record
59
+ ? decodeEntities( record?.description?.rendered )
60
+ : null }
61
+ </>
49
62
  }
50
63
  />
51
64
  );
@@ -2,20 +2,79 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { useCallback } from '@wordpress/element';
5
+ import { useCallback, useMemo } from '@wordpress/element';
6
+ import { useSelect } from '@wordpress/data';
7
+ import { store as coreStore } from '@wordpress/core-data';
8
+ import { BlockEditorProvider } from '@wordpress/block-editor';
9
+ import { createBlock } from '@wordpress/blocks';
6
10
 
7
11
  /**
8
12
  * Internal dependencies
9
13
  */
10
14
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
11
- import NavigationInspector from '../navigation-inspector';
12
15
  import { useHistory } from '../routes';
16
+ import NavigationMenuContent from './navigation-menu-content';
17
+ import { NavigationMenuLoader } from './loader';
18
+ import { unlock } from '../../private-apis';
19
+ import { store as editSiteStore } from '../../store';
20
+
21
+ const noop = () => {};
22
+ const NAVIGATION_MENUS_QUERY = {
23
+ per_page: 1,
24
+ status: 'publish',
25
+ order: 'desc',
26
+ orderby: 'date',
27
+ };
28
+
29
+ function SidebarNavigationScreenWrapper( { children, actions } ) {
30
+ return (
31
+ <SidebarNavigationScreen
32
+ title={ __( 'Navigation' ) }
33
+ actions={ actions }
34
+ description={ __(
35
+ 'Browse your site, edit pages, and manage your primary navigation menu.'
36
+ ) }
37
+ content={ children }
38
+ />
39
+ );
40
+ }
13
41
 
14
42
  export default function SidebarNavigationScreenNavigationMenus() {
15
43
  const history = useHistory();
44
+ const { navigationMenus, hasResolvedNavigationMenus, storedSettings } =
45
+ useSelect( ( select ) => {
46
+ const { getSettings } = unlock( select( editSiteStore ) );
47
+ const { getEntityRecords, hasFinishedResolution } =
48
+ select( coreStore );
49
+
50
+ const navigationMenusQuery = [
51
+ 'postType',
52
+ 'wp_navigation',
53
+ NAVIGATION_MENUS_QUERY,
54
+ ];
55
+ return {
56
+ storedSettings: getSettings( false ),
57
+ navigationMenus: getEntityRecords( ...navigationMenusQuery ),
58
+ hasResolvedNavigationMenus: hasFinishedResolution(
59
+ 'getEntityRecords',
60
+ navigationMenusQuery
61
+ ),
62
+ };
63
+ }, [] );
64
+
65
+ const firstNavigationMenu = navigationMenus?.[ 0 ]?.id;
66
+ const blocks = useMemo( () => {
67
+ return [
68
+ createBlock( 'core/navigation', { ref: firstNavigationMenu } ),
69
+ ];
70
+ }, [ firstNavigationMenu ] );
71
+
72
+ const isLoading = ! hasResolvedNavigationMenus;
73
+ const hasNavigationMenus = !! navigationMenus?.length;
74
+
16
75
  const onSelect = useCallback(
17
76
  ( selectedBlock ) => {
18
- const { attributes } = selectedBlock;
77
+ const { attributes, name } = selectedBlock;
19
78
  if (
20
79
  attributes.kind === 'post-type' &&
21
80
  attributes.id &&
@@ -25,21 +84,49 @@ export default function SidebarNavigationScreenNavigationMenus() {
25
84
  history.push( {
26
85
  postType: attributes.type,
27
86
  postId: attributes.id,
28
- path: '/navigation/single',
87
+ } );
88
+ }
89
+ if ( name === 'core/page-list-item' && attributes.id && history ) {
90
+ history.push( {
91
+ postType: 'page',
92
+ postId: attributes.id,
29
93
  } );
30
94
  }
31
95
  },
32
96
  [ history ]
33
97
  );
98
+
99
+ if ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {
100
+ return (
101
+ <SidebarNavigationScreenWrapper>
102
+ { __( 'There are no Navigation Menus.' ) }
103
+ </SidebarNavigationScreenWrapper>
104
+ );
105
+ }
106
+
107
+ if ( ! hasResolvedNavigationMenus || isLoading ) {
108
+ return (
109
+ <SidebarNavigationScreenWrapper>
110
+ <NavigationMenuLoader />
111
+ </SidebarNavigationScreenWrapper>
112
+ );
113
+ }
114
+
34
115
  return (
35
- <SidebarNavigationScreen
36
- path="/navigation"
37
- title={ __( 'Navigation' ) }
38
- content={
39
- <div className="edit-site-sidebar-navigation-screen-navigation-menus">
40
- <NavigationInspector onSelect={ onSelect } />
116
+ <BlockEditorProvider
117
+ settings={ storedSettings }
118
+ value={ blocks }
119
+ onChange={ noop }
120
+ onInput={ noop }
121
+ >
122
+ <SidebarNavigationScreenWrapper>
123
+ <div className="edit-site-sidebar-navigation-screen-navigation-menus__content">
124
+ <NavigationMenuContent
125
+ rootClientId={ blocks[ 0 ].clientId }
126
+ onSelect={ onSelect }
127
+ />
41
128
  </div>
42
- }
43
- />
129
+ </SidebarNavigationScreenWrapper>
130
+ </BlockEditorProvider>
44
131
  );
45
132
  }
@@ -0,0 +1,9 @@
1
+ export function NavigationMenuLoader() {
2
+ return (
3
+ <>
4
+ <div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
5
+ <div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
6
+ <div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
7
+ </>
8
+ );
9
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ privateApis as blockEditorPrivateApis,
6
+ store as blockEditorStore,
7
+ BlockList,
8
+ BlockTools,
9
+ } from '@wordpress/block-editor';
10
+ import { useDispatch, useSelect } from '@wordpress/data';
11
+ import { createBlock } from '@wordpress/blocks';
12
+ import { useCallback } from '@wordpress/element';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import { unlock } from '../../private-apis';
18
+ import { NavigationMenuLoader } from './loader';
19
+
20
+ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
21
+ const { clientIdsTree, isLoading } = useSelect(
22
+ ( select ) => {
23
+ const { __unstableGetClientIdsTree, areInnerBlocksControlled } =
24
+ select( blockEditorStore );
25
+ return {
26
+ clientIdsTree: __unstableGetClientIdsTree( rootClientId ),
27
+
28
+ // This is a small hack to wait for the navigation block
29
+ // to actually load its inner blocks.
30
+ isLoading: ! areInnerBlocksControlled( rootClientId ),
31
+ };
32
+ },
33
+ [ rootClientId ]
34
+ );
35
+ const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =
36
+ useDispatch( blockEditorStore );
37
+
38
+ const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
39
+
40
+ const offCanvasOnselect = useCallback(
41
+ ( block ) => {
42
+ if (
43
+ block.name === 'core/navigation-link' &&
44
+ ! block.attributes.url
45
+ ) {
46
+ __unstableMarkNextChangeAsNotPersistent();
47
+ replaceBlock(
48
+ block.clientId,
49
+ createBlock( 'core/navigation-link', block.attributes )
50
+ );
51
+ } else {
52
+ onSelect( block );
53
+ }
54
+ },
55
+ [ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]
56
+ );
57
+
58
+ // The hidden block is needed because it makes block edit side effects trigger.
59
+ // For example a navigation page list load its items has an effect on edit to load its items.
60
+ return (
61
+ <>
62
+ { isLoading && <NavigationMenuLoader /> }
63
+ { ! isLoading && (
64
+ <OffCanvasEditor
65
+ blocks={ clientIdsTree }
66
+ onSelect={ offCanvasOnselect }
67
+ LeafMoreMenu={ LeafMoreMenu }
68
+ showAppender={ false }
69
+ />
70
+ ) }
71
+ <div style={ { visibility: 'hidden' } }>
72
+ <BlockTools>
73
+ <BlockList />
74
+ </BlockTools>
75
+ </div>
76
+ </>
77
+ );
78
+ }