@wordpress/edit-site 5.6.0 → 5.8.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 (279) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +3 -11
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +7 -7
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +1 -1
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/block-editor/editor-canvas.js +7 -10
  9. package/build/components/block-editor/editor-canvas.js.map +1 -1
  10. package/build/components/editor/index.js +6 -4
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/border-panel.js +35 -1
  13. package/build/components/global-styles/border-panel.js.map +1 -1
  14. package/build/components/global-styles/context-menu.js +8 -11
  15. package/build/components/global-styles/context-menu.js.map +1 -1
  16. package/build/components/global-styles/dimensions-panel.js +11 -1
  17. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  18. package/build/components/global-styles/effects-panel.js +53 -0
  19. package/build/components/global-styles/effects-panel.js.map +1 -0
  20. package/build/components/global-styles/filters-panel.js +45 -0
  21. package/build/components/global-styles/filters-panel.js.map +1 -0
  22. package/build/components/global-styles/global-styles-provider.js +7 -4
  23. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  24. package/build/components/global-styles/hooks.js +1 -58
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/preview.js +4 -5
  27. package/build/components/global-styles/preview.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +17 -12
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-colors.js +22 -211
  31. package/build/components/global-styles/screen-colors.js.map +1 -1
  32. package/build/components/global-styles/screen-css.js +1 -1
  33. package/build/components/global-styles/screen-css.js.map +1 -1
  34. package/build/components/global-styles/screen-effects.js +15 -7
  35. package/build/components/global-styles/screen-effects.js.map +1 -1
  36. package/build/components/global-styles/screen-filters.js +2 -2
  37. package/build/components/global-styles/screen-filters.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +8 -118
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/screen-typography-element.js +4 -0
  41. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  42. package/build/components/global-styles/screen-typography.js +5 -0
  43. package/build/components/global-styles/screen-typography.js.map +1 -1
  44. package/build/components/global-styles/style-variations-container.js +149 -0
  45. package/build/components/global-styles/style-variations-container.js.map +1 -0
  46. package/build/components/global-styles/ui.js +51 -37
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/global-styles-renderer/index.js +1 -2
  49. package/build/components/global-styles-renderer/index.js.map +1 -1
  50. package/build/components/header-edit-mode/more-menu/index.js +1 -1
  51. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  52. package/build/components/keyboard-shortcuts/index.js +0 -137
  53. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  54. package/build/components/layout/index.js +8 -1
  55. package/build/components/layout/index.js.map +1 -1
  56. package/build/components/preferences-modal/index.js +4 -0
  57. package/build/components/preferences-modal/index.js.map +1 -1
  58. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
  59. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  60. package/build/components/sidebar/index.js +4 -0
  61. package/build/components/sidebar/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen/index.js +8 -6
  63. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
  65. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  66. package/build/components/sidebar-navigation-screen-main/index.js +5 -0
  67. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  68. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
  69. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  70. package/build/components/site-hub/index.js +4 -3
  71. package/build/components/site-hub/index.js.map +1 -1
  72. package/build/components/start-template-options/index.js +44 -9
  73. package/build/components/start-template-options/index.js.map +1 -1
  74. package/build/components/style-book/index.js +6 -7
  75. package/build/components/style-book/index.js.map +1 -1
  76. package/build/components/welcome-guide/styles.js +1 -1
  77. package/build/components/welcome-guide/styles.js.map +1 -1
  78. package/build/hooks/commands/index.js +19 -0
  79. package/build/hooks/commands/index.js.map +1 -0
  80. package/build/hooks/commands/use-navigation-commands.js +117 -0
  81. package/build/hooks/commands/use-navigation-commands.js.map +1 -0
  82. package/build/hooks/commands/use-wp-admin-commands.js +94 -0
  83. package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
  84. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  85. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  86. package/build/hooks/template-part-edit.js +2 -1
  87. package/build/hooks/template-part-edit.js.map +1 -1
  88. package/build/index.js +2 -1
  89. package/build/index.js.map +1 -1
  90. package/build/store/selectors.js +2 -1
  91. package/build/store/selectors.js.map +1 -1
  92. package/build-module/components/add-new-template/new-template-part.js +3 -9
  93. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  94. package/build-module/components/add-new-template/new-template.js +7 -7
  95. package/build-module/components/add-new-template/new-template.js.map +1 -1
  96. package/build-module/components/add-new-template/utils.js +1 -1
  97. package/build-module/components/add-new-template/utils.js.map +1 -1
  98. package/build-module/components/block-editor/editor-canvas.js +8 -11
  99. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  100. package/build-module/components/editor/index.js +6 -4
  101. package/build-module/components/editor/index.js.map +1 -1
  102. package/build-module/components/global-styles/border-panel.js +34 -1
  103. package/build-module/components/global-styles/border-panel.js.map +1 -1
  104. package/build-module/components/global-styles/context-menu.js +8 -8
  105. package/build-module/components/global-styles/context-menu.js.map +1 -1
  106. package/build-module/components/global-styles/dimensions-panel.js +11 -1
  107. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  108. package/build-module/components/global-styles/effects-panel.js +43 -0
  109. package/build-module/components/global-styles/effects-panel.js.map +1 -0
  110. package/build-module/components/global-styles/filters-panel.js +35 -0
  111. package/build-module/components/global-styles/filters-panel.js.map +1 -0
  112. package/build-module/components/global-styles/global-styles-provider.js +8 -5
  113. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  114. package/build-module/components/global-styles/hooks.js +1 -52
  115. package/build-module/components/global-styles/hooks.js.map +1 -1
  116. package/build-module/components/global-styles/preview.js +4 -5
  117. package/build-module/components/global-styles/preview.js.map +1 -1
  118. package/build-module/components/global-styles/screen-block-list.js +16 -11
  119. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  120. package/build-module/components/global-styles/screen-colors.js +23 -208
  121. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  122. package/build-module/components/global-styles/screen-css.js +1 -1
  123. package/build-module/components/global-styles/screen-css.js.map +1 -1
  124. package/build-module/components/global-styles/screen-effects.js +13 -4
  125. package/build-module/components/global-styles/screen-effects.js.map +1 -1
  126. package/build-module/components/global-styles/screen-filters.js +2 -2
  127. package/build-module/components/global-styles/screen-filters.js.map +1 -1
  128. package/build-module/components/global-styles/screen-style-variations.js +11 -114
  129. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  130. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  131. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  132. package/build-module/components/global-styles/screen-typography.js +5 -0
  133. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  134. package/build-module/components/global-styles/style-variations-container.js +130 -0
  135. package/build-module/components/global-styles/style-variations-container.js.map +1 -0
  136. package/build-module/components/global-styles/ui.js +49 -33
  137. package/build-module/components/global-styles/ui.js.map +1 -1
  138. package/build-module/components/global-styles-renderer/index.js +1 -2
  139. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  140. package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
  141. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  142. package/build-module/components/keyboard-shortcuts/index.js +1 -135
  143. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  144. package/build-module/components/layout/index.js +6 -1
  145. package/build-module/components/layout/index.js.map +1 -1
  146. package/build-module/components/preferences-modal/index.js +4 -0
  147. package/build-module/components/preferences-modal/index.js.map +1 -1
  148. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
  149. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  150. package/build-module/components/sidebar/index.js +3 -0
  151. package/build-module/components/sidebar/index.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen/index.js +9 -7
  153. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  155. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  156. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
  157. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
  159. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  160. package/build-module/components/site-hub/index.js +3 -3
  161. package/build-module/components/site-hub/index.js.map +1 -1
  162. package/build-module/components/start-template-options/index.js +45 -10
  163. package/build-module/components/start-template-options/index.js.map +1 -1
  164. package/build-module/components/style-book/index.js +7 -8
  165. package/build-module/components/style-book/index.js.map +1 -1
  166. package/build-module/components/welcome-guide/styles.js +1 -1
  167. package/build-module/components/welcome-guide/styles.js.map +1 -1
  168. package/build-module/hooks/commands/index.js +10 -0
  169. package/build-module/hooks/commands/index.js.map +1 -0
  170. package/build-module/hooks/commands/use-navigation-commands.js +101 -0
  171. package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
  172. package/build-module/hooks/commands/use-wp-admin-commands.js +79 -0
  173. package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
  174. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  175. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  176. package/build-module/hooks/template-part-edit.js +2 -1
  177. package/build-module/hooks/template-part-edit.js.map +1 -1
  178. package/build-module/index.js +2 -1
  179. package/build-module/index.js.map +1 -1
  180. package/build-module/store/selectors.js +2 -1
  181. package/build-module/store/selectors.js.map +1 -1
  182. package/build-style/style-rtl.css +24 -63
  183. package/build-style/style.css +24 -63
  184. package/package.json +33 -31
  185. package/src/components/add-new-template/new-template-part.js +1 -6
  186. package/src/components/add-new-template/new-template.js +3 -6
  187. package/src/components/add-new-template/utils.js +1 -1
  188. package/src/components/block-editor/editor-canvas.js +13 -23
  189. package/src/components/editor/index.js +11 -3
  190. package/src/components/global-styles/border-panel.js +32 -1
  191. package/src/components/global-styles/context-menu.js +8 -8
  192. package/src/components/global-styles/dimensions-panel.js +11 -0
  193. package/src/components/global-styles/effects-panel.js +40 -0
  194. package/src/components/global-styles/filters-panel.js +33 -0
  195. package/src/components/global-styles/global-styles-provider.js +4 -4
  196. package/src/components/global-styles/hooks.js +1 -78
  197. package/src/components/global-styles/preview.js +2 -2
  198. package/src/components/global-styles/screen-block-list.js +11 -7
  199. package/src/components/global-styles/screen-colors.js +25 -229
  200. package/src/components/global-styles/screen-css.js +1 -1
  201. package/src/components/global-styles/screen-effects.js +12 -5
  202. package/src/components/global-styles/screen-filters.js +2 -2
  203. package/src/components/global-styles/screen-style-variations.js +10 -129
  204. package/src/components/global-styles/screen-typography-element.js +4 -0
  205. package/src/components/global-styles/screen-typography.js +6 -0
  206. package/src/components/global-styles/stories/index.js +425 -0
  207. package/src/components/global-styles/style-variations-container.js +136 -0
  208. package/src/components/global-styles/style.scss +4 -57
  209. package/src/components/global-styles/ui.js +50 -33
  210. package/src/components/global-styles-renderer/index.js +1 -2
  211. package/src/components/header-edit-mode/more-menu/index.js +1 -1
  212. package/src/components/keyboard-shortcuts/index.js +1 -155
  213. package/src/components/layout/index.js +4 -0
  214. package/src/components/preferences-modal/index.js +7 -0
  215. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
  216. package/src/components/sidebar/index.js +4 -0
  217. package/src/components/sidebar-navigation-screen/index.js +10 -5
  218. package/src/components/sidebar-navigation-screen/style.scss +20 -5
  219. package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  220. package/src/components/sidebar-navigation-screen-main/index.js +9 -1
  221. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
  222. package/src/components/site-hub/index.js +3 -3
  223. package/src/components/start-template-options/index.js +40 -8
  224. package/src/components/start-template-options/style.scss +7 -14
  225. package/src/components/style-book/index.js +10 -16
  226. package/src/components/style-book/style.scss +1 -1
  227. package/src/components/welcome-guide/styles.js +1 -1
  228. package/src/hooks/commands/index.js +10 -0
  229. package/src/hooks/commands/use-navigation-commands.js +103 -0
  230. package/src/hooks/commands/use-wp-admin-commands.js +77 -0
  231. package/src/hooks/push-changes-to-global-styles/index.js +1 -0
  232. package/src/hooks/template-part-edit.js +1 -0
  233. package/src/index.js +1 -0
  234. package/src/store/selectors.js +2 -1
  235. package/build/components/global-styles/color-utils.js +0 -17
  236. package/build/components/global-styles/color-utils.js.map +0 -1
  237. package/build/components/global-styles/duotone-panel.js +0 -78
  238. package/build/components/global-styles/duotone-panel.js.map +0 -1
  239. package/build/components/global-styles/filter-utils.js +0 -17
  240. package/build/components/global-styles/filter-utils.js.map +0 -1
  241. package/build/components/global-styles/screen-background-color.js +0 -114
  242. package/build/components/global-styles/screen-background-color.js.map +0 -1
  243. package/build/components/global-styles/screen-button-color.js +0 -88
  244. package/build/components/global-styles/screen-button-color.js.map +0 -1
  245. package/build/components/global-styles/screen-heading-color.js +0 -165
  246. package/build/components/global-styles/screen-heading-color.js.map +0 -1
  247. package/build/components/global-styles/screen-link-color.js +0 -105
  248. package/build/components/global-styles/screen-link-color.js.map +0 -1
  249. package/build/components/global-styles/screen-text-color.js +0 -71
  250. package/build/components/global-styles/screen-text-color.js.map +0 -1
  251. package/build/components/global-styles/shadow-panel.js +0 -197
  252. package/build/components/global-styles/shadow-panel.js.map +0 -1
  253. package/build-module/components/global-styles/color-utils.js +0 -9
  254. package/build-module/components/global-styles/color-utils.js.map +0 -1
  255. package/build-module/components/global-styles/duotone-panel.js +0 -67
  256. package/build-module/components/global-styles/duotone-panel.js.map +0 -1
  257. package/build-module/components/global-styles/filter-utils.js +0 -9
  258. package/build-module/components/global-styles/filter-utils.js.map +0 -1
  259. package/build-module/components/global-styles/screen-background-color.js +0 -97
  260. package/build-module/components/global-styles/screen-background-color.js.map +0 -1
  261. package/build-module/components/global-styles/screen-button-color.js +0 -73
  262. package/build-module/components/global-styles/screen-button-color.js.map +0 -1
  263. package/build-module/components/global-styles/screen-heading-color.js +0 -149
  264. package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
  265. package/build-module/components/global-styles/screen-link-color.js +0 -89
  266. package/build-module/components/global-styles/screen-link-color.js.map +0 -1
  267. package/build-module/components/global-styles/screen-text-color.js +0 -56
  268. package/build-module/components/global-styles/screen-text-color.js.map +0 -1
  269. package/build-module/components/global-styles/shadow-panel.js +0 -178
  270. package/build-module/components/global-styles/shadow-panel.js.map +0 -1
  271. package/src/components/global-styles/color-utils.js +0 -14
  272. package/src/components/global-styles/duotone-panel.js +0 -82
  273. package/src/components/global-styles/filter-utils.js +0 -9
  274. package/src/components/global-styles/screen-background-color.js +0 -132
  275. package/src/components/global-styles/screen-button-color.js +0 -104
  276. package/src/components/global-styles/screen-heading-color.js +0 -206
  277. package/src/components/global-styles/screen-link-color.js +0 -124
  278. package/src/components/global-styles/screen-text-color.js +0 -62
  279. package/src/components/global-styles/shadow-panel.js +0 -178
