@wordpress/block-editor 16.0.0 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +8 -0
  3. package/build/components/alignment-control/ui.cjs +2 -4
  4. package/build/components/alignment-control/ui.cjs.map +2 -2
  5. package/build/components/background-image-control/index.cjs +40 -10
  6. package/build/components/background-image-control/index.cjs.map +2 -2
  7. package/build/components/block-alignment-control/ui.cjs +5 -3
  8. package/build/components/block-alignment-control/ui.cjs.map +2 -2
  9. package/build/components/block-inspector/index.cjs +73 -46
  10. package/build/components/block-inspector/index.cjs.map +2 -2
  11. package/build/components/block-list/block-html.cjs +4 -1
  12. package/build/components/block-list/block-html.cjs.map +2 -2
  13. package/build/components/block-list/use-block-props/index.cjs +5 -2
  14. package/build/components/block-list/use-block-props/index.cjs.map +2 -2
  15. package/build/components/block-list/use-block-props/use-focus-handler.cjs +2 -3
  16. package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
  17. package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
  18. package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
  19. package/build/components/block-parent-selector/index.cjs +2 -2
  20. package/build/components/block-parent-selector/index.cjs.map +2 -2
  21. package/build/components/block-toolbar/switch-section-style.cjs +4 -2
  22. package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
  23. package/build/components/block-tools/empty-block-inserter.cjs +2 -7
  24. package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
  25. package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
  26. package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
  27. package/build/components/border-radius-control/utils.cjs +8 -58
  28. package/build/components/border-radius-control/utils.cjs.map +2 -2
  29. package/build/components/colors-gradients/control.cjs +5 -3
  30. package/build/components/colors-gradients/control.cjs.map +2 -2
  31. package/build/components/dimension-control/index.cjs +30 -20
  32. package/build/components/dimension-control/index.cjs.map +3 -3
  33. package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
  34. package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
  35. package/build/components/editor-styles/index.cjs +9 -1
  36. package/build/components/editor-styles/index.cjs.map +2 -2
  37. package/build/components/global-styles/background-panel.cjs +66 -25
  38. package/build/components/global-styles/background-panel.cjs.map +3 -3
  39. package/build/components/global-styles/border-panel.cjs +153 -55
  40. package/build/components/global-styles/border-panel.cjs.map +3 -3
  41. package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
  42. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
  43. package/build/components/global-styles/color-panel.cjs +63 -17
  44. package/build/components/global-styles/color-panel.cjs.map +2 -2
  45. package/build/components/global-styles/dimensions-panel.cjs +242 -64
  46. package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
  47. package/build/components/global-styles/filters-panel.cjs +59 -20
  48. package/build/components/global-styles/filters-panel.cjs.map +3 -3
  49. package/build/components/global-styles/hooks.cjs +4 -1
  50. package/build/components/global-styles/hooks.cjs.map +2 -2
  51. package/build/components/global-styles/inheritance/index.cjs +142 -0
  52. package/build/components/global-styles/inheritance/index.cjs.map +7 -0
  53. package/build/components/global-styles/inherited-value-context.cjs +173 -0
  54. package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
  55. package/build/components/global-styles/shadow-panel-components.cjs +38 -20
  56. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  57. package/build/components/global-styles/state-control.cjs +1 -1
  58. package/build/components/global-styles/state-control.cjs.map +2 -2
  59. package/build/components/global-styles/typography-panel.cjs +271 -78
  60. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  61. package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
  62. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  63. package/build/components/line-height-control/index.cjs +1 -1
  64. package/build/components/line-height-control/index.cjs.map +2 -2
  65. package/build/components/link-control/index.cjs +3 -1
  66. package/build/components/link-control/index.cjs.map +2 -2
  67. package/build/components/preset-input-control/index.cjs +2 -1
  68. package/build/components/preset-input-control/index.cjs.map +2 -2
  69. package/build/components/provider/block-refs-provider.cjs +8 -2
  70. package/build/components/provider/block-refs-provider.cjs.map +2 -2
  71. package/build/components/provider/index.cjs +1 -1
  72. package/build/components/provider/index.cjs.map +2 -2
  73. package/build/components/provider/use-block-sync.cjs +18 -6
  74. package/build/components/provider/use-block-sync.cjs.map +2 -2
  75. package/build/components/provider/use-media-upload-settings.cjs +3 -1
  76. package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
  77. package/build/components/rich-text/index.cjs +23 -13
  78. package/build/components/rich-text/index.cjs.map +2 -2
  79. package/build/components/spacing-sizes-control/utils.cjs +6 -19
  80. package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
  81. package/build/components/text-indent-control/index.cjs +8 -2
  82. package/build/components/text-indent-control/index.cjs.map +2 -2
  83. package/build/components/url-input/index.cjs +303 -344
  84. package/build/components/url-input/index.cjs.map +3 -3
  85. package/build/components/writing-flow/index.cjs +2 -0
  86. package/build/components/writing-flow/index.cjs.map +3 -3
  87. package/build/components/writing-flow/use-arrow-nav.cjs +24 -1
  88. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  89. package/build/components/writing-flow/use-click-selection.cjs +28 -2
  90. package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
  91. package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
  92. package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
  93. package/build/components/writing-flow/use-editable-root.cjs +5 -42
  94. package/build/components/writing-flow/use-editable-root.cjs.map +2 -2
  95. package/build/components/writing-flow/use-home-end.cjs +1 -1
  96. package/build/components/writing-flow/use-home-end.cjs.map +2 -2
  97. package/build/components/writing-flow/use-selection-observer.cjs +17 -13
  98. package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
  99. package/build/components/writing-flow/utils.cjs +3 -14
  100. package/build/components/writing-flow/utils.cjs.map +2 -2
  101. package/build/hooks/background.cjs +13 -10
  102. package/build/hooks/background.cjs.map +2 -2
  103. package/build/hooks/block-style-variation.cjs +4 -45
  104. package/build/hooks/block-style-variation.cjs.map +3 -3
  105. package/build/hooks/border.cjs +19 -4
  106. package/build/hooks/border.cjs.map +2 -2
  107. package/build/hooks/custom-css.cjs +6 -2
  108. package/build/hooks/custom-css.cjs.map +2 -2
  109. package/build/hooks/dimensions.cjs +15 -4
  110. package/build/hooks/dimensions.cjs.map +2 -2
  111. package/build/hooks/duotone.cjs +26 -14
  112. package/build/hooks/duotone.cjs.map +3 -3
  113. package/build/hooks/elements.cjs +14 -4
  114. package/build/hooks/elements.cjs.map +2 -2
  115. package/build/hooks/line-height.cjs +1 -2
  116. package/build/hooks/line-height.cjs.map +2 -2
  117. package/build/hooks/typography.cjs +13 -4
  118. package/build/hooks/typography.cjs.map +2 -2
  119. package/build/private-apis.cjs +9 -5
  120. package/build/private-apis.cjs.map +3 -3
  121. package/build/store/actions.cjs +9 -4
  122. package/build/store/actions.cjs.map +2 -2
  123. package/build/store/private-selectors.cjs +28 -1
  124. package/build/store/private-selectors.cjs.map +2 -2
  125. package/build/store/reducer.cjs +6 -6
  126. package/build/store/reducer.cjs.map +2 -2
  127. package/build/store/selectors.cjs +23 -0
  128. package/build/store/selectors.cjs.map +2 -2
  129. package/build/utils/native-undo.cjs +55 -0
  130. package/build/utils/native-undo.cjs.map +7 -0
  131. package/build-module/components/alignment-control/ui.mjs +2 -4
  132. package/build-module/components/alignment-control/ui.mjs.map +2 -2
  133. package/build-module/components/background-image-control/index.mjs +43 -10
  134. package/build-module/components/background-image-control/index.mjs.map +2 -2
  135. package/build-module/components/block-alignment-control/ui.mjs +5 -3
  136. package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
  137. package/build-module/components/block-inspector/index.mjs +74 -46
  138. package/build-module/components/block-inspector/index.mjs.map +2 -2
  139. package/build-module/components/block-list/block-html.mjs +4 -1
  140. package/build-module/components/block-list/block-html.mjs.map +2 -2
  141. package/build-module/components/block-list/use-block-props/index.mjs +5 -2
  142. package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
  143. package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +2 -3
  144. package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
  145. package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
  146. package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
  147. package/build-module/components/block-parent-selector/index.mjs +2 -2
  148. package/build-module/components/block-parent-selector/index.mjs.map +2 -2
  149. package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
  150. package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
  151. package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
  152. package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
  153. package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
  154. package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
  155. package/build-module/components/border-radius-control/utils.mjs +11 -53
  156. package/build-module/components/border-radius-control/utils.mjs.map +2 -2
  157. package/build-module/components/colors-gradients/control.mjs +5 -3
  158. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  159. package/build-module/components/dimension-control/index.mjs +30 -20
  160. package/build-module/components/dimension-control/index.mjs.map +2 -2
  161. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
  162. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
  163. package/build-module/components/editor-styles/index.mjs +9 -1
  164. package/build-module/components/editor-styles/index.mjs.map +2 -2
  165. package/build-module/components/global-styles/background-panel.mjs +71 -29
  166. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  167. package/build-module/components/global-styles/border-panel.mjs +157 -56
  168. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  169. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
  170. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
  171. package/build-module/components/global-styles/color-panel.mjs +63 -17
  172. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  173. package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
  174. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  175. package/build-module/components/global-styles/filters-panel.mjs +64 -21
  176. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  177. package/build-module/components/global-styles/hooks.mjs +4 -1
  178. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  179. package/build-module/components/global-styles/inheritance/index.mjs +108 -0
  180. package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
  181. package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
  182. package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
  183. package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
  184. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  185. package/build-module/components/global-styles/state-control.mjs +1 -1
  186. package/build-module/components/global-styles/state-control.mjs.map +2 -2
  187. package/build-module/components/global-styles/typography-panel.mjs +276 -79
  188. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  189. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
  190. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  191. package/build-module/components/line-height-control/index.mjs +1 -1
  192. package/build-module/components/line-height-control/index.mjs.map +2 -2
  193. package/build-module/components/link-control/index.mjs +4 -2
  194. package/build-module/components/link-control/index.mjs.map +2 -2
  195. package/build-module/components/preset-input-control/index.mjs +2 -1
  196. package/build-module/components/preset-input-control/index.mjs.map +2 -2
  197. package/build-module/components/provider/block-refs-provider.mjs +8 -2
  198. package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
  199. package/build-module/components/provider/index.mjs +1 -1
  200. package/build-module/components/provider/index.mjs.map +2 -2
  201. package/build-module/components/provider/use-block-sync.mjs +18 -6
  202. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  203. package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
  204. package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
  205. package/build-module/components/rich-text/index.mjs +28 -14
  206. package/build-module/components/rich-text/index.mjs.map +2 -2
  207. package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
  208. package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
  209. package/build-module/components/text-indent-control/index.mjs +8 -2
  210. package/build-module/components/text-indent-control/index.mjs.map +2 -2
  211. package/build-module/components/url-input/index.mjs +306 -353
  212. package/build-module/components/url-input/index.mjs.map +2 -2
  213. package/build-module/components/writing-flow/index.mjs +2 -0
  214. package/build-module/components/writing-flow/index.mjs.map +2 -2
  215. package/build-module/components/writing-flow/use-arrow-nav.mjs +24 -1
  216. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  217. package/build-module/components/writing-flow/use-click-selection.mjs +28 -2
  218. package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
  219. package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
  220. package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
  221. package/build-module/components/writing-flow/use-editable-root.mjs +5 -37
  222. package/build-module/components/writing-flow/use-editable-root.mjs.map +2 -2
  223. package/build-module/components/writing-flow/use-home-end.mjs +1 -1
  224. package/build-module/components/writing-flow/use-home-end.mjs.map +2 -2
  225. package/build-module/components/writing-flow/use-selection-observer.mjs +18 -14
  226. package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
  227. package/build-module/components/writing-flow/utils.mjs +2 -11
  228. package/build-module/components/writing-flow/utils.mjs.map +2 -2
  229. package/build-module/hooks/background.mjs +13 -10
  230. package/build-module/hooks/background.mjs.map +2 -2
  231. package/build-module/hooks/block-style-variation.mjs +8 -44
  232. package/build-module/hooks/block-style-variation.mjs.map +2 -2
  233. package/build-module/hooks/border.mjs +19 -4
  234. package/build-module/hooks/border.mjs.map +2 -2
  235. package/build-module/hooks/custom-css.mjs +7 -3
  236. package/build-module/hooks/custom-css.mjs.map +2 -2
  237. package/build-module/hooks/dimensions.mjs +15 -4
  238. package/build-module/hooks/dimensions.mjs.map +2 -2
  239. package/build-module/hooks/duotone.mjs +20 -9
  240. package/build-module/hooks/duotone.mjs.map +2 -2
  241. package/build-module/hooks/elements.mjs +14 -4
  242. package/build-module/hooks/elements.mjs.map +2 -2
  243. package/build-module/hooks/line-height.mjs +1 -2
  244. package/build-module/hooks/line-height.mjs.map +2 -2
  245. package/build-module/hooks/typography.mjs +13 -4
  246. package/build-module/hooks/typography.mjs.map +2 -2
  247. package/build-module/private-apis.mjs +7 -3
  248. package/build-module/private-apis.mjs.map +2 -2
  249. package/build-module/store/actions.mjs +9 -4
  250. package/build-module/store/actions.mjs.map +2 -2
  251. package/build-module/store/private-selectors.mjs +29 -1
  252. package/build-module/store/private-selectors.mjs.map +2 -2
  253. package/build-module/store/reducer.mjs +6 -6
  254. package/build-module/store/reducer.mjs.map +2 -2
  255. package/build-module/store/selectors.mjs +23 -0
  256. package/build-module/store/selectors.mjs.map +2 -2
  257. package/build-module/utils/native-undo.mjs +29 -0
  258. package/build-module/utils/native-undo.mjs.map +7 -0
  259. package/build-style/content-rtl.css +10 -18
  260. package/build-style/content.css +10 -18
  261. package/build-style/style-rtl.css +150 -7
  262. package/build-style/style.css +150 -7
  263. package/package.json +40 -41
  264. package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
  265. package/src/components/alignment-control/ui.js +2 -4
  266. package/src/components/background-image-control/index.js +74 -37
  267. package/src/components/background-image-control/style.scss +13 -4
  268. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
  269. package/src/components/block-alignment-control/test/index.js +1 -1
  270. package/src/components/block-alignment-control/ui.js +4 -2
  271. package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
  272. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
  273. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
  274. package/src/components/block-inspector/index.js +60 -31
  275. package/src/components/block-list/block-html.js +5 -0
  276. package/src/components/block-list/content.scss +1 -11
  277. package/src/components/block-list/use-block-props/index.js +5 -1
  278. package/src/components/block-list/use-block-props/use-focus-handler.js +9 -8
  279. package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
  280. package/src/components/block-parent-selector/index.js +5 -2
  281. package/src/components/block-toolbar/switch-section-style.js +5 -2
  282. package/src/components/block-tools/empty-block-inserter.js +3 -7
  283. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
  284. package/src/components/block-vertical-alignment-control/test/index.js +18 -2
  285. package/src/components/block-vertical-alignment-control/ui.js +3 -5
  286. package/src/components/border-radius-control/test/utils.js +0 -41
  287. package/src/components/border-radius-control/utils.js +16 -107
  288. package/src/components/button-block-appender/content.scss +6 -2
  289. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  290. package/src/components/colors-gradients/control.js +6 -3
  291. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
  292. package/src/components/dimension-control/index.js +13 -1
  293. package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
  294. package/src/components/editor-styles/index.js +16 -1
  295. package/src/components/global-styles/background-panel.js +107 -34
  296. package/src/components/global-styles/border-panel.js +219 -48
  297. package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
  298. package/src/components/global-styles/color-panel.js +92 -11
  299. package/src/components/global-styles/dimensions-panel.js +422 -71
  300. package/src/components/global-styles/filters-panel.js +88 -28
  301. package/src/components/global-styles/hooks.js +8 -1
  302. package/src/components/global-styles/inheritance/index.js +204 -0
  303. package/src/components/global-styles/inheritance/style.scss +184 -0
  304. package/src/components/global-styles/inheritance/test/index.js +281 -0
  305. package/src/components/global-styles/inherited-value-context.js +271 -0
  306. package/src/components/global-styles/shadow-panel-components.js +48 -26
  307. package/src/components/global-styles/state-control.js +2 -2
  308. package/src/components/global-styles/test/background-panel.js +338 -1
  309. package/src/components/global-styles/test/border-panel.js +441 -0
  310. package/src/components/global-styles/test/color-panel.js +182 -2
  311. package/src/components/global-styles/test/dimensions-panel.js +753 -0
  312. package/src/components/global-styles/test/filters-panel.js +194 -0
  313. package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
  314. package/src/components/global-styles/test/inherited-value-context.js +454 -0
  315. package/src/components/global-styles/test/typography-panel-core.js +185 -0
  316. package/src/components/global-styles/test/typography-panel.js +849 -12
  317. package/src/components/global-styles/typography-panel.js +449 -100
  318. package/src/components/image-editor/style.scss +33 -0
  319. package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
  320. package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
  321. package/src/components/line-height-control/index.js +1 -1
  322. package/src/components/link-control/index.js +7 -2
  323. package/src/components/preset-input-control/index.js +4 -1
  324. package/src/components/provider/block-refs-provider.js +12 -2
  325. package/src/components/provider/index.js +2 -2
  326. package/src/components/provider/use-block-sync.js +18 -6
  327. package/src/components/provider/use-media-upload-settings.js +2 -0
  328. package/src/components/rich-text/index.js +37 -16
  329. package/src/components/spacing-sizes-control/test/utils.js +16 -5
  330. package/src/components/spacing-sizes-control/utils.js +11 -28
  331. package/src/components/text-indent-control/index.js +8 -0
  332. package/src/components/url-input/index.js +363 -431
  333. package/src/components/url-input/test/index.js +592 -0
  334. package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
  335. package/src/components/writing-flow/index.js +2 -0
  336. package/src/components/writing-flow/use-arrow-nav.js +51 -1
  337. package/src/components/writing-flow/use-click-selection.js +54 -3
  338. package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
  339. package/src/components/writing-flow/use-editable-root.js +7 -77
  340. package/src/components/writing-flow/use-home-end.js +17 -9
  341. package/src/components/writing-flow/use-selection-observer.js +32 -15
  342. package/src/components/writing-flow/utils.js +3 -24
  343. package/src/hooks/background.js +26 -21
  344. package/src/hooks/block-fields/rich-text/styles.scss +1 -1
  345. package/src/hooks/block-style-variation.js +8 -74
  346. package/src/hooks/border.js +19 -4
  347. package/src/hooks/custom-css.js +15 -6
  348. package/src/hooks/dimensions.js +17 -4
  349. package/src/hooks/duotone.js +26 -8
  350. package/src/hooks/elements.js +14 -3
  351. package/src/hooks/line-height.js +0 -1
  352. package/src/hooks/test/inherited-value-wiring.js +411 -0
  353. package/src/hooks/test/preset-round-trip.js +456 -0
  354. package/src/hooks/typography.js +35 -23
  355. package/src/private-apis.js +11 -2
  356. package/src/store/actions.js +10 -4
  357. package/src/store/private-selectors.js +57 -1
  358. package/src/store/reducer.js +9 -9
  359. package/src/store/selectors.js +56 -8
  360. package/src/store/test/private-selectors.js +160 -1
  361. package/src/style.scss +2 -0
  362. package/src/utils/native-undo.js +56 -0
  363. package/build/components/duotone/utils.cjs +0 -87
  364. package/build/components/duotone/utils.cjs.map +0 -7
  365. package/build-module/components/duotone/utils.mjs +0 -59
  366. package/build-module/components/duotone/utils.mjs.map +0 -7
  367. package/src/components/duotone/utils.js +0 -90
  368. package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
