@wordpress/edit-site 5.0.0 → 5.2.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 (262) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/LICENSE.md +1 -1
  3. package/build/components/add-new-template/new-template-part.js +21 -1
  4. package/build/components/add-new-template/new-template-part.js.map +1 -1
  5. package/build/components/add-new-template/utils.js +9 -1
  6. package/build/components/add-new-template/utils.js.map +1 -1
  7. package/build/components/block-editor/editor-canvas.js +0 -1
  8. package/build/components/block-editor/editor-canvas.js.map +1 -1
  9. package/build/components/block-editor/index.js +17 -52
  10. package/build/components/block-editor/index.js.map +1 -1
  11. package/build/components/block-editor/resize-handle.js +2 -1
  12. package/build/components/block-editor/resize-handle.js.map +1 -1
  13. package/build/components/editor/index.js +5 -17
  14. package/build/components/editor/index.js.map +1 -1
  15. package/build/components/global-styles/block-preview-panel.js +27 -6
  16. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  17. package/build/components/global-styles/border-panel.js +5 -5
  18. package/build/components/global-styles/border-panel.js.map +1 -1
  19. package/build/components/global-styles/context-menu.js +9 -1
  20. package/build/components/global-styles/context-menu.js.map +1 -1
  21. package/build/components/global-styles/custom-css.js +1 -0
  22. package/build/components/global-styles/custom-css.js.map +1 -1
  23. package/build/components/global-styles/dimensions-panel.js +16 -11
  24. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  25. package/build/components/global-styles/global-styles-provider.js +3 -2
  26. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  27. package/build/components/global-styles/screen-background-color.js +6 -6
  28. package/build/components/global-styles/screen-background-color.js.map +1 -1
  29. package/build/components/global-styles/screen-block-list.js +4 -1
  30. package/build/components/global-styles/screen-block-list.js.map +1 -1
  31. package/build/components/global-styles/screen-block.js +2 -6
  32. package/build/components/global-styles/screen-block.js.map +1 -1
  33. package/build/components/global-styles/screen-border.js +12 -2
  34. package/build/components/global-styles/screen-border.js.map +1 -1
  35. package/build/components/global-styles/screen-button-color.js +3 -4
  36. package/build/components/global-styles/screen-button-color.js.map +1 -1
  37. package/build/components/global-styles/screen-colors.js +53 -25
  38. package/build/components/global-styles/screen-colors.js.map +1 -1
  39. package/build/components/global-styles/screen-heading-color.js +9 -10
  40. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  41. package/build/components/global-styles/screen-layout.js +12 -2
  42. package/build/components/global-styles/screen-layout.js.map +1 -1
  43. package/build/components/global-styles/screen-link-color.js +8 -8
  44. package/build/components/global-styles/screen-link-color.js.map +1 -1
  45. package/build/components/global-styles/screen-root.js +7 -2
  46. package/build/components/global-styles/screen-root.js.map +1 -1
  47. package/build/components/global-styles/screen-text-color.js +4 -4
  48. package/build/components/global-styles/screen-text-color.js.map +1 -1
  49. package/build/components/global-styles/screen-typography.js +11 -1
  50. package/build/components/global-styles/screen-typography.js.map +1 -1
  51. package/build/components/global-styles/screen-variations.js +71 -0
  52. package/build/components/global-styles/screen-variations.js.map +1 -0
  53. package/build/components/global-styles/typography-panel.js +9 -8
  54. package/build/components/global-styles/typography-panel.js.map +1 -1
  55. package/build/components/global-styles/typography-utils.js +17 -5
  56. package/build/components/global-styles/typography-utils.js.map +1 -1
  57. package/build/components/global-styles/ui.js +85 -18
  58. package/build/components/global-styles/ui.js.map +1 -1
  59. package/build/components/global-styles/use-global-styles-output.js +119 -33
  60. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  61. package/build/components/global-styles/utils.js +60 -3
  62. package/build/components/global-styles/utils.js.map +1 -1
  63. package/build/components/global-styles/variations-panel.js +85 -0
  64. package/build/components/global-styles/variations-panel.js.map +1 -0
  65. package/build/components/header-edit-mode/document-actions/index.js +10 -41
  66. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  67. package/build/components/layout/index.js +129 -87
  68. package/build/components/layout/index.js.map +1 -1
  69. package/build/components/sidebar/index.js +5 -1
  70. package/build/components/sidebar/index.js.map +1 -1
  71. package/build/components/sidebar-edit-mode/index.js +3 -1
  72. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  73. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
  74. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
  75. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
  76. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  77. package/build/components/sidebar-navigation-screen-main/index.js +1 -31
  78. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  79. package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
  80. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  81. package/build/components/site-hub/index.js +149 -0
  82. package/build/components/site-hub/index.js.map +1 -0
  83. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
  84. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  85. package/build/components/template-details/edit-template-title.js +1 -0
  86. package/build/components/template-details/edit-template-title.js.map +1 -1
  87. package/build/components/template-details/template-part-area-selector.js +1 -0
  88. package/build/components/template-details/template-part-area-selector.js.map +1 -1
  89. package/build/components/use-edited-entity-record/index.js +60 -0
  90. package/build/components/use-edited-entity-record/index.js.map +1 -0
  91. package/build/hooks/index.js +2 -0
  92. package/build/hooks/index.js.map +1 -1
  93. package/build/hooks/push-changes-to-global-styles/index.js +144 -0
  94. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
  95. package/build/index.js +5 -0
  96. package/build/index.js.map +1 -1
  97. package/build/store/reducer.js +1 -1
  98. package/build/store/reducer.js.map +1 -1
  99. package/build-module/components/add-new-template/new-template-part.js +20 -1
  100. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  101. package/build-module/components/add-new-template/utils.js +5 -0
  102. package/build-module/components/add-new-template/utils.js.map +1 -1
  103. package/build-module/components/block-editor/editor-canvas.js +0 -1
  104. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  105. package/build-module/components/block-editor/index.js +19 -50
  106. package/build-module/components/block-editor/index.js.map +1 -1
  107. package/build-module/components/block-editor/resize-handle.js +2 -1
  108. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  109. package/build-module/components/editor/index.js +2 -13
  110. package/build-module/components/editor/index.js.map +1 -1
  111. package/build-module/components/global-styles/block-preview-panel.js +26 -6
  112. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  113. package/build-module/components/global-styles/border-panel.js +5 -5
  114. package/build-module/components/global-styles/border-panel.js.map +1 -1
  115. package/build-module/components/global-styles/context-menu.js +7 -1
  116. package/build-module/components/global-styles/context-menu.js.map +1 -1
  117. package/build-module/components/global-styles/custom-css.js +1 -0
  118. package/build-module/components/global-styles/custom-css.js.map +1 -1
  119. package/build-module/components/global-styles/dimensions-panel.js +16 -11
  120. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  121. package/build-module/components/global-styles/global-styles-provider.js +3 -2
  122. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  123. package/build-module/components/global-styles/screen-background-color.js +6 -6
  124. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  125. package/build-module/components/global-styles/screen-block-list.js +3 -1
  126. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  127. package/build-module/components/global-styles/screen-block.js +2 -5
  128. package/build-module/components/global-styles/screen-block.js.map +1 -1
  129. package/build-module/components/global-styles/screen-border.js +10 -2
  130. package/build-module/components/global-styles/screen-border.js.map +1 -1
  131. package/build-module/components/global-styles/screen-button-color.js +3 -4
  132. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  133. package/build-module/components/global-styles/screen-colors.js +51 -25
  134. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  135. package/build-module/components/global-styles/screen-heading-color.js +9 -10
  136. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  137. package/build-module/components/global-styles/screen-layout.js +10 -2
  138. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  139. package/build-module/components/global-styles/screen-link-color.js +8 -8
  140. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  141. package/build-module/components/global-styles/screen-root.js +8 -3
  142. package/build-module/components/global-styles/screen-root.js.map +1 -1
  143. package/build-module/components/global-styles/screen-text-color.js +4 -4
  144. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  145. package/build-module/components/global-styles/screen-typography.js +9 -1
  146. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  147. package/build-module/components/global-styles/screen-variations.js +54 -0
  148. package/build-module/components/global-styles/screen-variations.js.map +1 -0
  149. package/build-module/components/global-styles/typography-panel.js +9 -8
  150. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  151. package/build-module/components/global-styles/typography-utils.js +17 -5
  152. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  153. package/build-module/components/global-styles/ui.js +84 -19
  154. package/build-module/components/global-styles/ui.js.map +1 -1
  155. package/build-module/components/global-styles/use-global-styles-output.js +121 -35
  156. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  157. package/build-module/components/global-styles/utils.js +56 -3
  158. package/build-module/components/global-styles/utils.js.map +1 -1
  159. package/build-module/components/global-styles/variations-panel.js +68 -0
  160. package/build-module/components/global-styles/variations-panel.js.map +1 -0
  161. package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
  162. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  163. package/build-module/components/layout/index.js +129 -88
  164. package/build-module/components/layout/index.js.map +1 -1
  165. package/build-module/components/sidebar/index.js +4 -1
  166. package/build-module/components/sidebar/index.js.map +1 -1
  167. package/build-module/components/sidebar-edit-mode/index.js +3 -1
  168. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  169. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
  170. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
  171. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
  172. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  173. package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
  174. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  175. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
  176. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  177. package/build-module/components/site-hub/index.js +127 -0
  178. package/build-module/components/site-hub/index.js.map +1 -0
  179. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
  180. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  181. package/build-module/components/template-details/edit-template-title.js +1 -0
  182. package/build-module/components/template-details/edit-template-title.js.map +1 -1
  183. package/build-module/components/template-details/template-part-area-selector.js +1 -0
  184. package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
  185. package/build-module/components/use-edited-entity-record/index.js +48 -0
  186. package/build-module/components/use-edited-entity-record/index.js.map +1 -0
  187. package/build-module/hooks/index.js +1 -0
  188. package/build-module/hooks/index.js.map +1 -1
  189. package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
  190. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
  191. package/build-module/index.js +4 -0
  192. package/build-module/index.js.map +1 -1
  193. package/build-module/store/reducer.js +1 -1
  194. package/build-module/store/reducer.js.map +1 -1
  195. package/build-style/style-rtl.css +190 -125
  196. package/build-style/style.css +190 -125
  197. package/package.json +30 -29
  198. package/src/components/add-new-template/new-template-part.js +23 -1
  199. package/src/components/add-new-template/utils.js +14 -0
  200. package/src/components/block-editor/editor-canvas.js +0 -1
  201. package/src/components/block-editor/index.js +14 -59
  202. package/src/components/block-editor/resize-handle.js +6 -2
  203. package/src/components/block-editor/style.scss +43 -7
  204. package/src/components/editor/index.js +2 -17
  205. package/src/components/global-styles/block-preview-panel.js +37 -10
  206. package/src/components/global-styles/border-panel.js +8 -5
  207. package/src/components/global-styles/context-menu.js +6 -0
  208. package/src/components/global-styles/custom-css.js +1 -0
  209. package/src/components/global-styles/dimensions-panel.js +32 -15
  210. package/src/components/global-styles/global-styles-provider.js +11 -5
  211. package/src/components/global-styles/screen-background-color.js +12 -6
  212. package/src/components/global-styles/screen-block-list.js +6 -1
  213. package/src/components/global-styles/screen-block.js +1 -4
  214. package/src/components/global-styles/screen-border.js +8 -3
  215. package/src/components/global-styles/screen-button-color.js +2 -4
  216. package/src/components/global-styles/screen-colors.js +84 -20
  217. package/src/components/global-styles/screen-heading-color.js +8 -10
  218. package/src/components/global-styles/screen-layout.js +11 -3
  219. package/src/components/global-styles/screen-link-color.js +19 -8
  220. package/src/components/global-styles/screen-root.js +34 -27
  221. package/src/components/global-styles/screen-text-color.js +7 -4
  222. package/src/components/global-styles/screen-typography.js +13 -3
  223. package/src/components/global-styles/screen-variations.js +47 -0
  224. package/src/components/global-styles/style.scss +9 -0
  225. package/src/components/global-styles/test/typography-utils.js +72 -23
  226. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  227. package/src/components/global-styles/typography-panel.js +31 -8
  228. package/src/components/global-styles/typography-utils.js +24 -4
  229. package/src/components/global-styles/ui.js +101 -13
  230. package/src/components/global-styles/use-global-styles-output.js +137 -14
  231. package/src/components/global-styles/utils.js +56 -3
  232. package/src/components/global-styles/variations-panel.js +78 -0
  233. package/src/components/header-edit-mode/document-actions/index.js +18 -37
  234. package/src/components/header-edit-mode/style.scss +1 -0
  235. package/src/components/layout/index.js +217 -172
  236. package/src/components/layout/style.scss +98 -66
  237. package/src/components/list/style.scss +1 -8
  238. package/src/components/sidebar/index.js +4 -1
  239. package/src/components/sidebar-edit-mode/index.js +1 -1
  240. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
  241. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
  242. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
  243. package/src/components/sidebar-navigation-screen/style.scss +2 -4
  244. package/src/components/sidebar-navigation-screen-main/index.js +1 -29
  245. package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
  246. package/src/components/site-hub/index.js +161 -0
  247. package/src/components/site-hub/style.scss +31 -0
  248. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
  249. package/src/components/template-details/edit-template-title.js +1 -0
  250. package/src/components/template-details/template-part-area-selector.js +1 -0
  251. package/src/components/use-edited-entity-record/index.js +37 -0
  252. package/src/hooks/index.js +1 -0
  253. package/src/hooks/push-changes-to-global-styles/index.js +162 -0
  254. package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
  255. package/src/index.js +2 -0
  256. package/src/store/reducer.js +1 -1
  257. package/src/style.scss +2 -0
  258. package/build/components/site-title/index.js +0 -55
  259. package/build/components/site-title/index.js.map +0 -1
  260. package/build-module/components/site-title/index.js +0 -43
  261. package/build-module/components/site-title/index.js.map +0 -1
  262. package/src/components/site-title/index.js +0 -39
