@wordpress/edit-site 6.1.0 → 6.3.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 (290) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/build/components/add-new-pattern/index.js +31 -16
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/{add-new-page → add-new-post}/index.js +28 -16
  5. package/build/components/add-new-post/index.js.map +1 -0
  6. package/build/components/block-editor/use-site-editor-settings.js +5 -3
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/editor/index.js +32 -7
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +18 -7
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +0 -5
  13. package/build/components/global-styles/background-panel.js.map +1 -1
  14. package/build/components/global-styles/font-families.js +17 -17
  15. package/build/components/global-styles/font-families.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/context.js +2 -2
  17. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  21. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  22. package/build/components/global-styles/hooks.js +0 -40
  23. package/build/components/global-styles/hooks.js.map +1 -1
  24. package/build/components/global-styles/preview-typography.js +47 -0
  25. package/build/components/global-styles/preview-typography.js.map +1 -0
  26. package/build/components/global-styles/screen-block.js +14 -0
  27. package/build/components/global-styles/screen-block.js.map +1 -1
  28. package/build/components/global-styles/screen-layout.js +5 -1
  29. package/build/components/global-styles/screen-layout.js.map +1 -1
  30. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  31. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  32. package/build/components/global-styles/shadows-edit-panel.js +1 -2
  33. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  34. package/build/components/global-styles/style-variations-container.js +5 -5
  35. package/build/components/global-styles/style-variations-container.js.map +1 -1
  36. package/build/components/global-styles/typography-elements.js +0 -2
  37. package/build/components/global-styles/typography-elements.js.map +1 -1
  38. package/build/components/global-styles/variations/variation.js +28 -22
  39. package/build/components/global-styles/variations/variation.js.map +1 -1
  40. package/build/components/global-styles/variations/variations-color.js +5 -3
  41. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  42. package/build/components/global-styles/variations/variations-typography.js +14 -27
  43. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  44. package/build/components/global-styles-sidebar/index.js +2 -2
  45. package/build/components/global-styles-sidebar/index.js.map +1 -1
  46. package/build/components/layout/index.js +16 -8
  47. package/build/components/layout/index.js.map +1 -1
  48. package/build/components/layout/router.js +20 -41
  49. package/build/components/layout/router.js.map +1 -1
  50. package/build/components/page-patterns/index.js +51 -41
  51. package/build/components/page-patterns/index.js.map +1 -1
  52. package/build/components/page-patterns/rename-category-menu-item.js +3 -1
  53. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  54. package/build/components/page-patterns/search-items.js +29 -4
  55. package/build/components/page-patterns/search-items.js.map +1 -1
  56. package/build/components/page-patterns/use-patterns.js +22 -55
  57. package/build/components/page-patterns/use-patterns.js.map +1 -1
  58. package/build/components/page-templates/index.js +27 -21
  59. package/build/components/page-templates/index.js.map +1 -1
  60. package/build/components/pagination/index.js +4 -4
  61. package/build/components/pagination/index.js.map +1 -1
  62. package/build/components/posts-app/index.js +11 -17
  63. package/build/components/posts-app/index.js.map +1 -1
  64. package/build/components/{page-pages/index.js → posts-app/posts-list.js} +165 -38
  65. package/build/components/posts-app/posts-list.js.map +1 -0
  66. package/build/components/posts-app/router.js +85 -0
  67. package/build/components/posts-app/router.js.map +1 -0
  68. package/build/components/revisions/index.js +10 -7
  69. package/build/components/revisions/index.js.map +1 -1
  70. package/build/components/save-panel/index.js +1 -1
  71. package/build/components/save-panel/index.js.map +1 -1
  72. package/build/components/sidebar-dataviews/add-new-view.js +4 -1
  73. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  74. package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  75. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  76. package/build/components/sidebar-dataviews/default-views.js +98 -84
  77. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  78. package/build/components/sidebar-dataviews/index.js +4 -1
  79. package/build/components/sidebar-dataviews/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  81. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
  83. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  85. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  86. package/build/components/site-hub/index.js +81 -1
  87. package/build/components/site-hub/index.js.map +1 -1
  88. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  89. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  90. package/build/deprecated.js +11 -0
  91. package/build/deprecated.js.map +1 -1
  92. package/build/hooks/commands/use-set-command-context.js +11 -0
  93. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  94. package/build/hooks/push-changes-to-global-styles/index.js +1 -1
  95. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  96. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
  97. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  98. package/build/index.js +6 -0
  99. package/build/index.js.map +1 -1
  100. package/build/lock-unlock.js +1 -1
  101. package/build/lock-unlock.js.map +1 -1
  102. package/build/posts.js +57 -2
  103. package/build/posts.js.map +1 -1
  104. package/build/store/private-actions.js +7 -2
  105. package/build/store/private-actions.js.map +1 -1
  106. package/build-module/components/add-new-pattern/index.js +31 -16
  107. package/build-module/components/add-new-pattern/index.js.map +1 -1
  108. package/build-module/components/{add-new-page → add-new-post}/index.js +28 -16
  109. package/build-module/components/add-new-post/index.js.map +1 -0
  110. package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
  111. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  112. package/build-module/components/editor/index.js +33 -8
  113. package/build-module/components/editor/index.js.map +1 -1
  114. package/build-module/components/editor-canvas-container/index.js +19 -8
  115. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  116. package/build-module/components/global-styles/background-panel.js +0 -5
  117. package/build-module/components/global-styles/background-panel.js.map +1 -1
  118. package/build-module/components/global-styles/font-families.js +18 -18
  119. package/build-module/components/global-styles/font-families.js.map +1 -1
  120. package/build-module/components/global-styles/font-library-modal/context.js +2 -2
  121. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  122. package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
  123. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  124. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  125. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  126. package/build-module/components/global-styles/hooks.js +0 -38
  127. package/build-module/components/global-styles/hooks.js.map +1 -1
  128. package/build-module/components/global-styles/preview-typography.js +39 -0
  129. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  130. package/build-module/components/global-styles/screen-block.js +15 -0
  131. package/build-module/components/global-styles/screen-block.js.map +1 -1
  132. package/build-module/components/global-styles/screen-layout.js +5 -1
  133. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  134. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  135. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  136. package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
  137. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  138. package/build-module/components/global-styles/style-variations-container.js +6 -6
  139. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  140. package/build-module/components/global-styles/typography-elements.js +0 -2
  141. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  142. package/build-module/components/global-styles/variations/variation.js +29 -23
  143. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  144. package/build-module/components/global-styles/variations/variations-color.js +5 -3
  145. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  146. package/build-module/components/global-styles/variations/variations-typography.js +16 -28
  147. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  148. package/build-module/components/global-styles-sidebar/index.js +2 -2
  149. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  150. package/build-module/components/layout/index.js +14 -8
  151. package/build-module/components/layout/index.js.map +1 -1
  152. package/build-module/components/layout/router.js +20 -41
  153. package/build-module/components/layout/router.js.map +1 -1
  154. package/build-module/components/page-patterns/index.js +52 -42
  155. package/build-module/components/page-patterns/index.js.map +1 -1
  156. package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
  157. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  158. package/build-module/components/page-patterns/search-items.js +28 -4
  159. package/build-module/components/page-patterns/search-items.js.map +1 -1
  160. package/build-module/components/page-patterns/use-patterns.js +23 -56
  161. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  162. package/build-module/components/page-templates/index.js +27 -21
  163. package/build-module/components/page-templates/index.js.map +1 -1
  164. package/build-module/components/pagination/index.js +4 -4
  165. package/build-module/components/pagination/index.js.map +1 -1
  166. package/build-module/components/posts-app/index.js +11 -17
  167. package/build-module/components/posts-app/index.js.map +1 -1
  168. package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +164 -37
  169. package/build-module/components/posts-app/posts-list.js.map +1 -0
  170. package/build-module/components/posts-app/router.js +77 -0
  171. package/build-module/components/posts-app/router.js.map +1 -0
  172. package/build-module/components/revisions/index.js +10 -7
  173. package/build-module/components/revisions/index.js.map +1 -1
  174. package/build-module/components/save-panel/index.js +1 -1
  175. package/build-module/components/save-panel/index.js.map +1 -1
  176. package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
  177. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  178. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  179. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  180. package/build-module/components/sidebar-dataviews/default-views.js +97 -84
  181. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  182. package/build-module/components/sidebar-dataviews/index.js +5 -2
  183. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  185. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  186. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
  187. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  188. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  189. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  190. package/build-module/components/site-hub/index.js +81 -1
  191. package/build-module/components/site-hub/index.js.map +1 -1
  192. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  193. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  194. package/build-module/deprecated.js +11 -0
  195. package/build-module/deprecated.js.map +1 -1
  196. package/build-module/hooks/commands/use-set-command-context.js +11 -0
  197. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  198. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
  199. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  200. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
  201. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  202. package/build-module/index.js +7 -2
  203. package/build-module/index.js.map +1 -1
  204. package/build-module/lock-unlock.js +1 -1
  205. package/build-module/lock-unlock.js.map +1 -1
  206. package/build-module/posts.js +57 -2
  207. package/build-module/posts.js.map +1 -1
  208. package/build-module/store/private-actions.js +7 -2
  209. package/build-module/store/private-actions.js.map +1 -1
  210. package/build-style/posts-rtl.css +108 -28
  211. package/build-style/posts.css +108 -28
  212. package/build-style/style-rtl.css +127 -157
  213. package/build-style/style.css +127 -157
  214. package/lib/inflate.js +3188 -3937
  215. package/lib/lib-font.browser.js +32 -2
  216. package/lib/unbrotli.js +1818 -2458
  217. package/package.json +41 -41
  218. package/src/components/add-new-pattern/index.js +38 -23
  219. package/src/components/{add-new-page → add-new-post}/index.js +42 -18
  220. package/src/components/block-editor/style.scss +0 -11
  221. package/src/components/block-editor/use-site-editor-settings.js +33 -28
  222. package/src/components/editor/index.js +34 -20
  223. package/src/components/editor-canvas-container/index.js +20 -8
  224. package/src/components/global-styles/background-panel.js +0 -8
  225. package/src/components/global-styles/font-families.js +28 -19
  226. package/src/components/global-styles/font-library-modal/context.js +2 -2
  227. package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
  228. package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  229. package/src/components/global-styles/font-library-modal/style.scss +17 -10
  230. package/src/components/global-styles/hooks.js +0 -41
  231. package/src/components/global-styles/preview-typography.js +39 -0
  232. package/src/components/global-styles/screen-block.js +22 -0
  233. package/src/components/global-styles/screen-layout.js +5 -1
  234. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  235. package/src/components/global-styles/shadows-edit-panel.js +1 -2
  236. package/src/components/global-styles/style-variations-container.js +10 -7
  237. package/src/components/global-styles/style.scss +2 -1
  238. package/src/components/global-styles/typography-elements.js +0 -4
  239. package/src/components/global-styles/variations/variation.js +41 -26
  240. package/src/components/global-styles/variations/variations-color.js +6 -3
  241. package/src/components/global-styles/variations/variations-typography.js +16 -32
  242. package/src/components/global-styles-sidebar/index.js +2 -2
  243. package/src/components/layout/index.js +13 -4
  244. package/src/components/layout/router.js +20 -36
  245. package/src/components/layout/style.scss +12 -0
  246. package/src/components/page-patterns/index.js +55 -58
  247. package/src/components/page-patterns/rename-category-menu-item.js +2 -0
  248. package/src/components/page-patterns/search-items.js +37 -3
  249. package/src/components/page-patterns/style.scss +1 -8
  250. package/src/components/page-patterns/use-patterns.js +43 -82
  251. package/src/components/page-templates/index.js +26 -21
  252. package/src/components/page-templates/style.scss +1 -6
  253. package/src/components/pagination/index.js +4 -4
  254. package/src/components/posts-app/index.js +9 -11
  255. package/src/components/{page-pages/index.js → posts-app/posts-list.js} +163 -42
  256. package/src/components/posts-app/router.js +69 -0
  257. package/src/components/{page-pages → posts-app}/style.scss +22 -8
  258. package/src/components/revisions/index.js +9 -1
  259. package/src/components/save-panel/index.js +1 -1
  260. package/src/components/sidebar/style.scss +6 -0
  261. package/src/components/sidebar-dataviews/add-new-view.js +2 -1
  262. package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  263. package/src/components/sidebar-dataviews/default-views.js +119 -98
  264. package/src/components/sidebar-dataviews/index.js +3 -3
  265. package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
  266. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +8 -2
  267. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
  268. package/src/components/site-hub/index.js +84 -1
  269. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
  270. package/src/deprecated.js +14 -0
  271. package/src/hooks/commands/use-set-command-context.js +12 -0
  272. package/src/hooks/push-changes-to-global-styles/index.js +1 -1
  273. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
  274. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
  275. package/src/index.js +8 -1
  276. package/src/lock-unlock.js +1 -1
  277. package/src/posts.js +63 -2
  278. package/src/posts.scss +9 -0
  279. package/src/store/private-actions.js +7 -3
  280. package/src/style.scss +14 -2
  281. package/build/components/add-new-page/index.js.map +0 -1
  282. package/build/components/page-pages/index.js.map +0 -1
  283. package/build/components/table/index.js +0 -35
  284. package/build/components/table/index.js.map +0 -1
  285. package/build-module/components/add-new-page/index.js.map +0 -1
  286. package/build-module/components/page-pages/index.js.map +0 -1
  287. package/build-module/components/table/index.js +0 -30
  288. package/build-module/components/table/index.js.map +0 -1
  289. package/src/components/table/index.js +0 -33
  290. package/src/components/table/style.scss +0 -38
