@wordpress/edit-site 5.30.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/actions/index.js +2 -4
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/block-editor/editor-canvas.js +16 -3
  5. package/build/components/block-editor/editor-canvas.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +1 -1
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/global-styles/color-palette-panel.js +0 -9
  9. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/context.js +15 -8
  11. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
  13. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  15. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  17. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  19. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/utils/index.js +2 -2
  21. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  23. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  24. package/build/components/global-styles/header.js +1 -1
  25. package/build/components/global-styles/header.js.map +1 -1
  26. package/build/components/global-styles/hooks.js +50 -1
  27. package/build/components/global-styles/hooks.js.map +1 -1
  28. package/build/components/global-styles/preview-iframe.js +0 -1
  29. package/build/components/global-styles/preview-iframe.js.map +1 -1
  30. package/build/components/global-styles/preview-styles.js +2 -2
  31. package/build/components/global-styles/preview-styles.js.map +1 -1
  32. package/build/components/global-styles/screen-colors.js +2 -9
  33. package/build/components/global-styles/screen-colors.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +1 -6
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/global-styles/typography-elements.js +3 -1
  37. package/build/components/global-styles/typography-elements.js.map +1 -1
  38. package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  39. package/build/components/global-styles/typography-example.js.map +1 -0
  40. package/build/components/global-styles/typography-preview.js +3 -1
  41. package/build/components/global-styles/typography-preview.js.map +1 -1
  42. package/build/components/global-styles/utils.js +1 -1
  43. package/build/components/global-styles/utils.js.map +1 -1
  44. package/build/components/global-styles/variations/variations-color.js +8 -9
  45. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  46. package/build/components/global-styles/variations/variations-typography.js +27 -37
  47. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  48. package/build/components/header-edit-mode/index.js +2 -1
  49. package/build/components/header-edit-mode/index.js.map +1 -1
  50. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  51. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  52. package/build/components/keyboard-shortcuts/global.js +17 -3
  53. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  54. package/build/components/layout/router.js +2 -5
  55. package/build/components/layout/router.js.map +1 -1
  56. package/build/components/page-pages/index.js +6 -11
  57. package/build/components/page-pages/index.js.map +1 -1
  58. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  59. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  60. package/build/components/page-patterns/index.js +1 -4
  61. package/build/components/page-patterns/index.js.map +1 -1
  62. package/build/components/page-patterns/use-patterns.js +9 -9
  63. package/build/components/page-patterns/use-patterns.js.map +1 -1
  64. package/build/components/page-templates-template-parts/index.js +11 -16
  65. package/build/components/page-templates-template-parts/index.js.map +1 -1
  66. package/build/components/save-panel/index.js +14 -9
  67. package/build/components/save-panel/index.js.map +1 -1
  68. package/build/components/sidebar/index.js +2 -3
  69. package/build/components/sidebar/index.js.map +1 -1
  70. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  71. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  72. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  73. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  74. package/build/components/sidebar-dataviews/default-views.js +2 -2
  75. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  76. package/build/components/sidebar-dataviews/index.js +4 -3
  77. package/build/components/sidebar-dataviews/index.js.map +1 -1
  78. package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
  79. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  80. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  81. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  82. package/build/components/sidebar-edit-mode/sidebar-card/index.js +12 -6
  83. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  84. package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
  85. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
  87. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  88. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  89. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  90. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  91. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  92. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  94. package/build/components/sidebar-navigation-screen-template/index.js +5 -1
  95. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  96. package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  97. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  98. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  99. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  100. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  101. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  102. package/build/components/template-actions/index.js +44 -27
  103. package/build/components/template-actions/index.js.map +1 -1
  104. package/build/components/welcome-guide/editor.js +11 -2
  105. package/build/components/welcome-guide/editor.js.map +1 -1
  106. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  107. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  108. package/build/utils/constants.js +5 -3
  109. package/build/utils/constants.js.map +1 -1
  110. package/build/utils/get-is-list-page.js +1 -1
  111. package/build/utils/get-is-list-page.js.map +1 -1
  112. package/build/utils/math.js +98 -0
  113. package/build/utils/math.js.map +1 -0
  114. package/build-module/components/actions/index.js +3 -5
  115. package/build-module/components/actions/index.js.map +1 -1
  116. package/build-module/components/block-editor/editor-canvas.js +16 -3
  117. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  118. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  119. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  120. package/build-module/components/global-styles/color-palette-panel.js +0 -8
  121. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  122. package/build-module/components/global-styles/font-library-modal/context.js +16 -9
  123. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  124. package/build-module/components/global-styles/font-library-modal/font-collection.js +4 -3
  125. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  126. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  127. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  128. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  129. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  130. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  131. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  132. package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -2
  133. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  134. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  135. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  136. package/build-module/components/global-styles/header.js +1 -1
  137. package/build-module/components/global-styles/header.js.map +1 -1
  138. package/build-module/components/global-styles/hooks.js +48 -1
  139. package/build-module/components/global-styles/hooks.js.map +1 -1
  140. package/build-module/components/global-styles/preview-iframe.js +0 -1
  141. package/build-module/components/global-styles/preview-iframe.js.map +1 -1
  142. package/build-module/components/global-styles/preview-styles.js +2 -2
  143. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  144. package/build-module/components/global-styles/screen-colors.js +2 -9
  145. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  146. package/build-module/components/global-styles/screen-typography.js +1 -6
  147. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  148. package/build-module/components/global-styles/typography-elements.js +3 -1
  149. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  150. package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  151. package/build-module/components/global-styles/typography-example.js.map +1 -0
  152. package/build-module/components/global-styles/typography-preview.js +3 -1
  153. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  154. package/build-module/components/global-styles/utils.js +1 -1
  155. package/build-module/components/global-styles/utils.js.map +1 -1
  156. package/build-module/components/global-styles/variations/variations-color.js +8 -9
  157. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  158. package/build-module/components/global-styles/variations/variations-typography.js +28 -38
  159. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  160. package/build-module/components/header-edit-mode/index.js +2 -1
  161. package/build-module/components/header-edit-mode/index.js.map +1 -1
  162. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  163. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  164. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  165. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  166. package/build-module/components/layout/router.js +2 -5
  167. package/build-module/components/layout/router.js.map +1 -1
  168. package/build-module/components/page-pages/index.js +7 -12
  169. package/build-module/components/page-pages/index.js.map +1 -1
  170. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  171. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  172. package/build-module/components/page-patterns/index.js +2 -5
  173. package/build-module/components/page-patterns/index.js.map +1 -1
  174. package/build-module/components/page-patterns/use-patterns.js +9 -9
  175. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  176. package/build-module/components/page-templates-template-parts/index.js +12 -17
  177. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  178. package/build-module/components/save-panel/index.js +14 -9
  179. package/build-module/components/save-panel/index.js.map +1 -1
  180. package/build-module/components/sidebar/index.js +2 -3
  181. package/build-module/components/sidebar/index.js.map +1 -1
  182. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  183. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  184. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  185. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  186. package/build-module/components/sidebar-dataviews/default-views.js +3 -3
  187. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  188. package/build-module/components/sidebar-dataviews/index.js +4 -3
  189. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  190. package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
  191. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  192. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  193. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  194. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
  195. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  196. package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
  197. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  198. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
  199. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  201. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  202. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  203. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  205. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -1
  207. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  209. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  210. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  211. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  212. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  213. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  214. package/build-module/components/template-actions/index.js +44 -27
  215. package/build-module/components/template-actions/index.js.map +1 -1
  216. package/build-module/components/welcome-guide/editor.js +11 -2
  217. package/build-module/components/welcome-guide/editor.js.map +1 -1
  218. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  219. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  220. package/build-module/utils/constants.js +4 -2
  221. package/build-module/utils/constants.js.map +1 -1
  222. package/build-module/utils/get-is-list-page.js +1 -1
  223. package/build-module/utils/get-is-list-page.js.map +1 -1
  224. package/build-module/utils/math.js +92 -0
  225. package/build-module/utils/math.js.map +1 -0
  226. package/build-style/style-rtl.css +41 -37
  227. package/build-style/style.css +41 -37
  228. package/package.json +42 -42
  229. package/src/components/actions/index.js +3 -5
  230. package/src/components/block-editor/editor-canvas.js +20 -7
  231. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  232. package/src/components/global-styles/color-palette-panel.js +0 -11
  233. package/src/components/global-styles/font-library-modal/context.js +34 -17
  234. package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
  235. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  236. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  237. package/src/components/global-styles/font-library-modal/style.scss +14 -5
  238. package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
  239. package/src/components/global-styles/font-library-modal/utils/index.js +4 -4
  240. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
  241. package/src/components/global-styles/header.js +1 -1
  242. package/src/components/global-styles/hooks.js +68 -1
  243. package/src/components/global-styles/preview-iframe.js +0 -1
  244. package/src/components/global-styles/preview-styles.js +2 -2
  245. package/src/components/global-styles/screen-colors.js +2 -13
  246. package/src/components/global-styles/screen-typography.js +1 -12
  247. package/src/components/global-styles/style.scss +4 -1
  248. package/src/components/global-styles/typography-elements.js +5 -1
  249. package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
  250. package/src/components/global-styles/typography-preview.js +3 -1
  251. package/src/components/global-styles/utils.js +1 -1
  252. package/src/components/global-styles/variations/style.scss +0 -6
  253. package/src/components/global-styles/variations/variations-color.js +9 -5
  254. package/src/components/global-styles/variations/variations-typography.js +37 -59
  255. package/src/components/header-edit-mode/index.js +1 -0
  256. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  257. package/src/components/keyboard-shortcuts/global.js +16 -4
  258. package/src/components/layout/router.js +2 -7
  259. package/src/components/page-pages/index.js +8 -13
  260. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  261. package/src/components/page-patterns/index.js +2 -3
  262. package/src/components/page-patterns/use-patterns.js +17 -10
  263. package/src/components/page-templates-template-parts/index.js +14 -22
  264. package/src/components/save-panel/index.js +24 -17
  265. package/src/components/sidebar/index.js +2 -3
  266. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  267. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  268. package/src/components/sidebar-dataviews/default-views.js +11 -3
  269. package/src/components/sidebar-dataviews/index.js +4 -3
  270. package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
  271. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  272. package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
  273. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
  274. package/src/components/sidebar-edit-mode/template-panel/index.js +24 -5
  275. package/src/components/sidebar-navigation-screen/style.scss +10 -1
  276. package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
  277. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
  278. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  279. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  280. package/src/components/sidebar-navigation-screen-template/index.js +6 -1
  281. package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  282. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  283. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  284. package/src/components/template-actions/index.js +63 -46
  285. package/src/components/welcome-guide/editor.js +9 -6
  286. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
  287. package/src/style.scss +0 -1
  288. package/src/utils/constants.js +4 -2
  289. package/src/utils/get-is-list-page.js +1 -1
  290. package/src/utils/math.js +93 -0
  291. package/build/components/global-styles/preview-typography.js.map +0 -1
  292. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  293. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  294. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  295. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  296. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  297. package/build-module/components/global-styles/preview-typography.js.map +0 -1
  298. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  299. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  301. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  302. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  303. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  304. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  305. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