@@ -8,14 +8,19 @@ import { __ } from '@wordpress/i18n';
8
8
  */
9
9
  import ScreenHeader from './header';
10
10
  import BorderPanel, { useHasBorderPanel } from './border-panel';
11
+ import BlockPreviewPanel from './block-preview-panel';
12
+ import { getVariationClassNameFromPath } from './utils';
11
13
 
12
- function ScreenBorder( { name } ) {
14
+ function ScreenBorder( { name, variationPath = '' } ) {
13
15
  const hasBorderPanel = useHasBorderPanel( name );
14
-
16
+ const variationClassName = getVariationClassNameFromPath( variationPath );
15
17
  return (
16
18
  <>
17
19
  <ScreenHeader title={ __( 'Border' ) } />
18
- { hasBorderPanel && <BorderPanel name={ name } /> }
20
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
21
+ { hasBorderPanel && (
22
+ <BorderPanel name={ name } variationPath={ variationPath } />
23
+ ) }
19
24
  </>
20
25
  );
21
26
  }
@@ -15,7 +15,7 @@ import {
15
15
  useColorsPerOrigin,
16
16
  } from './hooks';
17
17
 
18
- function ScreenButtonColor( { name } ) {
18
+ function ScreenButtonColor( { name, variationPath = '' } ) {
19
19
  const supports = getSupportedGlobalStylesPanels( name );
20
20
  const [ solids ] = useSetting( 'color.palette', name );
21
21
  const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
@@ -30,7 +30,7 @@ function ScreenButtonColor( { name } ) {
30
30
  ( solids.length > 0 || areCustomSolidsEnabled );
31
31
 
32
32
  const [ buttonTextColor, setButtonTextColor ] = useStyle(
33
- 'elements.button.color.text',
33
+ variationPath + 'elements.button.color.text',
34
34
  name
35
35
  );
36
36
  const [ userButtonTextColor ] = useStyle(
@@ -70,7 +70,6 @@ function ScreenButtonColor( { name } ) {
70
70
  className="edit-site-screen-button-color__control"
71
71
  colors={ colorsPerOrigin }
72
72
  disableCustomColors={ ! areCustomSolidsEnabled }
73
- __experimentalHasMultipleOrigins
74
73
  showTitle={ false }
75
74
  enableAlpha
76
75
  __experimentalIsRenderedInSidebar
@@ -87,7 +86,6 @@ function ScreenButtonColor( { name } ) {
87
86
  className="edit-site-screen-button-color__control"
88
87
  colors={ colorsPerOrigin }
89
88
  disableCustomColors={ ! areCustomSolidsEnabled }
90
- __experimentalHasMultipleOrigins
91
89
  showTitle={ false }
92
90
  enableAlpha
93
91
  __experimentalIsRenderedInSidebar
@@ -20,14 +20,30 @@ import { NavigationButtonAsItem } from './navigation-button';
20
20
  import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
21
21
  import Subtitle from './subtitle';
22
22
  import ColorIndicatorWrapper from './color-indicator-wrapper';
23
+ import BlockPreviewPanel from './block-preview-panel';
24
+ import { getVariationClassNameFromPath } from './utils';
23
25
 
24
- function BackgroundColorItem( { name, parentMenu } ) {
26
+ function variationPathToURL( variationPath ) {
27
+ if ( ! variationPath ) {
28
+ return '';
29
+ }
30
+ // Replace the dots with slashes, add slash at the beginning and remove the last slash.
31
+ return '/' + variationPath.replace( /\./g, '/' ).slice( 0, -1 );
32
+ }
33
+
34
+ function BackgroundColorItem( { name, parentMenu, variationPath = '' } ) {
25
35
  const supports = getSupportedGlobalStylesPanels( name );
26
36
  const hasSupport =
27
37
  supports.includes( 'backgroundColor' ) ||
28
38
  supports.includes( 'background' );
29
- const [ backgroundColor ] = useStyle( 'color.background', name );
30
- const [ gradientValue ] = useStyle( 'color.gradient', name );
39
+ const [ backgroundColor ] = useStyle(
40
+ variationPath + 'color.background',
41
+ name
42
+ );
43
+ const [ gradientValue ] = useStyle(
44
+ variationPath + 'color.gradient',
45
+ name
46
+ );
31
47
 
32
48
  if ( ! hasSupport ) {
33
49
  return null;
@@ -35,7 +51,11 @@ function BackgroundColorItem( { name, parentMenu } ) {
35
51
 
36
52
  return (
37
53
  <NavigationButtonAsItem
38
- path={ parentMenu + '/colors/background' }
54
+ path={
55
+ parentMenu +
56
+ variationPathToURL( variationPath ) +
57
+ '/colors/background'
58
+ }
39
59
  aria-label={ __( 'Colors background styles' ) }
40
60
  >
41
61
  <HStack justify="flex-start">
@@ -53,10 +73,10 @@ function BackgroundColorItem( { name, parentMenu } ) {
53
73
  );
54
74
  }
55
75
 
56
- function TextColorItem( { name, parentMenu } ) {
76
+ function TextColorItem( { name, parentMenu, variationPath = '' } ) {
57
77
  const supports = getSupportedGlobalStylesPanels( name );
58
78
  const hasSupport = supports.includes( 'color' );
59
- const [ color ] = useStyle( 'color.text', name );
79
+ const [ color ] = useStyle( variationPath + 'color.text', name );
60
80
 
61
81
  if ( ! hasSupport ) {
62
82
  return null;
@@ -64,7 +84,11 @@ function TextColorItem( { name, parentMenu } ) {
64
84
 
65
85
  return (
66
86
  <NavigationButtonAsItem
67
- path={ parentMenu + '/colors/text' }
87
+ path={
88
+ parentMenu +
89
+ variationPathToURL( variationPath ) +
90
+ '/colors/text'
91
+ }
68
92
  aria-label={ __( 'Colors text styles' ) }
69
93
  >
70
94
  <HStack justify="flex-start">
@@ -82,11 +106,17 @@ function TextColorItem( { name, parentMenu } ) {
82
106
  );
83
107
  }
84
108
 
85
- function LinkColorItem( { name, parentMenu } ) {
109
+ function LinkColorItem( { name, parentMenu, variationPath = '' } ) {
86
110
  const supports = getSupportedGlobalStylesPanels( name );
87
111
  const hasSupport = supports.includes( 'linkColor' );
88
- const [ color ] = useStyle( 'elements.link.color.text', name );
89
- const [ colorHover ] = useStyle( 'elements.link.:hover.color.text', name );
112
+ const [ color ] = useStyle(
113
+ variationPath + 'elements.link.color.text',
114
+ name
115
+ );
116
+ const [ colorHover ] = useStyle(
117
+ variationPath + 'elements.link.:hover.color.text',
118
+ name
119
+ );
90
120
 
91
121
  if ( ! hasSupport ) {
92
122
  return null;
@@ -94,7 +124,11 @@ function LinkColorItem( { name, parentMenu } ) {
94
124
 
95
125
  return (
96
126
  <NavigationButtonAsItem
97
- path={ parentMenu + '/colors/link' }
127
+ path={
128
+ parentMenu +
129
+ variationPathToURL( variationPath ) +
130
+ '/colors/link'
131
+ }
98
132
  aria-label={ __( 'Colors link styles' ) }
99
133
  >
100
134
  <HStack justify="flex-start">
@@ -114,11 +148,17 @@ function LinkColorItem( { name, parentMenu } ) {
114
148
  );
115
149
  }
116
150
 
117
- function HeadingColorItem( { name, parentMenu } ) {
151
+ function HeadingColorItem( { name, parentMenu, variationPath = '' } ) {
118
152
  const supports = getSupportedGlobalStylesPanels( name );
119
153
  const hasSupport = supports.includes( 'color' );
120
- const [ color ] = useStyle( 'elements.heading.color.text', name );
121
- const [ bgColor ] = useStyle( 'elements.heading.color.background', name );
154
+ const [ color ] = useStyle(
155
+ variationPath + 'elements.heading.color.text',
156
+ name
157
+ );
158
+ const [ bgColor ] = useStyle(
159
+ variationPath + 'elements.heading.color.background',
160
+ name
161
+ );
122
162
 
123
163
  if ( ! hasSupport ) {
124
164
  return null;
@@ -126,7 +166,11 @@ function HeadingColorItem( { name, parentMenu } ) {
126
166
 
127
167
  return (
128
168
  <NavigationButtonAsItem
129
- path={ parentMenu + '/colors/heading' }
169
+ path={
170
+ parentMenu +
171
+ variationPathToURL( variationPath ) +
172
+ '/colors/heading'
173
+ }
130
174
  aria-label={ __( 'Colors heading styles' ) }
131
175
  >
132
176
  <HStack justify="flex-start">
@@ -144,18 +188,30 @@ function HeadingColorItem( { name, parentMenu } ) {
144
188
  );
145
189
  }
146
190
 
147
- function ButtonColorItem( { name, parentMenu } ) {
191
+ function ButtonColorItem( { name, parentMenu, variationPath = '' } ) {
148
192
  const supports = getSupportedGlobalStylesPanels( name );
149
193
  const hasSupport = supports.includes( 'buttonColor' );
150
- const [ color ] = useStyle( 'elements.button.color.text', name );
151
- const [ bgColor ] = useStyle( 'elements.button.color.background', name );
194
+ const [ color ] = useStyle(
195
+ variationPath + 'elements.button.color.text',
196
+ name
197
+ );
198
+ const [ bgColor ] = useStyle(
199
+ variationPath + 'elements.button.color.background',
200
+ name
201
+ );
152
202
 
153
203
  if ( ! hasSupport ) {
154
204
  return null;
155
205
  }
156
206
 
157
207
  return (
158
- <NavigationButtonAsItem path={ parentMenu + '/colors/button' }>
208
+ <NavigationButtonAsItem
209
+ path={
210
+ parentMenu +
211
+ variationPathToURL( variationPath ) +
212
+ '/colors/button'
213
+ }
214
+ >
159
215
  <HStack justify="flex-start">
160
216
  <ZStack isLayered={ false } offset={ -8 }>
161
217
  <ColorIndicatorWrapper expanded={ false }>
@@ -173,9 +229,10 @@ function ButtonColorItem( { name, parentMenu } ) {
173
229
  );
174
230
  }
175
231
 
176
- function ScreenColors( { name } ) {
232
+ function ScreenColors( { name, variationPath = '' } ) {
177
233
  const parentMenu =
178
234
  name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
235
+ const variationClassName = getVariationClassNameFromPath( variationPath );
179
236
 
180
237
  return (
181
238
  <>
@@ -186,6 +243,8 @@ function ScreenColors( { name } ) {
186
243
  ) }
187
244
  />
188
245
 
246
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
247
+
189
248
  <div className="edit-site-global-styles-screen-colors">
190
249
  <VStack spacing={ 10 }>
191
250
  <Palette name={ name } />
@@ -196,22 +255,27 @@ function ScreenColors( { name } ) {
196
255
  <BackgroundColorItem
197
256
  name={ name }
198
257
  parentMenu={ parentMenu }
258
+ variationPath={ variationPath }
199
259
  />
200
260
  <TextColorItem
201
261
  name={ name }
202
262
  parentMenu={ parentMenu }
263
+ variationPath={ variationPath }
203
264
  />
204
265
  <LinkColorItem
205
266
  name={ name }
206
267
  parentMenu={ parentMenu }
268
+ variationPath={ variationPath }
207
269
  />
208
270
  <HeadingColorItem
209
271
  name={ name }
210
272
  parentMenu={ parentMenu }
273
+ variationPath={ variationPath }
211
274
  />
212
275
  <ButtonColorItem
213
276
  name={ name }
214
277
  parentMenu={ parentMenu }
278
+ variationPath={ variationPath }
215
279
  />
216
280
  </ItemGroup>
217
281
  </VStack>
@@ -21,7 +21,7 @@ import {
21
21
  useGradientsPerOrigin,
22
22
  } from './hooks';
23
23
 
24
- function ScreenHeadingColor( { name } ) {
24
+ function ScreenHeadingColor( { name, variationPath = '' } ) {
25
25
  const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
26
26
 
27
27
  const supports = getSupportedGlobalStylesPanels( name );
@@ -52,30 +52,30 @@ function ScreenHeadingColor( { name } ) {
52
52
  ( gradients.length > 0 || areCustomGradientsEnabled );
53
53
 
54
54
  const [ color, setColor ] = useStyle(
55
- 'elements.' + selectedLevel + '.color.text',
55
+ variationPath + 'elements.' + selectedLevel + '.color.text',
56
56
  name
57
57
  );
58
58
  const [ userColor ] = useStyle(
59
- 'elements.' + selectedLevel + '.color.text',
59
+ variationPath + 'elements.' + selectedLevel + '.color.text',
60
60
  name,
61
61
  'user'
62
62
  );
63
63
 
64
64
  const [ backgroundColor, setBackgroundColor ] = useStyle(
65
- 'elements.' + selectedLevel + '.color.background',
65
+ variationPath + 'elements.' + selectedLevel + '.color.background',
66
66
  name
67
67
  );
68
68
  const [ userBackgroundColor ] = useStyle(
69
- 'elements.' + selectedLevel + '.color.background',
69
+ variationPath + 'elements.' + selectedLevel + '.color.background',
70
70
  name,
71
71
  'user'
72
72
  );
73
73
  const [ gradient, setGradient ] = useStyle(
74
- 'elements.' + selectedLevel + '.color.gradient',
74
+ variationPath + 'elements.' + selectedLevel + '.color.gradient',
75
75
  name
76
76
  );
77
77
  const [ userGradient ] = useStyle(
78
- 'elements.' + selectedLevel + '.color.gradient',
78
+ variationPath + 'elements.' + selectedLevel + '.color.gradient',
79
79
  name,
80
80
  'user'
81
81
  );
@@ -132,7 +132,7 @@ function ScreenHeadingColor( { name } ) {
132
132
  >
133
133
  <ToggleGroupControlOption
134
134
  value="heading"
135
- /* translators: 'All' refers to selecting all heading levels
135
+ /* translators: 'All' refers to selecting all heading levels
136
136
  and applying the same style to h1-h6. */
137
137
  label={ __( 'All' ) }
138
138
  />
@@ -159,7 +159,6 @@ function ScreenHeadingColor( { name } ) {
159
159
  className="edit-site-screen-heading-text-color__control"
160
160
  colors={ colorsPerOrigin }
161
161
  disableCustomColors={ ! areCustomSolidsEnabled }
162
- __experimentalHasMultipleOrigins
163
162
  showTitle={ false }
164
163
  enableAlpha
165
164
  __experimentalIsRenderedInSidebar
@@ -186,7 +185,6 @@ function ScreenHeadingColor( { name } ) {
186
185
  gradients={ gradientsPerOrigin }
187
186
  disableCustomColors={ ! areCustomSolidsEnabled }
188
187
  disableCustomGradients={ ! areCustomGradientsEnabled }
189
- __experimentalHasMultipleOrigins
190
188
  showTitle={ false }
191
189
  enableAlpha
192
190
  __experimentalIsRenderedInSidebar
@@ -8,14 +8,22 @@ import { __ } from '@wordpress/i18n';
8
8
  */
9
9
  import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
10
10
  import ScreenHeader from './header';
11
+ import BlockPreviewPanel from './block-preview-panel';
12
+ import { getVariationClassNameFromPath } from './utils';
11
13
 
12
- function ScreenLayout( { name } ) {
14
+ function ScreenLayout( { name, variationPath = '' } ) {
13
15
  const hasDimensionsPanel = useHasDimensionsPanel( name );
14
-
16
+ const variationClassName = getVariationClassNameFromPath( variationPath );
15
17
  return (
16
18
  <>
17
19
  <ScreenHeader title={ __( 'Layout' ) } />
18
- { hasDimensionsPanel && <DimensionsPanel name={ name } /> }
20
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
21
+ { hasDimensionsPanel && (
22
+ <DimensionsPanel
23
+ name={ name }
24
+ variationPath={ variationPath }
25
+ />
26
+ ) }
19
27
  </>
20
28
  );
21
29
  }
@@ -15,7 +15,7 @@ import {
15
15
  useColorsPerOrigin,
16
16
  } from './hooks';
17
17
 
18
- function ScreenLinkColor( { name } ) {
18
+ function ScreenLinkColor( { name, variationPath = '' } ) {
19
19
  const supports = getSupportedGlobalStylesPanels( name );
20
20
  const [ solids ] = useSetting( 'color.palette', name );
21
21
  const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
@@ -32,20 +32,32 @@ function ScreenLinkColor( { name } ) {
32
32
  const pseudoStates = {
33
33
  default: {
34
34
  label: __( 'Default' ),
35
- value: useStyle( 'elements.link.color.text', name )[ 0 ],
36
- handler: useStyle( 'elements.link.color.text', name )[ 1 ],
35
+ value: useStyle(
36
+ variationPath + 'elements.link.color.text',
37
+ name
38
+ )[ 0 ],
39
+ handler: useStyle(
40
+ variationPath + 'elements.link.color.text',
41
+ name
42
+ )[ 1 ],
37
43
  userValue: useStyle(
38
- 'elements.link.color.text',
44
+ variationPath + 'elements.link.color.text',
39
45
  name,
40
46
  'user'
41
47
  )[ 0 ],
42
48
  },
43
49
  hover: {
44
50
  label: __( 'Hover' ),
45
- value: useStyle( 'elements.link.:hover.color.text', name )[ 0 ],
46
- handler: useStyle( 'elements.link.:hover.color.text', name )[ 1 ],
51
+ value: useStyle(
52
+ variationPath + 'elements.link.:hover.color.text',
53
+ name
54
+ )[ 0 ],
55
+ handler: useStyle(
56
+ variationPath + 'elements.link.:hover.color.text',
57
+ name
58
+ )[ 1 ],
47
59
  userValue: useStyle(
48
- 'elements.link.:hover.color.text',
60
+ variationPath + 'elements.link.:hover.color.text',
49
61
  name,
50
62
  'user'
51
63
  )[ 0 ],
@@ -90,7 +102,6 @@ function ScreenLinkColor( { name } ) {
90
102
  className="edit-site-screen-link-color__control"
91
103
  colors={ colorsPerOrigin }
92
104
  disableCustomColors={ ! areCustomSolidsEnabled }
93
- __experimentalHasMultipleOrigins
94
105
  showTitle={ false }
95
106
  enableAlpha
96
107
  __experimentalIsRenderedInSidebar
@@ -35,6 +35,8 @@ function ScreenRoot() {
35
35
  };
36
36
  }, [] );
37
37
 
38
+ const __experimentalGlobalStylesCustomCSS =
39
+ window?.__experimentalEnableGlobalStylesCustomCSS;
38
40
  return (
39
41
  <Card size="small">
40
42
  <CardBody>
@@ -100,33 +102,38 @@ function ScreenRoot() {
100
102
  </ItemGroup>
101
103
  </CardBody>
102
104
 
103
- <CardDivider />
104
-
105
- <CardBody>
106
- <Spacer
107
- as="p"
108
- paddingTop={ 2 }
109
- paddingX="13px"
110
- marginBottom={ 4 }
111
- >
112
- { __(
113
- 'Add your own CSS to customize the appearance and layout of your site.'
114
- ) }
115
- </Spacer>
116
- <ItemGroup>
117
- <NavigationButtonAsItem
118
- path="/css"
119
- aria-label={ __( 'Additional CSS' ) }
120
- >
121
- <HStack justify="space-between">
122
- <FlexItem>{ __( 'Custom' ) }</FlexItem>
123
- <IconWithCurrentColor
124
- icon={ isRTL() ? chevronLeft : chevronRight }
125
- />
126
- </HStack>
127
- </NavigationButtonAsItem>
128
- </ItemGroup>
129
- </CardBody>
105
+ { __experimentalGlobalStylesCustomCSS && (
106
+ <>
107
+ <CardDivider />
108
+ <CardBody>
109
+ <Spacer
110
+ as="p"
111
+ paddingTop={ 2 }
112
+ paddingX="13px"
113
+ marginBottom={ 4 }
114
+ >
115
+ { __(
116
+ 'Add your own CSS to customize the appearance and layout of your site.'
117
+ ) }
118
+ </Spacer>
119
+ <ItemGroup>
120
+ <NavigationButtonAsItem
121
+ path="/css"
122
+ aria-label={ __( 'Additional CSS' ) }
123
+ >
124
+ <HStack justify="space-between">
125
+ <FlexItem>{ __( 'Custom' ) }</FlexItem>
126
+ <IconWithCurrentColor
127
+ icon={
128
+ isRTL() ? chevronLeft : chevronRight
129
+ }
130
+ />
131
+ </HStack>
132
+ </NavigationButtonAsItem>
133
+ </ItemGroup>
134
+ </CardBody>
135
+ </>
136
+ ) }
130
137
  </Card>
131
138
  );
132
139
  }
@@ -15,7 +15,7 @@ import {
15
15
  useColorsPerOrigin,
16
16
  } from './hooks';
17
17
 
18
- function ScreenTextColor( { name } ) {
18
+ function ScreenTextColor( { name, variationPath = '' } ) {
19
19
  const supports = getSupportedGlobalStylesPanels( name );
20
20
  const [ solids ] = useSetting( 'color.palette', name );
21
21
  const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
@@ -28,8 +28,12 @@ function ScreenTextColor( { name } ) {
28
28
  isTextEnabled &&
29
29
  ( solids.length > 0 || areCustomSolidsEnabled );
30
30
 
31
- const [ color, setColor ] = useStyle( 'color.text', name );
32
- const [ userColor ] = useStyle( 'color.text', name, 'user' );
31
+ const [ color, setColor ] = useStyle( variationPath + 'color.text', name );
32
+ const [ userColor ] = useStyle(
33
+ variationPath + 'color.text',
34
+ name,
35
+ 'user'
36
+ );
33
37
 
34
38
  if ( ! hasTextColor ) {
35
39
  return null;
@@ -47,7 +51,6 @@ function ScreenTextColor( { name } ) {
47
51
  className="edit-site-screen-text-color__control"
48
52
  colors={ colorsPerOrigin }
49
53
  disableCustomColors={ ! areCustomSolidsEnabled }
50
- __experimentalHasMultipleOrigins
51
54
  showTitle={ false }
52
55
  enableAlpha
53
56
  __experimentalIsRenderedInSidebar
@@ -17,6 +17,8 @@ import { NavigationButtonAsItem } from './navigation-button';
17
17
  import { useStyle } from './hooks';
18
18
  import Subtitle from './subtitle';
19
19
  import TypographyPanel from './typography-panel';
20
+ import BlockPreviewPanel from './block-preview-panel';
21
+ import { getVariationClassNameFromPath } from './utils';
20
22
 
21
23
  function Item( { name, parentMenu, element, label } ) {
22
24
  const hasSupport = ! name;
@@ -75,9 +77,9 @@ function Item( { name, parentMenu, element, label } ) {
75
77
  );
76
78
  }
77
79
 
78
- function ScreenTypography( { name } ) {
80
+ function ScreenTypography( { name, variationPath = '' } ) {
79
81
  const parentMenu = name === undefined ? '' : '/blocks/' + name;
80
-
82
+ const variationClassName = getVariationClassNameFromPath( variationPath );
81
83
  return (
82
84
  <>
83
85
  <ScreenHeader
@@ -87,6 +89,8 @@ function ScreenTypography( { name } ) {
87
89
  ) }
88
90
  />
89
91
 
92
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
93
+
90
94
  { ! name && (
91
95
  <div className="edit-site-global-styles-screen-typography">
92
96
  <VStack spacing={ 3 }>
@@ -121,7 +125,13 @@ function ScreenTypography( { name } ) {
121
125
  </div>
122
126
  ) }
123
127
  { /* No typography elements support yet for blocks. */ }
124
- { !! name && <TypographyPanel name={ name } element="text" /> }
128
+ { !! name && (
129
+ <TypographyPanel
130
+ name={ name }
131
+ variationPath={ variationPath }
132
+ element="text"
133
+ />
134
+ ) }
125
135
  </>
126
136
  );
127
137
  }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { __experimentalVStack as VStack } from '@wordpress/components';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import {
10
+ VariationPanel,
11
+ VariationsPanel,
12
+ useHasVariationsPanel,
13
+ } from './variations-panel';
14
+ import ScreenHeader from './header';
15
+ import BlockPreviewPanel from './block-preview-panel';
16
+ import Subtitle from './subtitle';
17
+
18
+ export function ScreenVariations( { name, path = '' } ) {
19
+ const hasVariationsPanel = useHasVariationsPanel( name, path );
20
+
21
+ if ( ! hasVariationsPanel ) {
22
+ return null;
23
+ }
24
+ return (
25
+ <div className="edit-site-global-styles-screen-variations">
26
+ <VStack spacing={ 3 }>
27
+ <p>Manage style variations, saved block appearence presets.</p>
28
+ <Subtitle>{ __( 'Style Variations' ) }</Subtitle>
29
+ <VariationsPanel name={ name } />
30
+ </VStack>
31
+ </div>
32
+ );
33
+ }
34
+
35
+ export function ScreenVariation( { blockName, style } ) {
36
+ const { name: styleName, label: styleLabel } = style;
37
+ return (
38
+ <>
39
+ <ScreenHeader title={ styleLabel } />
40
+ <BlockPreviewPanel
41
+ name={ blockName }
42
+ variation={ `is-style-${ styleName }` }
43
+ />
44
+ <VariationPanel blockName={ blockName } styleName={ styleName } />
45
+ </>
46
+ );
47
+ }
@@ -146,3 +146,12 @@ $block-preview-height: 150px;
146
146
  max-height: 200px;
147
147
  overflow-y: scroll;
148
148
  }
149
+
150
+ .edit-site-global-styles-screen-variations {
151
+ margin-top: $grid-unit-20;
152
+ border-top: 1px solid $gray-300;
153
+
154
+ & > * {
155
+ margin: $grid-unit-30 $grid-unit-20;
156
+ }
157
+ }