@wordpress/edit-site 5.29.0 → 5.31.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 (511) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/actions/index.js +3 -5
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/block-editor/editor-canvas.js +18 -6
  5. package/build/components/block-editor/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 +1 -15
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  11. package/build/components/global-styles/font-families.js +1 -1
  12. package/build/components/global-styles/font-families.js.map +1 -1
  13. package/build/components/global-styles/font-library-modal/collection-font-variant.js +2 -2
  14. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  15. package/build/components/global-styles/font-library-modal/context.js +70 -59
  16. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  17. package/build/components/global-styles/font-library-modal/font-card.js +10 -15
  18. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/font-collection.js +121 -78
  20. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
  22. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  24. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/index.js +19 -6
  26. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  28. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  30. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  31. package/build/components/global-styles/font-library-modal/upload-fonts.js +51 -23
  32. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  33. package/build/components/global-styles/font-library-modal/utils/index.js +39 -5
  34. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  35. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
  36. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  37. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  38. package/build/components/global-styles/header.js +2 -2
  39. package/build/components/global-styles/header.js.map +1 -1
  40. package/build/components/global-styles/highlighted-colors.js +50 -0
  41. package/build/components/global-styles/highlighted-colors.js.map +1 -0
  42. package/build/components/global-styles/hooks.js +50 -1
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/preview-colors.js +62 -0
  45. package/build/components/global-styles/preview-colors.js.map +1 -0
  46. package/build/components/global-styles/preview-iframe.js +130 -0
  47. package/build/components/global-styles/preview-iframe.js.map +1 -0
  48. package/build/components/global-styles/preview-styles.js +163 -0
  49. package/build/components/global-styles/preview-styles.js.map +1 -0
  50. package/build/components/global-styles/screen-block-list.js +1 -1
  51. package/build/components/global-styles/screen-block-list.js.map +1 -1
  52. package/build/components/global-styles/screen-block.js +1 -1
  53. package/build/components/global-styles/screen-block.js.map +1 -1
  54. package/build/components/global-styles/screen-colors.js +3 -2
  55. package/build/components/global-styles/screen-colors.js.map +1 -1
  56. package/build/components/global-styles/screen-revisions/index.js +2 -2
  57. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  58. package/build/components/global-styles/screen-root.js +2 -2
  59. package/build/components/global-styles/screen-root.js.map +1 -1
  60. package/build/components/global-styles/screen-typography.js +5 -2
  61. package/build/components/global-styles/screen-typography.js.map +1 -1
  62. package/build/components/global-styles/style-variations-container.js +12 -84
  63. package/build/components/global-styles/style-variations-container.js.map +1 -1
  64. package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
  65. package/build/components/global-styles/typography-elements.js.map +1 -0
  66. package/build/components/global-styles/typography-example.js +67 -0
  67. package/build/components/global-styles/typography-example.js.map +1 -0
  68. package/build/components/global-styles/typography-preview.js +3 -1
  69. package/build/components/global-styles/typography-preview.js.map +1 -1
  70. package/build/components/global-styles/ui.js +27 -2
  71. package/build/components/global-styles/ui.js.map +1 -1
  72. package/build/components/global-styles/utils.js +22 -0
  73. package/build/components/global-styles/utils.js.map +1 -1
  74. package/build/components/global-styles/variations/variation.js +90 -0
  75. package/build/components/global-styles/variations/variation.js.map +1 -0
  76. package/build/components/global-styles/variations/variations-color.js +35 -0
  77. package/build/components/global-styles/variations/variations-color.js.map +1 -0
  78. package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  79. package/build/components/global-styles/variations/variations-panel.js.map +1 -0
  80. package/build/components/global-styles/variations/variations-typography.js +54 -0
  81. package/build/components/global-styles/variations/variations-typography.js.map +1 -0
  82. package/build/components/header-edit-mode/index.js +14 -12
  83. package/build/components/header-edit-mode/index.js.map +1 -1
  84. package/build/components/header-edit-mode/more-menu/index.js +10 -2
  85. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  86. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  87. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  88. package/build/components/keyboard-shortcuts/global.js +17 -3
  89. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  90. package/build/components/layout/index.js +4 -1
  91. package/build/components/layout/index.js.map +1 -1
  92. package/build/components/layout/router.js +2 -5
  93. package/build/components/layout/router.js.map +1 -1
  94. package/build/components/page-pages/index.js +6 -11
  95. package/build/components/page-pages/index.js.map +1 -1
  96. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  97. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  98. package/build/components/page-patterns/index.js +15 -18
  99. package/build/components/page-patterns/index.js.map +1 -1
  100. package/build/components/page-patterns/use-patterns.js +9 -9
  101. package/build/components/page-patterns/use-patterns.js.map +1 -1
  102. package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
  103. package/build/components/page-templates-template-parts/hooks.js.map +1 -0
  104. package/build/components/page-templates-template-parts/index.js +25 -22
  105. package/build/components/page-templates-template-parts/index.js.map +1 -1
  106. package/build/components/resizable-frame/index.js +2 -1
  107. package/build/components/resizable-frame/index.js.map +1 -1
  108. package/build/components/revisions/index.js.map +1 -1
  109. package/build/components/save-panel/index.js +31 -11
  110. package/build/components/save-panel/index.js.map +1 -1
  111. package/build/components/sidebar/index.js +3 -4
  112. package/build/components/sidebar/index.js.map +1 -1
  113. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  114. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  115. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  116. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  117. package/build/components/sidebar-dataviews/default-views.js +4 -2
  118. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  119. package/build/components/sidebar-dataviews/index.js +4 -3
  120. package/build/components/sidebar-dataviews/index.js.map +1 -1
  121. package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
  122. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  123. package/build/components/sidebar-edit-mode/page-panels/page-status.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/sidebar-card/index.js +12 -6
  127. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  128. package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
  129. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
  131. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-main/index.js +1 -2
  133. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  135. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  136. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  137. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  139. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  141. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  143. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  144. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
  145. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  146. package/build/components/sidebar-navigation-screen-template/index.js +7 -3
  147. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  148. package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -6
  149. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  150. package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  151. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  152. package/build/components/start-template-options/index.js.map +1 -1
  153. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  154. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  155. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  156. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  157. package/build/components/template-actions/index.js +44 -27
  158. package/build/components/template-actions/index.js.map +1 -1
  159. package/build/components/welcome-guide/editor.js +11 -2
  160. package/build/components/welcome-guide/editor.js.map +1 -1
  161. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +78 -0
  162. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  163. package/build/utils/constants.js +5 -3
  164. package/build/utils/constants.js.map +1 -1
  165. package/build/utils/get-is-list-page.js +1 -1
  166. package/build/utils/get-is-list-page.js.map +1 -1
  167. package/build/utils/math.js +98 -0
  168. package/build/utils/math.js.map +1 -0
  169. package/build-module/components/actions/index.js +4 -6
  170. package/build-module/components/actions/index.js.map +1 -1
  171. package/build-module/components/block-editor/editor-canvas.js +18 -6
  172. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  173. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  174. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  175. package/build-module/components/editor/index.js +2 -16
  176. package/build-module/components/editor/index.js.map +1 -1
  177. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  178. package/build-module/components/global-styles/font-families.js +1 -1
  179. package/build-module/components/global-styles/font-families.js.map +1 -1
  180. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
  181. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/context.js +72 -61
  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-card.js +11 -16
  185. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  186. package/build-module/components/global-styles/font-library-modal/font-collection.js +124 -81
  187. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  188. package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
  189. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  190. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  191. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  192. package/build-module/components/global-styles/font-library-modal/index.js +19 -6
  193. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  194. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  195. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  196. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +4 -4
  197. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  198. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +52 -24
  199. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  200. package/build-module/components/global-styles/font-library-modal/utils/index.js +38 -5
  201. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  202. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
  203. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  204. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  205. package/build-module/components/global-styles/header.js +2 -2
  206. package/build-module/components/global-styles/header.js.map +1 -1
  207. package/build-module/components/global-styles/highlighted-colors.js +43 -0
  208. package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
  209. package/build-module/components/global-styles/hooks.js +48 -1
  210. package/build-module/components/global-styles/hooks.js.map +1 -1
  211. package/build-module/components/global-styles/preview-colors.js +54 -0
  212. package/build-module/components/global-styles/preview-colors.js.map +1 -0
  213. package/build-module/components/global-styles/preview-iframe.js +123 -0
  214. package/build-module/components/global-styles/preview-iframe.js.map +1 -0
  215. package/build-module/components/global-styles/preview-styles.js +155 -0
  216. package/build-module/components/global-styles/preview-styles.js.map +1 -0
  217. package/build-module/components/global-styles/screen-block-list.js +1 -1
  218. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  219. package/build-module/components/global-styles/screen-block.js +1 -1
  220. package/build-module/components/global-styles/screen-block.js.map +1 -1
  221. package/build-module/components/global-styles/screen-colors.js +3 -2
  222. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  223. package/build-module/components/global-styles/screen-revisions/index.js +2 -2
  224. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  225. package/build-module/components/global-styles/screen-root.js +2 -2
  226. package/build-module/components/global-styles/screen-root.js.map +1 -1
  227. package/build-module/components/global-styles/screen-typography.js +5 -2
  228. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  229. package/build-module/components/global-styles/style-variations-container.js +13 -85
  230. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  231. package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
  232. package/build-module/components/global-styles/typography-elements.js.map +1 -0
  233. package/build-module/components/global-styles/typography-example.js +60 -0
  234. package/build-module/components/global-styles/typography-example.js.map +1 -0
  235. package/build-module/components/global-styles/typography-preview.js +3 -1
  236. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  237. package/build-module/components/global-styles/ui.js +27 -2
  238. package/build-module/components/global-styles/ui.js.map +1 -1
  239. package/build-module/components/global-styles/utils.js +21 -0
  240. package/build-module/components/global-styles/utils.js.map +1 -1
  241. package/build-module/components/global-styles/variations/variation.js +82 -0
  242. package/build-module/components/global-styles/variations/variation.js.map +1 -0
  243. package/build-module/components/global-styles/variations/variations-color.js +27 -0
  244. package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
  245. package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  246. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
  247. package/build-module/components/global-styles/variations/variations-typography.js +46 -0
  248. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
  249. package/build-module/components/header-edit-mode/index.js +15 -13
  250. package/build-module/components/header-edit-mode/index.js.map +1 -1
  251. package/build-module/components/header-edit-mode/more-menu/index.js +13 -5
  252. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  253. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  254. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  255. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  256. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  257. package/build-module/components/layout/index.js +4 -1
  258. package/build-module/components/layout/index.js.map +1 -1
  259. package/build-module/components/layout/router.js +2 -5
  260. package/build-module/components/layout/router.js.map +1 -1
  261. package/build-module/components/page-pages/index.js +7 -12
  262. package/build-module/components/page-pages/index.js.map +1 -1
  263. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  264. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  265. package/build-module/components/page-patterns/index.js +16 -19
  266. package/build-module/components/page-patterns/index.js.map +1 -1
  267. package/build-module/components/page-patterns/use-patterns.js +9 -9
  268. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  269. package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
  270. package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
  271. package/build-module/components/page-templates-template-parts/index.js +25 -22
  272. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  273. package/build-module/components/resizable-frame/index.js +2 -1
  274. package/build-module/components/resizable-frame/index.js.map +1 -1
  275. package/build-module/components/revisions/index.js.map +1 -1
  276. package/build-module/components/save-panel/index.js +31 -11
  277. package/build-module/components/save-panel/index.js.map +1 -1
  278. package/build-module/components/sidebar/index.js +3 -4
  279. package/build-module/components/sidebar/index.js.map +1 -1
  280. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  281. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  282. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  283. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  284. package/build-module/components/sidebar-dataviews/default-views.js +6 -4
  285. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  286. package/build-module/components/sidebar-dataviews/index.js +4 -3
  287. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  288. package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
  289. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  290. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  291. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  292. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  293. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
  294. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  295. package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
  296. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  297. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
  298. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  299. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
  300. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  301. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  302. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  303. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  304. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  305. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  306. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  307. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  308. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  309. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  310. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  311. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  312. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  313. package/build-module/components/sidebar-navigation-screen-template/index.js +6 -2
  314. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  315. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
  316. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  317. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  318. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  319. package/build-module/components/start-template-options/index.js.map +1 -1
  320. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  321. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  322. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  323. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  324. package/build-module/components/template-actions/index.js +44 -27
  325. package/build-module/components/template-actions/index.js.map +1 -1
  326. package/build-module/components/welcome-guide/editor.js +11 -2
  327. package/build-module/components/welcome-guide/editor.js.map +1 -1
  328. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +76 -1
  329. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  330. package/build-module/utils/constants.js +4 -2
  331. package/build-module/utils/constants.js.map +1 -1
  332. package/build-module/utils/get-is-list-page.js +1 -1
  333. package/build-module/utils/get-is-list-page.js.map +1 -1
  334. package/build-module/utils/math.js +92 -0
  335. package/build-module/utils/math.js.map +1 -0
  336. package/build-style/style-rtl.css +196 -315
  337. package/build-style/style.css +196 -315
  338. package/package.json +42 -42
  339. package/src/components/actions/index.js +4 -6
  340. package/src/components/block-editor/editor-canvas.js +20 -6
  341. package/src/components/block-editor/style.scss +0 -3
  342. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  343. package/src/components/editor/index.js +0 -20
  344. package/src/components/global-styles/color-palette-panel.js +0 -1
  345. package/src/components/global-styles/font-families.js +1 -1
  346. package/src/components/global-styles/font-library-modal/collection-font-variant.js +5 -5
  347. package/src/components/global-styles/font-library-modal/context.js +136 -107
  348. package/src/components/global-styles/font-library-modal/font-card.js +11 -26
  349. package/src/components/global-styles/font-library-modal/font-collection.js +298 -218
  350. package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
  351. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  352. package/src/components/global-styles/font-library-modal/index.js +23 -16
  353. package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
  354. package/src/components/global-styles/font-library-modal/library-font-variant.js +5 -5
  355. package/src/components/global-styles/font-library-modal/style.scss +27 -11
  356. package/src/components/global-styles/font-library-modal/upload-fonts.js +70 -27
  357. package/src/components/global-styles/font-library-modal/utils/index.js +45 -5
  358. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +6 -1
  359. package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
  360. package/src/components/global-styles/gradients-palette-panel.js +2 -2
  361. package/src/components/global-styles/header.js +2 -2
  362. package/src/components/global-styles/highlighted-colors.js +39 -0
  363. package/src/components/global-styles/hooks.js +68 -1
  364. package/src/components/global-styles/preview-colors.js +61 -0
  365. package/src/components/global-styles/preview-iframe.js +152 -0
  366. package/src/components/global-styles/preview-styles.js +185 -0
  367. package/src/components/global-styles/screen-block-list.js +1 -1
  368. package/src/components/global-styles/screen-block.js +4 -1
  369. package/src/components/global-styles/screen-colors.js +3 -2
  370. package/src/components/global-styles/screen-revisions/index.js +5 -2
  371. package/src/components/global-styles/screen-root.js +2 -2
  372. package/src/components/global-styles/screen-typography.js +8 -2
  373. package/src/components/global-styles/style-variations-container.js +14 -92
  374. package/src/components/global-styles/style.scss +4 -35
  375. package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +5 -1
  376. package/src/components/global-styles/typography-example.js +64 -0
  377. package/src/components/global-styles/typography-preview.js +3 -1
  378. package/src/components/global-styles/ui.js +26 -2
  379. package/src/components/global-styles/utils.js +37 -0
  380. package/src/components/global-styles/variations/style.scss +38 -0
  381. package/src/components/global-styles/variations/variation.js +93 -0
  382. package/src/components/global-styles/variations/variations-color.js +34 -0
  383. package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  384. package/src/components/global-styles/variations/variations-typography.js +63 -0
  385. package/src/components/header-edit-mode/index.js +21 -27
  386. package/src/components/header-edit-mode/more-menu/index.js +17 -8
  387. package/src/components/header-edit-mode/style.scss +4 -0
  388. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  389. package/src/components/keyboard-shortcuts/global.js +16 -4
  390. package/src/components/layout/index.js +5 -0
  391. package/src/components/layout/router.js +2 -7
  392. package/src/components/page-pages/index.js +8 -13
  393. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  394. package/src/components/page-patterns/index.js +23 -24
  395. package/src/components/page-patterns/use-patterns.js +17 -10
  396. package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
  397. package/src/components/page-templates-template-parts/index.js +34 -25
  398. package/src/components/page-templates-template-parts/style.scss +48 -0
  399. package/src/components/resizable-frame/index.js +1 -0
  400. package/src/components/revisions/index.js +1 -1
  401. package/src/components/save-panel/index.js +56 -27
  402. package/src/components/sidebar/index.js +3 -4
  403. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  404. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  405. package/src/components/sidebar-dataviews/default-views.js +14 -4
  406. package/src/components/sidebar-dataviews/index.js +4 -3
  407. package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
  408. package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
  409. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  410. package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
  411. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
  412. package/src/components/sidebar-edit-mode/template-panel/index.js +25 -6
  413. package/src/components/sidebar-navigation-screen/style.scss +10 -1
  414. package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
  415. package/src/components/sidebar-navigation-screen-main/index.js +0 -2
  416. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  417. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  418. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  419. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  420. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  421. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
  422. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  423. package/src/components/sidebar-navigation-screen-template/index.js +7 -2
  424. package/src/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
  425. package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
  426. package/src/components/start-template-options/index.js +1 -1
  427. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  428. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  429. package/src/components/template-actions/index.js +63 -46
  430. package/src/components/welcome-guide/editor.js +9 -6
  431. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +173 -0
  432. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +85 -1
  433. package/src/style.scss +2 -3
  434. package/src/utils/constants.js +4 -2
  435. package/src/utils/get-is-list-page.js +1 -1
  436. package/src/utils/math.js +93 -0
  437. package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
  438. package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  439. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
  440. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  441. package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
  442. package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  443. package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
  444. package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  445. package/build/components/global-styles/preview.js +0 -271
  446. package/build/components/global-styles/preview.js.map +0 -1
  447. package/build/components/global-styles/typogrphy-elements.js.map +0 -1
  448. package/build/components/global-styles/variations-panel.js.map +0 -1
  449. package/build/components/list/added-by.js.map +0 -1
  450. package/build/components/list/header.js +0 -55
  451. package/build/components/list/header.js.map +0 -1
  452. package/build/components/list/index.js +0 -80
  453. package/build/components/list/index.js.map +0 -1
  454. package/build/components/list/table.js +0 -94
  455. package/build/components/list/table.js.map +0 -1
  456. package/build/components/list/use-register-shortcuts.js +0 -51
  457. package/build/components/list/use-register-shortcuts.js.map +0 -1
  458. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  459. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  460. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
  461. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  462. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  463. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
  464. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  465. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  466. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  467. package/build-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
  468. package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  469. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
  470. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  471. package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
  472. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  473. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
  474. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  475. package/build-module/components/global-styles/preview.js +0 -264
  476. package/build-module/components/global-styles/preview.js.map +0 -1
  477. package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
  478. package/build-module/components/global-styles/variations-panel.js.map +0 -1
  479. package/build-module/components/list/added-by.js.map +0 -1
  480. package/build-module/components/list/header.js +0 -47
  481. package/build-module/components/list/header.js.map +0 -1
  482. package/build-module/components/list/index.js +0 -72
  483. package/build-module/components/list/index.js.map +0 -1
  484. package/build-module/components/list/table.js +0 -86
  485. package/build-module/components/list/table.js.map +0 -1
  486. package/build-module/components/list/use-register-shortcuts.js +0 -45
  487. package/build-module/components/list/use-register-shortcuts.js.map +0 -1
  488. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  489. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  490. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
  491. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  492. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  493. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
  494. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  495. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  496. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  497. package/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
  498. package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
  499. package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
  500. package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
  501. package/src/components/global-styles/preview.js +0 -327
  502. package/src/components/list/header.js +0 -48
  503. package/src/components/list/index.js +0 -87
  504. package/src/components/list/style.scss +0 -188
  505. package/src/components/list/table.js +0 -140
  506. package/src/components/list/use-register-shortcuts.js +0 -49
  507. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  508. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
  509. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
  510. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  511. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_components","_editor","_coreData","_htmlEntities","_icons","_i18n","_compose","_blocks","_blockEditor","_store","_templateActions","_interopRequireDefault","_templateAreas","_sidebarCard","_hooks","_constants","CARD_ICONS","wp_block","symbol","wp_navigation","navigation","TemplatesList","availableTemplates","onSelect","shownTemplates","useAsyncList","length","_react","createElement","__experimentalBlockPatternsList","label","__","blockPatterns","shownPatterns","onClickPattern","showTitlesAsTooltip","TemplatePanel","_CARD_ICONS$record$ty","title","description","icon","record","postType","postId","useSelect","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","type","_postId","_record","info","availablePatterns","useAvailablePatterns","editEntityRecord","useDispatch","onTemplateSelect","selectedTemplate","blocks","content","serialize","Fragment","PanelBody","default","className","decodeEntities","actions","template","initialOpen","TEMPLATE_PART_POST_TYPE","PanelRow","PostLastRevisionPanel","PostTaxonomiesPanel","PostFeaturedImagePanel","PostExcerptPanel","PostDiscussionPanel","PageAttributesPanel"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPageAttributesPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostFeaturedImagePanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { navigation, symbol } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useAsyncList } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from './template-actions';\nimport TemplateAreas from './template-areas';\nimport SidebarCard from '../sidebar-card';\nimport { useAvailablePatterns } from './hooks';\nimport { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';\n\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n};\n\nfunction TemplatesList( { availableTemplates, onSelect } ) {\n\tconst shownTemplates = useAsyncList( availableTemplates );\n\tif ( ! availableTemplates || availableTemplates?.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ availableTemplates }\n\t\t\tshownPatterns={ shownTemplates }\n\t\t\tonClickPattern={ onSelect }\n\t\t\tshowTitlesAsTooltip={ true }\n\t\t/>\n\t);\n}\n\nexport default function TemplatePanel() {\n\tconst { title, description, icon, record, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst type = getEditedPostType();\n\t\t\tconst _postId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', type, _postId );\n\t\t\tconst info = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: info.title,\n\t\t\t\tdescription: info.description,\n\t\t\t\ticon: info.icon,\n\t\t\t\trecord: _record,\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst availablePatterns = useAvailablePatterns( record );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\tconst onTemplateSelect = async ( selectedTemplate ) => {\n\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\tblocks: selectedTemplate.blocks,\n\t\t\tcontent: serialize( selectedTemplate.blocks ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PanelBody>\n\t\t\t\t<SidebarCard\n\t\t\t\t\tclassName=\"edit-site-template-card\"\n\t\t\t\t\ttitle={ decodeEntities( title ) }\n\t\t\t\t\ticon={ CARD_ICONS[ record?.type ] ?? icon }\n\t\t\t\t\tdescription={ decodeEntities( description ) }\n\t\t\t\t\tactions={ <TemplateActions template={ record } /> }\n\t\t\t\t>\n\t\t\t\t\t<TemplateAreas />\n\t\t\t\t</SidebarCard>\n\t\t\t</PanelBody>\n\t\t\t{ availablePatterns?.length > 0 && (\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Transform into:' ) }\n\t\t\t\t\tinitialOpen={ postType === TEMPLATE_PART_POST_TYPE }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tavailableTemplates={ availablePatterns }\n\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t<PostLastRevisionPanel />\n\t\t\t<PostTaxonomiesPanel />\n\t\t\t<PostFeaturedImagePanel />\n\t\t\t<PostExcerptPanel />\n\t\t\t<PostDiscussionPanel />\n\t\t\t<PageAttributesPanel />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA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EACzB,IAAAlD,MAAA,CAAAC,aAAA,EAAC3B,OAAA,CAAA6E,mBAAmB,MAAE,CAAC,EACvB,IAAAnD,MAAA,CAAAC,aAAA,EAAC3B,OAAA,CAAA8E,sBAAsB,MAAE,CAAC,EAC1B,IAAApD,MAAA,CAAAC,aAAA,EAAC3B,OAAA,CAAA+E,gBAAgB,MAAE,CAAC,EACpB,IAAArD,MAAA,CAAAC,aAAA,EAAC3B,OAAA,CAAAgF,mBAAmB,MAAE,CAAC,EACvB,IAAAtD,MAAA,CAAAC,aAAA,EAAC3B,OAAA,CAAAiF,mBAAmB,MAAE,CACrB,CAAC;AAEL"}
