@wordpress/block-editor 15.22.1-next.v.202606191442.0 → 15.22.1

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 (352) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +2 -2
  3. package/build/components/block-editing-mode/index.cjs +13 -7
  4. package/build/components/block-editing-mode/index.cjs.map +2 -2
  5. package/build/components/block-inspector/index.cjs +32 -16
  6. package/build/components/block-inspector/index.cjs.map +2 -2
  7. package/build/components/block-rename/modal.cjs +0 -1
  8. package/build/components/block-rename/modal.cjs.map +2 -2
  9. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  10. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  11. package/build/components/colors-gradients/control.cjs +25 -14
  12. package/build/components/colors-gradients/control.cjs.map +2 -2
  13. package/build/components/colors-gradients/dropdown.cjs +4 -1
  14. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  15. package/build/components/contrast-checker/index.cjs +22 -4
  16. package/build/components/contrast-checker/index.cjs.map +2 -2
  17. package/build/components/date-format-picker/index.cjs +0 -1
  18. package/build/components/date-format-picker/index.cjs.map +2 -2
  19. package/build/components/global-styles/background-panel.cjs +153 -25
  20. package/build/components/global-styles/background-panel.cjs.map +3 -3
  21. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  22. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  23. package/build/components/global-styles/color-panel.cjs +98 -375
  24. package/build/components/global-styles/color-panel.cjs.map +3 -3
  25. package/build/components/global-styles/dimensions-panel.cjs +0 -3
  26. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  27. package/build/components/global-styles/hooks.cjs +34 -0
  28. package/build/components/global-styles/hooks.cjs.map +2 -2
  29. package/build/components/global-styles/typography-panel.cjs +82 -10
  30. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  31. package/build/components/inspector-controls/groups.cjs +2 -0
  32. package/build/components/inspector-controls/groups.cjs.map +2 -2
  33. package/build/components/inspector-controls-tabs/styles-tab.cjs +75 -31
  34. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  35. package/build/components/link-control/index.cjs +1 -2
  36. package/build/components/link-control/index.cjs.map +2 -2
  37. package/build/components/list-view/block-select-button.cjs +1 -10
  38. package/build/components/list-view/block-select-button.cjs.map +3 -3
  39. package/build/components/provider/use-block-sync.cjs +3 -1
  40. package/build/components/provider/use-block-sync.cjs.map +2 -2
  41. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  42. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  43. package/build/components/use-block-display-information/index.cjs +10 -3
  44. package/build/components/use-block-display-information/index.cjs.map +2 -2
  45. package/build/hooks/anchor.cjs +0 -1
  46. package/build/hooks/anchor.cjs.map +2 -2
  47. package/build/hooks/background.cjs +124 -75
  48. package/build/hooks/background.cjs.map +3 -3
  49. package/build/hooks/color.cjs +0 -162
  50. package/build/hooks/color.cjs.map +3 -3
  51. package/build/hooks/contrast-checker.cjs +31 -28
  52. package/build/hooks/contrast-checker.cjs.map +3 -3
  53. package/build/hooks/custom-class-name.cjs +0 -1
  54. package/build/hooks/custom-class-name.cjs.map +2 -2
  55. package/build/hooks/elements.cjs +142 -0
  56. package/build/hooks/elements.cjs.map +7 -0
  57. package/build/hooks/grid-visualizer.cjs +21 -11
  58. package/build/hooks/grid-visualizer.cjs.map +2 -2
  59. package/build/hooks/layout-child.cjs +38 -8
  60. package/build/hooks/layout-child.cjs.map +2 -2
  61. package/build/hooks/layout.cjs +6 -3
  62. package/build/hooks/layout.cjs.map +2 -2
  63. package/build/hooks/states.cjs +2 -2
  64. package/build/hooks/states.cjs.map +2 -2
  65. package/build/hooks/style.cjs +8 -4
  66. package/build/hooks/style.cjs.map +2 -2
  67. package/build/hooks/typography.cjs +62 -10
  68. package/build/hooks/typography.cjs.map +3 -3
  69. package/build/layouts/flex.cjs +99 -6
  70. package/build/layouts/flex.cjs.map +2 -2
  71. package/build/utils/block-bindings.cjs +9 -9
  72. package/build/utils/block-bindings.cjs.map +3 -3
  73. package/build/utils/color-values.cjs +10 -1
  74. package/build/utils/color-values.cjs.map +3 -3
  75. package/build/utils/dom.cjs +2 -5
  76. package/build/utils/dom.cjs.map +3 -3
  77. package/build/utils/fit-text-frontend.cjs +6 -2
  78. package/build/utils/fit-text-frontend.cjs.map +3 -3
  79. package/build/utils/fit-text-utils.cjs +1 -1
  80. package/build/utils/fit-text-utils.cjs.map +3 -3
  81. package/build/utils/format-font-style.cjs +1 -1
  82. package/build/utils/format-font-style.cjs.map +3 -3
  83. package/build/utils/format-font-weight.cjs +1 -1
  84. package/build/utils/format-font-weight.cjs.map +3 -3
  85. package/build/utils/get-editor-region.cjs +4 -2
  86. package/build/utils/get-editor-region.cjs.map +3 -3
  87. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  88. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  89. package/build/utils/get-px-from-css-unit.cjs +1 -1
  90. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  91. package/build/utils/index.cjs +1 -1
  92. package/build/utils/index.cjs.map +1 -1
  93. package/build/utils/math.cjs +1 -1
  94. package/build/utils/math.cjs.map +3 -3
  95. package/build/utils/object.cjs +8 -8
  96. package/build/utils/object.cjs.map +3 -3
  97. package/build/utils/order-inserter-block-items.cjs +1 -1
  98. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  99. package/build/utils/pasting.cjs +4 -2
  100. package/build/utils/pasting.cjs.map +3 -3
  101. package/build/utils/selection.cjs +2 -1
  102. package/build/utils/selection.cjs.map +3 -3
  103. package/build/utils/sorting.cjs +9 -3
  104. package/build/utils/sorting.cjs.map +3 -3
  105. package/build/utils/transform-styles/index.cjs +3 -2
  106. package/build/utils/transform-styles/index.cjs.map +3 -3
  107. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  108. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  109. package/build/utils/transform-styles/types.cjs +19 -0
  110. package/build/utils/transform-styles/types.cjs.map +7 -0
  111. package/build/utils/types.cjs +19 -0
  112. package/build/utils/types.cjs.map +7 -0
  113. package/build-module/components/block-editing-mode/index.mjs +14 -8
  114. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  115. package/build-module/components/block-inspector/index.mjs +32 -16
  116. package/build-module/components/block-inspector/index.mjs.map +2 -2
  117. package/build-module/components/block-rename/modal.mjs +0 -1
  118. package/build-module/components/block-rename/modal.mjs.map +2 -2
  119. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  120. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  121. package/build-module/components/colors-gradients/control.mjs +27 -15
  122. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  123. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  124. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  125. package/build-module/components/contrast-checker/index.mjs +18 -4
  126. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  127. package/build-module/components/date-format-picker/index.mjs +0 -1
  128. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  129. package/build-module/components/global-styles/background-panel.mjs +155 -27
  130. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  131. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  132. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  133. package/build-module/components/global-styles/color-panel.mjs +106 -387
  134. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  135. package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
  136. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  137. package/build-module/components/global-styles/hooks.mjs +33 -0
  138. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  139. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  140. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  141. package/build-module/components/inspector-controls/groups.mjs +2 -0
  142. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  143. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +75 -31
  144. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  145. package/build-module/components/link-control/index.mjs +1 -2
  146. package/build-module/components/link-control/index.mjs.map +2 -2
  147. package/build-module/components/list-view/block-select-button.mjs +2 -17
  148. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  149. package/build-module/components/provider/use-block-sync.mjs +3 -1
  150. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  151. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  152. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  153. package/build-module/components/use-block-display-information/index.mjs +10 -3
  154. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  155. package/build-module/hooks/anchor.mjs +0 -1
  156. package/build-module/hooks/anchor.mjs.map +2 -2
  157. package/build-module/hooks/background.mjs +123 -75
  158. package/build-module/hooks/background.mjs.map +2 -2
  159. package/build-module/hooks/color.mjs +2 -175
  160. package/build-module/hooks/color.mjs.map +2 -2
  161. package/build-module/hooks/contrast-checker.mjs +32 -19
  162. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  163. package/build-module/hooks/custom-class-name.mjs +0 -1
  164. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  165. package/build-module/hooks/elements.mjs +115 -0
  166. package/build-module/hooks/elements.mjs.map +7 -0
  167. package/build-module/hooks/grid-visualizer.mjs +21 -11
  168. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  169. package/build-module/hooks/layout-child.mjs +41 -8
  170. package/build-module/hooks/layout-child.mjs.map +2 -2
  171. package/build-module/hooks/layout.mjs +6 -3
  172. package/build-module/hooks/layout.mjs.map +2 -2
  173. package/build-module/hooks/states.mjs +2 -2
  174. package/build-module/hooks/states.mjs.map +2 -2
  175. package/build-module/hooks/style.mjs +9 -5
  176. package/build-module/hooks/style.mjs.map +2 -2
  177. package/build-module/hooks/typography.mjs +62 -10
  178. package/build-module/hooks/typography.mjs.map +2 -2
  179. package/build-module/layouts/flex.mjs +105 -7
  180. package/build-module/layouts/flex.mjs.map +2 -2
  181. package/build-module/utils/block-bindings.mjs +9 -9
  182. package/build-module/utils/block-bindings.mjs.map +3 -3
  183. package/build-module/utils/color-values.mjs +9 -1
  184. package/build-module/utils/color-values.mjs.map +3 -3
  185. package/build-module/utils/dom.mjs +2 -5
  186. package/build-module/utils/dom.mjs.map +3 -3
  187. package/build-module/utils/fit-text-frontend.mjs +6 -2
  188. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  189. package/build-module/utils/fit-text-utils.mjs +1 -1
  190. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  191. package/build-module/utils/format-font-style.mjs +1 -1
  192. package/build-module/utils/format-font-style.mjs.map +3 -3
  193. package/build-module/utils/format-font-weight.mjs +1 -1
  194. package/build-module/utils/format-font-weight.mjs.map +3 -3
  195. package/build-module/utils/get-editor-region.mjs +4 -2
  196. package/build-module/utils/get-editor-region.mjs.map +3 -3
  197. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  198. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  199. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  200. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  201. package/build-module/utils/index.mjs +1 -1
  202. package/build-module/utils/index.mjs.map +1 -1
  203. package/build-module/utils/math.mjs +1 -1
  204. package/build-module/utils/math.mjs.map +3 -3
  205. package/build-module/utils/object.mjs +8 -8
  206. package/build-module/utils/object.mjs.map +3 -3
  207. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  208. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  209. package/build-module/utils/pasting.mjs +4 -2
  210. package/build-module/utils/pasting.mjs.map +3 -3
  211. package/build-module/utils/selection.mjs +2 -1
  212. package/build-module/utils/selection.mjs.map +3 -3
  213. package/build-module/utils/sorting.mjs +9 -3
  214. package/build-module/utils/sorting.mjs.map +3 -3
  215. package/build-module/utils/transform-styles/index.mjs +3 -2
  216. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  217. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  218. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  219. package/build-module/utils/transform-styles/types.mjs +1 -0
  220. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  221. package/build-module/utils/types.mjs +1 -0
  222. package/build-module/utils/types.mjs.map +7 -0
  223. package/build-style/content-rtl.css +2 -0
  224. package/build-style/content.css +2 -0
  225. package/build-style/style-rtl.css +34 -41
  226. package/build-style/style.css +34 -41
  227. package/build-types/utils/block-bindings.d.ts +27 -0
  228. package/build-types/utils/block-bindings.d.ts.map +1 -0
  229. package/build-types/utils/color-values.d.ts +40 -0
  230. package/build-types/utils/color-values.d.ts.map +1 -0
  231. package/build-types/utils/dom.d.ts +19 -19
  232. package/build-types/utils/dom.d.ts.map +1 -1
  233. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  234. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  235. package/build-types/utils/fit-text-utils.d.ts +15 -0
  236. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  237. package/build-types/utils/format-font-style.d.ts +12 -0
  238. package/build-types/utils/format-font-style.d.ts.map +1 -0
  239. package/build-types/utils/format-font-weight.d.ts +12 -0
  240. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  241. package/build-types/utils/get-editor-region.d.ts +9 -0
  242. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  243. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  244. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  245. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  246. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  247. package/build-types/utils/index.d.ts +3 -0
  248. package/build-types/utils/index.d.ts.map +1 -0
  249. package/build-types/utils/math.d.ts +61 -0
  250. package/build-types/utils/math.d.ts.map +1 -0
  251. package/build-types/utils/object.d.ts +39 -0
  252. package/build-types/utils/object.d.ts.map +1 -0
  253. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  254. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  255. package/build-types/utils/pasting.d.ts +28 -0
  256. package/build-types/utils/pasting.d.ts.map +1 -0
  257. package/build-types/utils/selection.d.ts +21 -0
  258. package/build-types/utils/selection.d.ts.map +1 -0
  259. package/build-types/utils/sorting.d.ts +17 -0
  260. package/build-types/utils/sorting.d.ts.map +1 -0
  261. package/build-types/utils/transform-styles/index.d.ts +15 -0
  262. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  263. package/build-types/utils/transform-styles/types.d.ts +13 -0
  264. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  265. package/build-types/utils/types.d.ts +28 -0
  266. package/build-types/utils/types.d.ts.map +1 -0
  267. package/package.json +40 -39
  268. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  269. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  270. package/src/components/block-editing-mode/index.js +17 -9
  271. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  272. package/src/components/block-inspector/index.js +20 -10
  273. package/src/components/block-rename/modal.js +0 -1
  274. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  275. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  276. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  277. package/src/components/colors-gradients/control.js +29 -12
  278. package/src/components/colors-gradients/dropdown.js +4 -1
  279. package/src/components/colors-gradients/style.scss +39 -2
  280. package/src/components/contrast-checker/README.md +9 -0
  281. package/src/components/contrast-checker/index.js +42 -3
  282. package/src/components/date-format-picker/index.js +0 -1
  283. package/src/components/default-block-appender/content.scss +3 -0
  284. package/src/components/global-styles/background-panel.js +201 -34
  285. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  286. package/src/components/global-styles/color-panel.js +125 -487
  287. package/src/components/global-styles/dimensions-panel.js +0 -3
  288. package/src/components/global-styles/hooks.js +45 -0
  289. package/src/components/global-styles/test/background-panel.js +56 -0
  290. package/src/components/global-styles/test/color-panel.js +172 -118
  291. package/src/components/global-styles/test/typography-panel.js +167 -0
  292. package/src/components/global-styles/typography-panel.js +100 -11
  293. package/src/components/inspector-controls/README.md +0 -2
  294. package/src/components/inspector-controls/groups.js +2 -0
  295. package/src/components/inspector-controls-tabs/styles-tab.js +74 -28
  296. package/src/components/link-control/index.js +0 -1
  297. package/src/components/link-control/test/index.js +2 -3
  298. package/src/components/list-view/block-select-button.js +2 -17
  299. package/src/components/provider/use-block-sync.js +3 -1
  300. package/src/components/rich-text/content.scss +2 -0
  301. package/src/components/url-popover/image-url-input-ui.js +0 -2
  302. package/src/components/use-block-display-information/index.js +15 -2
  303. package/src/components/use-block-display-information/test/index.js +140 -0
  304. package/src/hooks/anchor.js +0 -1
  305. package/src/hooks/background.js +210 -133
  306. package/src/hooks/background.scss +0 -35
  307. package/src/hooks/color.js +2 -205
  308. package/src/hooks/color.scss +3 -9
  309. package/src/hooks/contrast-checker.js +60 -17
  310. package/src/hooks/custom-class-name.js +0 -1
  311. package/src/hooks/elements.js +140 -0
  312. package/src/hooks/elements.scss +8 -0
  313. package/src/hooks/grid-visualizer.js +59 -45
  314. package/src/hooks/layout-child.js +51 -12
  315. package/src/hooks/layout.js +6 -3
  316. package/src/hooks/states.js +2 -2
  317. package/src/hooks/style.js +11 -7
  318. package/src/hooks/test/background.js +59 -0
  319. package/src/hooks/test/block-style-state.js +14 -14
  320. package/src/hooks/test/layout.js +6 -6
  321. package/src/hooks/test/style.js +8 -8
  322. package/src/hooks/typography.js +70 -6
  323. package/src/layouts/flex.js +118 -15
  324. package/src/store/test/private-selectors.js +28 -7
  325. package/src/store/test/reducer.js +61 -10
  326. package/src/style.scss +1 -0
  327. package/src/utils/block-bindings.ts +51 -0
  328. package/src/utils/color-values.ts +63 -0
  329. package/src/utils/{dom.js → dom.ts} +27 -27
  330. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  331. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  332. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  333. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  334. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  335. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  336. package/src/utils/{math.js → math.ts} +37 -30
  337. package/src/utils/object.ts +89 -0
  338. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  339. package/src/utils/{pasting.js → pasting.ts} +18 -11
  340. package/src/utils/{selection.js → selection.ts} +11 -4
  341. package/src/utils/sorting.ts +81 -0
  342. package/src/utils/test/color-values.js +44 -1
  343. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  344. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  345. package/src/utils/transform-styles/types.ts +13 -0
  346. package/src/utils/types.ts +29 -0
  347. package/src/utils/block-bindings.js +0 -46
  348. package/src/utils/color-values.js +0 -28
  349. package/src/utils/object.js +0 -67
  350. package/src/utils/sorting.js +0 -54
  351. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  352. /package/src/utils/{index.js → index.ts} +0 -0
