@wordpress/edit-site 5.9.0 → 5.11.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 (545) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
  3. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  4. package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +32 -27
  5. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  6. package/build/components/add-new-template/new-template-part.js +8 -2
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +104 -68
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +8 -2
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/back-button.js +10 -3
  13. package/build/components/block-editor/back-button.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +39 -6
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +1 -3
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/create-template-part-modal/index.js +6 -7
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +20 -11
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/editor-canvas-container/index.js +27 -6
  23. package/build/components/editor-canvas-container/index.js.map +1 -1
  24. package/build/components/global-styles/block-preview-panel.js +1 -1
  25. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  26. package/build/components/global-styles/color-palette-panel.js +14 -3
  27. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  28. package/build/components/global-styles/dimensions-panel.js +17 -18
  29. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  30. package/build/components/global-styles/gradients-palette-panel.js +14 -3
  31. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/root-menu.js +61 -0
  33. package/build/components/global-styles/root-menu.js.map +1 -0
  34. package/build/components/global-styles/screen-block-list.js +3 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +235 -7
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-colors.js +9 -26
  39. package/build/components/global-styles/screen-colors.js.map +1 -1
  40. package/build/components/global-styles/screen-css.js +20 -15
  41. package/build/components/global-styles/screen-css.js.map +1 -1
  42. package/build/components/global-styles/screen-layout.js +4 -17
  43. package/build/components/global-styles/screen-layout.js.map +1 -1
  44. package/build/components/global-styles/screen-revisions/index.js +141 -0
  45. package/build/components/global-styles/screen-revisions/index.js.map +1 -0
  46. package/build/components/global-styles/screen-revisions/revisions-buttons.js +130 -0
  47. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  48. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +121 -0
  49. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  50. package/build/components/global-styles/screen-root.js +6 -6
  51. package/build/components/global-styles/screen-root.js.map +1 -1
  52. package/build/components/global-styles/screen-typography-element.js +0 -3
  53. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +11 -39
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +9 -18
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-panel.js +7 -11
  59. package/build/components/global-styles/typography-panel.js.map +1 -1
  60. package/build/components/global-styles/ui.js +70 -117
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations-panel.js +4 -28
  63. package/build/components/global-styles/variations-panel.js.map +1 -1
  64. package/build/components/header-edit-mode/document-actions/index.js +28 -103
  65. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  66. package/build/components/header-edit-mode/index.js +15 -2
  67. package/build/components/header-edit-mode/index.js.map +1 -1
  68. package/build/components/keyboard-shortcuts/register.js +1 -1
  69. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  70. package/build/components/layout/hooks.js +54 -0
  71. package/build/components/layout/hooks.js.map +1 -0
  72. package/build/components/layout/index.js +57 -104
  73. package/build/components/layout/index.js.map +1 -1
  74. package/build/components/list/actions/index.js +5 -2
  75. package/build/components/list/actions/index.js.map +1 -1
  76. package/build/components/list/index.js +9 -3
  77. package/build/components/list/index.js.map +1 -1
  78. package/build/components/list/table.js +1 -1
  79. package/build/components/list/table.js.map +1 -1
  80. package/build/components/plugin-template-setting-panel/index.js +44 -0
  81. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  82. package/build/components/resizable-frame/index.js +242 -0
  83. package/build/components/resizable-frame/index.js.map +1 -0
  84. package/build/components/revisions/index.js +96 -0
  85. package/build/components/revisions/index.js.map +1 -0
  86. package/build/components/routes/link.js +17 -2
  87. package/build/components/routes/link.js.map +1 -1
  88. package/build/components/routes/use-title.js +8 -2
  89. package/build/components/routes/use-title.js.map +1 -1
  90. package/build/components/save-button/index.js +31 -6
  91. package/build/components/save-button/index.js.map +1 -1
  92. package/build/components/save-hub/index.js +14 -31
  93. package/build/components/save-hub/index.js.map +1 -1
  94. package/build/components/save-panel/index.js +20 -7
  95. package/build/components/save-panel/index.js.map +1 -1
  96. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -10
  97. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  98. package/build/components/sidebar/index.js +19 -5
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +9 -2
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  105. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  106. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  107. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  108. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  109. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-item/index.js +5 -7
  111. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen/index.js +14 -4
  113. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
  115. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-main/index.js +31 -23
  117. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  119. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
  121. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  122. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
  123. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  124. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +55 -93
  125. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
  127. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  128. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
  129. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
  131. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  132. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  133. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  135. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  136. package/build/components/sidebar-navigation-screen-templates/index.js +39 -12
  137. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  138. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  139. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  140. package/build/components/site-hub/index.js +34 -6
  141. package/build/components/site-hub/index.js.map +1 -1
  142. package/build/components/start-template-options/index.js +12 -16
  143. package/build/components/start-template-options/index.js.map +1 -1
  144. package/build/components/style-book/index.js +93 -19
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  149. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  151. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  152. package/build/components/use-edited-entity-record/index.js +8 -4
  153. package/build/components/use-edited-entity-record/index.js.map +1 -1
  154. package/build/hooks/commands/use-edit-mode-commands.js +105 -0
  155. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
  156. package/build/hooks/template-part-edit.js +8 -2
  157. package/build/hooks/template-part-edit.js.map +1 -1
  158. package/build/index.js +8 -0
  159. package/build/index.js.map +1 -1
  160. package/build/store/actions.js +5 -3
  161. package/build/store/actions.js.map +1 -1
  162. package/build/utils/is-previewing-theme.js +27 -0
  163. package/build/utils/is-previewing-theme.js.map +1 -0
  164. package/build/utils/use-activate-theme.js +46 -0
  165. package/build/utils/use-activate-theme.js.map +1 -0
  166. package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
  167. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  168. package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +34 -28
  169. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  170. package/build-module/components/add-new-template/new-template-part.js +5 -1
  171. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  172. package/build-module/components/add-new-template/new-template.js +102 -68
  173. package/build-module/components/add-new-template/new-template.js.map +1 -1
  174. package/build-module/components/app/index.js +6 -2
  175. package/build-module/components/app/index.js.map +1 -1
  176. package/build-module/components/block-editor/back-button.js +6 -1
  177. package/build-module/components/block-editor/back-button.js.map +1 -1
  178. package/build-module/components/block-editor/editor-canvas.js +37 -6
  179. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  180. package/build-module/components/block-editor/index.js +1 -3
  181. package/build-module/components/block-editor/index.js.map +1 -1
  182. package/build-module/components/create-template-part-modal/index.js +7 -8
  183. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  184. package/build-module/components/editor/index.js +18 -11
  185. package/build-module/components/editor/index.js.map +1 -1
  186. package/build-module/components/editor-canvas-container/index.js +27 -8
  187. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  188. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  189. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  190. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  191. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  192. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  193. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  194. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  195. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  196. package/build-module/components/global-styles/root-menu.js +47 -0
  197. package/build-module/components/global-styles/root-menu.js.map +1 -0
  198. package/build-module/components/global-styles/screen-block-list.js +4 -2
  199. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  200. package/build-module/components/global-styles/screen-block.js +229 -7
  201. package/build-module/components/global-styles/screen-block.js.map +1 -1
  202. package/build-module/components/global-styles/screen-colors.js +9 -25
  203. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  204. package/build-module/components/global-styles/screen-css.js +20 -15
  205. package/build-module/components/global-styles/screen-css.js.map +1 -1
  206. package/build-module/components/global-styles/screen-layout.js +4 -16
  207. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  208. package/build-module/components/global-styles/screen-revisions/index.js +121 -0
  209. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  210. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +118 -0
  211. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  212. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +107 -0
  213. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  214. package/build-module/components/global-styles/screen-root.js +6 -6
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  217. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +11 -37
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +10 -18
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-panel.js +7 -11
  223. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  224. package/build-module/components/global-styles/ui.js +71 -115
  225. package/build-module/components/global-styles/ui.js.map +1 -1
  226. package/build-module/components/global-styles/variations-panel.js +3 -22
  227. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  228. package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
  229. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  230. package/build-module/components/header-edit-mode/index.js +16 -4
  231. package/build-module/components/header-edit-mode/index.js.map +1 -1
  232. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  233. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  234. package/build-module/components/layout/hooks.js +41 -0
  235. package/build-module/components/layout/hooks.js.map +1 -0
  236. package/build-module/components/layout/index.js +53 -102
  237. package/build-module/components/layout/index.js.map +1 -1
  238. package/build-module/components/list/actions/index.js +6 -3
  239. package/build-module/components/list/actions/index.js.map +1 -1
  240. package/build-module/components/list/index.js +5 -1
  241. package/build-module/components/list/index.js.map +1 -1
  242. package/build-module/components/list/table.js +1 -1
  243. package/build-module/components/list/table.js.map +1 -1
  244. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  245. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  246. package/build-module/components/resizable-frame/index.js +228 -0
  247. package/build-module/components/resizable-frame/index.js.map +1 -0
  248. package/build-module/components/revisions/index.js +78 -0
  249. package/build-module/components/revisions/index.js.map +1 -0
  250. package/build-module/components/routes/link.js +13 -1
  251. package/build-module/components/routes/link.js.map +1 -1
  252. package/build-module/components/routes/use-title.js +5 -1
  253. package/build-module/components/routes/use-title.js.map +1 -1
  254. package/build-module/components/save-button/index.js +28 -6
  255. package/build-module/components/save-button/index.js.map +1 -1
  256. package/build-module/components/save-hub/index.js +13 -32
  257. package/build-module/components/save-hub/index.js.map +1 -1
  258. package/build-module/components/save-panel/index.js +19 -7
  259. package/build-module/components/save-panel/index.js.map +1 -1
  260. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -11
  261. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  262. package/build-module/components/sidebar/index.js +14 -4
  263. package/build-module/components/sidebar/index.js.map +1 -1
  264. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  265. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  266. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  267. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  268. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  269. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  270. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  271. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  272. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  273. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  274. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  275. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  277. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
  279. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-main/index.js +30 -24
  281. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  282. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  283. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
  285. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  286. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
  287. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  288. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -93
  289. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
  291. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  292. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +13 -72
  293. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
  295. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  296. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  297. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  299. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  300. package/build-module/components/sidebar-navigation-screen-templates/index.js +38 -12
  301. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  303. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  304. package/build-module/components/site-hub/index.js +32 -6
  305. package/build-module/components/site-hub/index.js.map +1 -1
  306. package/build-module/components/start-template-options/index.js +13 -17
  307. package/build-module/components/start-template-options/index.js.map +1 -1
  308. package/build-module/components/style-book/index.js +93 -20
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  313. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  314. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  315. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  316. package/build-module/components/use-edited-entity-record/index.js +8 -4
  317. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  318. package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
  319. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
  320. package/build-module/hooks/template-part-edit.js +5 -1
  321. package/build-module/hooks/template-part-edit.js.map +1 -1
  322. package/build-module/index.js +1 -0
  323. package/build-module/index.js.map +1 -1
  324. package/build-module/store/actions.js +5 -3
  325. package/build-module/store/actions.js.map +1 -1
  326. package/build-module/utils/is-previewing-theme.js +17 -0
  327. package/build-module/utils/is-previewing-theme.js.map +1 -0
  328. package/build-module/utils/use-activate-theme.js +36 -0
  329. package/build-module/utils/use-activate-theme.js.map +1 -0
  330. package/build-style/style-rtl.css +409 -265
  331. package/build-style/style.css +410 -265
  332. package/package.json +37 -35
  333. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
  334. package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +44 -34
  335. package/src/components/add-new-template/new-template-part.js +4 -1
  336. package/src/components/add-new-template/new-template.js +142 -154
  337. package/src/components/add-new-template/style.scss +120 -103
  338. package/src/components/app/index.js +6 -3
  339. package/src/components/block-editor/back-button.js +4 -1
  340. package/src/components/block-editor/editor-canvas.js +36 -8
  341. package/src/components/block-editor/index.js +2 -3
  342. package/src/components/block-editor/style.scss +15 -8
  343. package/src/components/create-template-part-modal/index.js +19 -25
  344. package/src/components/editor/index.js +20 -8
  345. package/src/components/editor/style.scss +21 -6
  346. package/src/components/editor-canvas-container/index.js +43 -21
  347. package/src/components/global-styles/block-preview-panel.js +1 -1
  348. package/src/components/global-styles/color-palette-panel.js +9 -0
  349. package/src/components/global-styles/dimensions-panel.js +15 -15
  350. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  351. package/src/components/global-styles/root-menu.js +66 -0
  352. package/src/components/global-styles/screen-block-list.js +2 -2
  353. package/src/components/global-styles/screen-block.js +255 -7
  354. package/src/components/global-styles/screen-colors.js +9 -16
  355. package/src/components/global-styles/screen-css.js +21 -21
  356. package/src/components/global-styles/screen-layout.js +5 -9
  357. package/src/components/global-styles/screen-revisions/index.js +169 -0
  358. package/src/components/global-styles/screen-revisions/revisions-buttons.js +139 -0
  359. package/src/components/global-styles/screen-revisions/style.scss +100 -0
  360. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +138 -0
  361. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +99 -0
  362. package/src/components/global-styles/screen-root.js +7 -5
  363. package/src/components/global-styles/screen-typography-element.js +1 -3
  364. package/src/components/global-styles/screen-typography.js +44 -79
  365. package/src/components/global-styles/style-variations-container.js +17 -28
  366. package/src/components/global-styles/style.scss +4 -23
  367. package/src/components/global-styles/typography-panel.js +12 -13
  368. package/src/components/global-styles/ui.js +83 -110
  369. package/src/components/global-styles/variations-panel.js +3 -26
  370. package/src/components/header-edit-mode/document-actions/index.js +26 -129
  371. package/src/components/header-edit-mode/document-actions/style.scss +28 -59
  372. package/src/components/header-edit-mode/index.js +23 -2
  373. package/src/components/header-edit-mode/style.scss +1 -0
  374. package/src/components/keyboard-shortcuts/register.js +1 -1
  375. package/src/components/layout/hooks.js +46 -0
  376. package/src/components/layout/index.js +60 -125
  377. package/src/components/layout/style.scss +9 -5
  378. package/src/components/list/actions/index.js +12 -5
  379. package/src/components/list/index.js +4 -1
  380. package/src/components/list/style.scss +5 -0
  381. package/src/components/list/table.js +3 -1
  382. package/src/components/plugin-template-setting-panel/index.js +33 -0
  383. package/src/components/resizable-frame/index.js +253 -0
  384. package/src/components/resizable-frame/style.scss +69 -0
  385. package/src/components/revisions/index.js +105 -0
  386. package/src/components/routes/link.js +16 -1
  387. package/src/components/routes/use-title.js +4 -1
  388. package/src/components/save-button/index.js +27 -6
  389. package/src/components/save-hub/index.js +17 -35
  390. package/src/components/save-panel/index.js +15 -3
  391. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -7
  392. package/src/components/sidebar/index.js +15 -4
  393. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
  394. package/src/components/sidebar-edit-mode/index.js +17 -6
  395. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  396. package/src/components/sidebar-edit-mode/style.scss +10 -0
  397. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  398. package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -2
  399. package/src/components/sidebar-navigation-item/index.js +13 -14
  400. package/src/components/sidebar-navigation-item/style.scss +17 -1
  401. package/src/components/sidebar-navigation-screen/index.js +26 -5
  402. package/src/components/sidebar-navigation-screen/style.scss +1 -2
  403. package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
  404. package/src/components/sidebar-navigation-screen-main/index.js +39 -35
  405. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  406. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
  407. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
  408. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -105
  409. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
  410. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -74
  411. package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
  412. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
  413. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  414. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  415. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  416. package/src/components/sidebar-navigation-screen-templates/index.js +57 -14
  417. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  418. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  419. package/src/components/site-hub/index.js +88 -58
  420. package/src/components/site-hub/style.scss +8 -0
  421. package/src/components/start-template-options/index.js +19 -27
  422. package/src/components/start-template-options/style.scss +28 -21
  423. package/src/components/style-book/index.js +132 -43
  424. package/src/components/style-book/style.scss +19 -0
  425. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  426. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  427. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  428. package/src/components/use-edited-entity-record/index.js +12 -3
  429. package/src/hooks/commands/use-edit-mode-commands.js +79 -0
  430. package/src/hooks/template-part-edit.js +4 -1
  431. package/src/index.js +1 -0
  432. package/src/store/actions.js +4 -5
  433. package/src/store/test/actions.js +6 -14
  434. package/src/store/test/utils.js +15 -5
  435. package/src/style.scss +5 -2
  436. package/src/utils/is-previewing-theme.js +18 -0
  437. package/src/utils/use-activate-theme.js +38 -0
  438. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  439. package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
  440. package/build/components/global-styles/border-panel.js +0 -133
  441. package/build/components/global-styles/border-panel.js.map +0 -1
  442. package/build/components/global-styles/context-menu.js +0 -126
  443. package/build/components/global-styles/context-menu.js.map +0 -1
  444. package/build/components/global-styles/custom-css.js +0 -113
  445. package/build/components/global-styles/custom-css.js.map +0 -1
  446. package/build/components/global-styles/effects-panel.js +0 -53
  447. package/build/components/global-styles/effects-panel.js.map +0 -1
  448. package/build/components/global-styles/filters-panel.js +0 -50
  449. package/build/components/global-styles/filters-panel.js.map +0 -1
  450. package/build/components/global-styles/screen-border.js +0 -61
  451. package/build/components/global-styles/screen-border.js.map +0 -1
  452. package/build/components/global-styles/screen-effects.js +0 -61
  453. package/build/components/global-styles/screen-effects.js.map +0 -1
  454. package/build/components/global-styles/screen-filters.js +0 -46
  455. package/build/components/global-styles/screen-filters.js.map +0 -1
  456. package/build/components/global-styles/screen-variations.js +0 -71
  457. package/build/components/global-styles/screen-variations.js.map +0 -1
  458. package/build/components/navigate-to-link/index.js +0 -51
  459. package/build/components/navigate-to-link/index.js.map +0 -1
  460. package/build/components/routes/index.js +0 -60
  461. package/build/components/routes/index.js.map +0 -1
  462. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  463. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
  464. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  465. package/build/components/template-details/edit-template-title.js +0 -42
  466. package/build/components/template-details/edit-template-title.js.map +0 -1
  467. package/build/components/template-details/index.js +0 -103
  468. package/build/components/template-details/index.js.map +0 -1
  469. package/build/components/template-details/template-areas.js +0 -160
  470. package/build/components/template-details/template-areas.js.map +0 -1
  471. package/build/components/template-details/template-part-area-selector.js +0 -48
  472. package/build/components/template-details/template-part-area-selector.js.map +0 -1
  473. package/build/hooks/commands/index.js +0 -19
  474. package/build/hooks/commands/index.js.map +0 -1
  475. package/build/hooks/commands/use-navigation-commands.js +0 -126
  476. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  477. package/build/hooks/commands/use-wp-admin-commands.js +0 -97
  478. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  479. package/build/utils/history.js +0 -41
  480. package/build/utils/history.js.map +0 -1
  481. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  482. package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
  483. package/build-module/components/global-styles/border-panel.js +0 -123
  484. package/build-module/components/global-styles/border-panel.js.map +0 -1
  485. package/build-module/components/global-styles/context-menu.js +0 -107
  486. package/build-module/components/global-styles/context-menu.js.map +0 -1
  487. package/build-module/components/global-styles/custom-css.js +0 -98
  488. package/build-module/components/global-styles/custom-css.js.map +0 -1
  489. package/build-module/components/global-styles/effects-panel.js +0 -43
  490. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  491. package/build-module/components/global-styles/filters-panel.js +0 -40
  492. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  493. package/build-module/components/global-styles/screen-border.js +0 -44
  494. package/build-module/components/global-styles/screen-border.js.map +0 -1
  495. package/build-module/components/global-styles/screen-effects.js +0 -44
  496. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  497. package/build-module/components/global-styles/screen-filters.js +0 -33
  498. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  499. package/build-module/components/global-styles/screen-variations.js +0 -54
  500. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  501. package/build-module/components/navigate-to-link/index.js +0 -39
  502. package/build-module/components/navigate-to-link/index.js.map +0 -1
  503. package/build-module/components/routes/index.js +0 -47
  504. package/build-module/components/routes/index.js.map +0 -1
  505. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  506. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
  507. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  508. package/build-module/components/template-details/edit-template-title.js +0 -33
  509. package/build-module/components/template-details/edit-template-title.js.map +0 -1
  510. package/build-module/components/template-details/index.js +0 -83
  511. package/build-module/components/template-details/index.js.map +0 -1
  512. package/build-module/components/template-details/template-areas.js +0 -141
  513. package/build-module/components/template-details/template-areas.js.map +0 -1
  514. package/build-module/components/template-details/template-part-area-selector.js +0 -36
  515. package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
  516. package/build-module/hooks/commands/index.js +0 -10
  517. package/build-module/hooks/commands/index.js.map +0 -1
  518. package/build-module/hooks/commands/use-navigation-commands.js +0 -109
  519. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  520. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
  521. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  522. package/build-module/utils/history.js +0 -31
  523. package/build-module/utils/history.js.map +0 -1
  524. package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
  525. package/src/components/global-styles/border-panel.js +0 -112
  526. package/src/components/global-styles/context-menu.js +0 -175
  527. package/src/components/global-styles/custom-css.js +0 -131
  528. package/src/components/global-styles/effects-panel.js +0 -40
  529. package/src/components/global-styles/filters-panel.js +0 -39
  530. package/src/components/global-styles/screen-border.js +0 -35
  531. package/src/components/global-styles/screen-effects.js +0 -35
  532. package/src/components/global-styles/screen-filters.js +0 -27
  533. package/src/components/global-styles/screen-variations.js +0 -46
  534. package/src/components/navigate-to-link/index.js +0 -46
  535. package/src/components/routes/index.js +0 -53
  536. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
  537. package/src/components/template-details/edit-template-title.js +0 -41
  538. package/src/components/template-details/index.js +0 -113
  539. package/src/components/template-details/style.scss +0 -72
  540. package/src/components/template-details/template-areas.js +0 -164
  541. package/src/components/template-details/template-part-area-selector.js +0 -39
  542. package/src/hooks/commands/index.js +0 -10
  543. package/src/hooks/commands/use-navigation-commands.js +0 -112
  544. package/src/hooks/commands/use-wp-admin-commands.js +0 -79
  545. package/src/utils/history.js +0 -39
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","__experimentalHeading","Heading","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,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,EAICC,qBAAqB,IAAIC,OAJ1B,QAKO,uBALP;AAMA,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,OAMX;AAAA,MAN6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA;AALgD,GAM7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBX,SAAS,CAAIY,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBV,MAAM,CAAES,MAAM,CAAEV,aAAF,CAAR,CAA9B;AACA,WAAO;AACNS,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,SAAS,EAAC,YAFX;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAER,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,IAAA,KAAK,EAAGF,EAAE,CAAE,0BAAF,CAFX;AAGC,IAAA,IAAI,EAAGc,aAAa,IAAI;AAHzB,IAZF,EAkBC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,KAAK,EAAG,OAFT;AAGC,IAAA,KAAK,EAAG,CAHT;AAIC,IAAA,IAAI,EAAG;AAJR,KAMGJ,KANH,CAlBD,EA0BGC,OA1BH,CADD,EA8BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGE,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAFF,EAMGD,OANH,CA9BD,CADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n\t__experimentalHeading as Heading,\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\talignment=\"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\tlabel={ __( 'Go back to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<Heading\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\tcolor={ 'white' }\n\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\tsize={ 20 }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","__experimentalHeading","Heading","isRTL","__","sprintf","chevronRight","chevronLeft","store","coreStore","useSelect","editSiteStore","unlock","SidebarButton","isPreviewingTheme","currentlyPreviewingTheme","SidebarNavigationScreen","isRoot","title","actions","content","description","dashboardLink","select","getSettings","__experimentalDashboardLink","getTheme","theme","name","rendered"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,EAICC,qBAAqB,IAAIC,OAJ1B,QAKO,uBALP;AAMA,SAASC,KAAT,EAAgBC,EAAhB,EAAoBC,OAApB,QAAmC,iBAAnC;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SACCC,iBADD,EAECC,wBAFD,QAGO,iCAHP;AAKA,eAAe,SAASC,uBAAT,OAMX;AAAA;;AAAA,MAN6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA;AALgD,GAM7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBZ,SAAS,CAAIa,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBZ,MAAM,CAAEW,MAAM,CAAEZ,aAAF,CAAR,CAA9B;AACA,WAAO;AACNW,MAAAA,aAAa,EAAEE,WAAW,GAAGC;AADvB,KAAP;AAGA,GALkC,EAKhC,EALgC,CAAnC;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAehB,SAAS,CAAED,SAAF,CAA9B;AACA,QAAMkB,KAAK,GAAGD,QAAQ,CAAEX,wBAAwB,EAA1B,CAAtB;AAEA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,SAAS,EAAC,YAFX;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAEE,MAAF,GACD,cAAC,uBAAD;AACC,IAAA,EAAE,EAAGJ,aADN;AAEC,IAAA,IAAI,EAAGV,KAAK,KAAKG,YAAL,GAAoBC,WAFjC;AAGC,IAAA,KAAK,EAAGH,EAAE,CAAE,MAAF;AAHX,IADC,GAOD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGD,KAAK,KAAKG,YAAL,GAAoBC,WADjC;AAEC,IAAA,KAAK,EACJ,CAAEO,iBAAiB,EAAnB,GACGV,EAAE,CAAE,0BAAF,CADL,GAEGA,EAAE,CAAE,+BAAF,CALP;AAOC,IAAA,IAAI,EACH,CAAEU,iBAAiB,EAAnB,GACGQ,aAAa,IAAI,WADpB,GAEG;AAVL,IAZF,EA0BC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,KAAK,EAAG,OAFT;AAGC,IAAA,KAAK,EAAG,CAHT;AAIC,IAAA,IAAI,EAAG;AAJR,KAMG,CAAER,iBAAiB,EAAnB,GACCI,KADD,GAECb,OAAO,CACP,uBADO,EAEPsB,KAFO,aAEPA,KAFO,sCAEPA,KAAK,CAAEC,IAFA,gDAEP,YAAaC,QAFN,EAGPX,KAHO,CARX,CA1BD,EAwCGC,OAxCH,CADD,EA4CC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGE,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAFF,EAMGD,OANH,CA5CD,CADD;AAuDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\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';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\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\tconst { getTheme } = useSelect( coreStore );\n\tconst theme = getTheme( currentlyPreviewingTheme() );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\talignment=\"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\tlabel={ __( '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\tlabel={\n\t\t\t\t\t\t\t! isPreviewingTheme()\n\t\t\t\t\t\t\t\t? __( 'Go back to the Dashboard' )\n\t\t\t\t\t\t\t\t: __( 'Go back to the theme showcase' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t! isPreviewingTheme()\n\t\t\t\t\t\t\t\t? dashboardLink || 'index.php'\n\t\t\t\t\t\t\t\t: 'themes.php'\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<Heading\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\tcolor={ 'white' }\n\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\tsize={ 20 }\n\t\t\t\t>\n\t\t\t\t\t{ ! isPreviewingTheme()\n\t\t\t\t\t\t? title\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t'Previewing %1$s: %2$s',\n\t\t\t\t\t\t\t\ttheme?.name?.rendered,\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t ) }\n\t\t\t\t</Heading>\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"]}
@@ -1,11 +1,15 @@
1
- import { createElement } from "@wordpress/element";
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement, Fragment } from "@wordpress/element";
2
3
 
