@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
@@ -5,7 +5,8 @@ import { createElement, Fragment } from "@wordpress/element";
5
5
  * WordPress dependencies
6
6
  */
7
7
  import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalUseNavigator as useNavigator } from '@wordpress/components';
8
- import { getBlockTypes } from '@wordpress/blocks';
8
+ import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
9
+ import { useSelect } from '@wordpress/data';
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
@@ -24,6 +25,7 @@ import ScreenHeadingColor from './screen-heading-color';
24
25
  import ScreenButtonColor from './screen-button-color';
25
26
  import ScreenLayout from './screen-layout';
26
27
  import ScreenStyleVariations from './screen-style-variations';
28
+ import { ScreenVariation } from './screen-variations';
27
29
  import ScreenBorder from './screen-border';
28
30
  import StyleBook from '../style-book';
29
31
  import ScreenCSS from './screen-css';
@@ -38,15 +40,61 @@ function GlobalStylesNavigationScreen(_ref) {
38
40
  }, props));
39
41
  }
40
42
 
41
- function ContextScreens(_ref2) {
43
+ function BlockStyleVariationsScreens(_ref2) {
42
44
  let {
43
45
  name
44
46
  } = _ref2;
45
- const parentMenu = name === undefined ? '' : '/blocks/' + encodeURIComponent(name);
47
+ const blockStyleVariations = useSelect(select => {
48
+ const {
49
+ getBlockStyles
50
+ } = select(blocksStore);
51
+ return getBlockStyles(name);
52
+ }, [name]);
53
+
54
+ if (!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length)) {
55
+ return null;
56
+ }
57
+
58
+ return blockStyleVariations.map(variation => createElement(ContextScreens, {
59
+ key: variation.name + name,
60
+ name: name,
61
+ parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name)
62
+ }));
63
+ }
64
+
65
+ function ContextScreens(_ref3) {
66
+ let {
67
+ name,
68
+ parentMenu = ''
69
+ } = _ref3;
70
+ const hasVariationPath = parentMenu.search('variations');
71
+ const variationPath = hasVariationPath !== -1 ? parentMenu.substring(hasVariationPath).replace('/', '.').concat('', '.') : '';
72
+ const blockStyleVariations = useSelect(select => {
73
+ const {
74
+ getBlockStyles
75
+ } = select(blocksStore);
76
+ return getBlockStyles(name);
77
+ }, [name]);
78
+
79
+ const BlockStylesNavigationScreens = _ref4 => {
80
+ let {
81
+ blockStyles,
82
+ blockName
83
+ } = _ref4;
84
+ return blockStyles.map((style, index) => createElement(GlobalStylesNavigationScreen, {
85
+ key: index,
86
+ path: parentMenu + '/variations/' + style.name
87
+ }, createElement(ScreenVariation, {
88
+ blockName: blockName,
89
+ style: style
90
+ })));
91
+ };
92
+
46
93
  return createElement(Fragment, null, createElement(GlobalStylesNavigationScreen, {
47
94
  path: parentMenu + '/typography'
48
95
  }, createElement(ScreenTypography, {
49
- name: name
96
+ name: name,
97
+ variationPath: variationPath
50
98
  })), createElement(GlobalStylesNavigationScreen, {
51
99
  path: parentMenu + '/typography/text'
52
100
  }, createElement(ScreenTypographyElement, {
@@ -70,7 +118,8 @@ function ContextScreens(_ref2) {
70
118
  })), createElement(GlobalStylesNavigationScreen, {
71
119
  path: parentMenu + '/colors'
72
120
  }, createElement(ScreenColors, {
73
- name: name
121
+ name: name,
122
+ variationPath: variationPath
74
123
  })), createElement(GlobalStylesNavigationScreen, {
75
124
  path: parentMenu + '/colors/palette'
76
125
  }, createElement(ScreenColorPalette, {
@@ -78,38 +127,48 @@ function ContextScreens(_ref2) {
78
127
  })), createElement(GlobalStylesNavigationScreen, {
79
128
  path: parentMenu + '/colors/background'
80
129
  }, createElement(ScreenBackgroundColor, {
81
- name: name
130
+ name: name,
131
+ variationPath: variationPath
82
132
  })), createElement(GlobalStylesNavigationScreen, {
83
133
  path: parentMenu + '/colors/text'
84
134
  }, createElement(ScreenTextColor, {
85
- name: name
135
+ name: name,
136
+ variationPath: variationPath
86
137
  })), createElement(GlobalStylesNavigationScreen, {
87
138
  path: parentMenu + '/colors/link'
88
139
  }, createElement(ScreenLinkColor, {
89
- name: name
140
+ name: name,
141
+ variationPath: variationPath
90
142
  })), createElement(GlobalStylesNavigationScreen, {
91
143
  path: parentMenu + '/colors/heading'
92
144
  }, createElement(ScreenHeadingColor, {
93
- name: name
145
+ name: name,
146
+ variationPath: variationPath
94
147
  })), createElement(GlobalStylesNavigationScreen, {
95
148
  path: parentMenu + '/colors/button'
96
149
  }, createElement(ScreenButtonColor, {
97
- name: name
150
+ name: name,
151
+ variationPath: variationPath
98
152
  })), createElement(GlobalStylesNavigationScreen, {
99
153
  path: parentMenu + '/border'
100
154
  }, createElement(ScreenBorder, {
101
- name: name
155
+ name: name,
156
+ variationPath: variationPath
102
157
  })), createElement(GlobalStylesNavigationScreen, {
103
158
  path: parentMenu + '/layout'
104
159
  }, createElement(ScreenLayout, {
105
- name: name
106
- })));
160
+ name: name,
161
+ variationPath: variationPath
162
+ })), !!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) && createElement(BlockStylesNavigationScreens, {
163
+ blockStyles: blockStyleVariations,
164
+ blockName: name
165
+ }));
107
166
  }
