@wordpress/edit-site 5.33.0 → 5.35.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 (543) hide show
  1. package/CHANGELOG.md +11 -3
  2. package/build/components/add-new-page/index.js +3 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +8 -7
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/add-new-template/index.js +2 -2
  11. package/build/components/add-new-template/index.js.map +1 -1
  12. package/build/components/app/index.js +4 -2
  13. package/build/components/app/index.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +4 -18
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/resize-handle.js +20 -5
  17. package/build/components/block-editor/resize-handle.js.map +1 -1
  18. package/build/components/block-editor/site-editor-canvas.js +2 -2
  19. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  20. package/build/components/create-template-part-modal/index.js +3 -0
  21. package/build/components/create-template-part-modal/index.js.map +1 -1
  22. package/build/components/dataviews-actions/index.js +46 -0
  23. package/build/components/dataviews-actions/index.js.map +1 -0
  24. package/build/components/editor/index.js +95 -16
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/global-styles/background-panel.js +13 -1
  27. package/build/components/global-styles/background-panel.js.map +1 -1
  28. package/build/components/global-styles/color-indicator-wrapper.js +2 -2
  29. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  30. package/build/components/global-styles/color-palette-panel.js +5 -2
  31. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/font-library-modal/context.js +9 -3
  33. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  34. package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
  35. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  36. package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  37. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  38. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  39. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  40. package/build/components/global-styles/gradients-palette-panel.js +1 -2
  41. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  42. package/build/components/global-styles/hooks.js +5 -2
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/icon-with-current-color.js +2 -2
  45. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  46. package/build/components/global-styles/preset-colors.js +29 -0
  47. package/build/components/global-styles/preset-colors.js.map +1 -0
  48. package/build/components/global-styles/preview-colors.js +3 -7
  49. package/build/components/global-styles/preview-colors.js.map +1 -1
  50. package/build/components/global-styles/screen-color-palette.js +5 -5
  51. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  52. package/build/components/global-styles/screen-colors.js +1 -4
  53. package/build/components/global-styles/screen-colors.js.map +1 -1
  54. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  55. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +8 -2
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-example.js +5 -2
  59. package/build/components/global-styles/typography-example.js.map +1 -1
  60. package/build/components/global-styles/ui.js +4 -1
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations/variation.js +12 -6
  63. package/build/components/global-styles/variations/variation.js.map +1 -1
  64. package/build/components/global-styles/variations/variations-color.js +5 -5
  65. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  66. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  67. package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  68. package/build/components/global-styles-sidebar/index.js.map +1 -0
  69. package/build/components/header-edit-mode/index.js +21 -137
  70. package/build/components/header-edit-mode/index.js.map +1 -1
  71. package/build/components/header-edit-mode/more-menu/index.js +3 -97
  72. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  73. package/build/components/keyboard-shortcuts/register.js +0 -49
  74. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  75. package/build/components/layout/index.js +9 -9
  76. package/build/components/layout/index.js.map +1 -1
  77. package/build/components/layout/router.js +70 -44
  78. package/build/components/layout/router.js.map +1 -1
  79. package/build/components/page/index.js +2 -2
  80. package/build/components/page/index.js.map +1 -1
  81. package/build/components/page-pages/index.js +4 -14
  82. package/build/components/page-pages/index.js.map +1 -1
  83. package/build/components/page-patterns/dataviews-pattern-actions.js +15 -87
  84. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  85. package/build/components/page-patterns/header.js +3 -1
  86. package/build/components/page-patterns/header.js.map +1 -1
  87. package/build/components/page-patterns/index.js +28 -68
  88. package/build/components/page-patterns/index.js.map +1 -1
  89. package/build/components/page-patterns/use-patterns.js +1 -0
  90. package/build/components/page-patterns/use-patterns.js.map +1 -1
  91. package/build/components/page-templates/hooks.js.map +1 -0
  92. package/build/components/{page-templates-template-parts → page-templates}/index.js +73 -94
  93. package/build/components/page-templates/index.js.map +1 -0
  94. package/build/components/pagination/index.js +2 -2
  95. package/build/components/pagination/index.js.map +1 -1
  96. package/build/components/pattern-modal/duplicate.js +7 -5
  97. package/build/components/pattern-modal/duplicate.js.map +1 -1
  98. package/build/components/plugin-template-setting-panel/index.js +9 -0
  99. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  100. package/build/components/resizable-frame/index.js +20 -9
  101. package/build/components/resizable-frame/index.js.map +1 -1
  102. package/build/components/revisions/index.js +5 -2
  103. package/build/components/revisions/index.js.map +1 -1
  104. package/build/components/save-panel/index.js +4 -4
  105. package/build/components/save-panel/index.js.map +1 -1
  106. package/build/components/sidebar/index.js +61 -31
  107. package/build/components/sidebar/index.js.map +1 -1
  108. package/build/components/sidebar-button/index.js +2 -2
  109. package/build/components/sidebar-button/index.js.map +1 -1
  110. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  111. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  112. package/build/components/sidebar-navigation-item/index.js +5 -3
  113. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen/index.js +6 -32
  115. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  117. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  119. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  121. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  122. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  123. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  124. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  125. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  127. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  129. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-page/index.js +39 -8
  131. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -2
  133. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-pattern/index.js +3 -15
  135. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  137. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  139. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  141. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-patterns/index.js +25 -29
  143. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  144. package/build/components/sidebar-navigation-screen-template/index.js +5 -2
  145. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  146. package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  147. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  148. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -33
  149. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  150. package/build/components/site-hub/index.js +3 -3
  151. package/build/components/site-hub/index.js.map +1 -1
  152. package/build/components/site-icon/index.js +2 -2
  153. package/build/components/site-icon/index.js.map +1 -1
  154. package/build/components/style-book/index.js +10 -7
  155. package/build/components/style-book/index.js.map +1 -1
  156. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  157. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  158. package/build/components/template-actions/index.js +1 -1
  159. package/build/components/template-actions/index.js.map +1 -1
  160. package/build/components/template-part-converter/index.js +18 -1
  161. package/build/components/template-part-converter/index.js.map +1 -1
  162. package/build/deprecated.js +55 -0
  163. package/build/deprecated.js.map +1 -0
  164. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +40 -6
  165. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  166. package/build/index.js +18 -18
  167. package/build/index.js.map +1 -1
  168. package/build/utils/constants.js +1 -2
  169. package/build/utils/constants.js.map +1 -1
  170. package/build/utils/get-is-list-page.js +1 -1
  171. package/build/utils/get-is-list-page.js.map +1 -1
  172. package/build/utils/use-activate-theme.js +9 -6
  173. package/build/utils/use-activate-theme.js.map +1 -1
  174. package/build-module/components/add-new-page/index.js +3 -0
  175. package/build-module/components/add-new-page/index.js.map +1 -1
  176. package/build-module/components/add-new-pattern/index.js +8 -7
  177. package/build-module/components/add-new-pattern/index.js.map +1 -1
  178. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  179. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  180. package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
  181. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  182. package/build-module/components/add-new-template/index.js +2 -2
  183. package/build-module/components/add-new-template/index.js.map +1 -1
  184. package/build-module/components/app/index.js +4 -2
  185. package/build-module/components/app/index.js.map +1 -1
  186. package/build-module/components/block-editor/editor-canvas.js +4 -18
  187. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  188. package/build-module/components/block-editor/resize-handle.js +21 -6
  189. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  190. package/build-module/components/block-editor/site-editor-canvas.js +2 -2
  191. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  192. package/build-module/components/create-template-part-modal/index.js +3 -0
  193. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  194. package/build-module/components/dataviews-actions/index.js +38 -0
  195. package/build-module/components/dataviews-actions/index.js.map +1 -0
  196. package/build-module/components/editor/index.js +96 -17
  197. package/build-module/components/editor/index.js.map +1 -1
  198. package/build-module/components/global-styles/background-panel.js +12 -1
  199. package/build-module/components/global-styles/background-panel.js.map +1 -1
  200. package/build-module/components/global-styles/color-indicator-wrapper.js +2 -2
  201. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  202. package/build-module/components/global-styles/color-palette-panel.js +4 -2
  203. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  204. package/build-module/components/global-styles/font-library-modal/context.js +9 -3
  205. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  206. package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
  207. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  208. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  209. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  210. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  211. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  212. package/build-module/components/global-styles/gradients-palette-panel.js +1 -2
  213. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  214. package/build-module/components/global-styles/hooks.js +4 -1
  215. package/build-module/components/global-styles/hooks.js.map +1 -1
  216. package/build-module/components/global-styles/icon-with-current-color.js +2 -2
  217. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  218. package/build-module/components/global-styles/preset-colors.js +22 -0
  219. package/build-module/components/global-styles/preset-colors.js.map +1 -0
  220. package/build-module/components/global-styles/preview-colors.js +3 -7
  221. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  222. package/build-module/components/global-styles/screen-color-palette.js +5 -5
  223. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  224. package/build-module/components/global-styles/screen-colors.js +1 -4
  225. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  226. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  227. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  228. package/build-module/components/global-styles/style-variations-container.js +8 -2
  229. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  230. package/build-module/components/global-styles/typography-example.js +4 -1
  231. package/build-module/components/global-styles/typography-example.js.map +1 -1
  232. package/build-module/components/global-styles/ui.js +4 -1
  233. package/build-module/components/global-styles/ui.js.map +1 -1
  234. package/build-module/components/global-styles/variations/variation.js +11 -5
  235. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  236. package/build-module/components/global-styles/variations/variations-color.js +6 -6
  237. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  238. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
  239. package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
  240. package/build-module/components/global-styles-sidebar/index.js.map +1 -0
  241. package/build-module/components/header-edit-mode/index.js +22 -138
  242. package/build-module/components/header-edit-mode/index.js.map +1 -1
  243. package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
  244. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  245. package/build-module/components/keyboard-shortcuts/register.js +0 -49
  246. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  247. package/build-module/components/layout/index.js +9 -9
  248. package/build-module/components/layout/index.js.map +1 -1
  249. package/build-module/components/layout/router.js +70 -45
  250. package/build-module/components/layout/router.js.map +1 -1
  251. package/build-module/components/page/index.js +2 -2
  252. package/build-module/components/page/index.js.map +1 -1
  253. package/build-module/components/page-pages/index.js +5 -15
  254. package/build-module/components/page-pages/index.js.map +1 -1
  255. package/build-module/components/page-patterns/dataviews-pattern-actions.js +15 -87
  256. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  257. package/build-module/components/page-patterns/header.js +3 -1
  258. package/build-module/components/page-patterns/header.js.map +1 -1
  259. package/build-module/components/page-patterns/index.js +31 -71
  260. package/build-module/components/page-patterns/index.js.map +1 -1
  261. package/build-module/components/page-patterns/use-patterns.js +1 -0
  262. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  263. package/build-module/components/page-templates/hooks.js.map +1 -0
  264. package/build-module/components/{page-templates-template-parts → page-templates}/index.js +73 -94
  265. package/build-module/components/page-templates/index.js.map +1 -0
  266. package/build-module/components/pagination/index.js +2 -2
  267. package/build-module/components/pagination/index.js.map +1 -1
  268. package/build-module/components/pattern-modal/duplicate.js +7 -5
  269. package/build-module/components/pattern-modal/duplicate.js.map +1 -1
  270. package/build-module/components/plugin-template-setting-panel/index.js +8 -0
  271. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  272. package/build-module/components/resizable-frame/index.js +21 -10
  273. package/build-module/components/resizable-frame/index.js.map +1 -1
  274. package/build-module/components/revisions/index.js +4 -1
  275. package/build-module/components/revisions/index.js.map +1 -1
  276. package/build-module/components/save-panel/index.js +4 -4
  277. package/build-module/components/save-panel/index.js.map +1 -1
  278. package/build-module/components/sidebar/index.js +62 -32
  279. package/build-module/components/sidebar/index.js.map +1 -1
  280. package/build-module/components/sidebar-button/index.js +2 -2
  281. package/build-module/components/sidebar-button/index.js.map +1 -1
  282. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  283. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-item/index.js +5 -3
  285. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  286. package/build-module/components/sidebar-navigation-screen/index.js +6 -32
  287. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  288. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  289. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -1
  291. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
  293. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
  295. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  297. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  298. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
  299. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
  301. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
  303. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -2
  305. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-pattern/index.js +3 -15
  307. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  308. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  309. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  310. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  311. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  312. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  313. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  314. package/build-module/components/sidebar-navigation-screen-patterns/index.js +26 -30
  315. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  316. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -2
  317. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  318. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  319. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  320. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -33
  321. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  322. package/build-module/components/site-hub/index.js +3 -3
  323. package/build-module/components/site-hub/index.js.map +1 -1
  324. package/build-module/components/site-icon/index.js +2 -2
  325. package/build-module/components/site-icon/index.js.map +1 -1
  326. package/build-module/components/style-book/index.js +9 -6
  327. package/build-module/components/style-book/index.js.map +1 -1
  328. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  329. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  330. package/build-module/components/template-actions/index.js +1 -1
  331. package/build-module/components/template-actions/index.js.map +1 -1
  332. package/build-module/components/template-part-converter/index.js +18 -1
  333. package/build-module/components/template-part-converter/index.js.map +1 -1
  334. package/build-module/deprecated.js +45 -0
  335. package/build-module/deprecated.js.map +1 -0
  336. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +38 -5
  337. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  338. package/build-module/index.js +2 -4
  339. package/build-module/index.js.map +1 -1
  340. package/build-module/utils/constants.js +0 -1
  341. package/build-module/utils/constants.js.map +1 -1
  342. package/build-module/utils/get-is-list-page.js +1 -1
  343. package/build-module/utils/get-is-list-page.js.map +1 -1
  344. package/build-module/utils/use-activate-theme.js +9 -6
  345. package/build-module/utils/use-activate-theme.js.map +1 -1
  346. package/build-style/style-rtl.css +208 -484
  347. package/build-style/style.css +208 -484
  348. package/package.json +43 -45
  349. package/src/components/add-new-page/index.js +7 -1
  350. package/src/components/add-new-pattern/index.js +15 -12
  351. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  352. package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
  353. package/src/components/add-new-template/index.js +2 -2
  354. package/src/components/app/index.js +5 -2
  355. package/src/components/block-editor/editor-canvas.js +6 -26
  356. package/src/components/block-editor/resize-handle.js +30 -11
  357. package/src/components/block-editor/site-editor-canvas.js +2 -2
  358. package/src/components/block-editor/style.scss +12 -17
  359. package/src/components/create-template-part-modal/index.js +3 -0
  360. package/src/components/dataviews-actions/index.js +38 -0
  361. package/src/components/editor/index.js +117 -18
  362. package/src/components/editor/style.scss +6 -5
  363. package/src/components/global-styles/background-panel.js +17 -2
  364. package/src/components/global-styles/color-indicator-wrapper.js +2 -2
  365. package/src/components/global-styles/color-palette-panel.js +3 -4
  366. package/src/components/global-styles/font-library-modal/context.js +9 -3
  367. package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
  368. package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
  369. package/src/components/global-styles/font-library-modal/style.scss +17 -0
  370. package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  371. package/src/components/global-styles/gradients-palette-panel.js +1 -4
  372. package/src/components/global-styles/hooks.js +2 -1
  373. package/src/components/global-styles/icon-with-current-color.js +2 -2
  374. package/src/components/global-styles/preset-colors.js +18 -0
  375. package/src/components/global-styles/preview-colors.js +4 -7
  376. package/src/components/global-styles/screen-color-palette.js +4 -4
  377. package/src/components/global-styles/screen-colors.js +0 -2
  378. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  379. package/src/components/global-styles/stories/index.story.js +2 -1
  380. package/src/components/global-styles/style-variations-container.js +11 -2
  381. package/src/components/global-styles/typography-example.js +2 -1
  382. package/src/components/global-styles/ui.js +5 -1
  383. package/src/components/global-styles/variations/style.scss +15 -31
  384. package/src/components/global-styles/variations/variation.js +13 -10
  385. package/src/components/global-styles/variations/variations-color.js +5 -8
  386. package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
  387. package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
  388. package/src/components/header-edit-mode/index.js +25 -184
  389. package/src/components/header-edit-mode/more-menu/index.js +8 -145
  390. package/src/components/header-edit-mode/style.scss +1 -271
  391. package/src/components/keyboard-shortcuts/register.js +0 -58
  392. package/src/components/layout/index.js +14 -10
  393. package/src/components/layout/router.js +66 -56
  394. package/src/components/layout/style.scss +2 -1
  395. package/src/components/page/index.js +2 -2
  396. package/src/components/page-pages/index.js +8 -28
  397. package/src/components/page-patterns/dataviews-pattern-actions.js +11 -101
  398. package/src/components/page-patterns/header.js +3 -1
  399. package/src/components/page-patterns/index.js +32 -110
  400. package/src/components/page-patterns/style.scss +14 -1
  401. package/src/components/page-patterns/use-patterns.js +1 -0
  402. package/src/components/{page-templates-template-parts → page-templates}/index.js +33 -75
  403. package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
  404. package/src/components/pagination/index.js +2 -2
  405. package/src/components/pattern-modal/duplicate.js +4 -3
  406. package/src/components/plugin-template-setting-panel/index.js +8 -0
  407. package/src/components/resizable-frame/index.js +20 -7
  408. package/src/components/revisions/index.js +2 -1
  409. package/src/components/save-panel/index.js +4 -4
  410. package/src/components/sidebar/index.js +61 -37
  411. package/src/components/sidebar-button/index.js +2 -5
  412. package/src/components/sidebar-dataviews/dataview-item.js +4 -7
  413. package/src/components/sidebar-navigation-item/index.js +3 -3
  414. package/src/components/sidebar-navigation-screen/index.js +7 -31
  415. package/src/components/sidebar-navigation-screen/style.scss +11 -9
  416. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
  417. package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -1
  418. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
  419. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
  420. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
  421. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
  422. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +0 -10
  423. package/src/components/sidebar-navigation-screen-page/index.js +48 -9
  424. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -2
  425. package/src/components/sidebar-navigation-screen-pattern/index.js +1 -12
  426. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  427. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  428. package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
  429. package/src/components/sidebar-navigation-screen-patterns/index.js +20 -39
  430. package/src/components/sidebar-navigation-screen-template/index.js +3 -2
  431. package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  432. package/src/components/sidebar-navigation-screen-templates-browse/index.js +8 -39
  433. package/src/components/site-hub/index.js +3 -3
  434. package/src/components/site-icon/index.js +2 -2
  435. package/src/components/style-book/index.js +7 -6
  436. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
  437. package/src/components/template-actions/index.js +1 -1
  438. package/src/components/template-part-converter/index.js +16 -3
  439. package/src/deprecated.js +42 -0
  440. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +71 -17
  441. package/src/index.js +2 -9
  442. package/src/style.scss +2 -16
  443. package/src/utils/constants.js +1 -1
  444. package/src/utils/get-is-list-page.js +1 -3
  445. package/src/utils/use-activate-theme.js +4 -4
  446. package/build/components/global-styles/global-styles-provider.js +0 -129
  447. package/build/components/global-styles/global-styles-provider.js.map +0 -1
  448. package/build/components/header-edit-mode/document-tools/index.js +0 -68
  449. package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
  450. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
  451. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  452. package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
  453. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  454. package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
  455. package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  456. package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
  457. package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  458. package/build/components/page-templates-template-parts/hooks.js.map +0 -1
  459. package/build/components/page-templates-template-parts/index.js.map +0 -1
  460. package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  461. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  462. package/build/components/sidebar-edit-mode/index.js +0 -146
  463. package/build/components/sidebar-edit-mode/index.js.map +0 -1
  464. package/build/components/sidebar-edit-mode/page-panels/index.js +0 -98
  465. package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  466. package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
  467. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  468. package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
  469. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  470. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
  471. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  472. package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
  473. package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  474. package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
  475. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  476. package/build/components/sidebar-edit-mode/template-panel/index.js +0 -130
  477. package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  478. package/build/components/start-template-options/index.js +0 -191
  479. package/build/components/start-template-options/index.js.map +0 -1
  480. package/build/utils/math.js +0 -98
  481. package/build/utils/math.js.map +0 -1
  482. package/build-module/components/global-styles/global-styles-provider.js +0 -120
  483. package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
  484. package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
  485. package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
  486. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
  487. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  488. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  489. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  490. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
  491. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  492. package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
  493. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  494. package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
  495. package/build-module/components/page-templates-template-parts/index.js.map +0 -1
  496. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
  497. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
  498. package/build-module/components/sidebar-edit-mode/index.js +0 -137
  499. package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
  500. package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -90
  501. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
  502. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
  503. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
  504. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
  505. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  506. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -31
  507. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
  508. package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
  509. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
  510. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
  511. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
  512. package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -122
  513. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
  514. package/build-module/components/start-template-options/index.js +0 -184
  515. package/build-module/components/start-template-options/index.js.map +0 -1
  516. package/build-module/utils/math.js +0 -92
  517. package/build-module/utils/math.js.map +0 -1
  518. package/src/components/global-styles/global-styles-provider.js +0 -162
  519. package/src/components/header-edit-mode/document-tools/index.js +0 -68
  520. package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
  521. package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  522. package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
  523. package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
  524. package/src/components/sidebar-edit-mode/index.js +0 -162
  525. package/src/components/sidebar-edit-mode/page-panels/index.js +0 -105
  526. package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
  527. package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
  528. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -49
  529. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
  530. package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
  531. package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
  532. package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
  533. package/src/components/sidebar-edit-mode/template-panel/index.js +0 -144
  534. package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
  535. package/src/components/start-template-options/index.js +0 -231
  536. package/src/components/start-template-options/style.scss +0 -55
  537. package/src/utils/math.js +0 -93
  538. /package/build/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  539. /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  540. /package/build-module/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  541. /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  542. /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
  543. /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_data","_coreData","_components","_compose","_blockEditor","_element","_editor","_preferences","_sidebarNavigationScreen","_interopRequireDefault","_styleVariationsContainer","_lockUnlock","_store","_sidebarButton","_sidebarNavigationItem","_styleBook","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_variationsColor","_variationsTypography","_hooks","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","setCanvasMode","unlock","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","_react","createElement","default","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","colorVariations","useColorVariations","typographyVariations","useTypographyVariations","gap","BlockEditorProvider","settings","onChange","onInput","__experimentalVStack","spacing","className","title","__","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","setIsListViewOpened","editorStore","isMobileViewport","useViewportMatch","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","preferencesStore","openGlobalStyles","useCallback","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","description","content","footer","record","actions","icon","seen","label","isPressed","edit","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\nimport {\n\tuseColorVariations,\n\tuseTypographyVariations,\n} from '../global-styles/hooks';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn <SidebarNavigationItem { ...props } path=\"/wp_global_styles\" />;\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst colorVariations = useColorVariations();\n\tconst typographyVariations = useTypographyVariations();\n\tconst gap = 3;\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer gap={ gap } />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<ColorVariations title={ __( 'Colors' ) } gap={ gap } />\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<TypographyVariations\n\t\t\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\t\t\tgap={ gap }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,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AG,MAAAA,CAAA,KAAY,MAAM4C,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAf,iBAAiB,IAAI,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAhC,MAAA,CAAAC,aAAA,EAACrB,UAAA,CAAAsB,OAAS;IACTmE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BlE,OAAO,EAAGgD,aAAe;IACzBmB,QAAQ,EAAGnB,aAAe;IAC1BoB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_data","_coreData","_components","_compose","_blockEditor","_element","_editor","_preferences","_sidebarNavigationScreen","_interopRequireDefault","_styleVariationsContainer","_lockUnlock","_store","_sidebarButton","_sidebarNavigationItem","_styleBook","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_variationsColor","_variationsTypography","_hooks","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","setCanvasMode","unlock","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","_react","createElement","default","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","colorVariations","useColorVariations","typographyVariations","useTypographyVariations","gap","BlockEditorProvider","settings","onChange","onInput","__experimentalVStack","spacing","className","title","__","SidebarNavigationScreenGlobalStyles","backPath","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","setIsListViewOpened","editorStore","isMobileViewport","useViewportMatch","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","preferencesStore","openGlobalStyles","useCallback","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","description","content","footer","record","actions","icon","seen","label","isPressed","edit","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\nimport {\n\tuseColorVariations,\n\tuseTypographyVariations,\n} from '../global-styles/hooks';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn <SidebarNavigationItem { ...props } path=\"/wp_global_styles\" />;\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst colorVariations = useColorVariations();\n\tconst typographyVariations = useTypographyVariations();\n\tconst gap = 3;\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer gap={ gap } />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<ColorVariations title={ __( 'Colors' ) } gap={ gap } />\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<TypographyVariations\n\t\t\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\t\t\tgap={ gap }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles( { backPath } ) {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,wBAAA,GAAAC,sBAAA,CAAAX,OAAA;AACA,IAAAY,yBAAA,GAAAD,sBAAA,CAAAX,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAJ,sBAAA,CAAAX,OAAA;AACA,IAAAgB,sBAAA,GAAAL,sBAAA,CAAAX,OAAA;AACA,IAAAiB,UAAA,GAAAN,sBAAA,CAAAX,OAAA;AACA,IAAAk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A1D,MAAA,CAAAC,aAAA,EAACnB,qCAAA,CAAAoB,OAAoC;MACpC6D,MAAM,EAAGvC,SAAS,GAAI,CAAC,CAAI;MAC3BpB,OAAO,EAAGkD;IAAe,CACzB,CAEF;IACDU,OAAO,EACN,IAAAhE,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAA2D,QAAA,QACG,CAAE7B,gBAAgB,IACnB,IAAA9B,MAAA,CAAAC,aAAA,EAACvB,cAAA,CAAAwB,OAAa;MACb+D,IAAI,EAAGC,WAAM;MACbC,KAAK,EAAG,IAAA9C,QAAE,EAAE,YAAa,CAAG;MAC5BjB,OAAO,EAAGA,CAAA,KACT4B,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACDyB,SAAS,EAAGlC;IAAmB,CAC/B,CACD,EACD,IAAAlC,MAAA,CAAAC,aAAA,EAACvB,cAAA,CAAAwB,OAAa;MACb+D,IAAI,EAAGI,WAAM;MACbF,KAAK,EAAG,IAAA9C,QAAE,EAAE,aAAc,CAAG;MAC7BjB,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAM6C,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAf,iBAAiB,IAAI,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAjC,MAAA,CAAAC,aAAA,EAACrB,UAAA,CAAAsB,OAAS;IACToE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BnE,OAAO,EAAGiD,aAAe;IACzBmB,QAAQ,EAAGnB,aAAe;IAC1BoB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL","ignoreList":[]}
