@wordpress/edit-site 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +3 -11
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +7 -7
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +1 -1
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/block-editor/editor-canvas.js +7 -10
  9. package/build/components/block-editor/editor-canvas.js.map +1 -1
  10. package/build/components/editor/index.js +6 -4
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/border-panel.js +35 -1
  13. package/build/components/global-styles/border-panel.js.map +1 -1
  14. package/build/components/global-styles/context-menu.js +8 -11
  15. package/build/components/global-styles/context-menu.js.map +1 -1
  16. package/build/components/global-styles/dimensions-panel.js +11 -1
  17. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  18. package/build/components/global-styles/effects-panel.js +53 -0
  19. package/build/components/global-styles/effects-panel.js.map +1 -0
  20. package/build/components/global-styles/filters-panel.js +45 -0
  21. package/build/components/global-styles/filters-panel.js.map +1 -0
  22. package/build/components/global-styles/global-styles-provider.js +7 -4
  23. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  24. package/build/components/global-styles/hooks.js +1 -58
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/preview.js +4 -5
  27. package/build/components/global-styles/preview.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +17 -12
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-colors.js +22 -211
  31. package/build/components/global-styles/screen-colors.js.map +1 -1
  32. package/build/components/global-styles/screen-css.js +1 -1
  33. package/build/components/global-styles/screen-css.js.map +1 -1
  34. package/build/components/global-styles/screen-effects.js +15 -7
  35. package/build/components/global-styles/screen-effects.js.map +1 -1
  36. package/build/components/global-styles/screen-filters.js +2 -2
  37. package/build/components/global-styles/screen-filters.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +8 -118
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/screen-typography-element.js +4 -0
  41. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  42. package/build/components/global-styles/screen-typography.js +5 -0
  43. package/build/components/global-styles/screen-typography.js.map +1 -1
  44. package/build/components/global-styles/style-variations-container.js +149 -0
  45. package/build/components/global-styles/style-variations-container.js.map +1 -0
  46. package/build/components/global-styles/ui.js +51 -37
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/global-styles-renderer/index.js +1 -2
  49. package/build/components/global-styles-renderer/index.js.map +1 -1
  50. package/build/components/header-edit-mode/more-menu/index.js +1 -1
  51. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  52. package/build/components/keyboard-shortcuts/index.js +0 -137
  53. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  54. package/build/components/layout/index.js +8 -1
  55. package/build/components/layout/index.js.map +1 -1
  56. package/build/components/preferences-modal/index.js +4 -0
  57. package/build/components/preferences-modal/index.js.map +1 -1
  58. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
  59. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  60. package/build/components/sidebar/index.js +4 -0
  61. package/build/components/sidebar/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen/index.js +8 -6
  63. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
  65. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  66. package/build/components/sidebar-navigation-screen-main/index.js +5 -0
  67. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  68. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
  69. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  70. package/build/components/site-hub/index.js +4 -3
  71. package/build/components/site-hub/index.js.map +1 -1
  72. package/build/components/start-template-options/index.js +44 -9
  73. package/build/components/start-template-options/index.js.map +1 -1
  74. package/build/components/style-book/index.js +6 -7
  75. package/build/components/style-book/index.js.map +1 -1
  76. package/build/components/welcome-guide/styles.js +1 -1
  77. package/build/components/welcome-guide/styles.js.map +1 -1
  78. package/build/hooks/commands/index.js +19 -0
  79. package/build/hooks/commands/index.js.map +1 -0
  80. package/build/hooks/commands/use-navigation-commands.js +117 -0
  81. package/build/hooks/commands/use-navigation-commands.js.map +1 -0
  82. package/build/hooks/commands/use-wp-admin-commands.js +94 -0
  83. package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
  84. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  85. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  86. package/build/hooks/template-part-edit.js +2 -1
  87. package/build/hooks/template-part-edit.js.map +1 -1
  88. package/build/index.js +2 -1
  89. package/build/index.js.map +1 -1
  90. package/build/store/selectors.js +2 -1
  91. package/build/store/selectors.js.map +1 -1
  92. package/build-module/components/add-new-template/new-template-part.js +3 -9
  93. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  94. package/build-module/components/add-new-template/new-template.js +7 -7
  95. package/build-module/components/add-new-template/new-template.js.map +1 -1
  96. package/build-module/components/add-new-template/utils.js +1 -1
  97. package/build-module/components/add-new-template/utils.js.map +1 -1
  98. package/build-module/components/block-editor/editor-canvas.js +8 -11
  99. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  100. package/build-module/components/editor/index.js +6 -4
  101. package/build-module/components/editor/index.js.map +1 -1
  102. package/build-module/components/global-styles/border-panel.js +34 -1
  103. package/build-module/components/global-styles/border-panel.js.map +1 -1
  104. package/build-module/components/global-styles/context-menu.js +8 -8
  105. package/build-module/components/global-styles/context-menu.js.map +1 -1
  106. package/build-module/components/global-styles/dimensions-panel.js +11 -1
  107. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  108. package/build-module/components/global-styles/effects-panel.js +43 -0
  109. package/build-module/components/global-styles/effects-panel.js.map +1 -0
  110. package/build-module/components/global-styles/filters-panel.js +35 -0
  111. package/build-module/components/global-styles/filters-panel.js.map +1 -0
  112. package/build-module/components/global-styles/global-styles-provider.js +8 -5
  113. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  114. package/build-module/components/global-styles/hooks.js +1 -52
  115. package/build-module/components/global-styles/hooks.js.map +1 -1
  116. package/build-module/components/global-styles/preview.js +4 -5
  117. package/build-module/components/global-styles/preview.js.map +1 -1
  118. package/build-module/components/global-styles/screen-block-list.js +16 -11
  119. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  120. package/build-module/components/global-styles/screen-colors.js +23 -208
  121. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  122. package/build-module/components/global-styles/screen-css.js +1 -1
  123. package/build-module/components/global-styles/screen-css.js.map +1 -1
  124. package/build-module/components/global-styles/screen-effects.js +13 -4
  125. package/build-module/components/global-styles/screen-effects.js.map +1 -1
  126. package/build-module/components/global-styles/screen-filters.js +2 -2
  127. package/build-module/components/global-styles/screen-filters.js.map +1 -1
  128. package/build-module/components/global-styles/screen-style-variations.js +11 -114
  129. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  130. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  131. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  132. package/build-module/components/global-styles/screen-typography.js +5 -0
  133. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  134. package/build-module/components/global-styles/style-variations-container.js +130 -0
  135. package/build-module/components/global-styles/style-variations-container.js.map +1 -0
  136. package/build-module/components/global-styles/ui.js +49 -33
  137. package/build-module/components/global-styles/ui.js.map +1 -1
  138. package/build-module/components/global-styles-renderer/index.js +1 -2
  139. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  140. package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
  141. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  142. package/build-module/components/keyboard-shortcuts/index.js +1 -135
  143. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  144. package/build-module/components/layout/index.js +6 -1
  145. package/build-module/components/layout/index.js.map +1 -1
  146. package/build-module/components/preferences-modal/index.js +4 -0
  147. package/build-module/components/preferences-modal/index.js.map +1 -1
  148. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
  149. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  150. package/build-module/components/sidebar/index.js +3 -0
  151. package/build-module/components/sidebar/index.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen/index.js +9 -7
  153. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  155. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  156. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
  157. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
  159. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  160. package/build-module/components/site-hub/index.js +3 -3
  161. package/build-module/components/site-hub/index.js.map +1 -1
  162. package/build-module/components/start-template-options/index.js +45 -10
  163. package/build-module/components/start-template-options/index.js.map +1 -1
  164. package/build-module/components/style-book/index.js +7 -8
  165. package/build-module/components/style-book/index.js.map +1 -1
  166. package/build-module/components/welcome-guide/styles.js +1 -1
  167. package/build-module/components/welcome-guide/styles.js.map +1 -1
  168. package/build-module/hooks/commands/index.js +10 -0
  169. package/build-module/hooks/commands/index.js.map +1 -0
  170. package/build-module/hooks/commands/use-navigation-commands.js +101 -0
  171. package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
  172. package/build-module/hooks/commands/use-wp-admin-commands.js +79 -0
  173. package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
  174. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  175. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  176. package/build-module/hooks/template-part-edit.js +2 -1
  177. package/build-module/hooks/template-part-edit.js.map +1 -1
  178. package/build-module/index.js +2 -1
  179. package/build-module/index.js.map +1 -1
  180. package/build-module/store/selectors.js +2 -1
  181. package/build-module/store/selectors.js.map +1 -1
  182. package/build-style/style-rtl.css +24 -63
  183. package/build-style/style.css +24 -63
  184. package/package.json +33 -31
  185. package/src/components/add-new-template/new-template-part.js +1 -6
  186. package/src/components/add-new-template/new-template.js +3 -6
  187. package/src/components/add-new-template/utils.js +1 -1
  188. package/src/components/block-editor/editor-canvas.js +13 -23
  189. package/src/components/editor/index.js +11 -3
  190. package/src/components/global-styles/border-panel.js +32 -1
  191. package/src/components/global-styles/context-menu.js +8 -8
  192. package/src/components/global-styles/dimensions-panel.js +11 -0
  193. package/src/components/global-styles/effects-panel.js +40 -0
  194. package/src/components/global-styles/filters-panel.js +33 -0
  195. package/src/components/global-styles/global-styles-provider.js +4 -4
  196. package/src/components/global-styles/hooks.js +1 -78
  197. package/src/components/global-styles/preview.js +2 -2
  198. package/src/components/global-styles/screen-block-list.js +11 -7
  199. package/src/components/global-styles/screen-colors.js +25 -229
  200. package/src/components/global-styles/screen-css.js +1 -1
  201. package/src/components/global-styles/screen-effects.js +12 -5
  202. package/src/components/global-styles/screen-filters.js +2 -2
  203. package/src/components/global-styles/screen-style-variations.js +10 -129
  204. package/src/components/global-styles/screen-typography-element.js +4 -0
  205. package/src/components/global-styles/screen-typography.js +6 -0
  206. package/src/components/global-styles/stories/index.js +425 -0
  207. package/src/components/global-styles/style-variations-container.js +136 -0
  208. package/src/components/global-styles/style.scss +4 -57
  209. package/src/components/global-styles/ui.js +50 -33
  210. package/src/components/global-styles-renderer/index.js +1 -2
  211. package/src/components/header-edit-mode/more-menu/index.js +1 -1
  212. package/src/components/keyboard-shortcuts/index.js +1 -155
  213. package/src/components/layout/index.js +4 -0
  214. package/src/components/preferences-modal/index.js +7 -0
  215. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
  216. package/src/components/sidebar/index.js +4 -0
  217. package/src/components/sidebar-navigation-screen/index.js +10 -5
  218. package/src/components/sidebar-navigation-screen/style.scss +20 -5
  219. package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  220. package/src/components/sidebar-navigation-screen-main/index.js +9 -1
  221. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
  222. package/src/components/site-hub/index.js +3 -3
  223. package/src/components/start-template-options/index.js +40 -8
  224. package/src/components/start-template-options/style.scss +7 -14
  225. package/src/components/style-book/index.js +10 -16
  226. package/src/components/style-book/style.scss +1 -1
  227. package/src/components/welcome-guide/styles.js +1 -1
  228. package/src/hooks/commands/index.js +10 -0
  229. package/src/hooks/commands/use-navigation-commands.js +103 -0
  230. package/src/hooks/commands/use-wp-admin-commands.js +77 -0
  231. package/src/hooks/push-changes-to-global-styles/index.js +1 -0
  232. package/src/hooks/template-part-edit.js +1 -0
  233. package/src/index.js +1 -0
  234. package/src/store/selectors.js +2 -1
  235. package/build/components/global-styles/color-utils.js +0 -17
  236. package/build/components/global-styles/color-utils.js.map +0 -1
  237. package/build/components/global-styles/duotone-panel.js +0 -78
  238. package/build/components/global-styles/duotone-panel.js.map +0 -1
  239. package/build/components/global-styles/filter-utils.js +0 -17
  240. package/build/components/global-styles/filter-utils.js.map +0 -1
  241. package/build/components/global-styles/screen-background-color.js +0 -114
  242. package/build/components/global-styles/screen-background-color.js.map +0 -1
  243. package/build/components/global-styles/screen-button-color.js +0 -88
  244. package/build/components/global-styles/screen-button-color.js.map +0 -1
  245. package/build/components/global-styles/screen-heading-color.js +0 -165
  246. package/build/components/global-styles/screen-heading-color.js.map +0 -1
  247. package/build/components/global-styles/screen-link-color.js +0 -105
  248. package/build/components/global-styles/screen-link-color.js.map +0 -1
  249. package/build/components/global-styles/screen-text-color.js +0 -71
  250. package/build/components/global-styles/screen-text-color.js.map +0 -1
  251. package/build/components/global-styles/shadow-panel.js +0 -197
  252. package/build/components/global-styles/shadow-panel.js.map +0 -1
  253. package/build-module/components/global-styles/color-utils.js +0 -9
  254. package/build-module/components/global-styles/color-utils.js.map +0 -1
  255. package/build-module/components/global-styles/duotone-panel.js +0 -67
  256. package/build-module/components/global-styles/duotone-panel.js.map +0 -1
  257. package/build-module/components/global-styles/filter-utils.js +0 -9
  258. package/build-module/components/global-styles/filter-utils.js.map +0 -1
  259. package/build-module/components/global-styles/screen-background-color.js +0 -97
  260. package/build-module/components/global-styles/screen-background-color.js.map +0 -1
  261. package/build-module/components/global-styles/screen-button-color.js +0 -73
  262. package/build-module/components/global-styles/screen-button-color.js.map +0 -1
  263. package/build-module/components/global-styles/screen-heading-color.js +0 -149
  264. package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
  265. package/build-module/components/global-styles/screen-link-color.js +0 -89
  266. package/build-module/components/global-styles/screen-link-color.js.map +0 -1
  267. package/build-module/components/global-styles/screen-text-color.js +0 -56
  268. package/build-module/components/global-styles/screen-text-color.js.map +0 -1
  269. package/build-module/components/global-styles/shadow-panel.js +0 -178
  270. package/build-module/components/global-styles/shadow-panel.js.map +0 -1
  271. package/src/components/global-styles/color-utils.js +0 -14
  272. package/src/components/global-styles/duotone-panel.js +0 -82
  273. package/src/components/global-styles/filter-utils.js +0 -9
  274. package/src/components/global-styles/screen-background-color.js +0 -132
  275. package/src/components/global-styles/screen-button-color.js +0 -104
  276. package/src/components/global-styles/screen-heading-color.js +0 -206
  277. package/src/components/global-styles/screen-link-color.js +0 -124
  278. package/src/components/global-styles/screen-text-color.js +0 -62
  279. package/src/components/global-styles/shadow-panel.js +0 -178
