@wordpress/edit-site 3.0.22 → 3.1.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 (274) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/block-editor/resizable-editor.js +1 -0
  4. package/build/components/block-editor/resizable-editor.js.map +1 -1
  5. package/build/components/code-editor/code-editor-text-area.js +95 -0
  6. package/build/components/code-editor/code-editor-text-area.js.map +1 -0
  7. package/build/components/code-editor/index.js +79 -0
  8. package/build/components/code-editor/index.js.map +1 -0
  9. package/build/components/editor/index.js +21 -6
  10. package/build/components/editor/index.js.map +1 -1
  11. package/build/components/global-styles/border-panel.js +81 -22
  12. package/build/components/global-styles/border-panel.js.map +1 -1
  13. package/build/components/global-styles/context-menu.js +4 -6
  14. package/build/components/global-styles/context-menu.js.map +1 -1
  15. package/build/components/global-styles/global-styles-provider.js +1 -0
  16. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  17. package/build/components/global-styles/header.js +2 -7
  18. package/build/components/global-styles/header.js.map +1 -1
  19. package/build/components/global-styles/navigation-button.js +27 -12
  20. package/build/components/global-styles/navigation-button.js.map +1 -1
  21. package/build/components/global-styles/palette.js +2 -2
  22. package/build/components/global-styles/palette.js.map +1 -1
  23. package/build/components/global-styles/preview.js +46 -15
  24. package/build/components/global-styles/preview.js.map +1 -1
  25. package/build/components/global-styles/screen-background-color.js +9 -12
  26. package/build/components/global-styles/screen-background-color.js.map +1 -1
  27. package/build/components/global-styles/screen-block-list.js +2 -3
  28. package/build/components/global-styles/screen-block-list.js.map +1 -1
  29. package/build/components/global-styles/screen-block.js +0 -1
  30. package/build/components/global-styles/screen-block.js.map +1 -1
  31. package/build/components/global-styles/screen-color-palette.js +0 -2
  32. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  33. package/build/components/global-styles/screen-colors.js +5 -6
  34. package/build/components/global-styles/screen-colors.js.map +1 -1
  35. package/build/components/global-styles/screen-layout.js +0 -2
  36. package/build/components/global-styles/screen-layout.js.map +1 -1
  37. package/build/components/global-styles/screen-link-color.js +6 -12
  38. package/build/components/global-styles/screen-link-color.js.map +1 -1
  39. package/build/components/global-styles/screen-root.js +22 -3
  40. package/build/components/global-styles/screen-root.js.map +1 -1
  41. package/build/components/global-styles/screen-style-variations.js +138 -0
  42. package/build/components/global-styles/screen-style-variations.js.map +1 -0
  43. package/build/components/global-styles/screen-text-color.js +6 -12
  44. package/build/components/global-styles/screen-text-color.js.map +1 -1
  45. package/build/components/global-styles/screen-typography-element.js +0 -2
  46. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  47. package/build/components/global-styles/screen-typography.js +2 -3
  48. package/build/components/global-styles/screen-typography.js.map +1 -1
  49. package/build/components/global-styles/ui.js +31 -14
  50. package/build/components/global-styles/ui.js.map +1 -1
  51. package/build/components/header/index.js +12 -4
  52. package/build/components/header/index.js.map +1 -1
  53. package/build/components/header/mode-switcher/index.js +78 -0
  54. package/build/components/header/mode-switcher/index.js.map +1 -0
  55. package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
  56. package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  57. package/build/components/header/more-menu/index.js +72 -39
  58. package/build/components/header/more-menu/index.js.map +1 -1
  59. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  60. package/build/components/header/more-menu/site-export.js.map +1 -0
  61. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  62. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  63. package/build/components/header/tools-more-menu-group/index.js +1 -5
  64. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  65. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  66. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  67. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  68. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  69. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  70. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  71. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  72. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  73. package/build/components/keyboard-shortcuts/index.js +26 -1
  74. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  75. package/build/components/list/actions/index.js +5 -4
  76. package/build/components/list/actions/index.js.map +1 -1
  77. package/build/components/list/actions/rename-menu-item.js +3 -3
  78. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  79. package/build/components/list/added-by.js +51 -50
  80. package/build/components/list/added-by.js.map +1 -1
  81. package/build/components/routes/redirect-to-homepage.js +87 -0
  82. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  83. package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
  84. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  85. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  86. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  87. package/build/components/sidebar/default-sidebar.js +4 -2
  88. package/build/components/sidebar/default-sidebar.js.map +1 -1
  89. package/build/components/sidebar/global-styles-sidebar.js +1 -0
  90. package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
  91. package/build/components/url-query-controller/index.js +1 -38
  92. package/build/components/url-query-controller/index.js.map +1 -1
  93. package/build/index.js +9 -4
  94. package/build/index.js.map +1 -1
  95. package/build/store/actions.js +26 -25
  96. package/build/store/actions.js.map +1 -1
  97. package/build/store/defaults.js +2 -1
  98. package/build/store/defaults.js.map +1 -1
  99. package/build/store/reducer.js +11 -0
  100. package/build/store/reducer.js.map +1 -1
  101. package/build/store/selectors.js +13 -0
  102. package/build/store/selectors.js.map +1 -1
  103. package/build-module/components/block-editor/resizable-editor.js +1 -0
  104. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  105. package/build-module/components/code-editor/code-editor-text-area.js +83 -0
  106. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
  107. package/build-module/components/code-editor/index.js +62 -0
  108. package/build-module/components/code-editor/index.js.map +1 -0
  109. package/build-module/components/editor/index.js +20 -6
  110. package/build-module/components/editor/index.js.map +1 -1
  111. package/build-module/components/global-styles/border-panel.js +82 -23
  112. package/build-module/components/global-styles/border-panel.js.map +1 -1
  113. package/build-module/components/global-styles/context-menu.js +1 -1
  114. package/build-module/components/global-styles/context-menu.js.map +1 -1
  115. package/build-module/components/global-styles/global-styles-provider.js +1 -1
  116. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  117. package/build-module/components/global-styles/header.js +2 -5
  118. package/build-module/components/global-styles/header.js.map +1 -1
  119. package/build-module/components/global-styles/navigation-button.js +27 -10
  120. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  121. package/build-module/components/global-styles/palette.js +1 -1
  122. package/build-module/components/global-styles/palette.js.map +1 -1
  123. package/build-module/components/global-styles/preview.js +45 -15
  124. package/build-module/components/global-styles/preview.js.map +1 -1
  125. package/build-module/components/global-styles/screen-background-color.js +9 -13
  126. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  127. package/build-module/components/global-styles/screen-block-list.js +1 -2
  128. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  129. package/build-module/components/global-styles/screen-block.js +0 -1
  130. package/build-module/components/global-styles/screen-block.js.map +1 -1
  131. package/build-module/components/global-styles/screen-color-palette.js +0 -2
  132. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  133. package/build-module/components/global-styles/screen-colors.js +2 -3
  134. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  135. package/build-module/components/global-styles/screen-layout.js +0 -2
  136. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  137. package/build-module/components/global-styles/screen-link-color.js +7 -13
  138. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  139. package/build-module/components/global-styles/screen-root.js +21 -4
  140. package/build-module/components/global-styles/screen-root.js.map +1 -1
  141. package/build-module/components/global-styles/screen-style-variations.js +119 -0
  142. package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
  143. package/build-module/components/global-styles/screen-text-color.js +7 -13
  144. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  145. package/build-module/components/global-styles/screen-typography-element.js +0 -2
  146. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  147. package/build-module/components/global-styles/screen-typography.js +1 -2
  148. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  149. package/build-module/components/global-styles/ui.js +29 -14
  150. package/build-module/components/global-styles/ui.js.map +1 -1
  151. package/build-module/components/header/index.js +13 -5
  152. package/build-module/components/header/index.js.map +1 -1
  153. package/build-module/components/header/mode-switcher/index.js +65 -0
  154. package/build-module/components/header/mode-switcher/index.js.map +1 -0
  155. package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
  156. package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  157. package/build-module/components/header/more-menu/index.js +67 -40
  158. package/build-module/components/header/more-menu/index.js.map +1 -1
  159. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  160. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  161. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  162. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  163. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  164. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  165. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  166. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  167. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  168. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  169. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  170. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  172. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  173. package/build-module/components/keyboard-shortcuts/index.js +26 -1
  174. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  175. package/build-module/components/list/actions/index.js +5 -4
  176. package/build-module/components/list/actions/index.js.map +1 -1
  177. package/build-module/components/list/actions/rename-menu-item.js +3 -3
  178. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  179. package/build-module/components/list/added-by.js +52 -51
  180. package/build-module/components/list/added-by.js.map +1 -1
  181. package/build-module/components/routes/redirect-to-homepage.js +75 -0
  182. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  183. package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
  184. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  185. package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
  186. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  187. package/build-module/components/sidebar/default-sidebar.js +4 -2
  188. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  189. package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
  190. package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
  191. package/build-module/components/url-query-controller/index.js +3 -40
  192. package/build-module/components/url-query-controller/index.js.map +1 -1
  193. package/build-module/index.js +8 -3
  194. package/build-module/index.js.map +1 -1
  195. package/build-module/store/actions.js +22 -23
  196. package/build-module/store/actions.js.map +1 -1
  197. package/build-module/store/defaults.js +2 -1
  198. package/build-module/store/defaults.js.map +1 -1
  199. package/build-module/store/reducer.js +11 -0
  200. package/build-module/store/reducer.js.map +1 -1
  201. package/build-module/store/selectors.js +11 -0
  202. package/build-module/store/selectors.js.map +1 -1
  203. package/build-style/style-rtl.css +202 -72
  204. package/build-style/style.css +202 -72
  205. package/package.json +29 -28
  206. package/src/components/block-editor/resizable-editor.js +1 -0
  207. package/src/components/block-editor/style.scss +15 -23
  208. package/src/components/code-editor/code-editor-text-area.js +79 -0
  209. package/src/components/code-editor/index.js +65 -0
  210. package/src/components/code-editor/style.scss +100 -0
  211. package/src/components/editor/index.js +30 -7
  212. package/src/components/global-styles/border-panel.js +106 -42
  213. package/src/components/global-styles/context-menu.js +1 -1
  214. package/src/components/global-styles/global-styles-provider.js +1 -2
  215. package/src/components/global-styles/header.js +3 -5
  216. package/src/components/global-styles/navigation-button.js +14 -10
  217. package/src/components/global-styles/palette.js +1 -1
  218. package/src/components/global-styles/preview.js +46 -18
  219. package/src/components/global-styles/screen-background-color.js +7 -12
  220. package/src/components/global-styles/screen-block-list.js +1 -2
  221. package/src/components/global-styles/screen-block.js +1 -1
  222. package/src/components/global-styles/screen-color-palette.js +0 -2
  223. package/src/components/global-styles/screen-colors.js +2 -3
  224. package/src/components/global-styles/screen-layout.js +1 -5
  225. package/src/components/global-styles/screen-link-color.js +6 -16
  226. package/src/components/global-styles/screen-root.js +32 -3
  227. package/src/components/global-styles/screen-style-variations.js +130 -0
  228. package/src/components/global-styles/screen-text-color.js +6 -16
  229. package/src/components/global-styles/screen-typography-element.js +0 -4
  230. package/src/components/global-styles/screen-typography.js +2 -3
  231. package/src/components/global-styles/style.scss +24 -25
  232. package/src/components/global-styles/ui.js +55 -25
  233. package/src/components/header/document-actions/style.scss +1 -9
  234. package/src/components/header/index.js +10 -2
  235. package/src/components/header/mode-switcher/index.js +67 -0
  236. package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
  237. package/src/components/header/more-menu/index.js +107 -44
  238. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  239. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  240. package/src/components/header/style.scss +2 -1
  241. package/src/components/header/tools-more-menu-group/index.js +2 -7
  242. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  243. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  244. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  245. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  246. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  247. package/src/components/keyboard-shortcuts/index.js +27 -1
  248. package/src/components/list/actions/index.js +5 -4
  249. package/src/components/list/actions/rename-menu-item.js +3 -3
  250. package/src/components/list/added-by.js +57 -63
  251. package/src/components/routes/redirect-to-homepage.js +71 -0
  252. package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
  253. package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
  254. package/src/components/secondary-sidebar/style.scss +0 -4
  255. package/src/components/sidebar/default-sidebar.js +2 -0
  256. package/src/components/sidebar/global-styles-sidebar.js +1 -0
  257. package/src/components/sidebar/style.scss +21 -14
  258. package/src/components/url-query-controller/index.js +3 -35
  259. package/src/index.js +9 -2
  260. package/src/store/actions.js +22 -35
  261. package/src/store/defaults.js +1 -0
  262. package/src/store/reducer.js +6 -0
  263. package/src/store/selectors.js +11 -0
  264. package/src/store/test/actions.js +2 -92
  265. package/src/style.scss +2 -0
  266. package/build/plugins/index.js +0 -28
  267. package/build/plugins/index.js.map +0 -1
  268. package/build/plugins/site-export.js.map +0 -1
  269. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  270. package/build-module/plugins/index.js +0 -20
  271. package/build-module/plugins/index.js.map +0 -1
  272. package/build-module/plugins/site-export.js.map +0 -1
  273. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  274. package/src/plugins/index.js +0 -24
