@wordpress/edit-site 5.30.0 → 5.32.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 (470) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-editor/editor-canvas.js +24 -4
  3. package/build/components/block-editor/editor-canvas.js.map +1 -1
  4. package/build/components/block-editor/site-editor-canvas.js +15 -4
  5. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +1 -1
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/editor/index.js +12 -3
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +1 -2
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +38 -0
  13. package/build/components/global-styles/background-panel.js.map +1 -0
  14. package/build/components/global-styles/color-palette-panel.js +0 -9
  15. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  16. package/build/components/global-styles/font-families.js +1 -1
  17. package/build/components/global-styles/font-families.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/context.js +53 -17
  19. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
  21. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  23. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  25. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  27. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/utils/index.js +22 -4
  29. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  31. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  32. package/build/components/global-styles/header.js +1 -1
  33. package/build/components/global-styles/header.js.map +1 -1
  34. package/build/components/global-styles/hooks.js +50 -1
  35. package/build/components/global-styles/hooks.js.map +1 -1
  36. package/build/components/global-styles/palette.js +3 -1
  37. package/build/components/global-styles/palette.js.map +1 -1
  38. package/build/components/global-styles/preview-colors.js +2 -2
  39. package/build/components/global-styles/preview-colors.js.map +1 -1
  40. package/build/components/global-styles/preview-iframe.js +0 -1
  41. package/build/components/global-styles/preview-iframe.js.map +1 -1
  42. package/build/components/global-styles/preview-styles.js +2 -2
  43. package/build/components/global-styles/preview-styles.js.map +1 -1
  44. package/build/components/global-styles/root-menu.js +8 -2
  45. package/build/components/global-styles/root-menu.js.map +1 -1
  46. package/build/components/global-styles/screen-background.js +34 -0
  47. package/build/components/global-styles/screen-background.js.map +1 -0
  48. package/build/components/global-styles/screen-color-palette.js +2 -2
  49. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +5 -10
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-style-variations.js +3 -37
  53. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +6 -11
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +5 -2
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-elements.js +3 -1
  59. package/build/components/global-styles/typography-elements.js.map +1 -1
  60. package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  61. package/build/components/global-styles/typography-example.js.map +1 -0
  62. package/build/components/global-styles/typography-preview.js +3 -1
  63. package/build/components/global-styles/typography-preview.js.map +1 -1
  64. package/build/components/global-styles/ui.js +4 -1
  65. package/build/components/global-styles/ui.js.map +1 -1
  66. package/build/components/global-styles/utils.js +1 -1
  67. package/build/components/global-styles/utils.js.map +1 -1
  68. package/build/components/global-styles/variations/variations-color.js +13 -7
  69. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  70. package/build/components/global-styles/variations/variations-typography.js +34 -37
  71. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  72. package/build/components/header-edit-mode/index.js +2 -1
  73. package/build/components/header-edit-mode/index.js.map +1 -1
  74. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  75. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  76. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  77. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  78. package/build/components/keyboard-shortcuts/global.js +17 -3
  79. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  80. package/build/components/layout/animation.js +129 -0
  81. package/build/components/layout/animation.js.map +1 -0
  82. package/build/components/layout/index.js +9 -17
  83. package/build/components/layout/index.js.map +1 -1
  84. package/build/components/layout/router.js +22 -22
  85. package/build/components/layout/router.js.map +1 -1
  86. package/build/components/page-pages/index.js +24 -27
  87. package/build/components/page-pages/index.js.map +1 -1
  88. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  89. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  90. package/build/components/page-patterns/index.js +19 -32
  91. package/build/components/page-patterns/index.js.map +1 -1
  92. package/build/components/page-patterns/search-items.js +16 -58
  93. package/build/components/page-patterns/search-items.js.map +1 -1
  94. package/build/components/page-patterns/use-patterns.js +9 -9
  95. package/build/components/page-patterns/use-patterns.js.map +1 -1
  96. package/build/components/page-templates-template-parts/actions.js +54 -41
  97. package/build/components/page-templates-template-parts/actions.js.map +1 -1
  98. package/build/components/page-templates-template-parts/index.js +31 -69
  99. package/build/components/page-templates-template-parts/index.js.map +1 -1
  100. package/build/components/plugin-template-setting-panel/index.js +12 -1
  101. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  102. package/build/components/save-button/index.js +45 -16
  103. package/build/components/save-button/index.js.map +1 -1
  104. package/build/components/save-hub/index.js +8 -112
  105. package/build/components/save-hub/index.js.map +1 -1
  106. package/build/components/save-panel/index.js +14 -9
  107. package/build/components/save-panel/index.js.map +1 -1
  108. package/build/components/sidebar/index.js +3 -8
  109. package/build/components/sidebar/index.js.map +1 -1
  110. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  111. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  112. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  113. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  114. package/build/components/sidebar-dataviews/default-views.js +3 -3
  115. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  116. package/build/components/sidebar-dataviews/index.js +5 -4
  117. package/build/components/sidebar-dataviews/index.js.map +1 -1
  118. package/build/components/sidebar-edit-mode/index.js +1 -2
  119. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  120. package/build/components/sidebar-edit-mode/page-panels/index.js +7 -17
  121. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  122. package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  123. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  124. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  125. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  126. package/build/components/sidebar-edit-mode/template-panel/index.js +32 -18
  127. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  129. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -1
  131. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  133. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  135. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  137. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
  139. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-template/index.js +5 -1
  141. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  143. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  144. package/build/components/style-book/index.js +1 -1
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  149. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  150. package/build/components/template-actions/index.js +44 -27
  151. package/build/components/template-actions/index.js.map +1 -1
  152. package/build/components/welcome-guide/editor.js +11 -2
  153. package/build/components/welcome-guide/editor.js.map +1 -1
  154. package/build/hooks/index.js +0 -1
  155. package/build/hooks/index.js.map +1 -1
  156. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  157. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  158. package/build/store/selectors.js +1 -9
  159. package/build/store/selectors.js.map +1 -1
  160. package/build/utils/constants.js +5 -3
  161. package/build/utils/constants.js.map +1 -1
  162. package/build/utils/get-is-list-page.js +1 -1
  163. package/build/utils/get-is-list-page.js.map +1 -1
  164. package/build/utils/math.js +98 -0
  165. package/build/utils/math.js.map +1 -0
  166. package/build-module/components/block-editor/editor-canvas.js +24 -4
  167. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  168. package/build-module/components/block-editor/site-editor-canvas.js +15 -4
  169. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  170. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  171. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  172. package/build-module/components/editor/index.js +13 -4
  173. package/build-module/components/editor/index.js.map +1 -1
  174. package/build-module/components/editor-canvas-container/index.js +1 -2
  175. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  176. package/build-module/components/global-styles/background-panel.js +31 -0
  177. package/build-module/components/global-styles/background-panel.js.map +1 -0
  178. package/build-module/components/global-styles/color-palette-panel.js +0 -8
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/font-families.js +1 -1
  181. package/build-module/components/global-styles/font-families.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/context.js +54 -18
  183. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  184. package/build-module/components/global-styles/font-library-modal/font-collection.js +4 -3
  185. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  186. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  187. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  188. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  189. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  190. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  191. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  192. package/build-module/components/global-styles/font-library-modal/utils/index.js +22 -4
  193. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  194. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  195. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  196. package/build-module/components/global-styles/header.js +1 -1
  197. package/build-module/components/global-styles/header.js.map +1 -1
  198. package/build-module/components/global-styles/hooks.js +48 -1
  199. package/build-module/components/global-styles/hooks.js.map +1 -1
  200. package/build-module/components/global-styles/palette.js +3 -1
  201. package/build-module/components/global-styles/palette.js.map +1 -1
  202. package/build-module/components/global-styles/preview-colors.js +2 -2
  203. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  204. package/build-module/components/global-styles/preview-iframe.js +0 -1
  205. package/build-module/components/global-styles/preview-iframe.js.map +1 -1
  206. package/build-module/components/global-styles/preview-styles.js +2 -2
  207. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  208. package/build-module/components/global-styles/root-menu.js +9 -3
  209. package/build-module/components/global-styles/root-menu.js.map +1 -1
  210. package/build-module/components/global-styles/screen-background.js +26 -0
  211. package/build-module/components/global-styles/screen-background.js.map +1 -0
  212. package/build-module/components/global-styles/screen-color-palette.js +2 -2
  213. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  214. package/build-module/components/global-styles/screen-colors.js +5 -10
  215. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +4 -38
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +6 -11
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +5 -2
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-elements.js +3 -1
  223. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  224. package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  225. package/build-module/components/global-styles/typography-example.js.map +1 -0
  226. package/build-module/components/global-styles/typography-preview.js +3 -1
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +4 -1
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +1 -1
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles/variations/variations-color.js +13 -7
  233. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  234. package/build-module/components/global-styles/variations/variations-typography.js +35 -38
  235. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  236. package/build-module/components/header-edit-mode/index.js +2 -1
  237. package/build-module/components/header-edit-mode/index.js.map +1 -1
  238. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  239. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  240. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  241. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  242. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  243. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  244. package/build-module/components/layout/animation.js +122 -0
  245. package/build-module/components/layout/animation.js.map +1 -0
  246. package/build-module/components/layout/index.js +9 -17
  247. package/build-module/components/layout/index.js.map +1 -1
  248. package/build-module/components/layout/router.js +22 -22
  249. package/build-module/components/layout/router.js.map +1 -1
  250. package/build-module/components/page-pages/index.js +25 -28
  251. package/build-module/components/page-pages/index.js.map +1 -1
  252. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  253. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  254. package/build-module/components/page-patterns/index.js +21 -34
  255. package/build-module/components/page-patterns/index.js.map +1 -1
  256. package/build-module/components/page-patterns/search-items.js +14 -55
  257. package/build-module/components/page-patterns/search-items.js.map +1 -1
  258. package/build-module/components/page-patterns/use-patterns.js +9 -9
  259. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  260. package/build-module/components/page-templates-template-parts/actions.js +54 -40
  261. package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
  262. package/build-module/components/page-templates-template-parts/index.js +34 -72
  263. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  264. package/build-module/components/plugin-template-setting-panel/index.js +12 -1
  265. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  266. package/build-module/components/save-button/index.js +46 -17
  267. package/build-module/components/save-button/index.js.map +1 -1
  268. package/build-module/components/save-hub/index.js +10 -114
  269. package/build-module/components/save-hub/index.js.map +1 -1
  270. package/build-module/components/save-panel/index.js +14 -9
  271. package/build-module/components/save-panel/index.js.map +1 -1
  272. package/build-module/components/sidebar/index.js +3 -8
  273. package/build-module/components/sidebar/index.js.map +1 -1
  274. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  275. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  276. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  277. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  278. package/build-module/components/sidebar-dataviews/default-views.js +4 -4
  279. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  280. package/build-module/components/sidebar-dataviews/index.js +5 -4
  281. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  282. package/build-module/components/sidebar-edit-mode/index.js +1 -2
  283. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  284. package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -20
  285. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  286. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  287. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  288. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  289. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  290. package/build-module/components/sidebar-edit-mode/template-panel/index.js +33 -19
  291. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  293. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -2
  295. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  297. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  299. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  301. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
  303. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -1
  305. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  307. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  308. package/build-module/components/style-book/index.js +1 -1
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  313. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  314. package/build-module/components/template-actions/index.js +44 -27
  315. package/build-module/components/template-actions/index.js.map +1 -1
  316. package/build-module/components/welcome-guide/editor.js +11 -2
  317. package/build-module/components/welcome-guide/editor.js.map +1 -1
  318. package/build-module/hooks/index.js +0 -1
  319. package/build-module/hooks/index.js.map +1 -1
  320. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  321. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  322. package/build-module/store/selectors.js +1 -9
  323. package/build-module/store/selectors.js.map +1 -1
  324. package/build-module/utils/constants.js +4 -2
  325. package/build-module/utils/constants.js.map +1 -1
  326. package/build-module/utils/get-is-list-page.js +1 -1
  327. package/build-module/utils/get-is-list-page.js.map +1 -1
  328. package/build-module/utils/math.js +92 -0
  329. package/build-module/utils/math.js.map +1 -0
  330. package/build-style/style-rtl.css +146 -130
  331. package/build-style/style.css +146 -130
  332. package/package.json +44 -44
  333. package/src/components/block-editor/editor-canvas.js +34 -9
  334. package/src/components/block-editor/site-editor-canvas.js +10 -7
  335. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  336. package/src/components/editor/index.js +11 -4
  337. package/src/components/editor-canvas-container/index.js +0 -1
  338. package/src/components/global-styles/background-panel.js +34 -0
  339. package/src/components/global-styles/color-palette-panel.js +0 -11
  340. package/src/components/global-styles/font-families.js +1 -1
  341. package/src/components/global-styles/font-library-modal/context.js +77 -31
  342. package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
  343. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  344. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  345. package/src/components/global-styles/font-library-modal/style.scss +15 -6
  346. package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
  347. package/src/components/global-styles/font-library-modal/utils/index.js +21 -8
  348. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
  349. package/src/components/global-styles/header.js +1 -1
  350. package/src/components/global-styles/hooks.js +68 -1
  351. package/src/components/global-styles/palette.js +3 -1
  352. package/src/components/global-styles/preview-colors.js +2 -2
  353. package/src/components/global-styles/preview-iframe.js +0 -1
  354. package/src/components/global-styles/preview-styles.js +2 -2
  355. package/src/components/global-styles/root-menu.js +12 -1
  356. package/src/components/global-styles/screen-background.js +29 -0
  357. package/src/components/global-styles/screen-color-palette.js +2 -2
  358. package/src/components/global-styles/screen-colors.js +4 -15
  359. package/src/components/global-styles/screen-style-variations.js +4 -36
  360. package/src/components/global-styles/screen-typography.js +6 -20
  361. package/src/components/global-styles/style-variations-container.js +2 -1
  362. package/src/components/global-styles/style.scss +15 -10
  363. package/src/components/global-styles/typography-elements.js +5 -1
  364. package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
  365. package/src/components/global-styles/typography-preview.js +3 -1
  366. package/src/components/global-styles/ui.js +5 -0
  367. package/src/components/global-styles/utils.js +1 -1
  368. package/src/components/global-styles/variations/style.scss +32 -23
  369. package/src/components/global-styles/variations/variations-color.js +12 -6
  370. package/src/components/global-styles/variations/variations-typography.js +41 -60
  371. package/src/components/header-edit-mode/index.js +1 -0
  372. package/src/components/header-edit-mode/style.scss +28 -17
  373. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  374. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  375. package/src/components/keyboard-shortcuts/global.js +16 -4
  376. package/src/components/layout/animation.js +122 -0
  377. package/src/components/layout/index.js +12 -27
  378. package/src/components/layout/router.js +26 -25
  379. package/src/components/layout/style.scss +2 -0
  380. package/src/components/page-pages/index.js +33 -54
  381. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  382. package/src/components/page-patterns/index.js +22 -31
  383. package/src/components/page-patterns/search-items.js +13 -58
  384. package/src/components/page-patterns/use-patterns.js +17 -10
  385. package/src/components/page-templates-template-parts/actions.js +106 -91
  386. package/src/components/page-templates-template-parts/index.js +41 -93
  387. package/src/components/page-templates-template-parts/style.scss +5 -0
  388. package/src/components/plugin-template-setting-panel/index.js +14 -1
  389. package/src/components/save-button/index.js +55 -26
  390. package/src/components/save-hub/index.js +20 -164
  391. package/src/components/save-panel/index.js +24 -17
  392. package/src/components/sidebar/index.js +2 -8
  393. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  394. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  395. package/src/components/sidebar-dataviews/default-views.js +12 -4
  396. package/src/components/sidebar-dataviews/index.js +5 -4
  397. package/src/components/sidebar-edit-mode/index.js +0 -2
  398. package/src/components/sidebar-edit-mode/page-panels/index.js +31 -62
  399. package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
  400. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  401. package/src/components/sidebar-edit-mode/template-panel/index.js +33 -24
  402. package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
  403. package/src/components/sidebar-navigation-screen/style.scss +21 -9
  404. package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
  405. package/src/components/sidebar-navigation-screen-global-styles/index.js +29 -2
  406. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
  407. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  408. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  409. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
  410. package/src/components/sidebar-navigation-screen-template/index.js +6 -1
  411. package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  412. package/src/components/style-book/index.js +1 -3
  413. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  414. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  415. package/src/components/template-actions/index.js +63 -46
  416. package/src/components/welcome-guide/editor.js +9 -6
  417. package/src/hooks/index.js +0 -1
  418. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
  419. package/src/store/selectors.js +3 -15
  420. package/src/style.scss +0 -2
  421. package/src/utils/constants.js +4 -2
  422. package/src/utils/get-is-list-page.js +1 -1
  423. package/src/utils/math.js +93 -0
  424. package/build/components/actions/index.js +0 -321
  425. package/build/components/actions/index.js.map +0 -1
  426. package/build/components/global-styles/preview-typography.js.map +0 -1
  427. package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -42
  428. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  429. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  430. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  431. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
  432. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  433. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  434. package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
  435. package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  436. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  437. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  438. package/build/hooks/template-part-edit.js +0 -82
  439. package/build/hooks/template-part-edit.js.map +0 -1
  440. package/build/store/utils.js +0 -71
  441. package/build/store/utils.js.map +0 -1
  442. package/build-module/components/actions/index.js +0 -310
  443. package/build-module/components/actions/index.js.map +0 -1
  444. package/build-module/components/global-styles/preview-typography.js.map +0 -1
  445. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  446. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  447. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  448. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  449. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
  450. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  451. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  452. package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
  453. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  454. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  455. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  456. package/build-module/hooks/template-part-edit.js +0 -75
  457. package/build-module/hooks/template-part-edit.js.map +0 -1
  458. package/build-module/store/utils.js +0 -64
  459. package/build-module/store/utils.js.map +0 -1
  460. package/src/components/actions/index.js +0 -411
  461. package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  462. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -37
  463. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  464. package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
  465. package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
  466. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  467. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
  468. package/src/hooks/template-part-edit.js +0 -89
  469. package/src/store/test/utils.js +0 -191
  470. package/src/store/utils.js +0 -69
