@wordpress/edit-site 5.24.0 → 5.25.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 (347) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-template-modal-content.js +2 -3
  3. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  4. package/build/components/block-editor/editor-canvas.js +48 -23
  5. package/build/components/block-editor/editor-canvas.js.map +1 -1
  6. package/build/components/block-editor/site-editor-canvas.js +5 -54
  7. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  8. package/build/components/block-editor/use-site-editor-settings.js +14 -5
  9. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  10. package/build/components/editor/index.js +6 -17
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/collection-font-variant.js +8 -7
  13. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/context.js +1 -1
  15. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/library-font-variant.js +8 -7
  17. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  18. package/build/components/global-styles/screen-revisions/get-revision-changes.js +146 -0
  19. package/build/components/global-styles/screen-revisions/get-revision-changes.js.map +1 -0
  20. package/build/components/global-styles/screen-revisions/index.js +6 -10
  21. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  22. package/build/components/global-styles/screen-revisions/revisions-buttons.js +63 -13
  23. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  24. package/build/components/header-edit-mode/document-tools/index.js +17 -10
  25. package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
  26. package/build/components/header-edit-mode/index.js +16 -38
  27. package/build/components/header-edit-mode/index.js.map +1 -1
  28. package/build/components/header-edit-mode/more-menu/index.js +11 -9
  29. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  30. package/build/components/layout/index.js +9 -8
  31. package/build/components/layout/index.js.map +1 -1
  32. package/build/components/page/header.js +2 -1
  33. package/build/components/page/header.js.map +1 -1
  34. package/build/components/page-pages/index.js +31 -28
  35. package/build/components/page-pages/index.js.map +1 -1
  36. package/build/components/page-patterns/patterns-list.js +1 -2
  37. package/build/components/page-patterns/patterns-list.js.map +1 -1
  38. package/build/components/page-patterns/rename-menu-item.js +3 -0
  39. package/build/components/page-patterns/rename-menu-item.js.map +1 -1
  40. package/build/components/page-templates/dataviews-templates.js +18 -17
  41. package/build/components/page-templates/dataviews-templates.js.map +1 -1
  42. package/build/components/preferences-modal/index.js +36 -20
  43. package/build/components/preferences-modal/index.js.map +1 -1
  44. package/build/components/routes/use-title.js +3 -4
  45. package/build/components/routes/use-title.js.map +1 -1
  46. package/build/components/save-button/index.js +2 -1
  47. package/build/components/save-button/index.js.map +1 -1
  48. package/build/components/sidebar/index.js +26 -12
  49. package/build/components/sidebar/index.js.map +1 -1
  50. package/build/components/sidebar-dataviews/dataview-item.js +2 -10
  51. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  52. package/build/components/sidebar-dataviews/default-views.js +2 -2
  53. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  54. package/build/components/sidebar-edit-mode/page-panels/index.js +9 -3
  55. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  56. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -2
  57. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
  59. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  61. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-template/home-template-details.js +3 -89
  63. package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-template/index.js +2 -1
  65. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-template/template-areas.js +117 -0
  67. package/build/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
  68. package/build/components/site-hub/index.js +6 -3
  69. package/build/components/site-hub/index.js.map +1 -1
  70. package/build/components/template-actions/rename-menu-item.js +3 -0
  71. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  72. package/build/components/welcome-guide/styles.js +1 -1
  73. package/build/components/welcome-guide/styles.js.map +1 -1
  74. package/build/hooks/commands/use-common-commands.js +9 -1
  75. package/build/hooks/commands/use-common-commands.js.map +1 -1
  76. package/build/hooks/navigation-menu-edit.js +1 -1
  77. package/build/hooks/navigation-menu-edit.js.map +1 -1
  78. package/build/hooks/template-part-edit.js +1 -1
  79. package/build/hooks/template-part-edit.js.map +1 -1
  80. package/build/store/actions.js +15 -8
  81. package/build/store/actions.js.map +1 -1
  82. package/build/store/reducer.js +0 -18
  83. package/build/store/reducer.js.map +1 -1
  84. package/build/store/selectors.js +12 -6
  85. package/build/store/selectors.js.map +1 -1
  86. package/build/utils/constants.js +15 -1
  87. package/build/utils/constants.js.map +1 -1
  88. package/build-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
  89. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  90. package/build-module/components/block-editor/editor-canvas.js +50 -25
  91. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  92. package/build-module/components/block-editor/site-editor-canvas.js +8 -56
  93. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  94. package/build-module/components/block-editor/use-site-editor-settings.js +14 -5
  95. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  96. package/build-module/components/editor/index.js +9 -20
  97. package/build-module/components/editor/index.js.map +1 -1
  98. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +9 -7
  99. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  100. package/build-module/components/global-styles/font-library-modal/context.js +1 -1
  101. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  102. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +9 -7
  103. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  104. package/build-module/components/global-styles/screen-revisions/get-revision-changes.js +139 -0
  105. package/build-module/components/global-styles/screen-revisions/get-revision-changes.js.map +1 -0
  106. package/build-module/components/global-styles/screen-revisions/index.js +7 -11
  107. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  108. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +64 -14
  109. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  110. package/build-module/components/header-edit-mode/document-tools/index.js +17 -10
  111. package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
  112. package/build-module/components/header-edit-mode/index.js +20 -42
  113. package/build-module/components/header-edit-mode/index.js.map +1 -1
  114. package/build-module/components/header-edit-mode/more-menu/index.js +12 -10
  115. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  116. package/build-module/components/layout/index.js +9 -8
  117. package/build-module/components/layout/index.js.map +1 -1
  118. package/build-module/components/page/header.js +2 -1
  119. package/build-module/components/page/header.js.map +1 -1
  120. package/build-module/components/page-pages/index.js +31 -28
  121. package/build-module/components/page-pages/index.js.map +1 -1
  122. package/build-module/components/page-patterns/patterns-list.js +1 -2
  123. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  124. package/build-module/components/page-patterns/rename-menu-item.js +3 -0
  125. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
  126. package/build-module/components/page-templates/dataviews-templates.js +18 -17
  127. package/build-module/components/page-templates/dataviews-templates.js.map +1 -1
  128. package/build-module/components/preferences-modal/index.js +37 -21
  129. package/build-module/components/preferences-modal/index.js.map +1 -1
  130. package/build-module/components/routes/use-title.js +3 -4
  131. package/build-module/components/routes/use-title.js.map +1 -1
  132. package/build-module/components/save-button/index.js +2 -1
  133. package/build-module/components/save-button/index.js.map +1 -1
  134. package/build-module/components/sidebar/index.js +26 -12
  135. package/build-module/components/sidebar/index.js.map +1 -1
  136. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -10
  137. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  138. package/build-module/components/sidebar-dataviews/default-views.js +2 -2
  139. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  140. package/build-module/components/sidebar-edit-mode/page-panels/index.js +9 -3
  141. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  142. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -3
  143. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  144. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
  145. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  146. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  147. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  148. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +5 -90
  149. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  150. package/build-module/components/sidebar-navigation-screen-template/index.js +2 -1
  151. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen-template/template-areas.js +109 -0
  153. package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
  154. package/build-module/components/site-hub/index.js +6 -3
  155. package/build-module/components/site-hub/index.js.map +1 -1
  156. package/build-module/components/template-actions/rename-menu-item.js +3 -0
  157. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  158. package/build-module/components/welcome-guide/styles.js +1 -1
  159. package/build-module/components/welcome-guide/styles.js.map +1 -1
  160. package/build-module/hooks/commands/use-common-commands.js +9 -1
  161. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  162. package/build-module/hooks/navigation-menu-edit.js +1 -1
  163. package/build-module/hooks/navigation-menu-edit.js.map +1 -1
  164. package/build-module/hooks/template-part-edit.js +1 -1
  165. package/build-module/hooks/template-part-edit.js.map +1 -1
  166. package/build-module/store/actions.js +13 -6
  167. package/build-module/store/actions.js.map +1 -1
  168. package/build-module/store/reducer.js +0 -17
  169. package/build-module/store/reducer.js.map +1 -1
  170. package/build-module/store/selectors.js +10 -3
  171. package/build-module/store/selectors.js.map +1 -1
  172. package/build-module/utils/constants.js +8 -0
  173. package/build-module/utils/constants.js.map +1 -1
  174. package/build-style/style-rtl.css +302 -354
  175. package/build-style/style.css +302 -354
  176. package/package.json +42 -42
  177. package/src/components/add-new-template/add-custom-template-modal-content.js +1 -1
  178. package/src/components/block-editor/editor-canvas.js +63 -47
  179. package/src/components/block-editor/site-editor-canvas.js +32 -96
  180. package/src/components/block-editor/style.scss +6 -12
  181. package/src/components/block-editor/use-site-editor-settings.js +47 -36
  182. package/src/components/editor/index.js +10 -16
  183. package/src/components/global-styles/font-library-modal/collection-font-variant.js +12 -6
  184. package/src/components/global-styles/font-library-modal/context.js +1 -1
  185. package/src/components/global-styles/font-library-modal/library-font-variant.js +12 -6
  186. package/src/components/global-styles/screen-revisions/get-revision-changes.js +171 -0
  187. package/src/components/global-styles/screen-revisions/index.js +4 -11
  188. package/src/components/global-styles/screen-revisions/revisions-buttons.js +86 -17
  189. package/src/components/global-styles/screen-revisions/style.scss +10 -2
  190. package/src/components/global-styles/screen-revisions/test/get-revision-changes.js +191 -0
  191. package/src/components/header-edit-mode/document-tools/index.js +13 -13
  192. package/src/components/header-edit-mode/index.js +29 -63
  193. package/src/components/header-edit-mode/more-menu/index.js +18 -22
  194. package/src/components/header-edit-mode/style.scss +58 -33
  195. package/src/components/layout/index.js +21 -20
  196. package/src/components/list/style.scss +5 -0
  197. package/src/components/page/header.js +2 -1
  198. package/src/components/page/style.scss +2 -2
  199. package/src/components/page-pages/index.js +59 -35
  200. package/src/components/page-pages/style.scss +3 -1
  201. package/src/components/page-patterns/patterns-list.js +5 -2
  202. package/src/components/page-patterns/rename-menu-item.js +7 -1
  203. package/src/components/page-templates/dataviews-templates.js +28 -13
  204. package/src/components/preferences-modal/index.js +59 -33
  205. package/src/components/routes/use-title.js +3 -10
  206. package/src/components/save-button/index.js +1 -0
  207. package/src/components/sidebar/index.js +41 -24
  208. package/src/components/sidebar/style.scss +10 -12
  209. package/src/components/sidebar-dataviews/dataview-item.js +3 -7
  210. package/src/components/sidebar-dataviews/default-views.js +2 -2
  211. package/src/components/sidebar-edit-mode/page-panels/index.js +39 -25
  212. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -2
  213. package/src/components/sidebar-edit-mode/page-panels/style.scss +1 -42
  214. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +7 -1
  215. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  216. package/src/components/sidebar-navigation-screen-template/home-template-details.js +1 -96
  217. package/src/components/sidebar-navigation-screen-template/index.js +8 -2
  218. package/src/components/sidebar-navigation-screen-template/template-areas.js +135 -0
  219. package/src/components/site-hub/index.js +4 -5
  220. package/src/components/template-actions/rename-menu-item.js +7 -1
  221. package/src/components/welcome-guide/styles.js +1 -1
  222. package/src/hooks/commands/use-common-commands.js +10 -5
  223. package/src/hooks/navigation-menu-edit.js +1 -1
  224. package/src/hooks/template-part-edit.js +1 -1
  225. package/src/store/actions.js +15 -5
  226. package/src/store/reducer.js +0 -18
  227. package/src/store/selectors.js +15 -3
  228. package/src/style.scss +1 -2
  229. package/src/utils/constants.js +8 -0
  230. package/build/components/dataviews/add-filter.js +0 -91
  231. package/build/components/dataviews/add-filter.js.map +0 -1
  232. package/build/components/dataviews/constants.js +0 -14
  233. package/build/components/dataviews/constants.js.map +0 -1
  234. package/build/components/dataviews/dataviews.js +0 -99
  235. package/build/components/dataviews/dataviews.js.map +0 -1
  236. package/build/components/dataviews/filter-summary.js +0 -62
  237. package/build/components/dataviews/filter-summary.js.map +0 -1
  238. package/build/components/dataviews/filters.js +0 -63
  239. package/build/components/dataviews/filters.js.map +0 -1
  240. package/build/components/dataviews/index.js +0 -21
  241. package/build/components/dataviews/index.js.map +0 -1
  242. package/build/components/dataviews/item-actions.js +0 -184
  243. package/build/components/dataviews/item-actions.js.map +0 -1
  244. package/build/components/dataviews/pagination.js +0 -123
  245. package/build/components/dataviews/pagination.js.map +0 -1
  246. package/build/components/dataviews/reset-filters.js +0 -33
  247. package/build/components/dataviews/reset-filters.js.map +0 -1
  248. package/build/components/dataviews/search.js +0 -51
  249. package/build/components/dataviews/search.js.map +0 -1
  250. package/build/components/dataviews/view-actions.js +0 -244
  251. package/build/components/dataviews/view-actions.js.map +0 -1
  252. package/build/components/dataviews/view-grid.js +0 -82
  253. package/build/components/dataviews/view-grid.js.map +0 -1
  254. package/build/components/dataviews/view-list.js +0 -399
  255. package/build/components/dataviews/view-list.js.map +0 -1
  256. package/build/components/dataviews/view-side-by-side.js +0 -20
  257. package/build/components/dataviews/view-side-by-side.js.map +0 -1
  258. package/build/components/header-edit-mode/document-actions/index.js +0 -172
  259. package/build/components/header-edit-mode/document-actions/index.js.map +0 -1
  260. package/build/components/page-content-focus-notifications/back-to-page-notification.js +0 -61
  261. package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
  262. package/build/components/page-content-focus-notifications/edit-template-notification.js +0 -102
  263. package/build/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
  264. package/build/components/page-content-focus-notifications/index.js +0 -22
  265. package/build/components/page-content-focus-notifications/index.js.map +0 -1
  266. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +0 -101
  267. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
  268. package/build/components/sidebar-edit-mode/page-panels/hooks.js +0 -79
  269. package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
  270. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -48
  271. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
  272. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -84
  273. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
  274. package/build/utils/use-debounced-input.js +0 -22
  275. package/build/utils/use-debounced-input.js.map +0 -1
  276. package/build-module/components/dataviews/add-filter.js +0 -84
  277. package/build-module/components/dataviews/add-filter.js.map +0 -1
  278. package/build-module/components/dataviews/constants.js +0 -6
  279. package/build-module/components/dataviews/constants.js.map +0 -1
  280. package/build-module/components/dataviews/dataviews.js +0 -90
  281. package/build-module/components/dataviews/dataviews.js.map +0 -1
  282. package/build-module/components/dataviews/filter-summary.js +0 -55
  283. package/build-module/components/dataviews/filter-summary.js.map +0 -1
  284. package/build-module/components/dataviews/filters.js +0 -55
  285. package/build-module/components/dataviews/filters.js.map +0 -1
  286. package/build-module/components/dataviews/index.js +0 -2
  287. package/build-module/components/dataviews/index.js.map +0 -1
  288. package/build-module/components/dataviews/item-actions.js +0 -177
  289. package/build-module/components/dataviews/item-actions.js.map +0 -1
  290. package/build-module/components/dataviews/pagination.js +0 -115
  291. package/build-module/components/dataviews/pagination.js.map +0 -1
  292. package/build-module/components/dataviews/reset-filters.js +0 -26
  293. package/build-module/components/dataviews/reset-filters.js.map +0 -1
  294. package/build-module/components/dataviews/search.js +0 -43
  295. package/build-module/components/dataviews/search.js.map +0 -1
  296. package/build-module/components/dataviews/view-actions.js +0 -237
  297. package/build-module/components/dataviews/view-actions.js.map +0 -1
  298. package/build-module/components/dataviews/view-grid.js +0 -74
  299. package/build-module/components/dataviews/view-grid.js.map +0 -1
  300. package/build-module/components/dataviews/view-list.js +0 -390
  301. package/build-module/components/dataviews/view-list.js.map +0 -1
  302. package/build-module/components/dataviews/view-side-by-side.js +0 -12
  303. package/build-module/components/dataviews/view-side-by-side.js.map +0 -1
  304. package/build-module/components/header-edit-mode/document-actions/index.js +0 -164
  305. package/build-module/components/header-edit-mode/document-actions/index.js.map +0 -1
  306. package/build-module/components/page-content-focus-notifications/back-to-page-notification.js +0 -54
  307. package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
  308. package/build-module/components/page-content-focus-notifications/edit-template-notification.js +0 -96
  309. package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
  310. package/build-module/components/page-content-focus-notifications/index.js +0 -14
  311. package/build-module/components/page-content-focus-notifications/index.js.map +0 -1
  312. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +0 -93
  313. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
  314. package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +0 -69
  315. package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
  316. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -41
  317. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
  318. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -77
  319. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
  320. package/build-module/utils/use-debounced-input.js +0 -15
  321. package/build-module/utils/use-debounced-input.js.map +0 -1
  322. package/src/components/dataviews/README.md +0 -191
  323. package/src/components/dataviews/add-filter.js +0 -108
  324. package/src/components/dataviews/constants.js +0 -5
  325. package/src/components/dataviews/dataviews.js +0 -99
  326. package/src/components/dataviews/filter-summary.js +0 -79
  327. package/src/components/dataviews/filters.js +0 -65
  328. package/src/components/dataviews/index.js +0 -1
  329. package/src/components/dataviews/item-actions.js +0 -208
  330. package/src/components/dataviews/pagination.js +0 -144
  331. package/src/components/dataviews/reset-filters.js +0 -26
  332. package/src/components/dataviews/search.js +0 -42
  333. package/src/components/dataviews/style.scss +0 -131
  334. package/src/components/dataviews/view-actions.js +0 -319
  335. package/src/components/dataviews/view-grid.js +0 -90
  336. package/src/components/dataviews/view-list.js +0 -512
  337. package/src/components/dataviews/view-side-by-side.js +0 -9
  338. package/src/components/header-edit-mode/document-actions/index.js +0 -204
  339. package/src/components/header-edit-mode/document-actions/style.scss +0 -145
  340. package/src/components/page-content-focus-notifications/back-to-page-notification.js +0 -58
  341. package/src/components/page-content-focus-notifications/edit-template-notification.js +0 -104
  342. package/src/components/page-content-focus-notifications/index.js +0 -14
  343. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +0 -108
  344. package/src/components/sidebar-edit-mode/page-panels/hooks.js +0 -99
  345. package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -45
  346. package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -83
  347. package/src/utils/use-debounced-input.js +0 -18
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classNames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -33,53 +38,65 @@ import DataViewsSidebarContent from '../sidebar-dataviews';
33
38
 