@@ -5,11 +5,9 @@ import { __ } from '@wordpress/i18n';
5
5
  import {
6
6
  __experimentalItemGroup as ItemGroup,
7
7
  __experimentalVStack as VStack,
8
- __experimentalHStack as HStack,
9
8
  Button,
10
9
  } from '@wordpress/components';
11
10
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
12
- import { settings } from '@wordpress/icons';
13
11
  import { useContext } from '@wordpress/element';
14
12
 
15
13
  /**
@@ -51,30 +49,41 @@ function FontFamilies() {
51
49
  ) }
52
50
 
53
51
  <VStack spacing={ 2 }>
54
- <HStack justify="space-between">
55
- <Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
56
- <Button
57
- onClick={ () => setModalTabOpen( 'installed-fonts' ) }
58
- label={ __( 'Manage fonts' ) }
59
- icon={ settings }
60
- size="small"
61
- />
62
- </HStack>
52
+ <Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
63
53
  { hasFonts ? (
64
- <ItemGroup isBordered isSeparated>
65
- { customFonts.map( ( font ) => (
66
- <FontFamilyItem key={ font.slug } font={ font } />
67
- ) ) }
68
- { themeFonts.map( ( font ) => (
69
- <FontFamilyItem key={ font.slug } font={ font } />
70
- ) ) }
71
- </ItemGroup>
54
+ <>
55
+ <ItemGroup isBordered isSeparated>
56
+ { customFonts.map( ( font ) => (
57
+ <FontFamilyItem
58
+ key={ font.slug }
59
+ font={ font }
60
+ />
61
+ ) ) }
62
+ { themeFonts.map( ( font ) => (
63
+ <FontFamilyItem
64
+ key={ font.slug }
65
+ font={ font }
66
+ />
67
+ ) ) }
68
+ </ItemGroup>
69
+ <Button
70
+ className="edit-site-global-styles-font-families__manage-fonts"
71
+ variant="secondary"
72
+ __next40pxDefaultSize
73
+ onClick={ () =>
74
+ setModalTabOpen( 'installed-fonts' )
75
+ }
76
+ >
77
+ { __( 'Manage fonts' ) }
78
+ </Button>
79
+ </>
72
80
  ) : (
73
81
  <>
74
82
  { __( 'No fonts installed.' ) }
75
83
  <Button
76
84
  className="edit-site-global-styles-font-families__add-fonts"
77
85
  variant="secondary"
86
+ __next40pxDefaultSize
78
87
  onClick={ () => setModalTabOpen( 'upload-fonts' ) }
79
88
  >
80
89
  { __( 'Add fonts' ) }
@@ -451,13 +451,13 @@ function FontLibraryProvider( { children } ) {
451
451
  );
452
452
 
453
453
  if ( isFaceActivated ) {
454
+ unloadFontFaceInBrowser( face, 'all' );
455
+ } else {
454
456
  loadFontFaceInBrowser(
455
457
  face,
456
458
  getDisplaySrcFromFontFace( face?.src ),
457
459
  'all'
458
460
  );
459
- } else {
460
- unloadFontFaceInBrowser( face, 'all' );
461
461
  }
462
462
  };
463
463
 
@@ -28,7 +28,7 @@ import {
28
28
  } from '@wordpress/components';
29
29
  import { debounce } from '@wordpress/compose';
30
30
  import { sprintf, __, _x } from '@wordpress/i18n';
31
- import { moreVertical, chevronLeft } from '@wordpress/icons';
31
+ import { moreVertical, chevronLeft, chevronRight } from '@wordpress/icons';
32
32
 
33
33
  /**
34
34
  * Internal dependencies
@@ -429,7 +429,7 @@ function FontCollection( { slug } ) {
429
429
  { selectedFont && (
430
430
  <Flex
431
431
  justify="flex-end"
432
- className="font-library-modal__tabpanel-layout__footer"
432
+ className="font-library-modal__footer"
433
433
  >
434
434
  <Button
435
435
  variant="primary"
@@ -438,7 +438,7 @@ function FontCollection( { slug } ) {
438
438
  disabled={
439
439
  fontsToInstall.length === 0 || isInstalling
440
440
  }
441
- __experimentalIsFocusable
441
+ accessibleWhenDisabled
442
442
  >
443
443
  { __( 'Install' ) }
444
444
  </Button>
@@ -446,32 +446,26 @@ function FontCollection( { slug } ) {
446
446
  ) }
447
447
 
448
448
  { ! selectedFont && (
449
- <Flex
449
+ <HStack
450
+ spacing={ 4 }
450
451
  justify="center"
451
- className="font-library-modal__tabpanel-layout__footer"
452
+ className="font-library-modal__footer"
452
453
  >
453
- <Button
454
- label={ __( 'First page' ) }
455
- size="compact"
456
- onClick={ () => setPage( 1 ) }
457
- disabled={ page === 1 }
458
- __experimentalIsFocusable
459
- >
460
- <span>«</span>
461
- </Button>
462
454
  <Button
463
455
  label={ __( 'Previous page' ) }
464
456
  size="compact"
465
457
  onClick={ () => setPage( page - 1 ) }
466
458
  disabled={ page === 1 }
467
- __experimentalIsFocusable
468
- >
469
- <span>‹</span>
470
- </Button>
459
+ showTooltip
460
+ accessibleWhenDisabled
461
+ icon={ chevronLeft }
462
+ tooltipPosition="top"
463
+ />
471
464
  <HStack
472
465
  justify="flex-start"
473
466
  expanded={ false }
474
467
  spacing={ 2 }
468
+ className="font-library-modal__page-selection"
475
469
  >
476
470
  { createInterpolateElement(
477
471
  sprintf(
@@ -514,20 +508,11 @@ function FontCollection( { slug } ) {
514
508
  size="compact"
515
509
  onClick={ () => setPage( page + 1 ) }
516
510
  disabled={ page === totalPages }
517
- __experimentalIsFocusable
518
- >
519
- <span>›</span>
520
- </Button>
521
- <Button
522
- label={ __( 'Last page' ) }
523
- size="compact"
524
- onClick={ () => setPage( totalPages ) }
525
- disabled={ page === totalPages }
526
- __experimentalIsFocusable
527
- >
528
- <span>»</span>
529
- </Button>
530
- </Flex>
511
+ accessibleWhenDisabled
512
+ icon={ chevronRight }
513
+ tooltipPosition="top"
514
+ />
515
+ </HStack>
531
516
  ) }
532
517
  </>
533
518
  ) }
@@ -311,7 +311,7 @@ function InstalledFonts() {
311
311
 
312
312
  <HStack
313
313
  justify="flex-end"
314
- className="font-library-modal__tabpanel-layout__footer"
314
+ className="font-library-modal__footer"
315
315
  >
316
316
  { isInstalling && <ProgressBar /> }
317
317
  { shouldDisplayDeleteButton && (
@@ -329,7 +329,7 @@ function InstalledFonts() {
329
329
  saveFontFamilies( fontFamilies );
330
330
  } }
331
331
  disabled={ ! fontFamiliesHasChanges }
332
- __experimentalIsFocusable
332
+ accessibleWhenDisabled
333
333
  >
334
334
  { __( 'Update' ) }
335
335
  </Button>
@@ -49,17 +49,24 @@ $footer-height: 70px;
49
49
  // It should be 120px (72px modal header height + 48px tab height)
50
50
  padding-top: $header-height + $grid-unit-15 + $grid-unit-60;
51
51
  }
52
+ }
52
53
 
53
- .font-library-modal__tabpanel-layout__footer {
54
- border-top: 1px solid $gray-300;
55
- margin: 0 #{$grid-unit-40 * -1} #{$grid-unit-40 * -1};
56
- padding: $grid-unit-20 $grid-unit-40;
57
- position: absolute;
58
- bottom: $grid-unit-40;
59
- width: 100%;
60
- height: $footer-height;
61
- background-color: $white;
62
- }
54
+ .font-library-modal__footer {
55
+ border-top: 1px solid $gray-300;
56
+ margin: 0 #{$grid-unit-40 * -1} #{$grid-unit-40 * -1};
57
+ padding: $grid-unit-20 $grid-unit-40;
58
+ position: absolute;
59
+ bottom: $grid-unit-40;
60
+ width: 100%;
61
+ height: $footer-height;
62
+ background-color: $white;
63
+ }
64
+
65
+ .font-library-modal__page-selection {
66
+ font-size: 11px;
67
+ text-transform: uppercase;
68
+ font-weight: 500;
69
+ color: $gray-900;
63
70
  }
64
71
 
65
72
  .font-library-modal__tabpanel-layout .components-base-control__field {
@@ -9,12 +9,10 @@ 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 { __ } from '@wordpress/i18n';
13
12
 
14
13
  /**
15
14
  * Internal dependencies
16
15
  */