@@ -12,7 +12,6 @@ import {
12
12
  */
13
13
  import { isInsideRootBlock } from '../../../utils/dom';
14
14
  import { store as blockEditorStore } from '../../../store';
15
- import { isShiftClickInProgress } from '../../writing-flow/utils';
16
15
  import { unlock } from '../../../lock-unlock';
17
16
 
18
17
  const { subscribeDelegatedListener } = unlock( composePrivateApis );
@@ -23,7 +22,7 @@ const { subscribeDelegatedListener } = unlock( composePrivateApis );
23
22
  * @param {string} clientId Block client ID.
24
23
  */
25
24
  export function useFocusHandler( clientId ) {
26
- const { isBlockSelected, isBlockMultiSelected } =
25
+ const { isBlockSelected, isBlockMultiSelected, isMultiSelecting } =
27
26
  useSelect( blockEditorStore );
28
27
  const { selectBlock, selectionChange } = useDispatch( blockEditorStore );
29
28
 
@@ -48,12 +47,14 @@ export function useFocusHandler( clientId ) {
48
47
  return;
49
48
  }
50
49
 
51
- // Never select on the focus fired by a shift+click: the
52
- // browser can focus the common editable ancestor of the
53
- // range (e.g. a group block), and any selection re-render
54
- // mid gesture destroys the native selection being made. The
55
- // selection observer builds the multi-selection on mouseup.
56
- if ( isShiftClickInProgress() ) {
50
+ // Never select on the focus fired during a selection
51
+ // gesture (a shift+click, marked by the selection observer
52
+ // with startMultiSelect). The browser can focus the common
53
+ // editable ancestor of the range (e.g. a group block), and
54
+ // any selection re-render mid gesture destroys the native
55
+ // selection being made. The observer builds the
56
+ // multi-selection on mouseup.
57
+ if ( isMultiSelecting() ) {
57
58
  return;
58
59
  }
59
60
 
@@ -0,0 +1,45 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ useContext,
6
+ useEffect,
7
+ useInsertionEffect,
8
+ useRef,
9
+ } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { getEventHandlers } from '../../writing-flow/use-editable-root-event-handlers';
15
+ import { BlockRefs } from '../../provider/block-refs-provider';
16
+
17
+ /**
18
+ * Registers the block's `wrapperProps` event handlers so the writing flow host
19
+ * can call them when a block that supports `editableRoot` is edited through the
20
+ * host and the events no longer reach the block.
21
+ *
22
+ * Handlers are keyed by client ID in the `BlockRefs` context, so the host
23
+ * resolves them from the block hierarchy. A ref is stored so the host always
24
+ * calls the latest render's handlers, and only blocks that have a handler are
25
+ * registered.
26
+ *
27
+ * @param {string} clientId Block client ID.
28
+ * @param {Object} wrapperProps The block's merged wrapper props.
29
+ */
30
+ export function useRegisterBlockEventHandlers( clientId, wrapperProps ) {
31
+ const { eventHandlers } = useContext( BlockRefs );
32
+ const handlers = getEventHandlers( wrapperProps );
33
+ const handlersRef = useRef();
34
+ useInsertionEffect( () => {
35
+ handlersRef.current = handlers;
36
+ } );
37
+
38
+ const hasHandlers = !! handlers;
39
+ useEffect( () => {
40
+ if ( hasHandlers ) {
41
+ eventHandlers.set( clientId, handlersRef );
42
+ return () => eventHandlers.delete( clientId );
43
+ }
44
+ }, [ eventHandlers, clientId, hasHandlers ] );
45
+ }
@@ -26,10 +26,13 @@ export default function BlockParentSelector() {
26
26
  const { parentClientId } = useSelect( ( select ) => {
27
27
  const {
28
28
  getBlockParents,
29
- getSelectedBlockClientId,
29
+ getSelectedBlockClientIds,
30
30
  getParentSectionBlock,
31
31
  } = unlock( select( blockEditorStore ) );
32
- const selectedBlockClientId = getSelectedBlockClientId();
32
+ // Not getSelectedBlockClientId: a text selection crossing into a
33
+ // nested block resolves to the ancestor alone, but its selection
34
+ // start and end differ.
35
+ const [ selectedBlockClientId ] = getSelectedBlockClientIds();
33
36
  const parentSection = getParentSectionBlock( selectedBlockClientId );
34
37
  const parents = getBlockParents( selectedBlockClientId );
35
38
  const _parentClientId = parentSection ?? parents[ parents.length - 1 ];
@@ -10,6 +10,7 @@ import {
10
10
  } from '@wordpress/components';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { useDispatch, useSelect } from '@wordpress/data';
13
+ import { privateApis as globalStylesEnginePrivateApis } from '@wordpress/global-styles-engine';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -18,7 +19,9 @@ import useStylesForBlocks from '../block-styles/use-styles-for-block';
18
19
  import { replaceActiveStyle } from '../block-styles/utils';
19
20
  import { store as blockEditorStore } from '../../store';
20
21
  import { globalStylesDataKey } from '../../store/private-keys';
21
- import { getVariationStylesWithRefValues } from '../../hooks/block-style-variation';
22
+ import { unlock } from '../../lock-unlock';
23
+
24
+ const { getVariationStyle } = unlock( globalStylesEnginePrivateApis );
22
25
 
23
26
  const styleIcon = (
24
27
  <SVG
@@ -59,7 +62,7 @@ function SwitchSectionStyle( { clientId } ) {
59
62
 
60
63
  // Get the background color for the active style
61
64
  const activeStyleBackground = activeStyle?.name
62
- ? getVariationStylesWithRefValues(
65
+ ? getVariationStyle(
63
66
  {
64
67
  settings: globalSettings,
65
68
  styles: globalStyles,
@@ -15,12 +15,8 @@ export default function EmptyBlockInserter( {
15
15
  clientId,
16
16
  __unstableContentRef,
17
17
  } ) {
18
- const {
19
- capturingClientId,
20
- isInsertionPointVisible,
21
- lastClientId,
22
- rootClientId,
23
- } = useSelectedBlockToolProps( clientId );
18
+ const { isInsertionPointVisible, lastClientId, rootClientId } =
19
+ useSelectedBlockToolProps( clientId );
24
20
 
25
21
  const popoverProps = useBlockToolbarPopoverProps( {
26
22
  contentElement: __unstableContentRef?.current,
@@ -29,7 +25,7 @@ export default function EmptyBlockInserter( {
29
25
 
30
26
  return (
31
27
  <BlockPopoverCover
32
- clientId={ capturingClientId || clientId }
28
+ clientId={ clientId }
33
29
  bottomClientId={ lastClientId }
34
30
  className={ clsx(
35
31
  'block-editor-block-list__block-side-inserter-popover',
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden 1`] = `
4
4
  <div>
@@ -9,7 +9,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden
9
9
  <button
10
10
  aria-expanded="false"
11
11
  aria-haspopup="true"
12
- aria-label="Change vertical alignment"
12
+ aria-label="Align content vertically"
13
13
  class="components-button components-dropdown-menu__toggle has-icon"
14
14
  data-toolbar-item="true"
15
15
  type="button"
@@ -37,7 +37,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
37
37
  <div
38
38
  class="components-toolbar"
39
39
  icon="[object Object]"
40
- label="Change vertical alignment"
40
+ label="Align content vertically"
41
41
  >
42
42
  <div>
43
43
  <button
@@ -40,6 +40,22 @@ describe( 'BlockVerticalAlignmentUI', () => {
40
40
  expect( container ).toMatchSnapshot();
41
41
  } );
42
42
 
43
+ test( 'should use custom label and description', () => {
44
+ render(
45
+ <BlockVerticalAlignmentUI
46
+ value={ alignment }
47
+ onChange={ onChange }
48
+ label="Custom Label"
49
+ description="Custom Description"
50
+ />
51
+ );
52
+
53
+ const button = screen.getByRole( 'button', { name: 'Custom Label' } );
54
+ expect( button ).toHaveAttribute( 'aria-label', 'Custom Label' );
55
+ // The description is now part of the toggleProps and not directly accessible
56
+ // We can't easily test for the describedBy attribute here
57
+ } );
58
+
43
59
  test( 'should expand controls when toggled', async () => {
44
60
  const user = userEvent.setup();
45
61
 
@@ -59,7 +75,7 @@ describe( 'BlockVerticalAlignmentUI', () => {
59
75
 
60
76
  await user.click(
61
77
  screen.getByRole( 'button', {
62
- name: 'Change vertical alignment',
78
+ name: 'Align content vertically',
63
79
  } )
64
80
  );
65
81
 
@@ -86,7 +102,7 @@ describe( 'BlockVerticalAlignmentUI', () => {
86
102
  );
87
103
 
88
104
  const activeControl = screen.getByRole( 'button', {
89
- name: `Align ${ alignment }`,
105
+ name: `Align top`,
90
106
  pressed: true,
91
107
  } );
92
108
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { _x } from '@wordpress/i18n';
4
+ import { __, _x } from '@wordpress/i18n';
5
5
  import { ToolbarGroup, ToolbarDropdownMenu } from '@wordpress/components';
6
6
  import {
7
7
  justifyTop,
@@ -43,6 +43,7 @@ function BlockVerticalAlignmentUI( {
43
43
  controls = DEFAULT_CONTROLS,
44
44
  isCollapsed = true,
45
45
  isToolbar,
46
+ label = __( 'Align content vertically' ),
46
47
  } ) {
47
48
  function applyOrUnset( align ) {
48
49
  return () => onChange( value === align ? undefined : align );
@@ -62,10 +63,7 @@ function BlockVerticalAlignmentUI( {
62
63
  ? activeAlignment.icon
63
64
  : defaultAlignmentControl.icon
64
65
  }
65
- label={ _x(
66
- 'Change vertical alignment',
67
- 'Block vertical alignment setting label'
68
- ) }
66
+ label={ label }
69
67
  controls={ controls.map( ( control ) => {
70
68
  return {
71
69
  ...BLOCK_ALIGNMENTS_CONTROLS[ control ],
@@ -7,7 +7,6 @@ import {
7
7
  hasMixedValues,
8
8
  hasDefinedValues,
9
9
  mode,
10
- getPresetValueFromCustomValue,
11
10
  getPresetValueFromControlValue,
12
11
  } from '../utils';
13
12
 
@@ -273,46 +272,6 @@ describe( 'mode', () => {
273
272
  } );
274
273
  } );
275
274
 
276
- describe( 'getPresetValueFromCustomValue', () => {
277
- const presets = [
278
- { name: 'None', slug: '0', size: 0 },
279
- { name: 'Small', slug: 'sm', size: '4px' },
280
- { name: 'Medium', slug: 'md', size: 'clamp(2px, 1vw, 8px)' },
281
- ];
282
-
283
- it( 'should return "0" if value is "0"', () => {
284
- expect( getPresetValueFromCustomValue( '0', presets ) ).toBe( '0' );
285
- } );
286
-
287
- it( 'should return preset reference if value matches a preset', () => {
288
- expect( getPresetValueFromCustomValue( '4px', presets ) ).toBe(
289
- 'var:preset|border-radius|sm'
290
- );
291
- expect(
292
- getPresetValueFromCustomValue( 'clamp(2px, 1vw, 8px)', presets )
293
- ).toBe( 'var:preset|border-radius|md' );
294
- } );
295
-
296
- it( 'should return value as-is if no matching preset', () => {
297
- expect( getPresetValueFromCustomValue( '7px', presets ) ).toBe( '7px' );
298
- } );
299
-
300
- it( 'should return value as-is if already a preset reference', () => {
301
- expect(
302
- getPresetValueFromCustomValue(
303
- 'var:preset|border-radius|md',
304
- presets
305
- )
306
- ).toBe( 'var:preset|border-radius|md' );
307
- } );
308
-
309
- it( 'should return undefined if value is undefined', () => {
310
- expect(
311
- getPresetValueFromCustomValue( undefined, presets )
312
- ).toBeUndefined();
313
- } );
314
- } );
315
-
316
275
  describe( 'getPresetValueFromControlValue', () => {
317
276
  const presets = [
318
277
  { name: 'None', slug: '0', size: 0 },
@@ -3,6 +3,16 @@
3
3
  */
4
4
  import { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
5
5
 
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import {
10
+ getCustomValueFromPreset,
11
+ isValuePreset,
12
+ } from '../preset-input-control/utils';
13
+
14
+ const BORDER_RADIUS_PRESET_TYPE = 'border-radius';
15
+
6
16
  /**
7
17
  * Gets the (non-undefined) item with the highest occurrence within an array
8
18
  * Based in part on: https://stackoverflow.com/a/20762713
@@ -138,84 +148,6 @@ export function hasDefinedValues( values ) {
138
148
  return !! filteredValues.length;
139
149
  }
140
150
 
141
- /**
142
- * Checks is given value is a radius preset.
143
- *
144
- * @param {string} value Value to check
145
- *
146
- * @return {boolean} Return true if value is string in format var:preset|border-radius|.
147
- */
148
- export function isValuePreset( value ) {
149
- if ( ! value?.includes ) {
150
- return false;
151
- }
152
- return value === '0' || value.includes( 'var:preset|border-radius|' );
153
- }
154
-
155
- /**
156
- * Returns the slug section of the given preset string.
157
- *
158
- * @param {string} value Value to extract slug from.
159
- *
160
- * @return {string|undefined} The value slug from given preset.
161
- */
162
- export function getPresetSlug( value ) {
163
- if ( ! value ) {
164
- return;
165
- }
166
-
167
- if ( value === '0' || value === 'default' ) {
168
- return value;
169
- }
170
-
171
- const slug = value.match( /var:preset\|border-radius\|(.+)/ );
172
-
173
- return slug ? slug[ 1 ] : undefined;
174
- }
175
-
176
- /**
177
- * Converts radius preset value into a Range component value .
178
- *
179
- * @param {string} presetValue Value to convert to Range value.
180
- * @param {Array} presets Array of current radius preset value objects.
181
- *
182
- * @return {number} The int value for use in Range control.
183
- */
184
- export function getSliderValueFromPreset( presetValue, presets ) {
185
- if ( presetValue === undefined ) {
186
- return 0;
187
- }
188
- const slug =
189
- parseFloat( presetValue, 10 ) === 0
190
- ? '0'
191
- : getPresetSlug( presetValue );
192
- const sliderValue = presets.findIndex( ( size ) => {
193
- return String( size.slug ) === slug;
194
- } );
195
-
196
- // Returning NaN rather than undefined as undefined makes range control thumb sit in center
197
- return sliderValue !== -1 ? sliderValue : NaN;
198
- }
199
-
200
- /**
201
- * Converts a preset into a custom value.
202
- *
203
- * @param {string} value Value to convert
204
- * @param {Array} presets Array of the current radius preset objects
205
- *
206
- * @return {string} Mapping of the radius preset to its equivalent custom value.
207
- */
208
- export function getCustomValueFromPreset( value, presets ) {
209
- if ( ! isValuePreset( value ) ) {
210
- return value;
211
- }
212
-
213
- const slug = parseFloat( value, 10 ) === 0 ? '0' : getPresetSlug( value );
214
- const radiusSize = presets.find( ( size ) => String( size.slug ) === slug );
215
-
216
- return radiusSize?.size;
217
- }
218
-
219
151
  /**
220
152
  * Converts a control value into a preset value.
221
153
  *
@@ -242,33 +174,6 @@ export function getPresetValueFromControlValue(
242
174
  return `var:preset|border-radius|${ presets[ controlValue ]?.slug }`;
243
175
  }
244
176
 
245
- /**
246
- * Converts a custom value to preset value if one can be found.
247
- *
248
- * Returns value as-is if no match is found.
249
- *
250
- * @param {string} value Value to convert
251
- * @param {Array} presets Array of the current border radius preset objects
252
- *
253
- * @return {string} The preset value if it can be found.
254
- */
255
- export function getPresetValueFromCustomValue( value, presets ) {
256
- // Return value as-is if it is undefined or is already a preset, or '0';
257
- if ( ! value || isValuePreset( value ) || value === '0' ) {
258
- return value;
259
- }
260
-
261
- const spacingMatch = presets.find(
262
- ( size ) => String( size.size ) === String( value )
263
- );
264
-
265
- if ( spacingMatch?.slug ) {
266
- return `var:preset|border-radius|${ spacingMatch.slug }`;
267
- }
268
-
269
- return value;
270
- }
271
-
272
177
  /**
273
178
  * Converts all preset values in a values object to their custom equivalents.
274
179
  *
@@ -285,8 +190,12 @@ export function convertPresetsToCustomValues( values, presets ) {
285
190
  const converted = {};
286
191
  Object.keys( values ).forEach( ( key ) => {
287
192
  const value = values[ key ];
288
- if ( isValuePreset( value ) ) {
289
- const customValue = getCustomValueFromPreset( value, presets );
193
+ if ( isValuePreset( value, BORDER_RADIUS_PRESET_TYPE ) ) {
194
+ const customValue = getCustomValueFromPreset(
195
+ value,
196
+ presets,
197
+ BORDER_RADIUS_PRESET_TYPE
198
+ );
290
199
  converted[ key ] = customValue !== undefined ? customValue : value;
291
200
  } else {
292
201
  converted[ key ] = value;
@@ -25,8 +25,12 @@
25
25
  }
26
26
 
27
27
 
28
- // When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state.
29
- .block-list-appender:only-child {
28
+ // When a button appender shows up in empty container blocks, such as Group
29
+ // and Columns, add an extra click state: the first click selects the
30
+ // container instead of opening the inserter. Default block appenders don't
31
+ // need this because their first click inserts a paragraph and sets the
32
+ // selection.
33
+ .block-list-appender:only-child:has(.block-editor-button-block-appender) {
30
34
  // One level of nesting
31
35
  .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &,
32
36
  .is-layout-flow.block-editor-block-list__block:not(.is-selected) > &,
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`ColorPaletteControl matches the snapshot 1`] = `
4
4
  .emotion-0 {
@@ -45,6 +45,7 @@ function ColorGradientControlInner( {
45
45
  colorValue,
46
46
  colorSlug,
47
47
  gradientValue,
48
+ gradientSlug,
48
49
  clearable,
49
50
  showTitle = true,
50
51
  enableAlpha,
@@ -102,13 +103,15 @@ function ColorGradientControlInner( {
102
103
  [ TAB_IDS.gradient ]: (
103
104
  <GradientPicker
104
105
  value={ gradientValue }
106
+ selectedSlug={ gradientSlug }
105
107
  onChange={
106
108
  canChooseAColor
107
- ? ( newGradient ) => {
108
- onGradientChange( newGradient );
109
+ ? ( newGradient, _index, newSlug ) => {
110
+ onGradientChange( newGradient, newSlug );
109
111
  onColorChange();
110
112
  }
111
- : onGradientChange
113
+ : ( newGradient, _index, newSlug ) =>
114
+ onGradientChange( newGradient, newSlug )
112
115
  }
113
116
  { ...{ gradients, disableCustomGradients } }
114
117
  __experimentalIsRenderedInSidebar={
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`DefaultBlockAppender should append a default block when input focused 1`] = `
4
4
  <div>
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -58,6 +63,8 @@ function useDimensionSizes( presets ) {
58
63
  * @param {?string} props.label A label for the control.
59
64
  * @param {( value: string ) => void } props.onChange Called when the dimension value changes.
60
65
  * @param {string} props.value The current dimension value.
66
+ * @param {?string} props.placeholder Placeholder text for the custom-value input.
67
+ * @param {?string} props.className Additional CSS class on the wrapping fieldset.
61
68
  * @param {?Object} props.dimensionSizes Optional dimension size presets. Falls back to settings from the store.
62
69
  *
63
70
  * @return {Component} The component to be rendered.
@@ -66,6 +73,8 @@ export default function DimensionControl( {
66
73
  label = __( 'Dimension' ),
67
74
  onChange,
68
75
  value,
76
+ placeholder,
77
+ className,
69
78
  dimensionSizes: dimensionSizesProp,
70
79
  } ) {
71
80
  const [ dimensionSizesFromSettings, availableUnits ] = useSettings(
@@ -146,7 +155,9 @@ export default function DimensionControl( {
146
155
  };
147
156
 
148
157
  return (
149
- <fieldset className="block-editor-dimension-control">
158
+ <fieldset
159
+ className={ clsx( 'block-editor-dimension-control', className ) }
160
+ >
150
161
  <BaseControl.VisualLabel as="legend">
151
162
  { label }
152
163
  </BaseControl.VisualLabel>
@@ -157,6 +168,7 @@ export default function DimensionControl( {
157
168
  minimumCustomValue={ 0 }
158
169
  onChange={ onChange }
159
170
  onUnitChange={ handleUnitChange }
171
+ placeholder={ placeholder }
160
172
  presets={ options }
161
173
  presetType="dimension"
162
174
  selectedUnit={ selectedUnit }
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- SelectControl,
6
- __experimentalToolsPanelItem as ToolsPanelItem,
7
- } from '@wordpress/components';
4
+ import { SelectControl } from '@wordpress/components';
8
5
  import { __, _x } from '@wordpress/i18n';
9
6
  /**
10
7
  * Internal dependencies
11
8
  */
12
9
  import { useSettings } from '../use-settings';
10
+ import { InheritanceToolsPanelItem } from '../global-styles/inheritance';
13
11
 
14
12
  /**
15
13
  * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
@@ -29,6 +27,9 @@ import { useSettings } from '../use-settings';
29
27
  * @property {SelectControlProps[]} [options] Aspect ratio options.
30
28
  * @property {string} [defaultValue] Default aspect ratio value.
31
29
  * @property {boolean} [isShownByDefault] Whether the tool is shown by default.
30
+ * @property {string} [className] Additional CSS class on the wrapping panel item.
31
+ * @property {boolean} [isInherited] Whether the control is displaying an inherited Global Styles value.
32
+ * @property {boolean} [hasLocalOverride] Whether a local value is overriding an inherited Global Styles value.
32
33
  */
33
34
 
34
35
  export default function AspectRatioTool( {
@@ -39,6 +40,9 @@ export default function AspectRatioTool( {
39
40
  defaultValue = 'auto',
40
41
  hasValue,
41
42
  isShownByDefault = true,
43
+ className,
44
+ isInherited,
45
+ hasLocalOverride,
42
46
  } ) {
43
47
  // Match the CSS default so if the value is used directly in CSS it will look correct in the control.
44
48
  const displayValue = value ?? 'auto';
@@ -78,7 +82,10 @@ export default function AspectRatioTool( {
78
82
  ];
79
83
 
80
84
  return (
81
- <ToolsPanelItem
85
+ <InheritanceToolsPanelItem
86
+ className={ className }
87
+ isInherited={ isInherited }
88
+ hasLocalOverride={ hasLocalOverride }
82
89
  hasValue={
83
90
  hasValue ? hasValue : () => displayValue !== defaultValue
84
91
  }
@@ -93,6 +100,6 @@ export default function AspectRatioTool( {
93
100
  options={ options ?? aspectRatioOptions }
94
101
  onChange={ onChange }
95
102
  />
96
- </ToolsPanelItem>
103
+ </InheritanceToolsPanelItem>
97
104
  );
98
105
  }
@@ -75,7 +75,22 @@ function EditorStyles( { styles, scope, transformOptions } ) {
75
75
  const [ transformedStyles, transformedSvgs ] = useMemo( () => {
76
76
  const _styles = Object.values( styles ?? [] );
77
77
 
78
- for ( const [ id, override ] of overrides ) {
78
+ /*
79
+ * Custom CSS overrides are applied after all other overrides so they
80
+ * win the cascade at equal specificity, mirroring the front end where
81
+ * the custom CSS stylesheet is printed last. Both partitions keep the
82
+ * block order established by getStyleOverrides.
83
+ */
84
+ const orderedOverrides = [
85
+ ...overrides.filter(
86
+ ( [ , override ] ) => override?.__unstableType !== 'custom-css'
87
+ ),
88
+ ...overrides.filter(
89
+ ( [ , override ] ) => override?.__unstableType === 'custom-css'
90
+ ),
91
+ ];
92
+
93
+ for ( const [ id, override ] of orderedOverrides ) {
79
94
  const index = _styles.findIndex( ( { id: _id } ) => id === _id );
80
95
  const overrideWithId = { ...override, id };
81
96
  if ( index === -1 ) {