@@ -29,6 +29,10 @@ const elements = {
29
29
  description: __( 'Manage the fonts and typography used on headings.' ),
30
30
  title: __( 'Headings' ),
31
31
  },
32
+ caption: {
33
+ description: __( 'Manage the fonts and typography used on captions.' ),
34
+ title: __( 'Captions' ),
35
+ },
32
36
  button: {
33
37
  description: __( 'Manage the fonts and typography used on buttons.' ),
34
38
  title: __( 'Buttons' ),
@@ -129,6 +129,12 @@ function ScreenTypography( { name, variation = '' } ) {
129
129
  element="heading"
130
130
  label={ __( 'Headings' ) }
131
131
  />
132
+ <Item
133
+ name={ name }
134
+ parentMenu={ parentMenu }
135
+ element="caption"
136
+ label={ __( 'Captions' ) }
137
+ />
132
138
  <Item
133
139
  name={ name }
134
140
  parentMenu={ parentMenu }
@@ -0,0 +1,425 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
+ import { useMemo, useState } from '@wordpress/element';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { mergeBaseAndUserConfigs } from '../global-styles-provider';
11
+ import { default as GlobalStylesUIComponent } from '../ui';
12
+ import { unlock } from '../../../private-apis';
13
+
14
+ const { GlobalStylesContext, ExperimentalBlockEditorProvider } = unlock(
15
+ blockEditorPrivateApis
16
+ );
17
+
18
+ export default { title: 'EditSite/GlobalStylesUI' };
19
+
20
+ const BASE_SETTINGS = {
21
+ settings: {
22
+ appearanceTools: false,
23
+ useRootPaddingAwareAlignments: true,
24
+ border: {
25
+ color: true,
26
+ radius: true,
27
+ style: true,
28
+ width: true,
29
+ },
30
+ color: {
31
+ background: true,
32
+ custom: true,
33
+ customDuotone: true,
34
+ customGradient: true,
35
+ defaultDuotone: true,
36
+ defaultGradients: true,
37
+ defaultPalette: true,
38
+ duotone: {
39
+ default: [
40
+ {
41
+ name: 'Dark grayscale',
42
+ colors: [ '#000000', '#7f7f7f' ],
43
+ slug: 'dark-grayscale',
44
+ },
45
+ {
46
+ name: 'Grayscale',
47
+ colors: [ '#000000', '#ffffff' ],
48
+ slug: 'grayscale',
49
+ },
50
+ {
51
+ name: 'Purple and yellow',
52
+ colors: [ '#8c00b7', '#fcff41' ],
53
+ slug: 'purple-yellow',
54
+ },
55
+ {
56
+ name: 'Blue and red',
57
+ colors: [ '#000097', '#ff4747' ],
58
+ slug: 'blue-red',
59
+ },
60
+ {
61
+ name: 'Midnight',
62
+ colors: [ '#000000', '#00a5ff' ],
63
+ slug: 'midnight',
64
+ },
65
+ {
66
+ name: 'Magenta and yellow',
67
+ colors: [ '#c7005a', '#fff278' ],
68
+ slug: 'magenta-yellow',
69
+ },
70
+ {
71
+ name: 'Purple and green',
72
+ colors: [ '#a60072', '#67ff66' ],
73
+ slug: 'purple-green',
74
+ },
75
+ {
76
+ name: 'Blue and orange',
77
+ colors: [ '#1900d8', '#ffa96b' ],
78
+ slug: 'blue-orange',
79
+ },
80
+ ],
81
+ },
82
+ gradients: {
83
+ default: [
84
+ {
85
+ name: 'Vivid cyan blue to vivid purple',
86
+ gradient:
87
+ 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
88
+ slug: 'vivid-cyan-blue-to-vivid-purple',
89
+ },
90
+ {
91
+ name: 'Light green cyan to vivid green cyan',
92
+ gradient:
93
+ 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',
94
+ slug: 'light-green-cyan-to-vivid-green-cyan',
95
+ },
96
+ {
97
+ name: 'Luminous vivid amber to luminous vivid orange',
98
+ gradient:
99
+ 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',
100
+ slug: 'luminous-vivid-amber-to-luminous-vivid-orange',
101
+ },
102
+ {
103
+ name: 'Luminous vivid orange to vivid red',
104
+ gradient:
105
+ 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',
106
+ slug: 'luminous-vivid-orange-to-vivid-red',
107
+ },
108
+ {
109
+ name: 'Very light gray to cyan bluish gray',
110
+ gradient:
111
+ 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',
112
+ slug: 'very-light-gray-to-cyan-bluish-gray',
113
+ },
114
+ {
115
+ name: 'Cool to warm spectrum',
116
+ gradient:
117
+ 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',
118
+ slug: 'cool-to-warm-spectrum',
119
+ },
120
+ {
121
+ name: 'Blush light purple',
122
+ gradient:
123
+ 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',
124
+ slug: 'blush-light-purple',
125
+ },
126
+ {
127
+ name: 'Blush bordeaux',
128
+ gradient:
129
+ 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',
130
+ slug: 'blush-bordeaux',
131
+ },
132
+ {
133
+ name: 'Luminous dusk',
134
+ gradient:
135
+ 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',
136
+ slug: 'luminous-dusk',
137
+ },
138
+ {
139
+ name: 'Pale ocean',
140
+ gradient:
141
+ 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',
142
+ slug: 'pale-ocean',
143
+ },
144
+ {
145
+ name: 'Electric grass',
146
+ gradient:
147
+ 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',
148
+ slug: 'electric-grass',
149
+ },
150
+ {
151
+ name: 'Midnight',
152
+ gradient:
153
+ 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',
154
+ slug: 'midnight',
155
+ },
156
+ ],
157
+ },
158
+ link: true,
159
+ palette: {
160
+ default: [
161
+ {
162
+ name: 'Black',
163
+ slug: 'black',
164
+ color: '#000000',
165
+ },
166
+ {
167
+ name: 'Cyan bluish gray',
168
+ slug: 'cyan-bluish-gray',
169
+ color: '#abb8c3',
170
+ },
171
+ {
172
+ name: 'White',
173
+ slug: 'white',
174
+ color: '#ffffff',
175
+ },
176
+ {
177
+ name: 'Pale pink',
178
+ slug: 'pale-pink',
179
+ color: '#f78da7',
180
+ },
181
+ {
182
+ name: 'Vivid red',
183
+ slug: 'vivid-red',
184
+ color: '#cf2e2e',
185
+ },
186
+ {
187
+ name: 'Luminous vivid orange',
188
+ slug: 'luminous-vivid-orange',
189
+ color: '#ff6900',
190
+ },
191
+ {
192
+ name: 'Luminous vivid amber',
193
+ slug: 'luminous-vivid-amber',
194
+ color: '#fcb900',
195
+ },
196
+ {
197
+ name: 'Light green cyan',
198
+ slug: 'light-green-cyan',
199
+ color: '#7bdcb5',
200
+ },
201
+ {
202
+ name: 'Vivid green cyan',
203
+ slug: 'vivid-green-cyan',
204
+ color: '#00d084',
205
+ },
206
+ {
207
+ name: 'Pale cyan blue',
208
+ slug: 'pale-cyan-blue',
209
+ color: '#8ed1fc',
210
+ },
211
+ {
212
+ name: 'Vivid cyan blue',
213
+ slug: 'vivid-cyan-blue',
214
+ color: '#0693e3',
215
+ },
216
+ {
217
+ name: 'Vivid purple',
218
+ slug: 'vivid-purple',
219
+ color: '#9b51e0',
220
+ },
221
+ ],
222
+ theme: [
223
+ {
224
+ color: '#ffffff',
225
+ name: 'Base',
226
+ slug: 'base',
227
+ },
228
+ {
229
+ color: '#000000',
230
+ name: 'Contrast',
231
+ slug: 'contrast',
232
+ },
233
+ {
234
+ color: '#9DFF20',
235
+ name: 'Primary',
236
+ slug: 'primary',
237
+ },
238
+ {
239
+ color: '#345C00',
240
+ name: 'Secondary',
241
+ slug: 'secondary',
242
+ },
243
+ {
244
+ color: '#F6F6F6',
245
+ name: 'Tertiary',
246
+ slug: 'tertiary',
247
+ },
248
+ ],
249
+ },
250
+ text: true,
251
+ },
252
+ shadow: {
253
+ defaultPresets: true,
254
+ presets: {
255
+ default: [
256
+ {
257
+ name: 'Natural',
258
+ slug: 'natural',
259
+ shadow: '6px 6px 9px rgba(0, 0, 0, 0.2)',
260
+ },
261
+ {
262
+ name: 'Deep',
263
+ slug: 'deep',
264
+ shadow: '12px 12px 50px rgba(0, 0, 0, 0.4)',
265
+ },
266
+ {
267
+ name: 'Sharp',
268
+ slug: 'sharp',
269
+ shadow: '6px 6px 0px rgba(0, 0, 0, 0.2)',
270
+ },
271
+ {
272
+ name: 'Outlined',
273
+ slug: 'outlined',
274
+ shadow: '6px 6px 0px -3px rgba(255, 255, 255, 1), 6px 6px rgba(0, 0, 0, 1)',
275
+ },
276
+ {
277
+ name: 'Crisp',
278
+ slug: 'crisp',
279
+ shadow: '6px 6px 0px rgba(0, 0, 0, 1)',
280
+ },
281
+ ],
282
+ },
283
+ },
284
+ layout: {
285
+ contentSize: '650px',
286
+ wideSize: '1200px',
287
+ },
288
+ spacing: {
289
+ blockGap: true,
290
+ margin: true,
291
+ padding: true,
292
+ customSpacingSize: true,
293
+ units: [ '%', 'px', 'em', 'rem', 'vh', 'vw' ],
294
+ spacingScale: {
295
+ operator: '*',
296
+ increment: 1.5,
297
+ steps: 0,
298
+ mediumStep: 1.5,
299
+ unit: 'rem',
300
+ },
301
+ spacingSizes: {
302
+ theme: [
303
+ {
304
+ size: 'clamp(1.5rem, 5vw, 2rem)',
305
+ slug: '30',
306
+ name: '1',
307
+ },
308
+ {
309
+ size: 'clamp(1.8rem, 1.8rem + ((1vw - 0.48rem) * 2.885), 3rem)',
310
+ slug: '40',
311
+ name: '2',
312
+ },
313
+ {
314
+ size: 'clamp(2.5rem, 8vw, 4.5rem)',
315
+ slug: '50',
316
+ name: '3',
317
+ },
318
+ {
319
+ size: 'clamp(3.75rem, 10vw, 7rem)',
320
+ slug: '60',
321
+ name: '4',
322
+ },
323
+ {
324
+ size: 'clamp(5rem, 5.25rem + ((1vw - 0.48rem) * 9.096), 8rem)',
325
+ slug: '70',
326
+ name: '5',
327
+ },
328
+ {
329
+ size: 'clamp(7rem, 14vw, 11rem)',
330
+ slug: '80',
331
+ name: '6',
332
+ },
333
+ ],
334
+ },
335
+ },
336
+ typography: {
337
+ customFontSize: true,
338
+ dropCap: false,
339
+ fontSizes: {
340
+ default: [
341
+ {
342
+ name: 'Small',
343
+ slug: 'small',
344
+ size: '13px',
345
+ },
346
+ {
347
+ name: 'Medium',
348
+ slug: 'medium',
349
+ size: '20px',
350
+ },
351
+ {
352
+ name: 'Large',
353
+ slug: 'large',
354
+ size: '36px',
355
+ },
356
+ {
357
+ name: 'Extra Large',
358
+ slug: 'x-large',
359
+ size: '42px',
360
+ },
361
+ ],
362
+ },
363
+ fontStyle: true,
364
+ fontWeight: true,
365
+ letterSpacing: true,
366
+ lineHeight: true,
367
+ textColumns: false,
368
+ textDecoration: true,
369
+ textTransform: true,
370
+ fluid: true,
371
+ fontFamilies: {
372
+ theme: [
373
+ {
374
+ fontFamily:
375
+ '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
376
+ name: 'System Font',
377
+ slug: 'system-font',
378
+ },
379
+ ],
380
+ },
381
+ },
382
+ dimensions: {
383
+ minHeight: true,
384
+ },
385
+ position: {
386
+ fixed: true,
387
+ sticky: true,
388
+ },
389
+ },
390
+ styles: {
391
+ blocks: {},
392
+ elements: {},
393
+ },
394
+ };
395
+
396
+ export const GlobalStylesUI = () => {
397
+ const [ userGlobalStyles, setUserStyles ] = useState( {
398
+ settings: {},
399
+ styles: {},
400
+ } );
401
+ const context = useMemo( () => {
402
+ return {
403
+ isReady: true,
404
+ user: userGlobalStyles,
405
+ base: BASE_SETTINGS,
406
+ merged: mergeBaseAndUserConfigs( BASE_SETTINGS, userGlobalStyles ),
407
+ setUserConfig: setUserStyles,
408
+ };
409
+ }, [ userGlobalStyles, setUserStyles ] );
410
+ const wrapperStyle = {
411
+ width: 280,
412
+ };
413
+ return (
414
+ <ExperimentalBlockEditorProvider>
415
+ <GlobalStylesContext.Provider value={ context }>
416
+ <div style={ wrapperStyle }>
417
+ <GlobalStylesUIComponent
418
+ isStyleBookOpened={ false }
419
+ onCloseStyleBook={ () => {} }
420
+ />
421
+ </div>
422
+ </GlobalStylesContext.Provider>
423
+ </ExperimentalBlockEditorProvider>
424
+ );
425
+ };
@@ -0,0 +1,136 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+ import fastDeepEqual from 'fast-deep-equal/es6';
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, useState } from '@wordpress/element';
13
+ import { ENTER } from '@wordpress/keycodes';
14
+ import { __experimentalGrid as Grid } from '@wordpress/components';
15
+ import { __ } from '@wordpress/i18n';
16
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ import { mergeBaseAndUserConfigs } from './global-styles-provider';
22
+ import StylesPreview from './preview';
23
+ import { unlock } from '../../private-apis';
24
+
25
+ const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
26
+
27
+ function compareVariations( a, b ) {
28
+ return (
29
+ fastDeepEqual( a.styles, b.styles ) &&
30
+ fastDeepEqual( a.settings, b.settings )
31
+ );
32
+ }
33
+
34
+ function Variation( { variation } ) {
35
+ const [ isFocused, setIsFocused ] = useState( false );
36
+ const { base, user, setUserConfig } = useContext( GlobalStylesContext );
37
+ const context = useMemo( () => {
38
+ return {
39
+ user: {
40
+ settings: variation.settings ?? {},
41
+ styles: variation.styles ?? {},
42
+ },
43
+ base,
44
+ merged: mergeBaseAndUserConfigs( base, variation ),
45
+ setUserConfig: () => {},
46
+ };
47
+ }, [ variation, base ] );
48
+
49
+ const selectVariation = () => {
50
+ setUserConfig( () => {
51
+ return {
52
+ settings: variation.settings,
53
+ styles: variation.styles,
54
+ };
55
+ } );
56
+ };
57
+
58
+ const selectOnEnter = ( event ) => {
59
+ if ( event.keyCode === ENTER ) {
60
+ event.preventDefault();
61
+ selectVariation();
62
+ }
63
+ };
64
+
65
+ const isActive = useMemo( () => {
66
+ return compareVariations( user, variation );
67
+ }, [ user, variation ] );
68
+
69
+ return (
70
+ <GlobalStylesContext.Provider value={ context }>
71
+ <div
72
+ className={ classnames(
73
+ 'edit-site-global-styles-variations_item',
74
+ {
75
+ 'is-active': isActive,
76
+ }
77
+ ) }
78
+ role="button"
79
+ onClick={ selectVariation }
80
+ onKeyDown={ selectOnEnter }
81
+ tabIndex="0"
82
+ aria-label={ variation?.title }
83
+ aria-current={ isActive }
84
+ onFocus={ () => setIsFocused( true ) }
85
+ onBlur={ () => setIsFocused( false ) }
86
+ >
87
+ <div className="edit-site-global-styles-variations_item-preview">
88
+ <StylesPreview
89
+ label={ variation?.title }
90
+ isFocused={ isFocused }
91
+ withHoverView
92
+ />
93
+ </div>
94
+ </div>
95
+ </GlobalStylesContext.Provider>
96
+ );
97
+ }
98
+
99
+ export default function StyleVariationsContainer() {
100
+ const { variations } = useSelect( ( select ) => {
101
+ return {
102
+ variations:
103
+ select(
104
+ coreStore
105
+ ).__experimentalGetCurrentThemeGlobalStylesVariations() || [],
106
+ };
107
+ }, [] );
108
+
109
+ const withEmptyVariation = useMemo( () => {
110
+ return [
111
+ {
112
+ title: __( 'Default' ),
113
+ settings: {},
114
+ styles: {},
115
+ },
116
+ ...variations.map( ( variation ) => ( {
117
+ ...variation,
118
+ settings: variation.settings ?? {},
119
+ styles: variation.styles ?? {},
120
+ } ) ),
121
+ ];
122
+ }, [ variations ] );
123
+
124
+ return (
125
+ <>
126
+ <Grid
127
+ columns={ 2 }
128
+ className="edit-site-global-styles-style-variations-container"
129
+ >
130
+ { withEmptyVariation?.map( ( variation, index ) => (
131
+ <Variation key={ index } variation={ variation } />
132
+ ) ) }
133
+ </Grid>
134
+ </>
135
+ );
136
+ }
@@ -27,7 +27,6 @@
27
27
  max-width: 100%;
28
28
  }