17
- import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
18
16
  import { unlock } from '../../lock-unlock';
19
17
  import { useSelect } from '@wordpress/data';
20
18
 
@@ -111,42 +109,3 @@ export function useSupportedStyles( name, element ) {
111
109
 
112
110
  return supportedPanels;
113
111
  }
114
-
115
- export function useColorVariations() {
116
- const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
117
- property: 'color',
118
- } );
119
- /*
120
- * Filter out variations with no settings or styles.
121
- */
122
- return colorVariations?.length
123
- ? colorVariations.filter( ( variation ) => {
124
- const { settings, styles, title } = variation;
125
- return (
126
- title === __( 'Default' ) || // Always preseve the default variation.
127
- Object.keys( settings ).length > 0 ||
128
- Object.keys( styles ).length > 0
129
- );
130
- } )
131
- : [];
132
- }
133
-
134
- export function useTypographyVariations() {
135
- const typographyVariations =
136
- useCurrentMergeThemeStyleVariationsWithUserConfig( {
137
- property: 'typography',
138
- } );
139
- /*
140
- * Filter out variations with no settings or styles.
141
- */
142
- return typographyVariations?.length
143
- ? typographyVariations.filter( ( variation ) => {
144
- const { settings, styles, title } = variation;
145
- return (
146
- title === __( 'Default' ) || // Always preseve the default variation.
147
- Object.keys( settings ).length > 0 ||
148
- Object.keys( styles ).length > 0
149
- );
150
- } )
151
- : [];
152
- }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalHStack as HStack } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import TypographyExample from './typography-example';
10
+ import PreviewIframe from './preview-iframe';
11
+
12
+ const StylesPreviewTypography = ( { variation, isFocused, withHoverView } ) => {
13
+ return (
14
+ <PreviewIframe
15
+ label={ variation.title }
16
+ isFocused={ isFocused }
17
+ withHoverView={ withHoverView }
18
+ >
19
+ { ( { ratio, key } ) => (
20
+ <HStack
21
+ key={ key }
22
+ spacing={ 10 * ratio }
23
+ justify="center"
24
+ style={ {
25
+ height: '100%',
26
+ overflow: 'hidden',
27
+ } }
28
+ >
29
+ <TypographyExample
30
+ variation={ variation }
31
+ fontSize={ 85 * ratio }
32
+ />
33
+ </HStack>
34
+ ) }
35
+ </PreviewIframe>
36
+ );
37
+ };
38
+
39
+ export default StylesPreviewTypography;
@@ -25,6 +25,11 @@ import {
25
25
  VariationsPanel,
26
26
  } from './variations/variations-panel';