1
+ {"version":3,"names":["_data","require","_components","_editor","_coreData","_htmlEntities","_icons","_i18n","_compose","_blocks","_blockEditor","_router","_store","_templateActions","_interopRequireDefault","_templateAreas","_sidebarCard","_hooks","_constants","_lockUnlock","useHistory","unlock","routerPrivateApis","CARD_ICONS","wp_block","symbol","wp_navigation","navigation","TemplatesList","availableTemplates","onSelect","shownTemplates","useAsyncList","length","_react","createElement","__experimentalBlockPatternsList","label","__","blockPatterns","shownPatterns","onClickPattern","showTitlesAsTooltip","POST_TYPE_PATH","wp_template","wp_template_part","TemplatePanel","_CARD_ICONS$record$ty","title","description","icon","record","postType","postId","useSelect","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","type","_postId","_record","info","history","availablePatterns","useAvailablePatterns","editEntityRecord","useDispatch","onTemplateSelect","selectedTemplate","blocks","content","serialize","Fragment","PanelBody","default","className","decodeEntities","actions","toggleProps","size","onRemove","push","path","initialOpen","TEMPLATE_PART_POST_TYPE","PanelRow","PostLastRevisionPanel","PostTaxonomiesPanel","PostExcerptPanel","PostDiscussionPanel","PageAttributesPanel"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPageAttributesPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { navigation, symbol } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useAsyncList } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from '../../template-actions';\nimport TemplateAreas from './template-areas';\nimport SidebarCard from '../sidebar-card';\nimport { useAvailablePatterns } from './hooks';\nimport { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n};\n\nfunction TemplatesList( { availableTemplates, onSelect } ) {\n\tconst shownTemplates = useAsyncList( availableTemplates );\n\tif ( ! availableTemplates || availableTemplates?.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ availableTemplates }\n\t\t\tshownPatterns={ shownTemplates }\n\t\t\tonClickPattern={ onSelect }\n\t\t\tshowTitlesAsTooltip\n\t\t/>\n\t);\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/wp_template_part/all',\n};\n\nexport default function TemplatePanel() {\n\tconst { title, description, icon, record, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst type = getEditedPostType();\n\t\t\tconst _postId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', type, _postId );\n\t\t\tconst info = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: info.title,\n\t\t\t\tdescription: info.description,\n\t\t\t\ticon: info.icon,\n\t\t\t\trecord: _record,\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst history = useHistory();\n\tconst availablePatterns = useAvailablePatterns( record );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\tconst onTemplateSelect = async ( selectedTemplate ) => {\n\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\tblocks: selectedTemplate.blocks,\n\t\t\tcontent: serialize( selectedTemplate.blocks ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PanelBody>\n\t\t\t\t<SidebarCard\n\t\t\t\t\tclassName=\"edit-site-template-card\"\n\t\t\t\t\ttitle={ decodeEntities( title ) }\n\t\t\t\t\ticon={ CARD_ICONS[ record?.type ] ?? icon }\n\t\t\t\t\tdescription={ decodeEntities( description ) }\n\t\t\t\t\tactions={\n\t\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\t\t\t\t\ttoggleProps={ { size: 'small' } }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\tpath: POST_TYPE_PATH[ postType ],\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\t\t<TemplateAreas />\n\t\t\t\t</SidebarCard>\n\t\t\t</PanelBody>\n\t\t\t{ availablePatterns?.length > 0 && (\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Transform into:' ) }\n\t\t\t\t\tinitialOpen={ postType === TEMPLATE_PART_POST_TYPE }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tavailableTemplates={ availablePatterns }\n\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t<PostLastRevisionPanel />\n\t\t\t<PostTaxonomiesPanel />\n\t\t\t<PostExcerptPanel />\n\t\t\t<PostDiscussionPanel />\n\t\t\t<PageAttributesPanel />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAQA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAC,sBAAA,CAAAb,OAAA;AACA,IAAAc,cAAA,GAAAD,sBAAA,CAAAb,OAAA;AACA,IAAAe,YAAA,GAAAF,sBAAA,CAAAb,OAAA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CAAC,EACzB,IAAA1D,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA0F,mBAAmB,MAAE,CAAC,EACvB,IAAA3D,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA2F,gBAAgB,MAAE,CAAC,EACpB,IAAA5D,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA4F,mBAAmB,MAAE,CAAC,EACvB,IAAA7D,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA6F,mBAAmB,MAAE,CACrB,CAAC;AAEL"}
@@ -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,8 @@ function SidebarNavigationScreenGlobalStylesContent() {
71
74
  storedSettings: getSettings()
72
75
  };
73
76
  }, []);