108
167
 
109
- function GlobalStylesStyleBook(_ref3) {
168
+ function GlobalStylesStyleBook(_ref5) {
110
169
  let {
111
170
  onClose
112
- } = _ref3;
171
+ } = _ref5;
113
172
  const navigator = useNavigator();
114
173
  const {
115
174
  path
@@ -134,11 +193,11 @@ function GlobalStylesStyleBook(_ref3) {
134
193
  });
135
194
  }
136
195
 
137
- function GlobalStylesUI(_ref4) {
196
+ function GlobalStylesUI(_ref6) {
138
197
  let {
139
198
  isStyleBookOpened,
140
199
  onCloseStyleBook
141
- } = _ref4;
200
+ } = _ref6;
142
201
  const blocks = getBlockTypes();
143
202
  return createElement(NavigatorProvider, {
144
203
  className: "edit-site-global-styles-sidebar__navigator-provider",
@@ -156,8 +215,14 @@ function GlobalStylesUI(_ref4) {
156
215
  name: block.name
157
216
  }))), createElement(ContextScreens, null), blocks.map(block => createElement(ContextScreens, {
158
217
  key: 'screens-block-' + block.name,
159
- name: block.name
160
- })), isStyleBookOpened && createElement(GlobalStylesStyleBook, {
218
+ name: block.name,
219
+ parentMenu: '/blocks/' + encodeURIComponent(block.name)
220
+ })), blocks.map((block, index) => {
221
+ return createElement(BlockStyleVariationsScreens, {
222
+ key: 'screens-block-styles-' + block.name + index,
223
+ name: block.name
224
+ });
225
+ }), isStyleBookOpened && createElement(GlobalStylesStyleBook, {
161
226
  onClose: onCloseStyleBook
162
227
  }), createElement(GlobalStylesNavigationScreen, {
163
228
  path: "/css"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","__experimentalUseNavigator","useNavigator","getBlockTypes","ScreenRoot","ScreenBlockList","ScreenBlock","ScreenTypography","ScreenTypographyElement","ScreenColors","ScreenColorPalette","ScreenBackgroundColor","ScreenTextColor","ScreenLinkColor","ScreenHeadingColor","ScreenButtonColor","ScreenLayout","ScreenStyleVariations","ScreenBorder","StyleBook","ScreenCSS","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","ContextScreens","name","parentMenu","undefined","encodeURIComponent","GlobalStylesStyleBook","onClose","navigator","path","location","blockName","startsWith","depth","match","length","i","goBack","goTo","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","map","block"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,uBAJP;AAKA,SAASC,aAAT,QAA8B,mBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,OAAOC,uBAAP,MAAoC,6BAApC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,SAAP,MAAsB,cAAtB;;AAEA,SAASC,4BAAT,OAAiE;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AAChE,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAG,CACX,mDADW,EAEXD,SAFW,EAIVE,MAJU,CAIFC,OAJE,EAKVC,IALU,CAKJ,GALI;AADb,KAOMH,KAPN,EADD;AAWA;;AAED,SAASI,cAAT,QAAoC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnC,QAAM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;AAFd,IADC,CA3BH,EAkCGkB,iBAAiB,IAClB,cAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IAnCF,EAqCC,cAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,cAAC,SAAD,OADD,CArCD,CADD;AA2CA;;AAED,eAAeF,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ContextScreens( { name } ) {\n\tconst parentMenu =\n\t\tname === undefined ? '' : '/blocks/' + encodeURIComponent( name );\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","__experimentalUseNavigator","useNavigator","getBlockTypes","store","blocksStore","useSelect","ScreenRoot","ScreenBlockList","ScreenBlock","ScreenTypography","ScreenTypographyElement","ScreenColors","ScreenColorPalette","ScreenBackgroundColor","ScreenTextColor","ScreenLinkColor","ScreenHeadingColor","ScreenButtonColor","ScreenLayout","ScreenStyleVariations","ScreenVariation","ScreenBorder","StyleBook","ScreenCSS","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","select","getBlockStyles","length","map","variation","encodeURIComponent","ContextScreens","parentMenu","hasVariationPath","search","variationPath","substring","replace","concat","BlockStylesNavigationScreens","blockStyles","blockName","style","index","GlobalStylesStyleBook","onClose","navigator","path","location","startsWith","depth","match","i","goBack","goTo","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","block"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,uBAJP;AAKA,SAASC,aAAT,EAAwBC,KAAK,IAAIC,WAAjC,QAAoD,mBAApD;AAEA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,OAAOC,uBAAP,MAAoC,6BAApC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,SAAP,MAAsB,cAAtB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,GAAuCoB,KAD9C;AAEC,MAAA,IAAI,EAAGgB,KAAK,CAACpC;AAFd,MADD;AAMA,GAPC,CAnCH,EA2CGiC,iBAAiB,IAClB,cAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IA5CF,EA8CC,cAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,cAAC,SAAD,OADD,CA9CD,CADD;AAoDA;;AAED,eAAeF,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport { ScreenVariation } from './screen-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStyleVariationsScreens( { name } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tif ( ! blockStyleVariations?.length ) {\n\t\treturn null;\n\t}\n\n\treturn blockStyleVariations.map( ( variation ) => (\n\t\t<ContextScreens\n\t\t\tkey={ variation.name + name }\n\t\t\tname={ name }\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( variation.name )\n\t\t\t}\n\t\t/>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '' } ) {\n\tconst hasVariationPath = parentMenu.search( 'variations' );\n\tconst variationPath =\n\t\thasVariationPath !== -1\n\t\t\t? parentMenu\n\t\t\t\t\t.substring( hasVariationPath )\n\t\t\t\t\t.replace( '/', '.' )\n\t\t\t\t\t.concat( '', '.' )\n\t\t\t: '';\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\tconst BlockStylesNavigationScreens = ( { blockStyles, blockName } ) => {\n\t\treturn blockStyles.map( ( style, index ) => (\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tkey={ index }\n\t\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t\t>\n\t\t\t\t<ScreenVariation blockName={ blockName } style={ style } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t) );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ blocks.map( ( block, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockStyleVariationsScreens\n\t\t\t\t\t\tkey={ 'screens-block-styles-' + block.name + index }\n\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
@@ -3,12 +3,12 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { get, isEmpty, kebabCase, pickBy, set } from 'lodash';
6
+ import { get, isEmpty, kebabCase, set } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, __EXPERIMENTAL_ELEMENTS as ELEMENTS, getBlockTypes } from '@wordpress/blocks';
11
+ import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, __EXPERIMENTAL_ELEMENTS as ELEMENTS, getBlockTypes, store as blocksStore } from '@wordpress/blocks';
12
12
  import { useSelect } from '@wordpress/data';
