@wordpress/edit-site 3.0.24 → 4.0.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 (275) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +7 -1
  4. package/build/components/block-editor/resizable-editor.js +1 -0
  5. package/build/components/block-editor/resizable-editor.js.map +1 -1
  6. package/build/components/code-editor/code-editor-text-area.js +95 -0
  7. package/build/components/code-editor/code-editor-text-area.js.map +1 -0
  8. package/build/components/code-editor/index.js +79 -0
  9. package/build/components/code-editor/index.js.map +1 -0
  10. package/build/components/editor/index.js +39 -9
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/border-panel.js +81 -22
  13. package/build/components/global-styles/border-panel.js.map +1 -1
  14. package/build/components/global-styles/context-menu.js +4 -6
  15. package/build/components/global-styles/context-menu.js.map +1 -1
  16. package/build/components/global-styles/global-styles-provider.js +1 -0
  17. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  18. package/build/components/global-styles/header.js +2 -7
  19. package/build/components/global-styles/header.js.map +1 -1
  20. package/build/components/global-styles/navigation-button.js +35 -12
  21. package/build/components/global-styles/navigation-button.js.map +1 -1
  22. package/build/components/global-styles/palette.js +3 -3
  23. package/build/components/global-styles/palette.js.map +1 -1
  24. package/build/components/global-styles/preview.js +46 -15
  25. package/build/components/global-styles/preview.js.map +1 -1
  26. package/build/components/global-styles/screen-background-color.js +9 -12
  27. package/build/components/global-styles/screen-background-color.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +2 -3
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-block.js +0 -1
  31. package/build/components/global-styles/screen-block.js.map +1 -1
  32. package/build/components/global-styles/screen-color-palette.js +0 -2
  33. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  34. package/build/components/global-styles/screen-colors.js +5 -6
  35. package/build/components/global-styles/screen-colors.js.map +1 -1
  36. package/build/components/global-styles/screen-layout.js +0 -2
  37. package/build/components/global-styles/screen-layout.js.map +1 -1
  38. package/build/components/global-styles/screen-link-color.js +6 -12
  39. package/build/components/global-styles/screen-link-color.js.map +1 -1
  40. package/build/components/global-styles/screen-root.js +22 -3
  41. package/build/components/global-styles/screen-root.js.map +1 -1
  42. package/build/components/global-styles/screen-style-variations.js +138 -0
  43. package/build/components/global-styles/screen-style-variations.js.map +1 -0
  44. package/build/components/global-styles/screen-text-color.js +6 -12
  45. package/build/components/global-styles/screen-text-color.js.map +1 -1
  46. package/build/components/global-styles/screen-typography-element.js +0 -2
  47. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  48. package/build/components/global-styles/screen-typography.js +2 -3
  49. package/build/components/global-styles/screen-typography.js.map +1 -1
  50. package/build/components/global-styles/ui.js +31 -14
  51. package/build/components/global-styles/ui.js.map +1 -1
  52. package/build/components/header/index.js +12 -4
  53. package/build/components/header/index.js.map +1 -1
  54. package/build/components/header/mode-switcher/index.js +78 -0
  55. package/build/components/header/mode-switcher/index.js.map +1 -0
  56. package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
  57. package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  58. package/build/components/header/more-menu/index.js +72 -39
  59. package/build/components/header/more-menu/index.js.map +1 -1
  60. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  61. package/build/components/header/more-menu/site-export.js.map +1 -0
  62. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  63. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  64. package/build/components/header/tools-more-menu-group/index.js +1 -5
  65. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  66. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  67. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  68. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  69. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  70. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  71. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  72. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  73. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  74. package/build/components/keyboard-shortcuts/index.js +26 -1
  75. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  76. package/build/components/list/actions/index.js +5 -4
  77. package/build/components/list/actions/index.js.map +1 -1
  78. package/build/components/list/actions/rename-menu-item.js +3 -3
  79. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  80. package/build/components/list/added-by.js +51 -50
  81. package/build/components/list/added-by.js.map +1 -1
  82. package/build/components/routes/redirect-to-homepage.js +87 -0
  83. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  84. package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
  85. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  86. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  87. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  88. package/build/components/sidebar/default-sidebar.js +4 -2
  89. package/build/components/sidebar/default-sidebar.js.map +1 -1
  90. package/build/components/sidebar/global-styles-sidebar.js +1 -0
  91. package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
  92. package/build/components/url-query-controller/index.js +1 -38
  93. package/build/components/url-query-controller/index.js.map +1 -1
  94. package/build/index.js +10 -5
  95. package/build/index.js.map +1 -1
  96. package/build/store/actions.js +29 -27
  97. package/build/store/actions.js.map +1 -1
  98. package/build/store/defaults.js +2 -1
  99. package/build/store/defaults.js.map +1 -1
  100. package/build/store/reducer.js +11 -0
  101. package/build/store/reducer.js.map +1 -1
  102. package/build/store/selectors.js +13 -0
  103. package/build/store/selectors.js.map +1 -1
  104. package/build-module/components/block-editor/resizable-editor.js +1 -0
  105. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  106. package/build-module/components/code-editor/code-editor-text-area.js +83 -0
  107. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
  108. package/build-module/components/code-editor/index.js +62 -0
  109. package/build-module/components/code-editor/index.js.map +1 -0
  110. package/build-module/components/editor/index.js +38 -10
  111. package/build-module/components/editor/index.js.map +1 -1
  112. package/build-module/components/global-styles/border-panel.js +82 -23
  113. package/build-module/components/global-styles/border-panel.js.map +1 -1
  114. package/build-module/components/global-styles/context-menu.js +1 -1
  115. package/build-module/components/global-styles/context-menu.js.map +1 -1
  116. package/build-module/components/global-styles/global-styles-provider.js +1 -1
  117. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  118. package/build-module/components/global-styles/header.js +2 -5
  119. package/build-module/components/global-styles/header.js.map +1 -1
  120. package/build-module/components/global-styles/navigation-button.js +35 -10
  121. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  122. package/build-module/components/global-styles/palette.js +2 -2
  123. package/build-module/components/global-styles/palette.js.map +1 -1
  124. package/build-module/components/global-styles/preview.js +45 -15
  125. package/build-module/components/global-styles/preview.js.map +1 -1
  126. package/build-module/components/global-styles/screen-background-color.js +9 -13
  127. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  128. package/build-module/components/global-styles/screen-block-list.js +1 -2
  129. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  130. package/build-module/components/global-styles/screen-block.js +0 -1
  131. package/build-module/components/global-styles/screen-block.js.map +1 -1
  132. package/build-module/components/global-styles/screen-color-palette.js +0 -2
  133. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  134. package/build-module/components/global-styles/screen-colors.js +2 -3
  135. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  136. package/build-module/components/global-styles/screen-layout.js +0 -2
  137. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  138. package/build-module/components/global-styles/screen-link-color.js +7 -13
  139. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  140. package/build-module/components/global-styles/screen-root.js +21 -4
  141. package/build-module/components/global-styles/screen-root.js.map +1 -1
  142. package/build-module/components/global-styles/screen-style-variations.js +119 -0
  143. package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
  144. package/build-module/components/global-styles/screen-text-color.js +7 -13
  145. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  146. package/build-module/components/global-styles/screen-typography-element.js +0 -2
  147. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  148. package/build-module/components/global-styles/screen-typography.js +1 -2
  149. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  150. package/build-module/components/global-styles/ui.js +29 -14
  151. package/build-module/components/global-styles/ui.js.map +1 -1
  152. package/build-module/components/header/index.js +13 -5
  153. package/build-module/components/header/index.js.map +1 -1
  154. package/build-module/components/header/mode-switcher/index.js +65 -0
  155. package/build-module/components/header/mode-switcher/index.js.map +1 -0
  156. package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
  157. package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  158. package/build-module/components/header/more-menu/index.js +67 -40
  159. package/build-module/components/header/more-menu/index.js.map +1 -1
  160. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  161. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  162. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  163. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  164. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  165. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  166. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  167. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  168. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  169. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  170. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  172. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  173. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  174. package/build-module/components/keyboard-shortcuts/index.js +26 -1
  175. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  176. package/build-module/components/list/actions/index.js +5 -4
  177. package/build-module/components/list/actions/index.js.map +1 -1
  178. package/build-module/components/list/actions/rename-menu-item.js +3 -3
  179. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  180. package/build-module/components/list/added-by.js +52 -51
  181. package/build-module/components/list/added-by.js.map +1 -1
  182. package/build-module/components/routes/redirect-to-homepage.js +75 -0
  183. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  184. package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
  185. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  186. package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
  187. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  188. package/build-module/components/sidebar/default-sidebar.js +4 -2
  189. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  190. package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
  191. package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
  192. package/build-module/components/url-query-controller/index.js +3 -40
  193. package/build-module/components/url-query-controller/index.js.map +1 -1
  194. package/build-module/index.js +9 -4
  195. package/build-module/index.js.map +1 -1
  196. package/build-module/store/actions.js +25 -25
  197. package/build-module/store/actions.js.map +1 -1
  198. package/build-module/store/defaults.js +2 -1
  199. package/build-module/store/defaults.js.map +1 -1
  200. package/build-module/store/reducer.js +11 -0
  201. package/build-module/store/reducer.js.map +1 -1
  202. package/build-module/store/selectors.js +11 -0
  203. package/build-module/store/selectors.js.map +1 -1
  204. package/build-style/style-rtl.css +202 -72
  205. package/build-style/style.css +202 -72
  206. package/package.json +28 -30
  207. package/src/components/block-editor/resizable-editor.js +1 -0
  208. package/src/components/block-editor/style.scss +15 -23
  209. package/src/components/code-editor/code-editor-text-area.js +79 -0
  210. package/src/components/code-editor/index.js +65 -0
  211. package/src/components/code-editor/style.scss +100 -0
  212. package/src/components/editor/index.js +55 -10
  213. package/src/components/global-styles/border-panel.js +106 -42
  214. package/src/components/global-styles/context-menu.js +1 -1
  215. package/src/components/global-styles/global-styles-provider.js +1 -2
  216. package/src/components/global-styles/header.js +3 -5
  217. package/src/components/global-styles/navigation-button.js +31 -10
  218. package/src/components/global-styles/palette.js +6 -2
  219. package/src/components/global-styles/preview.js +46 -18
  220. package/src/components/global-styles/screen-background-color.js +7 -12
  221. package/src/components/global-styles/screen-block-list.js +1 -2
  222. package/src/components/global-styles/screen-block.js +1 -1
  223. package/src/components/global-styles/screen-color-palette.js +0 -2
  224. package/src/components/global-styles/screen-colors.js +2 -3
  225. package/src/components/global-styles/screen-layout.js +1 -5
  226. package/src/components/global-styles/screen-link-color.js +6 -16
  227. package/src/components/global-styles/screen-root.js +32 -3
  228. package/src/components/global-styles/screen-style-variations.js +130 -0
  229. package/src/components/global-styles/screen-text-color.js +6 -16
  230. package/src/components/global-styles/screen-typography-element.js +0 -4
  231. package/src/components/global-styles/screen-typography.js +2 -3
  232. package/src/components/global-styles/style.scss +24 -25
  233. package/src/components/global-styles/ui.js +55 -25
  234. package/src/components/header/document-actions/style.scss +1 -9
  235. package/src/components/header/index.js +10 -2
  236. package/src/components/header/mode-switcher/index.js +67 -0
  237. package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
  238. package/src/components/header/more-menu/index.js +107 -44
  239. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  240. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  241. package/src/components/header/style.scss +2 -1
  242. package/src/components/header/tools-more-menu-group/index.js +2 -7
  243. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  244. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  245. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  246. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  247. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  248. package/src/components/keyboard-shortcuts/index.js +27 -1
  249. package/src/components/list/actions/index.js +5 -4
  250. package/src/components/list/actions/rename-menu-item.js +3 -3
  251. package/src/components/list/added-by.js +57 -63
  252. package/src/components/routes/redirect-to-homepage.js +71 -0
  253. package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
  254. package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
  255. package/src/components/secondary-sidebar/style.scss +0 -4
  256. package/src/components/sidebar/default-sidebar.js +2 -0
  257. package/src/components/sidebar/global-styles-sidebar.js +1 -0
  258. package/src/components/sidebar/style.scss +21 -14
  259. package/src/components/url-query-controller/index.js +3 -35
  260. package/src/index.js +10 -3
  261. package/src/store/actions.js +24 -37
  262. package/src/store/defaults.js +1 -0
  263. package/src/store/reducer.js +6 -0
  264. package/src/store/selectors.js +11 -0
  265. package/src/store/test/actions.js +2 -92
  266. package/src/style.scss +2 -0
  267. package/build/plugins/index.js +0 -28
  268. package/build/plugins/index.js.map +0 -1
  269. package/build/plugins/site-export.js.map +0 -1
  270. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  271. package/build-module/plugins/index.js +0 -20
  272. package/build-module/plugins/index.js.map +0 -1
  273. package/build-module/plugins/site-export.js.map +0 -1
  274. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  275. package/src/plugins/index.js +0 -24
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -17,7 +17,6 @@ import {
17
17
  } from './hooks';