77
+ const colorVariations = (0, _hooks.useColorVariations)();
78
+ const typographyVariations = (0, _hooks.useTypographyVariations)();
74
79
 
75
80
  // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
76
81
  // loaded. This is necessary because the Iframe component waits until
@@ -81,7 +86,14 @@ function SidebarNavigationScreenGlobalStylesContent() {
81
86
  settings: storedSettings,
82
87
  onChange: noop,
83
88
  onInput: noop
84
- }, (0, _react.createElement)(_styleVariationsContainer.default, null));
89
+ }, (0, _react.createElement)(_components.__experimentalVStack, {
90
+ spacing: 10,
91
+ className: "edit-site-global-styles-variation-container"
92
+ }, (0, _react.createElement)(_styleVariationsContainer.default, null), colorVariations?.length && (0, _react.createElement)("div", null, (0, _react.createElement)("h3", {
93
+ className: "edit-site-global-styles-variation-title"
94
+ }, (0, _i18n.__)('Colors')), (0, _react.createElement)(_variationsColor.default, null)), typographyVariations?.length && (0, _react.createElement)("div", null, (0, _react.createElement)("h3", {
95
+ className: "edit-site-global-styles-variation-title"
96
+ }, (0, _i18n.__)('Typography')), (0, _react.createElement)(_variationsTypography.default, null))));
85
97
  }