@@ -1,9 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { useSupportedStyles } from './hooks';
5
-
6
- export function useHasFilterPanel( name ) {
7
- const supports = useSupportedStyles( name );
8
- return supports.includes( 'filter' );
9
- }
@@ -1,132 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { __ } from '@wordpress/i18n';
10
- import {
11
- __experimentalColorGradientControl as ColorGradientControl,
12
- privateApis as blockEditorPrivateApis,
13
- } from '@wordpress/block-editor';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import ScreenHeader from './header';
19
- import {
20
- useSupportedStyles,
21
- useColorsPerOrigin,
22
- useGradientsPerOrigin,
23
- } from './hooks';
24
- import { unlock } from '../../private-apis';
25
-
26
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
27
-
28
- function ScreenBackgroundColor( { name, variation = '' } ) {
29
- const prefix = variation ? `variations.${ variation }.` : '';
30
- const supports = useSupportedStyles( name );
31
- const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
32
- const [ areCustomGradientsEnabled ] = useGlobalSetting(
33
- 'color.customGradient',
34
- name
35
- );
36
- const colorsPerOrigin = useColorsPerOrigin( name );
37
- const gradientsPerOrigin = useGradientsPerOrigin( name );
38
-
39
- const [ isBackgroundEnabled ] = useGlobalSetting(
40
- 'color.background',
41
- name
42
- );
43
-
44
- const hasBackgroundColor =
45
- supports.includes( 'backgroundColor' ) &&
46
- isBackgroundEnabled &&
47
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
48
- const hasGradientColor =
49
- supports.includes( 'background' ) &&
50
- ( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
51
- const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
52
- prefix + 'color.background',
53
- name
54
- );
55
- const [ userBackgroundColor ] = useGlobalStyle(
56
- prefix + 'color.background',
57
- name,
58
- 'user'
59
- );
60
- const [ gradient, setGradient ] = useGlobalStyle(
61
- prefix + 'color.gradient',
62
- name
63
- );
64
- const [ userGradient ] = useGlobalStyle(
65
- prefix + 'color.gradient',
66
- name,
67
- 'user'
68
- );
69
-
70
- if ( ! hasBackgroundColor && ! hasGradientColor ) {
71
- return null;
72
- }
73
-
74
- let backgroundSettings = {};
75
- if ( hasBackgroundColor ) {
76
- backgroundSettings = {
77
- colorValue: backgroundColor,
78
- onColorChange: setBackgroundColor,
79
- };
80
- if ( backgroundColor ) {
81
- backgroundSettings.clearable =
82
- backgroundColor === userBackgroundColor;
83
- }
84
- }
85
-
86
- let gradientSettings = {};
87
- if ( hasGradientColor ) {
88
- gradientSettings = {
89
- gradientValue: gradient,
90
- onGradientChange: setGradient,
91
- };
92
- if ( gradient ) {
93
- gradientSettings.clearable = gradient === userGradient;
94
- }
95
- }
96
-
97
- const controlProps = {
98
- ...backgroundSettings,
99
- ...gradientSettings,
100
- };
101
-
102
- return (
103
- <>
104
- <ScreenHeader
105
- title={ __( 'Background' ) }
106
- description={ __(
107
- 'Set a background color or gradient for the whole site.'
108
- ) }
109
- />
110
- <ColorGradientControl
111
- className={ classnames(
112
- 'edit-site-screen-background-color__control',
113
- {
114
- 'has-no-tabs':
115
- ! hasBackgroundColor || ! hasGradientColor,
116
- }
117
- ) }
118
- colors={ colorsPerOrigin }
119
- gradients={ gradientsPerOrigin }
120
- disableCustomColors={ ! areCustomSolidsEnabled }
121
- disableCustomGradients={ ! areCustomGradientsEnabled }
122
- showTitle={ false }
123
- enableAlpha
124
- __experimentalIsRenderedInSidebar
125
- headingLevel={ 3 }
126
- { ...controlProps }
127
- />
128
- </>
129
- );
130
- }
131
-
132
- export default ScreenBackgroundColor;
@@ -1,104 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import {
6
- __experimentalColorGradientControl as ColorGradientControl,
7
- privateApis as blockEditorPrivateApis,
8
- } from '@wordpress/block-editor';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import ScreenHeader from './header';
14
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
15
- import { unlock } from '../../private-apis';
16
-
17
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
18
-
19
- function ScreenButtonColor( { name, variation = '' } ) {
20
- const prefix = variation ? `variations.${ variation }.` : '';
21
- const supports = useSupportedStyles( name );
22
- const colorsPerOrigin = useColorsPerOrigin( name );
23
- const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
24
- const [ isBackgroundEnabled ] = useGlobalSetting(
25
- 'color.background',
26
- name
27
- );
28
-
29
- const hasButtonColor =
30
- supports.includes( 'buttonColor' ) &&
31
- isBackgroundEnabled &&
32
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
33
-
34
- const [ buttonTextColor, setButtonTextColor ] = useGlobalStyle(
35
- prefix + 'elements.button.color.text',
36
- name
37
- );
38
- const [ userButtonTextColor ] = useGlobalStyle(
39
- 'elements.button.color.text',
40
- name,
41
- 'user'
42
- );
43
-
44
- const [ buttonBgColor, setButtonBgColor ] = useGlobalStyle(
45
- 'elements.button.color.background',
46
- name
47
- );
48
- const [ userButtonBgColor ] = useGlobalStyle(
49
- 'elements.button.color.background',
50
- name,
51
- 'user'
52
- );
53
-
54
- if ( ! hasButtonColor ) {
55
- return null;
56
- }
57
-
58
- return (
59
- <>
60
- <ScreenHeader
61
- title={ __( 'Buttons' ) }
62
- description={ __(
63
- 'Set the default colors used for buttons across the site.'
64
- ) }
65
- />
66
-
67
- <h3 className="edit-site-global-styles-section-title">
68
- { __( 'Text color' ) }
69
- </h3>
70
-
71
- <ColorGradientControl
72
- className="edit-site-screen-button-color__control"
73
- colors={ colorsPerOrigin }
74
- disableCustomColors={ ! areCustomSolidsEnabled }
75
- showTitle={ false }
76
- enableAlpha
77
- __experimentalIsRenderedInSidebar
78
- colorValue={ buttonTextColor }
79
- onColorChange={ setButtonTextColor }
80
- clearable={ buttonTextColor === userButtonTextColor }
81
- headingLevel={ 4 }
82
- />
83
-
84
- <h3 className="edit-site-global-styles-section-title">
85
- { __( 'Background color' ) }
86
- </h3>
87
-
88
- <ColorGradientControl
89
- className="edit-site-screen-button-color__control"
90
- colors={ colorsPerOrigin }
91
- disableCustomColors={ ! areCustomSolidsEnabled }
92
- showTitle={ false }
93
- enableAlpha
94
- __experimentalIsRenderedInSidebar
95
- colorValue={ buttonBgColor }
96
- onColorChange={ setButtonBgColor }
97
- clearable={ buttonBgColor === userButtonBgColor }
98
- headingLevel={ 4 }
99
- />
100
- </>
101
- );
102
- }
103
-
104
- export default ScreenButtonColor;
@@ -1,206 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { sprintf, __ } from '@wordpress/i18n';
5
- import {
6
- __experimentalToggleGroupControl as ToggleGroupControl,
7
- __experimentalToggleGroupControlOption as ToggleGroupControlOption,
8
- } from '@wordpress/components';
9
- import {
10
- __experimentalColorGradientControl as ColorGradientControl,
11
- privateApis as blockEditorPrivateApis,
12
- } from '@wordpress/block-editor';
13
- import { useState } from '@wordpress/element';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import ScreenHeader from './header';
19
- import {
20
- useSupportedStyles,
21
- useColorsPerOrigin,
22
- useGradientsPerOrigin,
23
- } from './hooks';
24
- import { unlock } from '../../private-apis';
25
-
26
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
27
-
28
- function ScreenHeadingColor( { name, variation = '' } ) {
29
- const prefix = variation ? `variations.${ variation }.` : '';
30
- const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
31
- const supports = useSupportedStyles( name );
32
- const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
33
- const [ areCustomGradientsEnabled ] = useGlobalSetting(
34
- 'color.customGradient',
35
- name
36
- );
37
- const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
38
- const [ isBackgroundEnabled ] = useGlobalSetting(
39
- 'color.background',
40
- name
41
- );
42
- const colorsPerOrigin = useColorsPerOrigin( name );
43
- const gradientsPerOrigin = useGradientsPerOrigin( name );
44
-
45
- const hasTextColor =
46
- supports.includes( 'color' ) &&
47
- isTextEnabled &&
48
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
49
-
50
- const hasBackgroundColor =
51
- supports.includes( 'backgroundColor' ) &&
52
- isBackgroundEnabled &&
53
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
54
- const hasGradientColor =
55
- supports.includes( 'background' ) &&
56
- ( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
57
-
58
- const [ color, setColor ] = useGlobalStyle(
59
- prefix + 'elements.' + selectedLevel + '.color.text',
60
- name
61
- );
62
- const [ userColor ] = useGlobalStyle(
63
- prefix + 'elements.' + selectedLevel + '.color.text',
64
- name,
65
- 'user'
66
- );
67
-
68
- const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
69
- prefix + 'elements.' + selectedLevel + '.color.background',
70
- name
71
- );
72
- const [ userBackgroundColor ] = useGlobalStyle(
73
- prefix + 'elements.' + selectedLevel + '.color.background',
74
- name,
75
- 'user'
76
- );
77
- const [ gradient, setGradient ] = useGlobalStyle(
78
- prefix + 'elements.' + selectedLevel + '.color.gradient',
79
- name
80
- );
81
- const [ userGradient ] = useGlobalStyle(
82
- prefix + 'elements.' + selectedLevel + '.color.gradient',
83
- name,
84
- 'user'
85
- );
86
-
87
- if ( ! hasTextColor && ! hasBackgroundColor && ! hasGradientColor ) {
88
- return null;
89
- }
90
-
91
- let backgroundSettings = {};
92
- if ( hasBackgroundColor ) {
93
- backgroundSettings = {
94
- colorValue: backgroundColor,
95
- onColorChange: setBackgroundColor,
96
- };
97
- if ( backgroundColor ) {
98
- backgroundSettings.clearable =
99
- backgroundColor === userBackgroundColor;
100
- }
101
- }
102
-
103
- let gradientSettings = {};
104
- if ( hasGradientColor ) {
105
- gradientSettings = {
106
- gradientValue: gradient,
107
- onGradientChange: setGradient,
108
- };
109
- if ( gradient ) {
110
- gradientSettings.clearable = gradient === userGradient;
111
- }
112
- }
113
-
114
- const controlProps = {
115
- ...backgroundSettings,
116
- ...gradientSettings,
117
- };
118
-
119
- return (
120
- <>
121
- <ScreenHeader
122
- title={ __( 'Headings' ) }
123
- description={ __(
124
- 'Set the default color used for headings across the site.'
125
- ) }
126
- />
127
- <div className="edit-site-global-styles-screen-heading-color">
128
- <h3>{ __( 'Select heading level' ) }</h3>
129
-
130
- <ToggleGroupControl
131
- __nextHasNoMarginBottom
132
- label={ __( 'Select heading level' ) }
133
- hideLabelFromVision={ true }
134
- value={ selectedLevel }
135
- onChange={ setCurrentTab }
136
- isBlock
137
- >
138
- <ToggleGroupControlOption
139
- value="heading"
140
- /* translators: 'All' refers to selecting all heading levels
141
- and applying the same style to h1-h6. */
142
- label={ __( 'All' ) }
143
- />
144
- <ToggleGroupControlOption value="h1" label={ __( 'H1' ) } />
145
- <ToggleGroupControlOption value="h2" label={ __( 'H2' ) } />
146
- <ToggleGroupControlOption value="h3" label={ __( 'H3' ) } />
147
- <ToggleGroupControlOption value="h4" label={ __( 'H4' ) } />
148
- <ToggleGroupControlOption value="h5" label={ __( 'H5' ) } />
149
- <ToggleGroupControlOption value="h6" label={ __( 'H6' ) } />
150
- </ToggleGroupControl>
151
- </div>
152
- { hasTextColor && (
153
- <div className="edit-site-global-styles-screen-heading-color">
154
- <h3>
155
- { selectedLevel === 'heading'
156
- ? __( 'Text color for all heading levels' )
157
- : sprintf(
158
- /* translators: %s: heading level (h1-h6) */
159
- __( 'Text color for %s' ),
160
- selectedLevel.toUpperCase()
161
- ) }
162
- </h3>
163
- <ColorGradientControl
164
- className="edit-site-screen-heading-text-color__control"
165
- colors={ colorsPerOrigin }
166
- disableCustomColors={ ! areCustomSolidsEnabled }
167
- showTitle={ false }
168
- enableAlpha
169
- __experimentalIsRenderedInSidebar
170
- colorValue={ color }
171
- onColorChange={ setColor }
172
- clearable={ color === userColor }
173
- headingLevel={ 4 }
174
- />
175
- </div>
176
- ) }
177
- { hasBackgroundColor && (
178
- <div className="edit-site-global-styles-screen-heading-color">
179
- <h3>
180
- { selectedLevel === 'heading'
181
- ? __( 'Background color for all heading levels' )
182
- : sprintf(
183
- /* translators: %s: heading level (h1-h6) */
184
- __( 'Background color for %s' ),
185
- selectedLevel.toUpperCase()
186
- ) }
187
- </h3>
188
- <ColorGradientControl
189
- className="edit-site-screen-heading-background-color__control"
190
- colors={ colorsPerOrigin }
191
- gradients={ gradientsPerOrigin }
192
- disableCustomColors={ ! areCustomSolidsEnabled }
193
- disableCustomGradients={ ! areCustomGradientsEnabled }
194
- showTitle={ false }
195
- enableAlpha
196
- __experimentalIsRenderedInSidebar
197
- headingLevel={ 4 }
198
- { ...controlProps }
199
- />
200
- </div>
201
- ) }
202
- </>
203
- );
204
- }
205
-
206
- export default ScreenHeadingColor;
@@ -1,124 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import {
6
- __experimentalColorGradientControl as ColorGradientControl,
7
- privateApis as blockEditorPrivateApis,
8
- } from '@wordpress/block-editor';
9
- import { TabPanel } from '@wordpress/components';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import ScreenHeader from './header';
15
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
16
- import { unlock } from '../../private-apis';
17
-
18
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
19
-
20
- function ScreenLinkColor( { name, variation = '' } ) {
21
- const prefix = variation ? `variations.${ variation }.` : '';
22
- const supports = useSupportedStyles( name );
23
- const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
24
- const colorsPerOrigin = useColorsPerOrigin( name );
25
- const [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );
26
-
27
- const hasLinkColor =
28
- supports.includes( 'linkColor' ) &&
29
- isLinkEnabled &&
30
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
31
-
32
- const pseudoStates = {
33
- default: {
34
- label: __( 'Default' ),
35
- value: useGlobalStyle(
36
- prefix + 'elements.link.color.text',
37
- name
38
- )[ 0 ],
39
- handler: useGlobalStyle(
40
- prefix + 'elements.link.color.text',
41
- name
42
- )[ 1 ],
43
- userValue: useGlobalStyle(
44
- prefix + 'elements.link.color.text',
45
- name,
46
- 'user'
47
- )[ 0 ],
48
- },
49
- hover: {
50
- label: __( 'Hover' ),
51
- value: useGlobalStyle(
52
- prefix + 'elements.link.:hover.color.text',
53
- name
54
- )[ 0 ],
55
- handler: useGlobalStyle(
56
- prefix + 'elements.link.:hover.color.text',
57
- name
58
- )[ 1 ],
59
- userValue: useGlobalStyle(
60
- prefix + 'elements.link.:hover.color.text',
61
- name,
62
- 'user'
63
- )[ 0 ],
64
- },
65
- };
66
-
67
- if ( ! hasLinkColor ) {
68
- return null;
69
- }
70
-
71
- const tabs = Object.entries( pseudoStates ).map(
72
- ( [ selector, config ] ) => {
73
- return {
74
- name: selector,
75
- title: config.label,
76
- className: `color-text-${ selector }`,
77
- };
78
- }
79
- );
80
-
81
- return (
82
- <>
83
- <ScreenHeader
84
- title={ __( 'Links' ) }
85
- description={ __(
86
- 'Set the colors used for links across the site.'
87
- ) }
88
- />
89
-
90
- <TabPanel tabs={ tabs }>
91
- { ( tab ) => {
92
- const pseudoSelectorConfig =
93
- pseudoStates[ tab.name ] ?? null;
94
-
95
- if ( ! pseudoSelectorConfig ) {
96
- return null;
97
- }
98
-
99
- return (
100
- <>
101
- <ColorGradientControl
102
- className="edit-site-screen-link-color__control"
103
- colors={ colorsPerOrigin }
104
- disableCustomColors={ ! areCustomSolidsEnabled }
105
- showTitle={ false }
106
- enableAlpha
107
- __experimentalIsRenderedInSidebar
108
- colorValue={ pseudoSelectorConfig.value }
109
- onColorChange={ pseudoSelectorConfig.handler }
110
- clearable={
111
- pseudoSelectorConfig.value ===
112
- pseudoSelectorConfig.userValue
113
- }
114
- headingLevel={ 3 }
115
- />
116
- </>
117
- );
118
- } }
119
- </TabPanel>
120
- </>
121
- );
122
- }
123
-
124
- export default ScreenLinkColor;
@@ -1,62 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import {
6
- __experimentalColorGradientControl as ColorGradientControl,
7
- privateApis as blockEditorPrivateApis,
8
- } from '@wordpress/block-editor';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import ScreenHeader from './header';
14
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
15
- import { unlock } from '../../private-apis';
16
-
17
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
18
-
19
- function ScreenTextColor( { name, variation = '' } ) {
20
- const prefix = variation ? `variations.${ variation }.` : '';
21
- const supports = useSupportedStyles( name );
22
- const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
23
- const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
24
- const colorsPerOrigin = useColorsPerOrigin( name );
25
-
26
- const hasTextColor =
27
- supports.includes( 'color' ) &&
28
- isTextEnabled &&
29
- ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
30
-
31
- const [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );
32
- const [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );
33
-
34
- if ( ! hasTextColor ) {
35
- return null;
36
- }
37
-
38
- return (
39
- <>
40
- <ScreenHeader
41
- title={ __( 'Text' ) }
42
- description={ __(
43
- 'Set the default color used for text across the site.'
44
- ) }
45
- />
46
- <ColorGradientControl
47
- className="edit-site-screen-text-color__control"
48
- colors={ colorsPerOrigin }
49
- disableCustomColors={ ! areCustomSolidsEnabled }
50
- showTitle={ false }
51
- enableAlpha
52
- __experimentalIsRenderedInSidebar
53
- colorValue={ color }
54
- onColorChange={ setColor }
55
- clearable={ color === userColor }
56
- headingLevel={ 3 }
57
- />
58
- </>
59
- );
60
- }
61
-
62
- export default ScreenTextColor;