18
18
 
19
19
  function ScreenBackgroundColor( { name } ) {
20
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
21
20
  const supports = getSupportedGlobalStylesPanels( name );
22
21
  const [ solids ] = useSetting( 'color.palette', name );
23
22
  const [ gradients ] = useSetting( 'color.gradients', name );
@@ -55,7 +54,6 @@ function ScreenBackgroundColor( { name } ) {
55
54
  return null;
56
55
  }
57
56
 
58
- const settings = [];
59
57
  let backgroundSettings = {};
60
58
  if ( hasBackgroundColor ) {
61
59
  backgroundSettings = {
@@ -79,25 +77,21 @@ function ScreenBackgroundColor( { name } ) {
79
77
  }
80
78
  }
81
79
 
82
- settings.push( {
80
+ const controlProps = {
83
81
  ...backgroundSettings,
84
82
  ...gradientSettings,
85
- label: __( 'Background color' ),
86
- } );
83
+ };
87
84
 
88
85
  return (
89
86
  <>
90
87
  <ScreenHeader
91
- back={ parentMenu + '/colors' }
92
88
  title={ __( 'Background' ) }
93
89
  description={ __(
94
- 'Set a background color or gradient for the whole website.'
90
+ 'Set a background color or gradient for the whole site.'
95
91
  ) }
96
92
  />
97
-
98
- <PanelColorGradientSettings
99
- title={ __( 'Color' ) }
100
- settings={ settings }
93
+ <ColorGradientControl
94
+ className="edit-site-screen-background-color__control"
101
95
  colors={ colorsPerOrigin }
102
96
  gradients={ gradientsPerOrigin }
103
97
  disableCustomColors={ ! areCustomSolidsEnabled }
@@ -106,6 +100,7 @@ function ScreenBackgroundColor( { name } ) {
106
100
  showTitle={ false }
107
101
  enableAlpha
108
102
  __experimentalIsRenderedInSidebar
103
+ { ...controlProps }
109
104
  />
110
105
  </>
111
106
  );
@@ -17,7 +17,7 @@ import { useHasColorPanel } from './color-utils';
17
17
  import { useHasDimensionsPanel } from './dimensions-panel';
18
18
  import { useHasTypographyPanel } from './typography-panel';
19
19
  import ScreenHeader from './header';
20
- import NavigationButton from './navigation-button';
20
+ import { NavigationButton } from './navigation-button';
21
21
 
22
22
  function BlockMenuItem( { block } ) {
23
23
  const hasTypographyPanel = useHasTypographyPanel( block.name );
@@ -48,7 +48,6 @@ function ScreenBlockList() {
48
48
  return (
49
49
  <>
50
50
  <ScreenHeader
51
- back="/"
52
51
  title={ __( 'Blocks' ) }
53
52
  description={ __(
54
53
  'Customize the appearance of specific blocks and for the whole site.'
@@ -14,7 +14,7 @@ function ScreenBlock( { name } ) {
14
14
 
15
15
  return (
16
16
  <>
17
- <ScreenHeader back="/blocks" title={ blockType.title } />
17
+ <ScreenHeader title={ blockType.title } />
18
18
  <ContextMenu parentMenu={ '/blocks/' + name } name={ name } />
19
19
  </>
20
20
  );
@@ -17,12 +17,10 @@ import ScreenHeader from './header';
17
17
 
18
18
  function ScreenColorPalette( { name } ) {
19
19
  const [ currentTab, setCurrentTab ] = useState( 'solid' );
20
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
21
20
 
22
21
  return (
23
22
  <>
24
23
  <ScreenHeader
25
- back={ parentMenu + '/colors' }
26
24
  title={ __( 'Palette' ) }
27
25
  description={ __(
28
26
  'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'
@@ -15,7 +15,7 @@ import {
15
15
  */
16
16
  import ScreenHeader from './header';
17
17
  import Palette from './palette';
18
- import NavigationButton from './navigation-button';
18
+ import { NavigationButton } from './navigation-button';
19
19
  import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
20
20
  import Subtitle from './subtitle';
21
21
 
@@ -93,10 +93,9 @@ function ScreenColors( { name } ) {
93
93
  return (
94
94
  <>
95
95
  <ScreenHeader
96
- back={ parentMenu ? parentMenu : '/' }
97
96
  title={ __( 'Colors' ) }
98
97
  description={ __(
99
- 'Manage palettes and the default color of different global elements on the website.'
98
+ 'Manage palettes and the default color of different global elements on the site.'
100
99
  ) }
101
100
  />
102
101
 
@@ -11,16 +11,12 @@ import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
11
11
  import ScreenHeader from './header';
12
12
 
13
13
  function ScreenLayout( { name } ) {
14
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
15
14
  const hasBorderPanel = useHasBorderPanel( name );
16
15
  const hasDimensionsPanel = useHasDimensionsPanel( name );
17
16
 
18
17
  return (
19
18
  <>
20
- <ScreenHeader
21
- back={ parentMenu ? parentMenu : '/' }
22
- title={ __( 'Layout' ) }
23
- />
19
+ <ScreenHeader title={ __( 'Layout' ) } />
24
20
  { hasDimensionsPanel && <DimensionsPanel name={ name } /> }
25
21
  { hasBorderPanel && <BorderPanel name={ name } /> }
26
22
  </>
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -16,7 +16,6 @@ import {
16
16
  } from './hooks';
17
17
 
18
18
  function ScreenLinkColor( { name } ) {
19
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
20
19
  const supports = getSupportedGlobalStylesPanels( name );
21
20
  const [ solids ] = useSetting( 'color.palette', name );
22
21
  const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
@@ -44,34 +43,25 @@ function ScreenLinkColor( { name } ) {
44
43
  return null;
45
44
  }
46
45
 
47
- const settings = [
48
- {
49
- colorValue: linkColor,
50
- onColorChange: setLinkColor,
51
- label: __( 'Link color' ),
52
- clearable: linkColor === userLinkColor,
53
- },
54
- ];
55
-
56
46
  return (
57
47
  <>
58
48
  <ScreenHeader
59
- back={ parentMenu + '/colors' }
60
49
  title={ __( 'Links' ) }
61
50
  description={ __(
62
51
  'Set the default color used for links across the site.'
63
52
  ) }
64
53
  />
65
-
66
- <PanelColorGradientSettings
67
- title={ __( 'Color' ) }
68
- settings={ settings }
54
+ <ColorGradientControl
55
+ className="edit-site-screen-link-color__control"
69
56
  colors={ colorsPerOrigin }
70
57
  disableCustomColors={ ! areCustomSolidsEnabled }
71
58
  __experimentalHasMultipleOrigins
72
59
  showTitle={ false }
73
60
  enableAlpha
74
61
  __experimentalIsRenderedInSidebar
62
+ colorValue={ linkColor }
63
+ onColorChange={ setLinkColor }
64
+ clearable={ linkColor === userLinkColor }
75
65
  />
76
66
  </>
77
67
  );
@@ -5,6 +5,7 @@ import {
5
5
  __experimentalItemGroup as ItemGroup,
6
6
  __experimentalItem as Item,
7
7
  __experimentalHStack as HStack,
8
+ __experimentalVStack as VStack,
8
9
  FlexItem,
9
10
  CardBody,
10
11
  Card,
@@ -12,19 +13,47 @@ import {
12
13
  } from '@wordpress/components';
13
14
  import { isRTL, __ } from '@wordpress/i18n';
14
15
  import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
16
+ import { useSelect } from '@wordpress/data';
17
+ import { store as coreStore } from '@wordpress/core-data';
15
18
 
16
19
  /**
17
20
  * Internal dependencies
18
21
  */
19
- import StylesPreview from './preview';
20
- import NavigationButton from './navigation-button';
22
+ import { NavigationButton } from './navigation-button';
21
23
  import ContextMenu from './context-menu';
24
+ import StylesPreview from './preview';
22
25
 
23
26
  function ScreenRoot() {
27
+ const { variations } = useSelect( ( select ) => {
28
+ return {
29
+ variations: select(
30
+ coreStore
31
+ ).__experimentalGetCurrentThemeGlobalStylesVariations(),
32
+ };
33
+ }, [] );
34
+
24
35
  return (
25
36
  <Card size="small">
26
37
  <CardBody>
27
- <StylesPreview />
38
+ <VStack spacing={ 2 }>
39
+ <Card>
40
+ <StylesPreview />
41
+ </Card>
42
+ { !! variations?.length && (
43
+ <NavigationButton path="/variations">
44
+ <HStack justify="space-between">
45
+ <FlexItem>{ __( 'Other styles' ) }</FlexItem>
46
+ <FlexItem>
47
+ <Icon
48
+ icon={
49
+ isRTL() ? chevronLeft : chevronRight
50
+ }
51
+ />
52
+ </FlexItem>
53
+ </HStack>
54
+ </NavigationButton>
55
+ ) }
56
+ </VStack>
28
57
  </CardBody>
29
58
 
30
59
  <CardBody>
@@ -0,0 +1,130 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { isEqual } from 'lodash';
5
+ import classnames from 'classnames';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { store as coreStore } from '@wordpress/core-data';
11
+ import { useSelect } from '@wordpress/data';
12
+ import { useMemo, useContext } from '@wordpress/element';
13
+ import { ENTER } from '@wordpress/keycodes';
14
+ import {
15
+ __experimentalGrid as Grid,
16
+ Card,
17
+ CardBody,
18
+ } from '@wordpress/components';
19
+ import { __ } from '@wordpress/i18n';
20
+
21
+ /**
22
+ * Internal dependencies
23
+ */
24
+ import { mergeBaseAndUserConfigs } from './global-styles-provider';
25
+ import { GlobalStylesContext } from './context';
26
+ import StylesPreview from './preview';
27
+ import ScreenHeader from './header';
28
+
29
+ function compareVariations( a, b ) {
30
+ return isEqual( a.styles, b.styles ) && isEqual( a.settings, b.settings );
31
+ }
32
+
33
+ function Variation( { variation } ) {
34
+ const { base, user, setUserConfig } = useContext( GlobalStylesContext );
35
+ const context = useMemo( () => {
36
+ return {
37
+ user: {
38
+ settings: variation.settings ?? {},
39
+ styles: variation.styles ?? {},
40
+ },
41
+ base,
42
+ merged: mergeBaseAndUserConfigs( base, variation ),
43
+ setUserConfig: () => {},
44
+ };
45
+ }, [ variation, base ] );
46
+
47
+ const selectVariation = () => {
48
+ setUserConfig( () => {
49
+ return {
50
+ settings: variation.settings,
51
+ styles: variation.styles,
52
+ };
53
+ } );
54
+ };
55
+
56
+ const selectOnEnter = ( event ) => {
57
+ if ( event.keyCode === ENTER ) {
58
+ event.preventDefault();
59
+ selectVariation();
60
+ }
61
+ };
62
+
63
+ const isActive = useMemo( () => {
64
+ return compareVariations( user, variation );
65
+ }, [ user, variation ] );
66
+
67
+ return (
68
+ <GlobalStylesContext.Provider value={ context }>
69
+ <div
70
+ className={ classnames(
71
+ 'edit-site-global-styles-variations_item',
72
+ {
73
+ 'is-active': isActive,
74
+ }
75
+ ) }
76
+ role="button"
77
+ onClick={ selectVariation }
78
+ onKeyDown={ selectOnEnter }
79
+ tabIndex="0"
80
+ >
81
+ <StylesPreview height={ 100 } />
82
+ </div>
83
+ </GlobalStylesContext.Provider>
84
+ );
85
+ }
86
+
87
+ function ScreenStyleVariations() {
88
+ const { variations } = useSelect( ( select ) => {
89
+ return {
90
+ variations: select(
91
+ coreStore
92
+ ).__experimentalGetCurrentThemeGlobalStylesVariations(),
93
+ };
94
+ }, [] );
95
+
96
+ const withEmptyVariation = useMemo( () => {
97
+ return [
98
+ {
99
+ name: __( 'Default' ),
100
+ settings: {},
101
+ styles: {},
102
+ },
103
+ ...variations,
104
+ ];
105
+ }, [ variations ] );
106
+
107
+ return (
108
+ <>
109
+ <ScreenHeader
110
+ back="/"
111
+ title={ __( 'Other styles' ) }
112
+ description={ __(
113
+ 'Choose a different style combination for the theme styles'
114
+ ) }
115
+ />
116
+
117
+ <Card size="small" isBorderless>
118
+ <CardBody>
119
+ <Grid columns={ 2 }>
120
+ { withEmptyVariation?.map( ( variation, index ) => (
121
+ <Variation key={ index } variation={ variation } />
122
+ ) ) }
123
+ </Grid>
124
+ </CardBody>
125
+ </Card>
126
+ </>
127
+ );
128
+ }
129
+
130
+ export default ScreenStyleVariations;
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -16,7 +16,6 @@ import {
16
16
  } from './hooks';
17
17
 
18
18
  function ScreenTextColor( { name } ) {
19
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
20
19
  const supports = getSupportedGlobalStylesPanels( name );
21
20
  const [ solids ] = useSetting( 'color.palette', name );
22
21
  const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
@@ -36,34 +35,25 @@ function ScreenTextColor( { name } ) {
36
35
  return null;
37
36
  }
38
37
 
39
- const settings = [
40
- {
41
- colorValue: color,
42
- onColorChange: setColor,
43
- label: __( 'Text color' ),
44
- clearable: color === userColor,
45
- },
46
- ];
47
-
48
38
  return (
49
39
  <>
50
40
  <ScreenHeader
51
- back={ parentMenu + '/colors' }
52
41
  title={ __( 'Text' ) }
53
42
  description={ __(
54
43
  'Set the default color used for text across the site.'
55
44
  ) }
56
45
  />
57
-
58
- <PanelColorGradientSettings
59
- title={ __( 'Color' ) }
60
- settings={ settings }
46
+ <ColorGradientControl
47
+ className="edit-site-screen-text-color__control"
61
48
  colors={ colorsPerOrigin }
62
49
  disableCustomColors={ ! areCustomSolidsEnabled }
63
50
  __experimentalHasMultipleOrigins
64
51
  showTitle={ false }
65
52
  enableAlpha
66
53
  __experimentalIsRenderedInSidebar
54
+ colorValue={ color }
55
+ onColorChange={ setColor }
56
+ clearable={ color === userColor }
67
57
  />
68
58
  </>
69
59
  );
@@ -21,13 +21,9 @@ const elements = {
21
21
  };
22
22
 
23
23
  function ScreenTypographyElement( { name, element } ) {
24
- const parentMenu =
25
- name === undefined ? '/typography' : '/blocks/' + name + '/typography';
26
-
27
24
  return (
28
25
  <>
29
26
  <ScreenHeader
30
- back={ parentMenu }
31
27
  title={ elements[ element ].title }
32
28
  description={ elements[ element ].description }
33
29
  />
@@ -13,7 +13,7 @@ import {
13
13
  * Internal dependencies
14
14
  */
15
15
  import ScreenHeader from './header';
16
- import NavigationButton from './navigation-button';
16
+ import { NavigationButton } from './navigation-button';
17
17
  import { useStyle } from './hooks';
18
18
  import Subtitle from './subtitle';
19
19
  import TypographyPanel from './typography-panel';
@@ -72,7 +72,6 @@ function ScreenTypography( { name } ) {
72
72
  return (
73
73
  <>
74
74
  <ScreenHeader
75
- back={ parentMenu ? parentMenu : '/' }
76
75
  title={ __( 'Typography' ) }
77
76
  description={ __(
78
77
  'Manage the typography settings for different elements.'
@@ -101,7 +100,7 @@ function ScreenTypography( { name } ) {
101
100
  </div>
102
101
  ) }
103
102
 
104
- { /* no typogrpahy elements support yet for blocks */ }
103
+ { /* no typography elements support yet for blocks */ }
105
104
  { !! name && <TypographyPanel name={ name } element="text" /> }
106
105
  </>
107
106
  );
@@ -2,17 +2,13 @@
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- min-height: 152px;
6
5
  line-height: 1;
6
+ cursor: pointer;
7
+ }
7
8
 
8
- .component-color-indicator {
9
- border-radius: 50%;
10
- border: 0;
11
- height: 36px;
12
- width: 36px;
13
- margin-left: 0;
14
- padding: 0;
15
- }
9
+ .edit-site-global-styles-preview__iframe {
10
+ max-width: 100%;
11
+ display: block;
16
12
  }
17
13
 
18
14
  .edit-site-typography-panel__preview {
@@ -43,14 +39,6 @@
43
39
  margin: $grid-unit-20;
44
40
 
45
41
  .component-color-indicator {
46
- margin-left: 0;
47
- display: block;
48
- border-radius: 50%;
49
- height: 24px;
50
- width: 24px;
51
- padding: 0;
52
- border: $border-width solid $gray-300;
53
-
54
42
  // Show a diagonal line (crossed out) for empty swatches.
55
43
  background: linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
56
44
  }
@@ -77,16 +65,27 @@
77
65
  }
78
66
  }
79
67
 
80
- h2.edit-site-global-styles-gradient-palette-panel__duotone-heading.components-heading {
81
- text-transform: uppercase;
82
- line-height: $grid-unit-30;
83
- font-weight: 500;
84
- font-size: 11px;
85
- margin-bottom: $grid-unit-10;
86
- }
87
-
88
68
  .edit-site-screen-text-color__control,
89
69
  .edit-site-screen-link-color__control,
90
70
  .edit-site-screen-background-color__control {
91
71
  padding: $grid-unit-20;
92
72
  }
73
+
74
+ .edit-site-global-styles-variations_item {
75
+ box-sizing: border-box;
76
+ padding: $border-width * 2;
77
+ border-radius: $radius-block-ui;
78
+ border: $gray-200 $border-width solid;
79
+
80
+ &.is-active {
81
+ border: $gray-900 $border-width solid;
82
+ }
83
+
84
+ &:hover {
85
+ border: var(--wp-admin-theme-color) $border-width solid;
86
+ }
87
+
88
+ &:focus {
89
+ border: var(--wp-admin-theme-color) $border-width solid;
90
+ }
91
+ }
@@ -21,47 +21,70 @@ import ScreenBackgroundColor from './screen-background-color';
21
21
  import ScreenTextColor from './screen-text-color';
22
22
  import ScreenLinkColor from './screen-link-color';
23
23
  import ScreenLayout from './screen-layout';
24
+ import ScreenStyleVariations from './screen-style-variations';
25
+
26
+ function GlobalStylesNavigationScreen( { className, ...props } ) {
27
+ return (
28
+ <NavigatorScreen
29
+ className={ [
30
+ 'edit-site-global-styles-sidebar__navigator-screen',
31
+ className,
32
+ ]
33
+ .filter( Boolean )
34
+ .join( ' ' ) }
35
+ { ...props }
36
+ />
37
+ );
38
+ }
24
39
 
25
40
  function ContextScreens( { name } ) {
26
41
  const parentMenu = name === undefined ? '' : '/blocks/' + name;
27
42
 
28
43
  return (
29
44
  <>
30
- <NavigatorScreen path={ parentMenu + '/typography' }>
45
+ <GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>
31
46
  <ScreenTypography name={ name } />
32
- </NavigatorScreen>
47
+ </GlobalStylesNavigationScreen>
33
48
 
34
- <NavigatorScreen path={ parentMenu + '/typography/text' }>
49
+ <GlobalStylesNavigationScreen
50
+ path={ parentMenu + '/typography/text' }
51
+ >
35
52
  <ScreenTypographyElement name={ name } element="text" />
36
- </NavigatorScreen>
53
+ </GlobalStylesNavigationScreen>
37
54
 
38
- <NavigatorScreen path={ parentMenu + '/typography/link' }>
55
+ <GlobalStylesNavigationScreen
56
+ path={ parentMenu + '/typography/link' }
57
+ >
39
58
  <ScreenTypographyElement name={ name } element="link" />
40
- </NavigatorScreen>
59
+ </GlobalStylesNavigationScreen>
41
60
 
42
- <NavigatorScreen path={ parentMenu + '/colors' }>
61
+ <GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>
43
62
  <ScreenColors name={ name } />
44
- </NavigatorScreen>
63
+ </GlobalStylesNavigationScreen>
45
64
 
46
- <NavigatorScreen path={ parentMenu + '/colors/palette' }>
65
+ <GlobalStylesNavigationScreen
66
+ path={ parentMenu + '/colors/palette' }
67
+ >
47
68
  <ScreenColorPalette name={ name } />
48
- </NavigatorScreen>
69
+ </GlobalStylesNavigationScreen>
49
70
 
50
- <NavigatorScreen path={ parentMenu + '/colors/background' }>
71
+ <GlobalStylesNavigationScreen
72
+ path={ parentMenu + '/colors/background' }
73
+ >
51
74
  <ScreenBackgroundColor name={ name } />
52
- </NavigatorScreen>
75
+ </GlobalStylesNavigationScreen>
53
76
 
54
- <NavigatorScreen path={ parentMenu + '/colors/text' }>
77
+ <GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>
55
78
  <ScreenTextColor name={ name } />
56
- </NavigatorScreen>
79
+ </GlobalStylesNavigationScreen>
57
80
 
58
- <NavigatorScreen path={ parentMenu + '/colors/link' }>
81
+ <GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>
59
82
  <ScreenLinkColor name={ name } />
60
- </NavigatorScreen>
83
+ </GlobalStylesNavigationScreen>
61
84
 
62
- <NavigatorScreen path={ parentMenu + '/layout' }>
85
+ <GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
63
86
  <ScreenLayout name={ name } />
64
- </NavigatorScreen>
87
+ </GlobalStylesNavigationScreen>
65
88
  </>
66
89
  );
67
90
  }
@@ -70,22 +93,29 @@ function GlobalStylesUI() {
70
93
  const blocks = getBlockTypes();
71
94
 
72
95
  return (
73
- <NavigatorProvider initialPath="/">
74
- <NavigatorScreen path="/">
96
+ <NavigatorProvider
97
+ className="edit-site-global-styles-sidebar__navigator-provider"
98
+ initialPath="/"
99
+ >
100
+ <GlobalStylesNavigationScreen path="/">
75
101
  <ScreenRoot />
76
- </NavigatorScreen>
102
+ </GlobalStylesNavigationScreen>
103
+
104
+ <GlobalStylesNavigationScreen path="/variations">
105
+ <ScreenStyleVariations />
106
+ </GlobalStylesNavigationScreen>
77
107
 
78
- <NavigatorScreen path="/blocks">
108
+ <GlobalStylesNavigationScreen path="/blocks">
79
109
  <ScreenBlockList />
80
- </NavigatorScreen>
110
+ </GlobalStylesNavigationScreen>
81
111
 
82
112
  { blocks.map( ( block ) => (
83
- <NavigatorScreen
113
+ <GlobalStylesNavigationScreen
84
114
  key={ 'menu-block-' + block.name }
85
115
  path={ '/blocks/' + block.name }
86
116
  >
87
117
  <ScreenBlock name={ block.name } />
88
- </NavigatorScreen>
118
+ </GlobalStylesNavigationScreen>
89
119
  ) ) }
90
120
 
91
121
  <ContextScreens />