86
98
  function SidebarNavigationScreenGlobalStyles() {
87
99
  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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A,EAAAD,MAAA,CAAAmD,QAAA,QACG,CAAE7B,gBAAgB,IACnB,IAAAtB,MAAA,CAAAC,aAAA,EAACpB,cAAA,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","BlockEditorProvider","settings","onChange","onInput","__experimentalVStack","spacing","className","__","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 {\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\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 />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<ColorVariations />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<TypographyVariations />\n\t\t\t\t\t</div>\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\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B,GAChB,YAAY,GACZS,SACJ,CACA;MACD0B,SAAS,EAAGnC;IAAmB,CAC/B,CACD,EACD,IAAAlC,MAAA,CAAAC,aAAA,EAACvB,cAAA,CAAA4B,OAAa;MACb4D,IAAI,EAAGI,WAAM;MACbF,KAAK,EAAG,IAAA9C,QAAE,EAAE,aAAc,CAAG;MAC7Bf,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAM0C,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAf,iBAAiB,IAAI,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAjC,MAAA,CAAAC,aAAA,EAACrB,UAAA,CAAA0B,OAAS;IACTiE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BjE,OAAO,EAAG8C,aAAe;IACzBoB,QAAQ,EAAGpB,aAAe;IAC1BqB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
@@ -16,7 +16,6 @@ var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigati
16
16
  var _sidebarNavigationScreenGlobalStyles = require("../sidebar-navigation-screen-global-styles");
17
17
  var _lockUnlock = require("../../lock-unlock");
18
18
  var _store = require("../../store");
19
- var _templatePartHint = _interopRequireDefault(require("./template-part-hint"));
20
19
  /**
21
20
  * WordPress dependencies
22
21
  */
@@ -66,7 +65,7 @@ function SidebarNavigationScreenMain() {
66
65
  path: "/patterns",
67
66
  withChevron: true,
68
67
  icon: _icons.symbol
69
- }, (0, _i18n.__)('Patterns'))), (0, _react.createElement)(_templatePartHint.default, null))
68
+ }, (0, _i18n.__)('Patterns'))))
70
69
  });