13
13
  import { useContext, useMemo } from '@wordpress/element';
14
14
  import { getCSSRules } from '@wordpress/style-engine';
@@ -156,6 +156,25 @@ function flattenTree() {
156
156
  });
157
157
  return result;
158
158
  }
159
+ /**
160
+ * Gets variation selector string from feature selector.
161
+ *
162
+ * @param {string} featureSelector The feature selector.
163
+ *
164
+ * @param {string} styleVariationSelector The style variation selector.
165
+ * @return {string} Combined selector string.
166
+ *
167
+ */
168
+
169
+
170
+ function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
171
+ const featureSelectors = featureSelector.split(',');
172
+ const combinedSelectors = [];
173
+ featureSelectors.forEach(selector => {
174
+ combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`);
175
+ });
176
+ return combinedSelectors.join(', ');
177
+ }
159
178
  /**
160
179
  * Transform given style tree into a set of style declarations.
161
180
  *
@@ -395,7 +414,10 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
395
414
  return nodes;
396
415
  }
397
416
 
398
- const pickStyleKeys = treeToPickFrom => pickBy(treeToPickFrom, (value, key) => ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key)); // Top-level.
417
+ const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref11 => {
418
+ let [key] = _ref11;
419
+ return ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key);
420
+ })); // Top-level.
399
421
 
400
422
 
401
423
  const styles = pickStyleKeys(tree.styles);
@@ -407,10 +429,10 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
407
429
  });
408
430
  }
409
431
 
410
- Object.entries(ELEMENTS).forEach(_ref11 => {
432
+ Object.entries(ELEMENTS).forEach(_ref12 => {
411
433
  var _tree$styles;
412
434
 
413
- let [name, selector] = _ref11;
435
+ let [name, selector] = _ref12;
414
436
 
415
437
  if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && _tree$styles.elements[name])) {
416
438
  var _tree$styles2;
@@ -422,12 +444,20 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
422
444
  }
423
445
  }); // Iterate over blocks: they can have styles & elements.
424
446
 
425
- Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref12 => {
447
+ Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref13 => {
426
448
  var _blockSelectors$block, _node$elements;
427
449
 
428
- let [blockName, node] = _ref12;
450
+ let [blockName, node] = _ref13;
429
451
  const blockStyles = pickStyleKeys(node);
430
452
 
453
+ if (node !== null && node !== void 0 && node.variations) {
454
+ const variations = {};
455
+ Object.keys(node.variations).forEach(variation => {
456
+ variations[variation] = pickStyleKeys(node.variations[variation]);
457
+ });
458
+ blockStyles.variations = variations;
459
+ }
460
+
431
461
  if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
432
462
  nodes.push({
433
463
  duotoneSelector: blockSelectors[blockName].duotoneSelector,
@@ -435,12 +465,13 @@ export const getNodesWithStyles = (tree, blockSelectors) => {
435
465
  hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
436
466
  selector: blockSelectors[blockName].selector,
437
467
  styles: blockStyles,
438
- featureSelectors: blockSelectors[blockName].featureSelectors
468
+ featureSelectors: blockSelectors[blockName].featureSelectors,
469
+ styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
439
470
  });
440
471
  }
441
472
 
442
- Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref13 => {
443
- let [elementName, value] = _ref13;
473
+ Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref14 => {
474
+ let [elementName, value] = _ref14;
444
475
 
445
476
  if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(ELEMENTS !== null && ELEMENTS !== void 0 && ELEMENTS[elementName])) {
446
477
  nodes.push({
@@ -466,10 +497,10 @@ export const getNodesWithSettings = (tree, blockSelectors) => {
466
497
 
467
498
  const pickPresets = treeToPickFrom => {
468
499
  const presets = {};
469
- PRESET_METADATA.forEach(_ref14 => {
500
+ PRESET_METADATA.forEach(_ref15 => {
470
501
  let {
471
502
  path
472
- } = _ref14;
503
+ } = _ref15;
473
504
  const value = get(treeToPickFrom, path, false);
474
505
 
475
506
  if (value !== false) {
@@ -492,8 +523,8 @@ export const getNodesWithSettings = (tree, blockSelectors) => {
492
523
  } // Blocks.
493
524
 
494
525
 
495
- Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref15 => {
496
- let [blockName, node] = _ref15;
526
+ Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref16 => {
527
+ let [blockName, node] = _ref16;
497
528
  const blockPresets = pickPresets(node);
498
529
  const blockCustom = node.custom;
499
530
 
@@ -510,12 +541,12 @@ export const getNodesWithSettings = (tree, blockSelectors) => {
510
541
  export const toCustomProperties = (tree, blockSelectors) => {
511
542
  const settings = getNodesWithSettings(tree, blockSelectors);
512
543
  let ruleset = '';
513
- settings.forEach(_ref16 => {
544
+ settings.forEach(_ref17 => {
514
545
  let {
515
546
  presets,
516
547
  custom,
517
548
  selector
518
- } = _ref16;
549
+ } = _ref17;
519
550
  const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
520
551
  const customProps = flattenTree(custom, '--wp--custom--', '--');
521
552
 
@@ -570,21 +601,22 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
570
601
  }
571
602
 
572
603
  ruleset += '}';
573
- nodesWithStyles.forEach(_ref17 => {
604
+ nodesWithStyles.forEach(_ref18 => {
574
605
  let {
575
606
  selector,
576
607
  duotoneSelector,
577
608
  styles,
578
609
  fallbackGapValue,
579
610
  hasLayoutSupport,
580
- featureSelectors
581
- } = _ref17;
611
+ featureSelectors,
612
+ styleVariationSelectors
613
+ } = _ref18;
582
614
 
583
615
  // Process styles for block support features with custom feature level
584
616
  // CSS selectors set.
585
617
  if (featureSelectors) {
586
- Object.entries(featureSelectors).forEach(_ref18 => {
587
- let [featureName, featureSelector] = _ref18;
618
+ Object.entries(featureSelectors).forEach(_ref19 => {
619
+ let [featureName, featureSelector] = _ref19;
588
620
 
589
621
  if (styles !== null && styles !== void 0 && styles[featureName]) {
590
622
  const featureStyles = {
@@ -600,6 +632,46 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
600
632
  });
601
633
  }
602
634
 
635
+ if (styleVariationSelectors) {
636
+ Object.entries(styleVariationSelectors).forEach(_ref20 => {
637
+ var _styles$variations;
638
+
639
+ let [styleVariationName, styleVariationSelector] = _ref20;
640
+
641
+ if (styles !== null && styles !== void 0 && (_styles$variations = styles.variations) !== null && _styles$variations !== void 0 && _styles$variations[styleVariationName]) {
642
+ var _styles$variations3;
643
+
644
+ // If the block uses any custom selectors for block support, add those first.
645
+ if (featureSelectors) {
646
+ Object.entries(featureSelectors).forEach(_ref21 => {
647
+ var _styles$variations2, _styles$variations2$s;
648
+
649
+ let [featureName, featureSelector] = _ref21;
650
+
651
+ if (styles !== null && styles !== void 0 && (_styles$variations2 = styles.variations) !== null && _styles$variations2 !== void 0 && (_styles$variations2$s = _styles$variations2[styleVariationName]) !== null && _styles$variations2$s !== void 0 && _styles$variations2$s[featureName]) {
652
+ const featureStyles = {
653
+ [featureName]: styles.variations[styleVariationName][featureName]
654
+ };
655
+ const featureDeclarations = getStylesDeclarations(featureStyles);
656
+ delete styles.variations[styleVariationName][featureName];
657
+
658
+ if (!!featureDeclarations.length) {
659
+ ruleset = ruleset + `${concatFeatureVariationSelectorString(featureSelector, styleVariationSelector)}{${featureDeclarations.join(';')} }`;
660
+ }
661
+ }
662
+ });
663
+ } // Otherwise add regular selectors.
664
+
665
+
666
+ const styleVariationDeclarations = getStylesDeclarations(styles === null || styles === void 0 ? void 0 : (_styles$variations3 = styles.variations) === null || _styles$variations3 === void 0 ? void 0 : _styles$variations3[styleVariationName], styleVariationSelector, useRootPaddingAlign, tree);
667
+
668
+ if (!!styleVariationDeclarations.length) {
669
+ ruleset = ruleset + `${styleVariationSelector}{${styleVariationDeclarations.join(';')}}`;
670
+ }
671
+ }
672
+ });
673
+ }
674
+
603
675
  const duotoneStyles = {};
604
676
 
605
677
  if (styles !== null && styles !== void 0 && styles.filter) {
@@ -636,14 +708,14 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
636
708
  } // Check for pseudo selector in `styles` and handle separately.
637
709
 
638
710
 
639
- const pseudoSelectorStyles = Object.entries(styles).filter(_ref19 => {
640
- let [key] = _ref19;
711
+ const pseudoSelectorStyles = Object.entries(styles).filter(_ref22 => {
712
+ let [key] = _ref22;
641
713
  return key.startsWith(':');
642
714
  });
643
715
 
644
716
  if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
645
- pseudoSelectorStyles.forEach(_ref20 => {
646
- let [pseudoKey, pseudoStyle] = _ref20;
717
+ pseudoSelectorStyles.forEach(_ref23 => {
718
+ let [pseudoKey, pseudoStyle] = _ref23;
647
719
  const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
648
720
 
649
721
  if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
@@ -679,11 +751,11 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
679
751
  ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
680
752
  }
681
753
 
682
- nodesWithSettings.forEach(_ref21 => {
754
+ nodesWithSettings.forEach(_ref24 => {
683
755
  let {
684
756
  selector,
685
757
  presets
686
- } = _ref21;
758
+ } = _ref24;
687
759
 
688
760
  if (ROOT_BLOCK_SELECTOR === selector) {
689
761
  // Do not add extra specificity for top-level classes.
@@ -700,14 +772,14 @@ export const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasF
700
772
  };
701
773
  export function toSvgFilters(tree, blockSelectors) {
702
774
  const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
703
- return nodesWithSettings.flatMap(_ref22 => {
775
+ return nodesWithSettings.flatMap(_ref25 => {
704
776
  let {
705
777
  presets
706
- } = _ref22;
778
+ } = _ref25;
707
779
  return getPresetsSvgFilters(presets);
708
780
  });
709
781
  }
710
- export const getBlockSelectors = blockTypes => {
782
+ export const getBlockSelectors = (blockTypes, getBlockStyles) => {
711
783
  const result = {};
712
784
  blockTypes.forEach(blockType => {
713
785
  var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports4, _blockType$supports4$, _blockType$supports4$2;
@@ -716,13 +788,23 @@ export const getBlockSelectors = blockTypes => {
716
788
  const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
717
789
  const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
718
790
  const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && _blockType$supports3.__experimentalLayout);
719
- const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports4 = blockType.supports) === null || _blockType$supports4 === void 0 ? void 0 : (_blockType$supports4$ = _blockType$supports4.spacing) === null || _blockType$supports4$ === void 0 ? void 0 : (_blockType$supports4$2 = _blockType$supports4$.blockGap) === null || _blockType$supports4$2 === void 0 ? void 0 : _blockType$supports4$2.__experimentalDefault; // For each block support feature add any custom selectors.
791
+ const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports4 = blockType.supports) === null || _blockType$supports4 === void 0 ? void 0 : (_blockType$supports4$ = _blockType$supports4.spacing) === null || _blockType$supports4$ === void 0 ? void 0 : (_blockType$supports4$2 = _blockType$supports4$.blockGap) === null || _blockType$supports4$2 === void 0 ? void 0 : _blockType$supports4$2.__experimentalDefault;
792
+ const blockStyleVariations = getBlockStyles(name);
793
+ const styleVariationSelectors = {};
794
+
795
+ if (blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) {
796
+ blockStyleVariations.forEach(variation => {
797
+ const styleVariationSelector = `.is-style-${variation.name}${selector}`;
798
+ styleVariationSelectors[variation.name] = styleVariationSelector;
799
+ });
800
+ } // For each block support feature add any custom selectors.
801
+
720
802
 
721
803
  const featureSelectors = {};
722
- Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref23 => {
804
+ Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref26 => {
723
805
  var _blockType$supports5, _blockType$supports5$;
724
806
 
725
- let [featureKey, featureName] = _ref23;
807
+ let [featureKey, featureName] = _ref26;
726
808
  const featureSelector = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports5 = blockType.supports) === null || _blockType$supports5 === void 0 ? void 0 : (_blockType$supports5$ = _blockType$supports5[featureKey]) === null || _blockType$supports5$ === void 0 ? void 0 : _blockType$supports5$.__experimentalSelector;
727
809
 
728
810
  if (featureSelector) {
@@ -735,7 +817,8 @@ export const getBlockSelectors = blockTypes => {
735
817
  featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined,
736
818
  hasLayoutSupport,
737
819
  name,
738
- selector
820
+ selector,
821
+ styleVariationSelectors: Object.keys(styleVariationSelectors).length ? styleVariationSelectors : undefined
739
822
  };
740
823
  });
741
824
  return result;
@@ -786,6 +869,9 @@ export function useGlobalStylesOutput() {
786
869
  } = select(blockEditorStore);
787
870
  return !!getSettings().disableLayoutStyles;
788
871
  });
872
+ const getBlockStyles = useSelect(select => {
873
+ return select(blocksStore).getBlockStyles;
874
+ }, []);
789
875
  return useMemo(() => {
790
876
  var _mergedConfig, _mergedConfig2, _mergedConfig$styles$;
791
877
 
@@ -794,7 +880,7 @@ export function useGlobalStylesOutput() {
794
880
  }
795
881
 
796
882
  mergedConfig = updateConfigWithSeparator(mergedConfig);
797
- const blockSelectors = getBlockSelectors(getBlockTypes());
883
+ const blockSelectors = getBlockSelectors(getBlockTypes(), getBlockStyles);
798
884
  const customProperties = toCustomProperties(mergedConfig, blockSelectors);
799
885
  const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
800
886
  const filters = toSvgFilters(mergedConfig, blockSelectors);