@@ -31,7 +31,9 @@ const {
31
31
  useLocation
32
32
  } = (0, _lockUnlock.unlock)(_router.privateApis);
33
33
  const postType = exports.postType = `wp_navigation`;
34
- function SidebarNavigationScreenNavigationMenu() {
34
+ function SidebarNavigationScreenNavigationMenu({
35
+ backPath
36
+ }) {
35
37
  const {
36
38
  params: {
37
39
  postId
@@ -66,30 +68,35 @@ function SidebarNavigationScreenNavigationMenu() {
66
68
  const _handleDuplicate = () => handleDuplicate(navigationMenu);
67
69
  if (isLoading) {
68
70
  return (0, _react.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
69
- description: (0, _i18n.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.')
71
+ description: (0, _i18n.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'),
72
+ backPath: backPath
70
73
  }, (0, _react.createElement)(_components.Spinner, {
71
74
  className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
72
75
  }));
73
76
  }
74
77
  if (!isLoading && !navigationMenu) {
75
78
  return (0, _react.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
76
- description: (0, _i18n.__)('Navigation Menu missing.')
79
+ description: (0, _i18n.__)('Navigation Menu missing.'),
80
+ backPath: backPath
77
81
  });
78
82
  }
79
83
  if (!navigationMenu?.content?.raw) {
80
84
  return (0, _react.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
81
85
  actions: (0, _react.createElement)(_moreMenu.default, {
86
+ menuId: navigationMenu?.id,
82
87
  menuTitle: (0, _htmlEntities.decodeEntities)(menuTitle),
83
88
  onDelete: _handleDelete,
84
89
  onSave: _handleSave,
85
90
  onDuplicate: _handleDuplicate
86
91
  }),
92
+ backPath: backPath,
87
93
  title: (0, _buildNavigationLabel.default)(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
88
94
  description: (0, _i18n.__)('This Navigation Menu is empty.')
89
95
  });
90
96
  }
91
97
  return (0, _react.createElement)(_singleNavigationMenu.default, {
92
98
  navigationMenu: navigationMenu,
99
+ backPath: backPath,
93
100
  handleDelete: _handleDelete,
94
101
  handleSave: _handleSave,
95
102
  handleDuplicate: _handleDuplicate
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_components","_i18n","_data","_htmlEntities","_router","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_singleNavigationMenu","_useNavigationMenuHandlers","_buildNavigationLabel","_lockUnlock","useLocation","unlock","routerPrivateApis","postType","exports","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","useEntityRecord","isSaving","isDeleting","useSelect","select","isSavingEntityRecord","isDeletingEntityRecord","coreStore","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","useNavigationMenuHandlers","_handleDelete","_handleSave","edits","_handleDuplicate","_react","createElement","SidebarNavigationScreenWrapper","description","__","Spinner","className","content","raw","actions","default","decodeEntities","onDelete","onSave","onDuplicate","buildNavigationLabel","id","status"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isDeletingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = ( edits ) => handleSave( navigationMenu, edits );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\t\tnavigationMenu?.title,\n\t\t\t\t\tnavigationMenu?.id,\n\t\t\t\t\tnavigationMenu?.status\n\t\t\t\t) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\t\t\thandleDuplicate={ _handleDuplicate }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,uCAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,0BAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,qBAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA,MAAM;EAAEa;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE5C,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAI,eAAc;AAExB,SAASE,qCAAqCA,CAAA,EAAG;EAC/D,MAAM;IACLC,MAAM,EAAE;MAAEC;IAAO;EAClB,CAAC,GAAGP,WAAW,CAAC,CAAC;EAEjB,MAAM;IAAEQ,MAAM,EAAEC,cAAc;IAAEC;EAAY,CAAC,GAAG,IAAAC,yBAAe,EAC9D,UAAU,EACVR,QAAQ,EACRI,MACD,CAAC;EAED,MAAM;IAAEK,QAAQ;IAAEC;E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AAC;EAEJ;EAEA,IAAK,CAAE3B,cAAc,EAAE8B,OAAO,EAAEC,GAAG,EAAG;IACrC,OACC,IAAAR,MAAA,CAAAC,aAAA,EAACxC,uCAAA,CAAAyC,8BAA8B;MAC9BO,OAAO,EACN,IAAAT,MAAA,CAAAC,aAAA,EAACvC,SAAA,CAAAgD,OAAwB;QACxBtB,SAAS,EAAG,IAAAuB,4BAAc,EAAEvB,SAAU,CAAG;QACzCwB,QAAQ,EAAGhB,aAAe;QAC1BiB,MAAM,EAAGhB,WAAa;QACtBiB,WAAW,EAAGf;MAAkB,CAChC,CACD;MACDV,KAAK,EAAG,IAAA0B,6BAAoB,EAC3BtC,cAAc,EAAEY,KAAK,EACrBZ,cAAc,EAAEuC,EAAE,EAClBvC,cAAc,EAAEwC,MACjB,CAAG;MACHd,WAAW,EAAG,IAAAC,QAAE,EAAE,gCAAiC;IAAG,CACtD,CAAC;EAEJ;EAEA,OACC,IAAAJ,MAAA,CAAAC,aAAA,EAACrC,qBAAA,CAAA8C,OAAoB;IACpBjC,cAAc,EAAGA,cAAgB;IACjCgB,YAAY,EAAGG,aAAe;IAC9BJ,UAAU,EAAGK,WAAa;IAC1BH,eAAe,EAAGK;EAAkB,CACpC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_components","_i18n","_data","_htmlEntities","_router","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_singleNavigationMenu","_useNavigationMenuHandlers","_buildNavigationLabel","_lockUnlock","useLocation","unlock","routerPrivateApis","postType","exports","SidebarNavigationScreenNavigationMenu","backPath","params","postId","record","navigationMenu","isResolving","useEntityRecord","isSaving","isDeleting","useSelect","select","isSavingEntityRecord","isDeletingEntityRecord","coreStore","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","useNavigationMenuHandlers","_handleDelete","_handleSave","edits","_handleDuplicate","_react","createElement","SidebarNavigationScreenWrapper","description","__","Spinner","className","content","raw","actions","default","menuId","id","decodeEntities","onDelete","onSave","onDuplicate","buildNavigationLabel","status"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu( { backPath } ) {\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isDeletingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = ( edits ) => handleSave( navigationMenu, edits );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuId={ navigationMenu?.id }\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tbackPath={ backPath }\n\t\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\t\tnavigationMenu?.title,\n\t\t\t\t\tnavigationMenu?.id,\n\t\t\t\t\tnavigationMenu?.status\n\t\t\t\t) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\tbackPath={ backPath }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\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,OAAwB;QACxBC,MAAM,EAAGlC,cAAc,EAAEmC,EAAI;QAC7BxB,SAAS,EAAG,IAAAyB,4BAAc,EAAEzB,SAAU,CAAG;QACzC0B,QAAQ,EAAGlB,aAAe;QAC1BmB,MAAM,EAAGlB,WAAa;QACtBmB,WAAW,EAAGjB;MAAkB,CAChC,CACD;MACD1B,QAAQ,EAAGA,QAAU;MACrBgB,KAAK,EAAG,IAAA4B,6BAAoB,EAC3BxC,cAAc,EAAEY,KAAK,EACrBZ,cAAc,EAAEmC,EAAE,EAClBnC,cAAc,EAAEyC,MACjB,CAAG;MACHf,WAAW,EAAG,IAAAC,QAAE,EAAE,gCAAiC;IAAG,CACtD,CAAC;EAEJ;EAEA,OACC,IAAAJ,MAAA,CAAAC,aAAA,EAACtC,qBAAA,CAAA+C,OAAoB;IACpBjC,cAAc,EAAGA,cAAgB;IACjCJ,QAAQ,EAAGA,QAAU;IACrBoB,YAAY,EAAGG,aAAe;IAC9BJ,UAAU,EAAGK,WAAa;IAC1BH,eAAe,EAAGK;EAAkB,CACpC,CAAC;AAEJ","ignoreList":[]}
@@ -10,8 +10,10 @@ var _components = require("@wordpress/components");
10
10
  var _icons = require("@wordpress/icons");
11
11
  var _i18n = require("@wordpress/i18n");
12
12
  var _element = require("@wordpress/element");
13
+ var _router = require("@wordpress/router");
13
14
  var _renameModal = _interopRequireDefault(require("./rename-modal"));
14
15
  var _deleteConfirmDialog = _interopRequireDefault(require("./delete-confirm-dialog"));
16
+ var _lockUnlock = require("../../lock-unlock");
15
17
  /**
16
18
  * WordPress dependencies
17
19
  */
@@ -20,6 +22,9 @@ var _deleteConfirmDialog = _interopRequireDefault(require("./delete-confirm-dial
20
22
  * Internal dependencies
21
23
  */
22
24
 
25
+ const {
26
+ useHistory
27
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
23
28
  const POPOVER_PROPS = {
24
29
  position: 'bottom right'
25
30
  };
@@ -28,10 +33,12 @@ function ScreenNavigationMoreMenu(props) {
28
33
  onDelete,
29
34
  onSave,
30
35
  onDuplicate,
31
- menuTitle
36
+ menuTitle,
37
+ menuId
32
38
  } = props;
33
39
  const [renameModalOpen, setRenameModalOpen] = (0, _element.useState)(false);
34
40
  const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0, _element.useState)(false);
41
+ const history = useHistory();
35
42
  const closeModals = () => {
36
43
  setRenameModalOpen(false);
37
44
  setDeleteConfirmDialogOpen(false);
@@ -52,6 +59,14 @@ function ScreenNavigationMoreMenu(props) {
52
59
  onClose();
53
60
  }
54
61
  }, (0, _i18n.__)('Rename')), (0, _react.createElement)(_components.MenuItem, {
62
+ onClick: () => {
63
+ history.push({
64
+ postId: menuId,
65
+ postType: 'wp_navigation',
66
+ canvas: 'edit'
67
+ });
68
+ }
69
+ }, (0, _i18n.__)('Edit')), (0, _react.createElement)(_components.MenuItem, {
55
70
  onClick: () => {
56
71
  onDuplicate();
57
72
  onClose();
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_icons","_i18n","_element","_renameModal","_interopRequireDefault","_deleteConfirmDialog","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","renameModalOpen","setRenameModalOpen","useState","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","closeModals","openRenameModal","openDeleteConfirmDialog","_react","createElement","Fragment","DropdownMenu","className","label","__","icon","moreVertical","popoverProps","onClose","MenuGroup","MenuItem","onClick","isDestructive","default","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAD,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAMO,aAAa,GAAG;EACrBC,QAAQ,EAAE;AACX,CAAC;AAEc,SAASC,wBAAwBA,CAAEC,KAAK,EAAG;EACzD,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGJ,KAAK;EAE1D,MAAM,CAAEK,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjE,MAAM,CAAEC,uBAAuB,EAAEC,0BAA0B,CAAE,GAC5D,IAAAF,iBAAQ,EAAE,KAAM,CAAC;EAElB,MAAMG,WAAW,GAAGA,CAAA,KAAM;IACzBJ,kB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MAAA,CAAAC,aAAA,EAAClB,oBAAA,CAAAgC,OAAmB;IACnBL,OAAO,EAAGb,WAAa;IACvBmB,SAAS,EAAG5B;EAAU,CACtB,CACD,EACCI,eAAe,IAChB,IAAAQ,MAAA,CAAAC,aAAA,EAACpB,YAAA,CAAAkC,OAAW;IACXL,OAAO,EAAGb,WAAa;IACvBN,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_icons","_i18n","_element","_router","_renameModal","_interopRequireDefault","_deleteConfirmDialog","_lockUnlock","useHistory","unlock","routerPrivateApis","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","menuId","renameModalOpen","setRenameModalOpen","useState","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","history","closeModals","openRenameModal","openDeleteConfirmDialog","_react","createElement","Fragment","DropdownMenu","className","label","__","icon","moreVertical","popoverProps","onClose","MenuGroup","MenuItem","onClick","push","postId","postType","canvas","isDestructive","default","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst history = useHistory();\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\tpostId: menuId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_navigation',\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAM;EAAES;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElD,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAE;AACX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A,EAAChC,WAAA,CAAA2C,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfjB,OAAO,CAACkB,IAAI,CAAE;QACbC,MAAM,EAAEzB,MAAM;QACd0B,QAAQ,EAAE,eAAe;QACzBC,MAAM,EAAE;MACT,CAAE,CAAC;IACJ;EAAG,GAED,IAAAX,QAAE,EAAE,MAAO,CACJ,CAAC,EACX,IAAAN,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAA2C,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfzB,WAAW,CAAC,CAAC;MACbsB,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAJ,QAAE,EAAE,WAAY,CACT,CAAC,EACX,IAAAN,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAA2C,QAAQ;IACRM,aAAa;IACbL,OAAO,EAAGA,CAAA,KAAM;MACfd,uBAAuB,CAAC,CAAC;;MAEzB;MACAW,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAJ,QAAE,EAAE,QAAS,CACN,CACA,CACP,CAEO,CAAC,EACbZ,uBAAuB,IACxB,IAAAM,MAAA,CAAAC,aAAA,EAACxB,oBAAA,CAAA0C,OAAmB;IACnBT,OAAO,EAAGb,WAAa;IACvBuB,SAAS,EAAGlC;EAAU,CACtB,CACD,EACCK,eAAe,IAChB,IAAAS,MAAA,CAAAC,aAAA,EAAC1B,YAAA,CAAA4C,OAAW;IACXT,OAAO,EAAGb,WAAa;IACvBR,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL","ignoreList":[]}
@@ -22,6 +22,7 @@ var _buildNavigationLabel = _interopRequireDefault(require("../sidebar-navigatio
22
22
 
23
23
  function SingleNavigationMenu({
24
24
  navigationMenu,
25
+ backPath,
25
26
  handleDelete,
26
27
  handleDuplicate,
27
28
  handleSave
@@ -29,11 +30,13 @@ function SingleNavigationMenu({
29
30
  const menuTitle = navigationMenu?.title?.rendered;
30
31
  return (0, _react.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
31
32
  actions: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_moreMenu.default, {
33
+ menuId: navigationMenu?.id,
32
34
  menuTitle: (0, _htmlEntities.decodeEntities)(menuTitle),
33
35
  onDelete: handleDelete,
34
36
  onSave: handleSave,
35
37
  onDuplicate: handleDuplicate
36
38
  })),
39
+ backPath: backPath,
37
40
  title: (0, _buildNavigationLabel.default)(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
38
41
  description: (0, _i18n.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.')
39
42
  }, (0, _react.createElement)(_navigationMenuEditor.default, {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_htmlEntities","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_navigationMenuEditor","_buildNavigationLabel","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","_react","createElement","SidebarNavigationScreenWrapper","actions","Fragment","default","decodeEntities","onDelete","onSave","onDuplicate","buildNavigationLabel","id","status","description","__","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,qBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMe,SAASO,oBAAoBA,CAAE;EAC7CC,cAAc;EACdC,YAAY;EACZC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAK,EAAEC,QAAQ;EAEjD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACd,uCAAA,CAAAe,8BAA8B;IAC9BC,OAAO,EACN,IAAAH,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACb,SAAA,CAAAiB,OAAwB;MACxBR,SAAS,EAAG,IAAAS,4BAAc,EAAET,SAAU,CAAG;MACzCU,QAAQ,EAAGb,YAAc;MACzBc,MAAM,EAAGZ,UAAY;MACrBa,WAAW,EAAGd;IAAiB,CAC/B,CACA,CACF;IACDG,KAAK,EAAG,IAAAY,6BAAoB,EAC3BjB,cAAc,EAAEK,KAAK,EACrBL,cAAc,EAAEkB,EAAE,EAClBlB,cAAc,EAAEmB,MACjB,CAAG;IACHC,WAAW,EAAG,IAAAC,QAAE,EACf,kGACD;EAAG,GAEH,IAAAd,MAAA,CAAAC,aAAA,EAACX,qBAAA,CAAAe,OAAoB;IAACU,gBAAgB,EAAGtB,cAAc,EAAEkB;EAAI,CAAE,CAChC,CAAC;AAEnC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_htmlEntities","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_navigationMenuEditor","_buildNavigationLabel","SingleNavigationMenu","navigationMenu","backPath","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","_react","createElement","SidebarNavigationScreenWrapper","actions","Fragment","default","menuId","id","decodeEntities","onDelete","onSave","onDuplicate","buildNavigationLabel","status","description","__","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\tbackPath,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuId={ navigationMenu?.id }\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,qBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMe,SAASO,oBAAoBA,CAAE;EAC7CC,cAAc;EACdC,QAAQ;EACRC,YAAY;EACZC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAGL,cAAc,EAAEM,KAAK,EAAEC,QAAQ;EAEjD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACf,uCAAA,CAAAgB,8BAA8B;IAC9BC,OAAO,EACN,IAAAH,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACd,SAAA,CAAAkB,OAAwB;MACxBC,MAAM,EAAGd,cAAc,EAAEe,EAAI;MAC7BV,SAAS,EAAG,IAAAW,4BAAc,EAAEX,SAAU,CAAG;MACzCY,QAAQ,EAAGf,YAAc;MACzBgB,MAAM,EAAGd,UAAY;MACrBe,WAAW,EAAGhB;IAAiB,CAC/B,CACA,CACF;IACDF,QAAQ,EAAGA,QAAU;IACrBK,KAAK,EAAG,IAAAc,6BAAoB,EAC3BpB,cAAc,EAAEM,KAAK,EACrBN,cAAc,EAAEe,EAAE,EAClBf,cAAc,EAAEqB,MACjB,CAAG;IACHC,WAAW,EAAG,IAAAC,QAAE,EACf,kGACD;EAAG,GAEH,IAAAf,MAAA,CAAAC,aAAA,EAACZ,qBAAA,CAAAgB,OAAoB;IAACW,gBAAgB,EAAGxB,cAAc,EAAEe;EAAI,CAAE,CAChC,CAAC;AAEnC","ignoreList":[]}
@@ -45,7 +45,9 @@ function buildMenuLabel(title, id, status) {
45
45
 
46
46
  // Save a boolean to prevent us creating a fallback more than once per session.
47
47
  let hasCreatedFallback = false;
48
- function SidebarNavigationScreenNavigationMenus() {
48
+ function SidebarNavigationScreenNavigationMenus({
49
+ backPath
50
+ }) {
49
51
  const {
50
52
  records: navigationMenus,
51
53
  isResolving: isResolvingNavigationMenus,
@@ -74,13 +76,16 @@ function SidebarNavigationScreenNavigationMenus() {
74
76
  } = (0, _useNavigationMenuHandlers.default)();
75
77
  const hasNavigationMenus = !!navigationMenus?.length;
76
78
  if (isLoading) {
77
- return (0, _react.createElement)(SidebarNavigationScreenWrapper, null, (0, _react.createElement)(_components.Spinner, {
79
+ return (0, _react.createElement)(SidebarNavigationScreenWrapper, {
80
+ backPath: backPath
81
+ }, (0, _react.createElement)(_components.Spinner, {
78
82
  className: "edit-site-sidebar-navigation-screen-navigation-menus__loading"
79
83
  }));
80
84
  }
81
85
  if (!isLoading && !hasNavigationMenus) {
82
86
  return (0, _react.createElement)(SidebarNavigationScreenWrapper, {
83
- description: (0, _i18n.__)('No Navigation Menus found.')
87
+ description: (0, _i18n.__)('No Navigation Menus found.'),
88
+ backPath: backPath
84
89
  });
85
90
  }
86
91
 
@@ -88,12 +93,15 @@ function SidebarNavigationScreenNavigationMenus() {
88
93
  if (navigationMenus?.length === 1) {
89
94
  return (0, _react.createElement)(_singleNavigationMenu.default, {
90
95
  navigationMenu: firstNavigationMenu,
96
+ backPath: backPath,
91
97
  handleDelete: () => handleDelete(firstNavigationMenu),
92
98
  handleDuplicate: () => handleDuplicate(firstNavigationMenu),
93
99
  handleSave: edits => handleSave(firstNavigationMenu, edits)
94
100
  });
95
101
  }
96
- return (0, _react.createElement)(SidebarNavigationScreenWrapper, null, (0, _react.createElement)(_components.__experimentalItemGroup, null, navigationMenus?.map(({
102
+ return (0, _react.createElement)(SidebarNavigationScreenWrapper, {
103
+ backPath: backPath
104
+ }, (0, _react.createElement)(_components.__experimentalItemGroup, null, navigationMenus?.map(({
97
105
  id,
98
106
  title,
99
107
  status
@@ -108,12 +116,14 @@ function SidebarNavigationScreenWrapper({
108
116
  children,
109
117
  actions,
110
118
  title,
111
- description
119
+ description,
120
+ backPath
112
121
  }) {
113
122
  return (0, _react.createElement)(_sidebarNavigationScreen.default, {
114
123
  title: title || (0, _i18n.__)('Navigation'),
115
124
  actions: actions,
116
125
  description: description || (0, _i18n.__)('Manage your Navigation Menus.'),
126
+ backPath: backPath,
117
127
  content: children
118
128
  });
119
129
  }
@@ -123,7 +133,7 @@ const NavMenuItem = ({
123
133
  }) => {
124
134
  const linkInfo = (0, _link.useLink)({
125
135
  postId,
126
- postType: _constants2.NAVIGATION_POST_TYPE
136
+ path: '/navigation'
127
137
  });
128
138
  return (0, _react.createElement)(_sidebarNavigationItem.default, {
129
139
  ...linkInfo,
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_coreData","_data","_htmlEntities","_components","_icons","_sidebarNavigationScreen","_interopRequireDefault","_sidebarNavigationItem","_constants","_link","_singleNavigationMenu","_useNavigationMenuHandlers","_lockUnlock","_constants2","buildMenuLabel","title","id","status","sprintf","__","decodeEntities","hasCreatedFallback","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","useEntityRecords","NAVIGATION_POST_TYPE","PRELOADED_NAVIGATION_MENUS_QUERY","isLoading","getNavigationFallbackId","unlock","useSelect","coreStore","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","useNavigationMenuHandlers","hasNavigationMenus","length","_react","createElement","SidebarNavigationScreenWrapper","Spinner","className","description","default","navigationMenu","edits","__experimentalItemGroup","map","index","NavMenuItem","postId","key","withChevron","icon","navigation","rendered","children","actions","content","props","linkInfo","useLink","postType"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\n// Save a boolean to prevent us creating a fallback more than once per session.\nlet hasCreatedFallback = false;\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\tNAVIGATION_POST_TYPE,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// Save a boolean to prevent us creating a fallback more than once per session.\n\tif ( firstNavigationMenu ) {\n\t\thasCreatedFallback = true;\n\t}\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t! hasCreatedFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\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\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title?.rendered, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\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: NAVIGATION_POST_TYPE,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAIA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,wBAAA,GAAAC,s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,KAAK;IAAEE;EAAO,CAAC,EAAEsC,KAAK,KACrD,IAAAX,MAAA,CAAAC,aAAA,EAACW,WAAW;IACXC,MAAM,EAAGzC,EAAI;IACb0C,GAAG,EAAG1C,EAAI;IACV2C,WAAW;IACXC,IAAI,EAAGC;EAAY,GAEjB/C,cAAc,CAAEC,KAAK,EAAE+C,QAAQ,EAAEP,KAAK,GAAG,CAAC,EAAEtC,MAAO,CACzC,CACZ,CACQ,CACoB,CAAC;AAEnC;AAEO,SAAS6B,8BAA8BA,CAAE;EAC/CiB,QAAQ;EACRC,OAAO;EACPjD,KAAK;EACLkC;AACD,CAAC,EAAG;EACH,OACC,IAAAL,MAAA,CAAAC,aAAA,EAACxC,wBAAA,CAAA6C,OAAuB;IACvBnC,KAAK,EAAGA,KAAK,IAAI,IAAAI,QAAE,EAAE,YAAa,CAAG;IACrC6C,OAAO,EAAGA,OAAS;IACnBf,WAAW,EAAGA,WAAW,IAAI,IAAA9B,QAAE,EAAE,+BAAgC,CAAG;IACpE8C,OAAO,EAAGF;EAAU,CACpB,CAAC;AAEJ;AAEA,MAAMP,WAAW,GAAGA,CAAE;EAAEC,MAAM;EAAE,GAAGS;AAAM,CAAC,KAAM;EAC/C,MAAMC,QAAQ,GAAG,IAAAC,aAAO,EAAE;IACzBX,MAAM;IACNY,QAAQ,EAAEvC;EACX,CAAE,CAAC;EACH,OAAO,IAAAc,MAAA,CAAAC,aAAA,EAACtC,sBAAA,CAAA2C,OAAqB;IAAA,GAAMiB,QAAQ;IAAA,GAAQD;EAAK,CAAI,CAAC;AAC9D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_coreData","_data","_htmlEntities","_components","_icons","_sidebarNavigationScreen","_interopRequireDefault","_sidebarNavigationItem","_constants","_link","_singleNavigationMenu","_useNavigationMenuHandlers","_lockUnlock","_constants2","buildMenuLabel","title","id","status","sprintf","__","decodeEntities","hasCreatedFallback","SidebarNavigationScreenNavigationMenus","backPath","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","useEntityRecords","NAVIGATION_POST_TYPE","PRELOADED_NAVIGATION_MENUS_QUERY","isLoading","getNavigationFallbackId","unlock","useSelect","coreStore","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","useNavigationMenuHandlers","hasNavigationMenus","length","_react","createElement","SidebarNavigationScreenWrapper","Spinner","className","description","default","navigationMenu","edits","__experimentalItemGroup","map","index","NavMenuItem","postId","key","withChevron","icon","navigation","rendered","children","actions","content","props","linkInfo","useLink","path"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\n// Save a boolean to prevent us creating a fallback more than once per session.\nlet hasCreatedFallback = false;\n\nexport default function SidebarNavigationScreenNavigationMenus( { backPath } ) {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\tNAVIGATION_POST_TYPE,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// Save a boolean to prevent us creating a fallback more than once per session.\n\tif ( firstNavigationMenu ) {\n\t\thasCreatedFallback = true;\n\t}\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t! hasCreatedFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\tbackPath={ backPath }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper backPath={ backPath }>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title?.rendered, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n\tbackPath,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation Menus.' ) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpath: '/navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAC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D,CAAC","ignoreList":[]}
@@ -12,7 +12,6 @@ var _element = require("@wordpress/element");
12
12
  var _i18n = require("@wordpress/i18n");
13
13
  var _blockEditor = require("@wordpress/block-editor");
14
14
  var _router = require("@wordpress/router");
15
- var _isPreviewingTheme = require("../../utils/is-previewing-theme");
16
15
  var _lockUnlock = require("../../lock-unlock");
17
16
  /**
18
17
  * WordPress dependencies
@@ -71,10 +70,7 @@ function LeafMoreMenu(props) {
71
70
  if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
72
71
  history.push({
73
72
  postType: attributes.type,
74
- postId: attributes.id,
75
- ...((0, _isPreviewingTheme.isPreviewingTheme)() && {
76
- wp_theme_preview: (0, _isPreviewingTheme.currentlyPreviewingTheme)()
77
- })
73
+ postId: attributes.id
78
74
  }, {
79
75
  backPath: params
80
76
  });
@@ -82,10 +78,7 @@ function LeafMoreMenu(props) {
82
78
  if (name === 'core/page-list-item' && attributes.id && history) {
83
79
  history.push({
84
80
  postType: 'page',
85
- postId: attributes.id,
86
- ...((0, _isPreviewingTheme.isPreviewingTheme)() && {
87
- wp_theme_preview: (0, _isPreviewingTheme.currentlyPreviewingTheme)()
88
- })
81
+ postId: attributes.id
89
82
  }, {
90
83
  backPath: params
91
84
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_components","_data","_element","_i18n","_blockEditor","_router","_isPreviewingTheme","_lockUnlock","POPOVER_PROPS","className","placement","useLocation","useHistory","unlock","routerPrivateApis","LeafMoreMenu","props","params","history","block","clientId","moveBlocksDown","moveBlocksUp","removeBlocks","useDispatch","blockEditorStore","removeLabel","sprintf","__","BlockTitle","maximumLength","goToLabel","rootClientId","useSelect","select","getBlockRootClientId","onGoToPage","useCallback","selectedBlock","attributes","name","kind","id","type","push","postType","postId","isPreviewingTheme","wp_theme_preview","currentlyPreviewingTheme","backPath","_react","createElement","DropdownMenu","icon","moreVertical","label","popoverProps","noIcons","onClose","Fragment","MenuGroup","MenuItem","chevronUp","onClick","chevronDown"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\n/**\n * Internal dependencies\n */\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function LeafMoreMenu( props ) {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { block } = props;\n\tconst { clientId } = block;\n\tconst { moveBlocksDown, moveBlocksUp, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst removeLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst goToLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Go to %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onGoToPage = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t\t...( isPreviewingTheme() && {\n\t\t\t\t\t\t\twp_theme_preview: currentlyPreviewingTheme(),\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t\t...( isPreviewingTheme() && {\n\t\t\t\t\t\t\twp_theme_preview: currentlyPreviewingTheme(),\n\t\t\t\t\t\t} ),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, params ]\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksUp( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move up' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksDown( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move down' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t{ block.attributes?.type === 'page' &&\n\t\t\t\t\t\t\tblock.attributes?.id && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonGoToPage( block );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ goToLabel }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ removeLabel }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAUA,IAAAO,kBAAA,GAAAP,OAAA;AAIA,IAAAQ,WAAA,GAAAR,OAAA;AAxBA;AACA;AACA;;AAUA,MAAMS,aAAa,GAAG;E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,EAAEY,YAAa,CAAC;MAC1C2B,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAA/B,QAAE,EAAE,SAAU,CACP,CAAC,EACX,IAAAuB,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAA8D,QAAQ;IACRR,IAAI,EAAGW,kBAAa;IACpBD,OAAO,EAAGA,CAAA,KAAM;MACf3C,cAAc,CAAE,CAAED,QAAQ,CAAE,EAAEY,YAAa,CAAC;MAC5C2B,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAA/B,QAAE,EAAE,WAAY,CACT,CAAC,EACTT,KAAK,CAACoB,UAAU,EAAEI,IAAI,KAAK,MAAM,IAClCxB,KAAK,CAACoB,UAAU,EAAEG,EAAE,IACnB,IAAAS,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAA8D,QAAQ;IACRE,OAAO,EAAGA,CAAA,KAAM;MACf5B,UAAU,CAAEjB,KAAM,CAAC;MACnBwC,OAAO,CAAC,CAAC;IACV;EAAG,GAED5B,SACO,CAEF,CAAC,EACZ,IAAAoB,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAA6D,SAAS,QACT,IAAAV,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAA8D,QAAQ;IACRE,OAAO,EAAGA,CAAA,KAAM;MACfzC,YAAY,CAAE,CAAEH,QAAQ,CAAE,EAAE,KAAM,CAAC;MACnCuC,OAAO,CAAC,CAAC;IACV;EAAG,GAEDjC,WACO,CACA,CACV,CAEU,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_components","_data","_element","_i18n","_blockEditor","_router","_lockUnlock","POPOVER_PROPS","className","placement","useLocation","useHistory","unlock","routerPrivateApis","LeafMoreMenu","props","params","history","block","clientId","moveBlocksDown","moveBlocksUp","removeBlocks","useDispatch","blockEditorStore","removeLabel","sprintf","__","BlockTitle","maximumLength","goToLabel","rootClientId","useSelect","select","getBlockRootClientId","onGoToPage","useCallback","selectedBlock","attributes","name","kind","id","type","push","postType","postId","backPath","_react","createElement","DropdownMenu","icon","moreVertical","label","popoverProps","noIcons","onClose","Fragment","MenuGroup","MenuItem","chevronUp","onClick","chevronDown"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function LeafMoreMenu( props ) {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { block } = props;\n\tconst { clientId } = block;\n\tconst { moveBlocksDown, moveBlocksUp, removeBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst removeLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst goToLabel = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Go to %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onGoToPage = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbackPath: params,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, params ]\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksUp( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move up' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tmoveBlocksDown( [ clientId ], rootClientId );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Move down' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t{ block.attributes?.type === 'page' &&\n\t\t\t\t\t\t\tblock.attributes?.id && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonGoToPage( block );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ goToLabel }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ removeLabel }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAUA,IAAAO,WAAA,GAAAP,OAAA;AApBA;AACA;AACA;;AAUA,MAAMQ,aAAa,GAAG;EACrBC,SAAS,EAAE,2CAA2C;EACtDC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;;AAGA,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEhD,SAASC,YAAYA,CAAEC,KAAK,EAA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xB,KAAK,CAACoB,UAAU,EAAEG,EAAE,IACnB,IAAAM,MAAA,CAAAC,aAAA,EAAChD,WAAA,CAAA0D,QAAQ;IACRE,OAAO,EAAGA,CAAA,KAAM;MACfzB,UAAU,CAAEjB,KAAM,CAAC;MACnBqC,OAAO,CAAC,CAAC;IACV;EAAG,GAEDzB,SACO,CAEF,CAAC,EACZ,IAAAiB,MAAA,CAAAC,aAAA,EAAChD,WAAA,CAAAyD,SAAS,QACT,IAAAV,MAAA,CAAAC,aAAA,EAAChD,WAAA,CAAA0D,QAAQ;IACRE,OAAO,EAAGA,CAAA,KAAM;MACftC,YAAY,CAAE,CAAEH,QAAQ,CAAE,EAAE,KAAM,CAAC;MACnCoC,OAAO,CAAC,CAAC;IACV;EAAG,GAED9B,WACO,CACA,CACV,CAEU,CAAC;AAEjB","ignoreList":[]}
@@ -18,6 +18,7 @@ var _url = require("@wordpress/url");
18
18
  var _element = require("@wordpress/element");
19
19
  var _router = require("@wordpress/router");
20
20
  var _editor = require("@wordpress/editor");
21
+ var _notices = require("@wordpress/notices");
21
22
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
22
23
  var _lockUnlock = require("../../lock-unlock");
23
24
  var _store = require("../../store");
@@ -46,6 +47,9 @@ function SidebarNavigationScreenPage({
46
47
  setCanvasMode
47
48
  } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
48
49
  const history = useHistory();
50
+ const {
51
+ createSuccessNotice
52
+ } = (0, _data.useDispatch)(_notices.store);
49
53
  const {
50
54
  params: {
51
55
  postId
@@ -82,15 +86,42 @@ function SidebarNavigationScreenPage({
82
86
  }
83
87
  }, [hasResolved, record, history]);
84
88
  const onActionPerformed = (0, _element.useCallback)((actionId, items) => {
85
- if (actionId === 'move-to-trash') {
86
- history.push({
87
- path: '/' + items[0].type,
88
- postId: undefined,
89
- postType: undefined,
90
- canvas: 'view'
91
- });
89
+ switch (actionId) {
90
+ case 'move-to-trash':
91
+ {
92
+ history.push({
93
+ path: '/' + items[0].type,
94
+ postId: undefined,
95
+ postType: undefined,
96
+ canvas: 'view'
97
+ });
98
+ }
99
+ break;
100
+ case 'duplicate-post':
101
+ {
102
+ const newItem = items[0];
103
+ const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
104
+ createSuccessNotice((0, _i18n.sprintf)(
105
+ // translators: %s: Title of the created post e.g: "Post 1".
106
+ (0, _i18n.__)('"%s" successfully created.'), title), {
107
+ type: 'snackbar',
108
+ id: 'duplicate-post-action',
109
+ actions: [{
110
+ label: (0, _i18n.__)('Edit'),
111
+ onClick: () => {
112
+ history.push({
113
+ path: undefined,
114
+ postId: newItem.id,
115
+ postType: newItem.type,
116
+ canvas: 'edit'
117
+ });
118
+ }
119
+ }]
120
+ });
121
+ }
122
+ break;
92
123
  }
93
- }, [history]);
124
+ }, [history, createSuccessNotice]);
94
125
  const featureImageAltText = featuredMediaAltText ? (0, _htmlEntities.decodeEntities)(featuredMediaAltText) : (0, _htmlEntities.decodeEntities)(record?.title?.rendered || (0, _i18n.__)('Featured image'));
95
126
  return record ? (0, _react.createElement)(_sidebarNavigationScreen.default, {
96
127
  backPath: backPath,