@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,117 +1,76 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createElement } from "@wordpress/element";
2
3
 
3
4
  /**
4
5
  * WordPress dependencies
5
6
  */
6
7
  import { __ } from '@wordpress/i18n';
7
- import { useCallback, useMemo } from '@wordpress/element';
8
- import { useSelect } from '@wordpress/data';
9
- import { store as coreStore } from '@wordpress/core-data';
10
- import { BlockEditorProvider } from '@wordpress/block-editor';
11
- import { createBlock } from '@wordpress/blocks';
8
+ import { useEntityRecords } from '@wordpress/core-data';
9
+ import { decodeEntities } from '@wordpress/html-entities';
10
+ import { __experimentalItemGroup as ItemGroup, Spinner } from '@wordpress/components';
11
+ import { navigation } from '@wordpress/icons';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
15
 
16
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
17
- import { useHistory } from '../routes';
18
- import NavigationMenuContent from './navigation-menu-content';
19
- import { NavigationMenuLoader } from './loader';
20
- import { unlock } from '../../private-apis';
21
- import { store as editSiteStore } from '../../store';
17
+ import SidebarNavigationItem from '../sidebar-navigation-item';
18
+ import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
19
+ import { useLink } from '../routes/link';
20
+ export default function SidebarNavigationScreenNavigationMenus() {
21
+ const {
22
+ records: navigationMenus,
23
+ isResolving: isLoading
24
+ } = useEntityRecords('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY);
25
+ const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
22
26
 
23
- const noop = () => {};
27
+ if (isLoading) {
28
+ return createElement(SidebarNavigationScreenWrapper, null, createElement(Spinner, {
29
+ className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
30
+ }));
31
+ }
24
32
 
25
- const NAVIGATION_MENUS_QUERY = {
26
- per_page: 1,
27
- status: 'publish',
28
- order: 'desc',
29
- orderby: 'date'
30
- };
33
+ if (!isLoading && !hasNavigationMenus) {
34
+ return createElement(SidebarNavigationScreenWrapper, {
35
+ description: __('No Navigation Menus found.')
36
+ });
37
+ }
31
38
 
32
- function SidebarNavigationScreenWrapper(_ref) {
39
+ return createElement(SidebarNavigationScreenWrapper, null, createElement(ItemGroup, null, navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.map(navMenu => {
40
+ var _navMenu$title;
41
+
42
+ return createElement(NavMenuItem, {
43
+ postId: navMenu.id,
44
+ key: navMenu.id,
45
+ withChevron: true,
46
+ icon: navigation
47
+ }, decodeEntities(((_navMenu$title = navMenu.title) === null || _navMenu$title === void 0 ? void 0 : _navMenu$title.rendered) || navMenu.slug));
48
+ })));
49
+ }
50
+ export function SidebarNavigationScreenWrapper(_ref) {
33
51
  let {
34
52
  children,
35
- actions
53
+ actions,
54
+ title,
55
+ description
36
56
  } = _ref;
37
57
  return createElement(SidebarNavigationScreen, {
38
- title: __('Navigation'),
58
+ title: title || __('Navigation'),
39
59
  actions: actions,
40
- description: __('Browse your site, edit pages, and manage your primary navigation menu.'),
60
+ description: description || __('Manage your Navigation menus.'),
41
61
  content: children
42
62
  });
43
63
  }
44
64
 
45
- export default function SidebarNavigationScreenNavigationMenus() {
46
- var _navigationMenus$;
47
-
48
- const history = useHistory();
49
- const {
50
- navigationMenus,
51
- hasResolvedNavigationMenus,
52
- storedSettings
53
- } = useSelect(select => {
54
- const {
55
- getSettings
56
- } = unlock(select(editSiteStore));
57
- const {
58
- getEntityRecords,
59
- hasFinishedResolution
60
- } = select(coreStore);
61
- const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY];
62
- return {
63
- storedSettings: getSettings(false),
64
- navigationMenus: getEntityRecords(...navigationMenusQuery),
65
- hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
66
- };
67
- }, []);
68
- const firstNavigationMenu = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id;
69
- const blocks = useMemo(() => {
70
- return [createBlock('core/navigation', {
71
- ref: firstNavigationMenu
72
- })];
73
- }, [firstNavigationMenu]);
74
- const isLoading = !hasResolvedNavigationMenus;
75
- const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
76
- const onSelect = useCallback(selectedBlock => {
77
- const {
78
- attributes,
79
- name
80
- } = selectedBlock;
81
-
82
- if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
83
- history.push({
84
- postType: attributes.type,
85
- postId: attributes.id
86
- });
87
- }
88
-
89
- if (name === 'core/page-list-item' && attributes.id && history) {
90
- history.push({
91
- postType: 'page',
92
- postId: attributes.id
93
- });
94
- }
95
- }, [history]);
96
-
97
- if (hasResolvedNavigationMenus && !hasNavigationMenus) {
98
- return createElement(SidebarNavigationScreenWrapper, null, __('There are no Navigation Menus.'));
99
- }
100
-
101
- if (!hasResolvedNavigationMenus || isLoading) {
102
- return createElement(SidebarNavigationScreenWrapper, null, createElement(NavigationMenuLoader, null));
103
- }
104
-
105
- return createElement(BlockEditorProvider, {
106
- settings: storedSettings,
107
- value: blocks,
108
- onChange: noop,
109
- onInput: noop
110
- }, createElement(SidebarNavigationScreenWrapper, null, createElement("div", {
111
- className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
112
- }, createElement(NavigationMenuContent, {
113
- rootClientId: blocks[0].clientId,
114
- onSelect: onSelect
115
- }))));
116
- }
65
+ const NavMenuItem = _ref2 => {
66
+ let {
67
+ postId,
68
+ ...props
69
+ } = _ref2;
70
+ const linkInfo = useLink({
71
+ postId,
72
+ postType: 'wp_navigation'
73
+ });
74
+ return createElement(SidebarNavigationItem, _extends({}, linkInfo, props));
75
+ };
117
76
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","useMemo","useSelect","store","coreStore","BlockEditorProvider","createBlock","SidebarNavigationScreen","useHistory","NavigationMenuContent","NavigationMenuLoader","unlock","editSiteStore","noop","NAVIGATION_MENUS_QUERY","per_page","status","order","orderby","SidebarNavigationScreenWrapper","children","actions","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","getEntityRecords","hasFinishedResolution","navigationMenusQuery","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,mBAAT,QAAoC,yBAApC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,SAASC,oBAAT,QAAqC,UAArC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAE,CADoB;AAE9BC,EAAAA,MAAM,EAAE,SAFsB;AAG9BC,EAAAA,KAAK,EAAE,MAHuB;AAI9BC,EAAAA,OAAO,EAAE;AAJqB,CAA/B;;AAOA,SAASC,8BAAT,OAAiE;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AA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QAD5B;AAEC,IAAA,QAAQ,EAAGT;AAFZ,IADD,CADD,CAND,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useHistory } from '../routes';\nimport NavigationMenuContent from './navigation-menu-content';\nimport { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = {\n\tper_page: 1,\n\tstatus: 'publish',\n\torder: 'desc',\n\torderby: 'date',\n};\n\nfunction SidebarNavigationScreenWrapper( { children, actions } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ __(\n\t\t\t\t'Browse your site, edit pages, and manage your primary navigation menu.'\n\t\t\t) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst { navigationMenus, hasResolvedNavigationMenus, storedSettings } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst navigationMenusQuery = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tNAVIGATION_MENUS_QUERY,\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( false ),\n\t\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tnavigationMenusQuery\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ]?.id;\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: firstNavigationMenu } ),\n\t\t];\n\t}, [ firstNavigationMenu ] );\n\n\tconst isLoading = ! hasResolvedNavigationMenus;\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tif ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedNavigationMenus || isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<NavigationMenuLoader />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t\t<NavigationMenuContent\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useEntityRecords","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isLoading","hasNavigationMenus","length","map","navMenu","id","title","rendered","slug","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,gCAAT,QAAiD,aAAjD;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAM;AAAEC,IAAAA,OAAO,EAAEC,eAAX;AAA4BC,IAAAA,WAAW,EAAEC;AAAzC,MACLd,gBAAgB,CACf,UADe,EAEd,eAFc,EAGfQ,gCAHe,CADjB;AAOA,QAAMO,kBAAkB,GAAG,CAAC,EAAEH,eAAF,aAAEA,eAAF,eAAEA,eAAe,CAAEI,MAAnB,CAA5B;;AAEA,MAAKF,SAAL,EAAiB;AAChB,WACC,cAAC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D,QAA5B,EAA4CD,KAA5C,EAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst { records: navigationMenus, isResolving: isLoading } =\n\t\tuseEntityRecords(\n\t\t\t'postType',\n\t\t\t`wp_navigation`,\n\t\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t\t);\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( navMenu ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ navMenu.id }\n\t\t\t\t\t\tkey={ navMenu.id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\tnavMenu.title?.rendered || navMenu.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
@@ -0,0 +1,71 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement, Fragment } from "@wordpress/element";
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';
8
+ import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
9
+ import { useDispatch, useSelect } from '@wordpress/data';
10
+ import { __, sprintf } from '@wordpress/i18n';
11
+ import { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';
12
+ const POPOVER_PROPS = {
13
+ className: 'block-editor-block-settings-menu__popover',
14
+ position: 'bottom right',
15
+ variant: 'toolbar'
16
+ };
17
+ export default function LeafMoreMenu(props) {
18
+ const {
19
+ block
20
+ } = props;
21
+ const {
22
+ clientId
23
+ } = block;
24
+ const {
25
+ moveBlocksDown,
26
+ moveBlocksUp,
27
+ removeBlocks
28
+ } = useDispatch(blockEditorStore);
29
+ const removeLabel = sprintf(
30
+ /* translators: %s: block name */
31
+ __('Remove %s'), BlockTitle({
32
+ clientId,
33
+ maximumLength: 25
34
+ }));
35
+ const rootClientId = useSelect(select => {
36
+ const {
37
+ getBlockRootClientId
38
+ } = select(blockEditorStore);
39
+ return getBlockRootClientId(clientId);
40
+ }, [clientId]);
41
+ return createElement(DropdownMenu, _extends({
42
+ icon: moreVertical,
43
+ label: __('Options'),
44
+ className: "block-editor-block-settings-menu",
45
+ popoverProps: POPOVER_PROPS,
46
+ noIcons: true
47
+ }, props), _ref => {
48
+ let {
49
+ onClose
50
+ } = _ref;
51
+ return createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, {
52
+ icon: chevronUp,
53
+ onClick: () => {
54
+ moveBlocksUp([clientId], rootClientId);
55
+ onClose();
56
+ }
57
+ }, __('Move up')), createElement(MenuItem, {
58
+ icon: chevronDown,
59
+ onClick: () => {
60
+ moveBlocksDown([clientId], rootClientId);
61
+ onClose();
62
+ }
63
+ }, __('Move down'))), createElement(MenuGroup, null, createElement(MenuItem, {
64
+ onClick: () => {
65
+ removeBlocks([clientId], false);
66
+ onClose();
67
+ }
68
+ }, removeLabel)));
69
+ });
70
+ }
71
+ //# sourceMappingURL=leaf-more-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js"],"names":["chevronUp","chevronDown","moreVertical","DropdownMenu","MenuItem","MenuGroup","useDispatch","useSelect","__","sprintf","BlockTitle","store","blockEditorStore","POPOVER_PROPS","className","position","variant","LeafMoreMenu","props","block","clientId","moveBlocksDown","moveBlocksUp","removeBlocks","removeLabel","maximumLength","rootClientId","select","getBlockRootClientId","onClose"],"mappings":";;;AAAA;AACA;AACA;AAEA,SAASA,SAAT,EAAoBC,WAApB,EAAiCC,YAAjC,QAAqD,kBAArD;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,QAAkD,uBAAlD;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,UAAT,EAAqBC,KAAK,IAAIC,gBAA9B,QAAsD,yBAAtD;AAEA,MAAMC,a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,CADD,EAUC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGP,WADR;AAEC,MAAA,OAAO,EAAG,MAAM;AACfoB,QAAAA,cAAc,CAAE,CAAED,QAAF,CAAF,EAAgBM,YAAhB,CAAd;AACAG,QAAAA,OAAO;AACP;AALF,OAOGrB,EAAE,CAAE,WAAF,CAPL,CAVD,CADD,EAqBC,cAAC,SAAD,QACC,cAAC,QAAD;AACC,MAAA,OAAO,EAAG,MAAM;AACfe,QAAAA,YAAY,CAAE,CAAEH,QAAF,CAAF,EAAgB,KAAhB,CAAZ;AACAS,QAAAA,OAAO;AACP;AAJF,OAMGL,WANH,CADD,CArBD,CADC;AAAA,GARH,CADD;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tposition: 'bottom right',\n\tvariant: 'toolbar',\n};\n\nexport default function LeafMoreMenu( props ) {\n\tconst { block } = props;\n\tconst { clientId } = block;\n\tconst { moveBlocksDown, moveBlocksUp, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst removeLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksUp( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move up' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksDown( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move down' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ removeLabel }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -3,11 +3,10 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools, __experimentalLinkControl as LinkControl } from '@wordpress/block-editor';
6
+ import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools } from '@wordpress/block-editor';
7
7
  import { useDispatch, useSelect } from '@wordpress/data';