29
29
 
30
- .edit-site-global-styles-screen-heading-color,
31
30
  .edit-site-global-styles-screen-typography,
32
31
  .edit-site-global-styles-screen-css {
33
32
  margin: $grid-unit-20;
@@ -46,10 +45,10 @@
46
45
  .edit-site-global-styles-screen-colors {
47
46
  margin: $grid-unit-20;
48
47
 
49
- .component-color-indicator {
50
- // Show a diagonal line (crossed out) for empty swatches.
51
- background: $white linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
52
- flex-shrink: 0;
48
+ .color-block-support-panel {
49
+ padding-left: 0;
50
+ padding-right: 0;
51
+ border-top: none;
53
52
  }
54
53
  }
55
54
 
@@ -84,13 +83,6 @@
84
83
  margin: 0;
85
84
  }
86
85
 
87
- .edit-site-screen-text-color__control,
88
- .edit-site-screen-link-color__control,
89
- .edit-site-screen-button-color__control,
90
- .edit-site-screen-background-color__control.has-no-tabs {
91
- padding: $grid-unit-20;
92
- }
93
-
94
86
  .edit-site-global-styles-variations_item {
95
87
  box-sizing: border-box;
96
88
 
@@ -123,12 +115,6 @@
123
115
  flex-shrink: 0;
124
116
  }
125
117
 
126
- .edit-site-global-styles__color-label {
127
- white-space: nowrap;
128
- overflow: hidden;
129
- text-overflow: ellipsis;
130
- }
131
-
132
118
  .edit-site-global-styles__block-preview-panel {
133
119
  position: relative;
134
120
  width: 100%;
@@ -203,45 +189,6 @@
203
189
  flex-direction: column;
204
190
  }
205
191
 
206
- .edit-site-global-styles__shadow-panel {
207
- width: 230px;
208
- }
209
-
210
- .edit-site-global-styles__shadow-dropdown {
211
- display: block;
212
- padding: 0;
213
-
214
- > button {
215
- width: 100%;
216
- padding: $grid-unit-10;
217
-
218
- &.is-open {
219
- background-color: $gray-100;
220
- }
221
- }
222
- }
223
-
224
- // wrapper to clip the shadow beyond 6px
225
- .edit-site-global-styles__shadow-indicator-wrapper {
226
- padding: 6px;
227
- overflow: hidden;
228
- display: flex;
229
- align-items: center;
230
- justify-content: center;
231
- }
232
-
233
- // These styles are similar to the color palette.
234
- .edit-site-global-styles__shadow-indicator {
235
- color: $gray-800;
236
- border: $gray-200 $border-width solid;
237
- border-radius: $radius-block-ui;
238
- cursor: pointer;
239
- padding: 0;
240
-
241
- height: 24px;
242
- width: 24px;
243
- }
244
-
245
192
  .edit-site-global-styles-screen-root.edit-site-global-styles-screen-root,
246
193
  .edit-site-global-styles-screen-style-variations.edit-site-global-styles-screen-style-variations {
247
194
  background: unset;