@wordpress/edit-site 5.24.1 → 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
@@ -2,15 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { CheckboxControl, Flex } from '@wordpress/components';
5
- /**
6
- * Internal dependencies
7
- */
8
- import { getFontFaceVariantName } from './utils';
9
5
 
10
6
  /**
11
7
  * Internal dependencies
12
8
  */
9
+ import { getFontFaceVariantName } from './utils';
13
10
  import FontFaceDemo from './font-demo';
11
+ import { kebabCase } from '../../../../../block-editor/src/utils/object';
14
12
 
15
13
  function CollectionFontVariant( {
16
14
  face,
@@ -27,18 +25,26 @@ function CollectionFontVariant( {
27
25
  };
28
26
 
29
27
  const displayName = font.name + ' ' + getFontFaceVariantName( face );
28
+ const checkboxId = kebabCase(
29
+ `${ font.slug }-${ getFontFaceVariantName( face ) }`
30
+ );
30
31
 
31
32
  return (
32
- <div className="font-library-modal__library-font-variant">
33
+ <label
34
+ className="font-library-modal__library-font-variant"
35
+ htmlFor={ checkboxId }
36
+ >
33
37
  <Flex justify="space-between" align="center" gap="1rem">
34
38
  <FontFaceDemo fontFace={ face } text={ displayName } />
35
39
  <CheckboxControl
36
40
  checked={ selected }
37
41
  onChange={ handleToggleActivation }
38
42
  __nextHasNoMarginBottom={ true }
43
+ id={ checkboxId }
44
+ label={ false }
39
45
  />
40
46
  </Flex>
41
- </div>
47
+ </label>
42
48
  );
43
49
  }
44
50
 
@@ -229,7 +229,7 @@ function FontLibraryProvider( { children } ) {
229
229
  // Uninstall the font (remove the font files from the server and the post from the database).
230
230
  const response = await fetchUninstallFonts( [ font ] );
231
231
  // Deactivate the font family (remove the font family from the global styles).
232
- if ( ! response.errors ) {
232
+ if ( 0 === response.errors.length ) {
233
233
  deactivateFontFamily( font );
234
234
  // Save the global styles to the database.
235
235
  await saveSpecifiedEntityEdits(
@@ -3,16 +3,14 @@
3
3
  */
4
4
  import { useContext } from '@wordpress/element';
5
5
  import { CheckboxControl, Flex } from '@wordpress/components';
6
- /**
7
- * Internal dependencies
8
- */
9
- import { getFontFaceVariantName } from './utils';
10
6
 
11
7
  /**
12
8
  * Internal dependencies
13
9
  */
10
+ import { getFontFaceVariantName } from './utils';
14
11
  import { FontLibraryContext } from './context';
15
12
  import FontFaceDemo from './font-demo';
13
+ import { kebabCase } from '../../../../../block-editor/src/utils/object';
16
14
 
17
15
  function LibraryFontVariant( { face, font } ) {
18
16
  const { isFontActivated, toggleActivateFont } =
@@ -36,18 +34,26 @@ function LibraryFontVariant( { face, font } ) {
36
34
  };
37
35
 
38
36
  const displayName = font.name + ' ' + getFontFaceVariantName( face );
37
+ const checkboxId = kebabCase(
38
+ `${ font.slug }-${ getFontFaceVariantName( face ) }`
39
+ );
39
40
 
40
41
  return (
41
- <div className="font-library-modal__library-font-variant">
42
+ <label
43
+ className="font-library-modal__library-font-variant"
44
+ htmlFor={ checkboxId }
45
+ >
42
46
  <Flex justify="space-between" align="center" gap="1rem">
43
47
  <FontFaceDemo fontFace={ face } text={ displayName } />
44
48
  <CheckboxControl
45
49
  checked={ isIstalled }
46
50
  onChange={ handleToggleActivation }
47
51
  __nextHasNoMarginBottom={ true }
52
+ id={ checkboxId }
53
+ label={ false }
48
54
  />
49
55
  </Flex>
50
- </div>
56
+ </label>
51
57
  );
52
58
  }
53
59
 
@@ -0,0 +1,171 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+
6
+ const globalStylesChangesCache = new Map();
7
+ const EMPTY_ARRAY = [];
8
+
9
+ const translationMap = {
10
+ caption: __( 'Caption' ),
11
+ link: __( 'Link' ),
12
+ button: __( 'Button' ),
13
+ heading: __( 'Heading' ),
14
+ 'settings.color': __( 'Color settings' ),
15
+ 'settings.typography': __( 'Typography settings' ),
16
+ 'styles.color': __( 'Colors' ),
17
+ 'styles.spacing': __( 'Spacing' ),
18
+ 'styles.typography': __( 'Typography' ),
19
+ };
20
+
21
+ const isObject = ( obj ) => obj !== null && typeof obj === 'object';
22
+
23
+ /**
24
+ * Get the translation for a given global styles key.
25
+ * @param {string} key A key representing a path to a global style property or setting.
26
+ * @param {Record<string,string>} blockNames A key/value pair object of block names and their rendered titles.
27
+ * @return {string|undefined} A translated key or undefined if no translation exists.
28
+ */
29
+ function getTranslation( key, blockNames ) {
30
+ if ( translationMap[ key ] ) {
31
+ return translationMap[ key ];
32
+ }
33
+
34
+ const keyArray = key.split( '.' );
35
+
36
+ if ( keyArray?.[ 0 ] === 'blocks' ) {
37
+ const blockName = blockNames[ keyArray[ 1 ] ];
38
+ return blockName
39
+ ? sprintf(
40
+ // translators: %s: block name.
41
+ __( '%s block' ),
42
+ blockName
43
+ )
44
+ : keyArray[ 1 ];
45
+ }
46
+
47
+ if ( keyArray?.[ 0 ] === 'elements' ) {
48
+ return sprintf(
49
+ // translators: %s: element name, e.g., heading button, link, caption.
50
+ __( '%s element' ),
51
+ translationMap[ keyArray[ 1 ] ]
52
+ );
53
+ }
54
+
55
+ return undefined;
56
+ }
57
+
58
+ /**
59
+ * A deep comparison of two objects, optimized for comparing global styles.
60
+ * @param {Object} changedObject The changed object to compare.
61
+ * @param {Object} originalObject The original object to compare against.
62
+ * @param {string} parentPath A key/value pair object of block names and their rendered titles.
63
+ * @return {string[]} An array of paths whose values have changed.
64
+ */
65
+ function deepCompare( changedObject, originalObject, parentPath = '' ) {
66
+ // We have two non-object values to compare.
67
+ if ( ! isObject( changedObject ) && ! isObject( originalObject ) ) {
68
+ /*
69
+ * Only return a path if the value has changed.
70
+ * And then only the path name up to 2 levels deep.
71
+ */
72
+ return changedObject !== originalObject
73
+ ? parentPath.split( '.' ).slice( 0, 2 ).join( '.' )
74
+ : undefined;
75
+ }
76
+
77
+ // Enable comparison when an object doesn't have a corresponding property to compare.
78
+ changedObject = isObject( changedObject ) ? changedObject : {};
79
+ originalObject = isObject( originalObject ) ? originalObject : {};
80
+
81
+ const allKeys = new Set( [
82
+ ...Object.keys( changedObject ),
83
+ ...Object.keys( originalObject ),
84
+ ] );
85
+
86
+ let diffs = [];
87
+ for ( const key of allKeys ) {
88
+ const path = parentPath ? parentPath + '.' + key : key;
89
+ const changedPath = deepCompare(
90
+ changedObject[ key ],
91
+ originalObject[ key ],
92
+ path
93
+ );
94
+ if ( changedPath ) {
95
+ diffs = diffs.concat( changedPath );
96
+ }
97
+ }
98
+ return diffs;
99
+ }
100
+
101
+ /**
102
+ * Get an array of translated summarized global styles changes.
103
+ * Results are cached using a Map() key of `JSON.stringify( { revision, previousRevision } )`.
104
+ *
105
+ * @param {Object} revision The changed object to compare.
106
+ * @param {Object} previousRevision The original object to compare against.
107
+ * @param {Record<string,string>} blockNames A key/value pair object of block names and their rendered titles.
108
+ * @return {string[]} An array of translated changes.
109
+ */
110
+ export default function getRevisionChanges(
111
+ revision,
112
+ previousRevision,
113
+ blockNames
114
+ ) {
115
+ const cacheKey = JSON.stringify( { revision, previousRevision } );
116
+
117
+ if ( globalStylesChangesCache.has( cacheKey ) ) {
118
+ return globalStylesChangesCache.get( cacheKey );
119
+ }
120
+
121
+ /*
122
+ * Compare the two revisions with normalized keys.
123
+ * The order of these keys determines the order in which
124
+ * they'll appear in the results.
125
+ */
126
+ const changedValueTree = deepCompare(
127
+ {
128
+ styles: {
129
+ color: revision?.styles?.color,
130
+ typography: revision?.styles?.typography,
131
+ spacing: revision?.styles?.spacing,
132
+ },
133
+ blocks: revision?.styles?.blocks,
134
+ elements: revision?.styles?.elements,
135
+ settings: revision?.settings,
136
+ },
137
+ {
138
+ styles: {
139
+ color: previousRevision?.styles?.color,
140
+ typography: previousRevision?.styles?.typography,
141
+ spacing: previousRevision?.styles?.spacing,
142
+ },
143
+ blocks: previousRevision?.styles?.blocks,
144
+ elements: previousRevision?.styles?.elements,
145
+ settings: previousRevision?.settings,
146
+ }
147
+ );
148
+
149
+ if ( ! changedValueTree.length ) {
150
+ globalStylesChangesCache.set( cacheKey, EMPTY_ARRAY );
151
+ return EMPTY_ARRAY;
152
+ }
153
+
154
+ // Remove duplicate results.
155
+ const result = [ ...new Set( changedValueTree ) ]
156
+ /*
157
+ * Translate the keys.
158
+ * Remove duplicate or empty translations.
159
+ */
160
+ .reduce( ( acc, curr ) => {
161
+ const translation = getTranslation( curr, blockNames );
162
+ if ( translation && ! acc.includes( translation ) ) {
163
+ acc.push( translation );
164
+ }
165
+ return acc;
166
+ }, [] );
167
+
168
+ globalStylesChangesCache.set( cacheKey, result );
169
+
170
+ return result;
171
+ }
@@ -7,7 +7,6 @@ import {
7
7
  __experimentalUseNavigator as useNavigator,
8
8
  __experimentalConfirmDialog as ConfirmDialog,
9
9
  Spinner,
10
- __experimentalSpacer as Spacer,
11
10
  } from '@wordpress/components';
12
11
  import { useSelect, useDispatch } from '@wordpress/data';
13
12
  import { store as coreStore } from '@wordpress/core-data';
@@ -135,7 +134,8 @@ function ScreenRevisions() {
135
134
  }
136
135
  }, [ shouldSelectFirstItem, firstRevision ] );
137
136
 
138
- // Only display load button if there is a revision to load and it is different from the current editor styles.
137
+ // Only display load button if there is a revision to load,
138
+ // and it is different from the current editor styles.
139
139
  const isLoadButtonEnabled =
140
140
  !! currentlySelectedRevisionId && ! selectedRevisionMatchesEditorStyles;
141
141
  const shouldShowRevisions = ! isLoading && revisions.length;
@@ -156,7 +156,7 @@ function ScreenRevisions() {
156
156
  { isLoading && (
157
157
  <Spinner className="edit-site-global-styles-screen-revisions__loading" />
158
158
  ) }
159
- { shouldShowRevisions ? (
159
+ { shouldShowRevisions && (
160
160
  <>
161
161
  <Revisions
162
162
  blocks={ blocks }
@@ -168,6 +168,7 @@ function ScreenRevisions() {
168
168
  onChange={ selectRevision }
169
169
  selectedRevisionId={ currentlySelectedRevisionId }
170
170
  userRevisions={ revisions }
171
+ canApplyRevision={ isLoadButtonEnabled }
171
172
  />
172
173
  { isLoadButtonEnabled && (
173
174
  <SidebarFixedBottom>
@@ -215,14 +216,6 @@ function ScreenRevisions() {
215
216
  </ConfirmDialog>
216
217
  ) }
217
218
  </>
218
- ) : (
219
- <Spacer marginX={ 4 } data-testid="global-styles-no-revisions">
220
- {
221
- // Adding an existing translation here in case these changes are shipped to WordPress 6.3.
222
- // Later we could update to something better, e.g., "There are currently no style revisions.".
223
- __( 'No results found.' )
224
- }
225
- </Spacer>
226
219
  ) }
227
220
  </>
228
221
  );
@@ -6,28 +6,69 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __, sprintf } from '@wordpress/i18n';
9
+ import { __, _n, sprintf } from '@wordpress/i18n';
10
10
  import { Button } from '@wordpress/components';
11
11
  import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
13
  import { useSelect } from '@wordpress/data';
14
+ import { useMemo } from '@wordpress/element';
15
+ import { getBlockTypes } from '@wordpress/blocks';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import getRevisionChanges from './get-revision-changes';
14
21
 
15
22
  const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;
23
+ const MAX_CHANGES = 7;
24
+
25
+ function ChangesSummary( { revision, previousRevision, blockNames } ) {
26
+ const changes = getRevisionChanges(
27
+ revision,
28
+ previousRevision,
29
+ blockNames
30
+ );
31
+ const changesLength = changes.length;
32
+
33
+ if ( ! changesLength ) {
34
+ return null;
35
+ }
36
+
37
+ // Truncate to `n` results if necessary.
38
+ if ( changesLength > MAX_CHANGES ) {
39
+ const deleteCount = changesLength - MAX_CHANGES;
40
+ const andMoreText = sprintf(
41
+ // translators: %d: number of global styles changes that are not displayed in the UI.
42
+ _n( '…and %d more change.', '…and %d more changes.', deleteCount ),
43
+ deleteCount
44
+ );
45
+ changes.splice( MAX_CHANGES, deleteCount, andMoreText );
46
+ }
47
+
48
+ return (
49
+ <span
50
+ data-testid="global-styles-revision-changes"
51
+ className="edit-site-global-styles-screen-revisions__changes"
52
+ >
53
+ { changes.join( ', ' ) }
54
+ </span>
55
+ );
56
+ }
16
57
 
17
58
  /**
18
59
  * Returns a button label for the revision.
19
60
  *
20
61
  * @param {string|number} id A revision object.
21
- * @param {boolean} isLatest Whether the revision is the most current.
22
62
  * @param {string} authorDisplayName Author name.
23
63
  * @param {string} formattedModifiedDate Revision modified date formatted.
64
+ * @param {boolean} areStylesEqual Whether the revision matches the current editor styles.
24
65
  * @return {string} Translated label.
25
66
  */
26
67
  function getRevisionLabel(
27
68
  id,
28
- isLatest,
29
69
  authorDisplayName,
30
- formattedModifiedDate
70
+ formattedModifiedDate,
71
+ areStylesEqual
31
72
  ) {
32
73
  if ( 'parent' === id ) {
33
74
  return __( 'Reset the styles to the theme defaults' );
@@ -35,21 +76,23 @@ function getRevisionLabel(
35
76
 
36
77
  if ( 'unsaved' === id ) {
37
78
  return sprintf(
38
- /* translators: %s author display name */
79
+ /* translators: %s: author display name */
39
80
  __( 'Unsaved changes by %s' ),
40
81
  authorDisplayName
41
82
  );
42
83
  }
43
84
 
44
- return isLatest
85
+ return areStylesEqual
45
86
  ? sprintf(
46
- /* translators: %1$s author display name, %2$s: revision creation date */
47
- __( 'Changes saved by %1$s on %2$s (current)' ),
87
+ // translators: %1$s: author display name, %2$s: revision creation date.
88
+ __(
89
+ 'Changes saved by %1$s on %2$s. This revision matches current editor styles.'
90
+ ),
48
91
  authorDisplayName,
49
92
  formattedModifiedDate
50
93
  )
51
94
  : sprintf(
52
- /* translators: %1$s author display name, %2$s: revision creation date */
95
+ // translators: %1$s: author display name, %2$s: revision creation date.
53
96
  __( 'Changes saved by %1$s on %2$s' ),
54
97
  authorDisplayName,
55
98
  formattedModifiedDate
@@ -67,7 +110,12 @@ function getRevisionLabel(
67
110
  * @param {props} Component props.
68
111
  * @return {JSX.Element} The modal component.
69
112
  */
70
- function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
113
+ function RevisionsButtons( {
114
+ userRevisions,
115
+ selectedRevisionId,
116
+ onChange,
117
+ canApplyRevision,
118
+ } ) {
71
119
  const { currentThemeName, currentUser } = useSelect( ( select ) => {
72
120
  const { getCurrentTheme, getCurrentUser } = select( coreStore );
73
121
  const currentTheme = getCurrentTheme();
@@ -77,8 +125,15 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
77
125
  currentUser: getCurrentUser(),
78
126
  };
79
127
  }, [] );
128
+ const blockNames = useMemo( () => {
129
+ const blockTypes = getBlockTypes();
130
+ return blockTypes.reduce( ( accumulator, { name, title } ) => {
131
+ accumulator[ name ] = title;
132
+ return accumulator;
133
+ }, {} );
134
+ }, [] );
80
135
  const dateNowInMs = getDate().getTime();
81
- const { date: dateFormat, datetimeAbbreviated } = getSettings().formats;
136
+ const { datetimeAbbreviated } = getSettings().formats;
82
137
 
83
138
  return (
84
139
  <ol
@@ -87,27 +142,29 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
87
142
  role="group"
88
143
  >
89
144
  { userRevisions.map( ( revision, index ) => {
90
- const { id, isLatest, author, modified } = revision;
145
+ const { id, author, modified } = revision;
91
146
  const isUnsaved = 'unsaved' === id;
92
147
  // Unsaved changes are created by the current user.
93
148
  const revisionAuthor = isUnsaved ? currentUser : author;
94
149
  const authorDisplayName = revisionAuthor?.name || __( 'User' );
95
150
  const authorAvatar = revisionAuthor?.avatar_urls?.[ '48' ];
151
+ const isFirstItem = index === 0;
96
152
  const isSelected = selectedRevisionId
97
153
  ? selectedRevisionId === id
98
- : index === 0;
154
+ : isFirstItem;
155
+ const areStylesEqual = ! canApplyRevision && isSelected;
99
156
  const isReset = 'parent' === id;
100
157
  const modifiedDate = getDate( modified );
101
158
  const displayDate =
102
159
  modified &&
103
160
  dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS
104
- ? dateI18n( dateFormat, modifiedDate )
161
+ ? dateI18n( datetimeAbbreviated, modifiedDate )
105
162
  : humanTimeDiff( modified );
106
163
  const revisionLabel = getRevisionLabel(
107
164
  id,
108
- isLatest,
109
165
  authorDisplayName,
110
- dateI18n( datetimeAbbreviated, modifiedDate )
166
+ dateI18n( datetimeAbbreviated, modifiedDate ),
167
+ areStylesEqual
111
168
  );
112
169
 
113
170
  return (
@@ -116,6 +173,7 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
116
173
  'edit-site-global-styles-screen-revisions__revision-item',
117
174
  {
118
175
  'is-selected': isSelected,
176
+ 'is-active': areStylesEqual,
119
177
  'is-reset': isReset,
120
178
  }
121
179
  ) }
@@ -127,7 +185,7 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
127
185
  onClick={ () => {
128
186
  onChange( revision );
129
187
  } }
130
- label={ revisionLabel }
188
+ aria-label={ revisionLabel }
131
189
  >
132
190
  { isReset ? (
133
191
  <span className="edit-site-global-styles-screen-revisions__description">
@@ -150,6 +208,17 @@ function RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {
150
208
  { displayDate }
151
209
  </time>
152
210
  ) }
211
+ { isSelected && (
212
+ <ChangesSummary
213
+ blockNames={ blockNames }
214
+ revision={ revision }
215
+ previousRevision={
216
+ index < userRevisions.length
217
+ ? userRevisions[ index + 1 ]
218
+ : {}
219
+ }
220
+ />
221
+ ) }
153
222
  <span className="edit-site-global-styles-screen-revisions__meta">
154
223
  <img
155
224
  alt={ authorDisplayName }
@@ -66,7 +66,7 @@
66
66
  width: 100%;
67
67
  height: auto;
68
68
  display: block;
69
- padding: $grid-unit-15 $grid-unit-15 $grid-unit-15 $grid-unit-30;
69
+ padding: $grid-unit-15 $grid-unit-15 $grid-unit-10 $grid-unit-30;
70
70
  &:focus,
71
71
  &:active {
72
72
  outline: 0;
@@ -103,6 +103,7 @@
103
103
  }
104
104
  }
105
105
 
106
+ .edit-site-global-styles-screen-revisions__changes,
106
107
  .edit-site-global-styles-screen-revisions__meta {
107
108
  color: $gray-600;
108
109
  display: flex;
@@ -110,7 +111,6 @@
110
111
  width: 100%;
111
112
  align-items: center;
112
113
  font-size: 12px;
113
-
114
114
  img {
115
115
  width: $grid-unit-20;
116
116
  height: $grid-unit-20;
@@ -122,3 +122,11 @@
122
122
  .edit-site-global-styles-screen-revisions__loading {
123
123
  margin: $grid-unit-30 auto !important;
124
124
  }
125
+
126
+ .edit-site-global-styles-screen-revisions__changes {
127
+ margin-bottom: $grid-unit-05;
128
+ text-align: left;
129
+ color: $gray-900;
130
+ line-height: $default-line-height;
131
+ }
132
+