34
39
  const { useLocation } = unlock( routerPrivateApis );
35
40
 
41
+ function SidebarScreenWrapper( { className, ...props } ) {
42
+ return (
43
+ <NavigatorScreen
44
+ className={ classNames(
45
+ 'edit-site-sidebar__screen-wrapper',
46
+ className
47
+ ) }
48
+ { ...props }
49
+ />
50
+ );
51
+ }
52
+
36
53
  function SidebarScreens() {
37
54
  useSyncPathWithURL();
38
55
 
39
56
  return (
40
57
  <>
41
- <NavigatorScreen path="/">
58
+ <SidebarScreenWrapper path="/">
42
59
  <SidebarNavigationScreenMain />
43
- </NavigatorScreen>
44
- <NavigatorScreen path="/navigation">
60
+ </SidebarScreenWrapper>
61
+ <SidebarScreenWrapper path="/navigation">
45
62
  <SidebarNavigationScreenNavigationMenus />
46
- </NavigatorScreen>
47
- <NavigatorScreen path="/navigation/:postType/:postId">
63
+ </SidebarScreenWrapper>
64
+ <SidebarScreenWrapper path="/navigation/:postType/:postId">
48
65
  <SidebarNavigationScreenNavigationMenu />
49
- </NavigatorScreen>
50
- <NavigatorScreen path="/wp_global_styles">
66
+ </SidebarScreenWrapper>
67
+ <SidebarScreenWrapper path="/wp_global_styles">
51
68
  <SidebarNavigationScreenGlobalStyles />
52
- </NavigatorScreen>
53
- <NavigatorScreen path="/page">
69
+ </SidebarScreenWrapper>
70
+ <SidebarScreenWrapper path="/page">
54
71
  <SidebarNavigationScreenPages />
55
- </NavigatorScreen>
56
- <NavigatorScreen path="/page/:postId">
72
+ </SidebarScreenWrapper>
73
+ <SidebarScreenWrapper path="/page/:postId">
57
74
  <SidebarNavigationScreenPage />
58
- </NavigatorScreen>
75
+ </SidebarScreenWrapper>
59
76
  { window?.__experimentalAdminViews && (
60
- <NavigatorScreen path="/pages">
77
+ <SidebarScreenWrapper path="/pages">
61
78
  <SidebarNavigationScreen
62
79
  title={ __( 'Pages' ) }
63
80
  backPath="/page"
64
81
  content={ <DataViewsSidebarContent /> }
65
82
  />
66
- </NavigatorScreen>
83
+ </SidebarScreenWrapper>
67
84
  ) }
68
- <NavigatorScreen path="/:postType(wp_template)">
85
+ <SidebarScreenWrapper path="/:postType(wp_template)">
69
86
  <SidebarNavigationScreenTemplates />
70
- </NavigatorScreen>
71
- <NavigatorScreen path="/patterns">
87
+ </SidebarScreenWrapper>
88
+ <SidebarScreenWrapper path="/patterns">
72
89
  <SidebarNavigationScreenPatterns />
73
- </NavigatorScreen>
74
- <NavigatorScreen path="/:postType(wp_template|wp_template_part)/all">
90
+ </SidebarScreenWrapper>
91
+ <SidebarScreenWrapper path="/:postType(wp_template|wp_template_part)/all">
75
92
  <SidebarNavigationScreenTemplatesBrowse />
76
- </NavigatorScreen>
77
- <NavigatorScreen path="/:postType(wp_template_part|wp_block)/:postId">
93
+ </SidebarScreenWrapper>
94
+ <SidebarScreenWrapper path="/:postType(wp_template_part|wp_block)/:postId">
78
95
  <SidebarNavigationScreenPattern />
79
- </NavigatorScreen>
80
- <NavigatorScreen path="/:postType(wp_template)/:postId">
96
+ </SidebarScreenWrapper>
97
+ <SidebarScreenWrapper path="/:postType(wp_template)/:postId">
81
98
  <SidebarNavigationScreenTemplate />
82
- </NavigatorScreen>
99
+ </SidebarScreenWrapper>
83
100
  </>
84
101
  );
85
102
  }