8
8
  import { createBlock } from '@wordpress/blocks';
9
- import { Popover } from '@wordpress/components';
10
- import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
9
+ import { VisuallyHidden } from '@wordpress/components';
11
10
  import { useCallback, useEffect, useState } from '@wordpress/element';
12
11
  import { store as coreStore } from '@wordpress/core-data';
13
12
  /**
@@ -15,46 +14,7 @@ import { store as coreStore } from '@wordpress/core-data';
15
14
  */
16
15
 
17
16
  import { unlock } from '../../private-apis';
18
- import { NavigationMenuLoader } from './loader';
19
-
20
- function CustomLinkAdditionalBlockUI(_ref) {
21
- let {
22
- block,
23
- onClose
24
- } = _ref;
25
- const {
26
- updateBlockAttributes
27
- } = useDispatch(blockEditorStore);
28
- const {
29
- label,
30
- url,
31
- opensInNewTab
32
- } = block.attributes;
33
- const link = {
34
- url,
35
- opensInNewTab,
36
- title: label && stripHTML(label)
37
- };
38
- return createElement(Popover, {
39
- placement: "bottom",
40
- shift: true,
41
- onClose: onClose
42
- }, createElement(LinkControl, {
43
- hasTextControl: true,
44
- hasRichPreviews: true,
45
- value: link,
46
- onChange: updatedValue => {
47
- updateBlockAttributes(block.clientId, {
48
- label: updatedValue.title,
49
- url: updatedValue.url,
50
- opensInNewTab: updatedValue.opensInNewTab
51
- });
52
- onClose();
53
- },
54
- onCancel: onClose
55
- }));
56
- } // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
57
-
17
+ import LeafMoreMenu from './leaf-more-menu'; // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
58
18
 
