@wordpress/block-editor 16.0.1-next.v.202607070741.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 (679) hide show
  1. package/CHANGELOG.md +27 -1
  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-canvas/index.cjs +6 -1
  10. package/build/components/block-canvas/index.cjs.map +2 -2
  11. package/build/components/block-controls/groups.cjs +3 -1
  12. package/build/components/block-controls/groups.cjs.map +2 -2
  13. package/build/components/block-edit/edit.cjs +10 -18
  14. package/build/components/block-edit/edit.cjs.map +2 -2
  15. package/build/components/block-inspector/index.cjs +73 -46
  16. package/build/components/block-inspector/index.cjs.map +2 -2
  17. package/build/components/block-list/block-html.cjs +4 -1
  18. package/build/components/block-list/block-html.cjs.map +2 -2
  19. package/build/components/block-list/block.cjs +9 -3
  20. package/build/components/block-list/block.cjs.map +3 -3
  21. package/build/components/block-list/index.cjs +1 -3
  22. package/build/components/block-list/index.cjs.map +2 -2
  23. package/build/components/block-list/use-block-props/index.cjs +7 -2
  24. package/build/components/block-list/use-block-props/index.cjs.map +2 -2
  25. package/build/components/block-list/use-block-props/use-focus-first-element.cjs +9 -4
  26. package/build/components/block-list/use-block-props/use-focus-first-element.cjs.map +2 -2
  27. package/build/components/block-list/use-block-props/use-focus-handler.cjs +11 -4
  28. package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
  29. package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
  30. package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
  31. package/build/components/block-parent-selector/index.cjs +2 -2
  32. package/build/components/block-parent-selector/index.cjs.map +2 -2
  33. package/build/components/block-toolbar/index.cjs +43 -24
  34. package/build/components/block-toolbar/index.cjs.map +2 -2
  35. package/build/components/block-toolbar/switch-section-style.cjs +4 -2
  36. package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
  37. package/build/components/block-tools/empty-block-inserter.cjs +2 -7
  38. package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
  39. package/build/components/block-tools/index.cjs +7 -2
  40. package/build/components/block-tools/index.cjs.map +2 -2
  41. package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
  42. package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
  43. package/build/components/block-visibility/modal.cjs +20 -6
  44. package/build/components/block-visibility/modal.cjs.map +2 -2
  45. package/build/components/block-visibility/use-block-visibility.cjs +16 -6
  46. package/build/components/block-visibility/use-block-visibility.cjs.map +3 -3
  47. package/build/components/block-visibility/utils.cjs +15 -2
  48. package/build/components/block-visibility/utils.cjs.map +3 -3
  49. package/build/components/block-visibility/viewport-menu-item.cjs +7 -1
  50. package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
  51. package/build/components/block-visibility/viewport-toolbar.cjs +5 -0
  52. package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
  53. package/build/components/block-visibility/viewport-visibility-info.cjs +5 -1
  54. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  55. package/build/components/border-radius-control/utils.cjs +8 -58
  56. package/build/components/border-radius-control/utils.cjs.map +2 -2
  57. package/build/components/child-layout-control/index.cjs +0 -4
  58. package/build/components/child-layout-control/index.cjs.map +2 -2
  59. package/build/components/colors-gradients/control.cjs +5 -3
  60. package/build/components/colors-gradients/control.cjs.map +2 -2
  61. package/build/components/dimension-control/index.cjs +30 -20
  62. package/build/components/dimension-control/index.cjs.map +3 -3
  63. package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
  64. package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
  65. package/build/components/editor-styles/index.cjs +9 -1
  66. package/build/components/editor-styles/index.cjs.map +2 -2
  67. package/build/components/global-styles/background-panel.cjs +66 -25
  68. package/build/components/global-styles/background-panel.cjs.map +3 -3
  69. package/build/components/global-styles/border-panel.cjs +153 -55
  70. package/build/components/global-styles/border-panel.cjs.map +3 -3
  71. package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
  72. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
  73. package/build/components/global-styles/color-panel.cjs +63 -17
  74. package/build/components/global-styles/color-panel.cjs.map +2 -2
  75. package/build/components/global-styles/dimensions-panel.cjs +242 -64
  76. package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
  77. package/build/components/global-styles/filters-panel.cjs +59 -20
  78. package/build/components/global-styles/filters-panel.cjs.map +3 -3
  79. package/build/components/global-styles/hooks.cjs +4 -1
  80. package/build/components/global-styles/hooks.cjs.map +2 -2
  81. package/build/components/global-styles/inheritance/index.cjs +142 -0
  82. package/build/components/global-styles/inheritance/index.cjs.map +7 -0
  83. package/build/components/global-styles/inherited-value-context.cjs +173 -0
  84. package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
  85. package/build/components/global-styles/shadow-panel-components.cjs +38 -20
  86. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  87. package/build/components/global-styles/state-control-badges.cjs +39 -3
  88. package/build/components/global-styles/state-control-badges.cjs.map +2 -2
  89. package/build/components/global-styles/state-control.cjs +1 -1
  90. package/build/components/global-styles/state-control.cjs.map +2 -2
  91. package/build/components/global-styles/typography-panel.cjs +271 -79
  92. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  93. package/build/components/image-size-control/index.cjs +2 -4
  94. package/build/components/image-size-control/index.cjs.map +2 -2
  95. package/build/components/inserter/media-tab/hooks.cjs +33 -6
  96. package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
  97. package/build/components/inserter/media-tab/media-panel.cjs +78 -16
  98. package/build/components/inserter/media-tab/media-panel.cjs.map +3 -3
  99. package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
  100. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  101. package/build/components/keyboard-shortcuts/index.cjs +19 -11
  102. package/build/components/keyboard-shortcuts/index.cjs.map +2 -2
  103. package/build/components/line-height-control/index.cjs +1 -2
  104. package/build/components/line-height-control/index.cjs.map +2 -2
  105. package/build/components/link-control/index.cjs +3 -1
  106. package/build/components/link-control/index.cjs.map +2 -2
  107. package/build/components/list-view/block.cjs +13 -4
  108. package/build/components/list-view/block.cjs.map +2 -2
  109. package/build/components/media-placeholder/index.cjs +0 -1
  110. package/build/components/media-placeholder/index.cjs.map +2 -2
  111. package/build/components/preset-input-control/index.cjs +2 -1
  112. package/build/components/preset-input-control/index.cjs.map +2 -2
  113. package/build/components/provider/block-refs-provider.cjs +8 -2
  114. package/build/components/provider/block-refs-provider.cjs.map +2 -2
  115. package/build/components/provider/index.cjs +1 -1
  116. package/build/components/provider/index.cjs.map +2 -2
  117. package/build/components/provider/use-block-sync.cjs +18 -6
  118. package/build/components/provider/use-block-sync.cjs.map +2 -2
  119. package/build/components/provider/use-media-upload-settings.cjs +3 -1
  120. package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
  121. package/build/components/rich-text/event-listeners/before-input-rules.cjs +3 -4
  122. package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
  123. package/build/components/rich-text/event-listeners/delete.cjs +2 -3
  124. package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
  125. package/build/components/rich-text/event-listeners/enter.cjs +3 -2
  126. package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
  127. package/build/components/rich-text/event-listeners/input-events.cjs +3 -3
  128. package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
  129. package/build/components/rich-text/event-listeners/input-rules.cjs +3 -4
  130. package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
  131. package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +3 -3
  132. package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
  133. package/build/components/rich-text/event-listeners/paste-handler.cjs +2 -1
  134. package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
  135. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +3 -3
  136. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
  137. package/build/components/rich-text/event-listeners/shortcuts.cjs +3 -3
  138. package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
  139. package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +3 -3
  140. package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
  141. package/build/components/rich-text/index.cjs +76 -17
  142. package/build/components/rich-text/index.cjs.map +2 -2
  143. package/build/components/spacing-sizes-control/utils.cjs +6 -19
  144. package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
  145. package/build/components/text-indent-control/index.cjs +8 -2
  146. package/build/components/text-indent-control/index.cjs.map +2 -2
  147. package/build/components/typewriter/index.cjs +129 -136
  148. package/build/components/typewriter/index.cjs.map +3 -3
  149. package/build/components/url-input/index.cjs +303 -344
  150. package/build/components/url-input/index.cjs.map +3 -3
  151. package/build/components/use-block-commands/index.cjs +21 -17
  152. package/build/components/use-block-commands/index.cjs.map +2 -2
  153. package/build/components/use-on-block-drop/index.cjs +1 -1
  154. package/build/components/use-on-block-drop/index.cjs.map +2 -2
  155. package/build/components/writing-flow/index.cjs +14 -1
  156. package/build/components/writing-flow/index.cjs.map +3 -3
  157. package/build/components/writing-flow/use-arrow-nav.cjs +42 -6
  158. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  159. package/build/components/writing-flow/use-click-selection.cjs +29 -3
  160. package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
  161. package/build/components/writing-flow/use-clipboard-handler.cjs +4 -1
  162. package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
  163. package/build/components/writing-flow/use-drag-selection.cjs +3 -8
  164. package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
  165. package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
  166. package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
  167. package/build/components/writing-flow/use-editable-root.cjs +75 -0
  168. package/build/components/writing-flow/use-editable-root.cjs.map +7 -0
  169. package/build/components/writing-flow/use-home-end.cjs +64 -0
  170. package/build/components/writing-flow/use-home-end.cjs.map +7 -0
  171. package/build/components/writing-flow/use-input.cjs +15 -5
  172. package/build/components/writing-flow/use-input.cjs.map +2 -2
  173. package/build/components/writing-flow/use-multi-selection.cjs +2 -2
  174. package/build/components/writing-flow/use-multi-selection.cjs.map +2 -2
  175. package/build/components/writing-flow/use-select-all.cjs +14 -2
  176. package/build/components/writing-flow/use-select-all.cjs.map +2 -2
  177. package/build/components/writing-flow/use-selection-observer.cjs +132 -22
  178. package/build/components/writing-flow/use-selection-observer.cjs.map +3 -3
  179. package/build/components/writing-flow/utils.cjs +28 -2
  180. package/build/components/writing-flow/utils.cjs.map +2 -2
  181. package/build/hooks/background.cjs +14 -10
  182. package/build/hooks/background.cjs.map +2 -2
  183. package/build/hooks/block-fields/rich-text/index.cjs +2 -3
  184. package/build/hooks/block-fields/rich-text/index.cjs.map +3 -3
  185. package/build/hooks/block-style-variation.cjs +4 -45
  186. package/build/hooks/block-style-variation.cjs.map +3 -3
  187. package/build/hooks/border.cjs +19 -4
  188. package/build/hooks/border.cjs.map +2 -2
  189. package/build/hooks/custom-css.cjs +6 -2
  190. package/build/hooks/custom-css.cjs.map +2 -2
  191. package/build/hooks/dimensions.cjs +15 -4
  192. package/build/hooks/dimensions.cjs.map +2 -2
  193. package/build/hooks/duotone.cjs +26 -14
  194. package/build/hooks/duotone.cjs.map +3 -3
  195. package/build/hooks/elements.cjs +15 -5
  196. package/build/hooks/elements.cjs.map +2 -2
  197. package/build/hooks/grid-visualizer.cjs +5 -3
  198. package/build/hooks/grid-visualizer.cjs.map +2 -2
  199. package/build/hooks/layout-child.cjs +22 -12
  200. package/build/hooks/layout-child.cjs.map +3 -3
  201. package/build/hooks/layout.cjs +28 -13
  202. package/build/hooks/layout.cjs.map +3 -3
  203. package/build/hooks/line-height.cjs +1 -2
  204. package/build/hooks/line-height.cjs.map +2 -2
  205. package/build/hooks/states.cjs +27 -7
  206. package/build/hooks/states.cjs.map +3 -3
  207. package/build/hooks/style.cjs +31 -9
  208. package/build/hooks/style.cjs.map +3 -3
  209. package/build/hooks/text-align.cjs +36 -6
  210. package/build/hooks/text-align.cjs.map +3 -3
  211. package/build/hooks/typography.cjs +14 -5
  212. package/build/hooks/typography.cjs.map +2 -2
  213. package/build/layouts/constrained.cjs +14 -6
  214. package/build/layouts/constrained.cjs.map +2 -2
  215. package/build/layouts/flex.cjs +27 -19
  216. package/build/layouts/flex.cjs.map +2 -2
  217. package/build/layouts/grid.cjs +0 -2
  218. package/build/layouts/grid.cjs.map +2 -2
  219. package/build/private-apis.cjs +9 -5
  220. package/build/private-apis.cjs.map +3 -3
  221. package/build/store/actions.cjs +11 -6
  222. package/build/store/actions.cjs.map +2 -2
  223. package/build/store/private-selectors.cjs +41 -3
  224. package/build/store/private-selectors.cjs.map +3 -3
  225. package/build/store/reducer.cjs +6 -6
  226. package/build/store/reducer.cjs.map +2 -2
  227. package/build/store/selectors.cjs +23 -0
  228. package/build/store/selectors.cjs.map +2 -2
  229. package/build/utils/block-bindings.cjs +29 -0
  230. package/build/utils/block-bindings.cjs.map +2 -2
  231. package/build/utils/dom.cjs +14 -0
  232. package/build/utils/dom.cjs.map +2 -2
  233. package/build/{components/rich-text/input-event.cjs → utils/native-undo.cjs} +29 -24
  234. package/build/utils/native-undo.cjs.map +7 -0
  235. package/build-module/components/alignment-control/ui.mjs +2 -4
  236. package/build-module/components/alignment-control/ui.mjs.map +2 -2
  237. package/build-module/components/background-image-control/index.mjs +43 -10
  238. package/build-module/components/background-image-control/index.mjs.map +2 -2
  239. package/build-module/components/block-alignment-control/ui.mjs +5 -3
  240. package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
  241. package/build-module/components/block-canvas/index.mjs +7 -2
  242. package/build-module/components/block-canvas/index.mjs.map +2 -2
  243. package/build-module/components/block-controls/groups.mjs +3 -1
  244. package/build-module/components/block-controls/groups.mjs.map +2 -2
  245. package/build-module/components/block-edit/edit.mjs +11 -18
  246. package/build-module/components/block-edit/edit.mjs.map +2 -2
  247. package/build-module/components/block-inspector/index.mjs +74 -46
  248. package/build-module/components/block-inspector/index.mjs.map +2 -2
  249. package/build-module/components/block-list/block-html.mjs +4 -1
  250. package/build-module/components/block-list/block-html.mjs.map +2 -2
  251. package/build-module/components/block-list/block.mjs +9 -3
  252. package/build-module/components/block-list/block.mjs.map +3 -3
  253. package/build-module/components/block-list/index.mjs +1 -3
  254. package/build-module/components/block-list/index.mjs.map +2 -2
  255. package/build-module/components/block-list/use-block-props/index.mjs +7 -2
  256. package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
  257. package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs +9 -4
  258. package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs.map +2 -2
  259. package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +11 -4
  260. package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
  261. package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
  262. package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
  263. package/build-module/components/block-parent-selector/index.mjs +2 -2
  264. package/build-module/components/block-parent-selector/index.mjs.map +2 -2
  265. package/build-module/components/block-toolbar/index.mjs +43 -24
  266. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  267. package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
  268. package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
  269. package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
  270. package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
  271. package/build-module/components/block-tools/index.mjs +7 -2
  272. package/build-module/components/block-tools/index.mjs.map +2 -2
  273. package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
  274. package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
  275. package/build-module/components/block-visibility/modal.mjs +22 -10
  276. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  277. package/build-module/components/block-visibility/use-block-visibility.mjs +17 -7
  278. package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
  279. package/build-module/components/block-visibility/utils.mjs +18 -3
  280. package/build-module/components/block-visibility/utils.mjs.map +2 -2
  281. package/build-module/components/block-visibility/viewport-menu-item.mjs +7 -1
  282. package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
  283. package/build-module/components/block-visibility/viewport-toolbar.mjs +5 -0
  284. package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
  285. package/build-module/components/block-visibility/viewport-visibility-info.mjs +5 -1
  286. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  287. package/build-module/components/border-radius-control/utils.mjs +11 -53
  288. package/build-module/components/border-radius-control/utils.mjs.map +2 -2
  289. package/build-module/components/child-layout-control/index.mjs +0 -4
  290. package/build-module/components/child-layout-control/index.mjs.map +2 -2
  291. package/build-module/components/colors-gradients/control.mjs +5 -3
  292. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  293. package/build-module/components/dimension-control/index.mjs +30 -20
  294. package/build-module/components/dimension-control/index.mjs.map +2 -2
  295. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
  296. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
  297. package/build-module/components/editor-styles/index.mjs +9 -1
  298. package/build-module/components/editor-styles/index.mjs.map +2 -2
  299. package/build-module/components/global-styles/background-panel.mjs +71 -29
  300. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  301. package/build-module/components/global-styles/border-panel.mjs +157 -56
  302. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  303. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
  304. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
  305. package/build-module/components/global-styles/color-panel.mjs +63 -17
  306. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  307. package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
  308. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  309. package/build-module/components/global-styles/filters-panel.mjs +64 -21
  310. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  311. package/build-module/components/global-styles/hooks.mjs +4 -1
  312. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  313. package/build-module/components/global-styles/inheritance/index.mjs +108 -0
  314. package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
  315. package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
  316. package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
  317. package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
  318. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  319. package/build-module/components/global-styles/state-control-badges.mjs +41 -5
  320. package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
  321. package/build-module/components/global-styles/state-control.mjs +1 -1
  322. package/build-module/components/global-styles/state-control.mjs.map +2 -2
  323. package/build-module/components/global-styles/typography-panel.mjs +276 -80
  324. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  325. package/build-module/components/image-size-control/index.mjs +2 -4
  326. package/build-module/components/image-size-control/index.mjs.map +2 -2
  327. package/build-module/components/inserter/media-tab/hooks.mjs +33 -6
  328. package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
  329. package/build-module/components/inserter/media-tab/media-panel.mjs +86 -18
  330. package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
  331. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
  332. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  333. package/build-module/components/keyboard-shortcuts/index.mjs +19 -11
  334. package/build-module/components/keyboard-shortcuts/index.mjs.map +2 -2
  335. package/build-module/components/line-height-control/index.mjs +1 -2
  336. package/build-module/components/line-height-control/index.mjs.map +2 -2
  337. package/build-module/components/link-control/index.mjs +4 -2
  338. package/build-module/components/link-control/index.mjs.map +2 -2
  339. package/build-module/components/list-view/block.mjs +13 -4
  340. package/build-module/components/list-view/block.mjs.map +2 -2
  341. package/build-module/components/media-placeholder/index.mjs +0 -1
  342. package/build-module/components/media-placeholder/index.mjs.map +2 -2
  343. package/build-module/components/preset-input-control/index.mjs +2 -1
  344. package/build-module/components/preset-input-control/index.mjs.map +2 -2
  345. package/build-module/components/provider/block-refs-provider.mjs +8 -2
  346. package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
  347. package/build-module/components/provider/index.mjs +1 -1
  348. package/build-module/components/provider/index.mjs.map +2 -2
  349. package/build-module/components/provider/use-block-sync.mjs +18 -6
  350. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  351. package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
  352. package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
  353. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +8 -5
  354. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
  355. package/build-module/components/rich-text/event-listeners/delete.mjs +7 -4
  356. package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
  357. package/build-module/components/rich-text/event-listeners/enter.mjs +8 -3
  358. package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
  359. package/build-module/components/rich-text/event-listeners/input-events.mjs +3 -3
  360. package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
  361. package/build-module/components/rich-text/event-listeners/input-rules.mjs +8 -5
  362. package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
  363. package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +3 -3
  364. package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
  365. package/build-module/components/rich-text/event-listeners/paste-handler.mjs +8 -2
  366. package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
  367. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +3 -3
  368. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
  369. package/build-module/components/rich-text/event-listeners/shortcuts.mjs +3 -3
  370. package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
  371. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +3 -3
  372. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
  373. package/build-module/components/rich-text/index.mjs +79 -14
  374. package/build-module/components/rich-text/index.mjs.map +2 -2
  375. package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
  376. package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
  377. package/build-module/components/text-indent-control/index.mjs +8 -2
  378. package/build-module/components/text-indent-control/index.mjs.map +2 -2
  379. package/build-module/components/typewriter/index.mjs +129 -136
  380. package/build-module/components/typewriter/index.mjs.map +2 -2
  381. package/build-module/components/url-input/index.mjs +306 -353
  382. package/build-module/components/url-input/index.mjs.map +2 -2
  383. package/build-module/components/use-block-commands/index.mjs +21 -17
  384. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  385. package/build-module/components/use-on-block-drop/index.mjs +2 -2
  386. package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
  387. package/build-module/components/writing-flow/index.mjs +14 -1
  388. package/build-module/components/writing-flow/index.mjs.map +2 -2
  389. package/build-module/components/writing-flow/use-arrow-nav.mjs +43 -7
  390. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  391. package/build-module/components/writing-flow/use-click-selection.mjs +29 -3
  392. package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
  393. package/build-module/components/writing-flow/use-clipboard-handler.mjs +5 -2
  394. package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
  395. package/build-module/components/writing-flow/use-drag-selection.mjs +1 -6
  396. package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
  397. package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
  398. package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
  399. package/build-module/components/writing-flow/use-editable-root.mjs +54 -0
  400. package/build-module/components/writing-flow/use-editable-root.mjs.map +7 -0
  401. package/build-module/components/writing-flow/use-home-end.mjs +43 -0
  402. package/build-module/components/writing-flow/use-home-end.mjs.map +7 -0
  403. package/build-module/components/writing-flow/use-input.mjs +15 -5
  404. package/build-module/components/writing-flow/use-input.mjs.map +2 -2
  405. package/build-module/components/writing-flow/use-multi-selection.mjs +2 -2
  406. package/build-module/components/writing-flow/use-multi-selection.mjs.map +2 -2
  407. package/build-module/components/writing-flow/use-select-all.mjs +19 -3
  408. package/build-module/components/writing-flow/use-select-all.mjs.map +2 -2
  409. package/build-module/components/writing-flow/use-selection-observer.mjs +134 -21
  410. package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
  411. package/build-module/components/writing-flow/utils.mjs +26 -1
  412. package/build-module/components/writing-flow/utils.mjs.map +2 -2
  413. package/build-module/hooks/background.mjs +14 -10
  414. package/build-module/hooks/background.mjs.map +2 -2
  415. package/build-module/hooks/block-fields/rich-text/index.mjs +2 -6
  416. package/build-module/hooks/block-fields/rich-text/index.mjs.map +2 -2
  417. package/build-module/hooks/block-style-variation.mjs +8 -44
  418. package/build-module/hooks/block-style-variation.mjs.map +2 -2
  419. package/build-module/hooks/border.mjs +19 -4
  420. package/build-module/hooks/border.mjs.map +2 -2
  421. package/build-module/hooks/custom-css.mjs +7 -3
  422. package/build-module/hooks/custom-css.mjs.map +2 -2
  423. package/build-module/hooks/dimensions.mjs +15 -4
  424. package/build-module/hooks/dimensions.mjs.map +2 -2
  425. package/build-module/hooks/duotone.mjs +20 -9
  426. package/build-module/hooks/duotone.mjs.map +2 -2
  427. package/build-module/hooks/elements.mjs +15 -5
  428. package/build-module/hooks/elements.mjs.map +2 -2
  429. package/build-module/hooks/grid-visualizer.mjs +5 -3
  430. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  431. package/build-module/hooks/layout-child.mjs +22 -12
  432. package/build-module/hooks/layout-child.mjs.map +2 -2
  433. package/build-module/hooks/layout.mjs +28 -13
  434. package/build-module/hooks/layout.mjs.map +2 -2
  435. package/build-module/hooks/line-height.mjs +1 -2
  436. package/build-module/hooks/line-height.mjs.map +2 -2
  437. package/build-module/hooks/states.mjs +27 -7
  438. package/build-module/hooks/states.mjs.map +2 -2
  439. package/build-module/hooks/style.mjs +40 -11
  440. package/build-module/hooks/style.mjs.map +2 -2
  441. package/build-module/hooks/text-align.mjs +39 -10
  442. package/build-module/hooks/text-align.mjs.map +2 -2
  443. package/build-module/hooks/typography.mjs +14 -5
  444. package/build-module/hooks/typography.mjs.map +2 -2
  445. package/build-module/layouts/constrained.mjs +14 -6
  446. package/build-module/layouts/constrained.mjs.map +2 -2
  447. package/build-module/layouts/flex.mjs +27 -19
  448. package/build-module/layouts/flex.mjs.map +2 -2
  449. package/build-module/layouts/grid.mjs +0 -2
  450. package/build-module/layouts/grid.mjs.map +2 -2
  451. package/build-module/private-apis.mjs +7 -3
  452. package/build-module/private-apis.mjs.map +2 -2
  453. package/build-module/store/actions.mjs +12 -7
  454. package/build-module/store/actions.mjs.map +2 -2
  455. package/build-module/store/private-selectors.mjs +42 -3
  456. package/build-module/store/private-selectors.mjs.map +2 -2
  457. package/build-module/store/reducer.mjs +6 -6
  458. package/build-module/store/reducer.mjs.map +2 -2
  459. package/build-module/store/selectors.mjs +23 -0
  460. package/build-module/store/selectors.mjs.map +2 -2
  461. package/build-module/utils/block-bindings.mjs +28 -0
  462. package/build-module/utils/block-bindings.mjs.map +2 -2
  463. package/build-module/utils/dom.mjs +13 -0
  464. package/build-module/utils/dom.mjs.map +2 -2
  465. package/build-module/utils/native-undo.mjs +29 -0
  466. package/build-module/utils/native-undo.mjs.map +7 -0
  467. package/build-style/content-rtl.css +14 -27
  468. package/build-style/content.css +14 -27
  469. package/build-style/default-editor-styles-rtl.css +1 -1
  470. package/build-style/default-editor-styles.css +1 -1
  471. package/build-style/style-rtl.css +191 -61
  472. package/build-style/style.css +191 -61
  473. package/build-types/components/block-context/index.d.ts +7 -0
  474. package/build-types/components/block-context/index.d.ts.map +1 -1
  475. package/build-types/utils/block-bindings.d.ts +19 -0
  476. package/build-types/utils/block-bindings.d.ts.map +1 -1
  477. package/build-types/utils/dom.d.ts +11 -0
  478. package/build-types/utils/dom.d.ts.map +1 -1
  479. package/build-types/utils/get-px-from-css-unit.d.ts +2 -2
  480. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -1
  481. package/build-types/utils/pasting.d.ts +1 -1
  482. package/build-types/utils/pasting.d.ts.map +1 -1
  483. package/package.json +43 -44
  484. package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
  485. package/src/components/alignment-control/ui.js +2 -4
  486. package/src/components/background-image-control/index.js +74 -37
  487. package/src/components/background-image-control/style.scss +13 -4
  488. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
  489. package/src/components/block-alignment-control/test/index.js +1 -1
  490. package/src/components/block-alignment-control/ui.js +4 -2
  491. package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
  492. package/src/components/block-canvas/index.js +9 -2
  493. package/src/components/block-card/style.scss +1 -1
  494. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
  495. package/src/components/block-controls/groups.js +2 -0
  496. package/src/components/block-edit/edit.js +13 -31
  497. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
  498. package/src/components/block-inspector/index.js +60 -31
  499. package/src/components/block-list/block-html.js +5 -0
  500. package/src/components/block-list/block.js +6 -0
  501. package/src/components/block-list/content.scss +1 -11
  502. package/src/components/block-list/index.js +0 -2
  503. package/src/components/block-list/use-block-props/index.js +7 -1
  504. package/src/components/block-list/use-block-props/use-focus-first-element.js +23 -4
  505. package/src/components/block-list/use-block-props/use-focus-handler.js +35 -9
  506. package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
  507. package/src/components/block-lock/style.scss +1 -1
  508. package/src/components/block-manager/style.scss +1 -1
  509. package/src/components/block-navigation/style.scss +1 -1
  510. package/src/components/block-parent-selector/index.js +5 -2
  511. package/src/components/block-quick-navigation/style.scss +1 -3
  512. package/src/components/block-styles/style.scss +2 -2
  513. package/src/components/block-toolbar/index.js +41 -18
  514. package/src/components/block-toolbar/switch-section-style.js +5 -2
  515. package/src/components/block-tools/empty-block-inserter.js +3 -7
  516. package/src/components/block-tools/index.js +7 -0
  517. package/src/components/block-types-list/style.scss +0 -1
  518. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
  519. package/src/components/block-vertical-alignment-control/test/index.js +18 -2
  520. package/src/components/block-vertical-alignment-control/ui.js +3 -5
  521. package/src/components/block-visibility/modal.js +24 -10
  522. package/src/components/block-visibility/style.scss +1 -1
  523. package/src/components/block-visibility/test/use-block-visibility.js +128 -35
  524. package/src/components/block-visibility/test/utils.js +11 -0
  525. package/src/components/block-visibility/use-block-visibility.js +33 -11
  526. package/src/components/block-visibility/utils.js +31 -6
  527. package/src/components/block-visibility/viewport-menu-item.js +10 -1
  528. package/src/components/block-visibility/viewport-toolbar.js +6 -0
  529. package/src/components/block-visibility/viewport-visibility-info.js +5 -1
  530. package/src/components/border-radius-control/test/utils.js +0 -41
  531. package/src/components/border-radius-control/utils.js +16 -107
  532. package/src/components/button-block-appender/content.scss +7 -9
  533. package/src/components/child-layout-control/index.js +0 -4
  534. package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -3
  535. package/src/components/colors-gradients/control.js +6 -3
  536. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
  537. package/src/components/dimension-control/index.js +13 -1
  538. package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
  539. package/src/components/editor-styles/index.js +16 -1
  540. package/src/components/font-family/stories/index.story.jsx +1 -1
  541. package/src/components/global-styles/background-panel.js +107 -34
  542. package/src/components/global-styles/border-panel.js +219 -48
  543. package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
  544. package/src/components/global-styles/color-panel.js +92 -11
  545. package/src/components/global-styles/dimensions-panel.js +422 -71
  546. package/src/components/global-styles/filters-panel.js +88 -28
  547. package/src/components/global-styles/hooks.js +8 -1
  548. package/src/components/global-styles/inheritance/index.js +204 -0
  549. package/src/components/global-styles/inheritance/style.scss +184 -0
  550. package/src/components/global-styles/inheritance/test/index.js +281 -0
  551. package/src/components/global-styles/inherited-value-context.js +271 -0
  552. package/src/components/global-styles/shadow-panel-components.js +48 -26
  553. package/src/components/global-styles/state-control-badges.js +45 -6
  554. package/src/components/global-styles/state-control.js +2 -2
  555. package/src/components/global-styles/style.scss +5 -0
  556. package/src/components/global-styles/test/background-panel.js +338 -1
  557. package/src/components/global-styles/test/border-panel.js +441 -0
  558. package/src/components/global-styles/test/color-panel.js +182 -2
  559. package/src/components/global-styles/test/dimensions-panel.js +753 -0
  560. package/src/components/global-styles/test/filters-panel.js +194 -0
  561. package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
  562. package/src/components/global-styles/test/inherited-value-context.js +454 -0
  563. package/src/components/global-styles/test/state-control-badges.js +65 -0
  564. package/src/components/global-styles/test/typography-panel-core.js +185 -0
  565. package/src/components/global-styles/test/typography-panel.js +849 -12
  566. package/src/components/global-styles/typography-panel.js +449 -101
  567. package/src/components/image-editor/style.scss +33 -0
  568. package/src/components/image-size-control/index.js +0 -2
  569. package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
  570. package/src/components/inserter/media-tab/hooks.js +55 -7
  571. package/src/components/inserter/media-tab/media-panel.js +117 -21
  572. package/src/components/inserter/media-tab/test/hooks.js +63 -0
  573. package/src/components/inserter/media-tab/test/media-panel.js +127 -0
  574. package/src/components/inserter/style.scss +19 -16
  575. package/src/components/inserter-list-item/style.scss +0 -15
  576. package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
  577. package/src/components/keyboard-shortcuts/index.js +28 -11
  578. package/src/components/line-height-control/index.js +1 -2
  579. package/src/components/link-control/index.js +7 -2
  580. package/src/components/link-control/style.scss +2 -2
  581. package/src/components/link-control/test/index.js +6 -6
  582. package/src/components/link-picker/style.scss +1 -2
  583. package/src/components/list-view/block.js +13 -4
  584. package/src/components/list-view/style.scss +4 -5
  585. package/src/components/media-placeholder/index.js +0 -1
  586. package/src/components/multi-selection-inspector/style.scss +1 -1
  587. package/src/components/preset-input-control/index.js +4 -1
  588. package/src/components/provider/block-refs-provider.js +12 -2
  589. package/src/components/provider/index.js +2 -2
  590. package/src/components/provider/use-block-sync.js +18 -6
  591. package/src/components/provider/use-media-upload-settings.js +2 -0
  592. package/src/components/responsive-block-control/style.scss +1 -1
  593. package/src/components/rich-text/event-listeners/before-input-rules.js +8 -5
  594. package/src/components/rich-text/event-listeners/delete.js +7 -4
  595. package/src/components/rich-text/event-listeners/enter.js +10 -4
  596. package/src/components/rich-text/event-listeners/input-events.js +4 -3
  597. package/src/components/rich-text/event-listeners/input-rules.js +8 -5
  598. package/src/components/rich-text/event-listeners/insert-replacement-text.js +4 -3
  599. package/src/components/rich-text/event-listeners/paste-handler.js +15 -3
  600. package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +4 -3
  601. package/src/components/rich-text/event-listeners/shortcuts.js +4 -3
  602. package/src/components/rich-text/event-listeners/undo-automatic-change.js +4 -3
  603. package/src/components/rich-text/index.js +116 -26
  604. package/src/components/skip-to-selected-block/style.scss +1 -1
  605. package/src/components/spacing-sizes-control/test/utils.js +16 -5
  606. package/src/components/spacing-sizes-control/utils.js +11 -28
  607. package/src/components/text-indent-control/index.js +8 -0
  608. package/src/components/typewriter/index.js +228 -224
  609. package/src/components/url-input/index.js +363 -431
  610. package/src/components/url-input/test/index.js +592 -0
  611. package/src/components/use-block-commands/index.js +27 -17
  612. package/src/components/use-on-block-drop/index.js +2 -2
  613. package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
  614. package/src/components/writing-flow/index.js +17 -1
  615. package/src/components/writing-flow/use-arrow-nav.js +90 -13
  616. package/src/components/writing-flow/use-click-selection.js +55 -5
  617. package/src/components/writing-flow/use-clipboard-handler.js +5 -2
  618. package/src/components/writing-flow/use-drag-selection.js +1 -14
  619. package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
  620. package/src/components/writing-flow/use-editable-root.js +112 -0
  621. package/src/components/writing-flow/use-home-end.js +71 -0
  622. package/src/components/writing-flow/use-input.js +25 -8
  623. package/src/components/writing-flow/use-multi-selection.js +2 -3
  624. package/src/components/writing-flow/use-select-all.js +33 -3
  625. package/src/components/writing-flow/use-selection-observer.js +218 -42
  626. package/src/components/writing-flow/utils.js +62 -0
  627. package/src/hooks/background.js +27 -24
  628. package/src/hooks/block-fields/link/styles.scss +1 -6
  629. package/src/hooks/block-fields/media/styles.scss +1 -6
  630. package/src/hooks/block-fields/rich-text/index.js +6 -9
  631. package/src/hooks/block-fields/rich-text/styles.scss +1 -1
  632. package/src/hooks/block-style-variation.js +8 -74
  633. package/src/hooks/border.js +19 -4
  634. package/src/hooks/custom-css.js +15 -6
  635. package/src/hooks/dimensions.js +17 -4
  636. package/src/hooks/duotone.js +26 -8
  637. package/src/hooks/elements.js +14 -4
  638. package/src/hooks/grid-visualizer.js +40 -36
  639. package/src/hooks/layout-child.js +19 -9
  640. package/src/hooks/layout.js +48 -31
  641. package/src/hooks/line-height.js +0 -1
  642. package/src/hooks/states.js +38 -9
  643. package/src/hooks/style.js +67 -17
  644. package/src/hooks/test/inherited-value-wiring.js +411 -0
  645. package/src/hooks/test/preset-round-trip.js +456 -0
  646. package/src/hooks/test/style.js +29 -0
  647. package/src/hooks/test/text-align.js +34 -1
  648. package/src/hooks/text-align.js +41 -10
  649. package/src/hooks/typography.js +35 -24
  650. package/src/layouts/constrained.js +5 -1
  651. package/src/layouts/flex.js +5 -1
  652. package/src/layouts/grid.js +0 -2
  653. package/src/private-apis.js +11 -2
  654. package/src/store/actions.js +53 -19
  655. package/src/store/private-selectors.js +82 -6
  656. package/src/store/reducer.js +9 -9
  657. package/src/store/selectors.js +56 -8
  658. package/src/store/test/actions.js +1 -1
  659. package/src/store/test/private-selectors.js +271 -1
  660. package/src/style.scss +2 -0
  661. package/src/utils/block-bindings.ts +50 -0
  662. package/src/utils/dom.ts +33 -0
  663. package/src/utils/native-undo.js +56 -0
  664. package/src/utils/test/block-bindings.js +181 -0
  665. package/build/components/duotone/utils.cjs +0 -87
  666. package/build/components/duotone/utils.cjs.map +0 -7
  667. package/build/components/rich-text/input-event.cjs.map +0 -7
  668. package/build/components/rich-text/shortcut.cjs +0 -51
  669. package/build/components/rich-text/shortcut.cjs.map +0 -7
  670. package/build-module/components/duotone/utils.mjs +0 -59
  671. package/build-module/components/duotone/utils.mjs.map +0 -7
  672. package/build-module/components/rich-text/input-event.mjs +0 -25
  673. package/build-module/components/rich-text/input-event.mjs.map +0 -7
  674. package/build-module/components/rich-text/shortcut.mjs +0 -26
  675. package/build-module/components/rich-text/shortcut.mjs.map +0 -7
  676. package/src/components/duotone/utils.js +0 -90
  677. package/src/components/rich-text/input-event.js +0 -31
  678. package/src/components/rich-text/shortcut.js +0 -32
  679. package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