3
4
  /**
4
5
  * WordPress dependencies
5
6
  */
6
7
  import { __ } from '@wordpress/i18n';
7
- import { edit } from '@wordpress/icons';
8
- import { useDispatch } from '@wordpress/data';
8
+ import { edit, seen } from '@wordpress/icons';
9
+ import { useSelect, useDispatch } from '@wordpress/data';
10
+ import { store as coreStore } from '@wordpress/core-data';
11
+ import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
12
+ import { useViewportMatch } from '@wordpress/compose';
9
13
  /**
10
14
  * Internal dependencies
11
15
  */
@@ -15,27 +19,79 @@ import StyleVariationsContainer from '../global-styles/style-variations-containe
15
19
  import { unlock } from '../../private-apis';
16
20
  import { store as editSiteStore } from '../../store';
17
21
  import SidebarButton from '../sidebar-button';
18
- export default function SidebarNavigationScreenGlobalStyles() {
22
+ import SidebarNavigationItem from '../sidebar-navigation-item';
23
+ import StyleBook from '../style-book';
24
+ export function SidebarNavigationItemGlobalStyles(props) {
19
25
  const {
20
26
  openGeneralSidebar
21
27
  } = useDispatch(editSiteStore);
22
28
  const {
23
29
  setCanvasMode
24
30
  } = unlock(useDispatch(editSiteStore));
25
- return createElement(SidebarNavigationScreen, {
31
+ const hasGlobalStyleVariations = useSelect(select => {
32
+ var _select$__experimenta;
33
+
34
+ return !!((_select$__experimenta = select(coreStore).__experimentalGetCurrentThemeGlobalStylesVariations()) !== null && _select$__experimenta !== void 0 && _select$__experimenta.length);
35
+ }, []);
36
+
37
+ if (hasGlobalStyleVariations) {
38
+ return createElement(NavigatorButton, _extends({}, props, {
39
+ as: SidebarNavigationItem,
40
+ path: "/wp_global_styles"
41
+ }));
42
+ }
43
+
44
+ return createElement(SidebarNavigationItem, _extends({}, props, {
45
+ onClick: () => {
46
+ // switch to edit mode.
47
+ setCanvasMode('edit'); // open global styles sidebar.
48
+
49
+ openGeneralSidebar('edit-site/global-styles');
50
+ }
51
+ }));
52
+ }
53
+ export default function SidebarNavigationScreenGlobalStyles() {
54
+ const {
55
+ openGeneralSidebar
56
+ } = useDispatch(editSiteStore);
57
+ const isMobileViewport = useViewportMatch('medium', '<');
58
+ const {
59
+ setCanvasMode,
60
+ setEditorCanvasContainerView
61
+ } = unlock(useDispatch(editSiteStore));
62
+ const isStyleBookOpened = useSelect(select => 'style-book' === unlock(select(editSiteStore)).getEditorCanvasContainerView(), []);
63
+
64
+ const openGlobalStyles = async () => Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
65
+
66
+ const openStyleBook = async () => {
67
+ await openGlobalStyles(); // Open the Style Book once the canvas mode is set to edit,
68
+ // and the global styles sidebar is open. This ensures that
69
+ // the Style Book is not prematurely closed.
70
+
71
+ setEditorCanvasContainerView('style-book');
72
+ };
73
+
74
+ return createElement(Fragment, null, createElement(SidebarNavigationScreen, {
26
75
  title: __('Styles'),
27
76
  description: __('Choose a different style combination for the theme styles.'),
28
77
  content: createElement(StyleVariationsContainer, null),
29
- actions: createElement(SidebarButton, {
78
+ actions: createElement("div", null, !isMobileViewport && createElement(SidebarButton, {
79
+ icon: seen,
80
+ label: __('Style Book'),
81
+ onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
82
+ isPressed: isStyleBookOpened
83
+ }), createElement(SidebarButton, {
30
84
  icon: edit,
31
85
  label: __('Edit styles'),
32
- onClick: () => {
33
- // switch to edit mode.
34
- setCanvasMode('edit'); // open global styles sidebar.
35
-
36
- openGeneralSidebar('edit-site/global-styles');
37
- }
38
- })
39
- });
86
+ onClick: async () => await openGlobalStyles()
87
+ }))
88
+ }), isStyleBookOpened && !isMobileViewport && createElement(StyleBook, {
89
+ enableResizing: false,
90
+ isSelected: () => false,
91
+ onClick: openStyleBook,
92
+ onSelect: openStyleBook,
93
+ showCloseButton: false,
94
+ showTabs: false
95
+ }));
40
96
  }
41
97
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["__","edit","useDispatch","SidebarNavigationScreen","StyleVariationsContainer","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenGlobalStyles","openGeneralSidebar","setCanvasMode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,wBAAP,MAAqC,6CAArC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,mCAAT,GAA+C;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAAyBR,WAAW,CAAEK,aAAF,CAA1C;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAoBN,MAAM,CAAEH,WAAW,CAAEK,aAAF,CAAb,CAAhC;AACA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGP,EAAE,CAAE,QAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,4DADe,CAFjB;AAKC,IAAA,OAAO,EAAG,cAAC,wBAAD,OALX;AAMC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,IAAI,EAAGC,IADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,aAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAM;AACf;AACAW,QAAAA,aAAa,CAAE,MAAF,CAAb,CAFe,CAGf;;AACAD,QAAAA,kBAAkB,CAAE,yBAAF,CAAlB;AACA;AARF;AAPF,IADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t) }\n\t\t\tcontent={ <StyleVariationsContainer /> }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t// switch to edit mode.\n\t\t\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t\t\t// open global styles sidebar.\n\t\t\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationScreenGlobalStyles","isMobileViewport","setEditorCanvasContainerView","isStyleBookOpened","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","undefined"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tconst isStyleBookOpened = useSelect(\n\t\t( select ) =>\n\t\t\t'style-book' ===\n\t\t\tunlock( select( editSiteStore ) ).getEditorCanvasContainerView(),\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = async () =>\n\t\tPromise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\n\tconst openStyleBook = async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <StyleVariationsContainer /> }\n\t\t\t\tactions={\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -5,43 +5,49 @@ import { createElement } from "@wordpress/element";
5
5
  */
6
6
  import { __experimentalItemGroup as ItemGroup, __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
7
7
  import { __ } from '@wordpress/i18n';
8
- import { layout, symbolFilled, navigation, styles } from '@wordpress/icons';
9
- import { useSelect } from '@wordpress/data';
10
- import { store as coreStore } from '@wordpress/core-data';
8
+ import { layout, symbol, navigation, styles, page } from '@wordpress/icons';
9
+ import { useDispatch, useSelect } from '@wordpress/data';
10
+ import { useEffect } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
14
 
15
15
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
16
  import SidebarNavigationItem from '../sidebar-navigation-item';
17
+ import { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';
18
+ import { unlock } from '../../private-apis';
19
+ import { store as editSiteStore } from '../../store';
20
+ import SidebarNavigationScreenNavigationMenuButton from '../sidebar-navigation-screen-navigation-menus/navigator-button';
17
21
  export default function SidebarNavigationScreenMain() {
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;
28
- });
29
- const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN ? hasNavigationMenus : false;
22
+ const editorCanvasContainerView = useSelect(select => {
23
+ return unlock(select(editSiteStore)).getEditorCanvasContainerView();
24
+ }, []);
25
+ const {
26
+ setEditorCanvasContainerView
27
+ } = unlock(useDispatch(editSiteStore)); // Clear the editor canvas container view when accessing the main navigation screen.
28
+
29
+ useEffect(() => {
30
+ if (editorCanvasContainerView) {
31
+ setEditorCanvasContainerView(undefined);
32
+ }
33
+ }, [editorCanvasContainerView, setEditorCanvasContainerView]);
30
34
  return createElement(SidebarNavigationScreen, {
31
35
  isRoot: true,
32
36
  title: __('Design'),
33
37
  description: __('Customize the appearance of your website using the block editor.'),
34
- content: createElement(ItemGroup, null, showNavigationScreen && createElement(NavigatorButton, {
35
- as: SidebarNavigationItem,
36
- path: "/navigation",
38
+ content: createElement(ItemGroup, null, createElement(SidebarNavigationScreenNavigationMenuButton, {
37
39
  withChevron: true,
38
- icon: navigation
39
- }, __('Navigation')), createElement(NavigatorButton, {
40
- as: SidebarNavigationItem,
41
- path: "/wp_global_styles",
40
+ icon: navigation,
41
+ as: SidebarNavigationItem
42
+ }, __('Navigation')), createElement(SidebarNavigationItemGlobalStyles, {
42
43
  withChevron: true,
43
44
  icon: styles
44
45
  }, __('Styles')), createElement(NavigatorButton, {
46
+ as: SidebarNavigationItem,
47
+ path: "/page",
48
+ withChevron: true,
49
+ icon: page
50
+ }, __('Pages')), createElement(NavigatorButton, {
45
51
  as: SidebarNavigationItem,
46
52
  path: "/wp_template",
47
53
  withChevron: true,
@@ -50,8 +56,8 @@ export default function SidebarNavigationScreenMain() {
50
56
  as: SidebarNavigationItem,
51
57
  path: "/wp_template_part",
52
58
  withChevron: true,
53
- icon: symbolFilled
54
- }, __('Template Parts')))
59
+ icon: symbol
60
+ }, __('Library')))
55
61
  });
56
62
  }
57
63
  //# sourceMappingURL=index.js.map
@@ -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","styles","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/B,EAA2CC,MAA3C,QAAyD,kBAAzD;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,QAAMC,kBAAkB,GAAGN,SAAS,CAAIO,MAAF,IAAc;AACnD;AACA;AACA,UAAMC,eAAe,GAAGD,MAAM,CAAEL,SAAF,CAAN,CAAoBO,gBAApB,CACvB,UADuB,EAEvB,eAFuB,EAGvB;AACCC,MAAAA,QAAQ,EAAE,CADX;AAECC,MAAAA,MAAM,EAAE,SAFT;AAGCC,MAAAA,KAAK,EAAE,MAHR;AAICC,MAAAA,OAAO,EAAE;AAJV,KAHuB,CAAxB;AAWA,WAAO,CAAAL,eAAe,SAAf,IAAAA,eAAe,WAAf,YAAAA,eAAe,CAAEM,MAAjB,IAA0B,CAAjC;AACA,GAfmC,CAApC;AAiBA,QAAMC,oBAAoB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAC1BZ,kBAD0B,GAE1B,KAFH;AAGA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGX,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,kEADe,CAHjB;AAMC,IAAA,OAAO,EACN,cAAC,SAAD,QACGoB,oBAAoB,IACrB,cAAC,eAAD;AACC,MAAA,EAAE,EAAGX,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGS,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGJ,EAAE,CAAE,QAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGS,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGR;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAnBD,EA2BC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGS,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CA3BD;AAPF,IADD;AA+CA","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, styles } 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_global_styles\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Styles' ) }\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\"\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","symbol","navigation","styles","page","useDispatch","useSelect","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","SidebarNavigationScreenNavigationMenuButton","SidebarNavigationScreenMain","editorCanvasContainerView","select","getEditorCanvasContainerView","setEditorCanvasContainerView","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,MAAjB,EAAyBC,UAAzB,EAAqCC,MAArC,EAA6CC,IAA7C,QAAyD,kBAAzD;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA,SAASC,SAAT,QAA0B,oBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,iCAAT,QAAkD,4CAAlD;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,2CAAP,MAAwD,gEAAxD;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAMC,yBAAyB,GAAGV,SAAS,CAAIW,MAAF,IAAc;AAC1D,WAAON,MAAM,CAAEM,MAAM,CAAEJ,aAAF,CAAR,CAAN,CAAkCK,4BAAlC,EAAP;AACA,GAF0C,EAExC,EAFwC,CAA3C;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAmCR,MAAM,CAC9CN,WAAW,CAAEQ,aAAF,CADmC,CAA/C,CALqD,CASrD;;AACAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKS,yBAAL,EAAiC;AAChCG,MAAAA,4BAA4B,CAAEC,SAAF,CAA5B;AACA;AACD,GAJQ,EAIN,CAAEJ,yBAAF,EAA6BG,4BAA7B,CAJM,CAAT;AAMA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGpB,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,kEADe,CAHjB;AAMC,IAAA,OAAO,EACN,cAAC,SAAD,QACC,cAAC,2CAAD;AACC,MAAA,WAAW,MADZ;AAEC,MAAA,IAAI,EAAGG,UAFR;AAGC,MAAA,EAAE,EAAGO;AAHN,OAKGV,EAAE,CAAE,YAAF,CALL,CADD,EASC,cAAC,iCAAD;AACC,MAAA,WAAW,MADZ;AAEC,MAAA,IAAI,EAAGI;AAFR,OAIGJ,EAAE,CAAE,QAAF,CAJL,CATD,EAeC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGU,qBADN;AAEC,MAAA,IAAI,EAAC,OAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGL,EAAE,CAAE,OAAF,CANL,CAfD,EAuBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGU,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGT;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAvBD,EA+BC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGU,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGR;AAJR,OAMGF,EAAE,CAAE,SAAF,CANL,CA/BD;AAPF,IADD;AAmDA","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, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationScreenNavigationMenuButton from '../sidebar-navigation-screen-navigation-menus/navigator-button';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst editorCanvasContainerView = useSelect( ( select ) => {\n\t\treturn unlock( select( editSiteStore ) ).getEditorCanvasContainerView();\n\t}, [] );\n\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( editorCanvasContainerView ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ editorCanvasContainerView, setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<SidebarNavigationScreenNavigationMenuButton\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t</SidebarNavigationScreenNavigationMenuButton>\n\n\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Pages' ) }\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\"\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={ symbol }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Library' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -39,7 +39,7 @@ export default function SidebarNavigationScreenNavigationItem() {
39
39
  label: __('Edit'),
40
40
  icon: pencil
41
41
  }),
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.'),
42
+ description: __('Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'),
43
43
  content: createElement(Fragment, null, record !== null && record !== void 0 && record.link ? createElement(ExternalLink, {
44
44
  className: "edit-site-sidebar-navigation-screen__page-link",
45
45
  href: record.link
@@ -1 +1 @@
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"]}
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,EAAGP,EAAE,CACf,oGADe,CATjB;AAYC,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;AAbF,IADD;AA8BA","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\t'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'\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"]}
@@ -0,0 +1,141 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { useEntityRecord } from '@wordpress/core-data';
7
+ import { __experimentalUseNavigator as useNavigator, Spinner } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { useCallback, useMemo } from '@wordpress/element';
10
+ import { useSelect } from '@wordpress/data';
11
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
12
+ import { BlockEditorProvider } from '@wordpress/block-editor';
13
+ import { createBlock } from '@wordpress/blocks';
14
+ import { decodeEntities } from '@wordpress/html-entities';
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ import { unlock } from '../../private-apis';
20
+ import { store as editSiteStore } from '../../store';
21
+ import { isPreviewingTheme, currentlyPreviewingTheme } from '../../utils/is-previewing-theme';
22
+ import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';
23
+ import NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';
24
+ const {
25
+ useHistory
26
+ } = unlock(routerPrivateApis);
27
+
28
+ const noop = () => {};
29
+
30
+ export default function SidebarNavigationScreenNavigationMenu() {
31
+ var _navigationMenu$title, _navigationMenu$conte;
32
+
33
+ const postType = `wp_navigation`;
34
+ const {
35
+ params: {
36
+ postId
37
+ }
38
+ } = useNavigator();
39
+ const {
40
+ record: navigationMenu,
41
+ isResolving: isLoading
42
+ } = useEntityRecord('postType', postType, postId);
43
+ const menuTitle = (navigationMenu === null || navigationMenu === void 0 ? void 0 : (_navigationMenu$title = navigationMenu.title) === null || _navigationMenu$title === void 0 ? void 0 : _navigationMenu$title.rendered) || (navigationMenu === null || navigationMenu === void 0 ? void 0 : navigationMenu.slug);
44
+
45
+ if (isLoading) {
46
+ return createElement(SidebarNavigationScreenWrapper, {
47
+ description: __('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
48
+ }, createElement(Spinner, {
49
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
50
+ }));
51
+ }
52
+
53
+ if (!isLoading && !navigationMenu) {
54
+ return createElement(SidebarNavigationScreenWrapper, {
55
+ description: __('Navigation Menu missing.')
56
+ });
57
+ }
58
+
59
+ if (!(navigationMenu !== null && navigationMenu !== void 0 && (_navigationMenu$conte = navigationMenu.content) !== null && _navigationMenu$conte !== void 0 && _navigationMenu$conte.raw)) {
60
+ return createElement(SidebarNavigationScreenWrapper, {
61
+ title: decodeEntities(menuTitle),
62
+ description: __('This Navigation Menu is empty.')
63
+ });
64
+ }
65
+
66
+ return createElement(SidebarNavigationScreenWrapper, {
67
+ title: decodeEntities(menuTitle),
68
+ description: __('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
69
+ }, createElement(NavigationMenuEditor, {
70
+ navigationMenu: navigationMenu
71
+ }));
72
+ }
73
+
74
+ function NavigationMenuEditor(_ref) {
75
+ let {
76
+ navigationMenu
77
+ } = _ref;
78
+ const history = useHistory();
79
+ const onSelect = useCallback(selectedBlock => {
80
+ const {
81
+ attributes,
82
+ name
83
+ } = selectedBlock;
84
+
85
+ if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
86
+ history.push({
87
+ postType: attributes.type,
88
+ postId: attributes.id,
89
+ ...(isPreviewingTheme() && {
90
+ theme_preview: currentlyPreviewingTheme()
91
+ })
92
+ });
93
+ }
94
+
95
+ if (name === 'core/page-list-item' && attributes.id && history) {
96
+ history.push({
97
+ postType: 'page',
98
+ postId: attributes.id,
99
+ ...(isPreviewingTheme() && {
100
+ theme_preview: currentlyPreviewingTheme()
101
+ })
102
+ });
103
+ }
104
+ }, [history]);
105
+ const {
106
+ storedSettings
107
+ } = useSelect(select => {
108
+ const {
109
+ getSettings
110
+ } = unlock(select(editSiteStore));
111
+ return {
112
+ storedSettings: getSettings(false)
113
+ };
114
+ }, []);
115
+ const blocks = useMemo(() => {
116
+ if (!NavigationMenuEditor) {
117
+ return [];
118
+ }
119
+
120
+ return [createBlock('core/navigation', {
121
+ ref: navigationMenu === null || navigationMenu === void 0 ? void 0 : navigationMenu.id
122
+ })];
123
+ }, [navigationMenu]);
124
+
125
+ if (!navigationMenu || !(blocks !== null && blocks !== void 0 && blocks.length)) {
126
+ return null;
127
+ }
128
+
129
+ return createElement(BlockEditorProvider, {
130
+ settings: storedSettings,
131
+ value: blocks,
132
+ onChange: noop,
133
+ onInput: noop
134
+ }, createElement("div", {
135
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
136
+ }, createElement(NavigationMenuContent, {
137
+ rootClientId: blocks[0].clientId,
138
+ onSelect: onSelect
139
+ })));
140
+ }
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["useEntityRecord","__experimentalUseNavigator","useNavigator","Spinner","__","useCallback","useMemo","useSelect","privateApis","routerPrivateApis","BlockEditorProvider","createBlock","decodeEntities","unlock","store","editSiteStore","isPreviewingTheme","currentlyPreviewingTheme","SidebarNavigationScreenWrapper","NavigationMenuContent","useHistory","noop","SidebarNavigationScreenNavigationMenu","postType","params","postId","record","navigationMenu","isResolving","isLoading","menuTitle","title","rendered","slug","content","raw","NavigationMenuEditor","history","onSelect","selectedBlock","attributes","name","kind","id","type","push","theme_preview","storedSettings","select","getSettings","blocks","ref","length","clientId"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord } from '@wordpress/core-data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tSpinner,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';\n\nconst { useHistory } = unlock( routerPrivateApis );\nconst noop = () => {};\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst postType = `wp_navigation`;\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\n\tconst { record: navigationMenu, isResolving: isLoading } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenu={ navigationMenu } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nfunction NavigationMenuEditor( { navigationMenu } ) {\n\tconst history = useHistory();\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\t...( isPreviewingTheme() && {\n\t\t\t\t\t\ttheme_preview: currentlyPreviewingTheme(),\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t...( isPreviewingTheme() && {\n\t\t\t\t\t\ttheme_preview: currentlyPreviewingTheme(),\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\tconst blocks = useMemo( () => {\n\t\tif ( ! NavigationMenuEditor ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: navigationMenu?.id } ),\n\t\t];\n\t}, [ navigationMenu ] );\n\n\tif ( ! navigationMenu || ! blocks?.length ) {\n\t\treturn null;\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<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t<NavigationMenuContent\n\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -0,0 +1,10 @@
1
+ // This requested is preloaded in `gutenberg_preload_navigation_posts`.
2
+ // As unbounded queries are limited to 100 by `fetchAllMiddleware`
3
+ // on apiFetch this query is limited to 100.
4
+ export const PRELOADED_NAVIGATION_MENUS_QUERY = {
5
+ per_page: 100,
6
+ status: 'publish',
7
+ order: 'desc',
8
+ orderby: 'date'
9
+ };
10
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/constants.js"],"names":["PRELOADED_NAVIGATION_MENUS_QUERY","per_page","status","order","orderby"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,gCAAgC,GAAG;AAC/CC,EAAAA,QAAQ,EAAE,GADqC;AAE/CC,EAAAA,MAAM,EAAE,SAFuC;AAG/CC,EAAAA,KAAK,EAAE,MAHwC;AAI/CC,EAAAA,OAAO,EAAE;AAJsC,CAAzC","sourcesContent":["// This requested is preloaded in `gutenberg_preload_navigation_posts`.\n// As unbounded queries are limited to 100 by `fetchAllMiddleware`\n// on apiFetch this query is limited to 100.\nexport const PRELOADED_NAVIGATION_MENUS_QUERY = {\n\tper_page: 100,\n\tstatus: 'publish',\n\torder: 'desc',\n\torderby: 'date',\n};\n"]}