@wordpress/block-editor 14.0.0 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -14
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-list/use-block-props/index.js +2 -2
  6. package/build/components/block-list/use-block-props/index.js.map +1 -1
  7. package/build/components/block-list/use-in-between-inserter.js +11 -4
  8. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  9. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  10. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  11. package/build/components/block-tools/insertion-point.js +14 -3
  12. package/build/components/block-tools/insertion-point.js.map +1 -1
  13. package/build/components/block-tools/use-show-block-tools.js +2 -1
  14. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  15. package/build/components/block-tools/zoom-out-mode-inserters.js +8 -4
  16. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  17. package/build/components/border-radius-control/index.js +1 -0
  18. package/build/components/border-radius-control/index.js.map +1 -1
  19. package/build/components/convert-to-group-buttons/index.js +1 -1
  20. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  21. package/build/components/date-format-picker/index.js +2 -0
  22. package/build/components/date-format-picker/index.js.map +1 -1
  23. package/build/components/font-appearance-control/index.js +3 -0
  24. package/build/components/font-appearance-control/index.js.map +1 -1
  25. package/build/components/font-family/index.js +3 -0
  26. package/build/components/font-family/index.js.map +1 -1
  27. package/build/components/global-styles/background-panel.js +114 -42
  28. package/build/components/global-styles/background-panel.js.map +1 -1
  29. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  30. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  31. package/build/components/global-styles/hooks.js +0 -7
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/index.js +0 -6
  34. package/build/components/global-styles/index.js.map +1 -1
  35. package/build/components/global-styles/use-global-styles-output.js +3 -3
  36. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  37. package/build/components/global-styles/utils.js +8 -24
  38. package/build/components/global-styles/utils.js.map +1 -1
  39. package/build/components/grid/grid-visualizer.js +20 -5
  40. package/build/components/grid/grid-visualizer.js.map +1 -1
  41. package/build/components/height-control/index.js +1 -0
  42. package/build/components/height-control/index.js.map +1 -1
  43. package/build/components/iframe/index.js +4 -2
  44. package/build/components/iframe/index.js.map +1 -1
  45. package/build/components/image-editor/zoom-dropdown.js +11 -7
  46. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  47. package/build/components/inner-blocks/button-block-appender.js +8 -8
  48. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  49. package/build/components/inner-blocks/default-block-appender.js +7 -25
  50. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  51. package/build/components/inner-blocks/index.js +9 -11
  52. package/build/components/inner-blocks/index.js.map +1 -1
  53. package/build/components/inserter/library.js +4 -2
  54. package/build/components/inserter/library.js.map +1 -1
  55. package/build/components/inserter/menu.js +30 -12
  56. package/build/components/inserter/menu.js.map +1 -1
  57. package/build/components/inserter/quick-inserter.js +4 -0
  58. package/build/components/inserter/quick-inserter.js.map +1 -1
  59. package/build/components/line-height-control/index.js +3 -0
  60. package/build/components/line-height-control/index.js.map +1 -1
  61. package/build/components/media-placeholder/index.js +9 -4
  62. package/build/components/media-placeholder/index.js.map +1 -1
  63. package/build/components/media-upload/index.native.js +4 -1
  64. package/build/components/media-upload/index.native.js.map +1 -1
  65. package/build/components/multi-selection-inspector/index.js +12 -12
  66. package/build/components/multi-selection-inspector/index.js.map +1 -1
  67. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  68. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  69. package/build/components/text-alignment-control/index.js +13 -8
  70. package/build/components/text-alignment-control/index.js.map +1 -1
  71. package/build/components/text-decoration-control/index.js +13 -8
  72. package/build/components/text-decoration-control/index.js.map +1 -1
  73. package/build/components/text-transform-control/index.js +13 -8
  74. package/build/components/text-transform-control/index.js.map +1 -1
  75. package/build/components/url-popover/image-url-input-ui.js +2 -0
  76. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  77. package/build/components/use-block-drop-zone/index.js +14 -2
  78. package/build/components/use-block-drop-zone/index.js.map +1 -1
  79. package/build/components/writing-mode-control/index.js +13 -8
  80. package/build/components/writing-mode-control/index.js.map +1 -1
  81. package/build/hooks/background.js +19 -23
  82. package/build/hooks/background.js.map +1 -1
  83. package/build/hooks/block-bindings.js +37 -79
  84. package/build/hooks/block-bindings.js.map +1 -1
  85. package/build/layouts/constrained.js +1 -0
  86. package/build/layouts/constrained.js.map +1 -1
  87. package/build/layouts/flex.js +2 -0
  88. package/build/layouts/flex.js.map +1 -1
  89. package/build/layouts/grid.js +3 -0
  90. package/build/layouts/grid.js.map +1 -1
  91. package/build/private-apis.js +3 -1
  92. package/build/private-apis.js.map +1 -1
  93. package/build/store/private-selectors.js +30 -0
  94. package/build/store/private-selectors.js.map +1 -1
  95. package/build/store/reducer.js +10 -1
  96. package/build/store/reducer.js.map +1 -1
  97. package/build/utils/block-bindings.js +112 -0
  98. package/build/utils/block-bindings.js.map +1 -0
  99. package/build-module/autocompleters/block.js +1 -1
  100. package/build-module/autocompleters/block.js.map +1 -1
  101. package/build-module/components/block-list/use-block-props/index.js +2 -2
  102. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  103. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  104. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  105. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  106. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  107. package/build-module/components/block-tools/insertion-point.js +14 -3
  108. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  109. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  110. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  111. package/build-module/components/block-tools/zoom-out-mode-inserters.js +8 -4
  112. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  113. package/build-module/components/border-radius-control/index.js +1 -0
  114. package/build-module/components/border-radius-control/index.js.map +1 -1
  115. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  116. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  117. package/build-module/components/date-format-picker/index.js +2 -0
  118. package/build-module/components/date-format-picker/index.js.map +1 -1
  119. package/build-module/components/font-appearance-control/index.js +3 -0
  120. package/build-module/components/font-appearance-control/index.js.map +1 -1
  121. package/build-module/components/font-family/index.js +3 -0
  122. package/build-module/components/font-family/index.js.map +1 -1
  123. package/build-module/components/global-styles/background-panel.js +117 -45
  124. package/build-module/components/global-styles/background-panel.js.map +1 -1
  125. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  126. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  127. package/build-module/components/global-styles/hooks.js +0 -6
  128. package/build-module/components/global-styles/hooks.js.map +1 -1
  129. package/build-module/components/global-styles/index.js +1 -1
  130. package/build-module/components/global-styles/index.js.map +1 -1
  131. package/build-module/components/global-styles/use-global-styles-output.js +5 -5
  132. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  133. package/build-module/components/global-styles/utils.js +8 -23
  134. package/build-module/components/global-styles/utils.js.map +1 -1
  135. package/build-module/components/grid/grid-visualizer.js +20 -5
  136. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  137. package/build-module/components/height-control/index.js +1 -0
  138. package/build-module/components/height-control/index.js.map +1 -1
  139. package/build-module/components/iframe/index.js +4 -2
  140. package/build-module/components/iframe/index.js.map +1 -1
  141. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  142. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  143. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  144. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  145. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  146. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  147. package/build-module/components/inner-blocks/index.js +9 -11
  148. package/build-module/components/inner-blocks/index.js.map +1 -1
  149. package/build-module/components/inserter/library.js +4 -2
  150. package/build-module/components/inserter/library.js.map +1 -1
  151. package/build-module/components/inserter/menu.js +30 -12
  152. package/build-module/components/inserter/menu.js.map +1 -1
  153. package/build-module/components/inserter/quick-inserter.js +5 -1
  154. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  155. package/build-module/components/line-height-control/index.js +3 -0
  156. package/build-module/components/line-height-control/index.js.map +1 -1
  157. package/build-module/components/media-placeholder/index.js +9 -4
  158. package/build-module/components/media-placeholder/index.js.map +1 -1
  159. package/build-module/components/media-upload/index.native.js +4 -1
  160. package/build-module/components/media-upload/index.native.js.map +1 -1
  161. package/build-module/components/multi-selection-inspector/index.js +12 -12
  162. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  163. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  164. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  165. package/build-module/components/text-alignment-control/index.js +13 -8
  166. package/build-module/components/text-alignment-control/index.js.map +1 -1
  167. package/build-module/components/text-decoration-control/index.js +13 -8
  168. package/build-module/components/text-decoration-control/index.js.map +1 -1
  169. package/build-module/components/text-transform-control/index.js +13 -8
  170. package/build-module/components/text-transform-control/index.js.map +1 -1
  171. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  172. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  173. package/build-module/components/use-block-drop-zone/index.js +14 -2
  174. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  175. package/build-module/components/writing-mode-control/index.js +13 -8
  176. package/build-module/components/writing-mode-control/index.js.map +1 -1
  177. package/build-module/hooks/background.js +19 -23
  178. package/build-module/hooks/background.js.map +1 -1
  179. package/build-module/hooks/block-bindings.js +38 -80
  180. package/build-module/hooks/block-bindings.js.map +1 -1
  181. package/build-module/layouts/constrained.js +1 -0
  182. package/build-module/layouts/constrained.js.map +1 -1
  183. package/build-module/layouts/flex.js +2 -0
  184. package/build-module/layouts/flex.js.map +1 -1
  185. package/build-module/layouts/grid.js +3 -0
  186. package/build-module/layouts/grid.js.map +1 -1
  187. package/build-module/private-apis.js +3 -1
  188. package/build-module/private-apis.js.map +1 -1
  189. package/build-module/store/private-selectors.js +27 -0
  190. package/build-module/store/private-selectors.js.map +1 -1
  191. package/build-module/store/reducer.js +9 -1
  192. package/build-module/store/reducer.js.map +1 -1
  193. package/build-module/utils/block-bindings.js +105 -0
  194. package/build-module/utils/block-bindings.js.map +1 -0
  195. package/build-style/content-rtl.css +7 -14
  196. package/build-style/content.css +7 -14
  197. package/build-style/default-editor-styles-rtl.css +2 -2
  198. package/build-style/default-editor-styles.css +2 -2
  199. package/build-style/style-rtl.css +36 -38
  200. package/build-style/style.css +36 -38
  201. package/package.json +32 -32
  202. package/src/autocompleters/block.js +2 -1
  203. package/src/components/block-list/content.scss +5 -13
  204. package/src/components/block-list/use-block-props/index.js +2 -2
  205. package/src/components/block-list/use-in-between-inserter.js +17 -5
  206. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  207. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  208. package/src/components/block-tools/insertion-point.js +11 -0
  209. package/src/components/block-tools/style.scss +1 -1
  210. package/src/components/block-tools/use-show-block-tools.js +4 -1
  211. package/src/components/block-tools/zoom-out-mode-inserters.js +7 -1
  212. package/src/components/block-variation-transforms/style.scss +1 -1
  213. package/src/components/border-radius-control/index.js +1 -0
  214. package/src/components/border-radius-control/style.scss +0 -10
  215. package/src/components/convert-to-group-buttons/index.js +1 -1
  216. package/src/components/date-format-picker/index.js +2 -0
  217. package/src/components/font-appearance-control/index.js +3 -0
  218. package/src/components/font-family/README.md +11 -2
  219. package/src/components/font-family/index.js +3 -0
  220. package/src/components/global-styles/background-panel.js +132 -53
  221. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  222. package/src/components/global-styles/hooks.js +0 -5
  223. package/src/components/global-styles/index.js +0 -1
  224. package/src/components/global-styles/style.scss +13 -2
  225. package/src/components/global-styles/test/use-global-styles-output.js +20 -4
  226. package/src/components/global-styles/use-global-styles-output.js +5 -6
  227. package/src/components/global-styles/utils.js +7 -29
  228. package/src/components/grid/grid-visualizer.js +22 -7
  229. package/src/components/height-control/index.js +1 -0
  230. package/src/components/iframe/index.js +4 -2
  231. package/src/components/image-editor/zoom-dropdown.js +17 -9
  232. package/src/components/inner-blocks/button-block-appender.js +5 -7
  233. package/src/components/inner-blocks/default-block-appender.js +4 -23
  234. package/src/components/inner-blocks/index.js +10 -9
  235. package/src/components/inserter/library.js +2 -0
  236. package/src/components/inserter/menu.js +32 -27
  237. package/src/components/inserter/quick-inserter.js +4 -1
  238. package/src/components/inserter/style.scss +1 -1
  239. package/src/components/inserter-list-item/style.scss +1 -0
  240. package/src/components/line-height-control/README.md +7 -0
  241. package/src/components/line-height-control/index.js +3 -0
  242. package/src/components/link-control/style.scss +1 -1
  243. package/src/components/media-placeholder/index.js +12 -7
  244. package/src/components/media-upload/README.md +2 -0
  245. package/src/components/media-upload/index.native.js +2 -0
  246. package/src/components/multi-selection-inspector/index.js +8 -9
  247. package/src/components/responsive-block-control/README.md +1 -0
  248. package/src/components/responsive-block-control/test/index.js +1 -0
  249. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
  250. package/src/components/spacing-sizes-control/style.scss +16 -16
  251. package/src/components/text-alignment-control/index.js +20 -8
  252. package/src/components/text-decoration-control/index.js +20 -8
  253. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  254. package/src/components/text-transform-control/index.js +20 -8
  255. package/src/components/text-transform-control/stories/index.story.js +0 -4
  256. package/src/components/url-input/style.scss +2 -2
  257. package/src/components/url-popover/image-url-input-ui.js +2 -0
  258. package/src/components/use-block-drop-zone/index.js +21 -3
  259. package/src/components/writing-mode-control/index.js +20 -8
  260. package/src/hooks/background.js +21 -27
  261. package/src/hooks/block-bindings.js +27 -84
  262. package/src/hooks/block-bindings.scss +1 -1
  263. package/src/hooks/test/background.js +60 -0
  264. package/src/layouts/constrained.js +1 -0
  265. package/src/layouts/flex.js +2 -0
  266. package/src/layouts/grid.js +3 -0
  267. package/src/private-apis.js +2 -0
  268. package/src/store/private-selectors.js +36 -0
  269. package/src/store/reducer.js +7 -0
  270. package/src/store/test/private-selectors.js +89 -0
  271. package/src/style.scss +0 -1
  272. package/src/utils/block-bindings.js +98 -0
  273. package/src/utils/test/transform-styles.js +49 -0
  274. package/build/components/global-styles/theme-file-uri-utils.js +0 -21
  275. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  276. package/build/components/inner-blocks/with-client-id.js +0 -28
  277. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  278. package/build/components/segmented-text-control/index.js +0 -63
  279. package/build/components/segmented-text-control/index.js.map +0 -1
  280. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
  281. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  282. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  283. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  284. package/build-module/components/segmented-text-control/index.js +0 -58
  285. package/build-module/components/segmented-text-control/index.js.map +0 -1
  286. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
  287. package/src/components/global-styles/theme-file-uri-utils.js +0 -18
  288. package/src/components/inner-blocks/with-client-id.js +0 -19
  289. package/src/components/segmented-text-control/index.js +0 -63
  290. package/src/components/segmented-text-control/style.scss +0 -15