@@ -1,14 +1,17 @@
1
1
  .edit-site-sidebar__content {
2
2
  flex-grow: 1;
3
3
  overflow-y: auto;
4
+ }
5
+
6
+ .edit-site-sidebar__screen-wrapper {
7
+ @include custom-scrollbars-on-hover(transparent, $gray-700);
8
+ scrollbar-gutter: stable;
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
4
12
 
5
- .components-navigator-screen {
6
- @include custom-scrollbars-on-hover(transparent, $gray-700);
7
- scrollbar-gutter: stable;
8
- display: flex;
9
- flex-direction: column;
10
- height: 100%;
11
- }
13
+ // This matches the logo padding
14
+ padding: 0 $grid-unit-15;
12
15
  }
13
16
 
14
17
  .edit-site-sidebar__footer {
@@ -17,8 +20,3 @@
17
20
  margin: 0 $canvas-padding;
18
21
  padding: $canvas-padding 0;
19
22
  }
20
-
21
- .edit-site-sidebar__content > div {
22
- // This matches the logo padding
23
- padding: 0 $grid-unit-15;
24
- }
@@ -6,9 +6,9 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { page, columns, pullRight } from '@wordpress/icons';
10
9
  import { privateApis as routerPrivateApis } from '@wordpress/router';