@@ -26,6 +26,9 @@ var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigati
26
26
  var _styleBook = _interopRequireDefault(require("../style-book"));
27
27
  var _useGlobalStylesRevisions = _interopRequireDefault(require("../global-styles/screen-revisions/use-global-styles-revisions"));
28
28
  var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
29
+ var _variationsColor = _interopRequireDefault(require("../global-styles/variations/variations-color"));
30
+ var _variationsTypography = _interopRequireDefault(require("../global-styles/variations/variations-typography"));
31
+ var _hooks = require("../global-styles/hooks");
29
32
  /**
30
33
  * WordPress dependencies
31
34
  */
@@ -71,6 +74,9 @@ function SidebarNavigationScreenGlobalStylesContent() {
71
74
  storedSettings: getSettings()
72
75
  };
73
76
  }, []);
77
+ const colorVariations = (0, _hooks.useColorVariations)();
78
+ const typographyVariations = (0, _hooks.useTypographyVariations)();
79
+ const gap = 3;
74
80
 
75
81
  // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
76
82
  // loaded. This is necessary because the Iframe component waits until
@@ -81,7 +87,18 @@ function SidebarNavigationScreenGlobalStylesContent() {
81
87
  settings: storedSettings,
82
88
  onChange: noop,
83
89
  onInput: noop
84
- }, (0, _react.createElement)(_styleVariationsContainer.default, null));
90
+ }, (0, _react.createElement)(_components.__experimentalVStack, {
91
+ spacing: 10,
92
+ className: "edit-site-global-styles-variation-container"
93
+ }, (0, _react.createElement)(_styleVariationsContainer.default, {
94
+ gap: gap
95
+ }), colorVariations?.length && (0, _react.createElement)(_variationsColor.default, {
96
+ title: (0, _i18n.__)('Colors'),
97
+ gap: gap
98
+ }), typographyVariations?.length && (0, _react.createElement)(_variationsTypography.default, {
99
+ title: (0, _i18n.__)('Typography'),
100
+ gap: gap
101
+ })));
85
102
  }