@@ -1,6 +1,9 @@
1
1
  @use "@wordpress/base-styles/variables" as *;
2
2
 
3
3
  .color-block-support-panel {
4
+ // Blocks with non-standard color attributes (e.g. Social Icons,
5
+ // Navigation) still render the public ContrastChecker component
6
+ // directly within the color panel.
4
7
  .block-editor-contrast-checker {
5
8
  grid-column: span 2;
6
9
  margin-top: $grid-unit-20;
@@ -12,13 +15,4 @@
12
15
  row-gap: 0;
13
16
  }
14
17
  }
15
-
16
- /**
17
- * After converting PanelColorGradientSettings to render as a ToolsPanel
18
- * we need to remove the top margin when wrapping inner content due to
19
- * rendering via SlotFills.
20
- */
21
- .block-editor-tools-panel-color-gradient-settings__item.first {
22
- margin-top: 0;
23
- }
24
18
  }
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useLayoutEffect, useReducer } from '@wordpress/element';
4
+ import { useEffect, useLayoutEffect, useReducer } from '@wordpress/element';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as blocksStore } from '@wordpress/blocks';
7
7
  import { getBlockSelector } from '@wordpress/global-styles-engine';
8
+ import { speak } from '@wordpress/a11y';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
12
- import ContrastChecker from '../components/contrast-checker';
13
+ import { getContrastWarning } from '../components/contrast-checker';
14
+
13
15
  import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