@@ -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 />
@@ -2,6 +2,7 @@
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  justify-content: center;
5
+ padding: 0 $grid-unit;
5
6
  height: 100%;
6
7
  // Flex items will, by default, refuse to shrink below a minimum
7
8
  // intrinsic width. In order to shrink this flexbox item, and
@@ -40,15 +41,6 @@
40
41
  white-space: nowrap;
41
42
  overflow: hidden;
42
43
  text-overflow: ellipsis;
43
- max-width: 120px;
44
-
45
- @include break-medium() {
46
- max-width: 75px;
47
- }
48
-
49
- @include break-xlarge() {
50
- max-width: 180px;
51
- }
52
44
  }
53
45
 
54
46
  .edit-site-document-actions__secondary-item {
@@ -11,7 +11,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
11
11
  import { PinnedItems } from '@wordpress/interface';
12
12
  import { _x, __ } from '@wordpress/i18n';
13
13
  import { listView, plus } from '@wordpress/icons';
14
- import { Button } from '@wordpress/components';
14
+ import { Button, ToolbarItem } from '@wordpress/components';
15
15
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
16
16
  import { store as editorStore } from '@wordpress/editor';
17
17
  import { store as coreStore } from '@wordpress/core-data';
@@ -45,6 +45,7 @@ export default function Header( {
45
45
  isListViewOpen,
46
46
  listViewShortcut,
47
47
  isLoaded,
48
+ isVisualMode,
48
49
  } = useSelect( ( select ) => {
49
50
  const {
50
51
  __experimentalGetPreviewDeviceType,
@@ -52,6 +53,7 @@ export default function Header( {
52
53
  getEditedPostId,
53
54
  isInserterOpened,
54
55
  isListViewOpened,
56
+ getEditorMode,
55
57
  } = select( editSiteStore );
56
58
  const { getEditedEntityRecord } = select( coreStore );
57
59
  const { __experimentalGetTemplateInfo: getTemplateInfo } = select(
@@ -75,6 +77,7 @@ export default function Header( {
75
77
  listViewShortcut: getShortcutRepresentation(
76
78
  'core/edit-site/toggle-list-view'
77
79
  ),
80
+ isVisualMode: getEditorMode() === 'visual',
78
81
  };
79
82
  }, [] );
80
83
 
@@ -111,6 +114,7 @@ export default function Header( {
111
114
  variant="primary"
112
115
  isPressed={ isInserterOpen }
113
116
  className="edit-site-header-toolbar__inserter-toggle"
117
+ disabled={ ! isVisualMode }
114
118
  onMouseDown={ preventDefault }
115
119
  onClick={ openInserter }
116
120
  icon={ plus }
@@ -121,11 +125,15 @@ export default function Header( {
121
125
  />
122
126
  { isLargeViewport && (
123
127
  <>
124
- <ToolSelector />
128
+ <ToolbarItem
129
+ as={ ToolSelector }
130
+ disabled={ ! isVisualMode }
131
+ />
125
132
  <UndoButton />
126
133
  <RedoButton />
127
134
  <Button
128
135
  className="edit-site-header-toolbar__list-view-toggle"
136
+ disabled={ ! isVisualMode }
129
137
  icon={ listView }
130
138
  isPressed={ isListViewOpen }
131
139
  /* translators: button label text should, if possible, be under 16 characters. */