@@ -344,8 +344,9 @@ function FontCollection( { slug } ) {
344
344
  size="small"
345
345
  onClick={ () => {
346
346
  setSelectedFont( null );
347
+ setNotice( null );
347
348
  } }
348
- aria-label={ __( 'Navigate to the previous view' ) }
349
+ label={ __( 'Back' ) }
349
350
  />
350
351
  <Heading
351
352
  level={ 2 }
@@ -441,13 +442,13 @@ function FontCollection( { slug } ) {
441
442
  sprintf(
442
443
  // translators: %s: Total number of pages.
443
444
  _x(
444
- 'Page <CurrenPageControl /> of %s',
445
+ 'Page <CurrentPageControl /> of %s',
445
446
  'paging'
446
447
  ),
447
448
  totalPages
448
449
  ),
449
450
  {
450
- CurrenPageControl: (
451
+ CurrentPageControl: (
451
452
  <SelectControl
452
453
  aria-label={ __( 'Current page' ) }
453
454
  value={ page }
@@ -6,6 +6,7 @@ import {
6
6
  Button,
7
7
  Card,
8
8
  CardBody,
9
+ __experimentalHeading as Heading,
9
10
  __experimentalText as Text,
10
11
  __experimentalSpacer as Spacer,
11
12
  } from '@wordpress/components';
@@ -24,7 +25,9 @@ function GoogleFontsConfirmDialog() {
24
25
  <div className="font-library__google-fonts-confirm">
25
26
  <Card>
26
27
  <CardBody>
27
- <Text as="h3">{ __( 'Connect to Google Fonts' ) }</Text>
28
+ <Heading level={ 2 }>
29
+ { __( 'Connect to Google Fonts' ) }
30
+ </Heading>
28
31
  <Spacer margin={ 6 } />
29
32
  <Text as="p">
30
33
  { __(
@@ -38,7 +41,11 @@ function GoogleFontsConfirmDialog() {
38
41
  ) }
39
42
  </Text>
40
43
  <Spacer margin={ 6 } />
41
- <Button variant="primary" onClick={ handleConfirm }>
44
+ <Button
45
+ __next40pxDefaultSize
46
+ variant="primary"
47
+ onClick={ handleConfirm }
48
+ >
42
49
  { __( 'Allow access to Google Fonts' ) }
43
50
  </Button>
44
51
  </CardBody>
@@ -202,7 +202,7 @@ function InstalledFonts() {
202
202
  onClick={ () => {
203
203
  handleSetLibraryFontSelected( null );
204
204
  } }
205
- aria-label={ __( 'Navigate to the previous view' ) }
205
+ label={ __( 'Back' ) }
206
206
  />
207
207
  <Heading
208
208
  level={ 2 }
@@ -125,13 +125,22 @@ button.font-library-modal__upload-area {
125
125
  align-items: center;
126
126
  margin-top: $grid-unit-80;
127
127
 
128
- h3 {
129
- font-size: 1.4rem;
128
+ p {
129
+ line-height: $default-line-height;
130
+ }
131
+
132
+ h2 {
133
+ font-size: 1.2rem;
134
+ font-weight: 400;
130
135
  }
131
136
 
132
137
  .components-card {
133
- width: 50%;
134
- min-width: 350px;
135
- max-width: 400px;
138
+ padding: $grid-unit-20;
139
+ width: 400px;
140
+ }
141
+
142
+ .components-button {
143
+ width: 100%;
144
+ justify-content: center;
136
145
  }
137
146
  }
@@ -45,29 +45,48 @@ function UploadFonts() {
45
45
  * @param {Array} files The files to be filtered
46
46
  * @return {void}
47
47
  */
48
- const handleFilesUpload = ( files ) => {
48
+ const handleFilesUpload = async ( files ) => {
49
49
  setNotice( null );
50
50
  setIsUploading( true );
51
51
  const uniqueFilenames = new Set();
52
52
  const selectedFiles = [ ...files ];
53
- const allowedFiles = selectedFiles.filter( ( file ) => {
53
+ let hasInvalidFiles = false;
54
+
55
+ // Use map to create a promise for each file check, then filter with Promise.all.
56
+ const checkFilesPromises = selectedFiles.map( async ( file ) => {
57
+ const isFont = await isFontFile( file );
58
+ if ( ! isFont ) {
59
+ hasInvalidFiles = true;
60
+ return null; // Return null for invalid files.
61
+ }
62
+ // Check for duplicates
54
63
  if ( uniqueFilenames.has( file.name ) ) {
55
- return false; // Discard duplicates
64
+ return null; // Return null for duplicates.
56
65
  }
57
- // Eliminates files that are not allowed
66
+ // Check if the file extension is allowed.
58
67
  const fileExtension = file.name.split( '.' ).pop().toLowerCase();
59
68
  if ( ALLOWED_FILE_EXTENSIONS.includes( fileExtension ) ) {
60
69
  uniqueFilenames.add( file.name );
61
- return true; // Keep file if the extension is allowed
70
+ return file; // Return the file if it passes all checks.
62
71
  }
63
- return false; // Discard file extension not allowed
72
+ return null; // Return null for disallowed file extensions.
64
73
  } );
74
+
75
+ // Filter out the nulls after all promises have resolved.
76
+ const allowedFiles = ( await Promise.all( checkFilesPromises ) ).filter(
77
+ ( file ) => null !== file
78
+ );
79
+
65
80
  if ( allowedFiles.length > 0 ) {
66
81
  loadFiles( allowedFiles );
67
82
  } else {
83
+ const message = hasInvalidFiles
84
+ ? __( 'Sorry, you are not allowed to upload this file type.' )
85
+ : __( 'No fonts found to install.' );
86
+
68
87
  setNotice( {
69
88
  type: 'error',
70
- message: __( 'No fonts found to install.' ),
89
+ message,
71
90
  } );
72
91
  setIsUploading( false );
73
92
  }
@@ -94,6 +113,23 @@ function UploadFonts() {
94
113
  handleInstall( fontFacesLoaded );
95
114
  };
96
115
 
116
+ /**
117
+ * Checks if a file is a valid Font file.
118
+ *
119
+ * @param {File} file The file to be checked.
120
+ * @return {boolean} Whether the file is a valid font file.
121
+ */
122
+ async function isFontFile( file ) {
123
+ const font = new Font( 'Uploaded Font' );
124
+ try {
125
+ const buffer = await readFileAsArrayBuffer( file );
126
+ await font.fromDataBuffer( buffer, 'font' );
127
+ return true;
128
+ } catch ( error ) {
129
+ return false;
130
+ }
131
+ }
132
+
97
133
  // Create a function to read the file as array buffer
98
134
  async function readFileAsArrayBuffer( file ) {
99
135
  return new Promise( ( resolve, reject ) => {
@@ -154,6 +190,7 @@ function UploadFonts() {
154
190
  setNotice( {
155
191
  type: 'error',
156
192
  message: error.message,
193
+ errors: error?.installationErrors,
157
194
  } );
158
195
  }
159
196
 
@@ -167,9 +204,17 @@ function UploadFonts() {
167
204
  { notice && (
168
205
  <Notice
169
206
  status={ notice.type }
207
+ __unstableHTML
170
208
  onRemove={ () => setNotice( null ) }
171
209
  >
172
210
  { notice.message }
211
+ { notice.errors && (
212
+ <ul>
213
+ { notice.errors.map( ( error, index ) => (
214
+ <li key={ index }>{ error }</li>
215
+ ) ) }
216
+ </ul>
217
+ ) }
173
218
  </Notice>
174
219
  ) }
175
220
  { isUploading && (
@@ -199,7 +244,7 @@ function UploadFonts() {
199
244
  <Spacer margin={ 2 } />
200
245
  <Text className="font-library-modal__upload-area__text">
201
246
  { __(
202
- 'Uploaded fonts appear in your library and can be used in your theme. Supported formats: .tff, .otf, .woff, and .woff2.'
247
+ 'Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.'
203
248
  ) }
204
249
  </Text>
205
250
  </VStack>
@@ -134,9 +134,9 @@ export function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {
134
134
  const unloadFontFace = ( fonts ) => {
135
135
  fonts.forEach( ( f ) => {
136
136
  if (
137
- f.family === formatFontFaceName( fontFace.fontFamily ) &&
138
- f.weight === fontFace.fontWeight &&
139
- f.style === fontFace.fontStyle
137
+ f.family === formatFontFaceName( fontFace?.fontFamily ) &&
138
+ f.weight === fontFace?.fontWeight &&
139
+ f.style === fontFace?.fontStyle
140
140
  ) {
141
141
  fonts.delete( f );
142
142
  }
@@ -259,7 +259,7 @@ export async function batchInstallFontFaces( fontFamilyId, fontFacesData ) {
259
259
  // Handle network errors or other fetch-related errors
260
260
  results.errors.push( {
261
261
  data: fontFacesData[ index ],
262
- message: `Fetch error: ${ result.reason.message }`,
262
+ message: result.reason.message,
263
263
  } );
264
264
  }
265
265
  } );
@@ -87,6 +87,10 @@ export function formatFontFamily( input ) {
87
87
  * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans"
88
88
  */
89
89
  export function formatFontFaceName( input ) {
90
+ if ( ! input ) {
91
+ return '';
92
+ }
93
+
90
94
  let output = input.trim();
91
95
  if ( output.includes( ',' ) ) {
92
96
  output = output
@@ -26,7 +26,7 @@ function ScreenHeader( { title, description, onBack } ) {
26
26
  }
27
27
  icon={ isRTL() ? chevronRight : chevronLeft }
28
28
  size="small"
29
- aria-label={ __( 'Navigate to the previous view' ) }
29
+ label={ __( 'Back' ) }
30
30
  onClick={ onBack }
31
31
  />
32
32
  <Spacer>
@@ -9,14 +9,21 @@ import a11yPlugin from 'colord/plugins/a11y';
9
9
  */
10
10
  import { store as blocksStore } from '@wordpress/blocks';
11
11
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
12
+ import { useContext } from '@wordpress/element';
13
+ import { __ } from '@wordpress/i18n';
12
14
 
13
15
  /**
14
16
  * Internal dependencies
15
17
  */
18
+ import { mergeBaseAndUserConfigs } from './global-styles-provider';
19
+ import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
20
+ import { getFontFamilies } from './utils';
16
21
  import { unlock } from '../../lock-unlock';
17
22
  import { useSelect } from '@wordpress/data';
18
23
 
19
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
24
+ const { useGlobalSetting, useGlobalStyle, GlobalStylesContext } = unlock(
25
+ blockEditorPrivateApis
26
+ );
20
27
 
21
28
  // Enable colord's a11y plugin.
22
29
  extend( [ a11yPlugin ] );
@@ -92,3 +99,63 @@ export function useSupportedStyles( name, element ) {
92
99
 
93
100
  return supportedPanels;
94
101
  }
102
+
103
+ export function useColorVariations() {
104
+ const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
105
+ property: 'color',
106
+ } );
107
+ /*
108
+ * Filter out variations with no settings or styles.
109
+ */
110
+ return colorVariations?.length
111
+ ? colorVariations.filter( ( variation ) => {
112
+ const { settings, styles, title } = variation;
113
+ return (
114
+ title === __( 'Default' ) || // Always preseve the default variation.
115
+ Object.keys( settings ).length > 0 ||
116
+ Object.keys( styles ).length > 0
117
+ );
118
+ } )
119
+ : [];
120
+ }
121
+
122
+ export function useTypographyVariations() {
123
+ const typographyVariations =
124
+ useCurrentMergeThemeStyleVariationsWithUserConfig( {
125
+ property: 'typography',
126
+ } );
127
+
128
+ const { base } = useContext( GlobalStylesContext );
129
+ /*
130
+ * Filter duplicate variations based on whether the variaitons
131
+ * have different heading and body font families.
132
+ */
133
+ return typographyVariations?.length
134
+ ? Object.values(
135
+ typographyVariations.reduce( ( acc, variation ) => {
136
+ const [ bodyFontFamily, headingFontFamily ] =
137
+ getFontFamilies(
138
+ mergeBaseAndUserConfigs( base, variation )
139
+ );
140
+
141
+ // Always preseve the default variation.
142
+ if ( variation?.title === 'Default' ) {
143
+ acc[
144
+ `${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
145
+ ] = variation;
146
+ } else if (
147
+ headingFontFamily?.name &&
148
+ bodyFontFamily?.name &&
149
+ ! acc[
150
+ `${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
151
+ ]
152
+ ) {
153
+ acc[
154
+ `${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
155
+ ] = variation;
156
+ }
157
+ return acc;
158
+ }, {} )
159
+ )
160
+ : [];
161
+ }
@@ -118,7 +118,6 @@ export default function PreviewIframe( {
118
118
  <Iframe
119
119
  className="edit-site-global-styles-preview__iframe"
120
120
  style={ {
121
- width: '100%',
122
121
  height: normalizedHeight * ratio,
123
122
  } }
124
123
  onMouseEnter={ () => setIsHovered( true ) }
@@ -13,7 +13,7 @@ import {
13
13
  */
14
14
  import { unlock } from '../../lock-unlock';
15
15
  import { useStylesPreviewColors } from './hooks';
16
- import PreviewTypography from './preview-typography';
16
+ import TypographyExample from './typography-example';
17
17
  import HighlightedColors from './highlighted-colors';
18
18
  import PreviewIframe from './preview-iframe';
19
19
 
@@ -89,7 +89,7 @@ const PreviewStyles = ( { label, isFocused, withHoverView, variation } ) => {
89
89
  overflow: 'hidden',
90
90
  } }
91
91
  >
92
- <PreviewTypography
92
+ <TypographyExample
93
93
  fontSize={ 65 * ratio }
94
94
  variation={ variation }
95
95
  />
@@ -12,7 +12,6 @@ import ScreenHeader from './header';
12
12
  import Palette from './palette';
13
13
  import { unlock } from '../../lock-unlock';
14
14
  import ColorVariations from './variations/variations-color';
15
- import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
16
15
 
17
16
  const {
18
17
  useGlobalStyle,
@@ -31,12 +30,6 @@ function ScreenColors() {
31
30
  const [ rawSettings ] = useGlobalSetting( '' );
32
31
  const settings = useSettingsForBlockElement( rawSettings );
33
32
 
34
- const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
35
- property: 'color',
36
- filter: ( variation ) =>
37
- variation?.settings?.color &&
38
- Object.keys( variation?.settings?.color ).length,
39
- } );
40
33
  return (
41
34
  <>
42
35
  <ScreenHeader
@@ -46,13 +39,9 @@ function ScreenColors() {
46
39
  ) }
47
40
  />
48
41
  <div className="edit-site-global-styles-screen-colors">
49
- <VStack spacing={ 3 }>
50
- { !! colorVariations.length && (
51
- <ColorVariations variations={ colorVariations } />
52
- ) }
53
-
42
+ <VStack spacing={ 6 }>
43
+ <ColorVariations />
54
44
  <Palette />
55
-
56
45
  <StylesColorPanel
57
46
  inheritedValue={ inheritedStyle }
58
47
  value={ style }
@@ -13,7 +13,6 @@ import TypographyElements from './typography-elements';
13
13
  import TypographyVariations from './variations/variations-typography';
14
14
  import FontFamilies from './font-families';
15
15
  import ScreenHeader from './header';
16
- import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
17
16
 
18
17
  function ScreenTypography() {
19
18
  const fontLibraryEnabled = useSelect(
@@ -21,14 +20,6 @@ function ScreenTypography() {
21
20
  select( editorStore ).getEditorSettings().fontLibraryEnabled,
22
21
  []
23
22
  );
24
- const typographyVariations =
25
- useCurrentMergeThemeStyleVariationsWithUserConfig( {
26
- property: 'typography',
27
- filter: ( variation ) =>
28
- variation?.settings?.typography?.fontFamilies &&
29
- Object.keys( variation?.settings?.typography?.fontFamilies )
30
- .length,
31
- } );
32
23
 
33
24
  return (
34
25
  <>
@@ -40,9 +31,7 @@ function ScreenTypography() {
40
31
  />
41
32
  <div className="edit-site-global-styles-screen-typography">
42
33
  <VStack spacing={ 6 }>
43
- { !! typographyVariations.length && (
44
- <TypographyVariations />
45
- ) }
34
+ <TypographyVariations />
46
35
  { ! window.__experimentalDisableFontLibrary && (
47
36
  <VStack spacing={ 3 }>
48
37
  { fontLibraryEnabled && <FontFamilies /> }
@@ -7,8 +7,10 @@
7
7
  }
8
8
 
9
9
  .edit-site-global-styles-preview__iframe {
10
- max-width: 100%;
10
+ border-radius: $radius-block-ui;
11
11
  display: block;
12
+ max-width: 100%;
13
+ width: 100%;
12
14
  }
13
15
 
14
16
  .edit-site-typography-preview {
@@ -165,3 +167,4 @@
165
167
  .edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
166
168
  fill: currentColor;
167
169
  }
170
+
@@ -35,6 +35,7 @@ function ElementItem( { parentMenu, element, label } ) {
35
35
  prefix + 'typography.letterSpacing'
36
36
  );
37
37
  const [ backgroundColor ] = useGlobalStyle( prefix + 'color.background' );
38
+ const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
38
39
  const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient' );
39
40
  const [ color ] = useGlobalStyle( prefix + 'color.text' );
40
41
 
@@ -54,7 +55,10 @@ function ElementItem( { parentMenu, element, label } ) {
54
55
  className="edit-site-global-styles-screen-typography__indicator"
55
56
  style={ {
56
57
  fontFamily: fontFamily ?? 'serif',
57
- background: gradientValue ?? backgroundColor,
58
+ background:
59
+ gradientValue ??
60
+ backgroundColor ??
61
+ fallbackBackgroundColor,
58
62
  color,
59
63
  fontStyle,
60
64
  fontWeight,
@@ -37,7 +37,6 @@ export default function PreviewTypography( { fontSize, variation } ) {
37
37
 
38
38
  return (
39
39
  <motion.div
40
- className="edit-site-global-styles_preview-typography"
41
40
  animate={ {
42
41
  scale: 1,
43
42
  opacity: 1,
@@ -50,6 +49,9 @@ export default function PreviewTypography( { fontSize, variation } ) {
50
49
  delay: 0.3,
51
50
  type: 'tween',
52
51
  } }
52
+ style={ {
53
+ textAlign: 'center',
54
+ } }
53
55
  >
54
56
  <span style={ headingPreviewStyle }>
55
57
  { _x( 'A', 'Uppercase letter A' ) }
@@ -27,6 +27,7 @@ export default function TypographyPreview( { name, element, headingLevel } ) {
27
27
  prefix + 'color.background',
28
28
  name
29
29
  );
30
+ const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
30
31
  const [ color ] = useGlobalStyle( prefix + 'color.text', name );
31
32
  const [ fontSize ] = useGlobalStyle( prefix + 'typography.fontSize', name );
32
33
  const [ fontStyle ] = useGlobalStyle(
@@ -53,7 +54,8 @@ export default function TypographyPreview( { name, element, headingLevel } ) {
53
54
  className="edit-site-typography-preview"
54
55
  style={ {
55
56
  fontFamily: fontFamily ?? 'serif',
56
- background: gradientValue ?? backgroundColor,
57
+ background:
58
+ gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
57
59
  color,
58
60
  fontSize,
59
61
  fontStyle,
@@ -12,7 +12,7 @@ export function getVariationClassName( variation ) {
12
12
  }
13
13
 
14
14
  function getFontFamilyFromSetting( fontFamilies, setting ) {
15
- if ( ! setting ) {
15
+ if ( ! Array.isArray( fontFamilies ) || ! setting ) {
16
16
  return null;
17
17
  }
18
18
 
@@ -36,9 +36,3 @@
36
36
  outline-offset: 0;
37
37
  }
38
38
  }
39
-
40
- .edit-site-global-styles_preview-typography {
41
- font-size: 22px;
42
- line-height: 44px;
43
- text-align: center;
44
- }
@@ -5,21 +5,25 @@ import {
5
5
  __experimentalGrid as Grid,
6
6
  __experimentalVStack as VStack,
7
7
  } from '@wordpress/components';
8
- import { __ } from '@wordpress/i18n';
9
8
 
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
13
- import Subtitle from '../subtitle';
14
12
  import Variation from './variation';
15
13
  import StylesPreviewColors from '../preview-colors';
14
+ import { useColorVariations } from '../hooks';
15
+
16
+ export default function ColorVariations() {
17
+ const colorVariations = useColorVariations();
18
+
19
+ if ( ! colorVariations?.length ) {
20
+ return null;
21
+ }
16
22
 
17
- export default function ColorVariations( { variations } ) {
18
23
  return (
19
24
  <VStack spacing={ 3 }>
20
- <Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>
21
25
  <Grid columns={ 3 }>
22
- { variations.map( ( variation, index ) => (
26
+ { colorVariations.map( ( variation, index ) => (
23
27
  <Variation key={ index } variation={ variation }>
24
28
  { () => <StylesPreviewColors /> }
25
29
  </Variation>