11
10
  import { __experimentalHStack as HStack } from '@wordpress/components';
11
+ import { VIEW_LAYOUTS } from '@wordpress/dataviews';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -18,11 +18,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
18
18
  import { unlock } from '../../lock-unlock';
19
19
  const { useLocation } = unlock( routerPrivateApis );
20
20
 
21
- function getDataViewIcon( type ) {
22
- const icons = { list: page, grid: columns, 'side-by-side': pullRight };
23
- return icons[ type ];
24
- }
25
-
26
21
  export default function DataViewItem( {
27
22
  title,
28
23
  slug,
@@ -37,7 +32,8 @@ export default function DataViewItem( {
37
32
  params: { path },
38
33
  } = useLocation();
39
34
 
40
- const iconToUse = icon || getDataViewIcon( type );
35
+ const iconToUse =
36
+ icon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;
41
37
 
42
38
  const linkInfo = useLink( {
43
39
  path,
@@ -7,10 +7,10 @@ import { trash } from '@wordpress/icons';
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import { OPERATOR_IN } from '../dataviews/constants';
10
+ import { LAYOUT_TABLE, OPERATOR_IN } from '../../utils/constants';
11
11
 
12
12
  const DEFAULT_PAGE_BASE = {
13
- type: 'list',
13
+ type: LAYOUT_TABLE,
14
14
  search: '',
15
15
  filters: [],
16
16
  page: 1,
@@ -12,6 +12,7 @@ import { humanTimeDiff } from '@wordpress/date';
12
12
  import { useSelect } from '@wordpress/data';
13
13
  import { store as coreStore } from '@wordpress/core-data';
14
14
  import { decodeEntities } from '@wordpress/html-entities';
15
+ import { store as editorStore } from '@wordpress/editor';
15
16
 
16
17
  /**
17
18
  * Internal dependencies
@@ -22,28 +23,39 @@ import PageContent from './page-content';
22
23
  import PageSummary from './page-summary';
23
24
 
24
25
  export default function PagePanels() {
25
- const { id, type, hasResolved, status, date, password, title, modified } =
26
- useSelect( ( select ) => {
27
- const { getEditedPostContext } = select( editSiteStore );
28
- const { getEditedEntityRecord, hasFinishedResolution } =
29
- select( coreStore );
30
- const context = getEditedPostContext();
31
- const queryArgs = [ 'postType', context.postType, context.postId ];
32
- const page = getEditedEntityRecord( ...queryArgs );
33
- return {
34
- hasResolved: hasFinishedResolution(
35
- 'getEditedEntityRecord',
36
- queryArgs
37
- ),
38
- title: page?.title,
39
- id: page?.id,
40
- type: page?.type,
41
- status: page?.status,
42
- date: page?.date,
43
- password: page?.password,
44
- modified: page?.modified,
45
- };
46
- }, [] );
26
+ const {
27
+ id,
28
+ type,
29
+ hasResolved,
30
+ status,
31
+ date,
32
+ password,
33
+ title,
34
+ modified,
35
+ renderingMode,
36
+ } = useSelect( ( select ) => {
37
+ const { getEditedPostContext } = select( editSiteStore );
38
+ const { getEditedEntityRecord, hasFinishedResolution } =
39
+ select( coreStore );
40
+ const { getRenderingMode } = select( editorStore );
41
+ const context = getEditedPostContext();
42
+ const queryArgs = [ 'postType', context.postType, context.postId ];
43
+ const page = getEditedEntityRecord( ...queryArgs );
44
+ return {
45
+ hasResolved: hasFinishedResolution(
46
+ 'getEditedEntityRecord',
47
+ queryArgs
48
+ ),
49
+ title: page?.title,
50
+ id: page?.id,
51
+ type: page?.type,
52
+ status: page?.status,
53
+ date: page?.date,
54
+ password: page?.password,
55
+ modified: page?.modified,
56
+ renderingMode: getRenderingMode(),
57
+ };
58
+ }, [] );
47
59
 
48
60
  if ( ! hasResolved ) {
49
61
  return null;
@@ -77,9 +89,11 @@ export default function PagePanels() {
77
89
  postType={ type }
78
90
  />
79
91
  </PanelBody>
80
- <PanelBody title={ __( 'Content' ) }>
81
- <PageContent />
82
- </PanelBody>
92
+ { renderingMode !== 'post-only' && (
93
+ <PanelBody title={ __( 'Content' ) }>
94
+ <PageContent />
95
+ </PanelBody>
96
+ ) }
83
97
  </>
84
98
  );
85
99
  }
@@ -6,13 +6,13 @@ import {
6
6
  PostAuthorPanel,
7
7
  PostURLPanel,
8
8
  PostSchedulePanel,
9
+ PostTemplatePanel,
9
10
  } from '@wordpress/editor';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
14
15
  import PageStatus from './page-status';
15
- import EditTemplate from './edit-template';
16
16
 
17
17
  export default function PageSummary( {
18
18
  status,
@@ -31,7 +31,7 @@ export default function PageSummary( {
31
31
  postType={ postType }
32
32
  />
33
33
  <PostSchedulePanel />
34
- <EditTemplate />
34
+ <PostTemplatePanel />
35
35
  <PostURLPanel />
36
36
  <PostAuthorPanel />
37
37
  </VStack>
@@ -1,39 +1,9 @@
1
- .edit-site-swap-template-modal {
2
- z-index: z-index(".edit-site-swap-template-modal");
3
- }
1
+
4
2
 
5
3
  .edit-site-page-panels__swap-template__confirm-modal__actions {
6
4
  margin-top: $grid-unit-30;
7
5
  }
8
6
 
9
- .edit-site-page-panels__swap-template__modal-content .block-editor-block-patterns-list {
10
- column-count: 2;
11
- column-gap: $grid-unit-30;
12
-
13
- // Small top padding required to avoid cutting off the visible outline when hovering items
14
- padding-top: $border-width-focus-fallback;
15
-
16
- @include break-medium() {
17
- column-count: 3;
18
- }
19
-
20
- @include break-wide() {
21
- column-count: 4;
22
- }
23
-
24
- .block-editor-block-patterns-list__list-item {
25
- break-inside: avoid-column;
26
- }
27
-
28
- .block-editor-block-patterns-list__item {
29
- // Avoid to override the BlockPatternList component
30
- // default hover and focus styles.
31
- &:not(:focus):not(:hover) .block-editor-block-preview__container {
32
- box-shadow: 0 0 0 1px $gray-300;
33
- }
34
- }
35
- }
36
-
37
7
  .edit-site-change-status__content {
38
8
  .components-popover__content {
39
9
  min-width: 320px;
@@ -69,14 +39,3 @@
69
39
  overflow: hidden;
70
40
  text-overflow: ellipsis;
71
41
  }
72
-
73
- .edit-site-page-panels-edit-template__dropdown {
74
- .components-popover__content {
75
- min-width: 240px;
76
- }
77
- .components-button.is-pressed,
78
- .components-button.is-pressed:hover {
79
- background: inherit;
80
- color: inherit;
81
- }
82
- }
@@ -27,16 +27,22 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
27
27
  <VStack spacing="3">
28
28
  <TextControl
29
29
  __nextHasNoMarginBottom
30
+ __next40pxDefaultSize
30
31
  value={ editedMenuTitle }
31
32
  placeholder={ __( 'Navigation title' ) }
32
33
  onChange={ setEditedMenuTitle }
33
34
  />
34
35
  <HStack justify="right">
35
- <Button variant="tertiary" onClick={ onClose }>
36
+ <Button
37
+ __next40pxDefaultSize
38
+ variant="tertiary"
39
+ onClick={ onClose }
40
+ >
36
41
  { __( 'Cancel' ) }
37
42
  </Button>
38
43
 
39
44
  <Button
45
+ __next40pxDefaultSize
40
46
  disabled={ ! isEditedMenuTitleValid }
41
47
  variant="primary"
42
48
  type="submit"
@@ -95,7 +95,7 @@ export default function usePatternCategories() {
95
95
  sortedCategories.unshift( {
96
96
  name: PATTERN_DEFAULT_CATEGORY,
97
97
  label: __( 'All patterns' ),
98
- description: __( 'A list of all patterns from all sources' ),
98
+ description: __( 'A list of all patterns from all sources.' ),
99
99
  count: themePatterns.length + userPatterns.length,
100
100
  } );
101
101
 
@@ -9,12 +9,8 @@ import {
9
9
  CheckboxControl,
10
10
  __experimentalInputControl as InputControl,
11
11
  __experimentalNumberControl as NumberControl,
12
- __experimentalTruncate as Truncate,
13
- __experimentalItemGroup as ItemGroup,
14
12
  } from '@wordpress/components';
15
- import { header, footer, layout } from '@wordpress/icons';
16
- import { useMemo, useState, useEffect } from '@wordpress/element';
17
- import { decodeEntities } from '@wordpress/html-entities';
13
+ import { useState, useEffect } from '@wordpress/element';
18
14
 
19
15
  /**
20
16
  * Internal dependencies
@@ -23,58 +19,19 @@ import {
23
19
  SidebarNavigationScreenDetailsPanel,
24
20
  SidebarNavigationScreenDetailsPanelRow,
25
21
  } from '../sidebar-navigation-screen-details-panel';
26
- import { unlock } from '../../lock-unlock';
27
- import { store as editSiteStore } from '../../store';
28
- import { useLink } from '../routes/link';
29
- import SidebarNavigationItem from '../sidebar-navigation-item';
30
- import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
31
22
 
32
23
  const EMPTY_OBJECT = {};
33
24
 
34
- function TemplateAreaButton( { postId, icon, title } ) {
35
- const icons = {
36
- header,
37
- footer,
38
- };
39
- const linkInfo = useLink( {
40
- postType: TEMPLATE_PART_POST_TYPE,
41
- postId,
42
- } );
43
-
44
- return (
45
- <SidebarNavigationItem
46
- className="edit-site-sidebar-navigation-screen-template__template-area-button"
47
- { ...linkInfo }
48
- icon={ icons[ icon ] ?? layout }
49
- withChevron
50
- >
51
- <Truncate
52
- limit={ 20 }
53
- ellipsizeMode="tail"
54
- numberOfLines={ 1 }
55
- className="edit-site-sidebar-navigation-screen-template__template-area-label-text"
56
- >
57
- { decodeEntities( title ) }
58
- </Truncate>
59
- </SidebarNavigationItem>
60
- );
61
- }
62
-
63
25
  export default function HomeTemplateDetails() {
64
26
  const { editEntityRecord } = useDispatch( coreStore );
65
27
 
66
28
  const {
67
29
  allowCommentsOnNewPosts,
68
- templatePartAreas,
69
30
  postsPerPage,
70
31
  postsPageTitle,
71
32
  postsPageId,
72
- currentTemplateParts,
73
33
  } = useSelect( ( select ) => {
74
34
  const { getEntityRecord } = select( coreStore );
75
- const { getSettings, getCurrentTemplateTemplateParts } = unlock(
76
- select( editSiteStore )
77
- );
78
35
  const siteSettings = getEntityRecord( 'root', 'site' );
79
36
  const _postsPageRecord = siteSettings?.page_for_posts
80
37
  ? getEntityRecord(
@@ -90,8 +47,6 @@ export default function HomeTemplateDetails() {
90
47
  postsPageTitle: _postsPageRecord?.title?.rendered,
91
48
  postsPageId: _postsPageRecord?.id,
92
49
  postsPerPage: siteSettings?.posts_per_page,
93
- templatePartAreas: getSettings()?.defaultTemplatePartAreas,
94
- currentTemplateParts: getCurrentTemplateTemplateParts(),
95
50
  };
96
51
  }, [] );
97
52
 
@@ -111,36 +66,6 @@ export default function HomeTemplateDetails() {
111
66
  setPostsCountValue( postsPerPage );
112
67
  }, [ postsPageTitle, allowCommentsOnNewPosts, postsPerPage ] );
113
68
 
114
- /*
115
- * Merge data in currentTemplateParts with templatePartAreas,
116
- * which contains the template icon and fallback labels
117
- */
118
- const templateAreas = useMemo( () => {
119
- // Keep track of template part IDs that have already been added to the array.
120
- const templatePartIds = new Set();
121
- const filterOutDuplicateTemplateParts = ( currentTemplatePart ) => {
122
- // If the template part has already been added to the array, skip it.
123
- if ( templatePartIds.has( currentTemplatePart.templatePart.id ) ) {
124
- return;
125
- }
126
- // Add to the array of template part IDs.
127
- templatePartIds.add( currentTemplatePart.templatePart.id );
128
- return currentTemplatePart;
129
- };
130
-
131
- return currentTemplateParts.length && templatePartAreas
132
- ? currentTemplateParts
133
- .filter( filterOutDuplicateTemplateParts )
134
- .map( ( { templatePart, block } ) => ( {
135
- ...templatePartAreas?.find(
136
- ( { area } ) => area === templatePart?.area
137
- ),
138
- ...templatePart,
139
- clientId: block.clientId,
140
- } ) )
141
- : [];
142
- }, [ currentTemplateParts, templatePartAreas ] );
143
-
144
69
  const setAllowCommentsOnNewPosts = ( newValue ) => {
145
70
  setCommentsOnNewPostsValue( newValue );
146
71
  editEntityRecord( 'root', 'site', undefined, {
@@ -214,26 +139,6 @@ export default function HomeTemplateDetails() {
214
139
  />
215
140
  </SidebarNavigationScreenDetailsPanelRow>
216
141
  </SidebarNavigationScreenDetailsPanel>
217
- <SidebarNavigationScreenDetailsPanel
218
- title={ __( 'Areas' ) }
219
- spacing={ 3 }
220
- >
221
- <ItemGroup>
222
- { templateAreas.map(
223
- ( { clientId, label, icon, theme, slug, title } ) => (
224
- <SidebarNavigationScreenDetailsPanelRow
225
- key={ clientId }
226
- >
227
- <TemplateAreaButton
228
- postId={ `${ theme }//${ slug }` }
229
- title={ title?.rendered || label }
230
- icon={ icon }
231
- />
232
- </SidebarNavigationScreenDetailsPanelRow>
233
- )
234
- ) }
235
- </ItemGroup>
236
- </SidebarNavigationScreenDetailsPanel>
237
142
  </>
238
143
  );
239
144
  }
@@ -12,6 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
+ import TemplateAreas from './template-areas';
15
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
17
  import useEditedEntityRecord from '../use-edited-entity-record';
17
18
  import { unlock } from '../../lock-unlock';
@@ -45,8 +46,13 @@ function useTemplateDetails( postType, postId ) {
45
46
 
46
47
  const content =
47
48
  record?.slug === 'home' || record?.slug === 'index' ? (
48
- <HomeTemplateDetails />
49
- ) : null;
49
+ <>
50
+ <HomeTemplateDetails />
51
+ <TemplateAreas />
52
+ </>
53
+ ) : (
54
+ <TemplateAreas />
55
+ );
50
56
 
51
57
  const footer = record?.modified ? (
52
58
  <SidebarNavigationScreenDetailsFooter record={ record } />
@@ -0,0 +1,135 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useSelect } from '@wordpress/data';
6
+ import {
7
+ __experimentalTruncate as Truncate,
8
+ __experimentalItemGroup as ItemGroup,
9
+ } from '@wordpress/components';
10
+ import { store as editorStore } from '@wordpress/editor';
11
+ import { useMemo } from '@wordpress/element';
12
+ import { decodeEntities } from '@wordpress/html-entities';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import {
18
+ SidebarNavigationScreenDetailsPanel,
19
+ SidebarNavigationScreenDetailsPanelRow,
20
+ } from '../sidebar-navigation-screen-details-panel';
21
+ import { unlock } from '../../lock-unlock';
22
+ import { store as editSiteStore } from '../../store';
23
+ import { useLink } from '../routes/link';
24
+ import SidebarNavigationItem from '../sidebar-navigation-item';
25
+ import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
26
+
27
+ function TemplateAreaButton( { postId, area, title } ) {
28
+ const templatePartArea = useSelect(
29
+ ( select ) => {
30
+ const defaultAreas =
31
+ select(
32
+ editorStore
33
+ ).__experimentalGetDefaultTemplatePartAreas();
34
+
35
+ return defaultAreas.find(
36
+ ( defaultArea ) => defaultArea.area === area
37
+ );
38
+ },
39
+ [ area ]
40
+ );
41
+ const linkInfo = useLink( {
42
+ postType: TEMPLATE_PART_POST_TYPE,
43
+ postId,
44
+ } );
45
+
46
+ return (
47
+ <SidebarNavigationItem
48
+ className="edit-site-sidebar-navigation-screen-template__template-area-button"
49
+ { ...linkInfo }
50
+ icon={ templatePartArea?.icon }
51
+ withChevron
52
+ >
53
+ <Truncate
54
+ limit={ 20 }
55
+ ellipsizeMode="tail"
56
+ numberOfLines={ 1 }
57
+ className="edit-site-sidebar-navigation-screen-template__template-area-label-text"
58
+ >
59
+ { decodeEntities( title ) }
60
+ </Truncate>
61
+ </SidebarNavigationItem>
62
+ );
63
+ }
64
+
65
+ export default function TemplateAreas() {
66
+ const { templatePartAreas, currentTemplateParts } = useSelect(
67
+ ( select ) => {
68
+ const { getSettings, getCurrentTemplateTemplateParts } = unlock(
69
+ select( editSiteStore )
70
+ );
71
+ return {
72
+ templatePartAreas: getSettings()?.defaultTemplatePartAreas,
73
+ currentTemplateParts: getCurrentTemplateTemplateParts(),
74
+ };
75
+ },
76
+ []
77
+ );
78
+
79
+ /*
80
+ * Merge data in currentTemplateParts with templatePartAreas,
81
+ * which contains the template icon and fallback labels
82
+ */
83
+ const templateAreas = useMemo( () => {
84
+ // Keep track of template part IDs that have already been added to the array.
85
+ const templatePartIds = new Set();
86
+ const filterOutDuplicateTemplateParts = ( currentTemplatePart ) => {
87
+ // If the template part has already been added to the array, skip it.
88
+ if ( templatePartIds.has( currentTemplatePart.templatePart.id ) ) {
89
+ return;
90
+ }
91
+ // Add to the array of template part IDs.
92
+ templatePartIds.add( currentTemplatePart.templatePart.id );
93
+ return currentTemplatePart;
94
+ };
95
+
96
+ return currentTemplateParts.length && templatePartAreas
97
+ ? currentTemplateParts
98
+ .filter( filterOutDuplicateTemplateParts )
99
+ .map( ( { templatePart, block } ) => ( {
100
+ ...templatePartAreas?.find(
101
+ ( { area } ) => area === templatePart?.area
102
+ ),
103
+ ...templatePart,
104
+ clientId: block.clientId,
105
+ } ) )
106
+ : [];
107
+ }, [ currentTemplateParts, templatePartAreas ] );
108
+
109
+ if ( ! templateAreas.length ) {
110
+ return null;
111
+ }
112
+
113
+ return (
114
+ <SidebarNavigationScreenDetailsPanel
115
+ title={ __( 'Areas' ) }
116
+ spacing={ 3 }
117
+ >
118
+ <ItemGroup>
119
+ { templateAreas.map(
120
+ ( { clientId, label, area, theme, slug, title } ) => (
121
+ <SidebarNavigationScreenDetailsPanelRow
122
+ key={ clientId }
123
+ >
124
+ <TemplateAreaButton
125
+ postId={ `${ theme }//${ slug }` }
126
+ title={ title?.rendered || label }
127
+ area={ area }
128
+ />
129
+ </SidebarNavigationScreenDetailsPanelRow>
130
+ )
131
+ ) }
132
+ </ItemGroup>
133
+ </SidebarNavigationScreenDetailsPanel>
134
+ );
135
+ }