86
103
  function SidebarNavigationScreenGlobalStyles() {
87
104
  const {
@@ -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","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","setCanvasMode","unlock","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","_react","createElement","__experimentalNavigatorButton","as","SidebarNavigationItem","path","default","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","BlockEditorProvider","settings","onChange","onInput","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","title","__","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 { __experimentalNavigatorButton as NavigatorButton } 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';\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 (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\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\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<StyleVariationsContainer />\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,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SA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,CAAAyB,OAAa;MACbqD,IAAI,EAAGC,WAAM;MACbC,KAAK,EAAG,IAAAR,QAAE,EAAE,YAAa,CAAG;MAC5B9C,OAAO,EAAGA,CAAA,KACTiB,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACD2B,SAAS,EAAGpC;IAAmB,CAC/B,CACD,EACD,IAAA1B,MAAA,CAAAC,aAAA,EAACpB,cAAA,CAAAyB,OAAa;MACbqD,IAAI,EAAGI,WAAM;MACbF,KAAK,EAAG,IAAAR,QAAE,EAAE,aAAc,CAAG;MAC7B9C,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMkC,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAf,iBAAiB,IAAI,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAzB,MAAA,CAAAC,aAAA,EAAClB,UAAA,CAAAuB,OAAS;IACT0D,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1B1D,OAAO,EAAGsC,aAAe;IACzBqB,QAAQ,EAAGrB,aAAe;IAC1BsB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
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","__experimentalNavigatorButton","as","SidebarNavigationItem","path","default","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 {\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as VStack,\n} 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 (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\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,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,WA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I,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAnC,MAAA,CAAAC,aAAA,EAACrB,UAAA,CAAA0B,OAAS;IACTkE,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"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = RenameModal;
6
+ exports.default = DeleteConfirmDialog;
7
7
  var _react = require("react");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
@@ -11,14 +11,13 @@ var _i18n = require("@wordpress/i18n");
11
11
  * WordPress dependencies
12
12
  */
13
13
 
14
- function RenameModal({
14
+ function DeleteConfirmDialog({
15
15
  onClose,
16
16
  onConfirm
17
17
  }) {
18
18
  return (0, _react.createElement)(_components.__experimentalConfirmDialog, {
19
19
  isOpen: true,
20
- onConfirm: e => {
21
- e.preventDefault();
20
+ onConfirm: () => {
22
21
  onConfirm();
23
22
 
24
23
  // Immediate close avoids ability to hit delete multiple times.
@@ -28,4 +27,4 @@ function RenameModal({
28
27
  confirmButtonText: (0, _i18n.__)('Delete')
29
28
  }, (0, _i18n.__)('Are you sure you want to delete this Navigation menu?'));
30
29
  }
31
- //# sourceMappingURL=delete-modal.js.map
30
+ //# sourceMappingURL=delete-confirm-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","DeleteConfirmDialog","onClose","onConfirm","_react","createElement","__experimentalConfirmDialog","isOpen","onCancel","confirmButtonText","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function DeleteConfirmDialog( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ () => {\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,mBAAmBA,CAAE;EAAEC,OAAO;EAAEC;AAAU,CAAC,EAAG;EACrE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,WAAA,CAAAQ,2BAAa;IACbC,MAAM;IACNJ,SAAS,EAAGA,CAAA,KAAM;MACjBA,SAAS,CAAC,CAAC;;MAEX;MACAD,OAAO,CAAC,CAAC;IACV,CAAG;IACHM,QAAQ,EAAGN,OAAS;IACpBO,iBAAiB,EAAG,IAAAC,QAAE,EAAE,QAAS;EAAG,GAElC,IAAAA,QAAE,EAAE,uDAAwD,CAChD,CAAC;AAElB"}
@@ -11,7 +11,7 @@ var _icons = require("@wordpress/icons");
11
11
  var _i18n = require("@wordpress/i18n");
12
12
  var _element = require("@wordpress/element");
13
13
  var _renameModal = _interopRequireDefault(require("./rename-modal"));
14
- var _deleteModal = _interopRequireDefault(require("./delete-modal"));
14
+ var _deleteConfirmDialog = _interopRequireDefault(require("./delete-confirm-dialog"));
15
15
  /**
16
16
  * WordPress dependencies
17
17
  */
@@ -31,13 +31,13 @@ function ScreenNavigationMoreMenu(props) {
31
31
  menuTitle
32
32
  } = props;
33
33
  const [renameModalOpen, setRenameModalOpen] = (0, _element.useState)(false);
34
- const [deleteModalOpen, setDeleteModalOpen] = (0, _element.useState)(false);
34
+ const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0, _element.useState)(false);
35
35
  const closeModals = () => {
36
36
  setRenameModalOpen(false);
37
- setDeleteModalOpen(false);
37
+ setDeleteConfirmDialogOpen(false);
38
38
  };
39
39
  const openRenameModal = () => setRenameModalOpen(true);
40
- const openDeleteModal = () => setDeleteModalOpen(true);
40
+ const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
41
41
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.DropdownMenu, {
42
42
  className: "sidebar-navigation__more-menu",
43
43
  label: (0, _i18n.__)('Actions'),
@@ -59,12 +59,12 @@ function ScreenNavigationMoreMenu(props) {
59
59
  }, (0, _i18n.__)('Duplicate')), (0, _react.createElement)(_components.MenuItem, {
60
60
  isDestructive: true,
61
61
  onClick: () => {
62
- openDeleteModal();
62
+ openDeleteConfirmDialog();
63
63
 
64
64
  // Close the dropdown after opening the modal.
65
65
  onClose();
66
66
  }
67
- }, (0, _i18n.__)('Delete'))))), deleteModalOpen && (0, _react.createElement)(_deleteModal.default, {
67
+ }, (0, _i18n.__)('Delete'))))), deleteConfirmDialogOpen && (0, _react.createElement)(_deleteConfirmDialog.default, {
68
68
  onClose: closeModals,
69
69
  onConfirm: onDelete
70
70
  }), renameModalOpen && (0, _react.createElement)(_renameModal.default, {
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_icons","_i18n","_element","_renameModal","_interopRequireDefault","_deleteModal","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","renameModalOpen","setRenameModalOpen","useState","deleteModalOpen","setDeleteModalOpen","closeModals","openRenameModal","openDeleteModal","_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 DeleteModal from './delete-modal';\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 [ deleteModalOpen, setDeleteModalOpen ] = useState( false );\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteModalOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteModal = () => setDeleteModalOpen( 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\topenDeleteModal();\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\n\t\t\t{ deleteModalOpen && (\n\t\t\t\t<DeleteModal onClose={ closeModals } onConfirm={ onDelete } />\n\t\t\t) }\n\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,YAAA,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,CAA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,CAAC;;MAEjB;MACAW,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAJ,QAAE,EAAE,QAAS,CACN,CACA,CACP,CAEO,CAAC,EAEbX,eAAe,IAChB,IAAAK,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAgC,OAAW;IAACL,OAAO,EAAGb,WAAa;IAACmB,SAAS,EAAG5B;EAAU,CAAE,CAC7D,EAECI,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"}
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,kBAAkB,CAAE,KAAM,CAAC;IAC3BG,0BAA0B,CAAE,KAAM,CAAC;EACpC,CAAC;EACD,MAAME,eAAe,GAAGA,CAAA,KAAML,kBAAkB,CAAE,IAAK,CAAC;EACxD,MAAMM,uBAAuB,GAAGA,C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ACpB,YAAA,CAAAkC,OAAW;IACXL,OAAO,EAAGb,WAAa;IACvBN,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL"}
@@ -38,7 +38,7 @@ function useDeleteNavigationMenu() {
38
38
  }, {
39
39
  throwOnError: true
40
40
  });
41
- createSuccessNotice((0, _i18n.__)('Deleted Navigation menu'), {
41
+ createSuccessNotice((0, _i18n.__)('Navigation menu successfully deleted.'), {
42
42
  type: 'snackbar'
43
43
  });
44
44
  goTo('/navigation');
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_components","_i18n","_data","_notices","_","_constants","useDeleteNavigationMenu","goTo","useNavigator","deleteEntityRecord","useDispatch","coreStore","createSuccessNotice","createErrorNotice","noticesStore","handleDelete","navigationMenu","postId","id","postType","force","throwOnError","__","type","error","sprintf","message","useSaveNavigationMenu","getEditedEntityRecord","useSelect","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","NAVIGATION_POST_TYPE","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Deleted Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\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,QAAA,GAAAJ,OAAA;AAKA,IAAAK,CAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,SAASO,uBAAuBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,sCAAY,EAAC,CAAC;EAE/B,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EAEvD,MAAM;IAAEC,mBAAmB;IAAEC;EAAkB,CAAC,GAC/C,IAAAH,iBAAW,EAAEI,cAAa,CAAC;EAE5B,MAAMC,YAAY,GAAG,MA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aAAO,GACb;QACA,IAAAH,QAAE,EAAE,WAAY,CAAC,EACjBuB,SACD,CAAC;QACDK,OAAO,EAAElC,cAAc,EAAEkC,OAAO,EAAEC,GAAG;QACrCC,MAAM,EAAE;MACT,CAAC,EACD;QACC/B,YAAY,EAAE;MACf,CACD,CAAC;MAED,IAAK4B,WAAW,EAAG;QAClBrC,mBAAmB,CAAE,IAAAU,QAAE,EAAE,4BAA6B,CAAC,EAAE;UACxDC,IAAI,EAAE;QACP,CAAE,CAAC;QACHhB,IAAI,CAAG,eAAeY,UAAU,IAAI8B,WAAW,CAAC/B,EAAI,EAAE,CAAC;MACxD;IACD,CAAC,CAAC,OAAQM,KAAK,EAAG;MACjBX,iBAAiB,CAChB,IAAAY,aAAO,GACN;MACA,IAAAH,QAAE,EAAG,2CAA2C,CAAC,EACjDE,KAAK,EAAEE,OACR,CAAC,EAED;QACCH,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAC;EAED,OAAOqB,eAAe;AACvB;AAEe,SAASS,yBAAyBA,CAAA,EAAG;EACnD,OAAO;IACNtC,YAAY,EAAET,uBAAuB,CAAC,CAAC;IACvC6B,UAAU,EAAER,qBAAqB,CAAC,CAAC;IACnCiB,eAAe,EAAEF,0BAA0B,CAAC;EAC7C,CAAC;AACF"}
1
+ {"version":3,"names":["_coreData","require","_components","_i18n","_data","_notices","_","_constants","useDeleteNavigationMenu","goTo","useNavigator","deleteEntityRecord","useDispatch","coreStore","createSuccessNotice","createErrorNotice","noticesStore","handleDelete","navigationMenu","postId","id","postType","force","throwOnError","__","type","error","sprintf","message","useSaveNavigationMenu","getEditedEntityRecord","useSelect","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","NAVIGATION_POST_TYPE","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__( 'Navigation menu successfully deleted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD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IACnCiB,eAAe,EAAEF,0BAA0B,CAAC;EAC7C,CAAC;AACF"}
@@ -100,11 +100,7 @@ function SidebarNavigationScreenPatterns() {
100
100
  // the Patterns page directly, preserve that state in the URL.
101
101
  didAccessPatternsPage: !isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined
102
102
  });
103
- const footer = !isMobileViewport ? (0, _react.createElement)(_components.__experimentalItemGroup, null, (0, _react.createElement)(_sidebarNavigationItem.default, {
104
- as: "a",
105
- href: "edit.php?post_type=wp_block",
106
- withChevron: true
107
- }, (0, _i18n.__)('Manage all of my patterns')), (isBlockBasedTheme || isTemplatePartsMode) && (0, _react.createElement)(_sidebarNavigationItem.default, {
103
+ const footer = !isMobileViewport ? (0, _react.createElement)(_components.__experimentalItemGroup, null, (isBlockBasedTheme || isTemplatePartsMode) && (0, _react.createElement)(_sidebarNavigationItem.default, {
108
104
  withChevron: true,
109
105
  ...templatePartsLink
110
106
  }, (0, _i18n.__)('Manage all template parts'))) : undefined;
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_compose","_editor","_i18n","_url","_coreData","_data","_icons","_addNewPattern","_interopRequireDefault","_sidebarNavigationItem","_sidebarNavigationScreen","_categoryItem","_constants","_link","_usePatternCategories","_useTemplatePartAreas","_store","TemplatePartGroup","areas","currentArea","currentType","_react","createElement","Fragment","className","__experimentalHeading","level","__","__experimentalItemGroup","Object","entries","map","area","label","templateParts","default","key","count","length","icon","getTemplatePartIcon","id","type","TEMPLATE_PART_POST_TYPE","isActive","PatternCategoriesGroup","categories","currentCategory","category","name","file","PATTERN_TYPES","theme","user","SidebarNavigationScreenPatterns","isMobileViewport","useViewportMatch","categoryType","categoryId","getQueryArgs","window","location","href","PATTERN_DEFAULT_CATEGORY","templatePartAreas","hasTemplateParts","isLoading","useTemplatePartAreas","patternCategories","hasPatterns","usePatternCategories","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","isTemplatePartsMode","settings","editSiteStore","getSettings","supportsTemplatePartsMode","templatePartsLink","useLink","path","didAccessPatternsPage","undefined","footer","as","withChevron","isRoot","title","description","actions","content","__experimentalItem"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { store as editSiteStore } from '../../store';\n\nfunction TemplatePartGroup( { areas, currentArea, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>\n\t\t\t</div>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ Object.entries( areas ).map(\n\t\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === area &&\n\t\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nfunction PatternCategoriesGroup( {\n\tcategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\tcount={ category.count }\n\t\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\t\ticon={ file }\n\t\t\t\t\t\tid={ category.name }\n\t\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( {\n\t\tpath: '/wp_template_part/all',\n\t\t// If a classic theme that supports template parts accessed\n\t\t// the Patterns page directly, preserve that state in the URL.\n\t\tdidAccessPatternsPage:\n\t\t\t! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,\n\t} );\n\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tas=\"a\"\n\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\twithChevron\n\t\t\t>\n\t\t\t\t{ __( 'Manage all of my patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ ( isBlockBasedTheme || isTemplatePartsMode ) && (\n\t\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t\t</SidebarNavigationItem>\n\t\t\t) }\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t\t\t\t<PatternCategoriesGroup\n\t\t\t\t\t\t\t\t\tcategories={ patternCategories }\n\t\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\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{ hasTemplateParts && (\n\t\t\t\t\t\t\t\t<TemplatePartGroup\n\t\t\t\t\t\t\t\t\tareas={ templatePartAreas }\n\t\t\t\t\t\t\t\t\tcurrentArea={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\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/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,wBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,aAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAKA,IAAAc,KAAA,GAAAd,OAAA;AACA,IAAAe,qBAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,qBAAA,GAAAP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AE,mBAAoB,CAAC,EACtC,CAAEuC,SAAS,IACZ,IAAA7C,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACG,CAAE0C,gBAAgB,IAAI,CAAEI,WAAW,IACpC,IAAAhD,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAA8B,uBAAS;MAACJ,SAAS,EAAC;IAAqD,GACzE,IAAAH,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAiG,kBAAI,QACF,IAAApE,QAAE,EACH,qCACD,CACK,CACI,CACX,EACC0C,WAAW,IACZ,IAAAhD,MAAA,CAAAC,aAAA,EAACuB,sBAAsB;MACtBC,UAAU,EAAGsB,iBAAmB;MAChCrB,eAAe,EAAGA,eAAiB;MACnC3B,WAAW,EAAGA;IAAa,CAC3B,CACD,EACC6C,gBAAgB,IACjB,IAAA5C,MAAA,CAAAC,aAAA,EAACL,iBAAiB;MACjBC,KAAK,EAAG8C,iBAAmB;MAC3B7C,WAAW,EAAG4B,eAAiB;MAC/B3B,WAAW,EAAGA;IAAa,CAC3B,CAED,CAEF;EACF,CACD,CAAC;AAEJ"}
1
+ {"version":3,"names":["_components","require","_compose","_editor","_i18n","_url","_coreData","_data","_icons","_addNewPattern","_interopRequireDefault","_sidebarNavigationItem","_sidebarNavigationScreen","_categoryItem","_constants","_link","_usePatternCategories","_useTemplatePartAreas","_store","TemplatePartGroup","areas","currentArea","currentType","_react","createElement","Fragment","className","__experimentalHeading","level","__","__experimentalItemGroup","Object","entries","map","area","label","templateParts","default","key","count","length","icon","getTemplatePartIcon","id","type","TEMPLATE_PART_POST_TYPE","isActive","PatternCategoriesGroup","categories","currentCategory","category","name","file","PATTERN_TYPES","theme","user","SidebarNavigationScreenPatterns","isMobileViewport","useViewportMatch","categoryType","categoryId","getQueryArgs","window","location","href","PATTERN_DEFAULT_CATEGORY","templatePartAreas","hasTemplateParts","isLoading","useTemplatePartAreas","patternCategories","hasPatterns","usePatternCategories","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","isTemplatePartsMode","settings","editSiteStore","getSettings","supportsTemplatePartsMode","templatePartsLink","useLink","path","didAccessPatternsPage","undefined","footer","withChevron","isRoot","title","description","actions","content","__experimentalItem"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { store as editSiteStore } from '../../store';\n\nfunction TemplatePartGroup( { areas, currentArea, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>\n\t\t\t</div>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ Object.entries( areas ).map(\n\t\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === area &&\n\t\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nfunction PatternCategoriesGroup( {\n\tcategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\tcount={ category.count }\n\t\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\t\ticon={ file }\n\t\t\t\t\t\tid={ category.name }\n\t\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( {\n\t\tpath: '/wp_template_part/all',\n\t\t// If a classic theme that supports template parts accessed\n\t\t// the Patterns page directly, preserve that state in the URL.\n\t\tdidAccessPatternsPage:\n\t\t\t! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,\n\t} );\n\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t{ ( isBlockBasedTheme || isTemplatePartsMode ) && (\n\t\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t\t</SidebarNavigationItem>\n\t\t\t) }\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t\t\t\t<PatternCategoriesGroup\n\t\t\t\t\t\t\t\t\tcategories={ patternCategories }\n\t\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\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{ hasTemplateParts && (\n\t\t\t\t\t\t\t\t<TemplatePartGroup\n\t\t\t\t\t\t\t\t\tareas={ templatePartAreas }\n\t\t\t\t\t\t\t\t\tcurrentArea={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\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/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,wBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,aAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAKA,IAAAc,KAAA,GAAAd,OAAA;AACA,IAAAe,qBAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,qBAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AA/BA;AACA;AACA;;AAcA;AACA;AACA;;AAeA,SAASkB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AAI,QACF,IAAAnE,QAAE,EACH,qCACD,CACK,CACI,CACX,EACC0C,WAAW,IACZ,IAAAhD,MAAA,CAAAC,aAAA,EAACuB,sBAAsB;MACtBC,UAAU,EAAGsB,iBAAmB;MAChCrB,eAAe,EAAGA,eAAiB;MACnC3B,WAAW,EAAGA;IAAa,CAC3B,CACD,EACC6C,gBAAgB,IACjB,IAAA5C,MAAA,CAAAC,aAAA,EAACL,iBAAiB;MACjBC,KAAK,EAAG8C,iBAAmB;MAC3B7C,WAAW,EAAG4B,eAAiB;MAC/B3B,WAAW,EAAGA;IAAa,CAC3B,CAED,CAEF;EACF,CACD,CAAC;AAEJ"}
@@ -70,6 +70,10 @@ function useTemplateDetails(postType, postId) {
70
70
  footer
71
71
  };
72
72
  }
73
+ const POST_TYPE_PATH = {
74
+ wp_template: '/wp_template',
75
+ wp_template_part: '/wp_template_part/all'
76
+ };
73
77
  function SidebarNavigationScreenTemplate() {
74
78
  const navigator = (0, _components.__experimentalUseNavigator)();
75
79
  const {
@@ -96,7 +100,7 @@ function SidebarNavigationScreenTemplate() {
96
100
  as: _sidebarButton.default
97
101
  },
98
102
  onRemove: () => {
99
- navigator.goTo(`/${postType}/all`);
103
+ navigator.goTo(POST_TYPE_PATH[postType]);
100
104
  }
101
105
  }), (0, _react.createElement)(_sidebarButton.default, {
102
106
  onClick: () => setCanvasMode('edit'),
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_icons","_components","_coreData","_templateAreas","_interopRequireDefault","_sidebarNavigationScreen","_useEditedEntityRecord","_lockUnlock","_store","_sidebarButton","_hooks","_templateActions","_homeTemplateDetails","_sidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","currentTheme","useSelect","select","coreStore","getCurrentTheme","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","__","content","slug","_react","createElement","Fragment","default","footer","modified","description","className","imageUrl","src","alt","width","height","Icon","icon","isCustomized","_x","SidebarNavigationScreenTemplate","navigator","useNavigator","params","setCanvasMode","unlock","useDispatch","editSiteStore","actions","toggleProps","as","SidebarButton","onRemove","goTo","onClick","label","pencil"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\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<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst navigator = useNavigator();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = navigator;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( `/${ postType }/all` );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,sBAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAL,sBAAA,CAAAN,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,gBAAA,GAAAP,sBAAA,CAAAN,OAAA;AACA,IAAAc,oBAAA,GAAAR,sBAAA,CAAAN,OAAA;AACA,IAAAe,qCAAA,GAAAT,sBAAA,CAAAN,OAAA;AAvBA;AACA;AACA;;AASA;AACA;AACA;;AAYA,SAASgB,kBAAkBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC/C,MAAM;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAG,IAAAC,8BAAqB,EACj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;IACf+B,OAAO,EACN,IAAAzB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAC5B,gBAAA,CAAA8B,OAAe;MACf1B,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjBgD,WAAW,EAAG;QAAEC,EAAE,EAAEC;MAAc,CAAG;MACrCC,QAAQ,EAAGA,CAAA,KAAM;QAChBX,SAAS,CAACY,IAAI,CAAG,IAAIrD,QAAU,MAAM,CAAC;MACvC;IAAG,CACH,CAAC,EACF,IAAAuB,MAAA,CAAAC,aAAA,EAAC9B,cAAA,CAAAgC,OAAa;MACb4B,OAAO,EAAGA,CAAA,KAAMV,aAAa,CAAE,MAAO,CAAG;MACzCW,KAAK,EAAG,IAAAnC,QAAE,EAAE,MAAO,CAAG;MACtBiB,IAAI,EAAGmB;IAAQ,CACf,CACA,CACF;IACD3B,WAAW,EAAGA,WAAa;IAC3BR,OAAO,EAAGA,OAAS;IACnBM,MAAM,EAAGA;EAAQ,CACjB,CAAC;AAEJ"}
1
+ {"version":3,"names":["_i18n","require","_data","_icons","_components","_coreData","_templateAreas","_interopRequireDefault","_sidebarNavigationScreen","_useEditedEntityRecord","_lockUnlock","_store","_sidebarButton","_hooks","_templateActions","_homeTemplateDetails","_sidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","currentTheme","useSelect","select","coreStore","getCurrentTheme","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","__","content","slug","_react","createElement","Fragment","default","footer","modified","description","className","imageUrl","src","alt","width","height","Icon","icon","isCustomized","_x","POST_TYPE_PATH","wp_template","wp_template_part","SidebarNavigationScreenTemplate","navigator","useNavigator","params","setCanvasMode","unlock","useDispatch","editSiteStore","actions","toggleProps","as","SidebarButton","onRemove","goTo","onClick","label","pencil"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\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<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/wp_template_part/all',\n};\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst navigator = useNavigator();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = navigator;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( POST_TYPE_PATH[ postType ] );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,sBAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAL,sBAAA,CAAAN,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,gBAAA,GAAAP,sBAAA,CAAAN,OAAA;AACA,IAAAc,oBAAA,GAAAR,sBAAA,CAAAN,OAAA;AACA,IAAAe,qCAAA,GAAAT,sBAAA,CAAAN,OAAA;AAvBA;AACA;AACA;;AASA;AACA;AACA;;AAYA,SAASgB,kBAAkBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC/C,MAAM;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAG,IAAAC,8BAAqB,EACjEL,QAAQ,EACRC,MACD,CAAC;EACD,MAAMK,YAAY,GAAG,IAAAC,eAAS,EAC3BC,MAAM,I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KAAO;IACfkC,OAAO,EACN,IAAA5B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAC5B,gBAAA,CAAA8B,OAAe;MACf1B,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjBmD,WAAW,EAAG;QAAEC,EAAE,EAAEC;MAAc,CAAG;MACrCC,QAAQ,EAAGA,CAAA,KAAM;QAChBX,SAAS,CAACY,IAAI,CAAEhB,cAAc,CAAExC,QAAQ,CAAG,CAAC;MAC7C;IAAG,CACH,CAAC,EACF,IAAAuB,MAAA,CAAAC,aAAA,EAAC9B,cAAA,CAAAgC,OAAa;MACb+B,OAAO,EAAGA,CAAA,KAAMV,aAAa,CAAE,MAAO,CAAG;MACzCW,KAAK,EAAG,IAAAtC,QAAE,EAAE,MAAO,CAAG;MACtBiB,IAAI,EAAGsB;IAAQ,CACf,CACA,CACF;IACD9B,WAAW,EAAGA,WAAa;IAC3BR,OAAO,EAAGA,OAAS;IACnBM,MAAM,EAAGA;EAAQ,CACjB,CAAC;AAEJ"}
@@ -35,7 +35,7 @@ function TemplateDataviewItem({
35
35
  title: text,
36
36
  icon: icon,
37
37
  isActive: isActive,
38
- isCustom: "false"
38
+ isCustom: false
39
39
  });
40
40
  }
41
41
  function DataviewsTemplatesSidebarContent({
@@ -64,7 +64,7 @@ function DataviewsTemplatesSidebarContent({
64
64
  title: title,
65
65
  icon: _icons.layout,
66
66
  isActive: activeView === 'all',
67
- isCustom: "false"
67
+ isCustom: false
68
68
  }), firstItemPerAuthorText.map(template => {
69
69
  return (0, _react.createElement)(TemplateDataviewItem, {
70
70
  key: template.author_text,
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_element","_components","_dataviewItem","_interopRequireDefault","_hooks","_icons","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","useAddedBy","type","id","_react","createElement","default","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","useEntityRecords","per_page","firstItemPerAuthorText","useMemo","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","__experimentalItemGroup","layout","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom=\"false\"\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\tpostType,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom=\"false\"\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMO,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAG,IAAAC,iBAAU,EAAEJ,QAAQ,CAACK,IAAI,EAAEL,QAAQ,CAACM,EAAG,CAAC;EAC/D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAe,OAAY;IACZC,GAAG,EAAGR,IAAM;IACZS,IAAI,EAAGT,IAAM;IACbU,KAAK,EAAGV,IAAM;IACdC,IAAI,EAAGA,IAAM;IACbF,QAAQ,EAAGA,QAAU;IACrBY,QAAQ,EAAC;EAAO,CAChB,CAAC;AAEJ;AAEe,SAASC,gCAAgCA,CAAE;EACzDC,UAAU;EACVC,QAAQ;EACRJ;AACD,CAAC,EAAG;EACH,MAAM;IAAEK;EAAQ,CAAC,GAAG,IAAAC,0BAAgB,EAAE,UAAU,EAAEF,QAAQ,EAAE;IAC3DG,QAAQ,EAAE,CAAC;EACZ,CAAE,CAAC;EACH,MAAMC,sBAAsB,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAAA,IAAAC,IAAA;IAC7C,MAAMC,kBAAkB,GAAGN,OAAO,EAAEO,MAAM,CAAE,CAAEC,GAAG,EAAEzB,QAAQ,KAAM;MAChE,MAAM0B,MAAM,GAAG1B,QAAQ,CAAC2B,WAAW;MACnC,IAAKD,MAAM,IAAI,CAAED,GAAG,CAAEC,MAAM,CAAE,EAAG;QAChCD,GAAG,CAAEC,MAAM,CAAE,GAAG1B,QAAQ;MACzB;MACA,OAAOyB,GAAG;IACX,CAAC,EAAE,CAAC,CAAE,CAAC;IACP,QAAAH,IAAA,GACGC,kBAAkB,IAAIK,MAAM,CAACC,MAAM,CAAEN,kBAAmB,CAAC,cAAAD,IAAA,cAAAA,IAAA,GAC3DxB,WAAW;EAEb,CAAC,EAAE,CAAEmB,OAAO,CAAG,CAAC;EAEhB,OACC,IAAAV,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAqC,uBAAS,QACT,IAAAvB,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAe,OAAY;IACZE,IAAI,EAAG,KAAO;IACdC,KAAK,EAAGA,KAAO;IACfT,IAAI,EAAG4B,aAAQ;IACf9B,QAAQ,EAAGc,UAAU,KAAK,KAAO;IACjCF,QAAQ,EAAC;EAAO,CAChB,CAAC,EACAO,sBAAsB,CAACY,GAAG,CAAIhC,QAAQ,IAAM;IAC7C,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACT,oBAAoB;MACpBW,GAAG,EAAGV,QAAQ,CAAC2B,WAAa;MAC5B3B,QAAQ,EAAGA,QAAU;MACrBC,QAAQ,EAAGc,UAAU,KAAKf,QAAQ,CAAC2B;IAAa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
1
+ {"version":3,"names":["_coreData","require","_element","_components","_dataviewItem","_interopRequireDefault","_hooks","_icons","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","useAddedBy","type","id","_react","createElement","default","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","useEntityRecords","per_page","firstItemPerAuthorText","useMemo","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","__experimentalItemGroup","layout","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\tpostType,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMO,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAG,IAAAC,iBAAU,EAAEJ,QAAQ,CAACK,IAAI,EAAEL,QAAQ,CAACM,EAAG,CAAC;EAC/D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAe,OAAY;IACZC,GAAG,EAAGR,IAAM;IACZS,IAAI,EAAGT,IAAM;IACbU,KAAK,EAAGV,IAAM;IACdC,IAAI,EAAGA,IAAM;IACbF,QAAQ,EAAGA,QAAU;IACrBY,QAAQ,EAAG;EAAO,CAClB,CAAC;AAEJ;AAEe,SAASC,gCAAgCA,CAAE;EACzDC,UAAU;EACVC,QAAQ;EACRJ;AACD,CAAC,EAAG;EACH,MAAM;IAAEK;EAAQ,CAAC,GAAG,IAAAC,0BAAgB,EAAE,UAAU,EAAEF,QAAQ,EAAE;IAC3DG,QAAQ,EAAE,CAAC;EACZ,CAAE,CAAC;EACH,MAAMC,sBAAsB,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAAA,IAAAC,IAAA;IAC7C,MAAMC,kBAAkB,GAAGN,OAAO,EAAEO,MAAM,CAAE,CAAEC,GAAG,EAAEzB,QAAQ,KAAM;MAChE,MAAM0B,MAAM,GAAG1B,QAAQ,CAAC2B,WAAW;MACnC,IAAKD,MAAM,IAAI,CAAED,GAAG,CAAEC,MAAM,CAAE,EAAG;QAChCD,GAAG,CAAEC,MAAM,CAAE,GAAG1B,QAAQ;MACzB;MACA,OAAOyB,GAAG;IACX,CAAC,EAAE,CAAC,CAAE,CAAC;IACP,QAAAH,IAAA,GACGC,kBAAkB,IAAIK,MAAM,CAACC,MAAM,CAAEN,kBAAmB,CAAC,cAAAD,IAAA,cAAAA,IAAA,GAC3DxB,WAAW;EAEb,CAAC,EAAE,CAAEmB,OAAO,CAAG,CAAC;EAEhB,OACC,IAAAV,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAqC,uBAAS,QACT,IAAAvB,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAe,OAAY;IACZE,IAAI,EAAG,KAAO;IACdC,KAAK,EAAGA,KAAO;IACfT,IAAI,EAAG4B,aAAQ;IACf9B,QAAQ,EAAGc,UAAU,KAAK,KAAO;IACjCF,QAAQ,EAAG;EAAO,CAClB,CAAC,EACAO,sBAAsB,CAACY,GAAG,CAAIhC,QAAQ,IAAM;IAC7C,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACT,oBAAoB;MACpBW,GAAG,EAAGV,QAAQ,CAAC2B,WAAa;MAC5B3B,QAAQ,EAAGA,QAAU;MACrBC,QAAQ,EAAGc,UAAU,KAAKf,QAAQ,CAAC2B;IAAa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
@@ -197,7 +197,7 @@ function StyleBook({
197
197
  return (0, _react.createElement)(_editorCanvasContainer.default, {
198
198
  onClose: onClose,
199
199
  enableResizing: enableResizing,
200
- closeButtonLabel: showCloseButton ? (0, _i18n.__)('Close Style Book') : null
200
+ closeButtonLabel: showCloseButton ? (0, _i18n.__)('Close') : null
201
201
  }, (0, _react.createElement)("div", {
202
202
  className: (0, _classnames.default)('edit-site-style-book', {
203
203
  'is-wide': sizes.width > 600,