59
19
  const MAX_PAGE_COUNT = 100;
60
20
  const PAGES_QUERY = ['postType', 'page', {
@@ -66,11 +26,11 @@ const PAGES_QUERY = ['postType', 'page', {
66
26
  orderby: 'menu_order',
67
27
  order: 'asc'
68
28
  }];
69
- export default function NavigationMenuContent(_ref2) {
29
+ export default function NavigationMenuContent(_ref) {
70
30
  let {
71
31
  rootClientId,
72
32
  onSelect
73
- } = _ref2;
33
+ } = _ref;
74
34
  const [isLoading, setIsLoading] = useState(true);
75
35
  const {
76
36
  clientIdsTree,
@@ -101,20 +61,7 @@ export default function NavigationMenuContent(_ref2) {
101
61
  const {
102
62
  replaceBlock,
103
63
  __unstableMarkNextChangeAsNotPersistent
104
- } = useDispatch(blockEditorStore);
105
- const [customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId] = useState(false);
106
- const renderAdditionalBlockUICallback = useCallback(block => {
107
- if (customLinkEditPopoverOpenId && block.clientId === customLinkEditPopoverOpenId) {
108
- return createElement(CustomLinkAdditionalBlockUI, {
109
- block: block,
110
- onClose: () => {
111
- setIsCustomLinkEditPopoverOpenId(false);
112
- }
113
- });
114
- }
115
-
116
- return null;
117
- }, [customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId]); // Delay loading stop by 50ms to avoid flickering.
64
+ } = useDispatch(blockEditorStore); // Delay loading stop by 50ms to avoid flickering.
118
65
 
119
66
  useEffect(() => {
120
67
  let timeoutId;
@@ -137,32 +84,26 @@ export default function NavigationMenuContent(_ref2) {
137
84
  };
138
85
  }, [shouldKeepLoading, clientIdsTree, isLoading]);
139
86
  const {
140
- OffCanvasEditor,
141
- LeafMoreMenu
87
+ PrivateListView
142
88
  } = unlock(blockEditorPrivateApis);
143
89
  const offCanvasOnselect = useCallback(block => {
144
90
  if (block.name === 'core/navigation-link' && !block.attributes.url) {
145
91
  __unstableMarkNextChangeAsNotPersistent();
146
92
 
147
93
  replaceBlock(block.clientId, createBlock('core/navigation-link', block.attributes));
148
- } else if (block.name === 'core/navigation-link' && block.attributes.kind === 'custom' && block.attributes.url) {
149
- setIsCustomLinkEditPopoverOpenId(block.clientId);
150
94
  } else {
151
95
  onSelect(block);
152
96
  }
153
- }, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock, setIsCustomLinkEditPopoverOpenId]); // The hidden block is needed because it makes block edit side effects trigger.
97
+ }, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger.
154
98
  // For example a navigation page list load its items has an effect on edit to load its items.
155
99
 
156
- return createElement(Fragment, null, isLoading && createElement(NavigationMenuLoader, null), !isLoading && createElement(OffCanvasEditor, {
100
+ return createElement(Fragment, null, !isLoading && createElement(PrivateListView, {
157
101
  blocks: isSinglePageList ? clientIdsTree[0].innerBlocks : clientIdsTree,
158
102
  onSelect: offCanvasOnselect,
159
- LeafMoreMenu: LeafMoreMenu,
160
- showAppender: false,
161
- renderAdditionalBlockUI: renderAdditionalBlockUICallback
162
- }), createElement("div", {
163
- style: {
164
- visibility: 'hidden'
165
- }
103
+ blockSettingsMenu: LeafMoreMenu,
104
+ showAppender: false
105
+ }), createElement(VisuallyHidden, {
106
+ "aria-hidden": "true"
166
107
  }, createElement(BlockTools, null, createElement(BlockList, null))));
167
108
  }
168
109
  //# sourceMappingURL=navigation-menu-content.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","__experimentalLinkControl","LinkControl","useDispatch","useSelect","createBlock","Popover","__unstableStripHTML","stripHTML","useCallback","useEffect","useState","coreStore","unlock","NavigationMenuLoader","CustomLinkAdditionalBlockUI","block","onClose","updateBlockAttributes","label","url","opensInNewTab","attributes","link","title","updatedValue","clientId","MAX_PAGE_COUNT","PAGES_QUERY","per_page","_fields","orderby","order","NavigationMenuContent","rootClientId","onSelect","isLoading","setIsLoading","clientIdsTree","shouldKeepLoading","isSinglePageList","select","__unstableGetClientIdsTree","areInnerBlocksControlled","getBlockName","isResolving","_clientIdsTree","hasOnlyPageListBlock","length","isLoadingPages","innerBlocks","replaceBlock","__unstableMarkNextChangeAsNotPersistent","customLinkEditPopoverOpenId","setIsCustomLinkEditPopoverOpenId","renderAdditionalBlockUICallback","timeoutId","setTimeout","undefined","clearTimeout","OffCanvasEditor","LeafMore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Z;AAOC,IAAA,YAAY,EAAGD,YAPhB;AAQC,IAAA,YAAY,EAAG,KARhB;AASC,IAAA,uBAAuB,EAAGN;AAT3B,IAHF,EAeC;AAAK,IAAA,KAAK,EAAG;AAAEU,MAAAA,UAAU,EAAE;AAAd;AAAb,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAfD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n\t__experimentalLinkControl as LinkControl,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { Popover } from '@wordpress/components';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { NavigationMenuLoader } from './loader';\n\nfunction CustomLinkAdditionalBlockUI( { block, onClose } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { label, url, opensInNewTab } = block.attributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t\ttitle: label && stripHTML( label ),\n\t};\n\treturn (\n\t\t<Popover placement=\"bottom\" shift onClose={ onClose }>\n\t\t\t<LinkControl\n\t\t\t\thasTextControl\n\t\t\t\thasRichPreviews\n\t\t\t\tvalue={ link }\n\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\tupdateBlockAttributes( block.clientId, {\n\t\t\t\t\t\tlabel: updatedValue.title,\n\t\t\t\t\t\turl: updatedValue.url,\n\t\t\t\t\t\topensInNewTab: updatedValue.opensInNewTab,\n\t\t\t\t\t} );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ onClose }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.\nconst MAX_PAGE_COUNT = 100;\nconst PAGES_QUERY = [\n\t'postType',\n\t'page',\n\t{\n\t\tper_page: MAX_PAGE_COUNT,\n\t\t_fields: [ 'id', 'link', 'menu_order', 'parent', 'title', 'type' ],\n\t\t// TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby\n\t\t// values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent\n\t\t// sort.\n\t\torderby: 'menu_order',\n\t\torder: 'asc',\n\t},\n];\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst [ isLoading, setIsLoading ] = useState( true );\n\tconst { clientIdsTree, shouldKeepLoading, isSinglePageList } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__unstableGetClientIdsTree,\n\t\t\t\tareInnerBlocksControlled,\n\t\t\t\tgetBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { isResolving } = select( coreStore );\n\n\t\t\tconst _clientIdsTree = __unstableGetClientIdsTree( rootClientId );\n\t\t\tconst hasOnlyPageListBlock =\n\t\t\t\t_clientIdsTree.length === 1 &&\n\t\t\t\tgetBlockName( _clientIdsTree[ 0 ].clientId ) ===\n\t\t\t\t\t'core/page-list';\n\t\t\tconst isLoadingPages = isResolving(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tPAGES_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tclientIdsTree: _clientIdsTree,\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tshouldKeepLoading:\n\t\t\t\t\t! areInnerBlocksControlled( rootClientId ) ||\n\t\t\t\t\tisLoadingPages,\n\t\t\t\tisSinglePageList:\n\t\t\t\t\thasOnlyPageListBlock &&\n\t\t\t\t\t! isLoadingPages &&\n\t\t\t\t\t_clientIdsTree[ 0 ].innerBlocks.length > 0,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst [ customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId ] =\n\t\tuseState( false );\n\n\tconst renderAdditionalBlockUICallback = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tcustomLinkEditPopoverOpenId &&\n\t\t\t\tblock.clientId === customLinkEditPopoverOpenId\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t<CustomLinkAdditionalBlockUI\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsCustomLinkEditPopoverOpenId( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\t[ customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId ]\n\t);\n\n\t// Delay loading stop by 50ms to avoid flickering.\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\t\tif ( shouldKeepLoading && ! isLoading ) {\n\t\t\tsetIsLoading( true );\n\t\t}\n\t\tif ( ! shouldKeepLoading && isLoading ) {\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetIsLoading( false );\n\t\t\t\ttimeoutId = undefined;\n\t\t\t}, 50 );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ shouldKeepLoading, clientIdsTree, isLoading ] );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\tblock.attributes.kind === 'custom' &&\n\t\t\t\tblock.attributes.url\n\t\t\t) {\n\t\t\t\tsetIsCustomLinkEditPopoverOpenId( block.clientId );\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tonSelect,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\treplaceBlock,\n\t\t\tsetIsCustomLinkEditPopoverOpenId,\n\t\t]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ isLoading && <NavigationMenuLoader /> }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<OffCanvasEditor\n\t\t\t\t\tblocks={\n\t\t\t\t\t\tisSinglePageList\n\t\t\t\t\t\t\t? clientIdsTree[ 0 ].innerBlocks\n\t\t\t\t\t\t\t: clientIdsTree\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t\trenderAdditionalBlockUI={ renderAdditionalBlockUICallback }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div style={ { visibility: 'hidden' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","useDispatch","useSelect","createBlock","VisuallyHidden","useCallback","useEffect","useState","coreStore","unlock","LeafMoreMenu","MAX_PAGE_COUNT","PAGES_QUERY","per_page","_fields","orderby","order","NavigationMenuContent","rootClientId","onSelect","isLoading","setIsLoading","clientIdsTree","shouldKeepLoading","isSinglePageList","select","__unstableGetClientIdsTree","areInnerBlocksControlled","getBlockName","isResolving","_clientIdsTree","hasOnlyPageListBlock","length","clientId","isLoadingPages","innerBlocks","replaceBlock","__unstableMarkNextChangeAsNotPersistent","timeoutId","setTimeout","undefined","clearTimeout","PrivateListView","offCanvasOnselect","block","name","attributes","url"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,EAGCC,SAHD,EAICC,UAJD,QAKO,yBALP;AAMA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,QAAjC,QAAiD,oBAAjD;AACA,SAASV,KAAK,IAAIW,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,YAAP,MAAyB,kBAAzB,C,CAEA;;AACA,MAAMC,cAAc,GAAG,GAAvB;AACA,MAAMC,WAAW,GAAG,CACnB,UADmB,EAEnB,MAFmB,EAGnB;AACCC,EAAAA,QAAQ,EAAEF,cADX;AAECG,EAAAA,OAAO,EAAE,CAAE,IAAF,EAAQ,MAAR,EAAgB,YAAhB,EAA8B,QAA9B,EAAwC,OAAxC,EAAiD,MAAjD,CAFV;AAGC;AACA;AACA;AACAC,EAAAA,OAAO,EAAE,YANV;AAOCC,EAAAA,KAAK,EAAE;AAPR,CAHmB,CAApB;AAcA,eAAe,SAASC,qBAAT,OAA6D;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AAC3E,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8Bd,QAAQ,CAAE,IAAF,CAA5C;AACA,QAAM;AAAEe,IAAAA,aAAF;AAA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AAZ;AACAiB,QAAAA,SAAS,GAAGE,SAAZ;AACA,OAHqB,EAGnB,EAHmB,CAAtB;AAIA;;AACD,WAAO,MAAM;AACZ,UAAKF,SAAL,EAAiB;AAChBG,QAAAA,YAAY,CAAEH,SAAF,CAAZ;AACA;AACD,KAJD;AAKA,GAhBQ,EAgBN,CAAEf,iBAAF,EAAqBD,aAArB,EAAoCF,SAApC,CAhBM,CAAT;AAkBA,QAAM;AAAEsB,IAAAA;AAAF,MAAsBjC,MAAM,CAAEb,sBAAF,CAAlC;AACA,QAAM+C,iBAAiB,GAAGtC,WAAW,CAClCuC,KAAF,IAAa;AACZ,QACCA,KAAK,CAACC,IAAN,KAAe,sBAAf,IACA,CAAED,KAAK,CAACE,UAAN,CAAiBC,GAFpB,EAGE;AACDV,MAAAA,uCAAuC;;AACvCD,MAAAA,YAAY,CACXQ,KAAK,CAACX,QADK,EAEX9B,WAAW,CAAE,sBAAF,EAA0ByC,KAAK,CAACE,UAAhC,CAFA,CAAZ;AAIA,KATD,MASO;AACN3B,MAAAA,QAAQ,CAAEyB,KAAF,CAAR;AACA;AACD,GAdmC,EAepC,CAAEzB,QAAF,EAAYkB,uCAAZ,EAAqDD,YAArD,CAfoC,CAArC,CA1D2E,CA4E3E;AACA;;AACA,SACC,8BACG,CAAEhB,SAAF,IACD,cAAC,eAAD;AACC,IAAA,MAAM,EACLI,gBAAgB,GACbF,aAAa,CAAE,CAAF,CAAb,CAAmBa,WADN,GAEbb,aAJL;AAMC,IAAA,QAAQ,EAAGqB,iBANZ;AAOC,IAAA,iBAAiB,EAAGjC,YAPrB;AAQC,IAAA,YAAY,EAAG;AARhB,IAFF,EAaC,cAAC,cAAD;AAAgB,mBAAY;AAA5B,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAbD,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport LeafMoreMenu from './leaf-more-menu';\n\n// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.\nconst MAX_PAGE_COUNT = 100;\nconst PAGES_QUERY = [\n\t'postType',\n\t'page',\n\t{\n\t\tper_page: MAX_PAGE_COUNT,\n\t\t_fields: [ 'id', 'link', 'menu_order', 'parent', 'title', 'type' ],\n\t\t// TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby\n\t\t// values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent\n\t\t// sort.\n\t\torderby: 'menu_order',\n\t\torder: 'asc',\n\t},\n];\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst [ isLoading, setIsLoading ] = useState( true );\n\tconst { clientIdsTree, shouldKeepLoading, isSinglePageList } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__unstableGetClientIdsTree,\n\t\t\t\tareInnerBlocksControlled,\n\t\t\t\tgetBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { isResolving } = select( coreStore );\n\n\t\t\tconst _clientIdsTree = __unstableGetClientIdsTree( rootClientId );\n\t\t\tconst hasOnlyPageListBlock =\n\t\t\t\t_clientIdsTree.length === 1 &&\n\t\t\t\tgetBlockName( _clientIdsTree[ 0 ].clientId ) ===\n\t\t\t\t\t'core/page-list';\n\t\t\tconst isLoadingPages = isResolving(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tPAGES_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tclientIdsTree: _clientIdsTree,\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tshouldKeepLoading:\n\t\t\t\t\t! areInnerBlocksControlled( rootClientId ) ||\n\t\t\t\t\tisLoadingPages,\n\t\t\t\tisSinglePageList:\n\t\t\t\t\thasOnlyPageListBlock &&\n\t\t\t\t\t! isLoadingPages &&\n\t\t\t\t\t_clientIdsTree[ 0 ].innerBlocks.length > 0,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Delay loading stop by 50ms to avoid flickering.\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\t\tif ( shouldKeepLoading && ! isLoading ) {\n\t\t\tsetIsLoading( true );\n\t\t}\n\t\tif ( ! shouldKeepLoading && isLoading ) {\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetIsLoading( false );\n\t\t\t\ttimeoutId = undefined;\n\t\t\t}, 50 );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ shouldKeepLoading, clientIdsTree, isLoading ] );\n\n\tconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ ! isLoading && (\n\t\t\t\t<PrivateListView\n\t\t\t\t\tblocks={\n\t\t\t\t\t\tisSinglePageList\n\t\t\t\t\t\t\t? clientIdsTree[ 0 ].innerBlocks\n\t\t\t\t\t\t\t: clientIdsTree\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tblockSettingsMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<VisuallyHidden aria-hidden=\"true\">\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,40 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement } from "@wordpress/element";
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
8
+ import { useEntityRecords } from '@wordpress/core-data';
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
14
+ export default function SidebarNavigationScreenNavigationMenuButton(_ref) {
15
+ let {
16
+ children,
17
+ ...props
18
+ } = _ref;
19
+ const {
20
+ records: navigationMenus,
21
+ isResolving: isLoading
22
+ } = useEntityRecords('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY);
23
+ const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
24
+ const hasSingleNavigationMenu = (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) === 1;
25
+ const firstNavigationMenu = navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus[0];
26
+ const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN ? hasNavigationMenus : false; // If there is a single menu then we can go directly to that menu.
27
+ // Otherwise we go to the navigation listing screen.
28
+
29
+ const path = hasSingleNavigationMenu ? `/navigation/wp_navigation/${firstNavigationMenu === null || firstNavigationMenu === void 0 ? void 0 : firstNavigationMenu.id}` : '/navigation';
30
+
31
+ if (!showNavigationScreen) {
32
+ return null;
33
+ }
34
+
35
+ return createElement(NavigatorButton, _extends({}, props, {
36
+ disabled: isLoading,
37
+ path: path
38
+ }), children);
39
+ }
40
+ //# sourceMappingURL=navigator-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js"],"names":["__experimentalNavigatorButton","NavigatorButton","useEntityRecords","PRELOADED_NAVIGATION_MENUS_QUERY","SidebarNavigationScreenNavigationMenuButton","children","props","records","navigationMenus","isResolving","isLoading","hasNavigationMenus","length","hasSingleNavigationMenu","firstNavigationMenu","showNavigationScreen","process","env","IS_GUTENBERG_PLUGIN","path","id"],"mappings":";;;AAAA;AACA;AACA;AAEA,SAASA,6BAA6B,IAAIC,eAA1C,QAAiE,uBAAjE;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AAEA;AACA;AACA;;AACA,SAASC,gCAAT,QAAiD,aAAjD;AAEA,eAAe,SAASC,2CAAT,OAGX;AAAA,MAHiE;AACpEC,IAAAA,QADoE;AAEpE,OAAGC;AAFiE,GAGjE;AACH,QAAM;AAAEC,IAAAA,OAAO,EAAEC,eAAX;AAA4BC,IAAAA,WAAW,EAAEC;AAAzC,MACLR,gBAAgB,CACf,UADe,EAEd,eAFc,EAGfC,gCAHe,CADjB;AAOA,QAAMQ,kBAAkB,GAAG,CAAC,EAAEH,eAAF,aAAEA,eAAF,eAAEA,eAAe,CAAEI,MAAnB,CAA5B;AACA,QAAMC,uBAAuB,GAAG,CAAAL,eAAe,SAAf,IAAAA,eAAe,WAAf,YAAAA,eAAe,CAAEI,MAAjB,MAA4B,CAA5D;AACA,QAAME,mBAAmB,GAAGN,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAI,CAAJ,CAA3C;AAEA,QAAMO,oBAAoB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAC1BP,kBAD0B,GAE1B,KAFH,CAZG,CAgBH;AACA;;AACA,QAAMQ,IAAI,GAAGN,uBAAuB,GAChC,6BAA6BC,mBAA9B,aAA8BA,mBAA9B,uBAA8BA,mBAAmB,CAAEM,EAAI,EADtB,GAEjC,aAFH;;AAIA,MAAK,CAAEL,oBAAP,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,cAAC,eAAD,eAAsBT,KAAtB;AAA8B,IAAA,QAAQ,EAAGI,SAAzC;AAAqD,IAAA,IAAI,EAAGS;AAA5D,MACGd,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useEntityRecords } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\n\nexport default function SidebarNavigationScreenNavigationMenuButton( {\n\tchildren,\n\t...props\n} ) {\n\tconst { records: navigationMenus, isResolving: isLoading } =\n\t\tuseEntityRecords(\n\t\t\t'postType',\n\t\t\t`wp_navigation`,\n\t\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t\t);\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\tconst hasSingleNavigationMenu = navigationMenus?.length === 1;\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\tconst showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN\n\t\t? hasNavigationMenus\n\t\t: false;\n\n\t// If there is a single menu then we can go directly to that menu.\n\t// Otherwise we go to the navigation listing screen.\n\tconst path = hasSingleNavigationMenu\n\t\t? `/navigation/wp_navigation/${ firstNavigationMenu?.id }`\n\t\t: '/navigation';\n\n\tif ( ! showNavigationScreen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigatorButton { ...props } disabled={ isLoading } path={ path }>\n\t\t\t{ children }\n\t\t</NavigatorButton>\n\t);\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { __experimentalUseNavigator as useNavigator, ExternalLink } from '@wordpress/components';
9
+ import { useEntityRecord } from '@wordpress/core-data';
10
+ import { decodeEntities } from '@wordpress/html-entities';
11
+ import { pencil } from '@wordpress/icons';
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+
16
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
17
+ import { unlock } from '../../private-apis';
18
+ import { store as editSiteStore } from '../../store';
19
+ import SidebarButton from '../sidebar-button';
20
+ export default function SidebarNavigationScreenPage() {
21
+ var _record$title, _record$description;
22
+
23
+ const {
24
+ setCanvasMode
25
+ } = unlock(useDispatch(editSiteStore));
26
+ const {
27
+ params: {
28
+ postId
29
+ }
30
+ } = useNavigator();
31
+ const {
32
+ record
33
+ } = useEntityRecord('postType', 'page', postId);
34
+ return createElement(SidebarNavigationScreen, {
35
+ title: record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) : null,
36
+ actions: createElement(SidebarButton, {
37
+ onClick: () => setCanvasMode('edit'),
38
+ label: __('Edit'),
39
+ icon: pencil
40
+ }),
41
+ description: __('Pages are static and are not listed by date. Pages do not use tags or categories.'),
42
+ content: createElement(Fragment, null, record !== null && record !== void 0 && record.link ? createElement(ExternalLink, {
43
+ className: "edit-site-sidebar-navigation-screen__page-link",
44
+ href: record.link
45
+ }, record.link) : null, record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$description = record.description) === null || _record$description === void 0 ? void 0 : _record$description.rendered) : null)
46
+ });
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"names":["__","useDispatch","__experimentalUseNavigator","useNavigator","ExternalLink","useEntityRecord","decodeEntities","pencil","SidebarNavigationScreen","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenPage","setCanvasMode","params","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,2BAAT,GAAuC;AAAA;;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,MAAM,CAAER,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFb,YAAY,EAFhB;AAGA,QAAM;AAAEc,IAAAA;AAAF,MAAaZ,eAAe,CAAE,UAAF,EAAc,MAAd,EAAsBW,MAAtB,CAAlC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,MAAM,GAAGX,cAAc,CAAEW,MAAF,aAAEA,MAAF,wCAAEA,MAAM,CAAEC,KAAV,kDAAE,cAAeC,QAAjB,CAAjB,GAA+C,IAD9D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAML,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,WAAW,EAAGP,EAAE,CACf,mFADe,CATjB;AAYC,IAAA,OAAO,EACN,8BACGiB,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,GACLX,cAAc,CAAEW,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 SidebarNavigationScreenPage() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', 'page', 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'Pages are static and are not listed by date. Pages do not use tags or categories.'\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"]}