@@ -23,6 +23,8 @@ import {
23
23
  __experimentalHStack as HStack,
24
24
  __experimentalTruncate as Truncate,
25
25
  Dropdown,
26
+ Placeholder,
27
+ Spinner,
26
28
  __experimentalDropdownContentWrapper as DropdownContentWrapper,
27
29
  } from '@wordpress/components';
28
30
  import { __, _x, sprintf } from '@wordpress/i18n';
@@ -34,6 +36,7 @@ import {
34
36
  useRef,
35
37
  useState,
36
38
  useEffect,
39
+ useMemo,
37
40
  } from '@wordpress/element';
38
41
  import { useDispatch, useSelect } from '@wordpress/data';
39
42
  import { focus } from '@wordpress/dom';
@@ -42,11 +45,15 @@ import { isBlobURL } from '@wordpress/blob';
42
45
  /**
43
46
  * Internal dependencies
44
47
  */
45
- import { useToolsPanelDropdownMenuProps } from './utils';
48
+ import { useToolsPanelDropdownMenuProps, getResolvedValue } from './utils';
46
49
  import { setImmutably } from '../../utils/object';
47
50
  import MediaReplaceFlow from '../media-replace-flow';
48
51
  import { store as blockEditorStore } from '../../store';
49
- import { getResolvedThemeFilePath } from './theme-file-uri-utils';
52
+
53
+ import {
54
+ globalStylesDataKey,
55
+ globalStylesLinksDataKey,
56
+ } from '../../store/private-keys';
50
57
 
