@wordpress/block-editor 12.21.0 → 12.23.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 (408) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/build/components/block-actions/index.js +2 -4
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.js +5 -5
  6. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  7. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  8. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  9. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  10. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  11. package/build/components/block-list/block-crash-warning.native.js +24 -0
  12. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  13. package/build/components/block-list/block.js +11 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +7 -2
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-mover/button.js +4 -1
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +5 -1
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-patterns-list/index.js +4 -1
  22. package/build/components/block-patterns-list/index.js.map +1 -1
  23. package/build/components/block-settings/container.native.js +2 -1
  24. package/build/components/block-settings/container.native.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-settings-menu-controls/index.js +1 -3
  28. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  29. package/build/components/block-switcher/index.js +4 -3
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.js +8 -5
  32. package/build/components/block-toolbar/index.js.map +1 -1
  33. package/build/components/block-toolbar/shuffle.js +19 -10
  34. package/build/components/block-toolbar/shuffle.js.map +1 -1
  35. package/build/components/block-tools/block-selection-button.js +48 -8
  36. package/build/components/block-tools/block-selection-button.js.map +1 -1
  37. package/build/components/block-tools/index.js +14 -2
  38. package/build/components/block-tools/index.js.map +1 -1
  39. package/build/components/child-layout-control/index.js +108 -11
  40. package/build/components/child-layout-control/index.js.map +1 -1
  41. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  42. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  43. package/build/components/global-styles/advanced-panel.js +9 -2
  44. package/build/components/global-styles/advanced-panel.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +444 -0
  46. package/build/components/global-styles/background-panel.js.map +1 -0
  47. package/build/components/global-styles/color-panel.js +2 -1
  48. package/build/components/global-styles/color-panel.js.map +1 -1
  49. package/build/components/global-styles/dimensions-panel.js +8 -33
  50. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  51. package/build/components/global-styles/get-global-styles-changes.js +3 -0
  52. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +1 -1
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/index.js +13 -0
  56. package/build/components/global-styles/index.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +16 -15
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +2 -3
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +43 -34
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  64. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  65. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  66. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  67. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  68. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  69. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  70. package/build/components/inserter/library.js +2 -0
  71. package/build/components/inserter/library.js.map +1 -1
  72. package/build/components/inserter/menu.js +11 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  75. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  76. package/build/components/inserter/search-items.js +36 -15
  77. package/build/components/inserter/search-items.js.map +1 -1
  78. package/build/components/inserter/search-results.js +2 -3
  79. package/build/components/inserter/search-results.js.map +1 -1
  80. package/build/components/inserter/tabs.js +1 -2
  81. package/build/components/inserter/tabs.js.map +1 -1
  82. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  83. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  84. package/build/components/keyboard-shortcuts/index.js +11 -0
  85. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  86. package/build/components/list-view/block-select-button.js +18 -12
  87. package/build/components/list-view/block-select-button.js.map +1 -1
  88. package/build/components/list-view/block.js +4 -11
  89. package/build/components/list-view/block.js.map +1 -1
  90. package/build/components/list-view/index.js +17 -2
  91. package/build/components/list-view/index.js.map +1 -1
  92. package/build/components/list-view/use-list-view-collapse-items.js +47 -0
  93. package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
  94. package/build/components/list-view/utils.js +5 -3
  95. package/build/components/list-view/utils.js.map +1 -1
  96. package/build/components/rich-text/index.js +14 -11
  97. package/build/components/rich-text/index.js.map +1 -1
  98. package/build/components/rich-text/index.native.js +17 -11
  99. package/build/components/rich-text/index.native.js.map +1 -1
  100. package/build/components/rich-text/native/get-format-colors.native.js +1 -1
  101. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  102. package/build/components/rich-text/native/index.native.js +2 -2
  103. package/build/components/rich-text/native/index.native.js.map +1 -1
  104. package/build/components/rich-text/with-deprecations.js +0 -3
  105. package/build/components/rich-text/with-deprecations.js.map +1 -1
  106. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  107. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  108. package/build/components/url-popover/image-url-input-ui.js +50 -36
  109. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  110. package/build/components/use-block-display-information/index.js +4 -6
  111. package/build/components/use-block-display-information/index.js.map +1 -1
  112. package/build/components/use-moving-animation/index.js +4 -0
  113. package/build/components/use-moving-animation/index.js.map +1 -1
  114. package/build/components/warning/index.native.js +9 -4
  115. package/build/components/warning/index.native.js.map +1 -1
  116. package/build/hooks/anchor.js +9 -10
  117. package/build/hooks/anchor.js.map +1 -1
  118. package/build/hooks/background.js +85 -402
  119. package/build/hooks/background.js.map +1 -1
  120. package/build/hooks/index.js +9 -1
  121. package/build/hooks/index.js.map +1 -1
  122. package/build/hooks/layout-child.js +28 -6
  123. package/build/hooks/layout-child.js.map +1 -1
  124. package/build/hooks/layout.js +21 -10
  125. package/build/hooks/layout.js.map +1 -1
  126. package/build/hooks/position.js +1 -1
  127. package/build/hooks/position.js.map +1 -1
  128. package/build/hooks/use-zoom-out.js +47 -0
  129. package/build/hooks/use-zoom-out.js.map +1 -0
  130. package/build/index.js +7 -0
  131. package/build/index.js.map +1 -1
  132. package/build/private-apis.js +6 -1
  133. package/build/private-apis.js.map +1 -1
  134. package/build/private-apis.native.js +5 -1
  135. package/build/private-apis.native.js.map +1 -1
  136. package/build/store/private-actions.js +13 -0
  137. package/build/store/private-actions.js.map +1 -1
  138. package/build/store/private-keys.js +2 -1
  139. package/build/store/private-keys.js.map +1 -1
  140. package/build/store/private-selectors.js +24 -3
  141. package/build/store/private-selectors.js.map +1 -1
  142. package/build/store/reducer.js +53 -26
  143. package/build/store/reducer.js.map +1 -1
  144. package/build/store/selectors.js +34 -32
  145. package/build/store/selectors.js.map +1 -1
  146. package/build/store/utils.js +7 -1
  147. package/build/store/utils.js.map +1 -1
  148. package/build/utils/transform-styles/index.js +2 -1
  149. package/build/utils/transform-styles/index.js.map +1 -1
  150. package/build-module/components/block-actions/index.js +2 -4
  151. package/build-module/components/block-actions/index.js.map +1 -1
  152. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  153. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  154. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  155. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  156. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  157. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  158. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  159. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  160. package/build-module/components/block-list/block.js +11 -3
  161. package/build-module/components/block-list/block.js.map +1 -1
  162. package/build-module/components/block-list/block.native.js +7 -2
  163. package/build-module/components/block-list/block.native.js.map +1 -1
  164. package/build-module/components/block-mover/button.js +4 -1
  165. package/build-module/components/block-mover/button.js.map +1 -1
  166. package/build-module/components/block-mover/index.js +5 -1
  167. package/build-module/components/block-mover/index.js.map +1 -1
  168. package/build-module/components/block-patterns-list/index.js +4 -1
  169. package/build-module/components/block-patterns-list/index.js.map +1 -1
  170. package/build-module/components/block-settings/container.native.js +3 -2
  171. package/build-module/components/block-settings/container.native.js.map +1 -1
  172. package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  174. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  175. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  176. package/build-module/components/block-switcher/index.js +4 -3
  177. package/build-module/components/block-switcher/index.js.map +1 -1
  178. package/build-module/components/block-toolbar/index.js +8 -5
  179. package/build-module/components/block-toolbar/index.js.map +1 -1
  180. package/build-module/components/block-toolbar/shuffle.js +19 -10
  181. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  182. package/build-module/components/block-tools/block-selection-button.js +50 -10
  183. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  184. package/build-module/components/block-tools/index.js +14 -2
  185. package/build-module/components/block-tools/index.js.map +1 -1
  186. package/build-module/components/child-layout-control/index.js +109 -12
  187. package/build-module/components/child-layout-control/index.js.map +1 -1
  188. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  189. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  190. package/build-module/components/global-styles/advanced-panel.js +9 -2
  191. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  192. package/build-module/components/global-styles/background-panel.js +430 -0
  193. package/build-module/components/global-styles/background-panel.js.map +1 -0
  194. package/build-module/components/global-styles/color-panel.js +2 -1
  195. package/build-module/components/global-styles/color-panel.js.map +1 -1
  196. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  197. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  198. package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
  199. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  200. package/build-module/components/global-styles/hooks.js +1 -1
  201. package/build-module/components/global-styles/hooks.js.map +1 -1
  202. package/build-module/components/global-styles/index.js +1 -0
  203. package/build-module/components/global-styles/index.js.map +1 -1
  204. package/build-module/components/global-styles/use-global-styles-output.js +17 -16
  205. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  206. package/build-module/components/global-styles/utils.js +1 -2
  207. package/build-module/components/global-styles/utils.js.map +1 -1
  208. package/build-module/components/iframe/index.js +43 -34
  209. package/build-module/components/iframe/index.js.map +1 -1
  210. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  211. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  212. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  213. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  214. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  216. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  217. package/build-module/components/inserter/library.js +2 -0
  218. package/build-module/components/inserter/library.js.map +1 -1
  219. package/build-module/components/inserter/menu.js +11 -11
  220. package/build-module/components/inserter/menu.js.map +1 -1
  221. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  222. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  223. package/build-module/components/inserter/search-items.js +33 -15
  224. package/build-module/components/inserter/search-items.js.map +1 -1
  225. package/build-module/components/inserter/search-results.js +2 -3
  226. package/build-module/components/inserter/search-results.js.map +1 -1
  227. package/build-module/components/inserter/tabs.js +1 -2
  228. package/build-module/components/inserter/tabs.js.map +1 -1
  229. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  230. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  231. package/build-module/components/keyboard-shortcuts/index.js +11 -0
  232. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  233. package/build-module/components/list-view/block-select-button.js +19 -13
  234. package/build-module/components/list-view/block-select-button.js.map +1 -1
  235. package/build-module/components/list-view/block.js +6 -13
  236. package/build-module/components/list-view/block.js.map +1 -1
  237. package/build-module/components/list-view/index.js +17 -2
  238. package/build-module/components/list-view/index.js.map +1 -1
  239. package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
  240. package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
  241. package/build-module/components/list-view/utils.js +2 -1
  242. package/build-module/components/list-view/utils.js.map +1 -1
  243. package/build-module/components/rich-text/index.js +15 -12
  244. package/build-module/components/rich-text/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.native.js +16 -11
  246. package/build-module/components/rich-text/index.native.js.map +1 -1
  247. package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
  248. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  249. package/build-module/components/rich-text/native/index.native.js +2 -2
  250. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  251. package/build-module/components/rich-text/with-deprecations.js +0 -3
  252. package/build-module/components/rich-text/with-deprecations.js.map +1 -1
  253. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  254. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  255. package/build-module/components/url-popover/image-url-input-ui.js +50 -36
  256. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  257. package/build-module/components/use-block-display-information/index.js +5 -7
  258. package/build-module/components/use-block-display-information/index.js.map +1 -1
  259. package/build-module/components/use-moving-animation/index.js +4 -0
  260. package/build-module/components/use-moving-animation/index.js.map +1 -1
  261. package/build-module/components/warning/index.native.js +9 -4
  262. package/build-module/components/warning/index.native.js.map +1 -1
  263. package/build-module/hooks/anchor.js +10 -11
  264. package/build-module/hooks/anchor.js.map +1 -1
  265. package/build-module/hooks/background.js +82 -397
  266. package/build-module/hooks/background.js.map +1 -1
  267. package/build-module/hooks/index.js +3 -1
  268. package/build-module/hooks/index.js.map +1 -1
  269. package/build-module/hooks/layout-child.js +28 -6
  270. package/build-module/hooks/layout-child.js.map +1 -1
  271. package/build-module/hooks/layout.js +21 -10
  272. package/build-module/hooks/layout.js.map +1 -1
  273. package/build-module/hooks/position.js +1 -1
  274. package/build-module/hooks/position.js.map +1 -1
  275. package/build-module/hooks/use-zoom-out.js +41 -0
  276. package/build-module/hooks/use-zoom-out.js.map +1 -0
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/private-apis.js +7 -2
  280. package/build-module/private-apis.js.map +1 -1
  281. package/build-module/private-apis.native.js +5 -1
  282. package/build-module/private-apis.native.js.map +1 -1
  283. package/build-module/store/private-actions.js +12 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-keys.js +1 -0
  286. package/build-module/store/private-keys.js.map +1 -1
  287. package/build-module/store/private-selectors.js +22 -4
  288. package/build-module/store/private-selectors.js.map +1 -1
  289. package/build-module/store/reducer.js +52 -26
  290. package/build-module/store/reducer.js.map +1 -1
  291. package/build-module/store/selectors.js +35 -33
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +6 -1
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/transform-styles/index.js +2 -1
  296. package/build-module/utils/transform-styles/index.js.map +1 -1
  297. package/build-style/content-rtl.css +18 -1
  298. package/build-style/content.css +18 -1
  299. package/build-style/style-rtl.css +92 -99
  300. package/build-style/style.css +92 -99
  301. package/package.json +31 -31
  302. package/src/components/block-actions/index.js +2 -8
  303. package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
  304. package/src/components/block-heading-level-dropdown/README.md +5 -5
  305. package/src/components/block-heading-level-dropdown/index.js +5 -5
  306. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  307. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  308. package/src/components/block-list/block-crash-warning.native.js +19 -0
  309. package/src/components/block-list/block.js +19 -3
  310. package/src/components/block-list/block.native.js +14 -7
  311. package/src/components/block-list/content.scss +16 -0
  312. package/src/components/block-mover/button.js +4 -1
  313. package/src/components/block-mover/index.js +8 -1
  314. package/src/components/block-patterns-list/index.js +22 -17
  315. package/src/components/block-preview/style.scss +28 -0
  316. package/src/components/block-settings/container.native.js +5 -1
  317. package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
  318. package/src/components/block-settings-menu-controls/README.md +0 -9
  319. package/src/components/block-settings-menu-controls/index.js +1 -6
  320. package/src/components/block-switcher/index.js +5 -3
  321. package/src/components/block-switcher/style.scss +1 -1
  322. package/src/components/block-toolbar/index.js +25 -20
  323. package/src/components/block-toolbar/shuffle.js +20 -14
  324. package/src/components/block-toolbar/style.scss +1 -1
  325. package/src/components/block-toolbar/test/index.native.js +1 -7
  326. package/src/components/block-tools/block-selection-button.js +66 -9
  327. package/src/components/block-tools/index.js +18 -1
  328. package/src/components/button-block-appender/content.scss +5 -1
  329. package/src/components/child-layout-control/index.js +147 -35
  330. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  331. package/src/components/default-block-appender/content.scss +2 -2
  332. package/src/components/global-styles/advanced-panel.js +8 -2
  333. package/src/components/global-styles/background-panel.js +591 -0
  334. package/src/components/global-styles/color-panel.js +2 -1
  335. package/src/components/global-styles/dimensions-panel.js +9 -34
  336. package/src/components/global-styles/get-global-styles-changes.js +3 -0
  337. package/src/components/global-styles/hooks.js +1 -0
  338. package/src/components/global-styles/index.js +4 -0
  339. package/src/components/global-styles/style.scss +78 -1
  340. package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
  341. package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
  342. package/src/components/global-styles/test/use-global-styles-output.js +40 -9
  343. package/src/components/global-styles/use-global-styles-output.js +30 -17
  344. package/src/components/global-styles/utils.js +1 -18
  345. package/src/components/iframe/index.js +79 -53
  346. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  347. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  348. package/src/components/inserter/block-patterns-tab/index.js +1 -0
  349. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  350. package/src/components/inserter/library.js +4 -0
  351. package/src/components/inserter/menu.js +12 -11
  352. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  353. package/src/components/inserter/search-items.js +37 -15
  354. package/src/components/inserter/search-results.js +1 -2
  355. package/src/components/inserter/style.scss +6 -12
  356. package/src/components/inserter/tabs.js +1 -2
  357. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  358. package/src/components/keyboard-shortcuts/index.js +11 -0
  359. package/src/components/link-control/style.scss +0 -5
  360. package/src/components/list-view/block-select-button.js +15 -19
  361. package/src/components/list-view/block.js +12 -21
  362. package/src/components/list-view/index.js +18 -1
  363. package/src/components/list-view/style.scss +38 -28
  364. package/src/components/list-view/use-list-view-collapse-items.js +33 -0
  365. package/src/components/list-view/utils.js +4 -1
  366. package/src/components/rich-text/README.md +6 -0
  367. package/src/components/rich-text/index.js +30 -13
  368. package/src/components/rich-text/index.native.js +14 -11
  369. package/src/components/rich-text/native/get-format-colors.native.js +1 -1
  370. package/src/components/rich-text/native/index.native.js +2 -2
  371. package/src/components/rich-text/with-deprecations.js +0 -3
  372. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  373. package/src/components/url-popover/image-url-input-ui.js +68 -51
  374. package/src/components/use-block-display-information/index.js +8 -10
  375. package/src/components/use-moving-animation/index.js +1 -0
  376. package/src/components/warning/index.native.js +19 -15
  377. package/src/hooks/anchor.js +43 -61
  378. package/src/hooks/background.js +100 -516
  379. package/src/hooks/index.js +3 -0
  380. package/src/hooks/layout-child.js +44 -8
  381. package/src/hooks/layout.js +22 -18
  382. package/src/hooks/position.js +1 -1
  383. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  384. package/src/hooks/test/anchor.native.js +32 -0
  385. package/src/hooks/use-zoom-out.js +36 -0
  386. package/src/index.js +1 -0
  387. package/src/private-apis.js +13 -1
  388. package/src/private-apis.native.js +4 -0
  389. package/src/store/private-actions.js +12 -0
  390. package/src/store/private-keys.js +1 -0
  391. package/src/store/private-selectors.js +54 -27
  392. package/src/store/reducer.js +63 -41
  393. package/src/store/selectors.js +195 -180
  394. package/src/store/test/private-actions.js +10 -0
  395. package/src/store/test/private-selectors.js +13 -0
  396. package/src/store/test/reducer.js +26 -0
  397. package/src/store/test/selectors.js +90 -199
  398. package/src/store/utils.js +13 -0
  399. package/src/style.scss +0 -2
  400. package/src/utils/transform-styles/index.js +2 -1
  401. package/tsconfig.json +1 -0
  402. package/build/utils/calculate-scale.js +0 -17
  403. package/build/utils/calculate-scale.js.map +0 -1
  404. package/build-module/utils/calculate-scale.js +0 -11
  405. package/build-module/utils/calculate-scale.js.map +0 -1
  406. package/src/hooks/anchor.scss +0 -4
  407. package/src/hooks/background.scss +0 -75
  408. package/src/utils/calculate-scale.js +0 -20