@@ -20,12 +20,40 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/block-editor/src/utils/block-bindings.ts
21
21
  var block_bindings_exports = {};
22
22
  __export(block_bindings_exports, {
23
+ getBlockBindingsContext: () => getBlockBindingsContext,
23
24
  hasPatternOverridesDefaultBinding: () => hasPatternOverridesDefaultBinding,
24
25
  replacePatternOverridesDefaultBinding: () => replacePatternOverridesDefaultBinding
25
26
  });
26
27
  module.exports = __toCommonJS(block_bindings_exports);
27
28
  var DEFAULT_ATTRIBUTE = "__default";
28
29
  var PATTERN_OVERRIDES_SOURCE = "core/pattern-overrides";
30
+ var EMPTY_CONTEXT = {};
31
+ function getBlockBindingsContext(blockContext, blockTypeUsesContext, sources) {
32
+ let context;
33
+ if (blockTypeUsesContext) {
34
+ for (const [key, value] of Object.entries(blockContext)) {
35
+ if (blockTypeUsesContext.includes(key)) {
36
+ if (context === void 0) {
37
+ context = {};
38
+ }
39
+ context[key] = value;
40
+ }
41
+ }
42
+ }
43
+ if (sources) {
44
+ for (const source of sources) {
45
+ source?.usesContext?.forEach((key) => {
46
+ if (key in blockContext) {
47
+ if (context === void 0) {
48
+ context = {};
49
+ }
50
+ context[key] = blockContext[key];
51
+ }
52
+ });
53
+ }
54
+ }
55
+ return context ?? EMPTY_CONTEXT;
56
+ }
29
57
  function hasPatternOverridesDefaultBinding(bindings) {
30
58
  return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE;
31
59
  }