51
58
  const IMAGE_BACKGROUND_TYPE = 'image';
52
59
  const DEFAULT_CONTROLS = {
@@ -263,18 +270,25 @@ function BackgroundControlsPanel( {
263
270
  );
264
271
  }
265
272
 
273
+ function LoadingSpinner() {
274
+ return (
275
+ <Placeholder className="block-editor-global-styles-background-panel__loading">
276
+ <Spinner />
277
+ </Placeholder>
278
+ );
279
+ }
280
+
266
281
  function BackgroundImageControls( {
267
282
  onChange,
268
283
  style,
269
284
  inheritedValue,
270
285
  onRemoveImage = noop,
286
+ onResetImage = noop,
271
287
  displayInPanel,
272
- themeFileURIs,
288
+ defaultValues,
273
289
  } ) {
274
- const mediaUpload = useSelect(
275
- ( select ) => select( blockEditorStore ).getSettings().mediaUpload,
276
- []
277
- );
290
+ const [ isUploading, setIsUploading ] = useState( false );
291
+ const { getSettings } = useSelect( blockEditorStore );
278
292
 
279
293
  const { id, title, url } = style?.background?.backgroundImage || {
280
294
  ...inheritedValue?.background?.backgroundImage,
@@ -283,6 +297,7 @@ function BackgroundImageControls( {
283
297
  const { createErrorNotice } = useDispatch( noticesStore );
284
298
  const onUploadError = ( message ) => {
285
299
  createErrorNotice( message, { type: 'snackbar' } );
300
+ setIsUploading( false );
286
301
  };
287
302
 
288
303
  const resetBackgroundImage = () =>
@@ -297,10 +312,12 @@ function BackgroundImageControls( {
297
312
  const onSelectMedia = ( media ) => {
298
313
  if ( ! media || ! media.url ) {
299
314
  resetBackgroundImage();
315
+ setIsUploading( false );
300
316
  return;
301
317
  }
302
318
 
303
319
  if ( isBlobURL( media.url ) ) {
320
+ setIsUploading( true );
304
321
  return;
305
322
  }
306
323
 
@@ -319,12 +336,8 @@ function BackgroundImageControls( {
319
336
  }
320
337
 
321
338
  const sizeValue =
322
- style?.background?.backgroundSize ||
323
- inheritedValue?.background?.backgroundSize;
324
- const positionValue =
325
- style?.background?.backgroundPosition ||
326
- inheritedValue?.background?.backgroundPosition;
327
-
339
+ style?.background?.backgroundSize || defaultValues?.backgroundSize;
340
+ const positionValue = style?.background?.backgroundPosition;
328
341
  onChange(
329
342
  setImmutably( style, [ 'background' ], {
330
343
  ...style?.background,
@@ -335,22 +348,33 @@ function BackgroundImageControls( {
335
348
  title: media.title || undefined,
336
349
  },
337
350
  backgroundPosition:
351
+ /*
352
+ * A background image uploaded and set in the editor receives a default background position of '50% 0',
353
+ * when the background image size is the equivalent of "Tile".
354
+ * This is to increase the chance that the image's focus point is visible.
355
+ * This is in-editor only to assist with the user experience.
356
+ */
338
357
  ! positionValue && ( 'auto' === sizeValue || ! sizeValue )
339
358
  ? '50% 0'
340
359
  : positionValue,
341
360
  backgroundSize: sizeValue,
342
361
  } )
343
362
  );
363
+ setIsUploading( false );
344
364
  };
345
365
 
366
+ // Drag and drop callback, restricting image to one.
346
367
  const onFilesDrop = ( filesList ) => {
347
- mediaUpload( {
368
+ if ( filesList?.length > 1 ) {
369
+ onUploadError(
370
+ __( 'Only one image can be used as a background image.' )
371
+ );
372
+ return;
373
+ }
374
+ getSettings().mediaUpload( {
348
375
  allowedTypes: [ IMAGE_BACKGROUND_TYPE ],
349
376
  filesList,
350
377
  onFileChange( [ image ] ) {
351
- if ( isBlobURL( image?.url ) ) {
352
- return;
353
- }
354
378
  onSelectMedia( image );
355
379
  },
356
380
  onError: onUploadError,
@@ -372,7 +396,9 @@ function BackgroundImageControls( {
372
396
 
373
397
  const onRemove = () =>
374
398
  onChange(
375
- setImmutably( style, [ 'background', 'backgroundImage' ], 'none' )
399
+ setImmutably( style, [ 'background' ], {
400
+ backgroundImage: 'none',
401
+ } )
376
402
  );
377
403
  const canRemove = ! hasValue && hasBackgroundImageValue( inheritedValue );
378
404
  const imgLabel =
@@ -383,6 +409,7 @@ function BackgroundImageControls( {
383
409
  ref={ replaceContainerRef }
384
410
  className="block-editor-global-styles-background-panel__image-tools-panel-item"
385
411
  >
412
+ { isUploading && <LoadingSpinner /> }
386
413
  <MediaReplaceFlow
387
414
  mediaId={ id }
388
415
  mediaURL={ url }
@@ -398,21 +425,20 @@ function BackgroundImageControls( {
398
425
  name={
399
426
  <InspectorImagePreviewItem
400
427
  className="block-editor-global-styles-background-panel__image-preview"
401
- imgUrl={ getResolvedThemeFilePath(
402
- url,
403
- themeFileURIs
404
- ) }
428
+ imgUrl={ url }
405
429
  filename={ title }
406
430
  label={ imgLabel }
407
431
  />
408
432
  }
409
433
  variant="secondary"
434
+ onError={ onUploadError }
410
435
  >
411
436
  { canRemove && (
412
437
  <MenuItem
413
438
  onClick={ () => {
414
439
  closeAndFocus();
415
440
  onRemove();
441
+ onRemoveImage();
416
442
  } }
417
443
  >
418
444
  { __( 'Remove' ) }
@@ -422,10 +448,10 @@ function BackgroundImageControls( {
422
448
  <MenuItem
423
449
  onClick={ () => {
424
450
  closeAndFocus();
425
- onRemoveImage();
451
+ onResetImage();
426
452
  } }
427
453
  >
428
- { __( 'Reset ' ) }
454
+ { __( 'Reset' ) }
429
455
  </MenuItem>
430
456
  ) }
431
457
  </MediaReplaceFlow>
@@ -442,7 +468,6 @@ function BackgroundSizeControls( {
442
468
  style,
443
469
  inheritedValue,
444
470
  defaultValues,
445
- themeFileURIs,
446
471
  } ) {
447
472
  const sizeValue =
448
473
  style?.background?.backgroundSize ||
@@ -453,9 +478,7 @@ function BackgroundSizeControls( {
453
478
  const imageValue =
454
479
  style?.background?.backgroundImage?.url ||
455
480
  inheritedValue?.background?.backgroundImage?.url;
456
- const isUploadedImage =
457
- style?.background?.backgroundImage?.id ||
458
- inheritedValue?.background?.backgroundImage?.id;
481
+ const isUploadedImage = style?.background?.backgroundImage?.id;
459
482
  const positionValue =
460
483
  style?.background?.backgroundPosition ||
461
484
  inheritedValue?.background?.backgroundPosition;
@@ -469,11 +492,19 @@ function BackgroundSizeControls( {
469
492
  * Block-level controls may have different defaults to root-level controls.
470
493
  * A falsy value is treated by default as `auto` (Tile).
471
494
  */
472
- const currentValueForToggle =
495
+ let currentValueForToggle =
473
496
  ! sizeValue && isUploadedImage
474
497
  ? defaultValues?.backgroundSize
475
498
  : sizeValue || 'auto';
476
-
499
+ /*
500
+ * The incoming value could be a value + unit, e.g. '20px'.
501
+ * In this case set the value to 'tile'.
502
+ */
503
+ currentValueForToggle = ! [ 'cover', 'contain', 'auto' ].includes(
504
+ currentValueForToggle
505
+ )
506
+ ? 'auto'
507
+ : currentValueForToggle;
477
508
  /*
478
509
  * If the current value is `cover` and the repeat value is `undefined`, then
479
510
  * the toggle should be unchecked as the default state. Otherwise, the toggle
@@ -510,6 +541,7 @@ function BackgroundSizeControls( {
510
541
  * receives a default background position of '50% 0',
511
542
  * when the toggle switches to "Tile". This is to increase the chance that
512
543
  * the image's focus point is visible.
544
+ * This is in-editor only to assist with the user experience.
513
545
  */
514
546
  if ( !! style?.background?.backgroundImage?.id ) {
515
547
  nextPosition = '50% 0';
@@ -562,14 +594,19 @@ function BackgroundSizeControls( {
562
594
  )
563
595
  );
564
596
 
597
+ // Set a default background position for non-site-wide, uploaded images with a size of 'contain'.
598
+ const backgroundPositionValue =
599
+ ! positionValue && isUploadedImage && 'contain' === sizeValue
600
+ ? defaultValues?.backgroundPosition
601
+ : positionValue;
602
+
565
603
  return (
566
- <VStack spacing={ 4 } className="single-column">
604
+ <VStack spacing={ 3 } className="single-column">
567
605
  <FocalPointPicker
568
- __next40pxDefaultSize
569
606
  __nextHasNoMarginBottom
570
607
  label={ __( 'Focal point' ) }
571
- url={ getResolvedThemeFilePath( imageValue, themeFileURIs ) }
572
- value={ backgroundPositionToCoords( positionValue ) }
608
+ url={ imageValue }
609
+ value={ backgroundPositionToCoords( backgroundPositionValue ) }
573
610
  onChange={ updateBackgroundPosition }
574
611
  />
575
612
  <ToggleControl
@@ -577,9 +614,6 @@ function BackgroundSizeControls( {
577
614
  label={ __( 'Fixed background' ) }
578
615
  checked={ attachmentValue === 'fixed' }
579
616
  onChange={ toggleScrollWithPage }
580
- help={ __(
581
- 'Whether your image should scroll with the page or stay fixed in place.'
582
- ) }
583
617
  />
584
618
  <ToggleGroupControl
585
619
  __nextHasNoMarginBottom
@@ -660,7 +694,7 @@ function BackgroundToolsPanel( {
660
694
  return (
661
695
  <VStack
662
696
  as={ ToolsPanel }
663
- spacing={ 4 }
697
+ spacing={ 2 }
664
698
  label={ headerLabel }
665
699
  resetAll={ resetAll }
666
700
  panelId={ panelId }
@@ -681,8 +715,44 @@ export default function BackgroundPanel( {
681
715
  defaultControls = DEFAULT_CONTROLS,
682
716
  defaultValues = {},
683
717
  headerLabel = __( 'Background image' ),
684
- themeFileURIs,
685
718
  } ) {
719
+ /*
720
+ * Resolve any inherited "ref" pointers.
721
+ * Should the block editor need resolved, inherited values
722
+ * across all controls, this could be abstracted into a hook,
723
+ * e.g., useResolveGlobalStyle
724
+ */
725
+ const { globalStyles, _links } = useSelect( ( select ) => {
726
+ const { getSettings } = select( blockEditorStore );
727
+ const _settings = getSettings();
728
+ return {
729
+ globalStyles: _settings[ globalStylesDataKey ],
730
+ _links: _settings[ globalStylesLinksDataKey ],
731
+ };
732
+ }, [] );
733
+ const resolvedInheritedValue = useMemo( () => {
734
+ const resolvedValues = {
735
+ background: {},
736
+ };
737
+
738
+ if ( ! inheritedValue?.background ) {
739
+ return inheritedValue;
740
+ }
741
+
742
+ Object.entries( inheritedValue?.background ).forEach(
743
+ ( [ key, backgroundValue ] ) => {
744
+ resolvedValues.background[ key ] = getResolvedValue(
745
+ backgroundValue,
746
+ {
747
+ styles: globalStyles,
748
+ _links,
749
+ }
750
+ );
751
+ }
752
+ );
753
+ return resolvedValues;
754
+ }, [ globalStyles, _links, inheritedValue ] );
755
+
686
756
  const resetAllFilter = useCallback( ( previousValue ) => {
687
757
  return {
688
758
  ...previousValue,
@@ -694,14 +764,19 @@ export default function BackgroundPanel( {
694
764
  onChange( setImmutably( value, [ 'background' ], {} ) );
695
765
 
696
766
  const { title, url } = value?.background?.backgroundImage || {
697
- ...inheritedValue?.background?.backgroundImage,
767
+ ...resolvedInheritedValue?.background?.backgroundImage,
698
768
  };
699
769
  const hasImageValue =
700
770
  hasBackgroundImageValue( value ) ||
701
- hasBackgroundImageValue( inheritedValue );
771
+ hasBackgroundImageValue( resolvedInheritedValue );
772
+
773
+ const imageValue =
774
+ value?.background?.backgroundImage ||
775
+ inheritedValue?.background?.backgroundImage;
702
776
 
703
777
  const shouldShowBackgroundImageControls =
704
778
  hasImageValue &&
779
+ 'none' !== imageValue &&
705
780
  ( settings?.background?.backgroundSize ||
706
781
  settings?.background?.backgroundPosition ||
707
782
  settings?.background?.backgroundRepeat );
@@ -725,7 +800,7 @@ export default function BackgroundPanel( {
725
800
  ) }
726
801
  >
727
802
  <ToolsPanelItem
728
- hasValue={ () => hasImageValue }
803
+ hasValue={ () => !! value?.background }
729
804
  label={ __( 'Image' ) }
730
805
  onDeselect={ resetBackground }
731
806
  isShownByDefault={ defaultControls.backgroundImage }
@@ -735,10 +810,7 @@ export default function BackgroundPanel( {
735
810
  <BackgroundControlsPanel
736
811
  label={ title }
737
812
  filename={ title }
738
- url={ getResolvedThemeFilePath(
739
- url,
740
- themeFileURIs
741
- ) }
813
+ url={ url }
742
814
  onToggle={ setIsDropDownOpen }
743
815
  hasImageValue={ hasImageValue }
744
816
  >
@@ -746,21 +818,23 @@ export default function BackgroundPanel( {
746
818
  <BackgroundImageControls
747
819
  onChange={ onChange }
748
820
  style={ value }
749
- inheritedValue={ inheritedValue }
750
- themeFileURIs={ themeFileURIs }
821
+ inheritedValue={ resolvedInheritedValue }
751
822
  displayInPanel
752
- onRemoveImage={ () => {
823
+ onResetImage={ () => {
753
824
  setIsDropDownOpen( false );
754
825
  resetBackground();
755
826
  } }
827
+ onRemoveImage={ () =>
828
+ setIsDropDownOpen( false )
829
+ }
830
+ defaultValues={ defaultValues }
756
831
  />
757
832
  <BackgroundSizeControls
758
833
  onChange={ onChange }
759
834
  panelId={ panelId }
760
835
  style={ value }
761
836
  defaultValues={ defaultValues }
762
- inheritedValue={ inheritedValue }
763
- themeFileURIs={ themeFileURIs }
837
+ inheritedValue={ resolvedInheritedValue }
764
838
  />
765
839
  </VStack>
766
840
  </BackgroundControlsPanel>
@@ -768,8 +842,13 @@ export default function BackgroundPanel( {
768
842
  <BackgroundImageControls
769
843
  onChange={ onChange }
770
844
  style={ value }
771
- inheritedValue={ inheritedValue }
772
- themeFileURIs={ themeFileURIs }
845
+ inheritedValue={ resolvedInheritedValue }
846
+ defaultValues={ defaultValues }
847
+ onResetImage={ () => {
848
+ setIsDropDownOpen( false );
849
+ resetBackground();
850
+ } }
851
+ onRemoveImage={ () => setIsDropDownOpen( false ) }
773
852
  />
774
853
  ) }
775
854
  </ToolsPanelItem>
@@ -202,7 +202,10 @@ export default function getGlobalStylesChanges( next, previous, options = {} ) {
202
202
  }, {} )
203
203
  ).map( ( [ key, changeValues ] ) => {
204
204
  const changeValuesLength = changeValues.length;
205
- const joinedChangesValue = changeValues.join( __( ', ' ) );
205
+ const joinedChangesValue = changeValues.join(
206
+ /* translators: Used between list items, there is a space after the comma. */
207
+ __( ', ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
208
+ );
206
209
  switch ( key ) {
207
210
  case 'blocks': {
208
211
  return sprintf(
@@ -209,11 +209,6 @@ export function useGlobalStyle(
209
209
  return [ result, setStyle ];
210
210
  }
211
211
 
212
- export function useGlobalStyleLinks() {
213
- const { merged: mergedConfig } = useContext( GlobalStylesContext );
214
- return mergedConfig?._links;
215
- }
216
-
217
212
  /**
218
213
  * React hook that overrides a global settings object with block and element specific settings.
219
214
  *
@@ -3,7 +3,6 @@ export {
3
3
  useGlobalSetting,
4
4
  useGlobalStyle,
5
5
  useSettingsForBlockElement,
6
- useGlobalStyleLinks,
7
6
  } from './hooks';
8
7
  export { getBlockCSSSelector } from './get-block-css-selector';
9
8
  export {
@@ -73,7 +73,7 @@
73
73
 
74
74
 
75
75
  .block-editor-global-styles-background-panel__inspector-media-replace-container {
76
- border: 1px solid $gray-300;
76
+ border: $border-width solid $gray-300;
77
77
  border-radius: 2px;
78
78
  // Full width. ToolsPanel lays out children in a grid.
79
79
  grid-column: 1 / -1;
@@ -101,7 +101,7 @@
101
101
  }
102
102
 
103
103
  .block-editor-global-styles-background-panel__image-tools-panel-item {
104
- border: 1px solid $gray-300;
104
+ border: $border-width solid $gray-300;
105
105
  border-radius: 2px;
106
106
 
107
107
  // Full width. ToolsPanel lays out children in a grid.
@@ -134,6 +134,17 @@
134
134
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
135
135
  }
136
136
  }
137
+
138
+ .block-editor-global-styles-background-panel__loading {
139
+ height: 100%;
140
+ position: absolute;
141
+ z-index: 1;
142
+ width: 100%;
143
+ padding: 10px 0 0 0;
144
+ svg {
145
+ margin: 0;
146
+ }
147
+ }
137
148
  }
138
149
 
139
150
  .block-editor-global-styles-background-panel__image-preview-content,
@@ -763,7 +763,7 @@ describe( 'global styles renderer', () => {
763
763
  } );
764
764
 
765
765
  expect( layoutStyles ).toEqual(
766
- '.is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.is-layout-flow > * + * { margin-block-start: 0.5em; margin-block-end: 0; }.is-layout-flex { gap: 0.5em; }:root { --wp--style--block-gap: 0.5em; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
766
+ ':root :where(.is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.is-layout-flow) > * + * { margin-block-start: 0.5em; margin-block-end: 0; }:root :where(.is-layout-flex) { gap: 0.5em; }:root { --wp--style--block-gap: 0.5em; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
767
767
  );
768
768
  } );
769
769
 
@@ -780,7 +780,7 @@ describe( 'global styles renderer', () => {
780
780
  } );
781
781
 
782
782
  expect( layoutStyles ).toEqual(
783
- '.is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.is-layout-flow > * + * { margin-block-start: 12px; margin-block-end: 0; }.is-layout-flex { gap: 12px; }:root { --wp--style--block-gap: 12px; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
783
+ ':root :where(.is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:root :where(.is-layout-flex) { gap: 12px; }:root { --wp--style--block-gap: 12px; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
784
784
  );
785
785
  } );
786
786
 
@@ -797,7 +797,7 @@ describe( 'global styles renderer', () => {
797
797
  } );
798
798
 
799
799
  expect( layoutStyles ).toEqual(
800
- '.wp-block-group-is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.wp-block-group-is-layout-flow > * + * { margin-block-start: 12px; margin-block-end: 0; }.wp-block-group-is-layout-flex { gap: 12px; }'
800
+ ':root :where(.wp-block-group-is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.wp-block-group-is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:root :where(.wp-block-group-is-layout-flex) { gap: 12px; }'
801
801
  );
802
802
  } );
803
803
 
@@ -1008,9 +1008,23 @@ describe( 'global styles renderer', () => {
1008
1008
  ref: 'styles.elements.h1.typography.letterSpacing',
1009
1009
  },
1010
1010
  },
1011
+ background: {
1012
+ backgroundImage: {
1013
+ ref: 'styles.background.backgroundImage',
1014
+ },
1015
+ backgroundSize: {
1016
+ ref: 'styles.background.backgroundSize',
1017
+ },
1018
+ },
1011
1019
  };
1012
1020
  const tree = {
1013
1021
  styles: {
1022
+ background: {
1023
+ backgroundImage: {
1024
+ url: 'http://my-image.org/image.gif',
1025
+ },
1026
+ backgroundSize: 'cover',
1027
+ },
1014
1028
  elements: {
1015
1029
  h1: {
1016
1030
  typography: {
@@ -1026,6 +1040,8 @@ describe( 'global styles renderer', () => {
1026
1040
  ).toEqual( [
1027
1041
  'font-size: var(--wp--preset--font-size--xx-large)',
1028
1042
  'letter-spacing: 2px',
1043
+ "background-image: url( 'http://my-image.org/image.gif' )",
1044
+ 'background-size: cover',
1029
1045
  ] );
1030
1046
  } );
1031
1047
  it( 'should set default values for block background styles', () => {
@@ -1061,7 +1077,7 @@ describe( 'global styles renderer', () => {
1061
1077
  )
1062
1078
  ).toEqual( [
1063
1079
  "background-image: url( 'https://wordpress.org/assets/image.jpg' )",
1064
- 'background-position: center',
1080
+ 'background-position: 50% 50%',
1065
1081
  'background-size: contain',
1066
1082
  ] );
1067
1083
  } );
@@ -10,7 +10,7 @@ import {
10
10
  } from '@wordpress/blocks';
11
11
  import { useSelect } from '@wordpress/data';
12
12
  import { useContext, useMemo } from '@wordpress/element';
13
- import { getCSSRules } from '@wordpress/style-engine';
13
+ import { getCSSRules, getCSSValueFromRawStyle } from '@wordpress/style-engine';
14
14
  import { privateApis as componentsPrivateApis } from '@wordpress/components';
15
15
 
16
16
  /**
@@ -24,7 +24,6 @@ import {
24
24
  scopeFeatureSelectors,
25
25
  appendToSelector,
26
26
  getBlockStyleVariationSelector,
27
- compileStyleValue,
28
27
  getResolvedValue,
29
28
  } from './utils';
30
29
  import { getBlockCSSSelector } from './get-block-css-selector';
@@ -357,7 +356,7 @@ export function getStylesDeclarations(
357
356
  ? name
358
357
  : kebabCase( name );
359
358
  declarations.push(
360
- `${ cssProperty }: ${ compileStyleValue(
359
+ `${ cssProperty }: ${ getCSSValueFromRawStyle(
361
360
  getValueFromObjectPath( styleValue, [ prop ] )
362
361
  ) }`
363
362
  );
@@ -369,7 +368,7 @@ export function getStylesDeclarations(
369
368
  ? key
370
369
  : kebabCase( key );
371
370
  declarations.push(
372
- `${ cssProperty }: ${ compileStyleValue(
371
+ `${ cssProperty }: ${ getCSSValueFromRawStyle(
373
372
  getValueFromObjectPath( blockStyles, pathToValue )
374
373
  ) }`
375
374
  );
@@ -538,10 +537,10 @@ export function getLayoutStyles( {
538
537
  } else {
539
538
  combinedSelector =
540
539
  selector === ROOT_BLOCK_SELECTOR
541
- ? `.${ className }${
540
+ ? `:root :where(.${ className })${
542
541
  spacingStyle?.selector || ''
543
542
  }`
544
- : `${ selector }-${ className }${
543
+ : `:root :where(${ selector }-${ className })${
545
544
  spacingStyle?.selector || ''
546
545
  }`;
547
546
  }
@@ -7,6 +7,7 @@ import fastDeepEqual from 'fast-deep-equal/es6';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useViewportMatch } from '@wordpress/compose';
10
+ import { getCSSValueFromRawStyle } from '@wordpress/style-engine';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -526,34 +527,6 @@ export function getBlockStyleVariationSelector( variation, blockSelector ) {
526
527
  return result.join( ',' );
527
528
  }
528
529
 
529
- /**
530
- * Converts style preset values `var:` to CSS custom var values.
531
- * TODO: Export and use the style engine util: getCSSVarFromStyleValue().
532
- *
533
- * Example:
534
- *
535
- * compileStyleValue( 'var:preset|color|primary' ) // returns 'var(--wp--color-primary)'
536
- *
537
- * @param {string} uncompiledValue A block style value.
538
- * @return {string} The compiled, or original value.
539
- */
540
- export function compileStyleValue( uncompiledValue ) {
541
- const VARIABLE_REFERENCE_PREFIX = 'var:';
542
- if (
543
- 'string' === typeof uncompiledValue &&
544
- uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX )
545
- ) {
546
- const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
547
- const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
548
- const variable = uncompiledValue
549
- .slice( VARIABLE_REFERENCE_PREFIX.length )
550
- .split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )
551
- .join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );
552
- return `var(--wp--${ variable })`;
553
- }
554
- return uncompiledValue;
555
- }
556
-
557
530
  /**
558
531
  * Looks up a theme file URI based on a relative path.
559
532
  *
@@ -589,9 +562,14 @@ export function getResolvedRefValue( ruleValue, tree ) {
589
562
  return ruleValue;
590
563
  }
591
564
 
565
+ /*
566
+ * Where the rule value is an object with a 'ref' property pointing
567
+ * to a path, this converts that path into the value at that path.
568
+ * For example: { "ref": "style.color.background" } => "#fff".
569
+ */
592
570
  if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
593
571
  const refPath = ruleValue.ref.split( '.' );
594
- const resolvedRuleValue = compileStyleValue(
572
+ const resolvedRuleValue = getCSSValueFromRawStyle(
595
573
  getValueFromObjectPath( tree, refPath )
596
574
  );
597
575