@@ -31,5 +31,9 @@ export {
31
31
  useHasImageSettingsPanel,
32
32
  } from './image-settings-panel';
33
33
  export { default as AdvancedPanel } from './advanced-panel';
34
+ export {
35
+ default as BackgroundPanel,
36
+ useHasBackgroundPanel,
37
+ } from './background-panel';
34
38
  export { areGlobalStyleConfigsEqual } from './utils';
35
39
  export { default as getGlobalStylesChanges } from './get-global-styles-changes';
@@ -2,7 +2,7 @@
2
2
  fill: currentColor;
3
3
  }
4
4
 
5
- // @todo: Ideally, popover, swatch size, and gap values should be CSS variables
5
+ // @todo Ideally, popover, swatch size, and gap values should be CSS variables
6
6
  // to apply precise grid layouts.
7
7
  // https://github.com/WordPress/gutenberg/blob/954ecae571abbddc113d3a4bd8e1a72230180554/packages/block-editor/src/components/duotone-control/style.scss#L3-L9
8
8
  .block-editor-global-styles__shadow-popover-container {
@@ -70,3 +70,80 @@
70
70
  /*rtl:ignore*/
71
71
  direction: ltr;
72
72
  }
73
+
74
+ .block-editor-global-styles-background-panel__inspector-media-replace-container {
75
+ position: relative;
76
+ // Since there is no option to skip rendering the drag'n'drop icon in drop
77
+ // zone, we hide it for now.
78
+ .components-drop-zone__content-icon {
79
+ display: none;
80
+ }
81
+
82
+ button.components-button {
83
+ color: $gray-900;
84
+ box-shadow: inset 0 0 0 $border-width $gray-300;
85
+ width: 100%;
86
+ display: block;
87
+ height: $grid-unit-50;
88
+
89
+ &:hover {
90
+ color: var(--wp-admin-theme-color);
91
+ }
92
+
93
+ &:focus {
94
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
95
+ }
96
+ }
97
+
98
+ .block-editor-global-styles-background-panel__inspector-media-replace-title {
99
+ word-break: break-all;
100
+ // The Button component is white-space: nowrap, and that won't work with line-clamp.
101
+ white-space: normal;
102
+
103
+ // Without this, the ellipsis can sometimes be partially hidden by the Button padding.
104
+ text-align: start;
105
+ text-align-last: center;
106
+ }
107
+
108
+ .components-dropdown {
109
+ display: block;
110
+ }
111
+ }
112
+
113
+ .block-editor-global-styles-background-panel__inspector-image-indicator-wrapper {
114
+ background: #fff linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%); // Show a diagonal line (crossed out) for empty background image.
115
+ border-radius: $radius-round !important; // Override the default border-radius inherited from FlexItem.
116
+ box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
117
+ display: block;
118
+ width: 20px;
119
+ height: 20px;
120
+ flex: none;
121
+
122
+ &.has-image {
123
+ background: #fff; // No diagonal line for non-empty background image. A background color is in use to account for partially transparent images.
124
+ }
125
+ }
126
+
127
+ .block-editor-global-styles-background-panel__inspector-image-indicator {
128
+ background-size: cover;
129
+ border-radius: $radius-round;
130
+ width: 20px;
131
+ height: 20px;
132
+ display: block;
133
+ position: relative;
134
+ }
135
+
136
+ .block-editor-global-styles-background-panel__inspector-image-indicator::after {
137
+ content: "";
138
+ position: absolute;
139
+ top: -1px;
140
+ left: -1px;
141
+ bottom: -1px;
142
+ right: -1px;
143
+ border-radius: $radius-round;
144
+ box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
145
+ // Show a thin outline in Windows high contrast mode, otherwise the button is invisible.
146
+ border: 1px solid transparent;
147
+ box-sizing: inherit;
148
+ }
149
+
@@ -5,7 +5,8 @@
5
5
  import {
6
6
  backgroundPositionToCoords,
7
7
  coordsToBackgroundPosition,
8
- } from '../background';
8
+ hasBackgroundImageValue,
9
+ } from '../background-panel';
9
10
 