27
27
 
28
+ // Initial control values where no block style is set.
29
+ const BACKGROUND_BLOCK_DEFAULT_VALUES = {
30
+ backgroundSize: 'cover',
31
+ };
32
+
28
33
  function applyFallbackStyle( border ) {
29
34
  if ( ! border ) {
30
35
  return border;
@@ -70,6 +75,8 @@ const {
70
75
  useHasFiltersPanel,
71
76
  useHasImageSettingsPanel,
72
77
  useGlobalStyle,
78
+ useHasBackgroundPanel,
79
+ BackgroundPanel: StylesBackgroundPanel,
73
80
  BorderPanel: StylesBorderPanel,
74
81
  ColorPanel: StylesColorPanel,
75
82
  TypographyPanel: StylesTypographyPanel,
@@ -121,6 +128,7 @@ function ScreenBlock( { name, variation } ) {
121
128
  }
122
129
 
123
130
  const blockVariations = useBlockVariations( name );
131
+ const hasBackgroundPanel = useHasBackgroundPanel( settings );
124
132
  const hasTypographyPanel = useHasTypographyPanel( settings );
125
133
  const hasColorPanel = useHasColorPanel( settings );
126
134
  const hasBorderPanel = useHasBorderPanel( settings );
@@ -296,6 +304,20 @@ function ScreenBlock( { name, variation } ) {
296
304
  />
297
305
  ) }
298
306
 
307
+ { hasBackgroundPanel && (
308
+ <StylesBackgroundPanel
309
+ inheritedValue={ inheritedStyle }
310
+ value={ style }
311
+ onChange={ setStyle }
312
+ settings={ settings }
313
+ defaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }
314
+ defaultControls={
315
+ blockType?.supports?.background
316
+ ?.__experimentalDefaultControls
317
+ }
318
+ />
319
+ ) }
320
+
299
321
  { canEditCSS && (
300
322
  <PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>
301
323
  <p>
@@ -23,7 +23,11 @@ function ScreenLayout() {
23
23
  const [ rawSettings ] = useGlobalSetting( '' );
24
24
  const settings = useSettingsForBlockElement( rawSettings );
25
25
  const hasDimensionsPanel = useHasDimensionsPanel( settings );
26
- const hasBackgroundPanel = useHasBackgroundPanel( settings );
26
+ /*
27
+ * Use the raw settings to determine if the background panel should be displayed,
28
+ * as the background panel is not dependent on the block element settings.
29
+ */
30
+ const hasBackgroundPanel = useHasBackgroundPanel( rawSettings );
27
31
  return (
28
32
  <>
29
33
  <ScreenHeader title={ __( 'Layout' ) } />
@@ -163,7 +163,7 @@ function RevisionsButtons( {
163
163
  >
164
164
  <Button
165
165
  className="edit-site-global-styles-screen-revisions__revision-button"
166
- __experimentalIsFocusable
166
+ accessibleWhenDisabled
167
167
  disabled={ isSelected }
168
168
  onClick={ () => {
169
169
  onChange( revision );
@@ -371,8 +371,7 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
371
371
  'edit-site-global-styles__shadow-editor__remove-button',
372
372
  { 'is-open': isOpen }
373
373
  ),
374
- ariaLabel: __( 'Remove shadow' ),
375
- tooltip: __( 'Remove shadow' ),
374
+ label: __( 'Remove shadow' ),
376
375
  };
377
376
 
378
377
  return (
@@ -13,7 +13,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
13
13
  */
14
14
  import PreviewStyles from './preview-styles';
15
15
  import Variation from './variations/variation';
16
- import { isVariationWithSingleProperty } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
16
+ import { isVariationWithProperties } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
17
17
  import { unlock } from '../../lock-unlock';
18
18
 
19
19
  const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
@@ -33,11 +33,14 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
33
33
  ).__experimentalGetCurrentThemeGlobalStylesVariations();
34
34
  }, [] );
35
35
 
36
- // Filter out variations that are of single property type, i.e. color or typography variations.
37
- const multiplePropertyVariations = variations?.filter( ( variation ) => {
36
+ // Filter out variations that are color or typography variations.
37
+ const fullStyleVariations = variations?.filter( ( variation ) => {
38
38
  return (
39
- ! isVariationWithSingleProperty( variation, 'color' ) &&
40
- ! isVariationWithSingleProperty( variation, 'typography' )
39
+ ! isVariationWithProperties( variation, [ 'color' ] ) &&
40
+ ! isVariationWithProperties( variation, [
41
+ 'typography',
42
+ 'spacing',
43
+ ] )
41
44
  );
42
45
  } );
43
46
 
@@ -48,7 +51,7 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
48
51
  settings: {},
49
52
  styles: {},
50
53
  },
51
- ...( multiplePropertyVariations ?? [] ),
54
+ ...( fullStyleVariations ?? [] ),
52
55
  ];
53
56
  return [
54
57
  ...withEmptyVariation.map( ( variation ) => {
@@ -105,7 +108,7 @@ export default function StyleVariationsContainer( { gap = 2 } ) {
105
108
  };
106
109
  } ),
107
110
  ];
108
- }, [ multiplePropertyVariations, userStyles?.blocks, userStyles?.css ] );
111
+ }, [ fullStyleVariations, userStyles?.blocks, userStyles?.css ] );
109
112
 
110
113
  return (
111
114
  <Grid
@@ -41,7 +41,8 @@
41
41
  color: $gray-700;
42
42
  }
43
43
 
44
- .edit-site-global-styles-font-families__add-fonts {
44
+ .edit-site-global-styles-font-families__add-fonts,
45
+ .edit-site-global-styles-font-families__manage-fonts {
45
46
  justify-content: center;
46
47
  }
47
48
 
@@ -31,9 +31,6 @@ function ElementItem( { parentMenu, element, label } ) {
31
31
  const [ fontFamily ] = useGlobalStyle( prefix + 'typography.fontFamily' );
32
32
  const [ fontStyle ] = useGlobalStyle( prefix + 'typography.fontStyle' );
33
33
  const [ fontWeight ] = useGlobalStyle( prefix + 'typography.fontWeight' );
34
- const [ letterSpacing ] = useGlobalStyle(
35
- prefix + 'typography.letterSpacing'
36
- );
37
34
  const [ backgroundColor ] = useGlobalStyle( prefix + 'color.background' );
38
35
  const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
39
36
  const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient' );
@@ -62,7 +59,6 @@ function ElementItem( { parentMenu, element, label } ) {
62
59
  color,
63
60
  fontStyle,
64
61
  fontWeight,
65
- letterSpacing,
66
62
  ...extraStyles,
67
63
  } }
68
64
  >
@@ -6,6 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
+ import { Tooltip } from '@wordpress/components';
9
10
  import { useMemo, useContext, useState } from '@wordpress/element';
10
11
  import { ENTER } from '@wordpress/keycodes';
11
12
  import { __, sprintf } from '@wordpress/i18n';
@@ -15,7 +16,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
15
16
  /**
16
17
  * Internal dependencies
17
18
  */
18
- import { filterObjectByProperty } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
19
+ import { filterObjectByProperties } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
19
20
  import { unlock } from '../../../lock-unlock';
20
21
 
21
22
  const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
@@ -23,14 +24,20 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
23
24
  blockEditorPrivateApis
24
25
  );
25
26
 
26
- export default function Variation( { variation, children, isPill, property } ) {
27
+ export default function Variation( {
28
+ variation,
29
+ children,
30
+ isPill,
31
+ properties,
32
+ showTooltip,
33
+ } ) {
27
34
  const [ isFocused, setIsFocused ] = useState( false );
28
35
  const { base, user, setUserConfig } = useContext( GlobalStylesContext );
29
36
 
30
37
  const context = useMemo( () => {
31
38
  let merged = mergeBaseAndUserConfigs( base, variation );
32
- if ( property ) {
33
- merged = filterObjectByProperty( merged, property );
39
+ if ( properties ) {
40
+ merged = filterObjectByProperties( merged, properties );
34
41
  }
35
42
  return {
36
43
  user: variation,
@@ -38,7 +45,7 @@ export default function Variation( { variation, children, isPill, property } ) {
38
45
  merged,
39
46
  setUserConfig: () => {},
40
47
  };
41
- }, [ variation, base, property ] );
48
+ }, [ variation, base, properties ] );
42
49
 
43
50
  const selectVariation = () => setUserConfig( variation );
44
51
 
@@ -64,30 +71,38 @@ export default function Variation( { variation, children, isPill, property } ) {
64
71
  );
65
72
  }
66
73
 
67
- return (
68
- <GlobalStylesContext.Provider value={ context }>
74
+ const content = (
75
+ <div
76
+ className={ clsx( 'edit-site-global-styles-variations_item', {
77
+ 'is-active': isActive,
78
+ } ) }
79
+ role="button"
80
+ onClick={ selectVariation }
81
+ onKeyDown={ selectOnEnter }
82
+ tabIndex="0"
83
+ aria-label={ label }
84
+ aria-current={ isActive }
85
+ onFocus={ () => setIsFocused( true ) }
86
+ onBlur={ () => setIsFocused( false ) }
87
+ >
69
88
  <div
70
- className={ clsx( 'edit-site-global-styles-variations_item', {
71
- 'is-active': isActive,
72
- } ) }
73
- role="button"
74
- onClick={ selectVariation }
75
- onKeyDown={ selectOnEnter }
76
- tabIndex="0"
77
- aria-label={ label }
78
- aria-current={ isActive }
79
- onFocus={ () => setIsFocused( true ) }
80
- onBlur={ () => setIsFocused( false ) }
89
+ className={ clsx(
90
+ 'edit-site-global-styles-variations_item-preview',
91
+ { 'is-pill': isPill }
92
+ ) }
81
93
  >
82
- <div
83
- className={ clsx(
84
- 'edit-site-global-styles-variations_item-preview',
85
- { 'is-pill': isPill }
86
- ) }
87
- >
88
- { children( isFocused ) }
89
- </div>
94
+ { children( isFocused ) }
90
95
  </div>
96
+ </div>
97
+ );
98
+
99
+ return (
100
+ <GlobalStylesContext.Provider value={ context }>
101
+ { showTooltip ? (
102
+ <Tooltip text={ variation?.title }>{ content }</Tooltip>
103
+ ) : (
104
+ content
105
+ ) }
91
106
  </GlobalStylesContext.Provider>
92
107
  );
93
108
  }
@@ -10,12 +10,14 @@ import {
10
10
  * Internal dependencies
11
11
  */
12
12
  import StylesPreviewColors from '../preview-colors';
13
- import { useColorVariations } from '../hooks';
13
+ import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
14
14
  import Subtitle from '../subtitle';
15
15
  import Variation from './variation';
16
16
 
17
17
  export default function ColorVariations( { title, gap = 2 } ) {
18
- const colorVariations = useColorVariations();
18
+ const propertiesToFilter = [ 'color' ];
19
+ const colorVariations =
20
+ useCurrentMergeThemeStyleVariationsWithUserConfig( propertiesToFilter );
19
21
 
20
22
  // Return null if there is only one variation (the default).
21
23
  if ( colorVariations?.length <= 1 ) {
@@ -31,7 +33,8 @@ export default function ColorVariations( { title, gap = 2 } ) {
31
33
  key={ index }
32
34
  variation={ variation }
33
35
  isPill
34
- property="color"
36
+ properties={ propertiesToFilter }
37
+ showTooltip
35
38
  >
36
39
  { () => <StylesPreviewColors /> }
37
40
  </Variation>