14
16
 
15
17
  function getComputedValue( node, property ) {
@@ -80,23 +82,47 @@ function reducer( prevColors, newColors ) {
80
82
  return hasChanged ? newColors : prevColors;
81
83
  }
82
84
 
83
- export default function BlockColorContrastChecker( { clientId, name } ) {
85
+ /**
86
+ * Returns a contrast warning message for a block's computed colors, or
87
+ * `undefined` when contrast is sufficient or checking is disabled.
88
+ *
89
+ * Colors are read from the rendered block element so that inherited values
90
+ * (e.g. from Global Styles or ancestor blocks) are taken into account.
91
+ *
92
+ * @param {Object} props
93
+ * @param {string} props.clientId Block client ID.
94
+ * @param {string} props.name Block name.
95
+ * @param {boolean} [props.enabled] Whether contrast checking is active.
96
+ * @param {boolean} [props.checkTextColor] Whether to evaluate the text/background pair.
97
+ * @param {boolean} [props.checkLinkColor] Whether to evaluate the link/background pair.
98
+ * @param {string} [props.messageOverride] Caller-provided copy used in place of the generic guidance.
99
+ *
100
+ * @return {?string} The warning message, if any.
101
+ */
102
+ export default function useBlockColorContrastWarning( {
103
+ clientId,
104
+ name,
105
+ enabled = true,
106
+ checkTextColor = true,
107
+ checkLinkColor = true,
108
+ messageOverride,
109
+ } ) {
84
110
  const blockEl = useBlockElement( clientId );
85
111
  const [ colors, setColors ] = useReducer( reducer, {} );
86
112
 
87
113
  const blockType = useSelect(
88
114
  ( select ) => {
89
- return name
115
+ return name && enabled
90
116
  ? select( blocksStore ).getBlockType( name )
91
117
  : undefined;
92
118
  },
93
- [ name ]
119
+ [ name, enabled ]
94
120
  );
95
121
 
96
122
  // There are so many things that can change the color of a block
97
123
  // So we perform this check on every render.
98
124
  useLayoutEffect( () => {
99
- if ( ! blockEl || ! blockType ) {
125
+ if ( ! enabled || ! blockEl || ! blockType ) {
100
126
  return;
101
127
  }
102
128
 
@@ -112,7 +138,7 @@ export default function BlockColorContrastChecker( { clientId, name } ) {
112
138
  // Runs in its own effect with dependencies so the observer is only
113
139
  // recreated when the block element or block type changes.
114
140
  useLayoutEffect( () => {
115
- if ( ! blockEl || ! blockType ) {
141
+ if ( ! enabled || ! blockEl || ! blockType ) {
116
142
  return;
117
143
  }
118
144
 
@@ -123,19 +149,36 @@ export default function BlockColorContrastChecker( { clientId, name } ) {
123
149
  observer.observe( blockEl, {
124
150
  attributes: true,
125
151
  attributeFilter: [ 'class', 'style' ],
152
+ subtree: true,
126
153
  } );
127
154
 
128
155
  return () => {
129
156
  observer.disconnect();
130
157
  };
131
- }, [ blockEl, blockType ] );
132
-
133
- return (
134
- <ContrastChecker
135
- backgroundColor={ colors.backgroundColor }
136
- textColor={ colors.textColor }
137
- linkColor={ colors.linkColor }
138
- enableAlphaChecker
139
- />
140
- );
158
+ }, [ enabled, blockEl, blockType ] );
159
+
160
+ const warning = enabled
161
+ ? getContrastWarning( {
162
+ backgroundColor: colors.backgroundColor,
163
+ textColor: checkTextColor ? colors.textColor : undefined,
164
+ linkColor: checkLinkColor ? colors.linkColor : undefined,
165
+ messageOverride,
166
+ enableAlphaChecker: true,
167
+ } )
168
+ : null;
169
+
170
+ // The popover Notice that displays this warning is muted
171
+ // (`spokenMessage={ null }`), so this hook is the single source of the
172
+ // spoken announcement. Announce only when the warning message itself
173
+ // appears or changes; keying off `speakMessage` rather than the raw
174
+ // computed `colors` avoids re-announcing the same warning when colors
175
+ // recompute without changing the outcome.
176
+ const speakMessage = warning?.speakMessage;
177
+ useEffect( () => {
178
+ if ( speakMessage ) {
179
+ speak( speakMessage );
180
+ }
181
+ }, [ speakMessage ] );
182
+
183
+ return warning?.message;
141
184
  }
@@ -47,7 +47,6 @@ function CustomClassNameControlsPure( { className, setAttributes } ) {
47
47
  return (
48
48
  <InspectorControls group="advanced">
49
49
  <TextControl
50
- __next40pxDefaultSize
51
50
  autoComplete="off"
52
51
  label={ __( 'Additional CSS class(es)' ) }
53
52
  value={ className || '' }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { getBlockSupport } from '@wordpress/blocks';
5
+ import { useMemo, useCallback } from '@wordpress/element';
6
+ import { useSelect } from '@wordpress/data';
7
+ import { __ } from '@wordpress/i18n';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import InspectorControls from '../components/inspector-controls';
13
+ import {
14
+ useHasColorPanel,
15
+ default as StylesColorPanel,
16
+ } from '../components/global-styles/color-panel';
17
+ import { cleanEmptyObject } from './utils';
18
+ import { store as blockEditorStore } from '../store';
19
+ import { COLOR_SUPPORT_KEY } from './color';
20
+ import useBlockColorContrastWarning from './contrast-checker';
21
+ import {
22
+ getStyleForState,
23
+ isDefaultBlockStyleState,
24
+ setStyleForState,
25
+ useBlockStyleState,
26
+ } from './block-style-state';
27
+
28
+ function ElementsInspectorControl( { children, resetAllFilter } ) {
29
+ const attributesResetAllFilter = useCallback(
30
+ ( attributes ) => {
31
+ const updatedStyle = resetAllFilter( attributes.style );
32
+ return {
33
+ ...attributes,
34
+ style: cleanEmptyObject( updatedStyle ),
35
+ };
36
+ },
37
+ [ resetAllFilter ]
38
+ );
39
+
40
+ return (
41
+ <InspectorControls
42
+ group="elements"
43
+ resetAllFilter={ attributesResetAllFilter }
44
+ >
45
+ { children }
46
+ </InspectorControls>
47
+ );
48
+ }
49
+
50
+ export function ElementsEdit( {
51
+ clientId,
52
+ name,
53
+ setAttributes,
54
+ settings,
55
+ asWrapper,
56
+ label,
57
+ defaultControls,
58
+ } ) {
59
+ const selectedState = useBlockStyleState();
60
+ const isEnabled = useHasColorPanel( settings );
61
+
62
+ const style = useSelect(
63
+ ( select ) => {
64
+ if ( ! isEnabled ) {
65
+ return undefined;
66
+ }
67
+ const attributes =
68
+ select( blockEditorStore ).getBlockAttributes( clientId );
69
+ return attributes?.style;
70
+ },
71
+ [ clientId, isEnabled ]
72
+ );
73
+
74
+ const isStateSelected = ! isDefaultBlockStyleState( selectedState );
75
+
76
+ const value = useMemo( () => {
77
+ if ( isStateSelected ) {
78
+ return getStyleForState( style, selectedState );
79
+ }
80
+ return style;
81
+ }, [ isStateSelected, selectedState, style ] );
82
+
83
+ const onChange = isStateSelected
84
+ ? ( newStyle ) => {
85
+ setAttributes( {
86
+ style: setStyleForState( style, selectedState, newStyle ),
87
+ } );
88
+ }
89
+ : ( newStyle ) => {
90
+ setAttributes( { style: cleanEmptyObject( newStyle ) } );
91
+ };
92
+
93
+ // Text and background color failures are reported by the Typography and
94
+ // Background panels, which own those selections.
95
+ const enableContrastChecking =
96
+ ! isStateSelected &&
97
+ !! value?.elements?.link?.color?.text &&
98
+ settings?.color?.link &&
99
+ false !==
100
+ getBlockSupport( name, [
101
+ COLOR_SUPPORT_KEY,
102
+ 'enableContrastChecker',
103
+ ] );
104
+
105
+ const contrastWarning = useBlockColorContrastWarning( {
106
+ clientId,
107
+ name,
108
+ enabled: !! enableContrastChecking,
109
+ checkTextColor: false,
110
+ messageOverride: __(
111
+ 'This link color has poor contrast against the background. Consider increasing contrast.'
112
+ ),
113
+ } );
114
+
115
+ if ( ! isEnabled ) {
116
+ return null;
117
+ }
118
+
119
+ defaultControls = defaultControls
120
+ ? defaultControls
121
+ : getBlockSupport( name, [
122
+ COLOR_SUPPORT_KEY,
123
+ '__experimentalDefaultControls',
124
+ ] );
125
+
126
+ const Wrapper = asWrapper || ElementsInspectorControl;
127
+
128
+ return (
129
+ <StylesColorPanel
130
+ as={ Wrapper }
131
+ panelId={ clientId }
132
+ settings={ settings }
133
+ value={ value }
134
+ onChange={ onChange }
135
+ defaultControls={ defaultControls }
136
+ label={ label }
137
+ contrastWarning={ contrastWarning }
138
+ />
139
+ );
140
+ }
@@ -0,0 +1,8 @@
1
+ .elements-block-support-panel {
2
+ /* Increased specificity required to remove the slot wrapper's row gap */
3
+ &#{&} {
4
+ .elements-block-support-panel__inner-wrapper {
5
+ row-gap: 0;
6
+ }
7
+ }
8
+ }
@@ -11,6 +11,7 @@ import { useSelect } from '@wordpress/data';
11
11
  import { GridVisualizer, useGridLayoutSync } from '../components/grid';
12
12
  import { store as blockEditorStore } from '../store';
13
13
  import { unlock } from '../lock-unlock';
14
+ import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
14
15
  import useBlockVisibility from '../components/block-visibility/use-block-visibility';
15
16
  import { deviceTypeKey } from '../store/private-keys';
16
17
  import { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';
@@ -20,60 +21,73 @@ function GridLayoutSync( props ) {
20
21
  }
21
22
 
22
23
  function GridTools( { clientId, layout } ) {
23
- const { isVisible, blockVisibility, deviceType, isAnyAncestorHidden } =
24
- useSelect(
25
- ( select ) => {
26
- const {
27
- isBlockSelected,
28
- hasSelectedInnerBlock,
29
- isDraggingBlocks,
30
- getTemplateLock,
31
- getBlockEditingMode,
32
- getBlockAttributes,
33
- getSettings,
34
- } = select( blockEditorStore );
24
+ const { isVisible, blockVisibility, deviceType } = useSelect(
25
+ ( select ) => {
26
+ const {
27
+ isBlockSelected,
28
+ hasSelectedInnerBlock,
29
+ isDraggingBlocks,
30
+ getTemplateLock,
31
+ getBlockEditingMode,
32
+ getBlockAttributes,
33
+ getSettings,
34
+ } = select( blockEditorStore );
35
35
 
36
- // These calls are purposely ordered from least expensive to most expensive.
37
- // Hides the visualizer in cases where the user is not or cannot interact with it.
38
- // Also hide if a child block is selected, because layout-child.js will render
39
- // the visualizer in that case (with proper childGridClientId handling).
40
- if (
41
- ( ! isDraggingBlocks() && ! isBlockSelected( clientId ) ) ||
42
- getTemplateLock( clientId ) ||
43
- getBlockEditingMode( clientId ) !== 'default' ||
44
- hasSelectedInnerBlock( clientId )
45
- ) {
46
- return { isVisible: false };
47
- }
36
+ // These calls are purposely ordered from least expensive to most expensive.
37
+ // Hides the visualizer in cases where the user is not or cannot interact with it.
38
+ // Also hide if a child block is selected, because layout-child.js will render
39
+ // the visualizer in that case (with proper childGridClientId handling).
40
+ if (
41
+ ( ! isDraggingBlocks() && ! isBlockSelected( clientId ) ) ||
42
+ getTemplateLock( clientId ) ||
43
+ getBlockEditingMode( clientId ) !== 'default' ||
44
+ hasSelectedInnerBlock( clientId )
45
+ ) {
46
+ return { isVisible: false };
47
+ }
48
48
 
49
- const { isBlockParentHiddenAtViewport } = unlock(
50
- select( blockEditorStore )
51
- );
49
+ const attributes = getBlockAttributes( clientId );
50
+ const settings = getSettings();
51
+ const currentDeviceType =
52
+ settings?.[ deviceTypeKey ]?.toLowerCase() ||
53
+ BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
52
54
 
53
- const attributes = getBlockAttributes( clientId );
54
- const settings = getSettings();
55
- const currentDeviceType =
56
- settings?.[ deviceTypeKey ]?.toLowerCase() ||
57
- BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
55
+ return {
56
+ isVisible: true,
57
+ blockVisibility: attributes?.metadata?.blockVisibility,
58
+ deviceType: currentDeviceType,
59
+ };
60
+ },
61
+ [ clientId ]
62
+ );
58
63
 
59
- return {
60
- isVisible: true,
61
- blockVisibility: attributes?.metadata?.blockVisibility,
62
- deviceType: currentDeviceType,
63
- isAnyAncestorHidden: isBlockParentHiddenAtViewport(
64
- clientId,
65
- currentDeviceType
66
- ),
67
- };
68
- },
69
- [ clientId ]
70
- );
64
+ // Get the block's DOM element to derive the canvas iframe window,
65
+ // so viewport detection matches the actual block rendering context
66
+ const blockElement = useBlockElement( clientId );
67
+ const rawCanvasView = blockElement?.ownerDocument?.defaultView;
68
+ const canvasView = rawCanvasView === null ? undefined : rawCanvasView;
71
69
 
72
- const { isBlockCurrentlyHidden } = useBlockVisibility( {
70
+ const { isBlockCurrentlyHidden, currentViewport } = useBlockVisibility( {
73
71
  blockVisibility,
74
72
  deviceType,
73
+ view: canvasView,
75
74
  } );
76
75
 
76
+ // Check whether any ancestor is hidden at the viewport actually detected
77
+ // from the canvas, so it stays consistent with how blocks are hidden.
78
+ const isAnyAncestorHidden = useSelect(
79
+ ( select ) => {
80
+ if ( ! isVisible ) {
81
+ return false;
82
+ }
83
+ const { isBlockParentHiddenAtViewport } = unlock(
84
+ select( blockEditorStore )
85
+ );
86
+ return isBlockParentHiddenAtViewport( clientId, currentViewport );
87
+ },
88
+ [ clientId, currentViewport, isVisible ]
89
+ );
90
+
77
91
  return (
78
92
  <>
79
93
  <GridLayoutSync clientId={ clientId } />
@@ -9,6 +9,7 @@ import { useState } from '@wordpress/element';
9
9
  * Internal dependencies
10
10
  */
11
11
  import { store as blockEditorStore } from '../store';
12
+ import { unlock } from '../lock-unlock';
12
13
  import { useStyleOverride } from './utils';
13
14
  import { useLayout } from '../components/block-list/layout';
14
15
  import {
@@ -16,16 +17,21 @@ import {
16
17
  GridItemResizer,
17
18
  GridItemMovers,
18
19
  } from '../components/grid';
20
+ import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
19
21
  import useBlockVisibility from '../components/block-visibility/use-block-visibility';
20
22
  import { deviceTypeKey } from '../store/private-keys';
21
23
  import { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';
24
+ import {
25
+ DEFAULT_BLOCK_STYLE_STATE,
26
+ getStyleForState,
27
+ } from './block-style-state';
22
28
 
23
29
  // Used for generating the instance ID
24
30
  const LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};
25
31
  // Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS.
26
32
  const RESPONSIVE_BREAKPOINTS = {
27
- mobile: '@media (width <= 480px)',
28
- tablet: '@media (480px < width <= 782px)',
33
+ '@mobile': '@media (width <= 480px)',
34
+ '@tablet': '@media (480px < width <= 782px)',
29
35
  };
30
36
 
31
37
  // These are the serialized `selfStretch` values. `max` used to be called
@@ -252,7 +258,10 @@ export function getResponsiveChildLayoutStyles( {
252
258
 
253
259
  return Object.entries( RESPONSIVE_BREAKPOINTS )
254
260
  .map( ( [ viewport, mediaQuery ] ) => {
255
- const viewportLayout = style?.[ viewport ]?.layout;
261
+ const viewportLayout = getStyleForState( style, {
262
+ viewport,
263
+ pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,
264
+ } )?.layout;
256
265
  if ( ! viewportLayout || ! Object.keys( viewportLayout ).length ) {
257
266
  return '';
258
267
  }
@@ -390,6 +399,9 @@ function GridTools( {
390
399
  const parentAttributes = getBlockAttributes( _rootClientId );
391
400
  const blockAttributes = getBlockAttributes( clientId );
392
401
  const settings = getSettings();
402
+ const currentDeviceType =
403
+ settings?.[ deviceTypeKey ]?.toLowerCase() ||
404
+ BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
393
405
 
394
406
  return {
395
407
  rootClientId: _rootClientId,
@@ -398,9 +410,7 @@ function GridTools( {
398
410
  parentAttributes?.metadata?.blockVisibility,
399
411
  blockBlockVisibility:
400
412
  blockAttributes?.metadata?.blockVisibility,
401
- deviceType:
402
- settings?.[ deviceTypeKey ]?.toLowerCase() ||
403
- BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
413
+ deviceType: currentDeviceType,
404
414
  // Check if the selected child block is itself a grid.
405
415
  isChildBlockAGrid: blockAttributes?.layout?.type === 'grid',
406
416
  };
@@ -408,16 +418,45 @@ function GridTools( {
408
418
  [ clientId ]
409
419
  );
410
420
 
411
- const { isBlockCurrentlyHidden: isParentBlockCurrentlyHidden } =
412
- useBlockVisibility( {
413
- blockVisibility: parentBlockVisibility,
414
- deviceType,
415
- } );
421
+ // Get the block's DOM element to derive the canvas iframe window,
422
+ // so viewport detection matches the actual block rendering context
423
+ const blockElement = useBlockElement( clientId );
424
+ const rawCanvasView = blockElement?.ownerDocument?.defaultView;
425
+ const canvasView = rawCanvasView === null ? undefined : rawCanvasView;
426
+
427
+ const {
428
+ isBlockCurrentlyHidden: isParentBlockCurrentlyHidden,
429
+ currentViewport,
430
+ } = useBlockVisibility( {
431
+ blockVisibility: parentBlockVisibility,
432
+ deviceType,
433
+ view: canvasView,
434
+ } );
435
+
436
+ // Check whether any ancestor of the parent grid is hidden at the viewport
437
+ // actually detected from the canvas, so it stays consistent with how
438
+ // blocks are hidden.
439
+ const isAnyAncestorHidden = useSelect(
440
+ ( select ) => {
441
+ if ( ! rootClientId ) {
442
+ return false;
443
+ }
444
+ const { isBlockParentHiddenAtViewport } = unlock(
445
+ select( blockEditorStore )
446
+ );
447
+ return isBlockParentHiddenAtViewport(
448
+ rootClientId,
449
+ currentViewport
450
+ );
451
+ },
452
+ [ rootClientId, currentViewport ]
453
+ );
416
454
 
417
455
  const { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } =
418
456
  useBlockVisibility( {
419
457
  blockVisibility: blockBlockVisibility,
420
458
  deviceType,
459
+ view: canvasView,
421
460
  } );
422
461
 
423
462
  // Use useState() instead of useRef() so that GridItemResizer updates when ref is set.
@@ -425,7 +464,7 @@ function GridTools( {
425
464
 
426
465
  const childGridClientId = isChildBlockAGrid ? clientId : undefined;
427
466
 
428
- if ( ! isVisible || isParentBlockCurrentlyHidden ) {
467
+ if ( ! isVisible || isParentBlockCurrentlyHidden || isAnyAncestorHidden ) {
429
468
  return null;
430
469
  }
431
470
 
@@ -52,8 +52,8 @@ const layoutBlockSupportKey = 'layout';
52
52
  // Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and
53
53
  // packages/global-styles-engine/src/core/render.tsx.
54
54
  const RESPONSIVE_BREAKPOINTS = {
55
- mobile: '@media (width <= 480px)',
56
- tablet: '@media (480px < width <= 782px)',
55
+ '@mobile': '@media (width <= 480px)',
56
+ '@tablet': '@media (480px < width <= 782px)',
57
57
  };
58
58
  const CHILD_LAYOUT_KEYS = [
59
59
  'selfStretch',
@@ -252,7 +252,10 @@ export function getResponsiveLayoutStyles( {
252
252
  } ) {
253
253
  return Object.entries( RESPONSIVE_BREAKPOINTS )
254
254
  .map( ( [ viewport, mediaQuery ] ) => {
255
- const viewportStyle = attributes?.style?.[ viewport ];
255
+ const viewportStyle = getStyleForState( attributes?.style, {
256
+ viewport,
257
+ pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,
258
+ } );
256
259
  const viewportLayout = getLayoutContainerValues(
257
260
  viewportStyle?.layout
258
261
  );
@@ -19,8 +19,8 @@ export const PSEUDO_STATE_LABELS = {
19
19
  };
20
20
 
21
21
  export const RESPONSIVE_STATE_LABELS = {
22
- tablet: __( 'Tablet' ),
23
- mobile: __( 'Mobile' ),
22
+ '@tablet': __( 'Tablet' ),
23
+ '@mobile': __( 'Mobile' ),
24
24
  };
25
25
 
26
26
  // Keep in sync with WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS
@@ -19,7 +19,8 @@ import { getCSSRules, compileCSS } from '@wordpress/style-engine';
19
19
  */
20
20
  import { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from './background';
21
21
  import { BORDER_SUPPORT_KEY, BorderPanel, SHADOW_SUPPORT_KEY } from './border';
22
- import { COLOR_SUPPORT_KEY, ColorEdit } from './color';
22
+ import { COLOR_SUPPORT_KEY } from './color';
23
+ import { ElementsEdit } from './elements';
23
24
  import {
24
25
  TypographyPanel,
25
26
  TYPOGRAPHY_SUPPORT_KEY,
@@ -57,8 +58,8 @@ const BORDER_SIDES = [ 'Top', 'Right', 'Bottom', 'Left' ];
57
58
  // Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and
58
59
  // packages/global-styles-engine/src/core/render.tsx.
59
60
  const RESPONSIVE_BREAKPOINTS = {
60
- mobile: '@media (width <= 480px)',
61
- tablet: '@media (480px < width <= 782px)',
61
+ '@mobile': '@media (width <= 480px)',
62
+ '@tablet': '@media (480px < width <= 782px)',
62
63
  };
63
64
 
64
65
  const styleSupportKeys = [
@@ -419,7 +420,10 @@ export function getResponsiveStateCSSRules( style, name, baseSelector ) {
419
420
 
420
421
  Object.entries( RESPONSIVE_BREAKPOINTS ).forEach(
421
422
  ( [ viewport, mediaQuery ] ) => {
422
- const viewportStyles = style?.[ viewport ];
423
+ const viewportStyles = getStyleForState( style, {
424
+ viewport,
425
+ pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,
426
+ } );
423
427
  if ( ! viewportStyles ) {
424
428
  return;
425
429
  }
@@ -464,8 +468,8 @@ export function getResponsiveStateCSSRules( style, name, baseSelector ) {
464
468
  * Returns the style value used to force-preview a selected state on canvas.
465
469
  *
466
470
  * Responsive pseudo states inherit from their default-viewport pseudo state.
467
- * For example, selecting `mobile + :hover` should preview styles from
468
- * `:hover`, with `mobile.:hover` values layered on top when present.
471
+ * For example, selecting `@mobile + :hover` should preview styles from
472
+ * `:hover`, with `@mobile.:hover` values layered on top when present.
469
473
  *
470
474
  * @param {Object} style Block style object.
471
475
  * @param {Object} selectedState Selected block style state.
@@ -848,7 +852,7 @@ function BlockStyleControls( {
848
852
 
849
853
  return (
850
854
  <BlockStyleStateProvider value={ selectedState }>
851
- <ColorEdit { ...passedProps } />
855
+ <ElementsEdit { ...passedProps } />
852
856
  <BackgroundImagePanel { ...passedProps } />
853
857
  <TypographyPanel { ...passedProps } />
854
858
  <BorderPanel { ...passedProps } />