71
70
  }
72
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_icons","_data","_element","_sidebarNavigationScreen","_interopRequireDefault","_sidebarNavigationItem","_sidebarNavigationScreenGlobalStyles","_lockUnlock","_store","_templatePartHint","SidebarNavigationScreenMain","location","useNavigator","setEditorCanvasContainerView","unlock","useDispatch","editSiteStore","useEffect","path","undefined","_react","createElement","default","isRoot","title","__","description","content","Fragment","__experimentalItemGroup","__experimentalNavigatorButton","as","SidebarNavigationItem","withChevron","icon","navigation","SidebarNavigationItemGlobalStyles","styles","page","layout","symbol"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport TemplatePartHint from './template-part-hint';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { location } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( location?.path === '/' ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ setEditorCanvasContainerView, location?.path ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/patterns\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t<TemplatePartHint />\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF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,EAAE,YAAa,CACH,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA,EAACf,oCAAA,CAAA8B,iCAAiC;MACjCH,WAAW;MACXC,IAAI,EAAGG;IAAQ,GAEb,IAAAZ,QAAE,EAAE,QAAS,CACmB,CAAC,EACpC,IAAAL,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAiC,6BAAe;MACfC,EAAE,EAAGC,8BAAuB;MAC5Bd,IAAI,EAAC,OAAO;MACZe,WAAW;MACXC,IAAI,EAAGI;IAAM,GAEX,IAAAb,QAAE,EAAE,OAAQ,CACE,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAiC,6BAAe;MACfC,EAAE,EAAGC,8BAAuB;MAC5Bd,IAAI,EAAC,cAAc;MACnBe,WAAW;MACXC,IAAI,EAAGK;IAAQ,GAEb,IAAAd,QAAE,EAAE,WAAY,CACF,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAiC,6BAAe;MACfC,EAAE,EAAGC,8BAAuB;MAC5Bd,IAAI,EAAC,WAAW;MAChBe,WAAW;MACXC,IAAI,EAAGM;IAAQ,GAEb,IAAAf,QAAE,EAAE,UAAW,CACD,CACP,CAAC,EACZ,IAAAL,MAAA,CAAAC,aAAA,EAACZ,iBAAA,CAAAa,OAAgB,MAAE,CAClB;EACF,CACD,CAAC;AAEJ"}
1
+ {"version":3,"names":["_components","require","_i18n","_icons","_data","_element","_sidebarNavigationScreen","_interopRequireDefault","_sidebarNavigationItem","_sidebarNavigationScreenGlobalStyles","_lockUnlock","_store","SidebarNavigationScreenMain","location","useNavigator","setEditorCanvasContainerView","unlock","useDispatch","editSiteStore","useEffect","path","undefined","_react","createElement","default","isRoot","title","__","description","content","Fragment","__experimentalItemGroup","__experimentalNavigatorButton","as","SidebarNavigationItem","withChevron","icon","navigation","SidebarNavigationItemGlobalStyles","styles","page","layout","symbol"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { location } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( location?.path === '/' ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ setEditorCanvasContainerView, location?.path ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/patterns\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,wBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,oCAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AArBA;AACA;AACA;;AAYA;AACA;AAC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E,EAAE,OAAQ,CACE,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAAgC,6BAAe;MACfC,EAAE,EAAGC,8BAAuB;MAC5Bd,IAAI,EAAC,cAAc;MACnBe,WAAW;MACXC,IAAI,EAAGK;IAAQ,GAEb,IAAAd,QAAE,EAAE,WAAY,CACF,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAAgC,6BAAe;MACfC,EAAE,EAAGC,8BAAuB;MAC5Bd,IAAI,EAAC,WAAW;MAChBe,WAAW;MACXC,IAAI,EAAGM;IAAQ,GAEb,IAAAf,QAAE,EAAE,UAAW,CACD,CACP,CACV;EACF,CACD,CAAC;AAEJ"}
@@ -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;IAAE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AAJ,QAAE,EAAE,WAAY,CACT,CAAC,EACX,IAAAN,MAAA,CAAAC,aAAA,EAACzB,WAAA,CAAAoC,QAAQ;IACRE,aAAa;IACbD,OAAO,EAAGA,CAAA,KAAM;MACfd,eAAe,CAAC,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,CA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AAC,aAAA,EAAClB,oBAAA,CAAAgC,OAAmB;IACnBL,OAAO,EAAGb,WAAa;IACvBmB,SAAS,EAAG5B;EAAU,CACtB,CACD,EACCI,eAAe,IAChB,IAAAQ,MAAA,CAAAC,aAAA,EAACpB,YAAA,CAAAkC,OAAW;IACXL,OAAO,EAAGb,WAAa;IACvBN,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL"}
@@ -12,7 +12,6 @@ var _sidebarNavigationScreenNavigationMenus = require("../sidebar-navigation-scr
12
12
  var _moreMenu = _interopRequireDefault(require("./more-menu"));
13
13
  var _navigationMenuEditor = _interopRequireDefault(require("./navigation-menu-editor"));
14
14
  var _buildNavigationLabel = _interopRequireDefault(require("../sidebar-navigation-screen-navigation-menus/build-navigation-label"));
15
- var _editButton = _interopRequireDefault(require("./edit-button"));
16
15
  /**
17
16
  * WordPress dependencies
18
17
  */
@@ -34,8 +33,6 @@ function SingleNavigationMenu({
34
33
  onDelete: handleDelete,
35
34
  onSave: handleSave,
36
35
  onDuplicate: handleDuplicate
37
- }), (0, _react.createElement)(_editButton.default, {
38
- postId: navigationMenu?.id
39
36
  })),
40
37
  title: (0, _buildNavigationLabel.default)(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
41
38
  description: (0, _i18n.__)('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_htmlEntities","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_navigationMenuEditor","_buildNavigationLabel","_editButton","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","_react","createElement","SidebarNavigationScreenWrapper","actions","Fragment","default","decodeEntities","onDelete","onSave","onDuplicate","postId","id","buildNavigationLabel","status","description","__","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\nimport EditButton from './edit-button';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t\t<EditButton postId={ navigationMenu?.id } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,qBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,WAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASQ,oBAAoBA,CAAE;EAC7CC,cAAc;EACdC,YAAY;EACZC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAK,EAAEC,QAAQ;EAEjD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACf,uCAAA,CAAAgB,8BAA8B;IAC9BC,OAAO,EACN,IAAAH,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACd,SAAA,CAAAkB,OAAwB;MACxBR,SAAS,EAAG,IAAAS,4BAAc,EAAET,SAAU,CAAG;MACzCU,QAAQ,EAAGb,YAAc;MACzBc,MAAM,EAAGZ,UAAY;MACrBa,WAAW,EAAGd;IAAiB,CAC/B,CAAC,EACF,IAAAK,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAc,OAAU;MAACK,MAAM,EAAGjB,cAAc,EAAEkB;IAAI,CAAE,CAC1C,CACF;IACDb,KAAK,EAAG,IAAAc,6BAAoB,EAC3BnB,cAAc,EAAEK,KAAK,EACrBL,cAAc,EAAEkB,EAAE,EAClBlB,cAAc,EAAEoB,MACjB,CAAG;IACHC,WAAW,EAAG,IAAAC,QAAE,EACf,kGACD;EAAG,GAEH,IAAAf,MAAA,CAAAC,aAAA,EAACZ,qBAAA,CAAAgB,OAAoB;IAACW,gBAAgB,EAAGvB,cAAc,EAAEkB;EAAI,CAAE,CAChC,CAAC;AAEnC"}
1
+ {"version":3,"names":["_i18n","require","_htmlEntities","_sidebarNavigationScreenNavigationMenus","_moreMenu","_interopRequireDefault","_navigationMenuEditor","_buildNavigationLabel","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","_react","createElement","SidebarNavigationScreenWrapper","actions","Fragment","default","decodeEntities","onDelete","onSave","onDuplicate","buildNavigationLabel","id","status","description","__","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,qBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMe,SAASO,oBAAoBA,CAAE;EAC7CC,cAAc;EACdC,YAAY;EACZC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAK,EAAEC,QAAQ;EAEjD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACd,uCAAA,CAAAe,8BAA8B;IAC9BC,OAAO,EACN,IAAAH,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACb,SAAA,CAAAiB,OAAwB;MACxBR,SAAS,EAAG,IAAAS,4BAAc,EAAET,SAAU,CAAG;MACzCU,QAAQ,EAAGb,YAAc;MACzBc,MAAM,EAAGZ,UAAY;MACrBa,WAAW,EAAGd;IAAiB,CAC/B,CACA,CACF;IACDG,KAAK,EAAG,IAAAY,6BAAoB,EAC3BjB,cAAc,EAAEK,KAAK,EACrBL,cAAc,EAAEkB,EAAE,EAClBlB,cAAc,EAAEmB,MACjB,CAAG;IACHC,WAAW,EAAG,IAAAC,QAAE,EACf,kGACD;EAAG,GAEH,IAAAd,MAAA,CAAAC,aAAA,EAACX,qBAAA,CAAAe,OAAoB;IAACU,gBAAgB,EAAGtB,cAAc,EAAEkB;EAAI,CAAE,CAChC,CAAC;AAEnC"}
@@ -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,MAAQC,cAAc,IAAM;IAChD,MAAMC,MAAM,GAAGD,cAAc,EAAEE,EAAE;IACjC,IAAI;MACH,MAAMT,kBAAkB,CACvB,UAAU,EACVU,UAAQ,EACRF,MAAM,EACN;QACCG,KAAK,EAAE;MACR,CAAC,EACD;QACCC,YAAY,EAAE;MACf,CACD,CAAC;MACDT,mBAAmB,CAAE,IAAAU,QAAE,EAAE,yBAA0B,CAAC,EAAE;QACrDC,IAAI,EAAE;MACP,CAAE,CAAC;MACHhB,IAAI,CAAE,aAAc,CAAC;IACtB,CAAC,CAAC,OAAQiB,KAAK,EAAG;MACjBX,iBAAiB,CAChB,IAAAY,aAAO,GACN;MACA,IAAAH,QAAE,EAAG,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,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,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,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C,UAAU,EACVxB,UAAQ,EACR;QACC2B,KAAK,EAAE,IAAArB,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 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_navigationMenuEditor","_interopRequireDefault","_useNavigationMenuTitle","TemplatePartNavigationMenu","id","title","useNavigationMenuTitle","undefined","_react","createElement","Fragment","__experimentalHeading","className","size","upperCase","weight","__","default","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\nimport useNavigationMenuTitle from './use-navigation-menu-title';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst title = useNavigationMenuTitle( id );\n\n\tif ( ! id || title === undefined ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIe,SAASK,0BAA0BA,CAAE;EAAEC;AAAG,CAAC,EAAG;EAC5D,MAAMC,KAAK,GAAG,IAAAC,+BAAsB,EAAEF,EAAG,CAAC;EAE1C,IAAK,CAAEA,EAAE,IAAIC,KAAK,KAAKE,SAAS,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAY,qBAAO;IACPC,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS,EAAG,IAAM;IAClBC,MAAM,EAAG;EAAK,GAEZV,KAAK,IAAI,IAAAW,QAAE,EAAE,YAAa,CACpB,CAAC,EACV,IAAAR,MAAA,CAAAC,aAAA,EAACT,qBAAA,CAAAiB,OAAoB;IAACC,gBAAgB,EAAGd;EAAI,CAAE,CAC9C,CAAC;AAEL"}
1
+ {"version":3,"names":["_i18n","require","_components","_navigationMenuEditor","_interopRequireDefault","_useNavigationMenuTitle","TemplatePartNavigationMenu","id","title","useNavigationMenuTitle","undefined","_react","createElement","Fragment","__experimentalHeading","className","size","upperCase","weight","__","default","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\nimport useNavigationMenuTitle from './use-navigation-menu-title';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst title = useNavigationMenuTitle( id );\n\n\tif ( ! id || title === undefined ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIe,SAASK,0BAA0BA,CAAE;EAAEC;AAAG,CAAC,EAAG;EAC5D,MAAMC,KAAK,GAAG,IAAAC,+BAAsB,EAAEF,EAAG,CAAC;EAE1C,IAAK,CAAEA,EAAE,IAAIC,KAAK,KAAKE,SAAS,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAY,qBAAO;IACPC,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZV,KAAK,IAAI,IAAAW,QAAE,EAAE,YAAa,CACpB,CAAC,EACV,IAAAR,MAAA,CAAAC,aAAA,EAACT,qBAAA,CAAAiB,OAAoB;IAACC,gBAAgB,EAAGd;EAAI,CAAE,CAC9C,CAAC;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_templatePartNavigationMenu","_interopRequireDefault","_templatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","_react","createElement","default","id","Fragment","__experimentalHeading","className","size","upperCase","weight","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,+BAAA,GAAAD,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,2BAA2BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChE,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG,OAAO,IAAI;;EAEjC;EACA,IAAKD,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;IACzB,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACP,2BAAA,CAAAQ,OAA0B;MAACC,EAAE,EAAGL,KAAK,CAAE,CAAC;IAAI,CAAE,CAAC;EACxD;;EAEA;EACA,OACC,IAAAE,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,qBAAO;IACPC,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS,EAAG,IAAM;IAClBC,MAAM,EAAG;EAAK,GAEZ,IAAAC,QAAE,EAAE,YAAa,CACX,CAAC,EACV,IAAAV,MAAA,CAAAC,aAAA,EAACL,+BAAA,CAAAM,OAA8B;IAACJ,KAAK,EAAGA;EAAO,CAAE,CAChD,CAAC;AAEL"}
1
+ {"version":3,"names":["_i18n","require","_components","_templatePartNavigationMenu","_interopRequireDefault","_templatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","_react","createElement","default","id","Fragment","__experimentalHeading","className","size","upperCase","weight","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,+BAAA,GAAAD,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,2BAA2BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChE,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG,OAAO,IAAI;;EAEjC;EACA,IAAKD,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;IACzB,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACP,2BAAA,CAAAQ,OAA0B;MAACC,EAAE,EAAGL,KAAK,CAAE,CAAC;IAAI,CAAE,CAAC;EACxD;;EAEA;EACA,OACC,IAAAE,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,qBAAO;IACPC,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZ,IAAAC,QAAE,EAAE,YAAa,CACX,CAAC,EACV,IAAAV,MAAA,CAAAC,aAAA,EAACL,+BAAA,CAAAM,OAA8B;IAACJ,KAAK,EAAGA;EAAO,CAAE,CAChD,CAAC;AAEL"}
@@ -11,7 +11,7 @@ var _i18n = require("@wordpress/i18n");
11
11
  var _coreData = require("@wordpress/core-data");
12
12
  var _editor = require("@wordpress/editor");
13
13
  var _data = require("@wordpress/data");
14
- var _addedBy = require("../list/added-by");
14
+ var _hooks = require("../page-templates-template-parts/hooks");
15
15
  var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
16
16
  var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
17
17
  var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
@@ -49,7 +49,7 @@ function usePatternDetails(postType, postId) {
49
49
  userPatternCategories: getUserPatternCategories()
50
50
  };
51
51
  }, []);
52
- const addedBy = (0, _addedBy.useAddedBy)(postType, postId);
52
+ const addedBy = (0, _hooks.useAddedBy)(postType, postId);
53
53
  const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
54
54
  const title = getTitle();
55
55
  let description = getDescription();
@@ -1 +1 @@
1
- {"version":3,"names":["_changeCase","require","_i18n","_coreData","_editor","_data","_addedBy","_useEditedEntityRecord","_interopRequireDefault","_useNavigationMenuContent","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenDetailsPanel","_constants","usePatternDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","coreStore","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","PATTERN_TYPES","user","sprintf","__","footer","modified","_react","createElement","default","details","TEMPLATE_PART_POST_TYPE","push","label","value","wp_pattern_sync_status","PATTERN_SYNC_TYPES","unsynced","_x","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","sentenceCase","className","origin","TEMPLATE_ORIGINS","plugin","has_theme_file","isCustomized","content","Fragment","useNavigationMenuContent","SidebarNavigationScreenDetailsPanel","spacing","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,yBAAA,GAA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AC,EAC3C,IAAAN,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA+E,wCAAwC,QACtCtC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEhB,KAAK;IAAEC,WAAW;IAAE6C,OAAO;IAAEvC;EAAO,CAAC;AAC/C"}
1
+ {"version":3,"names":["_changeCase","require","_i18n","_coreData","_editor","_data","_hooks","_useEditedEntityRecord","_interopRequireDefault","_useNavigationMenuContent","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenDetailsPanel","_constants","usePatternDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","coreStore","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","PATTERN_TYPES","user","sprintf","__","footer","modified","_react","createElement","default","details","TEMPLATE_PART_POST_TYPE","push","label","value","wp_pattern_sync_status","PATTERN_SYNC_TYPES","unsynced","_x","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","sentenceCase","className","origin","TEMPLATE_ORIGINS","plugin","has_theme_file","isCustomized","content","Fragment","useNavigationMenuContent","SidebarNavigationScreenDetailsPanel","spacing","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,qCAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,oCAAA,GAAAV,OAAA;AAMA,IAAAW,UAAA,GAAAX,OAAA;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAkBe,SAASY,iBAAiBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC7D,MAAM;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAG,IAAAC,8BAAqB,EACjEL,QAAQ,EACRC,MACD,CAAC;EACD,MAAMK,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,yCAAyC,CAAC,CAAC,EAClE,EACD,CAAC;EACD,MAAM;IAAEC,YAAY;IAAEC;EAAsB,CAAC,GAAG,IAAAL,eAAS,EAAIC,MAAM,IAAM;IACxE,MAAM;M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IAAAvC,QAAE,EAAE,KAAM,CAAC,GAAG,IAAAA,QAAE,EAAE,IAAK,CAC3C;IAER,CAAE,CAAC;EACJ;EAEA,MAAMwC,OAAO,GACZ,IAAArC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAsC,QAAA,QACG,IAAAC,iCAAwB,EAAEtE,QAAQ,EAAEC,MAAO,CAAC,EAC5C,CAAC,CAAEiC,OAAO,CAACU,MAAM,IAClB,IAAAb,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA0E,mCAAmC;IACnCC,OAAO,EAAG,CAAG;IACblD,KAAK,EAAG,IAAAM,QAAE,EAAE,SAAU;EAAG,GAEvBM,OAAO,CAACqB,GAAG,CAAE,CAAE;IAAElB,KAAK;IAAEC;EAAM,CAAC,KAChC,IAAAP,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA4E,sCAAsC;IAACC,GAAG,EAAGrC;EAAO,GACpD,IAAAN,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA8E,wCAAwC,QACtCtC,KACuC,CAAC,EAC3C,IAAAN,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA+E,wCAAwC,QACtCtC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEhB,KAAK;IAAEC,WAAW;IAAE6C,OAAO;IAAEvC;EAAO,CAAC;AAC/C"}
@@ -17,7 +17,7 @@ var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entit
17
17
  var _lockUnlock = require("../../lock-unlock");
18
18
  var _store = require("../../store");
19
19
  var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
20
- var _addedBy = require("../list/added-by");
20
+ var _hooks = require("../page-templates-template-parts/hooks");
21
21
  var _templateActions = _interopRequireDefault(require("../template-actions"));
22
22
  var _homeTemplateDetails = _interopRequireDefault(require("./home-template-details"));
23
23
  var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
@@ -36,7 +36,7 @@ function useTemplateDetails(postType, postId) {
36
36
  record
37
37
  } = (0, _useEditedEntityRecord.default)(postType, postId);
38
38
  const currentTheme = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme(), []);
39
- const addedBy = (0, _addedBy.useAddedBy)(postType, postId);
39
+ const addedBy = (0, _hooks.useAddedBy)(postType, postId);
40
40
  const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
41
41
  const title = getTitle();
42
42
  let descriptionText = getDescription();
@@ -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'),