@@ -42,6 +70,7 @@ function replacePatternOverridesDefaultBinding(bindings, supportedAttributes) {
42
70
  }
43
71
  // Annotate the CommonJS export names for ESM import in node:
44
72
  0 && (module.exports = {
73
+ getBlockBindingsContext,
45
74
  hasPatternOverridesDefaultBinding,
46
75
  replacePatternOverridesDefaultBinding
47
76
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/block-bindings.ts"],
4
- "sourcesContent": ["type Binding = { source?: string };\ntype Bindings = Record< string, Binding >;\n\nconst DEFAULT_ATTRIBUTE = '__default';\nconst PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';\n\n/**\n * Checks if the block has the `__default` binding for pattern overrides.\n *\n * @param bindings A block's bindings from the metadata attribute.\n *\n * @return Whether the block has the `__default` binding for pattern overrides.\n */\nexport function hasPatternOverridesDefaultBinding(\n\tbindings: Bindings | undefined | null\n): bindings is Bindings {\n\treturn bindings?.[ DEFAULT_ATTRIBUTE ]?.source === PATTERN_OVERRIDES_SOURCE;\n}\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param bindings A block's bindings from the metadata attribute.\n * @param supportedAttributes The block's attributes which are supported by block bindings.\n *\n * @return The bindings with default replaced for pattern overrides.\n */\nexport function replacePatternOverridesDefaultBinding(\n\tbindings: Bindings | undefined | null,\n\tsupportedAttributes: string[]\n) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif ( ! hasPatternOverridesDefaultBinding( bindings ) ) {\n\t\treturn bindings;\n\t}\n\n\tconst bindingsWithDefaults: Bindings = {};\n\tfor ( const attributeName of supportedAttributes ) {\n\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t? bindings[ attributeName ]\n\t\t\t: { source: PATTERN_OVERRIDES_SOURCE };\n\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t}\n\n\treturn bindingsWithDefaults;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAM,oBAAoB;AAC1B,IAAM,2BAA2B;AAS1B,SAAS,kCACf,UACuB;AACvB,SAAO,WAAY,iBAAkB,GAAG,WAAW;AACpD;AAcO,SAAS,sCACf,UACA,qBACC;AAED,MAAK,CAAE,kCAAmC,QAAS,GAAI;AACtD,WAAO;AAAA,EACR;AAEA,QAAM,uBAAiC,CAAC;AACxC,aAAY,iBAAiB,qBAAsB;AAElD,UAAM,gBAAgB,SAAU,aAAc,IAC3C,SAAU,aAAc,IACxB,EAAE,QAAQ,yBAAyB;AACtC,yBAAsB,aAAc,IAAI;AAAA,EACzC;AAEA,SAAO;AACR;",
4
+ "sourcesContent": ["type Binding = { source?: string };\ntype Bindings = Record< string, Binding >;\ntype BlockBindingsSource = { usesContext?: readonly string[] };\n\nconst DEFAULT_ATTRIBUTE = '__default';\nconst PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';\nconst EMPTY_CONTEXT: Record< string, unknown > = {};\n\n/**\n * Assembles the context made available to a block's bindings sources: the\n * entries of the surrounding block context declared by the block type's\n * `usesContext`, plus the entries declared by the given sources' `usesContext`.\n *\n * Only entries present in the surrounding block context are copied — a\n * declared key with no provider never becomes an own (undefined-valued) key\n * of the result, so `key in context` checks stay meaningful.\n *\n * @param blockContext The surrounding block context.\n * @param blockTypeUsesContext The block type's declared context needs.\n * @param sources Block-bindings sources whose declared context to add.\n *\n * @return The context for resolving the block's bindings.\n */\nexport function getBlockBindingsContext(\n\tblockContext: Record< string, unknown >,\n\tblockTypeUsesContext: readonly string[] | undefined,\n\tsources: readonly ( BlockBindingsSource | undefined )[] | undefined\n): Record< string, unknown > {\n\tlet context: Record< string, unknown > | undefined;\n\tif ( blockTypeUsesContext ) {\n\t\tfor ( const [ key, value ] of Object.entries( blockContext ) ) {\n\t\t\tif ( blockTypeUsesContext.includes( key ) ) {\n\t\t\t\tif ( context === undefined ) {\n\t\t\t\t\tcontext = {};\n\t\t\t\t}\n\t\t\t\tcontext[ key ] = value;\n\t\t\t}\n\t\t}\n\t}\n\tif ( sources ) {\n\t\tfor ( const source of sources ) {\n\t\t\tsource?.usesContext?.forEach( ( key ) => {\n\t\t\t\tif ( key in blockContext ) {\n\t\t\t\t\tif ( context === undefined ) {\n\t\t\t\t\t\tcontext = {};\n\t\t\t\t\t}\n\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\t// A stable empty object avoids re-renders for consumers that compare the\n\t// context by reference.\n\treturn context ?? EMPTY_CONTEXT;\n}\n\n/**\n * Checks if the block has the `__default` binding for pattern overrides.\n *\n * @param bindings A block's bindings from the metadata attribute.\n *\n * @return Whether the block has the `__default` binding for pattern overrides.\n */\nexport function hasPatternOverridesDefaultBinding(\n\tbindings: Bindings | undefined | null\n): bindings is Bindings {\n\treturn bindings?.[ DEFAULT_ATTRIBUTE ]?.source === PATTERN_OVERRIDES_SOURCE;\n}\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param bindings A block's bindings from the metadata attribute.\n * @param supportedAttributes The block's attributes which are supported by block bindings.\n *\n * @return The bindings with default replaced for pattern overrides.\n */\nexport function replacePatternOverridesDefaultBinding(\n\tbindings: Bindings | undefined | null,\n\tsupportedAttributes: string[]\n) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif ( ! hasPatternOverridesDefaultBinding( bindings ) ) {\n\t\treturn bindings;\n\t}\n\n\tconst bindingsWithDefaults: Bindings = {};\n\tfor ( const attributeName of supportedAttributes ) {\n\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t? bindings[ attributeName ]\n\t\t\t: { source: PATTERN_OVERRIDES_SOURCE };\n\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t}\n\n\treturn bindingsWithDefaults;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAM,oBAAoB;AAC1B,IAAM,2BAA2B;AACjC,IAAM,gBAA2C,CAAC;AAiB3C,SAAS,wBACf,cACA,sBACA,SAC4B;AAC5B,MAAI;AACJ,MAAK,sBAAuB;AAC3B,eAAY,CAAE,KAAK,KAAM,KAAK,OAAO,QAAS,YAAa,GAAI;AAC9D,UAAK,qBAAqB,SAAU,GAAI,GAAI;AAC3C,YAAK,YAAY,QAAY;AAC5B,oBAAU,CAAC;AAAA,QACZ;AACA,gBAAS,GAAI,IAAI;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AACA,MAAK,SAAU;AACd,eAAY,UAAU,SAAU;AAC/B,cAAQ,aAAa,QAAS,CAAE,QAAS;AACxC,YAAK,OAAO,cAAe;AAC1B,cAAK,YAAY,QAAY;AAC5B,sBAAU,CAAC;AAAA,UACZ;AACA,kBAAS,GAAI,IAAI,aAAc,GAAI;AAAA,QACpC;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAGA,SAAO,WAAW;AACnB;AASO,SAAS,kCACf,UACuB;AACvB,SAAO,WAAY,iBAAkB,GAAG,WAAW;AACpD;AAcO,SAAS,sCACf,UACA,qBACC;AAED,MAAK,CAAE,kCAAmC,QAAS,GAAI;AACtD,WAAO;AAAA,EACR;AAEA,QAAM,uBAAiC,CAAC;AACxC,aAAY,iBAAiB,qBAAsB;AAElD,UAAM,gBAAgB,SAAU,aAAc,IAC3C,SAAU,aAAc,IACxB,EAAE,QAAQ,yBAAyB;AACtC,yBAAsB,aAAc,IAAI;AAAA,EACzC;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -23,6 +23,7 @@ __export(dom_exports, {
23
23
  WITH_OVERFLOW_ELEMENT_BLOCKS: () => WITH_OVERFLOW_ELEMENT_BLOCKS,
24
24
  getBlockClientId: () => getBlockClientId,
25
25
  getElementBounds: () => getElementBounds,
26
+ getSelectionEditableElement: () => getSelectionEditableElement,
26
27
  isElementVisible: () => isElementVisible,
27
28
  isInSameBlock: () => isInSameBlock,
28
29
  isInsideRootBlock: () => isInsideRootBlock,
@@ -41,6 +42,18 @@ function isInsideRootBlock(blockElement, element) {
41
42
  );
42
43
  return parentBlock === blockElement;
43
44
  }
45
+ function getSelectionEditableElement(selection, root) {
46
+ const { anchorNode, focusNode } = selection;
47
+ if (!anchorNode || !focusNode) {
48
+ return;
49
+ }
50
+ const element = anchorNode.nodeType === anchorNode.ELEMENT_NODE ? anchorNode : anchorNode.parentElement;
51
+ const editable = element?.closest('[contenteditable="true"]');
52
+ if (!editable || editable === root || !editable.contains(focusNode)) {
53
+ return;
54
+ }
55
+ return editable;
56
+ }
44
57
  function getBlockClientId(node) {
45
58
  while (node && node.nodeType !== node.ELEMENT_NODE) {
46
59
  node = node.parentNode;
@@ -129,6 +142,7 @@ function getElementBounds(element) {
129
142
  WITH_OVERFLOW_ELEMENT_BLOCKS,
130
143
  getBlockClientId,
131
144
  getElementBounds,
145
+ getSelectionEditableElement,
132
146
  isElementVisible,
133
147
  isInSameBlock,
134
148
  isInsideRootBlock,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/dom.ts"],
4
- "sourcesContent": ["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param a First element.\n * @param b Second element.\n *\n * @return Whether elements are in the same block.\n */\nexport function isInSameBlock( a: Element, b: Element ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param blockElement Block container element.\n * @param element Element.\n *\n * @return Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement: Element, element: Element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param node DOM node.\n *\n * @return Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node: Node | null ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = node as Element;\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param rect1 First rectangle.\n * @param rect2 Second rectangle.\n * @return Union of the two rectangles.\n */\nexport function rectUnion( rect1: DOMRect, rect2: DOMRect ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param element Element.\n * @return Whether the element is visible.\n */\nexport function isElementVisible( element: Element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> components.\n\tif ( element.hasAttribute( 'data-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param element Element.\n * @return True if the element is scrollable.\n */\nfunction isScrollable( element: Element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\nexport const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];\n/**\n * Returns the bounding rectangle of an element, with special handling for blocks\n * that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).\n *\n * For blocks like Navigation that can have overflowing elements (e.g. submenus),\n * this function calculates the combined bounds of both the parent and its visible\n * children. The returned rect may extend beyond the viewport.\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param element Element.\n * @return Bounding client rect of the element and its visible children.\n */\nexport function getElementBounds( element: Element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst dataType = element.getAttribute( 'data-type' );\n\n\t/*\n\t * For blocks with overflowing elements (like Navigation), include the bounds\n\t * of visible children that extend beyond the parent container.\n\t */\n\tif ( dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes( dataType ) ) {\n\t\tconst stack = [ element ];\n\t\tlet currentElement;\n\n\t\twhile ( ( currentElement = stack.pop() ) ) {\n\t\t\t// Children won’t affect bounds unless the element is not scrollable.\n\t\t\tif ( ! isScrollable( currentElement ) ) {\n\t\t\t\tfor ( const child of currentElement.children ) {\n\t\t\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\t\t\tconst childBounds = child.getBoundingClientRect();\n\t\t\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\t\t\tstack.push( child );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AA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AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AAEA,SAAO;AACR;",
4
+ "sourcesContent": ["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param a First element.\n * @param b Second element.\n *\n * @return Whether elements are in the same block.\n */\nexport function isInSameBlock( a: Element, b: Element ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param blockElement Block container element.\n * @param element Element.\n *\n * @return Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement: Element, element: Element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Returns the editable element containing the selection, if the selection is\n * fully contained within one. The root element (an editable wrapper) does not\n * count as a containing editable element.\n *\n * @param selection The selection.\n * @param root The editable wrapper element.\n *\n * @return The editable element containing the selection.\n */\nexport function getSelectionEditableElement(\n\tselection: Selection,\n\troot: Element\n) {\n\tconst { anchorNode, focusNode } = selection;\n\n\tif ( ! anchorNode || ! focusNode ) {\n\t\treturn;\n\t}\n\n\tconst element =\n\t\tanchorNode.nodeType === anchorNode.ELEMENT_NODE\n\t\t\t? ( anchorNode as Element )\n\t\t\t: anchorNode.parentElement;\n\tconst editable = element?.closest( '[contenteditable=\"true\"]' );\n\n\tif ( ! editable || editable === root || ! editable.contains( focusNode ) ) {\n\t\treturn;\n\t}\n\n\treturn editable;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param node DOM node.\n *\n * @return Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node: Node | null ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = node as Element;\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param rect1 First rectangle.\n * @param rect2 Second rectangle.\n * @return Union of the two rectangles.\n */\nexport function rectUnion( rect1: DOMRect, rect2: DOMRect ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param element Element.\n * @return Whether the element is visible.\n */\nexport function isElementVisible( element: Element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> components.\n\tif ( element.hasAttribute( 'data-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param element Element.\n * @return True if the element is scrollable.\n */\nfunction isScrollable( element: Element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\nexport const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];\n/**\n * Returns the bounding rectangle of an element, with special handling for blocks\n * that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).\n *\n * For blocks like Navigation that can have overflowing elements (e.g. submenus),\n * this function calculates the combined bounds of both the parent and its visible\n * children. The returned rect may extend beyond the viewport.\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param element Element.\n * @return Bounding client rect of the element and its visible children.\n */\nexport function getElementBounds( element: Element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst dataType = element.getAttribute( 'data-type' );\n\n\t/*\n\t * For blocks with overflowing elements (like Navigation), include the bounds\n\t * of visible children that extend beyond the parent container.\n\t */\n\tif ( dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes( dataType ) ) {\n\t\tconst stack = [ element ];\n\t\tlet currentElement;\n\n\t\twhile ( ( currentElement = stack.pop() ) ) {\n\t\t\t// Children won’t affect bounds unless the element is not scrollable.\n\t\t\tif ( ! isScrollable( currentElement ) ) {\n\t\t\t\tfor ( const child of currentElement.children ) {\n\t\t\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\t\t\tconst childBounds = child.getBoundingClientRect();\n\t\t\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\t\t\tstack.push( child );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAC1B,IAAM,uBAAuB;AAUtB,SAAS,cAAe,GAAY,GAAa;AACvD,SAAO,EAAE,QAAS,cAAe,MAAM,EAAE,QAAS,cAAe;AAClE;AAYO,SAAS,kBAAmB,cAAuB,SAAmB;AAC5E,QAAM,cAAc,QAAQ;AAAA,IAC3B,CAAE,gBAAgB,mBAAmB,oBAAqB,EAAE,KAAM,GAAI;AAAA,EACvE;AACA,SAAO,gBAAgB;AACxB;AAYO,SAAS,4BACf,WACA,MACC;AACD,QAAM,EAAE,YAAY,UAAU,IAAI;AAElC,MAAK,CAAE,cAAc,CAAE,WAAY;AAClC;AAAA,EACD;AAEA,QAAM,UACL,WAAW,aAAa,WAAW,eAC9B,aACF,WAAW;AACf,QAAM,WAAW,SAAS,QAAS,0BAA2B;AAE9D,MAAK,CAAE,YAAY,aAAa,QAAQ,CAAE,SAAS,SAAU,SAAU,GAAI;AAC1E;AAAA,EACD;AAEA,SAAO;AACR;AAUO,SAAS,iBAAkB,MAAoB;AACrD,SAAQ,QAAQ,KAAK,aAAa,KAAK,cAAe;AACrD,WAAO,KAAK;AAAA,EACb;AAEA,MAAK,CAAE,MAAO;AACb;AAAA,EACD;AAEA,QAAM,cAAc;AACpB,QAAM,YAAY,YAAY,QAAS,cAAe;AAEtD,MAAK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AK,CAAE,UAAW;AACjB,WAAO,IAAI,OAAO,gBAAgB;AAAA,EACnC;AAEA,MAAI,SAAS,QAAQ,sBAAsB;AAC3C,QAAM,WAAW,QAAQ,aAAc,WAAY;AAMnD,MAAK,YAAY,6BAA6B,SAAU,QAAS,GAAI;AACpE,UAAM,QAAQ,CAAE,OAAQ;AACxB,QAAI;AAEJ,WAAU,iBAAiB,MAAM,IAAI,GAAM;AAE1C,UAAK,CAAE,aAAc,cAAe,GAAI;AACvC,mBAAY,SAAS,eAAe,UAAW;AAC9C,cAAK,iBAAkB,KAAM,GAAI;AAChC,kBAAM,cAAc,MAAM,sBAAsB;AAChD,qBAAS,UAAW,QAAQ,WAAY;AACxC,kBAAM,KAAM,KAAM;AAAA,UACnB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAUA,QAAM,OAAO,KAAK,IAAK,OAAO,MAAM,CAAE;AACtC,QAAM,QAAQ,KAAK,IAAK,OAAO,OAAO,SAAS,UAAW;AAC1D,WAAS,IAAI,OAAO;AAAA,IACnB;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -17,34 +17,39 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/block-editor/src/components/rich-text/input-event.js
21
- var input_event_exports = {};
22
- __export(input_event_exports, {
23
- RichTextInputEvent: () => RichTextInputEvent
20
+ // packages/block-editor/src/utils/native-undo.js
21
+ var native_undo_exports = {};
22
+ __export(native_undo_exports, {
23
+ useNativeUndo: () => useNativeUndo,
24
+ usesNativeUndo: () => usesNativeUndo
24
25
  });
25
- module.exports = __toCommonJS(input_event_exports);
26
- var import_element = require("@wordpress/element");
27
- var import__ = require("./index.cjs");
28
- function RichTextInputEvent({ inputType, onInput }) {
29
- const callbacks = (0, import_element.useContext)(import__.inputEventContext);
30
- const onInputRef = (0, import_element.useRef)();
31
- onInputRef.current = onInput;
32
- (0, import_element.useEffect)(() => {
33
- function callback(event) {
34
- if (event.inputType === inputType) {
35
- onInputRef.current();
36
- event.preventDefault();
37
- }
38
- }
39
- callbacks.current.add(callback);
26
+ module.exports = __toCommonJS(native_undo_exports);
27
+ var import_compose = require("@wordpress/compose");
28
+ var nativeUndoNodes = /* @__PURE__ */ new WeakSet();
29
+ function useNativeUndo() {
30
+ return (0, import_compose.useRefEffect)((node) => {
31
+ nativeUndoNodes.add(node);
40
32
  return () => {
41
- callbacks.current.delete(callback);
33
+ nativeUndoNodes.delete(node);
42
34
  };
43
- }, [inputType]);
44
- return null;
35
+ }, []);
36
+ }
37
+ function usesNativeUndo(event) {
38
+ let { target } = event;
39
+ if (target?.nodeName === "IFRAME") {
40
+ target = target.contentDocument?.activeElement;
41
+ }
42
+ while (target) {
43
+ if (nativeUndoNodes.has(target)) {
44
+ return true;
45
+ }
46
+ target = target.parentElement;
47
+ }
48
+ return false;
45
49
  }
46
50
  // Annotate the CommonJS export names for ESM import in node:
47
51
  0 && (module.exports = {
48
- RichTextInputEvent
52
+ useNativeUndo,
53
+ usesNativeUndo
49
54
  });
50
- //# sourceMappingURL=input-event.cjs.map
55
+ //# sourceMappingURL=native-undo.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/native-undo.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Elements whose content the browser's own undo acts on (a dialog input, an\n * HTML editing field, a search field), registered through `useNativeUndo`.\n * The editor history must not act on events originating within them.\n */\nconst nativeUndoNodes = new WeakSet();\n\n/**\n * Returns a ref that marks an element (and its descendants) as relying on\n * the browser's own undo, so the editor history leaves the undo and redo\n * shortcuts alone within it.\n *\n * @return {Function} Ref callback.\n */\nexport function useNativeUndo() {\n\treturn useRefEffect( ( node ) => {\n\t\tnativeUndoNodes.add( node );\n\t\treturn () => {\n\t\t\tnativeUndoNodes.delete( node );\n\t\t};\n\t}, [] );\n}\n\n/**\n * Returns true when the event originates from an element registered through\n * `useNativeUndo`.\n *\n * Events coming from the editor canvas are re-dispatched on the iframe\n * element, so the real target is resolved through the frame's focused\n * element.\n *\n * @param {KeyboardEvent} event Keyboard event.\n *\n * @return {boolean} Whether the element relies on the browser's own undo.\n */\nexport function usesNativeUndo( event ) {\n\tlet { target } = event;\n\n\tif ( target?.nodeName === 'IFRAME' ) {\n\t\ttarget = target.contentDocument?.activeElement;\n\t}\n\n\twhile ( target ) {\n\t\tif ( nativeUndoNodes.has( target ) ) {\n\t\t\treturn true;\n\t\t}\n\t\ttarget = target.parentElement;\n\t}\n\n\treturn false;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA6B;AAO7B,IAAM,kBAAkB,oBAAI,QAAQ;AAS7B,SAAS,gBAAgB;AAC/B,aAAO,6BAAc,CAAE,SAAU;AAChC,oBAAgB,IAAK,IAAK;AAC1B,WAAO,MAAM;AACZ,sBAAgB,OAAQ,IAAK;AAAA,IAC9B;AAAA,EACD,GAAG,CAAC,CAAE;AACP;AAcO,SAAS,eAAgB,OAAQ;AACvC,MAAI,EAAE,OAAO,IAAI;AAEjB,MAAK,QAAQ,aAAa,UAAW;AACpC,aAAS,OAAO,iBAAiB;AAAA,EAClC;AAEA,SAAQ,QAAS;AAChB,QAAK,gBAAgB,IAAK,MAAO,GAAI;AACpC,aAAO;AAAA,IACR;AACA,aAAS,OAAO;AAAA,EACjB;AAEA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -28,7 +28,7 @@ function AlignmentUI({
28
28
  onChange,
29
29
  alignmentControls = DEFAULT_ALIGNMENT_CONTROLS,
30
30
  label = __("Align text"),
31
- description = __("Change text alignment"),
31
+ description,
32
32
  isCollapsed = true,
33
33
  isToolbar
34
34
  }) {
@@ -46,9 +46,7 @@ function AlignmentUI({
46
46
  }
47
47
  const UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;
48
48
  const extraProps = isToolbar ? { isCollapsed } : {
49
- toggleProps: {
50
- description
51
- },
49
+ toggleProps: description ? { description } : {},
52
50
  popoverProps: POPOVER_PROPS
53
51
  };
54
52
  return /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/alignment-control/ui.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { ToolbarDropdownMenu, ToolbarGroup } from '@wordpress/components';\nimport { alignLeft, alignRight, alignCenter } from '@wordpress/icons';\n\nconst DEFAULT_ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align text left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align text center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align text right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction AlignmentUI( {\n\tvalue,\n\tonChange,\n\talignmentControls = DEFAULT_ALIGNMENT_CONTROLS,\n\tlabel = __( 'Align text' ),\n\tdescription = __( 'Change text alignment' ),\n\tisCollapsed = true,\n\tisToolbar,\n} ) {\n\tfunction applyOrUnset( align ) {\n\t\treturn () => onChange( value === align ? undefined : align );\n\t}\n\n\tconst activeAlignment = alignmentControls.find(\n\t\t( control ) => control.align === value\n\t);\n\n\tfunction setIcon() {\n\t\tif ( activeAlignment ) {\n\t\t\treturn activeAlignment.icon;\n\t\t}\n\t\treturn isRTL() ? alignRight : alignLeft;\n\t}\n\n\tconst UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst extraProps = isToolbar\n\t\t? { isCollapsed }\n\t\t: {\n\t\t\t\ttoggleProps: {\n\t\t\t\t\tdescription,\n\t\t\t\t},\n\t\t\t\tpopoverProps: POPOVER_PROPS,\n\t\t };\n\n\treturn (\n\t\t<UIComponent\n\t\t\ticon={ setIcon() }\n\t\t\tlabel={ label }\n\t\t\tcontrols={ alignmentControls.map( ( control ) => {\n\t\t\t\tconst { align } = control;\n\t\t\t\tconst isActive = value === align;\n\n\t\t\t\treturn {\n\t\t\t\t\t...control,\n\t\t\t\t\tisActive,\n\t\t\t\t\trole: isCollapsed ? 'menuitemradio' : undefined,\n\t\t\t\t\tonClick: applyOrUnset( align ),\n\t\t\t\t};\n\t\t\t} ) }\n\t\t\t{ ...extraProps }\n\t\t/>\n\t);\n}\n\nexport default AlignmentUI;\n"],
5
- "mappings": ";AAGA,SAAS,IAAI,aAAa;AAC1B,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,WAAW,YAAY,mBAAmB;AA2DjD;AAzDF,IAAM,6BAA6B;AAAA,EAClC;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,iBAAkB;AAAA,IAC7B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,WAAW;AACZ;AAEA,SAAS,YAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,QAAQ,GAAI,YAAa;AAAA,EACzB,cAAc,GAAI,uBAAwB;AAAA,EAC1C,cAAc;AAAA,EACd;AACD,GAAI;AACH,WAAS,aAAc,OAAQ;AAC9B,WAAO,MAAM,SAAU,UAAU,QAAQ,SAAY,KAAM;AAAA,EAC5D;AAEA,QAAM,kBAAkB,kBAAkB;AAAA,IACzC,CAAE,YAAa,QAAQ,UAAU;AAAA,EAClC;AAEA,WAAS,UAAU;AAClB,QAAK,iBAAkB;AACtB,aAAO,gBAAgB;AAAA,IACxB;AACA,WAAO,MAAM,IAAI,aAAa;AAAA,EAC/B;AAEA,QAAM,cAAc,YAAY,eAAe;AAC/C,QAAM,aAAa,YAChB,EAAE,YAAY,IACd;AAAA,IACA,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,cAAc;AAAA,EACd;AAEH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,QAAQ;AAAA,MACf;AAAA,MACA,UAAW,kBAAkB,IAAK,CAAE,YAAa;AAChD,cAAM,EAAE,MAAM,IAAI;AAClB,cAAM,WAAW,UAAU;AAE3B,eAAO;AAAA,UACN,GAAG;AAAA,UACH;AAAA,UACA,MAAM,cAAc,kBAAkB;AAAA,UACtC,SAAS,aAAc,KAAM;AAAA,QAC9B;AAAA,MACD,CAAE;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,aAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { ToolbarDropdownMenu, ToolbarGroup } from '@wordpress/components';\nimport { alignLeft, alignRight, alignCenter } from '@wordpress/icons';\n\nconst DEFAULT_ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align text left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align text center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align text right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction AlignmentUI( {\n\tvalue,\n\tonChange,\n\talignmentControls = DEFAULT_ALIGNMENT_CONTROLS,\n\tlabel = __( 'Align text' ),\n\tdescription,\n\tisCollapsed = true,\n\tisToolbar,\n} ) {\n\tfunction applyOrUnset( align ) {\n\t\treturn () => onChange( value === align ? undefined : align );\n\t}\n\n\tconst activeAlignment = alignmentControls.find(\n\t\t( control ) => control.align === value\n\t);\n\n\tfunction setIcon() {\n\t\tif ( activeAlignment ) {\n\t\t\treturn activeAlignment.icon;\n\t\t}\n\t\treturn isRTL() ? alignRight : alignLeft;\n\t}\n\n\tconst UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst extraProps = isToolbar\n\t\t? { isCollapsed }\n\t\t: {\n\t\t\t\ttoggleProps: description ? { description } : {},\n\t\t\t\tpopoverProps: POPOVER_PROPS,\n\t\t };\n\n\treturn (\n\t\t<UIComponent\n\t\t\ticon={ setIcon() }\n\t\t\tlabel={ label }\n\t\t\tcontrols={ alignmentControls.map( ( control ) => {\n\t\t\t\tconst { align } = control;\n\t\t\t\tconst isActive = value === align;\n\n\t\t\t\treturn {\n\t\t\t\t\t...control,\n\t\t\t\t\tisActive,\n\t\t\t\t\trole: isCollapsed ? 'menuitemradio' : undefined,\n\t\t\t\t\tonClick: applyOrUnset( align ),\n\t\t\t\t};\n\t\t\t} ) }\n\t\t\t{ ...extraProps }\n\t\t/>\n\t);\n}\n\nexport default AlignmentUI;\n"],
5
+ "mappings": ";AAGA,SAAS,IAAI,aAAa;AAC1B,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,WAAW,YAAY,mBAAmB;AAyDjD;AAvDF,IAAM,6BAA6B;AAAA,EAClC;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,iBAAkB;AAAA,IAC7B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,WAAW;AACZ;AAEA,SAAS,YAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,QAAQ,GAAI,YAAa;AAAA,EACzB;AAAA,EACA,cAAc;AAAA,EACd;AACD,GAAI;AACH,WAAS,aAAc,OAAQ;AAC9B,WAAO,MAAM,SAAU,UAAU,QAAQ,SAAY,KAAM;AAAA,EAC5D;AAEA,QAAM,kBAAkB,kBAAkB;AAAA,IACzC,CAAE,YAAa,QAAQ,UAAU;AAAA,EAClC;AAEA,WAAS,UAAU;AAClB,QAAK,iBAAkB;AACtB,aAAO,gBAAgB;AAAA,IACxB;AACA,WAAO,MAAM,IAAI,aAAa;AAAA,EAC/B;AAEA,QAAM,cAAc,YAAY,eAAe;AAC/C,QAAM,aAAa,YAChB,EAAE,YAAY,IACd;AAAA,IACA,aAAa,cAAc,EAAE,YAAY,IAAI,CAAC;AAAA,IAC9C,cAAc;AAAA,EACd;AAEH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,QAAQ;AAAA,MACf;AAAA,MACA,UAAW,kBAAkB,IAAK,CAAE,YAAa;AAChD,cAAM,EAAE,MAAM,IAAI;AAClB,cAAM,WAAW,UAAU;AAE3B,eAAO;AAAA,UACN,GAAG;AAAA,UACH;AAAA,UACA,MAAM,cAAc,kBAAkB;AAAA,UACtC,SAAS,aAAc,KAAM;AAAA,QAC9B;AAAA,MACD,CAAE;AAAA,MACA,GAAG;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,aAAQ;",
6
6
  "names": []
7
7
  }
@@ -29,6 +29,10 @@ import { focus } from "@wordpress/dom";
29
29
  import { isBlobURL } from "@wordpress/blob";
30
30
  import { getResolvedValue } from "@wordpress/global-styles-engine";
31
31
  import { hasBackgroundImageValue } from "../global-styles/background-panel.mjs";
32
+ import {
33
+ InheritanceResetButton,
34
+ isGlobalStylesInheritanceEnabled
35
+ } from "../global-styles/inheritance/index.mjs";
32
36
  import { setImmutably } from "../../utils/object.mjs";
33
37
  import MediaReplaceFlow from "../media-replace-flow/index.mjs";
34
38
  import { store as blockEditorStore } from "../../store/index.mjs";
@@ -133,6 +137,7 @@ function BackgroundControlsPanel({
133
137
  onToggle: onToggleCallback = noop,
134
138
  hasImageValue,
135
139
  onReset,
140
+ hasLocalOverride,
136
141
  containerRef
137
142
  }) {
138
143
  if (!hasImageValue) {
@@ -165,7 +170,19 @@ function BackgroundControlsPanel({
165
170
  onToggleCallback
166
171
  }
167
172
  ),
168
- onReset && /* @__PURE__ */ jsx(
173
+ onReset && (hasLocalOverride ? /* @__PURE__ */ jsx(
174
+ InheritanceResetButton,
175
+ {
176
+ className: "block-editor-global-styles-background-panel__reset",
177
+ onResetToInherited: () => {
178
+ onReset();
179
+ if (isOpen) {
180
+ onToggle();
181
+ }
182
+ focusToggleButton(containerRef);
183
+ }
184
+ }
185
+ ) : /* @__PURE__ */ jsx(
169
186
  Button,
170
187
  {
171
188
  __next40pxDefaultSize: true,
@@ -181,7 +198,7 @@ function BackgroundControlsPanel({
181
198
  focusToggleButton(containerRef);
182
199
  }
183
200
  }
184
- )
201
+ ))
185
202
  ] });
186
203
  },
187
204
  renderContent: () => /* @__PURE__ */ jsx(
@@ -343,12 +360,20 @@ function BackgroundSizeControls({
343
360
  inheritedValue,
344
361
  defaultValues
345
362
  }) {
346
- const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize;
347
- const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
363
+ const localSizeValue = style?.background?.backgroundSize;
364
+ const localRepeatValue = style?.background?.backgroundRepeat;
365
+ const localPositionValue = style?.background?.backgroundPosition;
366
+ const localAttachmentValue = style?.background?.backgroundAttachment;
367
+ const inheritedSizeValue = inheritedValue?.background?.backgroundSize;
368
+ const inheritedRepeatValue = inheritedValue?.background?.backgroundRepeat;
369
+ const inheritedPositionValue = inheritedValue?.background?.backgroundPosition;
370
+ const inheritedAttachmentValue = inheritedValue?.background?.backgroundAttachment;
371
+ const sizeValue = localSizeValue || inheritedSizeValue;
372
+ const repeatValue = localRepeatValue || inheritedRepeatValue;
348
373
  const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
349
374
  const isUploadedImage = style?.background?.backgroundImage?.id;
350
- const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
351
- const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment;
375
+ const positionValue = localPositionValue || inheritedPositionValue;
376
+ const attachmentValue = localAttachmentValue || inheritedAttachmentValue;
352
377
  let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || "auto";
353
378
  currentValueForToggle = !["cover", "contain", "auto"].includes(
354
379
  currentValueForToggle
@@ -502,7 +527,8 @@ function BackgroundImagePanel({
502
527
  onChange,
503
528
  inheritedValue = value,
504
529
  settings,
505
- defaultValues = {}
530
+ defaultValues = {},
531
+ showInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled()
506
532
  }) {
507
533
  const { globalStyles, _links } = useSelect((select) => {
508
534
  const { getSettings } = select(blockEditorStore);
@@ -532,11 +558,17 @@ function BackgroundImagePanel({
532
558
  );
533
559
  return resolvedValues;
534
560
  }, [globalStyles, _links, inheritedValue]);
535
- const resetBackground = () => onChange(setImmutably(value, ["background"], {}));
561
+ const resetBackground = () => onChange(
562
+ setImmutably(value, ["background"], {
563
+ gradient: value?.background?.gradient
564
+ })
565
+ );
536
566
  const { title, url } = value?.background?.backgroundImage || {
537
567
  ...resolvedInheritedValue?.background?.backgroundImage
538
568
  };
539
- const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue);
569
+ const localHasImageValue = hasBackgroundImageValue(value);
570
+ const hasImageValue = localHasImageValue || hasBackgroundImageValue(resolvedInheritedValue);
571
+ const hasLocalOverride = showInheritanceLabelIndicators && localHasImageValue && hasBackgroundImageValue(resolvedInheritedValue);
540
572
  const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage;
541
573
  const shouldShowBackgroundImageControls = hasImageValue && "none" !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat);
542
574
  const [isDropDownOpen, setIsDropDownOpen] = useState(false);
@@ -559,7 +591,8 @@ function BackgroundImagePanel({
559
591
  url,
560
592
  onToggle: setIsDropDownOpen,
561
593
  hasImageValue,
562
- onReset: resetBackground,
594
+ hasLocalOverride,
595
+ onReset: localHasImageValue ? resetBackground : void 0,
563
596
  containerRef,
564
597
  children: /* @__PURE__ */ jsxs(VStack, { spacing: 3, className: "single-column", children: [
565
598
  /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/background-image-control/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexBlock,\n\tFocalPointPicker,\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tDropdown,\n\tPlaceholder,\n\tSpinner,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { reset as resetIcon } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { isBlobURL } from '@wordpress/blob';\nimport { getResolvedValue } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { hasBackgroundImageValue } from '../global-styles/background-panel';\nimport { setImmutably } from '../../utils/object';\nimport MediaReplaceFlow from '../media-replace-flow';\nimport { store as blockEditorStore } from '../../store';\n\nimport {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n} from '../../store/private-keys';\n\nconst IMAGE_BACKGROUND_TYPE = 'image';\n\nconst BACKGROUND_POPOVER_PROPS = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n\tclassName: 'block-editor-global-styles-background-panel__popover',\n};\nconst noop = () => {};\n\n/**\n * Focuses the toggle button.\n * @param {Object} containerRef - ref object containing current element\n */\nconst focusToggleButton = ( containerRef ) => {\n\t// Use requestAnimationFrame to ensure DOM updates are complete\n\twindow.requestAnimationFrame( () => {\n\t\tconst [ toggleButton ] = focus.tabbable.find( containerRef?.current );\n\t\tif ( ! toggleButton ) {\n\t\t\treturn;\n\t\t}\n\t\t// Focus the toggle button and close the dropdown menu.\n\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\ttoggleButton.focus();\n\t} );\n};\n\n/**\n * Get the help text for the background size control.\n *\n * @param {string} value backgroundSize value.\n * @return {string} Translated help text.\n */\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Image has a fixed width.' );\n}\n\n/**\n * Converts decimal x and y coords from FocalPointPicker to percentage-based values\n * to use as backgroundPosition value.\n *\n * @param {{x?:number, y?:number}} value FocalPointPicker coords.\n * @return {string} \t\t\t\t backgroundPosition value.\n */\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\n/**\n * Converts backgroundPosition value to x and y coords for FocalPointPicker.\n *\n * @param {string} value backgroundPosition value.\n * @return {{x?:number, y?:number}} FocalPointPicker coords.\n */\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction InspectorImagePreviewItem( {\n\tas = 'span',\n\timgUrl,\n\ttoggleProps = {},\n\tfilename,\n\tlabel,\n\tonToggleCallback = noop,\n} ) {\n\tconst { isOpen, ...restToggleProps } = toggleProps;\n\n\tuseEffect( () => {\n\t\tif ( typeof isOpen !== 'undefined' ) {\n\t\t\tonToggleCallback( isOpen );\n\t\t}\n\t}, [ isOpen, onToggleCallback ] );\n\n\tconst renderPreviewContent = () => {\n\t\treturn (\n\t\t\t<HStack className=\"block-editor-global-styles-background-panel__inspector-preview-inner\">\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__inspector-image-indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundImage: imgUrl\n\t\t\t\t\t\t\t? `url(${ imgUrl })`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t{ imgUrl\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Background image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename || label\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No background image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexBlock>\n\t\t\t</HStack>\n\t\t);\n\t};\n\n\treturn as === 'button' ? (\n\t\t<Button __next40pxDefaultSize { ...restToggleProps }>\n\t\t\t{ renderPreviewContent() }\n\t\t</Button>\n\t) : (\n\t\trenderPreviewContent()\n\t);\n}\n\nfunction BackgroundControlsPanel( {\n\tlabel,\n\tfilename,\n\turl: imgUrl,\n\tchildren,\n\tonToggle: onToggleCallback = noop,\n\thasImageValue,\n\tonReset,\n\tcontainerRef,\n} ) {\n\tif ( ! hasImageValue ) {\n\t\treturn;\n\t}\n\n\tconst imgLabel = label || getFilename( imgUrl ) || __( 'Image' );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ BACKGROUND_POPOVER_PROPS }\n\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\tconst toggleProps = {\n\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\tclassName:\n\t\t\t\t\t\t'block-editor-global-styles-background-panel__dropdown-toggle',\n\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t'aria-label': __(\n\t\t\t\t\t\t'Background size, position and repeat options.'\n\t\t\t\t\t),\n\t\t\t\t\tisOpen,\n\t\t\t\t};\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorImagePreviewItem\n\t\t\t\t\t\t\timgUrl={ imgUrl }\n\t\t\t\t\t\t\tfilename={ filename }\n\t\t\t\t\t\t\tlabel={ imgLabel }\n\t\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t\t\tas=\"button\"\n\t\t\t\t\t\t\tonToggleCallback={ onToggleCallback }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ onReset && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__reset\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\t\t\t// Close the dropdown if open.\n\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Focus the toggle button.\n\t\t\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper\n\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__dropdown-content-wrapper\"\n\t\t\t\t\tpaddingSize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction LoadingSpinner() {\n\treturn (\n\t\t<Placeholder className=\"block-editor-global-styles-background-panel__loading\">\n\t\t\t<Spinner />\n\t\t</Placeholder>\n\t);\n}\n\nfunction BackgroundImageControls( {\n\tonChange,\n\tstyle,\n\tinheritedValue,\n\tonRemoveImage = noop,\n\tonResetImage = noop,\n\tdisplayInPanel,\n\tdefaultValues,\n\tcontainerRef,\n} ) {\n\tconst [ isUploading, setIsUploading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst { id, title, url } = style?.background?.backgroundImage || {\n\t\t...inheritedValue?.background?.backgroundImage,\n\t};\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetIsUploading( false );\n\t};\n\n\tconst resetBackgroundImage = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tresetBackgroundImage();\n\t\t\tsetIsUploading( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetIsUploading( true );\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sizeValue =\n\t\t\tstyle?.background?.backgroundSize || defaultValues?.backgroundSize;\n\t\tconst positionValue = style?.background?.backgroundPosition;\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t\tbackgroundPosition:\n\t\t\t\t\t/*\n\t\t\t\t\t * A background image uploaded and set in the editor receives a default background position of '50% 0',\n\t\t\t\t\t * when the background image size is the equivalent of \"Tile\".\n\t\t\t\t\t * This is to increase the chance that the image's focus point is visible.\n\t\t\t\t\t * This is in-editor only to assist with the user experience.\n\t\t\t\t\t */\n\t\t\t\t\t! positionValue && ( 'auto' === sizeValue || ! sizeValue )\n\t\t\t\t\t\t? '50% 0'\n\t\t\t\t\t\t: positionValue,\n\t\t\t\tbackgroundSize: sizeValue,\n\t\t\t} )\n\t\t);\n\t\tsetIsUploading( false );\n\t\t// Close the dropdown and focus the toggle button.\n\t\tfocusToggleButton( containerRef );\n\t};\n\n\t// Drag and drop callback, restricting image to one.\n\tconst onFilesDrop = ( filesList ) => {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: [ IMAGE_BACKGROUND_TYPE ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t\tmultiple: false,\n\t\t} );\n\t};\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\tconst onRemove = () =>\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\tbackgroundImage: 'none',\n\t\t\t} )\n\t\t);\n\tconst canRemove = ! hasValue && hasBackgroundImageValue( inheritedValue );\n\tconst imgLabel = title || getFilename( url ) || __( 'Image' );\n\n\treturn (\n\t\t<div className=\"block-editor-global-styles-background-panel__image-tools-panel-item\">\n\t\t\t{ isUploading && <LoadingSpinner /> }\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaId={ id }\n\t\t\t\tmediaURL={ url }\n\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tclassName: clsx( {\n\t\t\t\t\t\t'block-editor-global-styles-background-panel__media-replace-popover':\n\t\t\t\t\t\t\tdisplayInPanel,\n\t\t\t\t\t} ),\n\t\t\t\t} }\n\t\t\t\tname={\n\t\t\t\t\t<InspectorImagePreviewItem\n\t\t\t\t\t\timgUrl={ url }\n\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\tlabel={ imgLabel }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\trenderToggle={ ( props ) => (\n\t\t\t\t\t<Button { ...props } __next40pxDefaultSize />\n\t\t\t\t) }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tonReset={ () => {\n\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\tonResetImage();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ canRemove && (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</MediaReplaceFlow>\n\t\t\t<DropZone\n\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BackgroundSizeControls( {\n\tonChange,\n\tstyle,\n\tinheritedValue,\n\tdefaultValues,\n} ) {\n\tconst sizeValue =\n\t\tstyle?.background?.backgroundSize ||\n\t\tinheritedValue?.background?.backgroundSize;\n\tconst repeatValue =\n\t\tstyle?.background?.backgroundRepeat ||\n\t\tinheritedValue?.background?.backgroundRepeat;\n\tconst imageValue =\n\t\tstyle?.background?.backgroundImage?.url ||\n\t\tinheritedValue?.background?.backgroundImage?.url;\n\tconst isUploadedImage = style?.background?.backgroundImage?.id;\n\tconst positionValue =\n\t\tstyle?.background?.backgroundPosition ||\n\t\tinheritedValue?.background?.backgroundPosition;\n\tconst attachmentValue =\n\t\tstyle?.background?.backgroundAttachment ||\n\t\tinheritedValue?.background?.backgroundAttachment;\n\n\t/*\n\t * Set default values for uploaded images.\n\t * The default values are passed by the consumer.\n\t * Block-level controls may have different defaults to root-level controls.\n\t * A falsy value is treated by default as `auto` (Tile).\n\t */\n\tlet currentValueForToggle =\n\t\t! sizeValue && isUploadedImage\n\t\t\t? defaultValues?.backgroundSize\n\t\t\t: sizeValue || 'auto';\n\t/*\n\t * The incoming value could be a value + unit, e.g. '20px'.\n\t * In this case set the value to 'tile'.\n\t */\n\tcurrentValueForToggle = ! [ 'cover', 'contain', 'auto' ].includes(\n\t\tcurrentValueForToggle\n\t)\n\t\t? 'auto'\n\t\t: currentValueForToggle;\n\t/*\n\t * If the current value is `cover` and the repeat value is `undefined`, then\n\t * the toggle should be unchecked as the default state. Otherwise, the toggle\n\t * should reflect the current repeat value.\n\t */\n\tconst repeatCheckedValue = ! (\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t);\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\t\tlet nextPosition = positionValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t\tnextPosition = undefined;\n\t\t}\n\n\t\tif ( next === 'cover' ) {\n\t\t\tnextRepeat = undefined;\n\t\t\tnextPosition = undefined;\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t\t/*\n\t\t\t * A background image uploaded and set in the editor (an image with a record id),\n\t\t\t * receives a default background position of '50% 0',\n\t\t\t * when the toggle switches to \"Tile\". This is to increase the chance that\n\t\t\t * the image's focus point is visible.\n\t\t\t * This is in-editor only to assist with the user experience.\n\t\t\t */\n\t\t\tif ( !! style?.background?.backgroundImage?.id ) {\n\t\t\t\tnextPosition = '50% 0';\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Next will be null when the input is cleared,\n\t\t * in which case the value should be 'auto'.\n\t\t */\n\t\tif ( ! next && currentValueForToggle === 'auto' ) {\n\t\t\tnext = 'auto';\n\t\t}\n\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: nextPosition,\n\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\tbackgroundSize: next,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundPosition' ],\n\t\t\t\tcoordsToBackgroundPosition( next )\n\t\t\t)\n\t\t);\n\t};\n\n\tconst toggleIsRepeated = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundRepeat' ],\n\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : 'repeat'\n\t\t\t)\n\t\t);\n\n\tconst toggleScrollWithPage = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundAttachment' ],\n\t\t\t\tattachmentValue === 'fixed' ? 'scroll' : 'fixed'\n\t\t\t)\n\t\t);\n\n\t// Set a default background position for non-site-wide, uploaded images with a size of 'contain'.\n\tconst backgroundPositionValue =\n\t\t! positionValue && isUploadedImage && 'contain' === sizeValue\n\t\t\t? defaultValues?.backgroundPosition\n\t\t\t: positionValue;\n\n\treturn (\n\t\t<VStack spacing={ 3 } className=\"single-column\">\n\t\t\t<FocalPointPicker\n\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\turl={ imageValue }\n\t\t\t\tvalue={ backgroundPositionToCoords( backgroundPositionValue ) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\tchecked={ attachmentValue === 'fixed' }\n\t\t\t\tonChange={ toggleScrollWithPage }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText(\n\t\t\t\t\tsizeValue || defaultValues?.backgroundSize\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"cover\"\n\t\t\t\t\tvalue=\"cover\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Cover',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"contain\"\n\t\t\t\t\tvalue=\"contain\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Contain',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"tile\"\n\t\t\t\t\tvalue=\"auto\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Tile',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 2 } as=\"span\">\n\t\t\t\t<UnitControl\n\t\t\t\t\taria-label={ __( 'Background image width' ) }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t\t__unstableInputWidth=\"100px\"\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tdisabled={\n\t\t\t\t\t\tcurrentValueForToggle !== 'auto' ||\n\t\t\t\t\t\tcurrentValueForToggle === undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\tdisabled={ currentValueForToggle === 'cover' }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</VStack>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tdefaultValues = {},\n} ) {\n\t/*\n\t * Resolve any inherited \"ref\" pointers.\n\t * Should the block editor need resolved, inherited values\n\t * across all controls, this could be abstracted into a hook,\n\t * e.g., useResolveGlobalStyle\n\t */\n\tconst { globalStyles, _links } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tglobalStyles: _settings[ globalStylesDataKey ],\n\t\t\t_links: _settings[ globalStylesLinksDataKey ],\n\t\t};\n\t}, [] );\n\tconst resolvedInheritedValue = useMemo( () => {\n\t\tconst resolvedValues = {\n\t\t\tbackground: {},\n\t\t};\n\n\t\tif ( ! inheritedValue?.background ) {\n\t\t\treturn inheritedValue;\n\t\t}\n\n\t\tObject.entries( inheritedValue?.background ).forEach(\n\t\t\t( [ key, backgroundValue ] ) => {\n\t\t\t\tresolvedValues.background[ key ] = getResolvedValue(\n\t\t\t\t\tbackgroundValue,\n\t\t\t\t\t{\n\t\t\t\t\t\tstyles: globalStyles,\n\t\t\t\t\t\t_links,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\treturn resolvedValues;\n\t}, [ globalStyles, _links, inheritedValue ] );\n\n\tconst resetBackground = () =>\n\t\tonChange( setImmutably( value, [ 'background' ], {} ) );\n\n\tconst { title, url } = value?.background?.backgroundImage || {\n\t\t...resolvedInheritedValue?.background?.backgroundImage,\n\t};\n\tconst hasImageValue =\n\t\thasBackgroundImageValue( value ) ||\n\t\thasBackgroundImageValue( resolvedInheritedValue );\n\n\tconst imageValue =\n\t\tvalue?.background?.backgroundImage ||\n\t\tinheritedValue?.background?.backgroundImage;\n\n\tconst shouldShowBackgroundImageControls =\n\t\thasImageValue &&\n\t\t'none' !== imageValue &&\n\t\t( settings?.background?.backgroundSize ||\n\t\t\tsettings?.background?.backgroundPosition ||\n\t\t\tsettings?.background?.backgroundRepeat );\n\n\tconst [ isDropDownOpen, setIsDropDownOpen ] = useState( false );\n\tconst containerRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ containerRef }\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-global-styles-background-panel__inspector-media-replace-container',\n\t\t\t\t{\n\t\t\t\t\t'is-open': isDropDownOpen,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ shouldShowBackgroundImageControls ? (\n\t\t\t\t<BackgroundControlsPanel\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tfilename={ title }\n\t\t\t\t\turl={ url }\n\t\t\t\t\tonToggle={ setIsDropDownOpen }\n\t\t\t\t\thasImageValue={ hasImageValue }\n\t\t\t\t\tonReset={ resetBackground }\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 3 } className=\"single-column\">\n\t\t\t\t\t\t<BackgroundImageControls\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tstyle={ value }\n\t\t\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\t\t\tdisplayInPanel\n\t\t\t\t\t\t\tonResetImage={ () => {\n\t\t\t\t\t\t\t\tsetIsDropDownOpen( false );\n\t\t\t\t\t\t\t\tresetBackground();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonRemoveImage={ () => setIsDropDownOpen( false ) }\n\t\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BackgroundSizeControls\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tstyle={ value }\n\t\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</BackgroundControlsPanel>\n\t\t\t) : (\n\t\t\t\t<BackgroundImageControls\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tstyle={ value }\n\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\tonResetImage={ () => {\n\t\t\t\t\t\tsetIsDropDownOpen( false );\n\t\t\t\t\t\tresetBackground();\n\t\t\t\t\t} }\n\t\t\t\t\tonRemoveImage={ () => setIsDropDownOpen( false ) }\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,wCAAwC;AAAA,EACxC;AAAA,OACM;AACP,SAAS,sBAAsB;AAC/B,SAAS,SAAS,iBAAiB;AACnC,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,UAAU,WAAW,eAAe;AACrD,SAAS,aAAa,iBAAiB;AACvC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAKjC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,OAAO,sBAAsB;AAC7B,SAAS,SAAS,wBAAwB;AAE1C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAqGH,SAqEC,UArED,KAQA,YARA;AAnGJ,IAAM,wBAAwB;AAE9B,IAAM,2BAA2B;AAAA,EAChC,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACZ;AACA,IAAM,OAAO,MAAM;AAAC;AAMpB,IAAM,o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AY,sBACtB,UAAU,YAAY;AAExB,QAAM,CAAE,gBAAgB,iBAAkB,IAAI,SAAU,KAAM;AAC9D,QAAM,eAAe,OAAO;AAE5B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,KAAM;AAAA,MACN,WAAY;AAAA,QACX;AAAA,QACA;AAAA,UACC,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,MAEE,8CACD;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR,UAAW;AAAA,UACX;AAAA,UACA,UAAW;AAAA,UACX;AAAA,UACA,SAAU;AAAA,UACV;AAAA,UAEA,+BAAC,UAAO,SAAU,GAAI,WAAU,iBAC/B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA,OAAQ;AAAA,gBACR,gBAAiB;AAAA,gBACjB,gBAAc;AAAA,gBACd,cAAe,MAAM;AACpB,oCAAmB,KAAM;AACzB,kCAAgB;AAAA,gBACjB;AAAA,gBACA,eAAgB,MAAM,kBAAmB,KAAM;AAAA,gBAC/C;AAAA,gBACA;AAAA;AAAA,YACD;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA,OAAQ;AAAA,gBACR;AAAA,gBACA,gBAAiB;AAAA;AAAA,YAClB;AAAA,aACD;AAAA;AAAA,MACD,IAEA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,OAAQ;AAAA,UACR,gBAAiB;AAAA,UACjB;AAAA,UACA,cAAe,MAAM;AACpB,8BAAmB,KAAM;AACzB,4BAAgB;AAAA,UACjB;AAAA,UACA,eAAgB,MAAM,kBAAmB,KAAM;AAAA,UAC/C;AAAA;AAAA,MACD;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexBlock,\n\tFocalPointPicker,\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tDropdown,\n\tPlaceholder,\n\tSpinner,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { reset as resetIcon } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { isBlobURL } from '@wordpress/blob';\nimport { getResolvedValue } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { hasBackgroundImageValue } from '../global-styles/background-panel';\nimport {\n\tInheritanceResetButton,\n\tisGlobalStylesInheritanceEnabled,\n} from '../global-styles/inheritance';\nimport { setImmutably } from '../../utils/object';\nimport MediaReplaceFlow from '../media-replace-flow';\nimport { store as blockEditorStore } from '../../store';\n\nimport {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n} from '../../store/private-keys';\n\nconst IMAGE_BACKGROUND_TYPE = 'image';\n\nconst BACKGROUND_POPOVER_PROPS = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n\tclassName: 'block-editor-global-styles-background-panel__popover',\n};\nconst noop = () => {};\n\n/**\n * Focuses the toggle button.\n * @param {Object} containerRef - ref object containing current element\n */\nconst focusToggleButton = ( containerRef ) => {\n\t// Use requestAnimationFrame to ensure DOM updates are complete\n\twindow.requestAnimationFrame( () => {\n\t\tconst [ toggleButton ] = focus.tabbable.find( containerRef?.current );\n\t\tif ( ! toggleButton ) {\n\t\t\treturn;\n\t\t}\n\t\t// Focus the toggle button and close the dropdown menu.\n\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\ttoggleButton.focus();\n\t} );\n};\n\n/**\n * Get the help text for the background size control.\n *\n * @param {string} value backgroundSize value.\n * @return {string} Translated help text.\n */\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Image has a fixed width.' );\n}\n\n/**\n * Converts decimal x and y coords from FocalPointPicker to percentage-based values\n * to use as backgroundPosition value.\n *\n * @param {{x?:number, y?:number}} value FocalPointPicker coords.\n * @return {string} \t\t\t\t backgroundPosition value.\n */\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\n/**\n * Converts backgroundPosition value to x and y coords for FocalPointPicker.\n *\n * @param {string} value backgroundPosition value.\n * @return {{x?:number, y?:number}} FocalPointPicker coords.\n */\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction InspectorImagePreviewItem( {\n\tas = 'span',\n\timgUrl,\n\ttoggleProps = {},\n\tfilename,\n\tlabel,\n\tonToggleCallback = noop,\n} ) {\n\tconst { isOpen, ...restToggleProps } = toggleProps;\n\n\tuseEffect( () => {\n\t\tif ( typeof isOpen !== 'undefined' ) {\n\t\t\tonToggleCallback( isOpen );\n\t\t}\n\t}, [ isOpen, onToggleCallback ] );\n\n\tconst renderPreviewContent = () => {\n\t\treturn (\n\t\t\t<HStack className=\"block-editor-global-styles-background-panel__inspector-preview-inner\">\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__inspector-image-indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundImage: imgUrl\n\t\t\t\t\t\t\t? `url(${ imgUrl })`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t{ imgUrl\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Background image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename || label\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No background image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexBlock>\n\t\t\t</HStack>\n\t\t);\n\t};\n\n\treturn as === 'button' ? (\n\t\t<Button __next40pxDefaultSize { ...restToggleProps }>\n\t\t\t{ renderPreviewContent() }\n\t\t</Button>\n\t) : (\n\t\trenderPreviewContent()\n\t);\n}\n\nfunction BackgroundControlsPanel( {\n\tlabel,\n\tfilename,\n\turl: imgUrl,\n\tchildren,\n\tonToggle: onToggleCallback = noop,\n\thasImageValue,\n\tonReset,\n\thasLocalOverride,\n\tcontainerRef,\n} ) {\n\tif ( ! hasImageValue ) {\n\t\treturn;\n\t}\n\n\tconst imgLabel = label || getFilename( imgUrl ) || __( 'Image' );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ BACKGROUND_POPOVER_PROPS }\n\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\tconst toggleProps = {\n\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\tclassName:\n\t\t\t\t\t\t'block-editor-global-styles-background-panel__dropdown-toggle',\n\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t'aria-label': __(\n\t\t\t\t\t\t'Background size, position and repeat options.'\n\t\t\t\t\t),\n\t\t\t\t\tisOpen,\n\t\t\t\t};\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorImagePreviewItem\n\t\t\t\t\t\t\timgUrl={ imgUrl }\n\t\t\t\t\t\t\tfilename={ filename }\n\t\t\t\t\t\t\tlabel={ imgLabel }\n\t\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t\t\tas=\"button\"\n\t\t\t\t\t\t\tonToggleCallback={ onToggleCallback }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ onReset &&\n\t\t\t\t\t\t\t( hasLocalOverride ? (\n\t\t\t\t\t\t\t\t<InheritanceResetButton\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__reset\"\n\t\t\t\t\t\t\t\t\tonResetToInherited={ () => {\n\t\t\t\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\t\t\t\t// Close the dropdown if open.\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Focus the toggle button.\n\t\t\t\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__reset\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\t\t\t\t// Close the dropdown if open.\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Focus the toggle button.\n\t\t\t\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper\n\t\t\t\t\tclassName=\"block-editor-global-styles-background-panel__dropdown-content-wrapper\"\n\t\t\t\t\tpaddingSize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction LoadingSpinner() {\n\treturn (\n\t\t<Placeholder className=\"block-editor-global-styles-background-panel__loading\">\n\t\t\t<Spinner />\n\t\t</Placeholder>\n\t);\n}\n\nfunction BackgroundImageControls( {\n\tonChange,\n\tstyle,\n\tinheritedValue,\n\tonRemoveImage = noop,\n\tonResetImage = noop,\n\tdisplayInPanel,\n\tdefaultValues,\n\tcontainerRef,\n} ) {\n\tconst [ isUploading, setIsUploading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst { id, title, url } = style?.background?.backgroundImage || {\n\t\t...inheritedValue?.background?.backgroundImage,\n\t};\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetIsUploading( false );\n\t};\n\n\tconst resetBackgroundImage = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tresetBackgroundImage();\n\t\t\tsetIsUploading( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetIsUploading( true );\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sizeValue =\n\t\t\tstyle?.background?.backgroundSize || defaultValues?.backgroundSize;\n\t\tconst positionValue = style?.background?.backgroundPosition;\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t\tbackgroundPosition:\n\t\t\t\t\t/*\n\t\t\t\t\t * A background image uploaded and set in the editor receives a default background position of '50% 0',\n\t\t\t\t\t * when the background image size is the equivalent of \"Tile\".\n\t\t\t\t\t * This is to increase the chance that the image's focus point is visible.\n\t\t\t\t\t * This is in-editor only to assist with the user experience.\n\t\t\t\t\t */\n\t\t\t\t\t! positionValue && ( 'auto' === sizeValue || ! sizeValue )\n\t\t\t\t\t\t? '50% 0'\n\t\t\t\t\t\t: positionValue,\n\t\t\t\tbackgroundSize: sizeValue,\n\t\t\t} )\n\t\t);\n\t\tsetIsUploading( false );\n\t\t// Close the dropdown and focus the toggle button.\n\t\tfocusToggleButton( containerRef );\n\t};\n\n\t// Drag and drop callback, restricting image to one.\n\tconst onFilesDrop = ( filesList ) => {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: [ IMAGE_BACKGROUND_TYPE ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t\tmultiple: false,\n\t\t} );\n\t};\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\tconst onRemove = () =>\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\tbackgroundImage: 'none',\n\t\t\t} )\n\t\t);\n\tconst canRemove = ! hasValue && hasBackgroundImageValue( inheritedValue );\n\tconst imgLabel = title || getFilename( url ) || __( 'Image' );\n\n\treturn (\n\t\t<div className=\"block-editor-global-styles-background-panel__image-tools-panel-item\">\n\t\t\t{ isUploading && <LoadingSpinner /> }\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaId={ id }\n\t\t\t\tmediaURL={ url }\n\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tclassName: clsx( {\n\t\t\t\t\t\t'block-editor-global-styles-background-panel__media-replace-popover':\n\t\t\t\t\t\t\tdisplayInPanel,\n\t\t\t\t\t} ),\n\t\t\t\t} }\n\t\t\t\tname={\n\t\t\t\t\t<InspectorImagePreviewItem\n\t\t\t\t\t\timgUrl={ url }\n\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\tlabel={ imgLabel }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\trenderToggle={ ( props ) => (\n\t\t\t\t\t<Button { ...props } __next40pxDefaultSize />\n\t\t\t\t) }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tonReset={ () => {\n\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\tonResetImage();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ canRemove && (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</MediaReplaceFlow>\n\t\t\t<DropZone\n\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BackgroundSizeControls( {\n\tonChange,\n\tstyle,\n\tinheritedValue,\n\tdefaultValues,\n} ) {\n\t/*\n\t * Read local and inherited values separately so each sub-control can\n\t * show the inherited value while marking the control as inherited.\n\t */\n\tconst localSizeValue = style?.background?.backgroundSize;\n\tconst localRepeatValue = style?.background?.backgroundRepeat;\n\tconst localPositionValue = style?.background?.backgroundPosition;\n\tconst localAttachmentValue = style?.background?.backgroundAttachment;\n\tconst inheritedSizeValue = inheritedValue?.background?.backgroundSize;\n\tconst inheritedRepeatValue = inheritedValue?.background?.backgroundRepeat;\n\tconst inheritedPositionValue =\n\t\tinheritedValue?.background?.backgroundPosition;\n\tconst inheritedAttachmentValue =\n\t\tinheritedValue?.background?.backgroundAttachment;\n\n\tconst sizeValue = localSizeValue || inheritedSizeValue;\n\tconst repeatValue = localRepeatValue || inheritedRepeatValue;\n\tconst imageValue =\n\t\tstyle?.background?.backgroundImage?.url ||\n\t\tinheritedValue?.background?.backgroundImage?.url;\n\tconst isUploadedImage = style?.background?.backgroundImage?.id;\n\tconst positionValue = localPositionValue || inheritedPositionValue;\n\tconst attachmentValue = localAttachmentValue || inheritedAttachmentValue;\n\n\t/*\n\t * Set default values for uploaded images.\n\t * The default values are passed by the consumer.\n\t * Block-level controls may have different defaults to root-level controls.\n\t * A falsy value is treated by default as `auto` (Tile).\n\t */\n\tlet currentValueForToggle =\n\t\t! sizeValue && isUploadedImage\n\t\t\t? defaultValues?.backgroundSize\n\t\t\t: sizeValue || 'auto';\n\t/*\n\t * The incoming value could be a value + unit, e.g. '20px'.\n\t * In this case set the value to 'tile'.\n\t */\n\tcurrentValueForToggle = ! [ 'cover', 'contain', 'auto' ].includes(\n\t\tcurrentValueForToggle\n\t)\n\t\t? 'auto'\n\t\t: currentValueForToggle;\n\t/*\n\t * If the current value is `cover` and the repeat value is `undefined`, then\n\t * the toggle should be unchecked as the default state. Otherwise, the toggle\n\t * should reflect the current repeat value.\n\t */\n\tconst repeatCheckedValue = ! (\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t);\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\t\tlet nextPosition = positionValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t\tnextPosition = undefined;\n\t\t}\n\n\t\tif ( next === 'cover' ) {\n\t\t\tnextRepeat = undefined;\n\t\t\tnextPosition = undefined;\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t\t/*\n\t\t\t * A background image uploaded and set in the editor (an image with a record id),\n\t\t\t * receives a default background position of '50% 0',\n\t\t\t * when the toggle switches to \"Tile\". This is to increase the chance that\n\t\t\t * the image's focus point is visible.\n\t\t\t * This is in-editor only to assist with the user experience.\n\t\t\t */\n\t\t\tif ( !! style?.background?.backgroundImage?.id ) {\n\t\t\t\tnextPosition = '50% 0';\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Next will be null when the input is cleared,\n\t\t * in which case the value should be 'auto'.\n\t\t */\n\t\tif ( ! next && currentValueForToggle === 'auto' ) {\n\t\t\tnext = 'auto';\n\t\t}\n\n\t\tonChange(\n\t\t\tsetImmutably( style, [ 'background' ], {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: nextPosition,\n\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\tbackgroundSize: next,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundPosition' ],\n\t\t\t\tcoordsToBackgroundPosition( next )\n\t\t\t)\n\t\t);\n\t};\n\n\tconst toggleIsRepeated = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundRepeat' ],\n\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : 'repeat'\n\t\t\t)\n\t\t);\n\n\tconst toggleScrollWithPage = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tstyle,\n\t\t\t\t[ 'background', 'backgroundAttachment' ],\n\t\t\t\tattachmentValue === 'fixed' ? 'scroll' : 'fixed'\n\t\t\t)\n\t\t);\n\n\t// Set a default background position for non-site-wide, uploaded images with a size of 'contain'.\n\tconst backgroundPositionValue =\n\t\t! positionValue && isUploadedImage && 'contain' === sizeValue\n\t\t\t? defaultValues?.backgroundPosition\n\t\t\t: positionValue;\n\n\treturn (\n\t\t<VStack spacing={ 3 } className=\"single-column\">\n\t\t\t<FocalPointPicker\n\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\turl={ imageValue }\n\t\t\t\tvalue={ backgroundPositionToCoords( backgroundPositionValue ) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\tchecked={ attachmentValue === 'fixed' }\n\t\t\t\tonChange={ toggleScrollWithPage }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText(\n\t\t\t\t\tsizeValue || defaultValues?.backgroundSize\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"cover\"\n\t\t\t\t\tvalue=\"cover\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Cover',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"contain\"\n\t\t\t\t\tvalue=\"contain\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Contain',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"tile\"\n\t\t\t\t\tvalue=\"auto\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Tile',\n\t\t\t\t\t\t'Size option for background image control'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 2 } as=\"span\">\n\t\t\t\t<UnitControl\n\t\t\t\t\taria-label={ __( 'Background image width' ) }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t\t__unstableInputWidth=\"100px\"\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tdisabled={\n\t\t\t\t\t\tcurrentValueForToggle !== 'auto' ||\n\t\t\t\t\t\tcurrentValueForToggle === undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\tdisabled={ currentValueForToggle === 'cover' }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</VStack>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tdefaultValues = {},\n\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),\n} ) {\n\t/*\n\t * Resolve inherited `ref` pointers for background controls.\n\t */\n\tconst { globalStyles, _links } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tglobalStyles: _settings[ globalStylesDataKey ],\n\t\t\t_links: _settings[ globalStylesLinksDataKey ],\n\t\t};\n\t}, [] );\n\tconst resolvedInheritedValue = useMemo( () => {\n\t\tconst resolvedValues = {\n\t\t\tbackground: {},\n\t\t};\n\n\t\tif ( ! inheritedValue?.background ) {\n\t\t\treturn inheritedValue;\n\t\t}\n\n\t\tObject.entries( inheritedValue?.background ).forEach(\n\t\t\t( [ key, backgroundValue ] ) => {\n\t\t\t\tresolvedValues.background[ key ] = getResolvedValue(\n\t\t\t\t\tbackgroundValue,\n\t\t\t\t\t{\n\t\t\t\t\t\tstyles: globalStyles,\n\t\t\t\t\t\t_links,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\treturn resolvedValues;\n\t}, [ globalStyles, _links, inheritedValue ] );\n\n\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably( value, [ 'background' ], {\n\t\t\t\tgradient: value?.background?.gradient,\n\t\t\t} )\n\t\t);\n\n\tconst { title, url } = value?.background?.backgroundImage || {\n\t\t...resolvedInheritedValue?.background?.backgroundImage,\n\t};\n\tconst localHasImageValue = hasBackgroundImageValue( value );\n\tconst hasImageValue =\n\t\tlocalHasImageValue || hasBackgroundImageValue( resolvedInheritedValue );\n\t// The blue-dot local-override affordance is part of the inherited-value\n\t// treatment. When that treatment is disabled (e.g. in the Global Styles\n\t// panel, where the edited value *is* the global style rather than a local\n\t// override of it), fall back to the plain reset control.\n\tconst hasLocalOverride =\n\t\tshowInheritanceLabelIndicators &&\n\t\tlocalHasImageValue &&\n\t\thasBackgroundImageValue( resolvedInheritedValue );\n\n\tconst imageValue =\n\t\tvalue?.background?.backgroundImage ||\n\t\tinheritedValue?.background?.backgroundImage;\n\n\tconst shouldShowBackgroundImageControls =\n\t\thasImageValue &&\n\t\t'none' !== imageValue &&\n\t\t( settings?.background?.backgroundSize ||\n\t\t\tsettings?.background?.backgroundPosition ||\n\t\t\tsettings?.background?.backgroundRepeat );\n\n\tconst [ isDropDownOpen, setIsDropDownOpen ] = useState( false );\n\tconst containerRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ containerRef }\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-global-styles-background-panel__inspector-media-replace-container',\n\t\t\t\t{\n\t\t\t\t\t'is-open': isDropDownOpen,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ shouldShowBackgroundImageControls ? (\n\t\t\t\t<BackgroundControlsPanel\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tfilename={ title }\n\t\t\t\t\turl={ url }\n\t\t\t\t\tonToggle={ setIsDropDownOpen }\n\t\t\t\t\thasImageValue={ hasImageValue }\n\t\t\t\t\thasLocalOverride={ hasLocalOverride }\n\t\t\t\t\tonReset={ localHasImageValue ? resetBackground : undefined }\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 3 } className=\"single-column\">\n\t\t\t\t\t\t<BackgroundImageControls\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tstyle={ value }\n\t\t\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\t\t\tdisplayInPanel\n\t\t\t\t\t\t\tonResetImage={ () => {\n\t\t\t\t\t\t\t\tsetIsDropDownOpen( false );\n\t\t\t\t\t\t\t\tresetBackground();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonRemoveImage={ () => setIsDropDownOpen( false ) }\n\t\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BackgroundSizeControls\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tstyle={ value }\n\t\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</BackgroundControlsPanel>\n\t\t\t) : (\n\t\t\t\t<BackgroundImageControls\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tstyle={ value }\n\t\t\t\t\tinheritedValue={ resolvedInheritedValue }\n\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\tonResetImage={ () => {\n\t\t\t\t\t\tsetIsDropDownOpen( false );\n\t\t\t\t\t\tresetBackground();\n\t\t\t\t\t} }\n\t\t\t\t\tonRemoveImage={ () => setIsDropDownOpen( false ) }\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,wCAAwC;AAAA,EACxC;AAAA,O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,SACC;AAAA,IAAC;AAAA;AAAA,MACA,KAAM;AAAA,MACN,WAAY;AAAA,QACX;AAAA,QACA;AAAA,UACC,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,MAEE,8CACD;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR,UAAW;AAAA,UACX;AAAA,UACA,UAAW;AAAA,UACX;AAAA,UACA;AAAA,UACA,SAAU,qBAAqB,kBAAkB;AAAA,UACjD;AAAA,UAEA,+BAAC,UAAO,SAAU,GAAI,WAAU,iBAC/B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA,OAAQ;AAAA,gBACR,gBAAiB;AAAA,gBACjB,gBAAc;AAAA,gBACd,cAAe,MAAM;AACpB,oCAAmB,KAAM;AACzB,kCAAgB;AAAA,gBACjB;AAAA,gBACA,eAAgB,MAAM,kBAAmB,KAAM;AAAA,gBAC/C;AAAA,gBACA;AAAA;AAAA,YACD;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA,OAAQ;AAAA,gBACR;AAAA,gBACA,gBAAiB;AAAA;AAAA,YAClB;AAAA,aACD;AAAA;AAAA,MACD,IAEA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,OAAQ;AAAA,UACR,gBAAiB;AAAA,UACjB;AAAA,UACA,cAAe,MAAM;AACpB,8BAAmB,KAAM;AACzB,4BAAgB;AAAA,UACjB;AAAA,UACA,eAAgB,MAAM,kBAAmB,KAAM;AAAA,UAC/C;AAAA;AAAA,MACD;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -15,7 +15,9 @@ function BlockAlignmentUI({
15
15
  onChange,
16
16
  controls,
17
17
  isToolbar,
18
- isCollapsed = true
18
+ isCollapsed = true,
19
+ label = __("Align block"),
20
+ description
19
21
  }) {
20
22
  const enabledControls = useAvailableAlignments(controls);
21
23
  const hasEnabledControls = !!enabledControls.length;
@@ -30,7 +32,7 @@ function BlockAlignmentUI({
30
32
  const UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;
31
33
  const commonProps = {
32
34
  icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
33
- label: __("Align")
35
+ label
34
36
  };
35
37
  const extraProps = isToolbar ? {
36
38
  isCollapsed,
@@ -43,7 +45,7 @@ function BlockAlignmentUI({
43
45
  };
44
46
  })
45
47
  } : {
46
- toggleProps: { description: __("Change alignment") },
48
+ toggleProps: description ? { description } : {},
47
49
  children: ({ onClose }) => {
48
50
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MenuGroup, { className: "block-editor-block-alignment-control__menu-group", children: enabledControls.map(
49
51
  ({ name: controlName, info }) => {