10
11
  describe( 'backgroundPositionToCoords', () => {
11
12
  it( 'should return the correct coordinates for a percentage value using 2-value syntax', () => {
@@ -48,3 +49,37 @@ describe( 'coordsToBackgroundPosition', () => {
48
49
  expect( coordsToBackgroundPosition( {} ) ).toBeUndefined();
49
50
  } );
50
51
  } );
52
+
53
+ describe( 'hasBackgroundImageValue', () => {
54
+ it( 'should return `true` when id and url exist', () => {
55
+ expect(
56
+ hasBackgroundImageValue( {
57
+ background: { backgroundImage: { id: 1, url: 'url' } },
58
+ } )
59
+ ).toBe( true );
60
+ } );
61
+
62
+ it( 'should return `true` when only url exists', () => {
63
+ expect(
64
+ hasBackgroundImageValue( {
65
+ background: { backgroundImage: { url: 'url' } },
66
+ } )
67
+ ).toBe( true );
68
+ } );
69
+
70
+ it( 'should return `true` when only id exists', () => {
71
+ expect(
72
+ hasBackgroundImageValue( {
73
+ background: { backgroundImage: { id: 1 } },
74
+ } )
75
+ ).toBe( true );
76
+ } );
77
+
78
+ it( 'should return `false` when id and url do not exist', () => {
79
+ expect(
80
+ hasBackgroundImageValue( {
81
+ background: { backgroundImage: {} },
82
+ } )
83
+ ).toBe( false );
84
+ } );
85
+ } );
@@ -17,6 +17,15 @@ import {
17
17
  describe( 'getGlobalStylesChanges and utils', () => {
18
18
  const next = {
19
19
  styles: {
20
+ background: {
21
+ backgroundImage: {
22
+ url: 'https://example.com/image.jpg',
23
+ source: 'file',
24
+ },
25
+ backgroundSize: 'contain',
26
+ backgroundPosition: '30% 30%',
27
+ backgroundRepeat: 'no-repeat',
28
+ },
20
29
  typography: {
21
30
  fontSize: 'var(--wp--preset--font-size--potato)',
22
31
  fontStyle: 'normal',
@@ -84,6 +93,15 @@ describe( 'getGlobalStylesChanges and utils', () => {
84
93
  };
85
94
  const previous = {
86
95
  styles: {
96
+ background: {
97
+ backgroundImage: {
98
+ url: 'https://example.com/image_new.jpg',
99
+ source: 'file',
100
+ },
101
+ backgroundSize: 'contain',
102
+ backgroundPosition: '40% 77%',
103
+ backgroundRepeat: 'repeat',
104
+ },
87
105
  typography: {
88
106
  fontSize: 'var(--wp--preset--font-size--fungus)',
89
107
  fontStyle: 'normal',
@@ -195,7 +213,7 @@ describe( 'getGlobalStylesChanges and utils', () => {
195
213
  it( 'returns a list of changes', () => {
196
214
  const result = getGlobalStylesChanges( next, previous );
197
215
  expect( result ).toEqual( [
198
- 'Colors, Typography styles.',
216
+ 'Background, Colors, Typography styles.',
199
217
  'Test pumpkin flowers block.',
200
218
  'H3, Caption, H6, Link elements.',
201
219
  'Color, Typography settings.',
@@ -204,10 +222,10 @@ describe( 'getGlobalStylesChanges and utils', () => {
204
222
 
205
223
  it( 'returns a list of truncated changes', () => {
206
224
  const resultA = getGlobalStylesChanges( next, previous, {
207
- maxResults: 3,
225
+ maxResults: 4,
208
226
  } );
209
227
  expect( resultA ).toEqual( [
210
- 'Colors, Typography styles.',
228
+ 'Background, Colors, Typography styles.',
211
229
  'Test pumpkin flowers block.',
212
230
  ] );
213
231
  } );
@@ -254,6 +272,7 @@ describe( 'getGlobalStylesChanges and utils', () => {
254
272
  const resultA = getGlobalStylesChangelist( next, previous );
255
273
 
256
274
  expect( resultA ).toEqual( [
275
+ [ 'styles', 'Background' ],
257
276
  [ 'styles', 'Colors' ],
258
277
  [ 'styles', 'Typography' ],
259
278
  [ 'blocks', 'Test pumpkin flowers' ],
@@ -16,7 +16,7 @@ import {
16
16
  getStylesDeclarations,
17
17
  processCSSNesting,
18
18
  } from '../use-global-styles-output';
19
- import { ROOT_BLOCK_SELECTOR } from '../utils';
19
+ import { ROOT_BLOCK_SELECTOR, ROOT_CSS_PROPERTIES_SELECTOR } from '../utils';
20
20
 
21
21
  describe( 'global styles renderer', () => {
22
22
  describe( 'getNodesWithStyles', () => {
@@ -254,7 +254,7 @@ describe( 'global styles renderer', () => {
254
254
  ],
255
255
  },
256
256
  },
257
- selector: ROOT_BLOCK_SELECTOR,
257
+ selector: ROOT_CSS_PROPERTIES_SELECTOR,
258
258
  },
259
259
  {
260
260
  presets: {
@@ -342,7 +342,7 @@ describe( 'global styles renderer', () => {
342
342
  };
343
343
 
344
344
  expect( toCustomProperties( tree, blockSelectors ) ).toEqual(
345
- 'body{--wp--preset--color--white: white;--wp--preset--color--black: black;--wp--preset--color--white-2-black: value;--wp--custom--white-2-black: value;--wp--custom--font-primary: value;--wp--custom--line-height--body: 1.7;--wp--custom--line-height--heading: 1.3;}h1,h2,h3,h4,h5,h6{--wp--preset--font-size--small: 12px;--wp--preset--font-size--medium: 23px;}'
345
+ ':root{--wp--preset--color--white: white;--wp--preset--color--black: black;--wp--preset--color--white-2-black: value;--wp--custom--white-2-black: value;--wp--custom--font-primary: value;--wp--custom--line-height--body: 1.7;--wp--custom--line-height--heading: 1.3;}h1,h2,h3,h4,h5,h6{--wp--preset--font-size--small: 12px;--wp--preset--font-size--medium: 23px;}'
346
346
  );
347
347
  } );
348
348
  } );
@@ -481,8 +481,8 @@ describe( 'global styles renderer', () => {
481
481
 
482
482
  expect( toStyles( tree, blockSelectors ) ).toEqual(
483
483
  'body {margin: 0;}body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-constrained > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-constrained > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: var(--wp--style--global--content-size); margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignwide { max-width: var(--wp--style--global--wide-size); }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }body .is-layout-grid { display:grid; }body .is-layout-grid > * { margin: 0; }' +
484
- 'body{background-color: red;margin: 10px;padding: 10px;}a:where(:not(.wp-element-button)){color: blue;}a:where(:not(.wp-element-button)):hover{color: orange;}a:where(:not(.wp-element-button)):focus{color: orange;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a:where(:not(.wp-element-button)),h2 a:where(:not(.wp-element-button)),h3 a:where(:not(.wp-element-button)),h4 a:where(:not(.wp-element-button)),h5 a:where(:not(.wp-element-button)),h6 a:where(:not(.wp-element-button)){color: hotpink;}h1 a:where(:not(.wp-element-button)):hover,h2 a:where(:not(.wp-element-button)):hover,h3 a:where(:not(.wp-element-button)):hover,h4 a:where(:not(.wp-element-button)):hover,h5 a:where(:not(.wp-element-button)):hover,h6 a:where(:not(.wp-element-button)):hover{color: red;}h1 a:where(:not(.wp-element-button)):focus,h2 a:where(:not(.wp-element-button)):focus,h3 a:where(:not(.wp-element-button)):focus,h4 a:where(:not(.wp-element-button)):focus,h5 a:where(:not(.wp-element-button)):focus,h6 a:where(:not(.wp-element-button)):focus{color: red;}' +
485
- '.wp-block-image img, .wp-block-image .wp-crop-area{border-radius: 9999px;}.wp-block-image{color: red;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
484
+ ':where(body){background-color: red;margin: 10px;padding: 10px;}:where(a:where(:not(.wp-element-button))){color: blue;}a:where(:not(.wp-element-button)):hover{color: orange;}a:where(:not(.wp-element-button)):focus{color: orange;}:where(h1){font-size: 42px;}:where(.wp-block-group){margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}:where(h1,h2,h3,h4,h5,h6){color: orange;}:where(h1 a:where(:not(.wp-element-button)),h2 a:where(:not(.wp-element-button)),h3 a:where(:not(.wp-element-button)),h4 a:where(:not(.wp-element-button)),h5 a:where(:not(.wp-element-button)),h6 a:where(:not(.wp-element-button))){color: hotpink;}h1 a:where(:not(.wp-element-button)):hover,h2 a:where(:not(.wp-element-button)):hover,h3 a:where(:not(.wp-element-button)):hover,h4 a:where(:not(.wp-element-button)):hover,h5 a:where(:not(.wp-element-button)):hover,h6 a:where(:not(.wp-element-button)):hover{color: red;}h1 a:where(:not(.wp-element-button)):focus,h2 a:where(:not(.wp-element-button)):focus,h3 a:where(:not(.wp-element-button)):focus,h4 a:where(:not(.wp-element-button)):focus,h5 a:where(:not(.wp-element-button)):focus,h6 a:where(:not(.wp-element-button)):focus{color: red;}' +
485
+ ':where(.wp-block-image img, .wp-block-image .wp-crop-area){border-radius: 9999px;}:where(.wp-block-image){color: red;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
486
486
  '.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
487
487
  );
488
488
  } );
@@ -524,7 +524,7 @@ describe( 'global styles renderer', () => {
524
524
 
525
525
  expect( toStyles( Object.freeze( tree ), blockSelectors ) ).toEqual(
526
526
  'body {margin: 0;}body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-constrained > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-constrained > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: var(--wp--style--global--content-size); margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignwide { max-width: var(--wp--style--global--wide-size); }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }body .is-layout-grid { display:grid; }body .is-layout-grid > * { margin: 0; }' +
527
- '.wp-image-spacing{padding-top: 1px;}.wp-image-border-color{border-color: red;}.wp-image-border{border-radius: 9999px;}.wp-image{color: red;}' +
527
+ ':where(.wp-image-spacing){padding-top: 1px;}:where(.wp-image-border-color){border-color: red;}:where(.wp-image-border){border-radius: 9999px;}:where(.wp-image){color: red;}' +
528
528
  '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'
529
529
  );
530
530
  } );
@@ -614,7 +614,7 @@ describe( 'global styles renderer', () => {
614
614
  },
615
615
  };
616
616
  expect( toStyles( Object.freeze( tree ), 'body' ) ).toEqual(
617
- 'body {margin: 0; --wp--style--global--content-size: 840px; --wp--style--global--wide-size: 1100px;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'
617
+ ':root { --wp--style--global--content-size: 840px; --wp--style--global--wide-size: 1100px;}body {margin: 0;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'
618
618
  );
619
619
  } );
620
620
  } );
@@ -734,7 +734,7 @@ describe( 'global styles renderer', () => {
734
734
  } );
735
735
 
736
736
  expect( layoutStyles ).toEqual(
737
- ':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 0.5em; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 0.5em; }body { --wp--style--block-gap: 0.5em; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
737
+ ':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 0.5em; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 0.5em; }:root { --wp--style--block-gap: 0.5em; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
738
738
  );
739
739
  } );
740
740
 
@@ -751,7 +751,7 @@ describe( 'global styles renderer', () => {
751
751
  } );
752
752
 
753
753
  expect( layoutStyles ).toEqual(
754
- ':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 12px; }body { --wp--style--block-gap: 12px; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
754
+ ':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 12px; }:root { --wp--style--block-gap: 12px; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
755
755
  );
756
756
  } );
757
757
 
@@ -968,6 +968,37 @@ describe( 'global styles renderer', () => {
968
968
  'font-size: 15px',
969
969
  ] );
970
970
  } );
971
+
972
+ it( 'should correctly resolve referenced values', () => {
973
+ const stylesWithRef = {
974
+ typography: {
975
+ fontSize: {
976
+ ref: 'styles.elements.h1.typography.fontSize',
977
+ },
978
+ letterSpacing: {
979
+ ref: 'styles.elements.h1.typography.letterSpacing',
980
+ },
981
+ },
982
+ };
983
+ const tree = {
984
+ styles: {
985
+ elements: {
986
+ h1: {
987
+ typography: {
988
+ fontSize: 'var:preset|font-size|xx-large',
989
+ letterSpacing: '2px',
990
+ },
991
+ },
992
+ },
993
+ },
994
+ };
995
+ expect(
996
+ getStylesDeclarations( stylesWithRef, '.wp-block', false, tree )
997
+ ).toEqual( [
998
+ 'font-size: var(--wp--preset--font-size--xx-large)',
999
+ 'letter-spacing: 2px',
1000
+ ] );
1001
+ } );
971
1002
  } );
972
1003
 
973
1004
  describe( 'processCSSNesting', () => {
@@ -19,6 +19,7 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components';
19
19
  import {
20
20
  PRESET_METADATA,
21
21
  ROOT_BLOCK_SELECTOR,
22
+ ROOT_CSS_PROPERTIES_SELECTOR,
22
23
  scopeSelector,
23
24
  appendToSelector,
24
25
  getBlockStyleVariationSelector,
@@ -409,7 +410,9 @@ export function getStylesDeclarations(
409
410
  let ruleValue = rule.value;
410
411
  if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
411
412
  const refPath = ruleValue.ref.split( '.' );
412
- ruleValue = getValueFromObjectPath( tree, refPath );
413
+ ruleValue = compileStyleValue(
414
+ getValueFromObjectPath( tree, refPath )
415
+ );
413
416
  // Presence of another ref indicates a reference to another dynamic value.
414
417
  // Pointing to another dynamic value is not supported.
415
418
  if ( ! ruleValue || ruleValue?.ref ) {
@@ -541,7 +544,7 @@ export function getLayoutStyles( {
541
544
  );
542
545
  // For backwards compatibility, ensure the legacy block gap CSS variable is still available.
543
546
  if ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {
544
- ruleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;
547
+ ruleset += `${ ROOT_CSS_PROPERTIES_SELECTOR } { --wp--style--block-gap: ${ gapValue }; }`;
545
548
  }
546
549
  }
547
550
 
@@ -727,7 +730,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
727
730
  nodes.push( {
728
731
  presets,
729
732
  custom,
730
- selector: ROOT_BLOCK_SELECTOR,
733
+ selector: ROOT_CSS_PROPERTIES_SELECTOR,
731
734
  } );
732
735
  }
733
736
 
@@ -779,24 +782,28 @@ export const toStyles = (
779
782
  const nodesWithSettings = getNodesWithSettings( tree, blockSelectors );
780
783
  const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
781
784
  const { contentSize, wideSize } = tree?.settings?.layout || {};
785
+ let ruleset = '';
786
+
787
+ if ( contentSize || wideSize ) {
788
+ ruleset += `${ ROOT_CSS_PROPERTIES_SELECTOR } {`;
789
+ ruleset = contentSize
790
+ ? ruleset + ` --wp--style--global--content-size: ${ contentSize };`
791
+ : ruleset;
792
+ ruleset = wideSize
793
+ ? ruleset + ` --wp--style--global--wide-size: ${ wideSize };`
794
+ : ruleset;
795
+ ruleset += '}';
796
+ }
782
797
 
783
798
  /*
784
- * Reset default browser margin on the root body element.
785
- * This is set on the root selector **before** generating the ruleset
799
+ * Reset default browser margin on the body element.
800
+ * This is set on the body selector **before** generating the ruleset
786
801
  * from the `theme.json`. This is to ensure that if the `theme.json` declares
787
802
  * `margin` in its `spacing` declaration for the `body` element then these
788
803
  * user-generated values take precedence in the CSS cascade.
789
804
  * @link https://github.com/WordPress/gutenberg/issues/36147.
790
805
  */
791
- let ruleset = 'body {margin: 0;';
792
-
793
- if ( contentSize ) {
794
- ruleset += ` --wp--style--global--content-size: ${ contentSize };`;
795
- }
796
-
797
- if ( wideSize ) {
798
- ruleset += ` --wp--style--global--wide-size: ${ wideSize };`;
799
- }
806
+ ruleset += 'body {margin: 0;';
800
807
 
801
808
  // Root padding styles should only be output for full templates, not patterns or template parts.
802
809
  if ( useRootPaddingAlign && isTemplate ) {
@@ -837,7 +844,7 @@ export const toStyles = (
837
844
  ( [ cssSelector, declarations ] ) => {
838
845
  if ( declarations.length ) {
839
846
  const rules = declarations.join( ';' );
840
- ruleset += `${ cssSelector }{${ rules };}`;
847
+ ruleset += `:where(${ cssSelector }){${ rules };}`;
841
848
  }
842
849
  }
843
850
  );
@@ -930,7 +937,9 @@ export const toStyles = (
930
937
  isTemplate
931
938
  );
932
939
  if ( declarations?.length ) {
933
- ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
940
+ ruleset += `:where(${ selector }){${ declarations.join(
941
+ ';'
942
+ ) };}`;
934
943
  }
935
944
 
936
945
  // Check for pseudo selector in `styles` and handle separately.
@@ -998,7 +1007,10 @@ export const toStyles = (
998
1007
  }
999
1008
 
1000
1009
  nodesWithSettings.forEach( ( { selector, presets } ) => {
1001
- if ( ROOT_BLOCK_SELECTOR === selector ) {
1010
+ if (
1011
+ ROOT_BLOCK_SELECTOR === selector ||
1012
+ ROOT_CSS_PROPERTIES_SELECTOR === selector
1013
+ ) {
1002
1014
  // Do not add extra specificity for top-level classes.
1003
1015
  selector = '';
1004
1016
  }
@@ -1209,6 +1221,7 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1209
1221
  updatedConfig,
1210
1222
  blockSelectors
1211
1223
  );
1224
+
1212
1225
  const globalStyles = toStyles(
1213
1226
  updatedConfig,
1214
1227
  blockSelectors,
@@ -10,25 +10,8 @@ import { getTypographyFontSizeValue } from './typography-utils';
10
10
  import { getValueFromObjectPath } from '../../utils/object';
11
11
 
12
12
  /* Supporting data. */
13
- export const ROOT_BLOCK_NAME = 'root';
14
13
  export const ROOT_BLOCK_SELECTOR = 'body';
15
- export const ROOT_BLOCK_SUPPORTS = [
16
- 'background',
17
- 'backgroundColor',
18
- 'color',
19
- 'linkColor',
20
- 'captionColor',
21
- 'buttonColor',
22
- 'headingColor',
23
- 'fontFamily',
24
- 'fontSize',
25
- 'fontStyle',
26
- 'fontWeight',
27
- 'lineHeight',
28
- 'textDecoration',
29
- 'textTransform',
30
- 'padding',
31
- ];
14
+ export const ROOT_CSS_PROPERTIES_SELECTOR = ':root';
32
15
 
33
16
  export const PRESET_METADATA = [
34
17
  {